/* UnsolvedWatch.live — Civic monument · v3
   Heavier weights · Newsreader display · readable body
   ============================================================ */

:root {
    /* Paper & ink */
    --paper:        #f4ede0;
    --paper-2:      #ebe2d1;
    --paper-3:      #ddd2bd;
    --ink:          #0a1f3d;
    --ink-2:        #2b3a55;
    --ink-3:        #56607a;
    --rule:         #b8ac8e;
    --rule-2:       #948364;

    /* Accents */
    --red:          #b8222d;
    --red-dark:     #8a1820;
    --gold:         #a37c2c;
    --navy:         #1f3a68;

    /* Map color ramp */
    --map-0:        #f4ede0;
    --map-1:        #f0b890;
    --map-2:        #e08866;
    --map-3:        #c85a3e;
    --map-4:        #a01e26;
    --map-5:        #6f1217;
    --map-none:     #d8d0bc;

    /* Type — Newsreader for display + body (cohesive newspaper feel) */
    --font-display: 'Newsreader', 'Charter', 'Iowan Old Style', Georgia, serif;
    --font-body:    'Newsreader', 'Charter', 'Iowan Old Style', Georgia, serif;
    --font-mono:    'JetBrains Mono', ui-monospace, Menlo, monospace;

    --max-width:    1320px;
    --gutter:       clamp(1.5rem, 4vw, 3rem);
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 18px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    position: relative;
    /* Newsreader looks best with these opsz tuned for body sizing */
    font-variation-settings: "opsz" 16;
}

/* Subtle paper grain */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.45;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.32 0 0 0 0 0.2 0 0 0 0.15 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
}

body > * {
    position: relative;
    z-index: 1;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.18s ease;
}

ul { list-style: none; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* ============ MASTHEAD ============ */
.masthead {
    border-bottom: 1px solid var(--rule);
    padding: 1.5rem 0 1.25rem;
    background: var(--paper);
    position: sticky;
    top: 0;
    z-index: 100;
}

.masthead::after {
    content: "";
    display: block;
    position: absolute;
    left: 0; right: 0;
    bottom: -4px;
    height: 4px;
    background: linear-gradient(
        to right,
        var(--red) 0%,
        var(--red) 33.33%,
        var(--paper-3) 33.33%,
        var(--paper-3) 66.66%,
        var(--navy) 66.66%,
        var(--navy) 100%
    );
}

.masthead .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.55rem;
    letter-spacing: -0.015em;
    color: var(--ink);
    font-variation-settings: "opsz" 24;
}

.brand-mark {
    display: inline-block;
    width: 1.4rem;
    height: 1.4rem;
    background: var(--red);
    position: relative;
    flex-shrink: 0;
}
.brand-mark::after {
    content: "";
    position: absolute;
    inset: 22%;
    background-color: var(--paper);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.nav {
    display: flex;
    gap: 2rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}

.nav a {
    color: var(--ink-2);
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    transition: all 0.18s ease;
}

.nav a:hover {
    color: var(--red);
    border-bottom-color: var(--red);
}

/* ============ HERO ============ */
.hero {
    padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2.5rem, 5vw, 4rem);
    border-bottom: 1px solid var(--rule);
    position: relative;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--red);
    letter-spacing: 0.2em;
    margin-bottom: 1.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.hero-eyebrow::before {
    content: "";
    width: 36px;
    height: 2px;
    background: var(--red);
    display: inline-block;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.5rem, 6.5vw, 5.5rem);
    line-height: 1;
    letter-spacing: -0.025em;
    margin-bottom: 2rem;
    max-width: 20ch;
    color: var(--ink);
    font-variation-settings: "opsz" 144;
}

.hero-title .line {
    display: block;
    opacity: 0;
    transform: translateY(16px);
    animation: revealLine 0.7s cubic-bezier(0.2, 0.6, 0.2, 1) forwards;
}
.hero-title .line:nth-child(1) { animation-delay: 0.05s; }
.hero-title .line:nth-child(2) { animation-delay: 0.18s; }
.hero-title .line:nth-child(3) { animation-delay: 0.31s; }
.hero-title .line:nth-child(4) { animation-delay: 0.44s; }

.hero-title .accent {
    color: var(--red);
    font-style: italic;
    font-weight: 700;
}

