/* Data & transparency pages — extends styles.css, uses its tokens.
   Covers: overflows.html, consent-decree.html, data.html, clean-rivers.html */

:root {
    /* River colours — validated for colour-blind separation on white */
    --river-ana: #00889c;
    --river-pot: #d07b12;
    --river-rc:  #8e63cc;
    --ink-muted: #5b6b72;
}

/* ---------- page hero ---------- */
.page-hero {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary-color));
    color: white;
    padding: 3.5rem 0 3rem;
}

.page-hero .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    opacity: 0.85;
    margin-bottom: 0.75rem;
}

.page-hero h1 {
    font-size: 2.4rem;
    line-height: 1.15;
    margin-bottom: 1rem;
    max-width: 24ch;
}

.page-hero .subtitle {
    font-size: 1.1rem;
    max-width: 62ch;
    opacity: 0.95;
    margin-bottom: 0;
}

.nav-menu a.active { color: var(--primary-color); font-weight: 600; }

/* ---------- layout ---------- */
.content-section { padding: 3rem 0; }
.content-section.alt { background: var(--bg-gray); }
.container.narrow { max-width: 760px; }
.section-intro { color: var(--text-light); max-width: 65ch; }
.content-section h2 { scroll-margin-top: 90px; }

/* ---------- stat row ---------- */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.stat-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--primary-dark);
    font-variant-numeric: tabular-nums;
}

.stat-value.good { color: var(--success-color); }
.stat-value.bad  { color: var(--danger-color); }
.stat-note { font-size: 0.85rem; color: var(--text-light); line-height: 1.4; }

/* ---------- charts ---------- */
.chart-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem 1.25rem 1rem;
    overflow-x: auto;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    list-style: none;
    margin: 0 0 1.1rem;
    padding: 0;
    font-size: 0.9rem;
    color: var(--text-light);
}

.chart-legend li { display: flex; align-items: center; gap: 0.45rem; }

.key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }

.chart-card svg { display: block; width: 100%; height: auto; }
.chart-card .grid line { stroke: #eef2f4; stroke-width: 1; }
.chart-card .axis text { font-size: 10px; fill: var(--text-light); }
.chart-card .annot { font-size: 11px; fill: var(--text-color); }
.chart-card .annot-rule { stroke: var(--text-light); stroke-width: 1; stroke-dasharray: 2 3; }
.bar-group .bar-seg { transition: opacity 0.12s ease; }
.bar-group:hover .bar-seg { opacity: 0.5; }
.chart-error { color: var(--text-light); font-size: 0.9rem; margin: 0; }

.chart-note {
    font-size: 0.88rem;
    color: var(--text-light);
    margin-top: 0.9rem;
    max-width: 65ch;
}

/* ---------- tooltip ---------- */
.chart-tip {
    position: fixed;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    padding: 0.7rem 0.85rem;
    font-size: 0.85rem;
    line-height: 1.5;
    min-width: 190px;
}

.chart-tip .tip-year {
    font-weight: 700;
    color: var(--primary-dark);
    display: block;
    margin-bottom: 0.4rem;
}

.chart-tip .tip-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-variant-numeric: tabular-nums;
}

.chart-tip .tip-row span:last-child { margin-left: auto; font-weight: 600; }
.chart-tip .tip-sep {
    border-top: 1px solid var(--border-color);
    margin-top: 0.4rem;
    padding-top: 0.4rem;
}

/* ---------- compliance bars ---------- */
.cmp-row {
    display: grid;
    grid-template-columns: 150px 1fr 60px;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.cmp-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.92rem; }

.cmp-track {
    position: relative;
    height: 22px;
    background: var(--bg-gray);
    border-radius: 4px;
    overflow: visible;
}

.cmp-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--success-color);
    transition: width 0.4s ease;
}

.cmp-fill.over { background: var(--danger-color); }

.cmp-limit {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background: var(--text-color);
}

