/* ============================================
   annual.quest — Design Tokens & Variables
   ============================================ */

:root {
    /* Color Palette — Analogous warm spectrum */
    --color-base: #f0ebe3;
    --color-surface: #e6ddd1;
    --color-text-primary: #2b2520;
    --color-text-secondary: #7a6e62;
    --color-accent: #c4622d;
    --color-accent-secondary: #d4943a;
    --color-accent-tertiary: #d17a5a;
    --color-timeline: #b5704a;
    --color-divider: #8a6040;
    --color-dark: #1a1512;

    /* Typography */
    --font-headline: 'Nunito', sans-serif;
    --font-body: 'Karla', sans-serif;
    --font-mono: 'Space Mono', monospace;

    /* Spacing */
    --grid-gap: clamp(12px, 2vw, 24px);
    --border-radius: clamp(12px, 2vw, 24px);
    --section-overlap: -80px;

    /* Shadows */
    --shadow-offset: 6px 6px 0px var(--color-text-primary);
    --border-thick: 3px solid var(--color-text-primary);
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--color-text-primary);
    background-color: var(--color-base);
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* ============================================
   Concrete Grain Texture Overlay
   ============================================ */

.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
}

.grain-overlay::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 300px 300px;
}

/* ============================================
   Timeline Rail Navigation
   ============================================ */

.timeline-rail {
    position: fixed;
    right: 0;
    top: 0;
    width: 48px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    z-index: 1000;
    padding: 20px 0;
}

.timeline-line {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1px;
    height: 60%;
    background-color: var(--color-timeline);
    opacity: 0.4;
}

.timeline-marker {
    position: relative;
    z-index: 2;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--color-timeline);
    background-color: transparent;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                background-color 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    padding: 0;
}

.timeline-marker.active {
    transform: scale(1.6);
    background-color: var(--color-accent);
    border-color: var(--color-accent);
}

.marker-label {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-timeline);
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    pointer-events: none;
}

.timeline-marker:hover .marker-label {
    opacity: 1;
}

/* Mobile progress bar */
.mobile-progress {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--color-surface);
    z-index: 1001;
}

.mobile-progress-fill {
    height: 100%;
    width: 0%;
    background-color: var(--color-accent);
    transition: width 0.15s linear;
}

/* ============================================
   Section (Stratum) Base Styles
   ============================================ */

.stratum {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    overflow: hidden;
    background-color: var(--color-base);
    z-index: 1;
}

.stratum + .brutalist-divider + .stratum {
    margin-top: var(--section-overlap);
}

.stratum__content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1400px;
    padding: 80px var(--grid-gap);
}

/* ============================================
   10-Column Grid with Zigzag
   ============================================ */

.section-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: var(--grid-gap);
    width: 100%;
}

/* Odd sections: content offset right (leave 2 cols left) */
.content-block--offset-right {
    grid-column: 3 / 11;
}

/* Even sections: content offset left (leave 2 cols right) */
.content-block--offset-left {
    grid-column: 1 / 9;
}

/* Narrow block for The Record */
.content-block--narrow {
    grid-column: 1 / 7;
}

/* Pull-quote gutter */
.pull-quote-gutter {
    grid-column: 8 / 11;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
}

/* ============================================
   Ghost Numerals (Background Watermarks)
   ============================================ */

.ghost-numeral {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-headline);
    font-weight: 800;
    font-size: 20vw;
    color: var(--color-surface);
    opacity: 0.35;
    z-index: 0;
    line-height: 1;
    pointer-events: none;
    will-change: transform;
    user-select: none;
}

.ghost-numeral--inverted {
    color: #2b2520;
    opacity: 0.2;
}

/* ============================================
   Typography
   ============================================ */

.headline {
    font-family: var(--font-headline);
    font-weight: 800;
    font-size: clamp(2.2rem, 6vw, 5.5rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--color-text-primary);
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.headline--hero {
    font-size: clamp(2.8rem, 8vw, 7rem);
}

.headline--inverted {
    color: var(--color-base);
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--color-text-primary);
    max-width: 62ch;
    margin-bottom: 1rem;
    opacity: 0;
    transition: opacity 0.4s ease 0.2s;
}

.body-text.visible {
    opacity: 1;
}

.body-text--inverted {
    color: var(--color-base);
}

.meta-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.meta-label.visible {
    opacity: 1;
}

.meta-label--inverted {
    color: var(--color-accent-tertiary);
}

.meta-label--closing {
    margin-top: 3rem;
    font-size: 0.7rem;
    opacity: 0;
}

/* ============================================
   Brutalist Dividers
   ============================================ */