@keyframes revealLine {
    to { opacity: 1; transform: translateY(0); }
}

.hero-subtitle {
    font-size: clamp(1.15rem, 1.8vw, 1.4rem);
    color: var(--ink-2);
    max-width: 58ch;
    line-height: 1.5;
    margin-bottom: 3rem;
    font-weight: 500;
}

.hero-subtitle em {
    color: var(--ink);
    font-style: italic;
    font-weight: 700;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0;
    max-width: 880px;
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--rule);
}

.stat {
    padding: 1.75rem 1.5rem 1.5rem 0;
    border-right: 1px solid var(--rule);
}
.stat:last-child { border-right: none; }

@media (max-width: 600px) {
    .stat { border-right: none; border-bottom: 1px solid var(--rule); }
    .stat:last-child { border-bottom: none; }
}

/* Stats use MONO for the data feel — no more wonky serif numerals */
.stat-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(2rem, 3.4vw, 2.85rem);
    color: var(--ink);
    line-height: 1;
    margin-bottom: 0.65rem;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
}

/* ============ SECTIONS ============ */
.section {
    padding: clamp(3.5rem, 7vw, 5.5rem) 0;
    border-bottom: 1px solid var(--rule);
    position: relative;
}

.section-paper-darker {
    background: var(--paper-2);
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2.75rem;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--ink);
    padding-bottom: 1rem;
}

.section-header h2 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.85rem, 3.5vw, 2.85rem);
    letter-spacing: -0.025em;
    line-height: 1.05;
    color: var(--ink);
    font-variation-settings: "opsz" 144;
}

.section-header h2 .red { color: var(--red); }

.section-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 600;
}

.link-arrow {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 700;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: border-color 0.18s ease;
}

.link-arrow:hover {
    border-bottom-color: var(--red);
}

/* ============ HOW IT WORKS (NOW AT TOP) ============ */
.how-section {
    padding: clamp(3rem, 6vw, 4.5rem) 0;
    background: var(--paper-2);
    border-bottom: 1px solid var(--rule);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0;
    border-top: 2px solid var(--ink);
    border-left: 1px solid var(--rule);
}

.card {
    padding: 2.5rem 2rem;
    background: var(--paper);
    border-right: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.card-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--red);
    letter-spacing: 0.16em;
    margin-bottom: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.card-num::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--rule);
}

.card h3 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 0.9rem;
    letter-spacing: -0.015em;
    color: var(--ink);
    line-height: 1.15;
    font-variation-settings: "opsz" 144;
}

.card p {
    color: var(--ink-2);
    font-size: 1.02rem;
    line-height: 1.55;
    font-weight: 500;
}

/* ============ MAP ============ */
.map-section {
    padding: clamp(3rem, 6vw, 4.5rem) 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
}

.map-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    align-items: start;
}

@media (min-width: 1000px) {
    .map-wrap {
        grid-template-columns: 1fr 340px;
        gap: 3.5rem;
    }
}

/* CRITICAL: explicit aspect ratio so the SVG renders even before D3 injects */
#us-map {
    width: 100%;
    aspect-ratio: 975 / 610;
    min-height: 400px;
    position: relative;
    background: var(--paper);
}

#us-map .loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-3);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.map-canvas {
    width: 100%;
    height: 100%;
    max-width: 100%;
    background: var(--paper);
    display: block;
}

.map-canvas .state-path {
    stroke: var(--ink);
    stroke-width: 0.7;
    transition: stroke-width 0.15s ease;
    cursor: pointer;
}

.map-canvas .state-path:hover {
    stroke-width: 2;
}

.map-canvas .state-path.is-selected {
    stroke-width: 2.5;
}

.map-info {
    background: var(--paper-2);
    border-top: 4px solid var(--ink);
    border-bottom: 1px solid var(--rule);
    padding: 1.85rem;
    font-family: var(--font-body);
    min-height: 360px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 7rem;
}

.map-info-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.map-info-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2.15rem;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-bottom: 1.5rem;
    font-variation-settings: "opsz" 144;
}

.map-info-stat {
    margin-bottom: 1.4rem;
}

.map-info-stat-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.85rem;
    color: var(--red);
    line-height: 1;
    margin-bottom: 0.35rem;
    font-variant-numeric: tabular-nums;
}

