/* California HSR — High-end data story */
/* Inspired by NYT Graphics / The Pudding */

:root {
    --ink: #0a0a0a;
    --ink-80: #333;
    --ink-60: #666;
    --ink-40: #999;
    --ink-20: #ccc;
    --ink-10: #e5e5e5;
    --ink-05: #f2f2f2;
    --white: #fff;
    --red: #e03131;
    --red-light: rgba(224, 49, 49, 0.08);
    --red-dark: #c92a2a;
    --amber: #f59f00;
    --green: #37b24d;
    --blue: #228be6;
    --bg-dark: #111;
    --bg-dark-card: #1a1a1a;
    --font: 'DM Sans', -apple-system, system-ui, sans-serif;
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--white);
    line-height: 1.6;
}

/* ===== HERO ===== */
.hero {
    background: var(--ink);
    color: var(--white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 60px 24px 40px;
    position: relative;
}

.hero-inner { max-width: 800px; }

.hero-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--red);
    margin-bottom: 24px;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(36px, 7vw, 72px);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.5px;
    margin-bottom: 24px;
}

.hero-deck {
    font-size: clamp(16px, 2.5vw, 20px);
    color: rgba(255,255,255,0.6);
    max-width: 560px;
    margin: 0 auto 48px;
    line-height: 1.5;
}

.hero-metrics {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
}

.hero-metric {
    padding: 16px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.hero-metric-value {
    font-family: var(--font-mono);
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 600;
    letter-spacing: -1px;
    color: var(--white);
}

.hero-metric-value.accent { color: var(--red); }
.hero-metric-value.warn { color: var(--amber); }

.hero-metric-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
}

.hero-metric-divider {
    width: 1px;
    height: 40px;
    background: rgba(255,255,255,0.15);
}

.hero-scroll {
    position: absolute;
    bottom: 32px;
    font-size: 12px;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* ===== SECTIONS ===== */
.section {
    padding: 100px 24px;
    max-width: 900px;
    margin: 0 auto;
}

.section-dark {
    background: var(--bg-dark);
    color: var(--white);
    max-width: none;
    padding: 100px 24px;
}

.section-dark > * {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.section-head { margin-bottom: 56px; }

.section-num {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--red);
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.section-head h2 {
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 400;
    line-height: 1.15;
    margin-bottom: 12px;
}

.section-dark .section-head h2 { color: var(--white); }

.section-deck {
    font-size: 17px;
    color: var(--ink-60);
    max-width: 600px;
    line-height: 1.6;
}

.section-deck strong { color: var(--ink); font-weight: 600; }
.section-dark .section-deck { color: rgba(255,255,255,0.5); }
.section-dark .section-deck strong { color: var(--white); }

/* ===== VISUALIZATIONS ===== */
.viz-full {
    margin: 48px 0;
}

.viz-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-40);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ink-10);
}

.viz-title.light {
    color: rgba(255,255,255,0.35);
    border-color: rgba(255,255,255,0.1);
}

#cost-chart, #timeline-chart, #contractor-chart, #global-chart, #spending-chart, #funding-chart {
    width: 100%;
    min-height: 360px;
}

#route-map {
    width: 100%;
    min-height: 480px;
}

.chart-source {
    font-size: 11px;
    color: var(--ink-40);
    margin-top: 8px;
}

.section-dark .chart-source {
    color: rgba(255,255,255,0.25);
}

/* ===== DATA GRID ===== */
.data-grid {
    display: grid;
    gap: 16px;
    margin: 40px 0;
}

.data-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.data-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.data-card {
    padding: 24px;
    border-radius: 8px;
    border: 1px solid var(--ink-10);
    background: var(--white);
}

.data-card.dark {
    background: var(--ink);
    border: none;
    color: var(--white);
}

.data-card-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ink-40);
    margin-bottom: 8px;
}

.data-card.dark .data-card-label { color: rgba(255,255,255,0.4); }

.data-card-value {
    font-family: var(--font-mono);
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 8px;
}

.data-card-value .unit {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.5;
}

.data-card-context {
    font-size: 13px;
    color: var(--ink-40);
}

.data-card.dark .data-card-context { color: rgba(255,255,255,0.35); }

/* ===== ALTERNATIVES GRID ===== */
.alt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 2px;
    background: var(--ink-10);
    border-radius: 8px;
    overflow: hidden;
}

.alt-item {
    background: var(--white);
    padding: 28px 20px;
    text-align: center;
    transition: background 0.2s;
}

.alt-item:hover { background: var(--ink-05); }

.alt-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 600;
    color: var(--red);
    letter-spacing: -1px;
}

.alt-label {
    font-size: 12px;
    color: var(--ink-60);
    margin-top: 4px;
    line-height: 1.3;
}

/* ===== TIMELINE COMPACT ===== */
.timeline-compact {
    margin: 48px 0 0;
    position: relative;
    padding-left: 28px;
}

.timeline-compact::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--ink-10);
}

