/* ═══════════════════════════════════════════
   WEDDING GALLERY V4 — MOBILE-FIRST
   Portrait hero. Scroll-pan landscapes.
   Clip-path reveals. Breathing sections.
   ═══════════════════════════════════════════ */

:root {
    --bg: #0a0908;
    --text: #ede8e0;
    --muted: rgba(237, 232, 224, .5);
    --accent: #c9a96e;
    --pad: clamp(1rem, 4vw, 3rem);
    --gap: clamp(.625rem, 2vw, 1rem);
    --ff-d: 'Playfair Display', Georgia, serif;
    --ff-b: 'Inter', -apple-system, sans-serif;
    --ff-a: 'Crimson Pro', Georgia, serif;
    --ease: cubic-bezier(.22, .61, .36, 1);
    --r: 2px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--ff-b);
    font-size: clamp(1rem, 3vw, 1.125rem);
    font-weight: 300;
    line-height: 1.8;
    overflow-x: hidden;
}

img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font: inherit;
}

/* ═══════════ PRELOADER ═══════════ */
#preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pre-inner {
    text-align: center;
}

.pre-names {
    font-family: var(--ff-d);
    font-size: clamp(1.75rem, 7vw, 3.5rem);
    font-weight: 400;
    letter-spacing: .04em;
    opacity: 0;
}

.pre-names em {
    font-family: var(--ff-a);
    font-style: italic;
    color: var(--accent);
    margin: 0 .15em;
}

.pre-line {
    display: block;
    width: 0;
    height: 1px;
    background: var(--accent);
    margin: .75rem auto;
}

/* ═══════════ FAB ═══════════ */
.fab {
    position: fixed;
    bottom: 1.25rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1rem;
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 100px;
    font-size: .7rem;
    font-weight: 400;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(16px);
    transition: all .6s var(--ease);
}

.fab.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ═══════════ HERO ═══════════ */
.hero {
    position: relative;
    height: 100svh;
    min-height: 600px;
    overflow: hidden;
}

.hero-img {
    position: absolute;
    inset: 0;
}

.hero-img img {
    object-position: center 30%;
    /* face is usually upper third */
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(0deg, var(--bg) 0%, transparent 50%),
        linear-gradient(180deg, rgba(10, 9, 8, .3) 0%, transparent 25%);
}

.hero-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0 var(--pad) 14vh;
    z-index: 2;
}

.hero-kicker {
    font-family: var(--ff-a);
    font-style: italic;
    font-size: clamp(.75rem, 2vw, .875rem);
    color: var(--accent);
    letter-spacing: .15em;
    text-transform: uppercase;
    opacity: 0;
    margin-bottom: .25rem;
}

.hero-title {
    font-family: var(--ff-d);
    font-size: clamp(2rem, 8vw, 4.5rem);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: .02em;
    opacity: 0;
    transform: translateY(30px);
}

.hero-title em {
    font-family: var(--ff-a);
    font-style: italic;
    color: var(--accent);
}

.scroll-cue {
    position: absolute;
    bottom: 4vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    opacity: 0;
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: var(--accent);
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: .3;
        transform: scaleY(1);
    }

    50% {
        opacity: 1;
        transform: scaleY(.5);
    }
}

/* ═══════════ ACT SECTIONS ═══════════ */
.act {
    padding: 5rem var(--pad) 2rem;
}

.act--compact {
    padding-top: 2rem;
}

.act-label {
    margin-bottom: .5rem;
}

.act-label span {
    font-family: var(--ff-b);
    font-size: .7rem;
    font-weight: 400;
    letter-spacing: .3em;
    color: var(--accent);
    text-transform: uppercase;
    opacity: 0;
}

.act-title {
    font-family: var(--ff-d);
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 400;
    letter-spacing: .02em;
    margin-bottom: .75rem;
    opacity: 0;
    transform: translateY(20px);
}

.act-narrative {
    font-family: var(--ff-a);
    font-style: italic;
    font-size: clamp(1rem, 3vw, 1.25rem);
    line-height: 2;
    color: rgba(237, 232, 224, .72);
    max-width: 32ch;
    margin-bottom: 2rem;
    opacity: 0;
}