.map-info-stat-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}

.map-info-body {
    color: var(--ink-2);
    font-size: 0.98rem;
    line-height: 1.5;
    font-weight: 500;
}

.map-info-meta {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--ink-3);
    line-height: 1.5;
    font-weight: 500;
}

.map-info-link {
    display: inline-block;
    margin-top: 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--red);
    font-weight: 700;
    border-bottom: 1px solid var(--red);
    padding-bottom: 2px;
}

.map-legend {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-3);
    flex-wrap: wrap;
    font-weight: 600;
}

.legend-swatches {
    display: flex;
}

.legend-swatches span {
    width: 28px;
    height: 14px;
    border: 1px solid var(--ink);
    border-right: none;
}
.legend-swatches span:last-child { border-right: 1px solid var(--ink); }

/* ============ STATE GRID ============ */
.state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0;
    border-top: 2px solid var(--ink);
    border-left: 1px solid var(--rule);
}

.state-card {
    background: var(--paper);
    padding: 1.5rem;
    border-right: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    transition: background 0.18s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    min-height: 165px;
    position: relative;
}

.state-card:hover {
    background: var(--paper-2);
}

.state-card:hover .state-card-name {
    color: var(--red);
}

.state-card-abbr {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-3);
    letter-spacing: 0.14em;
    font-weight: 700;
}

.state-card-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.015em;
    color: var(--ink);
    transition: color 0.18s ease;
    font-variation-settings: "opsz" 144;
    line-height: 1;
}

.state-card-stat {
    margin-top: auto;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    color: var(--ink-2);
    font-weight: 500;
}

.state-card-stat strong {
    color: var(--red);
    font-weight: 700;
    font-size: 1.15rem;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.state-card-meta {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-3);
    margin-top: 0.4rem;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.state-card-nodata {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--red);
    font-style: italic;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.loading {
    grid-column: 1 / -1;
    padding: 4rem;
    text-align: center;
    color: var(--ink-3);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* ============ THE GAP CALLOUT ============ */
.callout {
    max-width: 920px;
    margin: 0 auto;
    text-align: left;
}

.callout-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--red);
    letter-spacing: 0.2em;
    margin-bottom: 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.callout-eyebrow::before {
    content: "";
    width: 36px;
    height: 2px;
    background: var(--red);
}

.callout-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2rem, 4.5vw, 3.25rem);
    letter-spacing: -0.025em;
    line-height: 1.05;
    margin-bottom: 1.75rem;
    max-width: 22ch;
    color: var(--ink);
    font-variation-settings: "opsz" 144;
}

.callout-body {
    font-size: 1.18rem;
    color: var(--ink-2);
    line-height: 1.55;
    max-width: 64ch;
    margin-bottom: 2.25rem;
    font-weight: 500;
}

.callout-body strong {
    color: var(--ink);
    font-weight: 700;
}

.btn {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    background: var(--ink);
    color: var(--paper);
    padding: 1rem 1.75rem;
    border: 2px solid var(--ink);
    font-weight: 700;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn:hover {
    background: var(--red);
    border-color: var(--red);
    color: var(--paper);
}

/* ============ FOOTER ============ */
.site-footer {
    padding: 4rem 0 2.5rem;
    background: var(--ink);
    color: var(--paper);
    position: relative;
}

.site-footer::before {
    content: "";
    display: block;
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(
        to right,
        var(--red) 0%, var(--red) 33.33%,
        var(--paper) 33.33%, var(--paper) 66.66%,
        var(--navy) 66.66%, var(--navy) 100%
    );
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

@media (max-width: 700px) {
    .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
}

.site-footer .brand {
    color: var(--paper);
}
.site-footer .brand-mark::after {
    background-color: var(--ink);
}

.footer-tagline {
    color: var(--paper-3);
    font-size: 0.98rem;
    margin-top: 1rem;
    max-width: 32ch;
    line-height: 1.55;
    font-weight: 500;
}

.site-footer h4 {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--paper-3);
    margin-bottom: 1rem;
    font-weight: 700;
}

.site-footer ul a {
    color: var(--paper);
    font-size: 0.98rem;
    display: block;
    padding: 0.35rem 0;
    transition: color 0.18s ease;
    font-weight: 500;
}
.site-footer ul a:hover { color: #ffb1b8; }

.footer-bottom {
    display: flex;
    justify-content: space-between;
    padding-top: 2rem;
    border-top: 1px solid #2a3a55;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--paper-3);
    letter-spacing: 0.05em;
    flex-wrap: wrap;
    gap: 1rem;
    font-weight: 500;
}

/* ============ ACCESSIBILITY ============ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .hero-title .line {
        opacity: 1;
        transform: none;
    }
}

a:focus-visible, button:focus-visible {
    outline: 3px solid var(--red);
    outline-offset: 3px;
}

/* ============================================================
   STATE PAGES — extends the patriotic monument aesthetic
   ============================================================ */

/* ---- breadcrumb ---- */
.breadcrumb {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--red);
    text-decoration: none;
    margin-bottom: 2rem;
    transition: opacity 0.15s ease;
}
.breadcrumb:hover { opacity: 0.7; }

/* ---- state hero ---- */
.state-hero {
    padding: 4rem 0 3rem;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
}

.state-hero-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3rem;
    align-items: end;
}

