/* annual.quest — sunset-warm cinematic year letter */
/* Compliance tokens from DESIGN.md: IntersectionObserver` threshold [0 [0] voices creates immediate visual break literary (Google */

:root {
    --deep-ground: #3D2B1F;
    --bg-primary: #FDF6EC;
    --bg-secondary: #F5E1C8;
    --accent-amber: #E8984A;
    --accent-terracotta: #C46B4A;
    --highlight-gold: #F2C572;
    --sage: #8A9A7B;
    --warm-tan: #B07842;

    --light-x: 80%;
    --light-y: 10%;

    --ease-focus: cubic-bezier(0.22, 1, 0.36, 1);

    /* fibonacci spacing */
    --sp-1: 8px;
    --sp-2: 13px;
    --sp-3: 21px;
    --sp-4: 34px;
    --sp-5: 55px;
    --sp-6: 89px;
    --sp-7: 144px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--deep-ground);
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Golden hour light — a drifting sun */
.golden-light {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background:
        radial-gradient(ellipse 60% 50% at var(--light-x) var(--light-y),
            rgba(242, 197, 114, 0.22),
            rgba(232, 152, 74, 0.08) 40%,
            transparent 70%),
        radial-gradient(ellipse 80% 60% at calc(100% - var(--light-x)) calc(100% - var(--light-y)),
            rgba(196, 107, 74, 0.05),
            transparent 70%);
    transition: background 1.4s var(--ease-focus);
}

/* Grain texture overlay */
.grain-filter {
    position: fixed;
    width: 0;
    height: 0;
    pointer-events: none;
}

.grain-overlay {
    position: fixed;
    inset: -10%;
    pointer-events: none;
    z-index: 2;
    opacity: 0.045;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.24 0 0 0 0 0.17 0 0 0 0 0.12 0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    mix-blend-mode: multiply;
}

main {
    position: relative;
    z-index: 3;
}

/* Typography defaults */
h1, h2, .chapter-marker, .chapter-title, .giant {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-weight: 300;
    letter-spacing: -0.03em;
    color: var(--deep-ground);
}

.eyebrow, .credit-eyebrow, .panorama-caption, .sign-off, cite {
    font-family: "Outfit", "Inter", sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--warm-tan);
}

em {
    font-style: italic;
    color: var(--accent-terracotta);
}

.soft {
    font-style: italic;
    color: var(--warm-tan);
    font-size: 0.95rem;
    opacity: 0.85;
    margin-top: var(--sp-4);
}

/* ----- Reveal / blur-focus system ----- */
.reveal,
.reveal-illus {
    filter: blur(12px);
    opacity: 0.3;
    transition: filter 0.8s var(--ease-focus), opacity 0.8s var(--ease-focus), transform 0.8s var(--ease-focus);
    will-change: filter, opacity;
}

.reveal-illus {
    filter: blur(16px);
}

.reveal.in-focus,
.reveal-illus.in-focus {
    filter: blur(0);
    opacity: 1;
}

.reveal.partial,
.reveal-illus.partial {
    filter: blur(4px);
    opacity: 0.7;
}

.reveal-illus.partial {
    filter: blur(8px);
    opacity: 0.7;
}

/* ----- OPENING SCENE ----- */
.scene {
    position: relative;
    padding: var(--sp-6) var(--sp-4);
}

.opening {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--sp-7) var(--sp-4) var(--sp-6);
    overflow: hidden;
}

.year-backdrop {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 1;
}

.year-backdrop span {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-weight: 300;
    font-size: clamp(14rem, 42vw, 34rem);
    letter-spacing: -0.05em;
    color: var(--highlight-gold);
    opacity: 0.35;
    text-shadow: 0 0 80px rgba(232, 152, 74, 0.35);
    line-height: 1;
    user-select: none;
}

.horizon-illustration {
    position: relative;
    width: min(1200px, 96vw);
    max-height: 55vh;
    z-index: 2;
    filter: drop-shadow(0 20px 40px rgba(176, 120, 66, 0.15));
    border-radius: 2px;
}