.whisper {
    font-family: var(--ff-a);
    font-style: italic;
    font-size: clamp(.875rem, 2.5vw, 1rem);
    color: var(--muted);
    line-height: 1.8;
    max-width: 28ch;
    padding: 1rem 0 1.5rem;
    opacity: 0;
}

/* ═══════════════════════════════════
   PAN-FRAME — The core mobile innovation
   Landscape image in a tall portrait window.
   Image pans horizontally as you scroll vertically.
   ═══════════════════════════════════ */
.pan-frame {
    position: relative;
    width: 100%;
    height: 65vh;
    min-height: 350px;
    overflow: hidden;
    border-radius: var(--r);
    margin-bottom: var(--gap);
}

.pan-frame--tall {
    height: 80vh;
}

.pan-frame img {
    position: absolute;
    top: 0;
    left: 0;
    width: 150%;
    /* wider than container for panning room */
    height: 100%;
    object-fit: cover;
    will-change: transform;
}

/* Starting positions now set dynamically by JS based on data-focus-x */

/* ═══════════════════════════════════
   PORTRAIT-FRAME — Full-bleed portrait images
   These fill the phone screen edge-to-edge.
   ═══════════════════════════════════ */
.portrait-frame {
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: var(--r);
    margin-bottom: var(--gap);
    opacity: 0;
    transform: translateY(16px);
}

.portrait-frame.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .9s var(--ease), transform .9s var(--ease);
}

.portrait-frame--hero {
    margin-left: calc(-1 * var(--pad));
    margin-right: calc(-1 * var(--pad));
    width: calc(100% + 2 * var(--pad));
    border-radius: 0;
    margin-bottom: 1.5rem;
}

.portrait-frame--small {
    max-width: 260px;
    margin: 0 auto var(--gap);
}

/* ═══════════════════════════════════
   REVEAL-FRAME — Clip-path reveals
   Circle or vertical split, animated on scroll.
   ═══════════════════════════════════ */
.reveal-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: var(--r);
    margin-bottom: var(--gap);
}

/* Circle: starts as tiny dot, expands to full */
.reveal-frame[data-reveal="circle"] {
    clip-path: circle(0% at 50% 50%);
}

.reveal-frame[data-reveal="circle"].revealed {
    clip-path: circle(75% at 50% 50%);
    transition: clip-path 1.2s var(--ease);
}

/* Vertical split: two halves open like doors */
.reveal-frame[data-reveal="vertical-split"] {
    clip-path: inset(0 50% 0 50%);
}

.reveal-frame[data-reveal="vertical-split"].revealed {
    clip-path: inset(0 0 0 0);
    transition: clip-path 1s var(--ease);
}

/* ═══════════════════════════════════
   PAIR-FRAME — Two images side by side
   Gemini-paired images shown together.
   ═══════════════════════════════════ */
.pair-frame {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    margin-bottom: var(--gap);
}

.pair-img {
    aspect-ratio: 1 / 1;
    /* square crop for pairs — shows faces */
    overflow: hidden;
    border-radius: var(--r);
    opacity: 0;
    transform: translateY(12px);
}

.pair-img.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .7s var(--ease), transform .7s var(--ease);
}

/* ═══════════════════════════════════
   BREATH — Emotional punctuation
   Dark screen. Single line of text fades in.
   ═══════════════════════════════════ */
.breath {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    padding: 3rem var(--pad);
    text-align: center;
}

.breath--img {
    min-height: auto;
    padding: 4rem var(--pad);
}

.breath--tall {
    padding: 3rem var(--pad) 5rem;
}

.breath-text {
    font-family: var(--ff-d);
    font-size: clamp(1.25rem, 4vw, 2rem);
    font-weight: 400;
    line-height: 1.5;
    color: rgba(237, 232, 224, .65);
    opacity: 0;
    transform: translateY(12px);
}

/* ═══════════════════════════════════
   GOODBYE — Fade to pure black
   ═══════════════════════════════════ */
.goodbye-frame {
    position: relative;
    width: calc(100% + 2 * var(--pad));
    margin-left: calc(-1 * var(--pad));
    height: 85vh;
    overflow: hidden;
}

