/* ============================================================
   STYLES.CSS — v3 Storytelling + Era Theming
   12 distinct era themes, sub-slide layout, interactive components
   ============================================================ */

/* ── CSS RESET & BASE ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Base palette (overridden per theme) */
    --bg: #F5F3EF;
    --bg-alt: #EFECE6;
    --text: #1A1A1A;
    --text-muted: #5A5650;
    --text-secondary: #7A756E;
    --accent: #2C5F8A;
    --accent-light: #3A7BB5;
    --accent2: #D4A853;
    --border: #D6D2CB;
    --cream: #F0EDE8;
    --shadow: rgba(0,0,0,0.08);
    --heading-font: 'Playfair Display', serif;
    --body-font: 'Inter', sans-serif;
    --mono-font: 'Space Mono', monospace;

    /* Layout */
    --timeline-h: 48px;
    --sub-nav-h: 40px;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--body-font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--heading-font); font-weight: 700; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============================================================
   TIMELINE BAR (fixed top)
   ============================================================ */
.timeline-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--timeline-h);
    background: rgba(245,243,239,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    transition: background 0.6s, border-color 0.6s;
}

.timeline-track {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    position: relative;
}

.timeline-line {
    position: absolute;
    top: 50%;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--border);
    transform: translateY(-50%);
    z-index: 0;
    transition: background 0.6s;
}

.timeline-dot {
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 11px;
    font-family: var(--body-font);
    font-weight: 600;
    color: var(--text-muted);
}

.timeline-dot:hover { border-color: var(--accent); color: var(--accent); transform: scale(1.15); }
.timeline-dot.visited { border-color: var(--accent); color: var(--accent); }
.timeline-dot.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(44,95,138,0.15);
}

.dot-label { font-size: 10px; line-height: 1; }
.timeline-era-label {
    font-family: var(--heading-font);
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: 16px;
    min-width: 80px;
    transition: color 0.6s;
}

/* ============================================================
   BRIDGE & ACT OVERLAYS
   ============================================================ */
.bridge-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(26,26,26,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}
.bridge-overlay.visible { opacity: 1; pointer-events: auto; }

.bridge-text {
    font-family: var(--heading-font);
    font-size: clamp(18px, 3vw, 26px);
    color: #F5F3EF;
    text-align: center;
    max-width: 700px;
    padding: 0 40px;
    line-height: 1.7;
    font-style: italic;
}

.act-overlay {
    position: fixed;
    inset: 0;
    z-index: 910;
    background: rgba(44,95,138,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s;
}
.act-overlay.visible { opacity: 1; pointer-events: auto; }

.act-content { text-align: center; color: #fff; }
.act-number {
    font-family: var(--body-font);
    font-size: 14px;
    letter-spacing: 6px;
    text-transform: uppercase;
    opacity: 0.7;
}
.act-title {
    font-family: var(--heading-font);
    font-size: clamp(36px, 6vw, 56px);
    margin: 12px 0 8px;
    color: #fff;
}
.act-theme {
    font-size: 16px;
    opacity: 0.8;
    font-style: italic;
}

/* ============================================================
   SLIDES CONTAINER & ERA SLIDES
   ============================================================ */
.slides-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.era-slide {
    position: absolute;
    inset: 0;
    top: var(--timeline-h);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
}
.era-slide.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}
.era-slide.exit-left { transform: translateX(-30px); }

/* Parallax bg layer */
.era-parallax-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    transition: transform 0.3s ease-out;
}

/* ============================================================
   HERO SLIDE
   ============================================================ */
