/* ============================================
   annual.quest - The Chronicle of Cyclical Time
   Almanac / Sepia-Nostalgic
   ============================================ */

:root {
    --aged-vellum: #F5EDE0;
    --warm-linen: #EDE4D3;
    --almanac-ink: #2C2416;
    --worn-graphite: #7A6B52;
    --gilt-edge: #8B6914;
    --autumn-ochre: #C4892B;
    --sprout-green: #6B8F5E;
    --frost-slate: #8A95A0;
    --foxed-edge: #C8B896;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--aged-vellum);
    color: var(--almanac-ink);
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.72;
    overflow-x: hidden;
}

/* Paper grain overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

.hidden-svg {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Site Colophon Title --- */
.site-colophon {
    position: fixed;
    top: 24px;
    left: 30px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.colophon-title {
    font-family: 'Inconsolata', monospace;
    font-size: 14px;
    color: var(--worn-graphite);
    letter-spacing: 0.04em;
    min-height: 1em;
}

.colophon-section {
    font-family: 'Inconsolata', monospace;
    font-size: 12px;
    color: var(--foxed-edge);
    letter-spacing: 0.04em;
}

/* --- Ephemeris Sidebar --- */
.ephemeris-wrapper {
    position: fixed;
    right: 30px;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 100;
    display: flex;
    align-items: center;
}

.ephemeris-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.ephemeris-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--foxed-edge);
    background: transparent;
    cursor: pointer;
    transition: background 0.4s ease, border-color 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ephemeris-circle span {
    font-family: 'Inconsolata', monospace;
    font-size: 7px;
    color: var(--foxed-edge);
    transition: color 0.3s ease;
    line-height: 1;
}

.ephemeris-circle.filled {
    background: var(--gilt-edge);
    border-color: var(--gilt-edge);
}

.ephemeris-circle.filled span {
    color: var(--aged-vellum);
}

.ephemeris-circle.active {
    animation: ephemerPulse 2s ease-in-out infinite;
}

@keyframes ephemerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* --- Year Wheel Header --- */
.year-wheel-header {
    display: flex;
    justify-content: center;
    padding: 60px 0 30px;
}

.year-wheel {
    width: 200px;
    height: 200px;
    opacity: 0;
    animation: wheelFadeIn 0.8s ease-out 0.3s forwards;
}

@keyframes wheelFadeIn {
    to { opacity: 1; }
}

.wheel-rotate {
    animation: wheelSpin 120s linear infinite;
    transform-origin: center;
}

@keyframes wheelSpin {
    to { transform: rotate(360deg); }
}

.wheel-arc {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: arcDraw 0.2s ease-out forwards;
}

.wheel-arc:nth-child(3) { animation-delay: 0.4s; }
.wheel-arc:nth-child(4) { animation-delay: 0.55s; }
.wheel-arc:nth-child(5) { animation-delay: 0.7s; }
.wheel-arc:nth-child(6) { animation-delay: 0.85s; }
.wheel-arc:nth-child(7) { animation-delay: 1.0s; }
.wheel-arc:nth-child(8) { animation-delay: 1.15s; }
.wheel-arc:nth-child(9) { animation-delay: 1.3s; }
.wheel-arc:nth-child(10) { animation-delay: 1.45s; }
.wheel-arc:nth-child(11) { animation-delay: 1.6s; }
.wheel-arc:nth-child(12) { animation-delay: 1.75s; }
.wheel-arc:nth-child(13) { animation-delay: 1.9s; }
.wheel-arc:nth-child(14) { animation-delay: 2.05s; }

@keyframes arcDraw {
    to { stroke-dashoffset: 0; }
}

.wheel-numeral {
    opacity: 0;
    animation: numeralIn 0.5s ease-out 2.4s forwards;
}

@keyframes numeralIn {
    to { opacity: 1; }
}

/* --- Chronicle / Chapters --- */
.chronicle {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 30px 80px;
}

.chapter {
    position: relative;
    padding: 3rem 0 2rem;
    padding-left: 60px;
}

.chapter-alt {
    background-color: transparent;
}

.chapter-numeral {
    position: absolute;
    left: -10px;
    top: 1rem;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 120px;
    color: var(--gilt-edge);
    opacity: 0.15;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.chapter-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--almanac-ink);
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.chapter-text {
    margin-bottom: 1.5rem;
    color: var(--almanac-ink);
}

.pull-quote {
    border-left: 3px solid var(--gilt-edge);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-family: 'Source Serif 4', serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--worn-graphite);
    font-style: italic;
    line-height: 1.7;
}

/* Fade Reveal */
.fade-reveal {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

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

/* Almanac Dividers */
.almanac-divider {
    padding: 2rem 0;
}

.almanac-divider svg {
    width: 100%;
    height: 24px;
}

.divider-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
}

.almanac-divider.visible .divider-line {
    animation: dividerDraw 0.8s ease-out forwards;
}

@keyframes dividerDraw {
    to { stroke-dashoffset: 0; }
}

.divider-icon {
    opacity: 0;
    transform-origin: center;
}

.almanac-divider.visible .divider-icon {
    animation: iconBounce 0.4s ease-out 0.8s forwards;
}

@keyframes iconBounce {
    0% { opacity: 0; transform: scale(0); }
    70% { transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* Seasonal Bands */
.seasonal-band {
    width: 100%;
    height: 0px;
    transition: height 0.6s ease-out;
}

.seasonal-band.visible {
    height: 4px;
}

.spring-band { background: linear-gradient(to right, #D4C4A8, #C8D4B4); }
.summer-band { background: linear-gradient(to right, #C8D4B4, #D4C0A0); }
.autumn-band { background: linear-gradient(to right, #D4C0A0, #E8DCC8); }
.winter-band { background: linear-gradient(to right, #E8DCC8, #D4C4A8); }

/* Year Wheel Footer */
.year-wheel-footer {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

.year-wheel-small {
    width: 120px;
    height: 120px;
}

.quest-renews {
    text-align: center;
    font-family: 'Inconsolata', monospace;
    font-size: 14px;
    color: var(--worn-graphite);
    letter-spacing: 0.04em;
    padding: 1rem 0 2rem;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.quest-renews.visible {
    opacity: 1;
}

/* Foxing Dots (per-section) */
.chapter:nth-child(odd)::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.25;
    background:
        radial-gradient(circle at 15% 20%, var(--foxed-edge) 2px, transparent 2px),
        radial-gradient(circle at 85% 45%, var(--foxed-edge) 3px, transparent 3px),
        radial-gradient(circle at 45% 80%, var(--foxed-edge) 2.5px, transparent 2.5px);
}

.chapter:nth-child(even)::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.2;
    background:
        radial-gradient(circle at 70% 15%, var(--foxed-edge) 2px, transparent 2px),
        radial-gradient(circle at 25% 55%, var(--foxed-edge) 3.5px, transparent 3.5px),
        radial-gradient(circle at 60% 90%, var(--foxed-edge) 2px, transparent 2px);
}

/* --- Mobile --- */
@media (max-width: 1200px) {
    .ephemeris-wrapper {
        display: none;
    }
}

@media (max-width: 768px) {
    .chronicle {
        padding: 20px 20px 60px;
    }

    .chapter {
        padding-left: 0;
    }

    .chapter-numeral {
        position: relative;
        left: auto;
        top: auto;
        font-size: 60px;
        display: block;
        margin-bottom: -1.5rem;
    }

    .year-wheel {
        width: 140px;
        height: 140px;
    }

    .site-colophon {
        left: 15px;
        top: 15px;
    }
}