.goodbye-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 75% 30%;
    /* Center on the forehead kiss */
    position: absolute;
    top: 0;
    left: 0;
}

.goodbye-dark {
    position: absolute;
    inset: 0;
    background: var(--bg);
    opacity: 0;
}

.goodbye-frame.dimmed img {
    /* no darkening — let the moment breathe */
}

.goodbye-frame.dimmed .goodbye-dark {
    opacity: 0;
}

.goodbye-text {
    position: absolute;
    bottom: 15vh;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--ff-d);
    font-size: clamp(1.25rem, 4vw, 2rem);
    padding: 0 var(--pad);
    opacity: 0;
    transform: translateY(16px);
    z-index: 2;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8), 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* ═══════════ CREDITS ═══════════ */
.credits {
    padding: 5rem var(--pad) 7rem;
    text-align: center;
    opacity: 0;
}

.credits-line {
    display: block;
    width: 0;
    height: 1px;
    background: var(--accent);
    margin: .75rem auto;
}

.credits-names {
    font-family: var(--ff-d);
    font-size: clamp(1.25rem, 4vw, 2rem);
    font-weight: 400;
    letter-spacing: .04em;
}

.credits-year {
    font-family: var(--ff-a);
    font-size: .8rem;
    color: var(--muted);
    letter-spacing: .2em;
}

.credits-note {
    font-family: var(--ff-a);
    font-style: italic;
    font-size: .75rem;
    color: var(--muted);
}

/* ═══════════ GALLERY OVERLAY ═══════════ */
.gallery {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: var(--bg);
    transform: translateY(100%);
    transition: transform .5s var(--ease);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.gallery.open {
    transform: translateY(0);
}

.gallery-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem var(--pad);
    background: rgba(10, 9, 8, .92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.gallery-bar h3 {
    font-family: var(--ff-b);
    font-size: .75rem;
    font-weight: 400;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.gallery-close {
    font-size: 1.5rem;
    line-height: 1;
    opacity: .6;
}

.gallery-grid {
    padding: var(--gap);
    columns: 2;
    column-gap: var(--gap);
}

.gallery-grid img {
    width: 100%;
    border-radius: var(--r);
    margin-bottom: var(--gap);
    break-inside: avoid;
    cursor: pointer;
}

/* ═══════════ LIGHTBOX ═══════════ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(0, 0, 0, .96);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s var(--ease);
}

.lightbox.open {
    opacity: 1;
    pointer-events: auto;
}

.lb-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.lightbox img {
    max-width: 94vw;
    max-height: 88vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--r);
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.lightbox.open img {
    pointer-events: auto;
}

.lb-close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    font-size: 1.75rem;
    opacity: .6;
    z-index: 10;
}

.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.25rem;
    opacity: .4;
    z-index: 10;
    padding: .75rem;
}

.lb-prev {
    left: .25rem;
}

.lb-next {
    right: .25rem;
}

.lb-count {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: .7rem;
    color: var(--muted);
    letter-spacing: .1em;
    z-index: 1;
    pointer-events: none;
}

/* ═══════════ DESKTOP 768+ ═══════════ */
@media (min-width: 768px) {
    .pan-frame {
        height: 75vh;
    }

    .pan-frame--tall {
        height: 90vh;
    }

    .portrait-frame--hero {
        max-width: 500px;
        margin: 0 auto 2rem;
        border-radius: var(--r);
        width: 100%;
    }

    .portrait-frame--small {
        max-width: 320px;
    }

    .act {
        max-width: 900px;
        margin: 0 auto;
        padding-top: 7rem;
    }

    .breath {
        min-height: 60vh;
    }

    .gallery-grid {
        columns: 3;
    }

    .pair-img {
        aspect-ratio: 3 / 2;
    }
}

/* ═══════════ LARGE DESKTOP 1200+ ═══════════ */
@media (min-width: 1200px) {
    .pan-frame {
        height: 80vh;
    }

    .act {
        max-width: 1100px;
    }

    .gallery-grid {
        columns: 4;
    }

    .portrait-frame--hero {
        max-width: 600px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}