/* Base */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    background: #F5F3EF;
}

:root {
    --bg: #F5F3EF;
    --bg-warm: #F5F3EF;
    --bg-card: #FFFFFF;
    --text: #1a1a1a;
    --text-dim: #4a4a4a;
    --text-muted: #7a7a7a;
    --accent: #C41E3A;
    --accent-soft: #E8D5D5;
    --coral: #D35F5F;
    --slate: #3D5A80;
    --charcoal: #2d2d2d;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Lock scrolling when in interactive mode - chart fills screen */
/* Only lock on desktop, allow free scroll on mobile */
body.interactive-mode {
    overflow: hidden;
}

@media (max-width: 768px) {
    body.interactive-mode {
        overflow: auto;
    }
}

/* Hero - Two contrasting quotes */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(180deg, var(--bg) 0%, var(--bg-warm) 100%);
}

.hero-content {
    max-width: 700px;
}

/* Parliament Silhouette Graphic */
.hero-graphic {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.parliament-graphic {
    width: 100px;
    height: 50px;
    opacity: 0.6;
}

/* Microphone icon for quote sections */
.quote-icon {
    width: 20px;
    height: 20px;
    margin-bottom: 0.75rem;
    opacity: 0.4;
    color: var(--text-muted);
}

.hero-quote {
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    font-weight: 400;
    font-style: italic;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.hero-attribution {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0;
    letter-spacing: 0.02em;
}

.hero-spacer {
    height: 2.5rem;
}

.hero-question {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 400;
    font-style: italic;
    margin-top: 2.5rem;
    margin-bottom: 2rem;
    color: #A63D3D;
    letter-spacing: 0.01em;
}

.scroll-prompt {
    color: #A63D3D;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

.scroll-arrow {
    width: 12px;
    height: 12px;
    border-right: 1.5px solid #A63D3D;
    border-bottom: 1.5px solid #A63D3D;
    transform: rotate(45deg);
    margin: 0.5rem auto 0;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Scrollytelling */
.scrolly-container {
    position: relative;
    padding-bottom: 300vh; /* Keeps sticky alive because it's inside the container */
}

.sticky-viz {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Align to top so chart doesn't shift */
    padding: 3rem 3rem 1rem 3rem;
    background: var(--bg);
    z-index: 100; /* Below scroll-sections during story */
    overflow: visible;
    /* Removed pointer-events: none - chart should always be clickable */
}

.viz-header {
    text-align: center;
    margin-bottom: 0.75rem;
    position: relative;
    min-height: 80px; /* Fixed height prevents chart from jumping */
    display: flex;
    flex-direction: column;
    justify-content: center;
    pointer-events: none; /* Don't block clicks to chart */
}

.viz-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.viz-header p {
    font-size: 1.2rem;
    color: var(--text-dim);
    font-family: 'Newsreader', serif;
    font-style: italic;
}

#timeline-viz {
    flex: 1;
    position: relative;
    min-height: 400px;
}

#timeline-viz svg {
    position: relative;
    z-index: 101;
}

.viz-legend {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Mobile legend - hidden on desktop */
.mobile-legend {
    display: none;
}

.mobile-legend-group {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.legend-arrow {
    font-weight: bold;
    font-size: 0.7rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text);
    font-weight: 500;
}

.legend-item .dot {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.year-progress {
    margin-top: 0.75rem;
    padding: 0 15%;
    pointer-events: none; /* Don't block clicks to chart */
}

.progress-bar {
    height: 3px;
    background: #e0ddd8;
    border-radius: 2px;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--coral) 0%, var(--slate) 100%);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* Scroll sections */
.scroll-sections {
    position: relative;
    z-index: 200;
    pointer-events: none;
}

.step {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    margin-bottom: 5vh;
    pointer-events: none;
}

.step-content {
    background: var(--bg-card);
    padding: 1.5rem;
    max-width: 420px;
    margin: 0 auto;
    border-radius: 4px;
    pointer-events: auto;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    border-left: 3px solid var(--accent);
}

/* Era badge */
.era-badge {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

/* Setup text */
.setup {
    font-size: 0.95rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

/* Quote */
.quote {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text);
    margin: 0 0 0.75rem 0;
    padding: 0;
    border: none;
}

/* Quote highlights - use <mark> for yellow highlighter effect */
.quote mark {
    background: linear-gradient(180deg, transparent 40%, #fff176 40%);
    color: inherit;
    padding: 0 2px;
}

/* Attribution */
.attribution {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Reflection */
.reflection {
    font-size: 0.9rem;
    color: var(--text-dim);
    font-style: italic;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0,0,0,0.08);
    margin: 0;
}

/* Color reference in reflection */
.reflection .color-ref {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    vertical-align: middle;
    margin: 0 2px;
}

/* Conclusion section - needs extra height to prevent skipping to explore */
#conclusion.step {
    min-height: 100vh;
    padding-bottom: 20vh;
}

/* Conclusion */
.conclusion-content {
    max-width: 500px;
    text-align: center;
    margin: 0 auto;
    border-left: none;
    border-top: 3px solid var(--accent);
}

.conclusion-content h3 {
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.conclusion-text p {
    font-size: 1rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

.conclusion-text p:last-child {
    color: var(--text);
    font-weight: 500;
}

.stats-box {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-warm);
    border-radius: 6px;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.explore-cta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* Word Change Visualization */
.word-change-viz {
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: var(--bg-warm);
    border-radius: 6px;
}

.word-change-header {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 1rem;
    text-align: center;
}

.word-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.word-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bar-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 70px;
    text-align: right;
    flex-shrink: 0;
}

.bar-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bar {
    height: 20px;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.bar-then {
    background: var(--slate);
}

.bar-now {
    background: var(--coral);
}

.bar-value {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 500;
}

.word-change-multiplier {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: 0.75rem;
}

.word-change-unit {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Word Trends Sections */
.trends-intro-content {
    text-align: center;
    border-left: none;
    border-top: 3px solid var(--accent);
    background: var(--bg-card);
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
}

.trends-intro-content h3 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}

.trends-intro-content .setup {
    color: var(--text-dim);
    font-size: 0.95rem;
}

/* Stat Highlight */
.stat-highlight-content {
    border-left-color: var(--coral);
}

.stat-highlight-content h3 {
    font-size: 1.4rem;
    color: var(--coral);
    margin-bottom: 0.75rem;
}

.trends-content {
    max-width: 500px;
}

.trends-content h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.trends-content.rising {
    border-left-color: var(--coral);
}

.trends-content.declining {
    border-left-color: var(--slate);
}

/* Sparkline Grid */
.sparkline-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--bg-warm);
    border-radius: 6px;
}

.sparkline-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: var(--bg-card);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sparkline-word {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text);
    text-transform: lowercase;
}

.sparkline {
    display: block;
}

.sparkline-change {
    font-size: 0.65rem;
    font-weight: 600;
}

.sparkline-change.rising {
    color: var(--coral);
}

.sparkline-change.declining {
    color: var(--slate);
}

.sparkline-rate {
    font-size: 0.6rem;
    color: var(--text-dim);
    margin-top: 2px;
}

/* PM Era Chart */
.pm-era-content {
    max-width: 450px;
}

.pm-era-chart {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pm-era-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pm-era-label {
    width: 140px;
    flex-shrink: 0;
    text-align: right;
}

.pm-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.pm-years {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.pm-era-bar-container {
    flex: 1;
    height: 32px;
    background: #f0efeb;
    border-radius: 4px;
    overflow: hidden;
}

.pm-era-bar-container.stacked {
    display: flex;
}

.pm-era-bar-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.6s ease;
    min-width: 30px;
}

.pm-era-bar-segment.promises {
    background: var(--coral);
    border-radius: 4px 0 0 4px;
}

.pm-era-bar-segment.demands {
    background: var(--slate);
    border-radius: 0 4px 4px 0;
}

.segment-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.pm-era-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.pm-era-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.promises {
    background: var(--coral);
}

.legend-color.demands {
    background: var(--slate);
}

/* Decade Chart */
.decade-era-content {
    max-width: 500px;
}

.decade-chart {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 1.5rem 0;
}

.decade-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.decade-label {
    min-width: 50px;
    text-align: right;
}

.decade-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--charcoal);
}

.decade-bar-container {
    flex: 1;
    height: 28px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.decade-bar-container.stacked {
    display: flex;
}

.decade-bar-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.6s ease;
    min-width: 25px;
}

.decade-bar-segment.promises {
    background: var(--coral);
    border-radius: 4px 0 0 4px;
}

.decade-bar-segment.demands {
    background: var(--slate);
    border-radius: 0 4px 4px 0;
}

.decade-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.decade-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* FM Table */
.fm-table-content {
    max-width: 480px;
    margin-top: 8rem;
}

.fm-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.6rem 0;
    font-size: 0.7rem;
}

.fm-table thead {
    background: var(--bg-warm);
}

.fm-table th {
    text-align: left;
    padding: 0.5rem;
    font-weight: 600;
    color: var(--charcoal);
    border-bottom: 2px solid var(--accent);
}

.fm-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.fm-table .fm-era {
    color: var(--text-dim);
    font-size: 0.75rem;
    white-space: nowrap;
}

.fm-table .fm-name {
    font-weight: 500;
    white-space: nowrap;
}

.fm-table .fm-words {
    color: var(--slate);
    font-style: italic;
}

.fm-table tbody tr:hover {
    background: var(--bg-warm);
}

/* Persistent Words Chart */
.persistent-words-content {
    max-width: 450px;
}

.persistent-words-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.75rem;
}

