/* ==========================================================================
   thefirst.quest — a meditative Y2K shrine
   (Scroll triggers handled via IntersectionObserver in script.js)
   Palette:
     #12082a  Midnight Velvet (void)
     #e8a4c8  Chrome Pink (shimmer)
     #f0f0ff  Diamond White (glint)
     #c4848e  Rose Gold (warm)
     #b8a9d4  Platinum Lilac (metal)
     #2d1854  Royal Plum (depth)
     #f5d5c8  Soft Peach (blush)
   ========================================================================== */

:root {
    --void: #12082a;
    --shimmer: #e8a4c8;
    --glint: #f0f0ff;
    --warm: #c4848e;
    --metal: #b8a9d4;
    --depth: #2d1854;
    --blush: #f5d5c8;

    --font-display: "Libre Baskerville", "Times New Roman", serif;
    --font-body: "Quicksand", "Inter", "Segoe UI", system-ui, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--void);
    color: var(--glint);
    overflow-x: hidden;
    font-weight: 300;
    letter-spacing: 0.05em;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}

.shrine {
    position: relative;
    width: 100%;
}

/* ========================================================================
   Section base
   ======================================================================== */
.section {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--glint);
    letter-spacing: 0.02em;
    text-align: center;
    background: linear-gradient(135deg, var(--shimmer), var(--glint), var(--metal), var(--shimmer));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: chromeShift 6s ease-in-out infinite;
}

.section-lede {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    color: var(--metal);
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
    letter-spacing: 0.08em;
}

/* ========================================================================
   SECTION 1 — The First Light
   ======================================================================== */
.section--first-light {
    min-height: 100vh;
    background: radial-gradient(ellipse at 50% 40%, #1b0b3a 0%, var(--void) 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.hero-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 1200px;
    width: 100%;
}

.eyebrow {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.8rem, 1vw, 0.95rem);
    text-transform: uppercase;
    letter-spacing: 0.4em;
    color: var(--metal);
    margin-bottom: 2.5rem;
    opacity: 0.8;
}

.chrome-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 7vw, 6rem);
    line-height: 1.1;
    letter-spacing: 0.01em;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3em;
    background: linear-gradient(135deg, var(--shimmer), var(--glint), var(--metal), var(--shimmer));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: chromeShift 6s ease-in-out infinite;
    text-shadow: 0 0 40px rgba(232, 164, 200, 0.15);
    margin-bottom: 2rem;
}

.chrome-title--small {
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    color: var(--blush);
    margin-bottom: 3rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5em;
    letter-spacing: 0.08em;
}

.word {
    position: relative;
    display: inline-block;
    padding-bottom: 0.15em;
}

.word::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--shimmer), var(--glint), var(--metal));
    transition: width 800ms ease-in-out;
}

.word.is-drawn::after {
    width: 100%;
}

.word-text {
    display: inline-block;
}

.hero-legend {
    font-family: var(--font-body);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5em;
    color: var(--warm);
    margin-top: 2rem;
    opacity: 0.7;
    animation: pulseFade 4s ease-in-out infinite;
}

/* Rhinestone line divider */
.rhinestone-line {
    height: 6px;
    margin: 2rem auto;
    width: min(60%, 400px);
    background-image: radial-gradient(circle, var(--shimmer) 0, var(--shimmer) 2px, transparent 3px, transparent 12px);
    background-size: 12px 6px;
    background-repeat: repeat-x;
    background-position: center;
    filter: drop-shadow(0 0 6px rgba(232, 164, 200, 0.6));
}

.rhinestone-line--floating {
    position: absolute;
    top: var(--top);
    left: var(--left);
    width: var(--w);
    transform: rotate(var(--rot));
    animation: floatDrift 7s ease-in-out infinite, slowSpin 50s linear infinite;
}

/* ========================================================================
   Sparkle field
   ======================================================================== */