.era-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F5F3EF;
}
.hero-content {
    text-align: center;
    max-width: 680px;
    padding: 40px 20px;
    animation: fadeInUp 1s ease;
}
.hero-ornament {
    font-size: 18px;
    letter-spacing: 8px;
    color: var(--border);
    margin-bottom: 32px;
}
.hero-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(32px, 6vw, 56px);
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 8px;
}
.hero-subtitle {
    font-family: 'Playfair Display', serif;
    font-size: clamp(16px, 2.5vw, 22px);
    color: var(--text-muted);
    font-style: italic;
}
.hero-divider {
    color: var(--border);
    margin: 24px 0;
    font-size: 14px;
    letter-spacing: 4px;
}
.hero-journey {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 28px;
}
.hero-credit {
    margin-bottom: 32px;
}
.credit-title {
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.credit-name {
    font-family: var(--heading-font);
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}
.credit-tom {
    font-family: var(--heading-font);
    font-size: 28px;
    color: var(--accent);
    margin: 8px 0;
}
.credit-dedication {
    font-size: 16px;
    color: var(--accent2);
}
.hero-start {
    font-family: var(--body-font);
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    padding: 14px 36px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.5px;
}
.hero-start:hover { background: var(--accent-light); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(44,95,138,0.25); }

.hero-footer {
    margin-top: 2.5rem;
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
    letter-spacing: 0.5px;
}
.hero-footer strong {
    color: var(--text);
    font-style: normal;
}
.heart-pulse {
    display: inline-block;
    color: #E74C3C;
    font-style: normal;
    animation: heartbeat 1.2s ease-in-out infinite;
}
@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.3); }
    70% { transform: scale(1); }
}

/* ============================================================
   ERA HEADER (inside each era slide)
   ============================================================ */
.era-header {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 16px 20px 8px;
    background: linear-gradient(180deg, var(--bg) 70%, transparent);
}

.era-number {
    font-family: var(--body-font);
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
}
.era-title {
    font-family: var(--heading-font);
    font-size: clamp(24px, 4vw, 36px);
    color: var(--text);
    line-height: 1.2;
    margin: 4px 0;
}
.era-dates {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}
.era-tagline {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 4px;
}

/* ============================================================
   SUB-SLIDES (horizontal within each era)
   ============================================================ */
.sub-slides {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow: hidden;
}

.sub-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
    overflow-y: auto;
    padding: 20px 40px 60px;
}
.sub-slide.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}
.sub-slide.exit-left {
    opacity: 0;
    transform: translateX(-40px);
}

/* Sub-slide types */
.sub-slide--hook {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding-top: 12vh;
}
.sub-slide--beat {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
}
.sub-slide--people {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
}
.sub-slide--legacy {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding-top: 12vh;
}

/* Sub-slide inner content wrapper */
.sub-content {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

/* ── Sub-nav (bottom dots) ── */
.sub-nav {
    position: relative;
    z-index: 3;
    height: var(--sub-nav-h);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
}

.sub-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--accent);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}
.sub-dot:hover { background: rgba(44,95,138,0.3); }
.sub-dot.active { background: var(--accent); transform: scale(1.3); }
.sub-dot.visited { background: rgba(44,95,138,0.4); }

/* Sub-slide counter (bottom center, global) */
.sub-slide-counter {
    display: none;
}

/* ============================================================
   NARRATIVE TEXT — storytelling prose
   ============================================================ */
.narrative {
    font-size: clamp(15px, 1.8vw, 17px);
    line-height: 1.85;
    color: var(--text);
    margin-bottom: 20px;
}
.narrative .highlight {
    color: var(--accent);
    font-weight: 600;
}
.narrative .gold {
    color: var(--accent2);
    font-weight: 600;
}
.narrative .dramatic {
    font-size: 1.15em;
    font-weight: 600;
    display: block;
    margin: 12px 0;
}

/* Hook text (large opening) */
.hook-text {
    font-family: var(--heading-font);
    font-size: clamp(22px, 3.5vw, 34px);
    line-height: 1.5;
    color: var(--text);
    max-width: 700px;
    margin-bottom: 24px;
}
.hook-text .gold { color: var(--accent2); }

.hook-date {
    font-family: var(--body-font);
    font-size: 13px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
    font-weight: 600;
}

.hook-location {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 8px;
}

