/* =============================================================
   rational.quest — Styles
   Colors: #0d1b2a #1b263b #f0e6d3 #8b7355 #c9a96e #415a77 #e63946
   Fonts: Playfair Display, Source Serif 4, Inconsolata
   ============================================================= */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #0d1b2a;
    color: #f0e6d3;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.8;
    overflow-x: hidden;
}

/* ---- Reading Progress Bar ---- */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(to right, #c9a96e, #e63946);
    z-index: 1000;
    transition: width 0.1s linear;
}

/* ---- Fixed Timeline Line ---- */
#timeline-line {
    position: fixed;
    top: 0;
    left: 3rem;
    width: 2px;
    height: 100vh;
    background: #8b7355;
    opacity: 0.4;
    z-index: 10;
    pointer-events: none;
}

/* ---- Watermark Field ---- */
.watermark-field {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.watermark-symbol {
    position: absolute;
    font-family: 'Source Serif 4', serif;
    font-size: clamp(4rem, 8vw, 9rem);
    color: #f0e6d3;
    opacity: 0.04;
    animation: floatUp linear infinite;
    user-select: none;
    pointer-events: none;
}

@keyframes floatUp {
    from { transform: translateY(100vh); }
    to   { transform: translateY(-120vh); }
}

/* ---- Hero Section ---- */
.section-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0d1b2a;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    max-width: 900px;
}

.hero-eyebrow {
    font-family: 'Inconsolata', monospace;
    font-size: 0.85rem;
    color: #8b7355;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeSlideUp 1s ease 0.3s forwards;
}

.hero-question {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    font-weight: 700;
    color: #f0e6d3;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeSlideUp 1.2s ease 0.6s forwards;
}

.hero-sub {
    font-family: 'Inconsolata', monospace;
    font-size: 0.9rem;
    color: #415a77;
    letter-spacing: 0.15em;
    opacity: 0;
    animation: fadeSlideUp 1s ease 1s forwards;
}

.hero-scroll-hint {
    margin-top: 4rem;
    opacity: 0;
    animation: fadeSlideUp 1s ease 1.4s forwards;
}

.scroll-indicator {
    font-size: 1.5rem;
    color: #8b7355;
    animation: bounceDown 2s ease infinite;
    display: inline-block;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(8px); }
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(1.5rem); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Era Sections ---- */
.era-section {
    position: relative;
    background-color: #0d1b2a;
    padding: 5rem 0 4rem 7rem;
    min-height: 60vh;
    overflow: hidden;
}

.era-section:nth-child(even) {
    background-color: #1b263b;
}

/* ---- Timeline Nodes ---- */
.timeline-node {
    position: absolute;
    left: calc(3rem - 6px);
    top: 5rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #c9a96e;
    background: #0d1b2a;
    z-index: 20;
    transition: background 0.5s ease, box-shadow 0.5s ease;
}

.timeline-node.active {
    background: #c9a96e;
    box-shadow: 0 0 12px rgba(201, 169, 110, 0.5);
}

/* ---- Quill Dividers ---- */
.quill-divider {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 800px;
    height: 40px;
    margin-bottom: 2rem;
    padding-left: 1rem;
}

.quill-svg {
    width: 100%;
    height: 40px;
}

.quill-line {
    transition: stroke-dashoffset 1.5s ease;
}

.quill-divider.drawn .quill-line {
    stroke-dashoffset: 0;
}

/* ---- Era Inner Content ---- */
.era-inner {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    padding-right: 3rem;
}

.era-date {
    font-family: 'Inconsolata', monospace;
    font-size: 0.8rem;
    color: #c9a96e;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

/* ---- Era Columns ---- */
.era-columns {
    display: grid;
    grid-template-columns: 60fr 40fr;
    gap: 3rem;
    align-items: start;
}

.era-main {
    padding-right: 1rem;
}

.era-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(2rem, 3.5vw, 3rem);
    font-weight: 700;
    color: #f0e6d3;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
}

.era-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.8;
    color: #f0e6d3;
    margin-bottom: 1.25rem;
}

.era-body em {
    font-style: italic;
    color: #f0e6d3;
}

.era-body strong.emphasis-cardinal {
    color: #e63946;
    font-weight: 600;
}

