/* =========================================================
   PRESTIJ TARIM - PUBLIC GALLERY + LIGHTBOX
   ========================================================= */

.page-hero--gallery {
    position: relative;
    overflow: hidden;
}

.gallery-hero-mark {
    min-height: 250px;
    padding: 34px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 28px;
    background:
        linear-gradient(145deg, rgba(255,255,255,.11), rgba(255,255,255,.04));
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    box-shadow: 0 22px 70px rgba(0,0,0,.12);
}

.gallery-hero-mark img {
    width: min(210px, 70%);
    max-height: 85px;
    object-fit: contain;
    object-position: left center;
    filter: brightness(0) invert(1);
    opacity: .92;
}

.gallery-hero-mark > span {
    margin-top: auto;
    color: #fff;
    font-size: clamp(52px, 6vw, 86px);
    line-height: .9;
    font-weight: 900;
    letter-spacing: -.06em;
}

.gallery-hero-mark small {
    margin-top: 12px;
    color: rgba(255,255,255,.67);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.gallery-page-section {
    background:
        radial-gradient(circle at 85% 6%, rgba(10,164,223,.07), transparent 25%),
        #fff;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
}

.gallery-card {
    position: relative;
    grid-column: span 4;
    aspect-ratio: 1.18 / 1;
    padding: 0;
    border: 0;
    border-radius: 22px;
    overflow: hidden;
    background: #edf4ef;
    cursor: zoom-in;
    box-shadow: 0 12px 40px rgba(17,37,28,.07);
    isolation: isolate;
}

.gallery-card:nth-child(8n + 1),
.gallery-card:nth-child(8n + 6) {
    grid-column: span 8;
    aspect-ratio: 2 / 1;
}

.gallery-card img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform .55s cubic-bezier(.2,.7,.2,1);
}

.gallery-card:hover img,
.gallery-card:focus-visible img {
    transform: scale(1.055);
}

.gallery-card__shade {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, transparent 48%, rgba(5,24,16,.62) 100%);
    opacity: .68;
    transition: opacity .25s ease;
}

.gallery-card:hover .gallery-card__shade,
.gallery-card:focus-visible .gallery-card__shade {
    opacity: .9;
}

.gallery-card__zoom {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 3;
    width: 58px;
    height: 58px;
    margin: -29px 0 0 -29px;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.14);
    color: #fff;
    backdrop-filter: blur(12px);
    opacity: 0;
    transform: scale(.78);
    transition: opacity .25s ease, transform .25s ease;
}

.gallery-card:hover .gallery-card__zoom,
.gallery-card:focus-visible .gallery-card__zoom {
    opacity: 1;
    transform: scale(1);
}

.gallery-card__zoom svg {
    width: 25px;
    fill: currentColor;
}

.gallery-card__number {
    position: absolute;
    z-index: 3;
    left: 17px;
    bottom: 15px;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .13em;
}

.gallery-card:focus-visible {
    outline: 3px solid rgba(103,184,48,.35);
    outline-offset: 4px;
}

.gallery-empty {
    padding: 80px 24px;
    border: 1px dashed var(--line);
    border-radius: 24px;
    background: var(--soft);
    text-align: center;
}

.gallery-empty__icon {
    width: 62px;
    height: 62px;
    margin: 0 auto 18px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: #e8f4e3;
    color: var(--green-dark);
    font-size: 27px;
}

.gallery-empty h3 {
    margin: 0 0 8px;
    font-size: 24px;
}

.gallery-empty p {
    margin: 0;
    color: var(--muted);
}

/* Home gallery preview */
.home-gallery-section {
    background: var(--soft);
}

.home-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
}

.home-gallery-card {
    position: relative;
    min-height: 260px;
    border-radius: 20px;
    overflow: hidden;
    background: #eaf1ec;
    box-shadow: var(--shadow-soft);
}

.home-gallery-card:nth-child(1),
.home-gallery-card:nth-child(5) {
    grid-column: span 2;
}

.home-gallery-card img {
    width: 100%;
    height: 100%;
    min-height: 260px;
    display: block;
    object-fit: cover;
    transition: transform .5s ease;
}