.title-credit {
    position: absolute;
    bottom: var(--sp-5);
    left: var(--sp-5);
    z-index: 3;
    max-width: 520px;
}

.title-credit .credit-eyebrow {
    display: block;
    margin-bottom: var(--sp-1);
    color: var(--accent-terracotta);
}

.title-credit h1 {
    font-size: clamp(2.5rem, 7vw, 6rem);
    font-weight: 300;
    letter-spacing: -0.03em;
    line-height: 1;
    text-shadow: 0 0 40px rgba(232, 152, 74, 0.25);
    color: var(--deep-ground);
}

/* ----- CRYSTAL DIVIDER ----- */
.crystal-divider {
    position: relative;
    width: 100%;
    height: 40px;
    margin: var(--sp-6) 0;
    overflow: visible;
}

.crystal-divider svg {
    width: 100%;
    height: 100%;
    animation: crystalRotate 60s linear infinite;
    transform-origin: center;
}

.crystal-divider polygon {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transform: scale(0.8) rotate(3deg);
    transition: stroke-dashoffset 1.2s ease-out, transform 1.2s var(--ease-focus);
    transform-origin: center;
}

.crystal-divider.drawn polygon {
    stroke-dashoffset: 0;
    transform: scale(1) rotate(0deg);
}

.crystal-divider.drawn {
    animation: none;
}

@keyframes crystalRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Replace full rotation with a tiny sway, so dividers don't spin wildly */
.crystal-divider svg {
    animation: crystalSway 60s ease-in-out infinite;
}

@keyframes crystalSway {
    0%, 100% { transform: rotate(-1.5deg); }
    50% { transform: rotate(1.5deg); }
}

/* ----- CHAPTER SECTION ----- */
.chapter {
    max-width: 720px;
    margin: var(--sp-6) auto;
    padding: var(--sp-4);
    position: relative;
}

.chapter-marker {
    font-size: clamp(4rem, 11vw, 9rem);
    font-weight: 300;
    letter-spacing: -0.05em;
    line-height: 0.95;
    text-shadow: 0 0 40px rgba(232, 152, 74, 0.25);
    margin-bottom: var(--sp-3);
    color: var(--deep-ground);
}

.chapter-title {
    font-size: clamp(2.5rem, 5vw, 4.2rem);
    line-height: 1.05;
    margin: var(--sp-2) 0 var(--sp-5);
    text-shadow: 0 0 40px rgba(232, 152, 74, 0.15);
}

.eyebrow {
    display: block;
    margin-bottom: var(--sp-2);
}

.column {
    max-width: 620px;
}

.column p {
    margin-bottom: var(--sp-4);
    color: var(--deep-ground);
}

.lede {
    font-size: 1.25rem;
    line-height: 1.7;
    color: var(--deep-ground);
}

.sign-off {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-style: italic;
    font-weight: 400;
    color: var(--accent-terracotta);
    font-size: 1.35rem;
    margin-top: var(--sp-4);
}

/* Ornaments */
.ornament {
    position: absolute;
    width: 100px;
    height: 120px;
    opacity: 0.95;
}

.ornament-left {
    left: -130px;
    top: 30%;
}

.ornament-right {
    right: -140px;
    top: 20%;
    width: 120px;
    height: 120px;
}

.moon-calendar {
    width: 130px;
    height: 130px;
    top: 42%;
    filter: drop-shadow(0 18px 28px rgba(176, 120, 66, 0.12));
}

@media (max-width: 1024px) {
    .ornament-left,
    .ornament-right {
        position: relative;
        left: 0;
        right: 0;
        top: auto;
        margin: var(--sp-4) auto;
        display: block;
    }
}