/* Legacy / closing quote */
.legacy-quote {
    font-family: var(--heading-font);
    font-size: clamp(18px, 3vw, 26px);
    line-height: 1.6;
    color: var(--text);
    font-style: italic;
    max-width: 600px;
    margin: 0 auto 20px;
}
.legacy-source {
    font-family: var(--body-font);
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================================
   VISUAL STAGE — SVG / diagram area
   ============================================================ */
.visual-stage {
    background: var(--bg-alt);
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
    border: 1px solid var(--border);
    position: relative;
    color: var(--text);
}
.visual-stage-title {
    font-family: var(--body-font);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
    text-align: center;
}
.visual-stage svg {
    display: block;
    margin: 0 auto;
    max-width: 100%;
}
.visual-stage-caption {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 12px;
    font-style: italic;
}

/* Map container (within visual stage or standalone) */
.map-container {
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0;
}

/* Leaflet map label tooltips */
.map-label {
    background: rgba(0,0,0,0.7) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 2px 8px !important;
    font-family: var(--body-font) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
}
.map-label::before { border-top-color: rgba(0,0,0,0.7) !important; }

/* Leaflet overrides inside visual stage */
.visual-stage .leaflet-container {
    border-radius: 8px;
    font-family: var(--body-font);
}

/* ============================================================
   FORMULA REVEAL — animate in when sub-slide enters
   ============================================================ */
.formula-reveal {
    background: var(--cream);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 16px 20px;
    margin: 20px 0;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.formula-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.formula-label {
    font-family: var(--body-font);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}
.formula-math {
    text-align: center;
    margin: 8px 0;
    font-size: 18px;
}
.formula-explain {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 8px;
}

/* ============================================================
   SIDE STORY — expandable inline cards
   ============================================================ */
.side-story-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--body-font);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent2);
    background: rgba(212,168,83,0.08);
    border: 1px solid rgba(212,168,83,0.2);
    border-radius: 20px;
    padding: 6px 14px;
    cursor: pointer;
    margin: 8px 4px;
    transition: all 0.3s;
}
.side-story-trigger:hover {
    background: rgba(212,168,83,0.15);
    transform: translateY(-1px);
}
.side-story-trigger::before {
    content: '📖';
    font-size: 14px;
}

/* Side story drawer (slide-in panel) */
.side-story-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 90vw;
    height: 100%;
    z-index: 950;
    background: var(--bg);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 30px rgba(0,0,0,0.15);
    transition: right 0.4s cubic-bezier(0.4,0,0.2,1);
    overflow-y: auto;
    padding: 60px 28px 28px;
}
.side-story-drawer.open { right: 0; }

.side-story-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}
.side-story-close:hover { border-color: var(--accent); color: var(--accent); }

.side-story-backdrop {
    position: fixed;
    inset: 0;
    z-index: 940;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.side-story-backdrop.visible { opacity: 1; pointer-events: auto; }

/* Side story body content */
.side-story-body h3 {
    font-family: var(--heading-font);
    font-size: 22px;
    color: var(--text);
    margin-bottom: 16px;
}
.side-story-body p {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 12px;
}
.side-story-body .formula-reveal {
    opacity: 1;
    transform: none;
}

/* ============================================================
   TOOLTIP
   ============================================================ */
.tooltip {
    position: fixed;
    z-index: 960;
    background: var(--text);
    color: #F5F3EF;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    max-width: 280px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.tooltip.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

.tooltip-arrow {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 5px;
    overflow: hidden;
}
.tooltip-arrow::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 0;
    width: 10px;
    height: 10px;
    background: var(--text);
    transform: rotate(45deg);
}

.tooltip-trigger {
    border-bottom: 1px dashed var(--accent);
    cursor: help;
    transition: border-color 0.2s;
}
.tooltip-trigger:hover { border-color: var(--accent2); }

/* ============================================================
   PHOTO CARD — real photos with flip hover
   ============================================================ */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.photo-card {
    perspective: 800px;
    cursor: pointer;
}

.photo-card-inner {
    position: relative;
    border-radius: 12px;
    transition: transform 0.6s cubic-bezier(0.4,0,0.2,1);
    transform-style: preserve-3d;
}
.photo-card:hover .photo-card-inner { transform: rotateY(180deg); }

.photo-card-front, .photo-card-back {
    border-radius: 12px;
    backface-visibility: hidden;
    overflow: hidden;
}

.photo-card-front {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    padding: 16px;
    text-align: center;
}
.photo-card-back {
    position: absolute;
    inset: 0;
    transform: rotateY(180deg);
    background: var(--accent);
    color: #fff;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--accent);
}

.photo-card-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 12px;
    border: 3px solid var(--border);
    background: var(--cream);
}
.photo-card-emoji {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 12px;
    background: var(--cream);
    border: 3px solid var(--border);
}

