/* ============================================================
   annual.quest -- v2
   Mid-century perpetual-calendar almanac timeline
   Palette: sepia-nostalgic, brass + linen + seasonal accents
   ============================================================ */

:root {
    --aged-linen: #F5F0E8;
    --chronicle-ink: #2C2416;
    --burnished-brass: #B8860B;
    --foxed-paper: #D4A574;
    --almanac-green: #7B8F5E;
    --harvest-gold: #C49A3C;
    --russet-leaf: #8B4513;
    --archive-slate: #4A5568;
    --quill-red: #8B2500;
    --axis-brown: #8B7355;
    --paper-shadow: rgba(44, 36, 22, 0.12);

    --font-serif-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-serif-body: 'Cormorant Garamond', Georgia, serif;
    --font-mono: 'IBM Plex Mono', 'SF Mono', Menlo, monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-serif-body);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.8;
    letter-spacing: 0.01em;
    color: var(--chronicle-ink);
    background-color: var(--aged-linen);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* --- Foxing / aged-paper texture overlay --- */
.foxing-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.55  0 0 0 0 0.45  0 0 0 0 0.30  0 0 0 0.45 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    opacity: 0.07;
    mix-blend-mode: multiply;
}

/* small radial vignette to feel like aged page */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(139, 115, 85, 0.18) 100%);
}

/* --- Perpetual Header (brass strip) --- */
.perpetual-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: linear-gradient(180deg, #C49A3C 0%, var(--burnished-brass) 60%, #9C7309 100%);
    border-bottom: 1px solid var(--foxed-paper);
    z-index: 100;
    box-shadow: 0 2px 8px rgba(44, 36, 22, 0.15);
}

.header-axis-line {
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--chronicle-ink) 50%, transparent 100%);
    opacity: 0.35;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 32px;
    color: var(--aged-linen);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.year-counter {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 400;
}

.year-counter-label { opacity: 0.85; }
.year-counter-num { font-weight: 500; letter-spacing: 0.18em; }
.year-counter-sep { opacity: 0.6; }
.year-counter-rotor {
    display: inline-block;
    min-width: 5ch;
    text-align: center;
    color: #2C2416;
    background: rgba(245, 240, 232, 0.78);
    padding: 2px 8px;
    border-radius: 1px;
    letter-spacing: 0.12em;
    font-weight: 500;
}

.header-title {
    font-family: var(--font-serif-display);
    font-weight: 600;
    font-size: 17px;
    letter-spacing: 0.34em;
    font-feature-settings: 'smcp' on;
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-mark {
    font-size: 9px;
    opacity: 0.85;
    transform: translateY(-1px);
}

/* --- Epoch Entrance / Hero --- */
.epoch-entrance {
    position: relative;
    min-height: 100vh;
    padding: 120px 24px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.dial-stage {
    position: relative;
    width: min(560px, 90vw);
    aspect-ratio: 1 / 1;
    margin: 0 auto;
}

.dial-frame {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

.calendar-dial {
    width: 100%;
    height: 100%;
    display: block;
}

.dial-rotor {
    transform-origin: 200px 200px;
    animation: dial-spin 120s linear infinite;
}

@keyframes dial-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.dial-pointer {
    transform-origin: 200px 200px;
}

.dial-center-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
}

.dial-eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--axis-brown);
    margin-bottom: 6px;
}

.dial-year {
    font-family: var(--font-serif-display);
    font-weight: 900;
    font-variation-settings: "opsz" 144;
    font-size: clamp(72px, 11vw, 168px);
    line-height: 1;
    color: var(--chronicle-ink);
    letter-spacing: -0.02em;
    text-shadow: 0 2px 0 rgba(184, 134, 11, 0.18);
}

.dial-tag {
    margin-top: 4px;
    font-style: italic;
    font-family: var(--font-serif-body);
    font-size: 14px;
    color: var(--axis-brown);
    letter-spacing: 0.06em;
}

.epoch-prelude {
    margin-top: 56px;
    text-align: center;
    max-width: 480px;
}

.epoch-quote {
    font-family: var(--font-serif-body);
    font-style: italic;
    font-size: 20px;
    color: var(--chronicle-ink);
    opacity: 0.88;
}

