/* Wedding Souls.in — home gallery (gallery.js, scripts/edits/gallery_section.py).

   Default (phones, tablets, reduced motion, no script): a strip that scrolls
   sideways inside itself and snaps to each photo. On wide screens gallery.js adds
   .is-pinned to the section: the stage holds the screen and the track slides
   sideways as the page scrolls. Only transform, opacity and clip-path animate. */

.gallery-lede {
    max-width: 34rem;
    margin: 0 0 1.5rem;
    color: var(--_color---nobel);
    font-size: 1.05rem;
    line-height: 1.5;
}

.gallery-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 2rem;
}

.gallery-chip {
    padding: .5rem .95rem;
    border: 1px solid var(--_color---white-15);
    border-radius: 999px;
    color: var(--_color---white);
    font-size: .875rem;
    line-height: 1;
    text-decoration: none;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.gallery-chip:hover,
.gallery-chip[aria-current="true"] {
    border-color: var(--_color---granadier);
    background-color: var(--_color---orange-10);
}

.gallery-chip:focus-visible {
    outline: 2px solid var(--_color---white);
    outline-offset: 2px;
}

/* ---- stage and track ------------------------------------------------------ */

.gallery-stage {
    position: relative;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.gallery-stage::-webkit-scrollbar {
    display: none;
}

.gallery-track {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2.4vw, 2.5rem);
    width: max-content;
    padding: 1rem 7.5vw 2.5rem;
}

.gallery-chapter-card {
    flex: 0 0 auto;
    width: min(72vw, 22rem);
    padding-right: 1rem;
    scroll-snap-align: start;
    scroll-margin-left: 7.5vw;
}

.gallery-chapter-no {
    display: block;
    margin-bottom: 1rem;
    color: var(--_color---granadier);
    font-size: .8rem;
    letter-spacing: .2em;
}

.gallery-chapter-title {
    margin: 0 0 .75rem;
    color: var(--_color---white);
    font-family: var(--font-family--display);
    font-size: clamp(2.25rem, 5vw, 4.25rem);
    font-weight: var(--fonts-weight--semi-bold);
    line-height: 1;
}

.gallery-chapter-line {
    margin: 0;
    color: var(--_color---nobel);
    font-size: 1rem;
    line-height: 1.5;
}

/* A thin gold rule ties each chapter card to the photos that follow it. */
.gallery-chapter-title::after {
    content: "";
    display: block;
    width: 3rem;
    height: 1px;
    margin-top: 1.25rem;
    background: linear-gradient(90deg, #d4a24c, transparent);
}

.gallery-frame {
    flex: 0 0 auto;
    position: relative;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
    scroll-snap-align: center;
    perspective: 1200px;
}

.gallery-frame--portrait {
    height: min(62vh, 30rem);
    aspect-ratio: 2 / 3;
}

.gallery-frame--landscape {
    height: min(62vh, 30rem);
    aspect-ratio: 3 / 2;
}

.gallery-frame-inner {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: .35rem;
    box-shadow: 0 1.5rem 3rem -1.5rem rgba(0, 0, 0, .8), 0 0 0 1px rgba(212, 162, 76, .18);
    transform-origin: left center;
}

.gallery-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s cubic-bezier(.23, 1, .32, 1);
}

.gallery-frame:hover .gallery-image {
    transform: scale(1.04);
}

.gallery-frame:focus-visible {
    outline: none;
}

.gallery-frame:focus-visible .gallery-frame-inner {
    box-shadow: 0 0 0 2px var(--_color---white), 0 1.5rem 3rem -1.5rem rgba(0, 0, 0, .8);
}

.gallery-progress {
    display: none;
}

/* ---- pinned (wide screens, motion allowed) -------------------------------- */

.gallery-section.is-pinned .gallery-stage {
    height: 100vh;
    overflow: hidden;
    scroll-snap-type: none;
    display: flex;
    align-items: center;
}

.gallery-section.is-pinned .gallery-track {
    padding-bottom: 0;
    will-change: transform;
}

.gallery-section.is-pinned .gallery-frame--portrait,
.gallery-section.is-pinned .gallery-frame--landscape {
    height: 68vh;
}

/* The photo is wider than its frame so it can drift against the scroll. */
.gallery-section.is-pinned .gallery-image {
    width: 116%;
    max-width: none;
    margin-left: -8%;
}

.gallery-section.is-pinned .gallery-progress {
    position: absolute;
    left: 7.5vw;
    right: 7.5vw;
    bottom: 2.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    color: var(--_color---nobel);
    font-size: .8rem;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.gallery-progress-label {
    flex: 0 0 auto;
    min-width: 11rem;
}

.gallery-progress-rule {
    flex: 1 1 auto;
    height: 1px;
    background-color: var(--_color---white-15);
}

.gallery-progress-fill {
    display: block;
    height: 100%;
    background-color: var(--_color---granadier);
    transform: scaleX(0);
    transform-origin: left center;
}

/* ---- lightbox ------------------------------------------------------------- */

.gallery-lightbox {
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(4, 2, 0, .96);
    color: var(--_color---white);
}

.gallery-lightbox::backdrop {
    background: rgba(4, 2, 0, .8);
}

.gallery-lightbox[open] {
    display: grid;
    grid-template-rows: 1fr auto;
    place-items: center;
    animation: gallery-lightbox-in .32s cubic-bezier(.23, 1, .32, 1);
}

.gallery-lightbox img {
    max-width: 92vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: .25rem;
}

.gallery-lightbox-caption {
    max-width: 44rem;
    padding: 1rem 1.5rem 1.75rem;
    color: var(--_color---nobel);
    font-size: .95rem;
    line-height: 1.5;
    text-align: center;
}

.gallery-lightbox-button {
    position: absolute;
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--_color---white-30);
    border-radius: 50%;
    background: rgba(4, 2, 0, .5);
    color: var(--_color---white);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color .2s ease, transform .16s cubic-bezier(.23, 1, .32, 1);
}

.gallery-lightbox-button:hover {
    background-color: var(--_color---granadier);
}

.gallery-lightbox-button:active {
    transform: scale(.95);
}

.gallery-lightbox-button:focus-visible {
    outline: 2px solid var(--_color---white);
    outline-offset: 2px;
}

.gallery-lightbox-close {
    top: 1.25rem;
    right: 1.25rem;
}

.gallery-lightbox-prev {
    top: 50%;
    left: 1.25rem;
    margin-top: -1.5rem;
}

.gallery-lightbox-next {
    top: 50%;
    right: 1.25rem;
    margin-top: -1.5rem;
}

@keyframes gallery-lightbox-in {
    from {
        opacity: 0;
        transform: scale(.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media screen and (max-width: 767px) {
    .gallery-frame--portrait,
    .gallery-frame--landscape {
        height: min(58vh, 26rem);
    }

    .gallery-frame--landscape {
        aspect-ratio: auto;
        width: 86vw;
        height: auto;
    }

    .gallery-frame--landscape .gallery-frame-inner {
        aspect-ratio: 3 / 2;
    }

    .gallery-lightbox-prev,
    .gallery-lightbox-next {
        top: auto;
        bottom: 1rem;
        margin-top: 0;
    }

    /* Clear of the arrow buttons, which move to the bottom corners on phones. */
    .gallery-lightbox-caption {
        padding: 1rem 4.5rem 5rem;
    }
}

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

    .gallery-frame:hover .gallery-image {
        transform: none;
    }

    .gallery-lightbox[open] {
        animation: none;
    }
}