.brutalist-divider {
    position: relative;
    width: 100%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.divider-bar {
    width: 100%;
    height: 8px;
    background-color: var(--color-divider);
}

.divider-pill {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 8px;
    border-radius: 999px;
    background-color: var(--color-accent);
    transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1;
}

.divider-pill.pulse {
    width: 240px;
}

/* ============================================
   Section: Epoch Zero
   ============================================ */

.stratum--epoch-zero {
    background-color: var(--color-base);
    min-height: 100vh;
}

/* ============================================
   Section: The Cycle (Dual Panels)
   ============================================ */

.cycle-panels {
    display: flex;
    align-items: flex-start;
    gap: var(--grid-gap);
    margin-top: 2rem;
    position: relative;
}

.cycle-panel {
    background-color: var(--color-surface);
    border: var(--border-thick);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-offset);
    padding: clamp(20px, 3vw, 40px);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.cycle-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.cycle-panel--left {
    flex: 0.55;
}

.cycle-panel--right {
    flex: 0.45;
    margin-top: 60px;
}

.cycle-arc {
    position: absolute;
    top: 0;
    left: 40%;
    width: 20%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.panel-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
    color: var(--color-accent);
}

/* ============================================
   Section: Annual Layers (Card Stack)
   ============================================ */

.card-stack {
    margin-top: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.stack-card {
    background-color: var(--color-surface);
    border: var(--border-thick);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-offset);
    padding: clamp(20px, 3vw, 36px);
    margin-top: -60px;
    position: relative;
    z-index: 1;
    cursor: pointer;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                margin-top 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
    max-height: 50px;
    opacity: 0;
}

.stack-card:first-child {
    margin-top: 0;
}

.stack-card.expanded {
    max-height: 400px;
    margin-top: 16px;
    opacity: 1;
}

.stack-card:first-child.expanded {
    margin-top: 0;
}

.stack-card.expanded + .stack-card.expanded {
    margin-top: 16px;
}

.card-number {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--color-accent-secondary);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}

.card-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}

/* ============================================
   Section: The Record
   ============================================ */

.section-grid--record {
    align-items: start;
}

.pull-quote {
    background-color: var(--color-surface);
    border: var(--border-thick);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-offset);
    padding: clamp(16px, 2vw, 28px);
    position: relative;
}

.pull-quote p {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    line-height: 1.3;
    color: var(--color-accent);
    letter-spacing: -0.01em;
}

.quote-arc {
    width: 60px;
    height: 120px;
}

/* ============================================
   Section: Return (Dark Inversion)
   ============================================ */

.stratum--return {
    background-color: var(--color-dark);
    position: relative;
}

.stratum--return::before {
    content: '';
    position: absolute;
    top: -200px;
    left: 0;
    width: 100%;
    height: 200px;
    background: linear-gradient(to bottom, transparent, var(--color-dark));
    pointer-events: none;
    z-index: 4;
}

/* ============================================
   SVG Arc Animations
   ============================================ */

.arc-path {
    transition: stroke-dashoffset 1.2s ease-in-out;
}

.arc-path.drawn {
    stroke-dashoffset: 0;
}

/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .headline,
    .body-text,
    .meta-label,
    .cycle-panel,
    .stack-card {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .arc-path {
        stroke-dashoffset: 0;
        transition: none;
    }

    .ghost-numeral {
        will-change: auto;
    }

    .divider-pill {
        transition: none;
    }
}

/* ============================================
   Responsive — Tablet
   ============================================ */

@media (max-width: 1024px) {
    .content-block--offset-right {
        grid-column: 2 / 11;
    }

    .content-block--offset-left {
        grid-column: 1 / 10;
    }

    .content-block--narrow {
        grid-column: 1 / 8;
    }

    .pull-quote-gutter {
        grid-column: 8 / 11;
    }

    .ghost-numeral {
        font-size: 25vw;
    }
}

/* ============================================
   Responsive — Mobile
   ============================================ */

@media (max-width: 768px) {
    .timeline-rail {
        display: none;
    }

    .mobile-progress {
        display: block;
    }

    .section-grid {
        grid-template-columns: 1fr;
    }

    .content-block--offset-right,
    .content-block--offset-left,
    .content-block--narrow {
        grid-column: 1 / -1;
    }

    .pull-quote-gutter {
        grid-column: 1 / -1;
        margin-top: 2rem;
    }

    .cycle-panels {
        flex-direction: column;
    }

    .cycle-panel--right {
        margin-top: 0;
    }

    .cycle-arc {
        display: none;
    }

    .stratum__content {
        padding: 60px 20px;
    }

    .ghost-numeral {
        font-size: 35vw;
    }

    .headline--hero {
        font-size: clamp(2.2rem, 10vw, 4rem);
    }

    .stack-card {
        margin-top: -40px;
    }

    .stratum {
        min-height: auto;
        min-height: 100svh;
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-base);
}

::-webkit-scrollbar-thumb {
    background: var(--color-timeline);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent);
}