.photo-card-name {
    font-family: var(--heading-font);
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}
.photo-card-dates {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.photo-card-role {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}
.photo-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.photo-card-back-title {
    font-family: var(--heading-font);
    font-size: 15px;
    margin-bottom: 8px;
    color: #fff;
}
.photo-card-back-text {
    font-size: 13px;
    line-height: 1.6;
    opacity: 0.9;
}
.photo-card-back-label {
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.6;
    margin-bottom: 6px;
}

/* ============================================================
   AUDIO TOGGLE
   ============================================================ */
.audio-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(245,243,239,0.9);
    backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.3s;
}
.audio-toggle:hover { border-color: var(--accent); color: var(--accent); }
.audio-toggle.muted { opacity: 0.5; }

.audio-icon { pointer-events: none; }

/* ============================================================
   NAVIGATION ARROWS
   ============================================================ */
.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    background: rgba(245,243,239,0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.3s;
}
.nav-arrow:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-50%) scale(1.1); }

.nav-prev { left: 16px; }
.nav-next { right: 16px; }

.nav-label {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--body-font);
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.nav-prev .nav-label { left: 52px; }
.nav-next .nav-label { right: 52px; }
.nav-arrow:hover .nav-label { opacity: 1; }

/* ============================================================
   FINALE SLIDE
   ============================================================ */
.era-finale {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F5F3EF;
}
.finale-content {
    text-align: center;
    max-width: 800px;
    padding: 40px 20px;
}
.finale-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(28px, 5vw, 44px);
    color: var(--text);
    margin-bottom: 24px;
}
.finale-arc {
    margin: 24px 0;
}
.finale-quote {
    font-family: 'Playfair Display', serif;
    font-size: clamp(16px, 2.5vw, 22px);
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.7;
    margin: 20px 0;
}
.finale-credit {
    margin-top: 32px;
}

/* ============================================================
   12 ERA THEMES — CSS Custom Properties per theme
   ============================================================ */

/* ── Theme 1: Cave (Prehistory) ── */
.theme-1 {
    --bg: #2C2416;
    --bg-alt: #362E1F;
    --text: #F2EBE0;
    --text-muted: #D8CCB4;
    --text-secondary: #BEB09A;
    --accent: #D4A87A;
    --accent-light: #E4B88A;
    --accent2: #F0D080;
    --border: #4A3F30;
    --cream: #3A3225;
    --shadow: rgba(0,0,0,0.3);
    --heading-font: 'Playfair Display', serif;
    --body-font: 'Inter', sans-serif;
}

/* ── Theme 2: Clay (Mesopotamia) ── */
.theme-2 {
    --bg: #D4C5A9;
    --bg-alt: #C9BA9C;
    --text: #3A2F1E;
    --text-muted: #5A4E3A;
    --text-secondary: #7A6E58;
    --accent: #6B4226;
    --accent-light: #8B5A36;
    --accent2: #C4956A;
    --border: #B0A48C;
    --cream: #DDD0B8;
    --shadow: rgba(60,40,10,0.12);
    --heading-font: 'Noto Sans', sans-serif;
    --body-font: 'Inter', sans-serif;
}

/* ── Theme 3: Papyrus (Egypt) ── */
.theme-3 {
    --bg: #E8D5B5;
    --bg-alt: #DBC8A4;
    --text: #2E2416;
    --text-muted: #5A4830;
    --text-secondary: #7A6850;
    --accent: #C5A55A;
    --accent-light: #D4B46A;
    --accent2: #1B6B5A;
    --border: #C4B290;
    --cream: #F0E0C8;
    --shadow: rgba(60,40,10,0.1);
    --heading-font: 'Cormorant Garamond', serif;
    --body-font: 'Inter', sans-serif;
}

