/*
* איצאב מתכות - עיצוב דף הגלריה
* גרסה: 2.0 - bronze/dark design
*/

.gallery-filters {
    padding: 2rem 0 4rem;
}

.filter-options {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-options li {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.8rem 1.8rem;
    cursor: pointer;
    border-radius: 50px;
    transition: var(--transition);
    font-weight: 600;
    font-family: var(--font-body);
    font-size: var(--text-sm);
}

.filter-options li.active,
.filter-options li:hover {
    background-color: var(--primary-color);
    color: var(--dark-color);
    border-color: var(--primary-color);
}

.gallery-section {
    padding-top: 0;
}

.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.gallery-container.gallery-masonry {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 200px;
    grid-auto-flow: dense;
}

.gallery-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    height: 280px;
    cursor: pointer;
    box-shadow: var(--box-shadow);
}

.gallery-masonry .gallery-card {
    height: auto;
    min-height: 220px;
    grid-row: span 2;
}

.gallery-masonry .gallery-card--tall {
    grid-row: span 3;
}

.gallery-masonry .gallery-card--wide {
    grid-column: span 2;
    grid-row: span 2;
}

.gallery-card-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
    background-color: var(--primary-color);
    color: var(--dark-color);
    font-size: var(--text-xs);
    font-weight: 700;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    pointer-events: none;
}

.rtl .gallery-card-badge {
    right: auto;
    left: 1rem;
}

.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

.gallery-masonry .gallery-card img {
    min-height: 220px;
}

.gallery-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2rem;
    background: linear-gradient(to top, rgba(33, 37, 41, 0.92), transparent);
    color: var(--light-text);
    transform: translateY(100%);
    transition: transform 0.35s ease;
}

.gallery-card-overlay h3 {
    color: var(--light-text);
    font-family: var(--font-display);
    margin-bottom: 0.5rem;
}

.gallery-card-desc {
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    margin: 0;
    opacity: 0.9;
}

.gallery-card:hover .gallery-card-overlay,
.gallery-card:focus-within .gallery-card-overlay {
    transform: translateY(0);
}

.image-hover-zoom:hover img,
.gallery-card:hover img {
    transform: scale(1.08);
}

.gallery-masonry > .gallery-card {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.gallery-masonry > .gallery-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .gallery-card img,
    .gallery-card-overlay,
    .gallery-masonry > .gallery-card {
        transition: none;
        transform: none;
        opacity: 1;
    }

    .gallery-card:hover img {
        transform: none;
    }

    .gallery-card-overlay {
        transform: translateY(0);
        background: linear-gradient(to top, rgba(33, 37, 41, 0.75), transparent);
    }
}

.load-more {
    text-align: center;
    margin-top: 4rem;
}

.gallery-modal {
    --modal-info-peek: 72px;
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    height: 100dvh;
    overflow: hidden;
}

.gallery-modal.is-open {
    display: block;
}

.gallery-modal__backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(33, 37, 41, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
}

.gallery-modal__stage {
    position: absolute;
    inset: 0;
    bottom: var(--modal-info-peek);
    overflow: hidden;
    cursor: zoom-in;
    z-index: 1;
}

.gallery-modal__viewport {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.gallery-modal__stage.is-zoomed {
    cursor: grab;
}

.gallery-modal__stage.is-panning {
    cursor: grabbing;
}

#modal-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.2s ease;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
}

.gallery-modal__stage.is-panning #modal-image,
.gallery-modal__stage.is-zoomed #modal-image {
    transition: none;
}

.gallery-modal__toolbar {
    position: fixed;
    top: 1rem;
    inset-inline-end: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 2003;
}

.gallery-modal__toolbar button,
.gallery-modal .modal-prev,
.gallery-modal .modal-next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    background-color: rgba(33, 37, 41, 0.75);
    color: var(--light-text);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.gallery-modal__toolbar button:hover,
.gallery-modal .modal-prev:hover,
.gallery-modal .modal-next:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--dark-color);
}

.gallery-modal .close-modal {
    font-size: var(--text-lg);
}

.gallery-modal .modal-prev,
.gallery-modal .modal-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2003;
}

.gallery-modal .modal-prev {
    inset-inline-start: 1rem;
}

.gallery-modal .modal-next {
    inset-inline-end: 1rem;
}

.gallery-modal__info {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2002;
    max-height: var(--modal-info-peek);
    padding: 0.875rem 1.5rem 1.125rem;
    background: linear-gradient(to top, rgba(33, 37, 41, 0.98) 55%, rgba(33, 37, 41, 0.88));
    color: var(--light-text);
    cursor: pointer;
    overflow: hidden;
    transition: max-height 0.3s ease;
    text-align: start;
}

.gallery-modal__info.is-expanded {
    max-height: 40vh;
    overflow-y: auto;
    cursor: default;
    background: rgba(33, 37, 41, 0.98);
}

.gallery-modal__info h3 {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-modal__info.is-expanded h3 {
    white-space: normal;
}

.gallery-modal__info p {
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
    color: var(--light-gray);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent);
    mask-image: linear-gradient(to bottom, #000 35%, transparent);
}

.gallery-modal__info.is-expanded p {
    display: block;
    -webkit-line-clamp: unset;
    -webkit-mask-image: none;
    mask-image: none;
}

@media (prefers-reduced-motion: reduce) {
    #modal-image,
    .gallery-modal__info {
        transition: none;
    }
}

.contact-cta {
    background-color: var(--dark-color);
    color: var(--light-text);
    padding: 6rem 0;
    margin-top: 5rem;
    text-align: center;
}

.contact-cta .section-title,
.contact-cta .section-subtitle {
    color: var(--light-text);
}

.contact-cta .section-title::after {
    background-color: var(--primary-color);
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.cta-buttons .cta-button-secondary {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.cta-buttons .cta-button-secondary:hover {
    background-color: var(--primary-color);
    color: var(--dark-color);
}

.page-header {
    background: linear-gradient(135deg, var(--dark-color) 0%, #343a40 100%);
    color: var(--light-text);
}

.page-header h1 {
    color: var(--light-text);
    font-family: var(--font-display);
}

.page-header p {
    color: var(--light-gray);
    max-width: var(--prose-max);
    margin: 0 auto;
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
}

@media screen and (max-width: 992px) {
    .gallery-container.gallery-masonry {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .filter-options {
        flex-direction: column;
        align-items: center;
    }

    .filter-options li {
        width: 100%;
        max-width: 300px;
        text-align: center;
    }

    .gallery-container.gallery-masonry {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }

    .gallery-masonry .gallery-card--wide {
        grid-column: span 1;
    }

    .gallery-masonry .gallery-card,
    .gallery-masonry .gallery-card--tall {
        grid-row: span 1;
        min-height: 240px;
    }

    .gallery-modal {
        --modal-info-peek: 64px;
    }

    .gallery-modal__toolbar {
        top: 0.75rem;
        inset-inline-end: 0.75rem;
    }

    .gallery-modal__toolbar button,
    .gallery-modal .modal-prev,
    .gallery-modal .modal-next {
        width: 2.5rem;
        height: 2.5rem;
    }

    .gallery-modal .modal-prev {
        inset-inline-start: 0.5rem;
    }

    .gallery-modal .modal-next {
        inset-inline-end: 0.5rem;
    }

    .gallery-modal__info {
        padding: 0.75rem 1rem 1rem;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
}