.persistent-words-table th {
    padding: 0.4rem 0.3rem;
    font-weight: 600;
    color: var(--text-dim);
    font-size: 0.7rem;
}

.persistent-words-table .word-label {
    text-align: right;
    padding-right: 0.6rem;
    font-weight: 600;
    color: var(--charcoal);
    font-style: italic;
}

.persistent-words-table .rate-cell {
    text-align: center;
    padding: 0.35rem 0.25rem;
    font-size: 0.65rem;
    font-weight: 500;
    border-radius: 0;
}

.table-note {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Final Section */
.final-content {
    max-width: 500px;
    text-align: center;
    margin: 0 auto;
    border-left: none;
    border-top: 3px solid var(--accent);
}

.final-content h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.final-text p {
    font-size: 1rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

.final-text p:last-child {
    color: var(--text);
    font-weight: 500;
    font-style: italic;
}

/* Explore Section in scrollytelling - points to interactive section below */
.step-explore {
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.step-explore .explore-content {
    max-width: 380px;
    text-align: center;
    margin: 0 auto;
    border-left: none;
    border: 2px solid var(--accent);
    border-radius: 8px;
    background: rgba(255,255,255,0.97);
    transition: opacity 0.5s ease;
}

/* Hide explore content when interactive mode is active */
body.interactive-mode .explore-content {
    opacity: 0;
    pointer-events: none;
}

body.interactive-mode .step-explore {
    display: none;
}

.explore-content h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

.explore-text p {
    font-size: 0.95rem;
    color: var(--text-dim);
    line-height: 1.7;
}

.explore-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding: 0.75rem;
    background: var(--accent-soft);
    border-radius: 6px;
    animation: pulse-hint 2s infinite;
}

.hint-icon {
    font-size: 1.2rem;
}

.explore-hint span:last-child {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
}

/* Hide explore hint on mobile - text already says "click" in the red box */
@media (max-width: 768px) {
    .explore-hint {
        display: none;
    }
}

@keyframes pulse-hint {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Full-screen interstitial sections */
.step-fullscreen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.fullscreen-content {
    max-width: 700px;
    text-align: center;
    padding: 3rem 2rem;
}

.fullscreen-title {
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 400;
    line-height: 1.3;
    color: var(--text);
    margin-bottom: 2rem;
}

.fullscreen-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-dim);
}

.fullscreen-text p {
    margin-bottom: 1.5rem;
}

.fullscreen-text p:last-child {
    margin-bottom: 0;
}

/* Prose sections - regular article text */
.step-prose {
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.prose-content {
    max-width: 620px;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: 4px;
}

.prose-text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text);
}