.state-hero-main { min-width: 0; }

.state-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--red);
    margin-bottom: 1rem;
}

.abbr-tag {
    background: var(--ink);
    color: var(--paper);
    padding: 0.1rem 0.5rem;
    border-radius: 2px;
    font-weight: 700;
    margin: 0 0.2rem;
}

.state-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(3rem, 7vw, 5.5rem);
    line-height: 0.95;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 1rem 0;
}

.state-dateline {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    text-transform: uppercase;
    margin: 0;
}

.state-hero-stat {
    background: var(--paper-2);
    border-top: 4px solid var(--ink);
    border-bottom: 1px solid var(--rule);
    padding: 1.75rem;
    text-align: left;
}

.state-hero-stat-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-feature-settings: "tnum";
    font-size: 3.2rem;
    line-height: 1;
    color: var(--red);
    margin-bottom: 0.4rem;
}

.state-hero-stat-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 1rem;
}

.state-hero-stat-rate {
    font-family: var(--font-mono);
    font-weight: 700;
    font-feature-settings: "tnum";
    font-size: 1.6rem;
    color: var(--ink);
    line-height: 1;
    margin-bottom: 0.25rem;
}
.state-hero-stat-rate span {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-left: 0.4rem;
}

.state-hero-stat-yoy {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.yoy--up    { color: var(--red); }
.yoy--down  { color: #2a6a3f; }
.yoy--flat,
.yoy--neutral { color: var(--ink-soft); }

@media (max-width: 768px) {
    .state-hero-grid { grid-template-columns: 1fr; gap: 2rem; }
    .state-hero-stat { padding: 1.25rem; }
    .state-hero-stat-value { font-size: 2.5rem; }
}

/* ---- offense table ---- */
.offense-table-wrap {
    margin-top: 2rem;
    overflow-x: auto;
}
.offense-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
}
.offense-table thead th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--ink);
}
.offense-table th.num-col,
.offense-table td.offense-count,
.offense-table td.offense-rate,
.offense-table td.offense-yoy { text-align: right; }
.offense-table th.trend-col,
.offense-table td.offense-spark { width: 220px; text-align: right; padding-right: 0.5rem; }

.offense-row td {
    padding: 1rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: middle;
}
.offense-row:hover td { background: rgba(0,0,0,0.025); }