.tc-item {
    position: relative;
    padding: 12px 0 12px 20px;
}

.tc-dot {
    position: absolute;
    left: -24px;
    top: 18px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 2px var(--green);
}

.tc-item.warn .tc-dot { background: var(--amber); box-shadow: 0 0 0 2px var(--amber); }
.tc-item.future .tc-dot { background: var(--ink-40); box-shadow: 0 0 0 2px var(--ink-40); }
.tc-item.unknown .tc-dot { background: transparent; border: 2px dashed var(--ink-40); box-shadow: none; }

.tc-date {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-40);
    margin-bottom: 2px;
}

.tc-text {
    font-size: 14px;
    color: var(--ink-60);
    line-height: 1.5;
}

.tc-text strong { color: var(--ink); }

/* ===== PROGRESS STRIP ===== */
.progress-strip {
    margin: 0 0 48px;
}

.ps-bar {
    height: 32px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.ps-fill {
    position: absolute;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px 0 0 4px;
    background: var(--green);
    transition: width 1.5s ease-out;
}

.ps-fill.under-construction { background: var(--amber); border-radius: 0; }
.ps-fill.design { background: var(--blue); border-radius: 0; }

.ps-fill-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.ps-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    margin-top: 8px;
}

/* ===== DATA TABLE ===== */
.data-table { margin: 40px 0; }

.dt-row {
    display: grid;
    grid-template-columns: 2fr 100px 2fr;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--ink-10);
    font-size: 14px;
    align-items: center;
}

.dt-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ink-40);
    border-bottom-width: 2px;
}

.dt-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--ink);
}

.dt-note {
    font-size: 13px;
    color: var(--ink-40);
}

/* ===== VERDICT ===== */
.section-verdict {
    background: var(--ink);
    color: var(--white);
    max-width: none;
    padding: 100px 24px;
    text-align: center;
}

.verdict-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    max-width: 700px;
    margin: 0 auto;
}

.verdict-col {
    padding: 32px;
    border-radius: 8px;
    background: var(--bg-dark-card);
    border: 1px solid rgba(255,255,255,0.08);
    text-align: left;
}

.verdict-col.reality {
    border-color: var(--red);
    background: rgba(224, 49, 49, 0.06);
}

.verdict-col h3 {
    font-family: var(--font-display);
    font-size: 18px;
    margin-bottom: 20px;
    color: rgba(255,255,255,0.5);
}

.verdict-col.reality h3 { color: var(--red); }

.verdict-item {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 14px;
    color: rgba(255,255,255,0.6);
}

.verdict-col.reality .verdict-item { border-color: rgba(224, 49, 49, 0.15); }

.verdict-item:last-child { border-bottom: none; }

.verdict-item.broken::before {
    content: "✕ ";
    color: var(--red);
    font-weight: 700;
}

.vr {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--red);
}

.verdict-footer {
    max-width: 500px;
    margin: 48px auto 0;
    padding: 24px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 15px;
    color: rgba(255,255,255,0.6);
    line-height: 1.6;
}

.verdict-footer strong { color: var(--amber); }
.verdict-footer a { color: var(--red); text-decoration: none; font-size: 13px; }

/* ===== FOOTER ===== */
footer {
    background: var(--ink);
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 40px 24px;
}

.footer-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    flex-wrap: wrap;
}

.footer-sources {
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.footer-sources strong { color: rgba(255,255,255,0.5); }

.footer-sources a {
    color: rgba(255,255,255,0.3);
    text-decoration: none;
    transition: color 0.15s;
}

.footer-sources a:hover { color: var(--red); }

.footer-credit {
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    text-align: right;
}

.footer-credit a { color: rgba(255,255,255,0.5); text-decoration: none; }
.footer-disclaimer { font-size: 11px; color: rgba(255,255,255,0.2); }

/* ===== TOOLTIP ===== */
.tooltip {
    position: absolute;
    background: var(--ink);
    color: var(--white);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    z-index: 100;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-family: var(--font);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero { padding: 48px 20px 32px; }
    .hero-metrics { flex-wrap: wrap; gap: 0; }
    .hero-metric { padding: 12px 16px; }
    .hero-metric-divider { display: none; }
    
    .section { padding: 64px 20px; }
    .section-dark { padding: 64px 20px; }
    
    .alt-grid { grid-template-columns: repeat(2, 1fr); }
    
    .dt-row { grid-template-columns: 1fr; gap: 4px; }
    .dt-header { display: none; }
    .dt-row:not(.dt-header) { padding: 16px 0; }
    .dt-note { font-size: 12px; }
    
    .verdict-grid { grid-template-columns: 1fr; }
    
    .footer-inner { flex-direction: column; }
    .footer-credit { text-align: left; }
}

@media (max-width: 480px) {
    .alt-grid { grid-template-columns: repeat(2, 1fr); }
    .data-grid.cols-2 { grid-template-columns: 1fr; }
}