.axis-seed {
    width: 2px;
    height: 64px;
    margin: 32px auto 0;
    background: linear-gradient(180deg, var(--axis-brown) 0%, transparent 100%);
}

.scroll-cue {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.scroll-cue-line {
    display: block;
    width: 1px;
    height: 36px;
    background: var(--axis-brown);
    animation: scroll-cue-pulse 2.4s ease-in-out infinite;
    transform-origin: top;
}

@keyframes scroll-cue-pulse {
    0%   { transform: scaleY(0); opacity: 0.0; }
    20%  { transform: scaleY(1); opacity: 1.0; }
    80%  { transform: scaleY(1); opacity: 1.0; }
    100% { transform: scaleY(0) translateY(36px); opacity: 0.0; }
}

.scroll-cue-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.32em;
    color: var(--axis-brown);
    text-transform: uppercase;
}

/* --- Timeline --- */
.timeline {
    position: relative;
    max-width: 1180px;
    margin: 0 auto;
    padding: 80px 24px 160px;
    z-index: 5;
}

.timeline-axis {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    pointer-events: none;
}

.timeline-axis-svg {
    width: 4px;
    height: 100%;
    overflow: visible;
    display: block;
}

#timeline-axis-line {
    transition: stroke-dashoffset 0.1s linear;
}

/* --- Entries --- */
.entry {
    position: relative;
    width: 100%;
    margin: 70px 0;
    display: flex;
}

.entry-left { justify-content: flex-start; }
.entry-right { justify-content: flex-end; }

.entry .node {
    position: absolute;
    top: 28px;
    left: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--burnished-brass);
    transform: translate(-50%, 0) scale(1);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.5s ease;
    z-index: 6;
    box-shadow: 0 0 0 0 rgba(184, 134, 11, 0.0);
}

.entry.is-active .node {
    transform: translate(-50%, 0) scale(1.6);
    box-shadow: 0 0 0 14px rgba(184, 134, 11, 0.18),
                0 0 24px 4px rgba(184, 134, 11, 0.35);
}

.entry-card {
    position: relative;
    width: calc(50% - 56px);
    padding: 28px 32px 26px;
    border: 1px solid var(--foxed-paper);
    background: rgba(245, 240, 232, 0.55);
    backdrop-filter: blur(0.5px);
    transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.6s ease,
                background 0.6s ease;
    opacity: 0;
}

.entry-left .entry-card { transform: translateX(-40px); }
.entry-right .entry-card { transform: translateX(40px); }

.entry.is-visible .entry-card {
    opacity: 1;
    transform: translateX(0);
}

.entry.is-active .entry-card {
    border-color: var(--burnished-brass);
    background: rgba(245, 240, 232, 0.78);
}

.entry-card::before,
.entry-card::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 1px solid var(--foxed-paper);
    pointer-events: none;
}
.entry-card::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.entry-card::after { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* connector tick from card to axis */
.entry-card {
    --connector-color: var(--foxed-paper);
}

.entry-left .entry-card {
    margin-left: 24px;
}
.entry-right .entry-card {
    margin-right: 24px;
}

.entry-left .entry-card::before {
    top: 32px;
    left: auto;
    right: -32px;
    width: 24px;
    height: 1px;
    border: none;
    background: var(--foxed-paper);
    box-shadow: none;
}

.entry-right .entry-card::after {
    top: 32px;
    bottom: auto;
    right: auto;
    left: -32px;
    width: 24px;
    height: 1px;
    border: none;
    background: var(--foxed-paper);
}

/* override corner brackets above; reapply with separate elements would be cleaner -- keep simple */

.entry-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    border-bottom: 1px dotted var(--foxed-paper);
    padding-bottom: 6px;
}

.entry-meta-mono {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--axis-brown);
}

.entry-meta-season {
    font-family: var(--font-serif-body);
    font-style: italic;
    font-size: 13px;
    color: var(--axis-brown);
    opacity: 0.8;
}