/* ---- Drop Caps ---- */
.drop-cap {
    float: left;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 3.5em;
    font-weight: 900;
    line-height: 0.8;
    margin-right: 0.08em;
    margin-top: 0.05em;
    background: linear-gradient(135deg, #c9a96e, #8b7355);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---- Annotation References ---- */
.annotation-ref {
    font-family: 'Inconsolata', monospace;
    font-size: 0.75rem;
    color: #c9a96e;
    cursor: pointer;
    vertical-align: super;
    line-height: 1;
    position: relative;
    transition: color 0.2s ease;
}

.annotation-ref:hover {
    color: #e63946;
}

/* ---- Global Annotation Tooltip ---- */
.global-tooltip {
    position: fixed;
    bottom: 2.5rem;
    right: 2.5rem;
    max-width: 320px;
    background: #1b263b;
    border: 1px solid #8b7355;
    border-left: 3px solid #c9a96e;
    padding: 1rem 1.25rem;
    z-index: 500;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.global-tooltip.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.global-tooltip-text {
    font-family: 'Inconsolata', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #f0e6d3;
}

/* ---- Marginalia ---- */
.era-margin {
    padding-top: 0.5rem;
    border-left: 1px solid #8b7355;
    padding-left: 1.5rem;
}

.marginalia {
    margin-bottom: 1.75rem;
}

.marginalia-label {
    font-family: 'Inconsolata', monospace;
    font-size: 0.7rem;
    color: #c9a96e;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.marginalia-text {
    font-family: 'Inconsolata', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #415a77;
}

.marginalia-operator {
    font-family: 'Inconsolata', monospace;
    font-size: 1rem;
    color: #8b7355;
    margin-top: 0.5rem;
    letter-spacing: 0.1em;
}

/* ---- Section Divider Rules ---- */
.era-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 7rem;
    right: 3rem;
    border-top: 1px solid #8b7355;
}

.era-section::after {
    content: '◆';
    position: absolute;
    top: -0.65em;
    left: 50%;
    transform: translateX(-50%);
    color: #8b7355;
    font-size: 0.7rem;
    background: inherit;
    padding: 0 0.5rem;
}

/* ---- Reveal Animations ---- */
.reveal-block {
    opacity: 0;
    transform: translateY(2rem);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-block .era-heading {
    transition-delay: 0ms;
}

.reveal-block.revealed .era-heading {
    transition-delay: 0ms;
}

.reveal-block .era-body:nth-child(1) { transition-delay: 150ms; }
.reveal-block .era-body:nth-child(2) { transition-delay: 300ms; }
.reveal-block .era-body:nth-child(3) { transition-delay: 450ms; }
.reveal-block .era-margin           { transition-delay: 300ms; }

/* ---- Coda Section ---- */
.section-coda {
    position: relative;
    background-color: #1b263b;
    padding: 6rem 7rem;
    overflow: hidden;
    border-top: 1px solid #8b7355;
}

.coda-inner {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.coda-rule {
    margin-bottom: 3rem;
}

.rule-diamond {
    color: #8b7355;
    font-size: 1.2rem;
}

.coda-quote {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    font-style: italic;
    font-weight: 400;
    color: #f0e6d3;
    line-height: 1.5;
    margin-bottom: 1rem;
    border-left: none;
}

.coda-quote cite {
    display: block;
    font-family: 'Inconsolata', monospace;
    font-size: 0.8rem;
    font-style: normal;
    color: #415a77;
    margin-top: 1rem;
    letter-spacing: 0.05em;
}

.coda-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #415a77;
    margin-top: 2rem;
}

.coda-operators {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #8b7355;
}

.coda-operators .op {
    font-family: 'Source Serif 4', serif;
    font-size: 1.5rem;
    color: #8b7355;
    opacity: 0.6;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.coda-operators .op:hover {
    opacity: 1;
    color: #c9a96e;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    #timeline-line {
        display: none;
    }

    .era-section {
        padding: 4rem 1.5rem 3rem 1.5rem;
    }

    .era-section::before {
        left: 1.5rem;
        right: 1.5rem;
    }

    .era-columns {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .era-margin {
        border-left: none;
        border-top: 1px solid #8b7355;
        padding-left: 0;
        padding-top: 1.5rem;
    }

    .section-coda {
        padding: 4rem 1.5rem;
    }

    .hero-content {
        padding: 2rem 1.5rem;
    }

    .timeline-node {
        left: 0.5rem;
    }

    .quill-divider {
        padding-left: 0;
    }
}

@media (max-width: 480px) {
    .era-section {
        padding: 3rem 1rem 2rem 1rem;
    }

    .era-heading {
        font-size: 1.75rem;
    }
}