.offense-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ink);
}
.offense-count,
.offense-rate {
    font-family: var(--font-mono);
    font-weight: 700;
    font-feature-settings: "tnum";
    font-size: 1rem;
    color: var(--ink);
}
.offense-yoy {
    font-family: var(--font-mono);
    font-weight: 700;
    font-feature-settings: "tnum";
    font-size: 0.9rem;
}
.offense-yoy--up   { color: var(--red); }
.offense-yoy--down { color: #2a6a3f; }
.offense-yoy--flat,
.offense-yoy--neutral { color: var(--ink-soft); }
.offense-row--nodata td { color: var(--ink-soft); font-style: italic; }
.offense-row--nodata .offense-name { font-style: normal; }

svg.spark { display: inline-block; vertical-align: middle; max-width: 100%; height: 40px; }

@media (max-width: 640px) {
    .offense-table th.trend-col, .offense-table td.offense-spark { display: none; }
}

/* ---- narrative ---- */
.narrative {
    max-width: 720px;
    margin-top: 2rem;
}
.narrative p {
    font-family: var(--font-body);
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.65;
    color: var(--ink);
    margin: 0 0 1.4rem 0;
}
.narrative p strong {
    font-weight: 700;
    color: var(--red);
}
.narrative-meta {
    font-family: var(--font-mono);
    font-size: 0.82rem !important;
    font-weight: 400 !important;
    line-height: 1.6 !important;
    color: var(--ink-soft) !important;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    margin-top: 2rem !important;
}

/* ---- agencies placeholder ---- */
.agencies-placeholder {
    margin-top: 2rem;
    max-width: 720px;
}
.agencies-placeholder p {
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--ink);
    margin: 0 0 1rem 0;
}
.placeholder-note {
    font-family: var(--font-mono) !important;
    font-size: 0.85rem !important;
    color: var(--ink-soft) !important;
}
.placeholder-note a { color: var(--red); text-decoration: underline; }

/* ---- state pagination ---- */
.state-pagination {
    padding: 3rem 0;
    background: var(--paper-2);
    border-top: 1px solid var(--rule);
}
.state-pagination .container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: center;
}
.state-pagination-prev,
.state-pagination-next {
    text-decoration: none;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.state-pagination-next {
    text-align: right;
    align-items: flex-end;
}
.state-pagination-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--red);
}
.state-pagination-name {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ink);
}
.state-pagination-all {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    text-decoration: none;
    padding: 0.6rem 1rem;
    border: 1px solid var(--rule);
    border-radius: 2px;
    transition: all 0.15s ease;
}
.state-pagination-all:hover {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}

@media (max-width: 720px) {
    .state-pagination .container { grid-template-columns: 1fr; text-align: left; }
    .state-pagination-next { text-align: left; align-items: flex-start; }
}

/* ---- states index page ---- */
.states-index-hero {
    padding: 4rem 0 2rem;
    border-bottom: 1px solid var(--rule);
}
.states-index-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0.5rem 0 1rem 0;
}
.states-index-lede {
    font-family: var(--font-body);
    font-size: 1.2rem;
    line-height: 1.55;
    color: var(--ink);
    max-width: 720px;
    margin: 0;
}

.states-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1px;
    background: var(--rule);
    border: 1px solid var(--rule);
}

.state-card {
    display: block;
    background: var(--paper);
    padding: 1.5rem 1.4rem 1.4rem;
    text-decoration: none;
    color: var(--ink);
    transition: background 0.12s ease, transform 0.12s ease;
    border-left: 3px solid transparent;
}
.state-card:hover {
    background: var(--paper-2);
    border-left-color: var(--red);
}
.state-card-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 0.5rem;
}
.state-card-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.1;
    color: var(--ink);
    margin-bottom: 0.85rem;
}
.state-card-stat {
    font-family: var(--font-body);
    font-size: 0.92rem;
    color: var(--ink);
    line-height: 1.4;
    margin-bottom: 0.35rem;
}
.card-stat-value,
.card-stat-rate {
    font-family: var(--font-mono);
    font-weight: 700;
    font-feature-settings: "tnum";
    color: var(--red);
}
.card-nodata {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--ink-soft);
    font-style: italic;
}
.state-card-period {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--ink-soft);
    letter-spacing: 0.03em;
}
/* =========================================================================
   UnsolvedWatch — state page additions
   Append this block to site/styles.css
   
   Adds:
     - Simplified state hero (no duplicate homicide stat box)
     - Color swatches in offense table (legend keys to overlay chart)
     - Overlay chart styling (8 offenses on one set of axes)
   ========================================================================= */

/* --- Simplified hero (replaces the two-column hero with the stat box) -- */

.state-hero--simple .breadcrumb {
    display: inline-block;
    margin-bottom: 2.5rem;
}

.state-hero--simple .state-eyebrow {
    margin-bottom: 0.5rem;
}

.state-hero--simple .state-name {
    margin-bottom: 0.5rem;
}

.state-hero--simple .state-dateline {
    margin-bottom: 0;
}