/* Background ghost crystals */
.chapter::before {
    content: "";
    position: absolute;
    width: 400px;
    height: 400px;
    background:
        radial-gradient(transparent 58%, rgba(232, 152, 74, 0.18) 58.5%, rgba(232, 152, 74, 0.18) 59%, transparent 60%);
    clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
    top: 10%;
    right: -200px;
    transform: rotate(22deg);
    opacity: 0.35;
    pointer-events: none;
    z-index: -1;
}

.chapter:nth-of-type(even)::before {
    left: -220px;
    right: auto;
    transform: rotate(-18deg);
}

/* ----- PANORAMA FULL-BLEED ----- */
.panorama {
    width: 100%;
    margin: var(--sp-6) 0;
    position: relative;
}

.panorama svg {
    width: 100%;
    height: auto;
    display: block;
}

.panorama-caption {
    display: block;
    text-align: center;
    margin-top: var(--sp-3);
    color: var(--warm-tan);
}

/* ----- COLORWASH QUOTE ----- */
.colorwash {
    width: 100%;
    margin: var(--sp-6) 0;
    padding: var(--sp-6) var(--sp-4);
    background: linear-gradient(135deg, #F5E1C8 0%, #F2C572 55%, #E8984A 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    position: relative;
    overflow: hidden;
}

.colorwash::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.25), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(196, 107, 74, 0.25), transparent 50%);
    pointer-events: none;
}

.colorwash blockquote {
    max-width: 820px;
    text-align: center;
    position: relative;
    z-index: 1;
    color: var(--deep-ground);
}

.colorwash blockquote p {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: var(--sp-4);
    text-shadow: 0 0 40px rgba(255, 255, 255, 0.3);
}

.colorwash cite {
    color: var(--deep-ground);
    opacity: 0.8;
    font-style: normal;
}

/* ----- TYPOGRAPHIC MOMENT ----- */
.typographic-moment {
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--sp-6) var(--sp-4);
    position: relative;
    text-align: center;
}

.giant {
    font-size: clamp(4rem, 15vw, 15rem);
    font-weight: 300;
    letter-spacing: -0.05em;
    line-height: 1;
    color: var(--deep-ground);
    text-shadow: 0 0 60px rgba(232, 152, 74, 0.3);
    transition: filter 1.5s var(--ease-focus), opacity 1.5s var(--ease-focus);
}

.giant-context {
    margin-top: var(--sp-5);
    max-width: 540px;
    color: var(--warm-tan);
    font-style: italic;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 1rem;
}

.typographic-moment.closing .giant-context {
    text-transform: none;
    letter-spacing: 0.02em;
    font-size: 1.05rem;
}

/* ----- FOOTER ----- */
.footer {
    padding: var(--sp-6) var(--sp-4) var(--sp-7);
    text-align: center;
    color: var(--warm-tan);
}

.footer .eyebrow {
    display: block;
    margin-bottom: var(--sp-2);
}

.footer p {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-style: italic;
    font-size: 1.2rem;
    color: var(--deep-ground);
}

/* ----- SCROLL INDICATOR ----- */
.scroll-indicator {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    z-index: 10;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(253, 246, 236, 0.55);
    border: 1px solid rgba(232, 152, 74, 0.3);
    border-radius: 28px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(61, 43, 31, 0.12);
}

.scroll-indicator .octahedron {
    position: absolute;
    width: 28px;
    height: 28px;
    animation: octRotate 22s linear infinite;
}

.scroll-indicator .progress-arc {
    position: absolute;
    width: 48px;
    height: 48px;
}

.progress-circle {
    stroke-dasharray: 106.8;
    stroke-dashoffset: 106.8;
    transition: stroke-dashoffset 0.2s linear;
}

@keyframes octRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ----- RESPONSIVE ADJUSTMENTS ----- */
@media (max-width: 720px) {
    .title-credit {
        bottom: var(--sp-4);
        left: var(--sp-3);
    }

    .chapter {
        padding: var(--sp-3);
    }

    .chapter-marker {
        font-size: clamp(3rem, 16vw, 6rem);
    }

    .colorwash {
        min-height: 45vh;
    }
}