/* ── Theme 4: Marble (Greece) ── */
.theme-4 {
    --bg: #F0F0F0;
    --bg-alt: #E8E8E8;
    --text: #1A1A2E;
    --text-muted: #4A4A5E;
    --text-secondary: #6A6A7E;
    --accent: #1B4F72;
    --accent-light: #2C6F92;
    --accent2: #C9A84C;
    --border: #CDCDCD;
    --cream: #F6F6F6;
    --shadow: rgba(0,0,0,0.06);
    --heading-font: 'Cormorant Garamond', serif;
    --body-font: 'Inter', sans-serif;
}

/* ── Theme 5: Mandala (India) ── */
.theme-5 {
    --bg: #FFF8E7;
    --bg-alt: #F5EDD8;
    --text: #2A1F0A;
    --text-muted: #5A4E30;
    --text-secondary: #7A6E50;
    --accent: #D4641C;
    --accent-light: #E4742C;
    --accent2: #1B6B5A;
    --border: #E0D4B8;
    --cream: #FFF0D0;
    --shadow: rgba(60,40,10,0.08);
    --heading-font: 'Tiro Devanagari Hindi', serif;
    --body-font: 'Inter', sans-serif;
}

/* ── Theme 6: Silk (China) ── */
.theme-6 {
    --bg: #F5F0E8;
    --bg-alt: #EBE4DA;
    --text: #1A1210;
    --text-muted: #4A4240;
    --text-secondary: #6A625E;
    --accent: #8B0000;
    --accent-light: #A02020;
    --accent2: #C4956A;
    --border: #D4CCC0;
    --cream: #FAF4EC;
    --shadow: rgba(40,20,10,0.08);
    --heading-font: 'Noto Serif SC', serif;
    --body-font: 'Inter', sans-serif;
}

/* ── Theme 7: Arabesque (Islamic Golden Age) ── */
.theme-7 {
    --bg: #1A2530;
    --bg-alt: #22303E;
    --text: #F2EEE2;
    --text-muted: #D4CCB8;
    --text-secondary: #B8B0A0;
    --accent: #D4B85C;
    --accent-light: #E4C86C;
    --accent2: #6BBBBB;
    --border: #344050;
    --cream: #263545;
    --shadow: rgba(0,0,0,0.3);
    --heading-font: 'Amiri', serif;
    --body-font: 'Inter', sans-serif;
}

/* ── Theme 8: Codex (Renaissance) ── */
.theme-8 {
    --bg: #F4ECD8;
    --bg-alt: #EAE0C8;
    --text: #2A2014;
    --text-muted: #5A4E3A;
    --text-secondary: #7A6E58;
    --accent: #5C3A21;
    --accent-light: #7C5A41;
    --accent2: #1B5F6A;
    --border: #D4C8B0;
    --cream: #FFF5E0;
    --shadow: rgba(40,20,0,0.08);
    --heading-font: 'Libre Baskerville', serif;
    --body-font: 'Inter', sans-serif;
}

/* ── Theme 9: Enlightenment (Calculus) ── */
.theme-9 {
    --bg: #FFFFF0;
    --bg-alt: #F5F5E4;
    --text: #1A1A2E;
    --text-muted: #4A4A5E;
    --text-secondary: #6A6A7E;
    --accent: #2C3E50;
    --accent-light: #3C5E70;
    --accent2: #C9A84C;
    --border: #D4D4C4;
    --cream: #FAFAE8;
    --shadow: rgba(0,0,0,0.06);
    --heading-font: 'EB Garamond', serif;
    --body-font: 'Inter', sans-serif;
}