/* --- Color swatches in the offense table ------------------------------- */

.offense-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 0.6rem;
    vertical-align: middle;
    transform: translateY(-1px);
}

.offense-row--nodata .offense-swatch {
    opacity: 0.35;
}


/* --- Five-year overlay chart ------------------------------------------- */

.overlay-explainer {
    font-family: "Newsreader", Georgia, serif;
    font-size: 1.0625rem;
    line-height: 1.55;
    color: var(--ink, #0a1f3d);
    opacity: 0.78;
    max-width: 60ch;
    margin: 0 0 1.75rem 0;
    font-style: italic;
}

.overlay-chart-wrap {
    width: 100%;
    overflow-x: auto;
    padding: 1rem 0 0.5rem 0;
}

.overlay-chart {
    display: block;
    width: 100%;
    height: auto;
    min-width: 820px; /* preserve readability on narrow screens — scroll instead of squish */
    max-width: 100%;
}

.overlay-axis-label {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11px;
    font-weight: 500;
    fill: var(--ink, #0a1f3d);
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
}

.overlay-end-label {
    font-family: "Newsreader", Georgia, serif;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.005em;
}

.overlay-end-value {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11.5px;
    font-weight: 500;
    opacity: 0.65;
    font-variant-numeric: tabular-nums;
}

.overlay-hover-month-label {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11px;
    font-weight: 600;
    fill: var(--ink, #0a1f3d);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* --- Floating tooltip near cursor ----------------------------------- */

.overlay-chart-wrap {
    position: relative;
}

.overlay-tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--paper, #f4ede0);
    border: 0.5px solid #0a1f3d;
    border-radius: 2px;
    padding: 8px 10px;
    min-width: 168px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.12s ease-out;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(10, 31, 61, 0.12);
}

.overlay-tooltip.is-visible {
    opacity: 1;
}

.overlay-tooltip-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    line-height: 1.3;
}

.overlay-tooltip-swatch {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 1px;
    flex-shrink: 0;
}

.overlay-tooltip-name {
    font-family: "Newsreader", Georgia, serif;
    font-weight: 500;
    color: var(--ink, #0a1f3d);
    flex: 1;
}

.overlay-tooltip-value {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-weight: 600;
    color: var(--ink, #0a1f3d);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    text-align: right;
}

.overlay-chart-empty {
    font-family: "Newsreader", Georgia, serif;
    font-style: italic;
    color: var(--ink, #0a1f3d);
    opacity: 0.55;
    padding: 2rem 0;
    text-align: center;
}


/* --- Responsive tweaks ------------------------------------------------- */

@media (max-width: 720px) {
    .overlay-chart-wrap {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* === UnsolvedWatch — overlay footnote (Jan 2023 baseline note) === */

.overlay-footnote {
    font-family: "Newsreader", Georgia, serif;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--ink, #0a1f3d);
    opacity: 0.62;
    max-width: 62ch;
    margin: -0.5rem 0 1.75rem 0;
    padding-left: 0.85rem;
    border-left: 2px solid var(--gold, #a37c2c);
}

.overlay-footnote em {
    font-style: italic;
    opacity: 0.85;
}

/* === UnsolvedWatch — chart caveat block (post-chart reading guide) === */

.chart-caveat {
    margin: 2.25rem 0 0 0;
    padding: 1.5rem 1.75rem;
    background: rgba(10, 31, 61, 0.04);
    border-left: 3px solid var(--navy, #0a1f3d);
    max-width: 72ch;
}

.chart-caveat-heading {
    font-family: "Newsreader", Georgia, serif;
    font-size: 0.9375rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--navy, #0a1f3d);
    margin: 0 0 0.65rem 0;
    opacity: 0.85;
}

.chart-caveat-body {
    font-family: "Newsreader", Georgia, serif;
    font-size: 1.0rem;
    line-height: 1.62;
    color: var(--ink, #0a1f3d);
    opacity: 0.82;
    margin: 0;
}

.chart-caveat-body a {
    color: var(--navy, #0a1f3d);
    text-decoration: underline;
    text-decoration-color: var(--gold, #a37c2c);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    font-weight: 500;
}

.chart-caveat-body a:hover {
    color: var(--red, #b8222d);
    text-decoration-color: var(--red, #b8222d);
}