.prose-text p {
    margin-bottom: 1.25rem;
}

.prose-text p:last-child {
    margin-bottom: 0;
}

/* Responsive for sparkline grid */
@media (max-width: 768px) {
    .sparkline-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
        padding: 0.5rem;
    }

    .sparkline-item {
        padding: 0.3rem;
    }

    .sparkline-word {
        font-size: 0.6rem;
    }

    .sparkline {
        width: 50px;
        height: 16px;
    }

    .sparkline-change {
        font-size: 0.55rem;
    }

    .sparkline-rate {
        font-size: 0.5rem;
    }

    .trends-content {
        max-width: 95%;
    }
}

/* Hover Panel - appears at top center when hovering dots */
.hover-panel {
    position: fixed;
    left: 50%;
    top: 2rem;
    transform: translateX(-50%);
    width: 500px;
    max-width: 90vw;
    max-height: calc(100vh - 4rem);
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 40px rgba(0,0,0,0.3);
    z-index: 9999;
    transition: opacity 0.15s ease, transform 0.15s ease;
    overflow-y: auto;
    border: 2px solid var(--accent);
}

.hover-panel.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
    pointer-events: none;
}

.hover-panel.pinned {
    border-color: var(--slate);
    box-shadow: 0 4px 40px rgba(61, 90, 128, 0.3);
}