.home-gallery-card:hover img {
    transform: scale(1.045);
}

.home-gallery-card__overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 40px 20px 18px;
    background: linear-gradient(180deg, transparent, rgba(6,31,20,.78));
    color: #fff;
}

.home-gallery-card__overlay strong,
.home-gallery-card__overlay small {
    display: block;
}

.home-gallery-card__overlay strong {
    font-size: 14px;
}

.home-gallery-card__overlay small {
    margin-top: 3px;
    color: rgba(255,255,255,.7);
    font-size: 10px;
}

/* Lightbox */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
}

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

.gallery-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3,14,10,.94);
    backdrop-filter: blur(14px);
}

.gallery-lightbox__stage {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    padding: 38px 88px;
    display: grid;
    grid-template-columns: 60px minmax(0,1fr) 60px;
    align-items: center;
    gap: 22px;
}

.gallery-lightbox__figure {
    position: relative;
    width: 100%;
    height: min(82vh, 900px);
    margin: 0;
    display: grid;
    grid-template-rows: minmax(0,1fr) auto;
    align-items: center;
    justify-items: center;
}

.gallery-lightbox__figure img {
    max-width: 100%;
    max-height: calc(82vh - 58px);
    width: auto;
    height: auto;
    border-radius: 15px;
    object-fit: contain;
    opacity: 0;
    transform: scale(.985);
    transition: opacity .2s ease, transform .2s ease;
    box-shadow: 0 28px 80px rgba(0,0,0,.35);
}

.gallery-lightbox__figure img.is-loaded {
    opacity: 1;
    transform: scale(1);
}

.gallery-lightbox__figure figcaption {
    width: min(100%, 900px);
    min-height: 48px;
    padding: 13px 3px 0;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    color: rgba(255,255,255,.72);
    font-size: 11px;
}

.gallery-lightbox__figure figcaption strong {
    color: #fff;
    letter-spacing: .08em;
}

.gallery-lightbox__close {
    position: absolute;
    right: 25px;
    top: 22px;
    z-index: 4;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: 29px;
    line-height: 1;
    cursor: pointer;
}

.gallery-lightbox__nav {
    width: 56px;
    height: 56px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.08);
    color: #fff;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.gallery-lightbox__nav:hover {
    background: rgba(255,255,255,.16);
    transform: scale(1.04);
}

.gallery-lightbox__nav svg {
    width: 27px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gallery-lightbox__loader {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 3px solid rgba(255,255,255,.18);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gallerySpin .7s linear infinite;
}

.gallery-lightbox__loader.is-hidden {
    display: none;
}

body.gallery-lightbox-open {
    overflow: hidden;
}

@keyframes gallerySpin {
    to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-card,
    .gallery-card:nth-child(8n + 1),
    .gallery-card:nth-child(8n + 6) {
        grid-column: span 1;
        aspect-ratio: 1.15 / 1;
    }

    .home-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-gallery-card:nth-child(1),
    .home-gallery-card:nth-child(5) {
        grid-column: span 1;
    }

    .gallery-lightbox__stage {
        padding: 65px 18px 22px;
        grid-template-columns: 46px minmax(0,1fr) 46px;
        gap: 8px;
    }

    .gallery-lightbox__nav {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 620px) {
    .gallery-grid,
    .home-gallery-grid {
        grid-template-columns: 1fr;
    }

    .home-gallery-card {
        min-height: 235px;
    }

    .gallery-lightbox__stage {
        padding: 74px 10px 18px;
        grid-template-columns: 1fr;
    }

    .gallery-lightbox__figure {
        height: calc(100vh - 105px);
    }

    .gallery-lightbox__figure img {
        max-height: calc(100vh - 170px);
    }

    .gallery-lightbox__nav {
        position: absolute;
        z-index: 4;
        top: 50%;
        margin-top: -22px;
    }

    .gallery-lightbox__nav--prev {
        left: 9px;
    }

    .gallery-lightbox__nav--next {
        right: 9px;
    }

    .gallery-lightbox__figure figcaption {
        padding-inline: 8px;
    }
}