.entry-year {
    display: block;
    font-family: var(--font-serif-display);
    font-weight: 900;
    font-variation-settings: "opsz" 144;
    font-size: clamp(40px, 5vw, 68px);
    line-height: 1;
    color: var(--chronicle-ink);
    letter-spacing: -0.01em;
    margin: 6px 0 4px;
}

.entry-title {
    font-family: var(--font-serif-display);
    font-weight: 600;
    font-variation-settings: "opsz" 144;
    font-size: 22px;
    line-height: 1.25;
    color: var(--chronicle-ink);
    margin-bottom: 14px;
    letter-spacing: 0.005em;
}

.entry-text {
    font-family: var(--font-serif-body);
    font-size: 17px;
    line-height: 1.78;
    color: var(--chronicle-ink);
    overflow: hidden;
}

.drop-cap {
    float: left;
    font-family: var(--font-serif-display);
    font-weight: 900;
    font-variation-settings: "opsz" 144;
    font-size: 3.4em;
    line-height: 0.82;
    padding: 6px 10px 0 0;
    color: var(--quill-red);
}

.entry-rule {
    margin-top: 16px;
    height: 1px;
    background: linear-gradient(90deg, var(--foxed-paper) 0%, transparent 100%);
}

.entry-tag {
    display: inline-block;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--burnished-brass);
}

/* season-tinted left border on cards */
.entry[data-season="spring"] .entry-card { border-left-color: var(--almanac-green); }
.entry[data-season="summer"] .entry-card { border-left-color: var(--harvest-gold); }
.entry[data-season="autumn"] .entry-card { border-left-color: var(--russet-leaf); }
.entry[data-season="winter"] .entry-card { border-left-color: var(--archive-slate); }

.entry-left .entry-card { border-left-width: 3px; }
.entry-right .entry-card { border-right-width: 3px; }
.entry[data-season="spring"].entry-right .entry-card { border-right-color: var(--almanac-green); }
.entry[data-season="summer"].entry-right .entry-card { border-right-color: var(--harvest-gold); }
.entry[data-season="autumn"].entry-right .entry-card { border-right-color: var(--russet-leaf); }
.entry[data-season="winter"].entry-right .entry-card { border-right-color: var(--archive-slate); }

/* --- Seasonal Interludes --- */
.interlude {
    position: relative;
    width: 100vw;
    margin: 110px calc(50% - 50vw) 110px;
    height: 60vh;
    min-height: 420px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    isolation: isolate;
}

.interlude-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
}

.interlude-spring .interlude-bg {
    background: linear-gradient(180deg,
        rgba(245,240,232,1) 0%,
        rgba(197,213,160,0.55) 30%,
        rgba(123,143,94,0.55) 65%,
        rgba(245,240,232,1) 100%);
}
.interlude-summer .interlude-bg {
    background: linear-gradient(180deg,
        rgba(245,240,232,1) 0%,
        rgba(212,165,116,0.55) 28%,
        rgba(196,154,60,0.65) 65%,
        rgba(245,240,232,1) 100%);
}
.interlude-autumn .interlude-bg {
    background: linear-gradient(180deg,
        rgba(245,240,232,1) 0%,
        rgba(196,154,60,0.50) 25%,
        rgba(139,69,19,0.55) 65%,
        rgba(245,240,232,1) 100%);
}
.interlude-winter .interlude-bg {
    background: linear-gradient(180deg,
        rgba(245,240,232,1) 0%,
        rgba(74,85,104,0.45) 30%,
        rgba(74,85,104,0.65) 65%,
        rgba(245,240,232,1) 100%);
}

.interlude-shape {
    width: clamp(140px, 22vw, 220px);
    height: clamp(140px, 22vw, 220px);
    transition: transform 1.4s ease-in-out;
}

.interlude.is-visible .interlude-shape {
    transform: rotate(8deg) scale(1.05);
}

.interlude-morph {
    transition: d 3s ease-in-out, fill 3s ease-in-out, stroke 3s ease-in-out;
}

.interlude-rays {
    transform-origin: 100px 100px;
    animation: dial-spin 60s linear infinite;
}

.interlude-label {
    margin-top: 22px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.46em;
    color: var(--chronicle-ink);
    opacity: 0.78;
    text-transform: uppercase;
}