.cmp-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.cmp-value.ok { color: var(--success-color); }
.cmp-value.over { color: var(--danger-color); }
.cmp-legend { font-size: 0.85rem; color: var(--text-light); margin-top: 1rem; }

/* ---------- R² bars ---------- */
.r2-row {
    display: grid;
    grid-template-columns: 1fr 220px 48px;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.6rem;
    font-size: 0.92rem;
}

.r2-track { height: 10px; background: var(--bg-gray); border-radius: 3px; }
.r2-fill { height: 100%; border-radius: 3px; background: var(--primary-color); }
.r2-fill.weak { background: var(--border-color); }
.r2-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-light); }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 2rem 0 0; padding: 0; position: relative; }

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border-color);
}

.timeline li { position: relative; padding: 0 0 1.9rem 2.4rem; }

.timeline .dot {
    position: absolute;
    left: 0;
    top: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary-color);
}

.timeline li.is-met .dot { border-color: var(--success-color); }
.timeline li.is-pending .dot { border-color: var(--warning-color); }
.timeline li.is-contested .dot { border-color: var(--danger-color); }

.timeline .t-date {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
    display: block;
    margin-bottom: 0.15rem;
}

.timeline .t-title { font-weight: 700; display: block; margin-bottom: 0.3rem; }
.timeline p { margin-bottom: 0.4rem; }

/* ---------- documents ---------- */
.doc-list { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 1rem; }

.doc-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow);
}

.doc-icon { font-size: 1.6rem; line-height: 1; flex: none; }
.doc-body { flex: 1; }
.doc-body h3 { font-size: 1.05rem; margin-bottom: 0.25rem; }
.doc-meta { font-size: 0.82rem; color: var(--text-light); margin-bottom: 0.4rem; }
.doc-body p { font-size: 0.92rem; margin-bottom: 0.5rem; }

.doc-links a {
    font-size: 0.88rem;
    font-weight: 600;
    margin-right: 1rem;
    white-space: nowrap;
}

/* ---------- tables ---------- */
.data-table-wrap { overflow-x: auto; margin: 1.5rem 0; }

.data-table { border-collapse: collapse; width: 100%; font-size: 0.92rem; background: white; }

.data-table caption {
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    padding-bottom: 0.7rem;
}

.data-table th,
.data-table td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border-color); }

.data-table thead th {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    background: var(--bg-gray);
}

.data-table td.num,
.data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

.data-table tbody tr:last-child td { border-bottom: none; }

.pill {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 100px;
    white-space: nowrap;
}

.pill.ok { background: #e6f4ea; color: #1e7136; }
.pill.warn { background: #fff4d6; color: #8a6100; }
.pill.bad { background: #fdeaea; color: #a32a2a; }

/* ---------- callouts ---------- */
.callout {
    background: #fff8e6;
    border-left: 4px solid var(--warning-color);
    border-radius: 4px;
    padding: 1.1rem 1.25rem;
    margin: 1.5rem 0;
}

.callout.method {
    background: #eef6fb;
    border-left-color: var(--primary-color);
}

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

.source-note {
    font-size: 0.88rem;
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1.5rem;
}

/* ---------- cross-links ---------- */
.next-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.next-card {
    display: block;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-color);
}

.next-card:hover { box-shadow: var(--shadow-lg); text-decoration: none; }
.next-card strong { display: block; color: var(--primary-dark); margin-bottom: 0.3rem; }
.next-card span { font-size: 0.9rem; color: var(--text-light); }

@media (max-width: 768px) {
    .page-hero h1 { font-size: 1.8rem; }
    .page-hero { padding: 2.5rem 0 2rem; }
    .stat-value { font-size: 1.8rem; }
    .cmp-row { grid-template-columns: 110px 1fr 48px; gap: 0.6rem; }
    .r2-row { grid-template-columns: 1fr 100px 40px; gap: 0.5rem; font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
    .bar-group .bar-seg, .chart-tip, .cmp-fill { transition: none; }
}