/* ── Theme 10: Victorian (19th Century) ── */
.theme-10 {
    --bg: #1F1F2E;
    --bg-alt: #2A2A3E;
    --text: #F4F2F0;
    --text-muted: #D0CEC8;
    --text-secondary: #B0AEA8;
    --accent: #D4B36A;
    --accent-light: #E4C37A;
    --accent2: #7BBBDD;
    --border: #3A3A4E;
    --cream: #2A2A3A;
    --shadow: rgba(0,0,0,0.3);
    --heading-font: 'Playfair Display', serif;
    --body-font: 'Inter', sans-serif;
}

/* ── Theme 11: Modernist (20th Century) ── */
.theme-11 {
    --bg: #FAFAFA;
    --bg-alt: #F0F0F0;
    --text: #1A1A1A;
    --text-muted: #5A5A5A;
    --text-secondary: #7A7A7A;
    --accent: #E63946;
    --accent-light: #F64956;
    --accent2: #1D3557;
    --border: #E0E0E0;
    --cream: #F5F5F5;
    --shadow: rgba(0,0,0,0.06);
    --heading-font: 'Space Grotesk', sans-serif;
    --body-font: 'Inter', sans-serif;
}

/* ── Theme 12: Digital (21st Century) ── */
.theme-12 {
    --bg: #0A0E27;
    --bg-alt: #121838;
    --text: #F0F4FC;
    --text-muted: #C0C8DC;
    --text-secondary: #A0A8C0;
    --accent: #00D4FF;
    --accent-light: #40E4FF;
    --accent2: #FF6B9D;
    --border: #1E2848;
    --cream: #141C3A;
    --shadow: rgba(0,0,0,0.4);
    --heading-font: 'Space Mono', monospace;
    --body-font: 'Inter', sans-serif;
}

/* ── Theme inheritance for timeline bar & overlays ── */
.era-slide.active ~ .timeline-bar,
body.theme-dark .timeline-bar {
    background: rgba(26,37,48,0.92);
    border-bottom-color: rgba(255,255,255,0.1);
}

/* ============================================================
   ERA TEXTURES (decorative backgrounds via CSS)
   ============================================================ */

/* Cave: rock grain + faint cave paintings */
.theme-1 .era-parallax-bg {
    background:
        url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E"),
        radial-gradient(ellipse at 20% 80%, rgba(196,149,106,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(196,149,106,0.03) 0%, transparent 50%);
}

/* Clay: cuneiform-inspired subtle pattern */
.theme-2 .era-parallax-bg {
    background:
        repeating-linear-gradient(90deg, transparent, transparent 30px, rgba(107,66,38,0.03) 30px, rgba(107,66,38,0.03) 31px),
        repeating-linear-gradient(0deg, transparent, transparent 12px, rgba(107,66,38,0.02) 12px, rgba(107,66,38,0.02) 13px);
}

/* Papyrus: horizontal fiber lines */
.theme-3 .era-parallax-bg {
    background:
        repeating-linear-gradient(0deg, transparent, transparent 16px, rgba(197,165,90,0.04) 16px, rgba(197,165,90,0.04) 17px),
        repeating-linear-gradient(90deg, transparent, transparent 80px, rgba(197,165,90,0.02) 80px, rgba(197,165,90,0.02) 81px);
}

/* Marble: veining effect */
.theme-4 .era-parallax-bg {
    background:
        url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.02' numOctaves='5'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23m)' opacity='0.02'/%3E%3C/svg%3E"),
        linear-gradient(135deg, rgba(27,79,114,0.02) 0%, transparent 40%, rgba(201,168,76,0.02) 100%);
}

/* Mandala: corner decorations */
.theme-5 .era-parallax-bg {
    background:
        radial-gradient(circle at 0% 0%, rgba(212,100,28,0.04) 0%, transparent 30%),
        radial-gradient(circle at 100% 0%, rgba(212,100,28,0.04) 0%, transparent 30%),
        radial-gradient(circle at 0% 100%, rgba(212,100,28,0.04) 0%, transparent 30%),
        radial-gradient(circle at 100% 100%, rgba(212,100,28,0.04) 0%, transparent 30%);
}

/* Silk: brush strokes */
.theme-6 .era-parallax-bg {
    background:
        repeating-linear-gradient(90deg, transparent, transparent 22px, rgba(139,0,0,0.02) 22px, rgba(139,0,0,0.02) 23px),
        repeating-linear-gradient(0deg, transparent, transparent 22px, rgba(139,0,0,0.015) 22px, rgba(139,0,0,0.015) 23px);
}

/* Arabesque: geometric star hints */
.theme-7 .era-parallax-bg {
    background:
        url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L35 25 L55 30 L35 35 L30 55 L25 35 L5 30 L25 25 Z' fill='none' stroke='rgba(201,168,76,0.06)' stroke-width='0.5'/%3E%3C/svg%3E"),
        radial-gradient(ellipse at 50% 50%, rgba(91,170,170,0.04) 0%, transparent 60%);
}

/* Codex: notebook grid */
.theme-8 .era-parallax-bg {
    background:
        repeating-linear-gradient(90deg, transparent, transparent 28px, rgba(92,58,33,0.03) 28px, rgba(92,58,33,0.03) 29px),
        repeating-linear-gradient(0deg, transparent, transparent 28px, rgba(92,58,33,0.02) 28px, rgba(92,58,33,0.02) 29px);
}

/* Enlightenment: ink & quill */
.theme-9 .era-parallax-bg {
    background:
        radial-gradient(circle at 10% 90%, rgba(44,62,80,0.03) 0%, transparent 30%),
        repeating-linear-gradient(0deg, transparent, transparent 18px, rgba(44,62,80,0.015) 18px, rgba(44,62,80,0.015) 19px);
}

/* Victorian: engraving lines */
.theme-10 .era-parallax-bg {
    background:
        repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(196,163,90,0.02) 3px, rgba(196,163,90,0.02) 4px),
        repeating-linear-gradient(-45deg, transparent, transparent 3px, rgba(196,163,90,0.02) 3px, rgba(196,163,90,0.02) 4px);
}

