/* historygrapher.com - Warm Twilight Archaeology */
/* Colors: #f5efe6 #b5654a #3d2b1f #4a3728 #f2e6d9 #6b8f71 #d4944c #c4978a #5b3a29 #c17a50 */

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

html { scroll-behavior: smooth; }

body {
    background-color: #f5efe6;
    color: #4a3728;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 19px;
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ===== GOLDEN THREAD SVG ===== */
#golden-thread {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#thread-path {
    filter: drop-shadow(0 0 6px #d4944c);
    opacity: 0.7;
}

@keyframes thread-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.85; }
}

#golden-thread { animation: thread-pulse 4s ease-in-out infinite; }

/* ===== CONTOUR BACKGROUND ===== */
#contour-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ===== MAIN CANVAS ===== */
#tributary-canvas {
    position: relative;
    z-index: 2;
    max-width: 100%;
    padding-bottom: 8rem;
}
/* ===== EPOCH POOLS ===== */
.epoch-pool {
    position: relative;
    width: 90vw;
    margin: 0 auto;
    padding: 6rem 4rem;
    overflow: visible;
}

.epoch-hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 12rem;
}

.epoch-offset-left {
    margin-left: 3vw;
    margin-right: auto;
}

.epoch-offset-right {
    margin-left: auto;
    margin-right: 3vw;
}

/* Dark epoch panel */
.epoch-dark {
    background-color: #b5654a;
    border-radius: 2px;
    margin-top: 4rem;
    margin-bottom: 4rem;
}

/* ===== EPOCH CONTENT ===== */
.epoch-content {
    position: relative;
    max-width: 720px;
    z-index: 3;
}

.epoch-hero .epoch-content {
    max-width: 800px;
    margin: 0 auto;
}

/* ===== ERA GLYPHS ===== */
.era-glyph {
    display: block;
    margin-bottom: 1.5rem;
}

.epoch-hero .era-glyph {
    margin: 0 auto 2rem auto;
}

/* ===== ERA LABELS ===== */
.era-label {
    font-family: "Space Grotesk", sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #c17a50;
    display: block;
    margin-bottom: 0.75rem;
}