.hover-panel-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    display: none;
}

.hover-panel.pinned .hover-panel-close {
    display: block;
}

.hover-panel-close:hover {
    color: var(--text);
}

.hover-panel-hint {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

.hover-panel.pinned .hover-panel-hint {
    display: none;
}

.hover-panel-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e0ddd8;
}

.hover-panel-year {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.hover-panel-fm {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.hover-panel-quote {
    font-family: 'Newsreader', serif;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
    margin: 0;
    font-style: italic;
}

.hover-panel-tag {
    margin-top: 1rem;
    padding: 0.25rem 0.6rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.hover-panel-tag:empty {
    display: none;
}

/* Dots - Non-interactive during story, enabled in interactive mode */
.dot {
    transition: opacity 0.2s ease, transform 0.15s ease;
    pointer-events: none;
    cursor: default;
}

.dot.selected {
    opacity: 1;
    stroke: #000;
    stroke-width: 1.5px;
}

/* Interactive Mode - Timeline becomes clickable after scrolling past all sections */
body.interactive-mode .scroll-sections {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    position: fixed;
    top: 100vh;
}

body.interactive-mode .step,
body.interactive-mode .step-content {
    pointer-events: none;
}

body.interactive-mode .sticky-viz {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
}

body.interactive-mode .viz-header,
body.interactive-mode .year-progress {
    pointer-events: none;
}

body.interactive-mode .dot {
    pointer-events: auto;
    cursor: pointer;
    opacity: 0.9;
}

body.interactive-mode .dot:hover {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .step {
        justify-content: center;
        align-items: center;
    }

    .step-content {
        max-width: 90%;
        margin: 0 auto;
    }

    .stats-box {
        flex-direction: column;
        gap: 1rem;
    }

    .viz-legend {
        gap: 0.75rem;
    }
}

/* Scroll spacer - maintains scroll height for sticky chart transition */
.scroll-spacer {
    height: 200vh;
    background: var(--bg);
    pointer-events: none; /* Don't block taps on the fixed chart below */
}

/* Credits and Methodology Section */
.credits-section {
    background: var(--bg);
    color: var(--text);
    padding: 4rem 2rem 6rem 2rem;
    margin-top: 2rem;
    border-top: 1px solid #e0e0e0;
}

.credits-content {
    max-width: 600px;
    margin: 0 auto;
}

.credits-block {
    margin-bottom: 1.75rem;
}

.credits-block h3 {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.credits-block p {
    font-family: 'Newsreader', serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.credits-block ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.credits-block li {
    font-family: 'Newsreader', serif;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.credits-block li strong {
    color: var(--text-dark);
}

.credits-block a {
    color: var(--accent);
    text-decoration: none;
}

.credits-block a:hover {
    text-decoration: underline;
}

/* Collapsible prompt section */
.prompt-details {
    margin-top: 0.5rem;
}

.prompt-details summary {
    cursor: pointer;
    color: var(--accent);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.85rem;
    padding: 0.25rem 0;
}

.prompt-details summary:hover {
    text-decoration: underline;
}

.prompt-content {
    margin-top: 0.75rem;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.prompt-content h4 {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dim);
    margin: 0.75rem 0 0.4rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prompt-content h4:first-child {
    margin-top: 0;
}

.prompt-content pre {
    font-family: 'IBM Plex Mono', 'Consolas', monospace;
    font-size: 0.7rem;
    line-height: 1.5;
    color: #555;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: transparent;
    padding: 0;
    margin: 0;
    overflow-x: auto;
}

.credits-byline {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.credits-byline p {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.credits-byline strong {
    color: var(--text-dark);
    font-weight: 600;
}

/* Section Navigator - subtle skip navigation (desktop only) */
.section-nav {
    position: fixed;
    left: 1.5rem;
    top: 6rem;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.section-nav.visible {
    opacity: 1;
}

.nav-hint {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.section-nav:hover .nav-hint {
    opacity: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.nav-item:hover {
    color: var(--text);
}

.nav-item.active .nav-dot {
    background: var(--accent);
    transform: scale(1.3);
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.2s ease;
}

.nav-item:hover .nav-dot {
    background: var(--text);
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    opacity: 0;
    transform: translateX(-5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.section-nav:hover .nav-label {
    opacity: 1;
    transform: translateX(0);
}

/* Hide on mobile and tablet */
@media (max-width: 1024px) {
    .section-nav {
        display: none;
    }
}

/* Keep nav visible in interactive mode - positioned in corner, won't block dots */

/* Mobile Section Navigator */
.mobile-nav {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 450;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-nav.visible {
    opacity: 1;
}

.mobile-nav-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.65rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-nav-toggle:active {
    background: #f0f0f0;
}

.mobile-nav-arrow {
    transition: transform 0.2s ease;
}

.mobile-nav.expanded .mobile-nav-arrow {
    transform: rotate(180deg);
}

.mobile-nav-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.5rem 0;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.mobile-nav.expanded .mobile-nav-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.mobile-nav-item {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-decoration: none;
    transition: background 0.15s ease;
}

.mobile-nav-item:active {
    background: var(--bg-warm);
}

.mobile-nav-item.active {
    color: var(--accent);
}

/* Show mobile nav only on mobile/tablet */
@media (max-width: 1024px) {
    .mobile-nav {
        display: block;
    }
}

/* Keep mobile nav visible in interactive mode */

/* Fixed methodology link - only visible in interactive mode */
.methodology-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.75rem;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 500;
    transition: all 0.2s ease;
    border: 1px solid #e0e0e0;
    opacity: 0;
    pointer-events: none;
}

body.interactive-mode .methodology-link {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile back button - hidden by default */
.mobile-back-btn {
    display: none;
}

/* Show mobile back button only on mobile in interactive mode */
@media (max-width: 768px) {
    body.interactive-mode .mobile-back-btn {
        display: block;
        position: fixed;
        top: 8px;
        right: 8px;
        left: auto;
        transform: none;
        background: rgba(255,255,255,0.9);
        color: var(--text-dim);
        border: 1px solid #ddd;
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
        font-family: 'IBM Plex Sans', sans-serif;
        font-size: 0.55rem;
        font-weight: 500;
        cursor: pointer;
        z-index: 9999;
        box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    }

    body.interactive-mode .mobile-back-btn:active {
        transform: scale(0.95);
        background: #f0f0f0;
    }
}

.methodology-link:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}


/* ===========================================
   MOBILE RESPONSIVE STYLES
   =========================================== */

/* Tablet breakpoint */
@media (max-width: 1024px) {
    .sticky-viz {
        padding: 2rem 2rem 1rem 2rem;
    }
    
    .viz-header h2 {
        font-size: 1.3rem;
    }
    
    .viz-header p {
        font-size: 1rem;
    }
}

/* Mobile breakpoint */
@media (max-width: 768px) {
    /* Hero adjustments */
    .hero {
        padding: 1.5rem;
        min-height: 100vh;
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    .hero-content {
        max-width: 95%;
    }

    .hero-quote {
        font-size: 1.4rem;
    }

    .hero-attribution {
        font-size: 0.8rem;
    }

    .hero-question {
        font-size: 1.4rem;
    }

    .hero-spacer {
        height: 1.5rem;
    }

    .scroll-prompt {
        font-size: 0.7rem;
    }

    .scroll-prompt span {
        font-size: 0.65rem;
        letter-spacing: 0.1em;
    }

    /* Scrolly container - less bottom padding */
    .scrolly-container {
        padding-bottom: 150vh;
    }

    /* Sticky viz container - extra top padding to show all dots */
    .sticky-viz {
        padding: 2.5rem 0.5rem 0 0.5rem;
        justify-content: flex-start;
    }

    .viz-header {
        min-height: auto;
        margin-bottom: 0.25rem;
        margin-top: 0.75rem;
    }

    .viz-header h2 {
        font-size: 0.85rem;
        margin-bottom: 0.1rem;
    }

    .viz-header p {
        font-size: 0.65rem;
        line-height: 1.3;
    }

    /* Timeline container - maximize height */
    #timeline-viz {
        min-height: 0;
        flex: 1;
        overflow: hidden;
    }

    /* Mobile legend - compact horizontal */
    .mobile-legend {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.2rem 0.6rem;
        margin-bottom: 0.25rem;
        font-size: 0.55rem;
    }

    .mobile-legend-item {
        display: flex;
        align-items: center;
        gap: 0.15rem;
        color: #888;
    }

    .mobile-legend-item .dot {
        width: 6px;
        height: 6px;
        border-radius: 1px;
    }

    /* Hide desktop legend */
    .viz-legend {
        display: none;
    }

    /* Hide year progress bar on mobile - saves space */
    .year-progress {
        display: none;
    }
    
    /* Step cards */
    .step {
        min-height: 90vh;
        padding: 0.75rem;
        margin-bottom: 2rem;
        justify-content: center;
        align-items: center;
    }

    .step-content {
        max-width: 90%;
        padding: 1rem;
        margin: 0 auto;
    }

    .step-content h3 {
        font-size: 0.9rem;
    }

    .step-content p {
        font-size: 0.8rem;
        line-height: 1.5;
    }

    .quote {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .prose-text {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .prose-text p {
        margin-bottom: 1rem;
    }

    /* FM Table - smaller on mobile */
    .fm-table {
        font-size: 0.65rem;
    }

    .fm-table th {
        padding: 0.35rem;
        font-size: 0.6rem;
    }

    .fm-table td {
        padding: 0.3rem 0.35rem;
    }

    .fm-table .fm-era {
        font-size: 0.6rem;
    }

    .fm-table .fm-words {
        font-size: 0.6rem;
    }
    
    /* Hover panel - top-aligned on mobile to avoid covering dots */
    .hover-panel {
        width: 85vw;
        max-width: 320px;
        padding: 0.75rem;
        top: 1rem;
        bottom: auto;
        left: 50%;
        transform: translateX(-50%);
    }

    /* Methodology link - centered below legend */
    .methodology-link {
        bottom: auto;
        top: 6.5rem;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: auto;
        height: auto;
        padding: 0.25rem 0.5rem;
        font-size: 0.55rem;
    }

    .hover-panel-year {
        font-size: 1rem;
    }

    .hover-panel-fm {
        font-size: 0.7rem;
    }

    .hover-panel-quote {
        font-size: 0.7rem;
        line-height: 1.4;
    }

    .hover-panel-tag {
        font-size: 0.6rem;
    }

    .hover-panel-hint {
        font-size: 0.55rem;
    }

    .hover-panel.hidden {
        transform: translateX(-50%) translateY(-10px);
        opacity: 0;
    }


    /* Year progress bar */
    .year-progress {
        padding: 0 5%;
    }
    
    /* Stats box */
    .stats-box {
        gap: 0.75rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
}

/* Small mobile breakpoint */
@media (max-width: 480px) {
    .hero {
        padding: 1rem;
    }

    .hero-quote {
        font-size: 1.2rem;
    }

    .hero-question {
        font-size: 1.2rem;
    }

    .hero-spacer {
        height: 1rem;
    }

    .scroll-prompt span {
        font-size: 0.6rem;
    }

    .sticky-viz {
        padding: 2.25rem 0.35rem 0 0.35rem;
    }

    .viz-header {
        min-height: auto;
        margin-bottom: 0.2rem;
        margin-top: 0.5rem;
    }

    .viz-header h2 {
        font-size: 0.8rem;
    }

    .viz-header p {
        font-size: 0.6rem;
        line-height: 1.25;
    }

    #timeline-viz {
        min-height: 0;
        overflow: hidden;
    }

    .mobile-legend {
        gap: 0.25rem 0.5rem;
        font-size: 0.55rem;
        margin-bottom: 0.35rem;
    }

    .mobile-legend-item .dot {
        width: 6px;
        height: 6px;
    }

    .step {
        min-height: 85vh;
        padding: 0.75rem;
    }

    .step-content {
        padding: 1rem;
    }

    .step-content h3 {
        font-size: 0.85rem;
    }

    .step-content p {
        font-size: 0.75rem;
        line-height: 1.45;
    }

    .prose-text {
        font-size: 0.9rem;
        line-height: 1.55;
    }

    .hover-panel {
        width: 90vw;
        max-width: 300px;
        left: 50%;
        padding: 0.5rem 0.6rem;
        top: 1rem;
        bottom: auto;
        transform: translateX(-50%);
    }

    .methodology-link {
        top: 5.5rem;
        left: 50%;
        right: auto;
        bottom: auto;
        transform: translateX(-50%);
        width: auto;
        height: auto;
        padding: 0.2rem 0.4rem;
        font-size: 0.5rem;
    }

    .hover-panel-header {
        flex-direction: column;
        gap: 0.1rem;
        margin-bottom: 0.35rem;
        padding-bottom: 0.35rem;
    }

    .hover-panel-year {
        font-size: 0.9rem;
    }

    .hover-panel-fm {
        font-size: 0.6rem;
    }

    .hover-panel-quote {
        font-size: 0.65rem;
        line-height: 1.35;
    }

    .hover-panel.hidden {
        transform: translateX(-50%) translateY(-10px);
        opacity: 0;
    }
}

/* Landscape mobile - prioritize chart width */
@media (max-width: 896px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 1rem 2rem;
    }
    
    .sticky-viz {
        padding: 0.5rem 1rem;
    }
    
    .viz-header {
        min-height: 40px;
        margin-bottom: 0.25rem;
    }
    
    .viz-header h2 {
        font-size: 1rem;
    }
    
    .viz-header p {
        font-size: 0.85rem;
    }
    
    .step {
        min-height: 100vh;
    }
    
    .step-content {
        max-width: 300px;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets */
    .hover-panel-close {
        display: block;
        padding: 0.5rem;
        font-size: 1.75rem;
    }
    
    .methodology-link {
        padding: 0.6rem 1rem;
    }
    
    /* Show hint about tapping */
    .hover-panel-hint {
        display: block;
    }
}