/* Modernist: Bauhaus geometric */
.theme-11 .era-parallax-bg {
    background:
        radial-gradient(circle at 85% 15%, rgba(230,57,70,0.04) 0%, transparent 20%),
        radial-gradient(circle at 15% 85%, rgba(29,53,87,0.04) 0%, transparent 20%),
        linear-gradient(90deg, transparent 49.5%, rgba(230,57,70,0.02) 49.5%, rgba(230,57,70,0.02) 50.5%, transparent 50.5%);
}

/* Digital: grid + glow */
.theme-12 .era-parallax-bg {
    background:
        repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(0,212,255,0.04) 39px, rgba(0,212,255,0.04) 40px),
        repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(0,212,255,0.03) 39px, rgba(0,212,255,0.03) 40px),
        radial-gradient(ellipse at 50% 50%, rgba(0,212,255,0.06) 0%, transparent 50%);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseGlow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}
@keyframes drawPath {
    from { stroke-dashoffset: 1000; }
    to { stroke-dashoffset: 0; }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    :root {
        --timeline-h: 40px;
    }

    .timeline-dot { width: 24px; height: 24px; }
    .dot-label { font-size: 9px; }
    .timeline-era-label { display: none; }

    .sub-slide { padding: 16px 20px 50px; }
    .hook-text { font-size: clamp(18px, 5vw, 26px); }
    .narrative { font-size: 14px; }
    .visual-stage { padding: 16px; }

    .people-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

    .nav-arrow { width: 36px; height: 36px; }
    .nav-label { display: none; }
    .nav-prev { left: 8px; }
    .nav-next { right: 8px; }

    .side-story-drawer { width: 100%; max-width: 100vw; right: -100%; }
}

@media (max-width: 480px) {
    .timeline-track { gap: 3px; }
    .timeline-dot { width: 20px; height: 20px; font-size: 9px; }

    .sub-slide { padding: 12px 16px 45px; }
    .hook-text { font-size: clamp(16px, 5vw, 22px); }

    .people-grid { grid-template-columns: 1fr; }

    .era-header { padding: 12px 16px 8px; }
    .era-title { font-size: 22px; }
}