.era-label-light { color: #f2e6d9; }

/* ===== EPOCH TITLES ===== */
.epoch-title {
    font-family: "Libre Baskerville", serif;
    font-variant: small-caps;
    font-weight: 700;
    font-size: clamp(42px, 6vw, 72px);
    letter-spacing: 0.04em;
    line-height: 1.12;
    color: #5b3a29;
    margin-bottom: 2rem;
}

.epoch-title-light { color: #f2e6d9; }

.epoch-hero .epoch-title {
    font-size: clamp(48px, 8vw, 80px);
    margin-bottom: 2.5rem;
}
/* ===== EPOCH HOOKS ===== */
.epoch-hook {
    font-family: "Libre Baskerville", serif;
    font-style: italic;
    font-size: 28px;
    line-height: 1.45;
    color: #5b3a29;
    margin-bottom: 3rem;
    max-width: 640px;
}

.epoch-hero .epoch-hook { text-align: center; margin: 0 auto 3rem auto; }
.epoch-hook-light { color: #f2e6d9; }

/* ===== BODY TEXT ===== */
.epoch-body {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 19px;
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #4a3728;
    margin-bottom: 2rem;
    max-width: 640px;
}

.epoch-body-light { color: #e8dcd0; }
.epoch-hero .epoch-body { text-align: center; margin: 0 auto 2rem auto; }

/* ===== HISTORICAL QUOTES ===== */
.historical-quote {
    margin: 3rem 0 3rem 3rem;
    padding: 1.5rem 2rem;
    border-left: 2px solid #6b8f71;
    max-width: 560px;
}

.historical-quote p {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-style: italic;
    font-size: 20px;
    line-height: 1.65;
    color: #4a3728;
    margin-bottom: 0.75rem;
}

.historical-quote cite {
    font-family: "Space Grotesk", sans-serif;
    font-size: 12px;
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #c17a50;
}

.historical-quote-light p { color: #f2e6d9; }
.historical-quote-light { border-left-color: #d4944c; }
.historical-quote-light cite { color: #e8dcd0; }

/* ===== LENS FLARE ===== */
.lens-flare {
    position: absolute;
    top: 3rem;
    left: 50%;
    transform: translateX(-50%) scale(0.4);
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 50%, rgba(212, 148, 76, 0.35) 0%, transparent 65%);
    pointer-events: none;
    opacity: 0;
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s ease-out;
    z-index: 0;
}

.lens-flare.active {
    opacity: 1;
    transform: translateX(-50%) scale(1.15);
}

.epoch-hero .lens-flare {
    top: 50%;
    transform: translate(-50%, -50%) scale(0.4);
    width: 600px;
    height: 600px;
}

.epoch-hero .lens-flare.active {
    transform: translate(-50%, -50%) scale(1.15);
}
/* ===== ASTROLABE FRAGMENTS ===== */
.astrolabe-fragment {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease-out, transform 1.2s ease-out;
}

.astrolabe-right {
    right: -2rem;
    transform: translateY(-50%) rotate(-15deg);
}

.astrolabe-left {
    left: -2rem;
    transform: translateY(-50%) rotate(15deg);
}

.astrolabe-fragment.visible {
    opacity: 1;
}

.astrolabe-right.visible {
    transform: translateY(-50%) rotate(0deg);
}

.astrolabe-left.visible {
    transform: translateY(-50%) rotate(0deg);
}

/* ===== NARROW PASSAGES ===== */
.narrow-passage {
    max-width: 540px;
    margin: 0 auto;
    padding: 8rem 2rem;
    position: relative;
    z-index: 2;
}

.narrow-text {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 20px;
    line-height: 1.72;
    color: #4a3728;
    text-align: center;
    font-style: italic;
}

.narrow-finale {
    padding-top: 10rem;
    padding-bottom: 12rem;
    text-align: center;
}

.finale-mark {
    display: flex;
    justify-content: center;
    margin-top: 4rem;
}

.finale-label {
    text-align: center;
    display: block;
    margin-top: 2rem;
    font-size: 14px;
}

/* ===== COMPASS ROSE DIVIDERS ===== */
.compass-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem 0;
    position: relative;
    z-index: 2;
}

.compass-outer {
    position: relative;
    width: 48px;
    height: 48px;
    animation: spin-cw 60s linear infinite;
}

.compass-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 48px;
    height: 48px;
    animation: spin-ccw 60s linear infinite;
}

@keyframes spin-cw { to { transform: rotate(360deg); } }
@keyframes spin-ccw { to { transform: rotate(-360deg); } }
/* ===== CONFLUENCE SECTIONS ===== */
.confluence-section {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    max-width: 900px;
    margin: 2rem auto;
    padding: 4rem 2rem;
    position: relative;
    z-index: 2;
    align-items: start;
}

.confluence-stream p {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 17px;
    line-height: 1.65;
    color: #4a3728;
}

.confluence-title {
    font-family: "Libre Baskerville", serif;
    font-variant: small-caps;
    font-size: 22px;
    letter-spacing: 0.04em;
    color: #5b3a29;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.confluence-glyph {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 1rem;
}

/* ===== ERA INDICATOR (Fixed bottom-right) ===== */
#era-indicator {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 80px;
    height: 80px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.era-ring-outer {
    position: relative;
    width: 80px;
    height: 80px;
    animation: spin-cw 30s linear infinite;
}

.era-ring-svg {
    position: absolute;
    top: 0;
    left: 0;
}

.era-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: "Space Grotesk", sans-serif;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #c17a50;
    white-space: nowrap;
    writing-mode: vertical-rl;
}

.era-ring-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: spin-ccw 30s linear infinite;
}

/* ===== SCROLL-TRIGGERED ENTRY ANIMATIONS ===== */
.epoch-pool .epoch-content {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out 0.2s, transform 0.8s ease-out 0.2s;
}

.epoch-pool.in-view .epoch-content {
    opacity: 1;
    transform: translateY(0);
}

.narrow-passage {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.narrow-passage.in-view {
    opacity: 1;
    transform: translateY(0);
}

.confluence-section {
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.confluence-section.in-view {
    opacity: 1;
}

.confluence-left {
    transform: translateX(-20px);
    transition: transform 0.8s ease-out, opacity 0.8s ease-out;
    opacity: 0;
}

.confluence-right {
    transform: translateX(20px);
    transition: transform 0.8s ease-out, opacity 0.8s ease-out;
    opacity: 0;
}

.confluence-section.in-view .confluence-left,
.confluence-section.in-view .confluence-right {
    transform: translateX(0);
    opacity: 1;
}
/* ===== YEAR COUNTER ANIMATION ===== */
.year-counter {
    font-family: "Space Grotesk", sans-serif;
    font-size: 14px;
    letter-spacing: 0.18em;
    color: #c17a50;
    display: inline-block;
    min-width: 4ch;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .epoch-pool {
        width: 100%;
        padding: 4rem 1.5rem;
    }

    .epoch-offset-left,
    .epoch-offset-right {
        margin-left: auto;
        margin-right: auto;
    }

    .epoch-title {
        font-size: clamp(32px, 8vw, 48px);
    }

    .epoch-hook {
        font-size: 22px;
    }

    .epoch-body {
        font-size: 17px;
    }

    .astrolabe-fragment {
        display: none;
    }

    .confluence-section {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 3rem 1.5rem;
    }

    .confluence-glyph {
        order: -1;
    }

    .narrow-passage {
        padding: 5rem 1.5rem;
    }

    .historical-quote {
        margin-left: 1rem;
        margin-right: 0;
    }

    #era-indicator {
        bottom: 1rem;
        right: 1rem;
        width: 60px;
        height: 60px;
    }

    .epoch-hero {
        padding-top: 8rem;
    }

    .lens-flare {
        width: 250px;
        height: 250px;
    }

    .epoch-hero .lens-flare {
        width: 350px;
        height: 350px;
    }
}

/* ===== SELECTION COLOR ===== */
::selection {
    background-color: rgba(212, 148, 76, 0.3);
    color: #3d2b1f;
}

/* ===== LINKS ===== */
a {
    color: #6b8f71;
    text-decoration: none;
    border-bottom: 1px solid rgba(107, 143, 113, 0.3);
    transition: border-color 0.3s ease;
}

a:hover {
    border-bottom-color: #6b8f71;
}