.interlude-spring .interlude-label { color: var(--almanac-green); }
.interlude-summer .interlude-label { color: var(--harvest-gold); }
.interlude-autumn .interlude-label { color: var(--russet-leaf); }
.interlude-winter .interlude-label { color: var(--archive-slate); }

/* --- Terminus --- */
.terminus {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    background: linear-gradient(180deg,
        var(--aged-linen) 0%,
        #FDFBF6 60%,
        #FFFFFF 100%);
    z-index: 5;
}

.terminus-axis-end {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 200px;
    background: linear-gradient(180deg, var(--axis-brown) 0%, transparent 100%);
}

.terminus-node {
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--burnished-brass);
    margin-bottom: 36px;
    box-shadow: 0 0 0 6px rgba(184, 134, 11, 0.18),
                0 0 0 14px rgba(184, 134, 11, 0.08),
                0 4px 12px rgba(44, 36, 22, 0.18);
}

.terminus-node-inner {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #F5D98A 0%, var(--burnished-brass) 60%, #6E5208 100%);
}

.terminus-eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.32em;
    color: var(--axis-brown);
    text-transform: uppercase;
    margin-bottom: 24px;
}

.terminus-text {
    font-family: var(--font-serif-display);
    font-size: clamp(28px, 4vw, 44px);
    color: var(--chronicle-ink);
    font-style: italic;
    text-align: center;
    margin-bottom: 32px;
}

.terminus-sig {
    font-family: var(--font-serif-body);
    font-style: italic;
    font-size: 15px;
    color: var(--axis-brown);
    letter-spacing: 0.04em;
}

.terminus-sig-name {
    border-bottom: 1px dotted var(--foxed-paper);
    padding: 0 6px 2px;
}

/* --- Marginalia (fixed) --- */
.marginalia {
    position: fixed;
    left: 32px;
    bottom: 28px;
    z-index: 90;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--axis-brown);
    background: rgba(245, 240, 232, 0.85);
    border: 1px solid var(--foxed-paper);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.marginalia-line {
    width: 28px;
    height: 1px;
    background: var(--burnished-brass);
}

.marginalia-label { color: var(--axis-brown); opacity: 0.8; }
.marginalia-year {
    font-family: var(--font-serif-display);
    font-weight: 900;
    font-size: 22px;
    letter-spacing: 0;
    color: var(--chronicle-ink);
    text-transform: none;
}
.marginalia-season {
    font-family: var(--font-serif-body);
    font-style: italic;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0.04em;
    color: var(--axis-brown);
}

/* --- Responsive --- */
@media (max-width: 820px) {
    .timeline-axis { left: 28px; }

    .entry {
        margin: 50px 0;
    }

    .entry .node {
        left: 28px;
    }

    .entry-left, .entry-right {
        justify-content: flex-start;
    }

    .entry-card {
        width: calc(100% - 64px);
        margin-left: 56px !important;
        margin-right: 0 !important;
    }

    .entry-left .entry-card,
    .entry-right .entry-card {
        transform: translateX(20px);
    }

    .entry.is-visible .entry-card { transform: translateX(0); }

    .entry-left .entry-card::before,
    .entry-right .entry-card::after {
        top: 32px;
        left: -32px;
        right: auto;
        width: 28px;
        height: 1px;
        background: var(--foxed-paper);
        border: none;
    }

    .marginalia { left: 12px; right: 12px; bottom: 12px; }

    .header-inner { padding: 0 16px; }
    .header-title { font-size: 14px; letter-spacing: 0.22em; gap: 8px; }
    .year-counter { gap: 6px; font-size: 10px; }
    .year-counter-label { display: none; }

    .interlude { margin: 70px calc(50% - 50vw); height: 50vh; min-height: 320px; }
}

@media (max-width: 480px) {
    .entry-title { font-size: 19px; }
    .entry-text { font-size: 16px; }
    .dial-eyebrow { font-size: 9px; letter-spacing: 0.22em; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
    .dial-rotor, .interlude-rays { animation: none; }
    .scroll-cue-line { animation: none; }
    .entry-card, .interlude-shape { transition: none; }
}