.sparkle-field {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.sparkle {
    position: absolute;
    width: var(--size, 3px);
    height: var(--size, 3px);
    border-radius: 50%;
    background: radial-gradient(circle, var(--glint) 0%, rgba(240, 240, 255, 0.6) 40%, transparent 70%);
    box-shadow: 0 0 6px 1px rgba(240, 240, 255, 0.5);
    top: var(--top);
    left: var(--left);
    opacity: 0.3;
    animation: sparkle var(--dur, 3s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

.sparkle-field--dim .sparkle {
    opacity: 0.15;
    animation-duration: 5s;
    background: radial-gradient(circle, rgba(240, 240, 255, 0.6) 0%, transparent 70%);
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0.2;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes chromeShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes pulseFade {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* ========================================================================
   SECTION 2 — The Collection (collage)
   ======================================================================== */
.section--collection {
    min-height: 150vh;
    background: linear-gradient(180deg, var(--void) 0%, #1a0b3a 50%, var(--depth) 100%);
    padding: 6rem 2rem 4rem;
    position: relative;
}

.section--collection::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(232, 164, 200, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(184, 169, 212, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

.collection-heading,
.memory-heading {
    position: relative;
    z-index: 3;
    text-align: center;
    margin-bottom: 4rem;
}

.collage {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 130vh;
}

.collage--dense {
    min-height: 110vh;
}

/* Floating element base */
.frame,
.butterfly,
.heart,
.star,
.chrome-fragment {
    position: absolute;
}

/* Chrome frames */
.frame {
    top: var(--top);
    left: var(--left);
    width: var(--w);
    height: var(--h);
    border: 3px solid transparent;
    border-image: linear-gradient(135deg, var(--shimmer), var(--glint), var(--metal), var(--shimmer)) 1;
    background:
        linear-gradient(135deg, rgba(232, 164, 200, 0.08), rgba(184, 169, 212, 0.06)),
        radial-gradient(circle at 30% 30%, rgba(240, 240, 255, 0.05), transparent 60%);
    transform: rotate(var(--rot));
    box-shadow:
        0 0 30px rgba(232, 164, 200, 0.15),
        inset 0 0 20px rgba(240, 240, 255, 0.05);
    animation: floatDrift 6s ease-in-out infinite, slowSpin 45s linear infinite;
}

.frame::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(240, 240, 255, 0.12);
    pointer-events: none;
}

.frame::after {
    content: '';
    position: absolute;
    inset: 14px;
    background: repeating-linear-gradient(
        135deg,
        rgba(232, 164, 200, 0.04),
        rgba(232, 164, 200, 0.04) 2px,
        transparent 2px,
        transparent 6px
    );
    pointer-events: none;
}

.frame--a { animation-delay: 0s, 0s; }
.frame--b { animation-delay: 1s, 2s; }
.frame--c { animation-delay: 2s, 4s; }
.frame--d { animation-delay: 3s, 1s; }
.frame--e { animation-delay: 0.5s, 3s; }
.frame--f { animation-delay: 1.5s, 5s; }

/* Butterflies */
.butterfly {
    top: var(--top);
    left: var(--left);
    width: calc(80px * var(--scale, 1));
    height: calc(80px * var(--scale, 1));
    fill: var(--shimmer);
    opacity: 0.5;
    transform: rotate(var(--rot));
    animation: floatDrift 7s ease-in-out infinite, slowSpin 55s linear infinite;
    filter: drop-shadow(0 0 8px rgba(232, 164, 200, 0.4));
}

.butterfly path {
    stroke: var(--shimmer);
    stroke-width: 1;
    fill: var(--shimmer);
}

.butterfly--small {
    opacity: 0.4;
}

.butterfly--warm {
    fill: var(--warm);
    filter: drop-shadow(0 0 8px rgba(196, 132, 142, 0.5));
}

.butterfly--warm path {
    stroke: var(--warm);
    fill: var(--warm);
}

/* Stars */
.star {
    top: var(--top);
    left: var(--left);
    width: var(--size);
    height: var(--size);
    background: var(--glint);
    box-shadow: 0 0 12px 4px rgba(240, 240, 255, 0.3);
    animation: starPulse 3s ease-in-out infinite, slowSpin 40s linear infinite;
}

.star--four {
    clip-path: polygon(
        50% 0%, 60% 40%, 100% 50%, 60% 60%,
        50% 100%, 40% 60%, 0% 50%, 40% 40%
    );
}

.star--six {
    clip-path: polygon(
        50% 0%, 58% 35%, 95% 30%, 68% 55%,
        80% 95%, 50% 72%, 20% 95%, 32% 55%,
        5% 30%, 42% 35%
    );
}

@keyframes starPulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.9) rotate(var(--r, 0deg));
    }
    50% {
        opacity: 1;
        transform: scale(1.1) rotate(var(--r, 0deg));
    }
}

/* Hearts */
.heart {
    top: var(--top);
    left: var(--left);
    width: calc(70px * var(--scale, 1));
    height: calc(64px * var(--scale, 1));
    transform: rotate(var(--rot));
    animation: floatDrift 8s ease-in-out infinite;
    filter: drop-shadow(0 0 6px rgba(196, 132, 142, 0.4));
}

.heart path {
    fill: none;
    stroke: var(--warm);
    stroke-width: 2.5;
    stroke-linejoin: round;
}

/* Chrome text fragments */
.chrome-fragment {
    top: var(--top);
    left: var(--left);
    font-family: var(--font-display);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(1.5rem, 3vw, 2.6rem);
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, var(--shimmer), var(--glint), var(--metal), var(--shimmer));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    transform: rotate(var(--rot));
    animation: chromeShift 6s ease-in-out infinite, floatDrift 9s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(232, 164, 200, 0.2);
    white-space: nowrap;
}

.chrome-fragment--sm {
    font-size: clamp(1rem, 2vw, 1.6rem);
}

/* Floating element animations */
@keyframes floatDrift {
    0%, 100% {
        transform: rotate(var(--rot)) translateY(0px);
    }
    50% {
        transform: rotate(var(--rot)) translateY(-12px);
    }
}

@keyframes slowSpin {
    from { --r: 0deg; }
    to { --r: 360deg; }
}

/* ========================================================================
   SECTION 3 — The Pause
   ======================================================================== */
.section--pause {
    min-height: 80vh;
    background: linear-gradient(180deg, var(--depth) 0%, #1a0d4a 50%, #0f0726 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    position: relative;
}

.section--pause::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(184, 169, 212, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.pause-inner {
    max-width: 900px;
    text-align: center;
    z-index: 2;
    position: relative;
}

.pause-text {
    font-family: var(--font-display);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    color: var(--blush);
    line-height: 1.6;
    letter-spacing: 0.06em;
    opacity: 0.9;
}

/* ========================================================================
   SECTION 4 — The Memory
   ======================================================================== */
.section--memory {
    min-height: 120vh;
    background: linear-gradient(180deg, #0f0726 0%, var(--depth) 40%, #1b0b3a 100%);
    padding: 6rem 2rem 4rem;
    position: relative;
}

.section--memory::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 30% 20%, rgba(245, 213, 200, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 70% 80%, rgba(196, 132, 142, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

/* ========================================================================
   SECTION 5 — The Return
   ======================================================================== */
.section--return {
    min-height: 100vh;
    background: linear-gradient(180deg, #1b0b3a 0%, var(--void) 50%, #000000 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 6rem 2rem 4rem;
    position: relative;
    overflow: hidden;
}

.return-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    margin-bottom: 10vh;
    max-width: 1000px;
}

.return-eyebrow {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5em;
    color: var(--warm);
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

.return-legend {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: var(--metal);
    opacity: 0.6;
    margin-top: 1.5rem;
    letter-spacing: 0.1em;
}

.fade-to-black {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.85) 80%, #000 100%);
    pointer-events: none;
    z-index: 1;
}

/* ========================================================================
   Reveal states
   ======================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1200ms ease-out, transform 1200ms ease-out;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in {
    opacity: 0;
    transition: opacity 1500ms ease-out;
}

.fade-in.is-visible {
    opacity: 1;
}

/* ========================================================================
   Responsive adjustments
   ======================================================================== */
@media (max-width: 768px) {
    .chrome-title {
        font-size: clamp(2rem, 10vw, 4rem);
    }

    .collage {
        min-height: 140vh;
    }

    .frame {
        --w: 120px !important;
        --h: 150px !important;
    }

    .chrome-fragment {
        font-size: clamp(1rem, 5vw, 1.8rem);
    }
}
