/* ========== NYT-STYLE DESIGN — DARK MODE ONLY ========== */

:root {
    --bg-primary: #1A1819;
    --bg-secondary: #222021;
    --bg-card: #2a2728;
    --bg-card-hover: #333031;
    --bg-accent: #3a3738;
    --text-primary: #F6F3EA;
    --text-secondary: #d9d6cd;
    --text-tertiary: #a09d94;
    --text-caption: #7a776e;
    --accent: #4460D8;
    --accent-hover: #6680f0;
    --border: #3a3738;
    --border-strong: #4a4748;
    --danger: #D9EF56;
    --danger-bg: #2a2b1a;
    --warning: #D9EF56;
    --success: #568B55;
    --rule: #F6F3EA;
    --rule-light: #3a3738;
    --text-muted: #7a776e;
    --bg-tertiary: #2a2728;
    --shadow: rgba(0,0,0,0.4);
    --shadow-strong: rgba(0,0,0,0.6);
}

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

body {
    font-family: 'DM Sans', 'Outfit', 'Century Gothic', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 18px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== NYT-STYLE HEADER ========== */
header {
    background: var(--bg-primary);
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--rule);
    position: relative;
    max-height: 600px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.35s ease,
                padding 0.45s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.35s ease;
}

header.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-color: transparent;
}

.donate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #d9ef56;
    border: 2px solid #d9ef56;
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.5rem 1.25rem 0.5rem calc(1.25rem + 0.12em);
    border-radius: 0;
    text-decoration: none;
    text-align: center;
    line-height: 1;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    z-index: 10;
    flex-shrink: 0;
}

.donate-btn:hover {
    background: #d9ef56;
    color: #000;
}

.donate-btn:active {
    background: #c8dd4e;
    border-color: #c8dd4e;
    color: #000;
}

.header-wordmark {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.masthead {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--text-tertiary);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--rule-light);
}

.section-label {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--danger);
    margin-bottom: 0.75rem;
}

header h1 {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.header-deck {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-secondary);
    max-width: 680px;
    margin: 0 auto 1.25rem;
}

.header-byline {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
}

.header-byline a {
    color: var(--text-primary);
    text-decoration: none;
}

.header-byline a:hover {
    text-decoration: underline;
}

.header-timestamp {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    color: var(--text-caption);
}

.key-figures {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
    padding: 1.5rem 0;
    border-top: 1px solid var(--rule-light);
    border-bottom: 1px solid var(--rule-light);
}

.key-figure {
    text-align: center;
}

.key-figure-number {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
}

.key-figure-number.danger {
    color: var(--danger);
}

.key-figure-label {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-caption);
    margin-top: 0.35rem;
}

.methodology-note {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    background: var(--bg-secondary);
    border-left: 3px solid var(--border-strong);
    padding: 1rem 1.25rem;
    margin: 1.5rem auto;
    max-width: 680px;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    line-height: 1.6;
}

.methodology-note strong {
    color: var(--text-secondary);
}

.methodology-note a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 2px;
    word-break: break-word;
}

.methodology-note a:hover {
    color: var(--accent);
}

/* ========== METHODOLOGY ARTICLE PAGES ========== */
/* Long-form methodology pages live at /methodology/<slug>.html and use
   <article class="methodology-note"> for the main content. The base
   .methodology-note rule above styles small inline notes (boxed,
   border-left, narrow); these scoped overrides give the article-level
   page a readable long-form treatment while still using the same site
   palette. Do not introduce a separate stylesheet — keep both the inline
   note and the article variants in this file. */
article.methodology-note {
    background: transparent;
    border-left: none;
    padding: 0 1rem;
    margin: 2rem auto 4rem;
    max-width: 720px;
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

article.methodology-note > header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--rule-light);
    /* Reset properties inherited from the bare `header` rule that wraps
       the masthead — that rule applies max-height/overflow/transition for
       a collapsible top header. None of those make sense on this nested
       article-level <header>; left unset, the article title and lede
       can clip at narrow viewports or animate out if a `collapsed`
       class is ever applied site-wide. */
    max-height: none;
    overflow: visible;
    transition: none;
}

article.methodology-note h1 {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-weight: 600;
    font-size: 2rem;
    line-height: 1.2;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    letter-spacing: -0.01em;
}

article.methodology-note h2 {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 2.25rem 0 0.75rem;
    letter-spacing: -0.005em;
}

article.methodology-note .lede {
    font-size: 1.05rem;
    color: var(--text-tertiary);
    margin: 0;
}

article.methodology-note > section {
    margin: 1.75rem 0;
}

article.methodology-note p,
article.methodology-note li {
    color: var(--text-secondary);
}

article.methodology-note p {
    margin: 0 0 1rem;
}

article.methodology-note ol,
article.methodology-note ul {
    margin: 0 0 1.25rem;
    padding-left: 1.25rem;
}

article.methodology-note li {
    margin-bottom: 0.5rem;
}

article.methodology-note code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: var(--bg-secondary);
    padding: 0.1em 0.35em;
    border-radius: 3px;
    color: var(--text-primary);
    word-break: break-word;
}

article.methodology-note figure {
    margin: 2rem 0;
    padding: 0;
}

article.methodology-note figure img {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
}

article.methodology-note figcaption {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text-tertiary);
    font-style: normal;
}

article.methodology-note table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.92rem;
    /* Allow horizontal scroll instead of viewport overflow on narrow screens. */
    display: block;
    overflow-x: auto;
}

@media (min-width: 600px) {
    article.methodology-note table {
        display: table;
        overflow-x: visible;
    }
}

article.methodology-note th,
article.methodology-note td {
    padding: 0.55rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--rule-light);
    vertical-align: top;
}

article.methodology-note th {
    color: var(--text-primary);
    font-weight: 600;
    border-bottom-color: var(--border-strong);
}

article.methodology-note td strong {
    color: var(--text-primary);
}

/* Honor the .methodology-note a underline accent inherited from the
   inline rule above; nothing extra here. */

/* ========== NYT-STYLE NAVIGATION ========== */
nav {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--rule-light);
    padding: 0;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    position: sticky;
    top: 0;
    z-index: 100;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

nav::-webkit-scrollbar {
    display: none;
}

/* Edge fade hints for horizontal scroll on small screens */
@media (max-width: 900px) {
    nav {
        -webkit-mask-image: linear-gradient(to right, transparent, black 20px, black calc(100% - 20px), transparent);
        mask-image: linear-gradient(to right, transparent, black 20px, black calc(100% - 20px), transparent);
    }
}

.nav-container {
    display: flex;
    justify-content: center;
    gap: 0;
    min-width: max-content;
    max-width: 1000px;
    margin: 0 auto;
}

.nav-btn {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-tertiary);
    padding: 0.875rem 1rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.nav-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--rule);
    font-weight: 600;
}

/* ========== MAIN CONTENT ========== */
main {
    padding: 2rem 1.5rem;
    max-width: 780px;
    margin: 0 auto;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.section-title {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.section-intro {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.section-intro a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 2px;
}

.section-intro a:hover {
    color: var(--accent);
}

.section-rule {
    width: 100%;
    height: 1px;
    background: var(--rule-light);
    margin: 2.5rem 0;
    border: none;
}

/* ========== PULL QUOTE / CALLOUT ========== */
.featured-callout {
    background: var(--danger-bg);
    border-left: 3px solid var(--danger);
    padding: 1.5rem 1.5rem 1.5rem 1.75rem;
    margin: 2rem 0;
}

.featured-callout h3 {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    color: var(--danger);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.featured-callout p {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.5;
}

.featured-callout .featured-stat {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--danger);
    display: block;
    margin-top: 0.75rem;
    line-height: 1;
}

/* ========== NYT STATS DISPLAY ========== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card.danger {
    background: var(--danger-bg);
}

.stat-card h3 {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    color: var(--text-caption);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.stat-value {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stat-card.danger .stat-value {
    color: var(--danger);
}

.stat-context {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
    line-height: 1.5;
}
.stat-context a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 2px;
}
.stat-context a:hover {
    color: var(--accent);
}

.stat-trend {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
    color: var(--danger);
}

.stat-trend.down {
    color: var(--success);
}

.stat-source {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.stat-source a {
    color: var(--accent);
    text-decoration: none;
}

.stat-source a:hover {
    text-decoration: underline;
}

/* Corporate section "Following the Money" callout — compact variant.
   ~25% smaller than the desktop default at all viewports. ID specificity
   beats the bare-class responsive overrides at the tablet/desktop breakpoints. */
#corporate .featured-callout {
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
}
#corporate .featured-callout h3 {
    font-size: 0.62rem;
    margin-bottom: 0.5rem;
}
#corporate .featured-callout p {
    font-size: 0.92rem;
    line-height: 1.5;
}
#corporate .featured-callout .featured-stat {
    font-size: 1.85rem;
    margin-top: 0.5rem;
}

/* Corporate section "Following the Money" stat grid — compact variant.
   Roughly 40% smaller than default stat-card scale to balance against the
   network graph above and the case cards below. */
#corporate .stats-grid .stat-card {
    padding: 0.9rem;
}
#corporate .stats-grid .stat-card h3 {
    font-size: 0.62rem;
    margin-bottom: 0.3rem;
}
#corporate .stats-grid .stat-value {
    font-size: 1.35rem;
}
#corporate .stats-grid .stat-context {
    font-size: 0.75rem;
    margin-top: 0.3rem;
    line-height: 1.4;
}
#corporate .stats-grid .stat-source {
    font-size: 0.6rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

/* ========== NYT-STYLE CASE CARDS ========== */
.case-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.case-card {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--rule-light);
    padding: 1.5rem 0;
    position: relative;
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
}

.case-card:first-child {
    border-top: 1px solid var(--rule-light);
}

.case-card.fatal {
    background: var(--danger-bg);
    padding: 1.5rem;
    margin: 1rem -1.5rem;
    border: none;
    border-left: 3px solid var(--danger);
}

.case-card.with-photo {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.case-photo {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.case-photo.portrait {
    aspect-ratio: 4/5;
    max-width: 200px;
}

.case-card.fatal::after {
    content: none;
}

.case-card.child {
    background: var(--bg-secondary);
    padding: 1.5rem;
    margin: 1rem -1.5rem;
    border: none;
    border-left: 3px solid var(--warning);
}

.case-card.child::after {
    content: none;
}

.case-label {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--danger);
    margin-bottom: 0.5rem;
}

.case-card h3 {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.case-meta {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 0.75rem;
}

.case-meta span {
    display: inline;
}

.case-meta span::after {
    content: ' · ';
}

.case-meta span:last-child::after {
    content: '';
}

.case-meta span[style*="border-left"] {
    padding-left: 0.5rem;
    margin-left: 0.25rem;
}

.case-tag[style*="border-left"] {
    padding-left: 0.5rem !important;
    margin-left: 0.25rem;
}

.case-description {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.7;
}

.case-description strong {
    color: var(--text-primary);
    font-weight: 500;
}

.case-source {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.8rem;
    color: var(--text-caption);
}

.case-source a {
    color: var(--accent);
    text-decoration: none;
    word-break: break-word;
}

.case-source a:hover {
    text-decoration: underline;
}

/* ========== NYT PULL QUOTE ========== */
.human-quote {
    border-top: 1px solid var(--rule-light);
    border-bottom: 1px solid var(--rule-light);
    padding: 1.75rem 0;
    margin: 2rem 0;
    position: relative;
}

.human-quote blockquote {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-style: italic;
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    text-indent: -0.4em;
}

.human-quote cite {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    display: block;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-style: normal;
}

.human-quote cite strong {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========== TABLES ========== */
.table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    position: relative;
}

/* Scroll-hint shadows that appear/disappear as user scrolls */
@media (max-width: 700px) {
    .table-container {
        background:
            /* covers that scroll with content (hide shadow when at edge) */
            linear-gradient(to right, var(--bg-card) 30%, transparent) local,
            linear-gradient(to left, var(--bg-card) 30%, transparent) local,
            /* fixed shadows on left/right edges */
            linear-gradient(to right, transparent, rgba(255,255,255,0.07)) scroll,
            linear-gradient(to left, transparent, rgba(255,255,255,0.07)) scroll;
        background-size: 40px 100%, 40px 100%, 20px 100%, 20px 100%;
        background-position: left, right, left, right;
        background-repeat: no-repeat;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 600px;
}

th, td {
    padding: 1rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: rgba(255,255,255,0.03);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
}

tr:hover {
    background: rgba(255,255,255,0.02);
}

tr:last-child td {
    border-bottom: none;
}

td a {
    color: var(--accent);
    text-decoration: none;
}

td a:hover {
    text-decoration: underline;
}

.death-row {
    background: rgba(220, 38, 38, 0.08);
    border-left: 3px solid rgba(220, 38, 38, 0.5);
}

.death-row:hover {
    background: rgba(220, 38, 38, 0.12);
}

/* ========== DEATHS SUBSECTIONS ========== */
.deaths-subsection {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--rule-light);
}

.deaths-subsection:first-of-type {
    margin-top: 2rem;
    padding-top: 0;
    border-top: none;
}

.deaths-subsection-header {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
}

.deaths-subsection-header .death-count {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--danger);
    display: block;
    margin-top: 0.25rem;
    line-height: 1.2;
}

.deaths-subsection .table-container {
    margin-bottom: 1rem;
}

.deaths-subsection .case-card {
    margin-top: 0;
}

.deaths-subsection .case-grid {
    margin-top: 1.5rem;
}

/* ========== SEARCH ========== */
.search-container {
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 16px; /* Prevents zoom on iOS */
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

/* Sources section - Mobile */
.source-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.source-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.source-card h4 {
    font-size: 0.9rem;
    margin-bottom: 0.375rem;
}

.source-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.source-card a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.75rem;
    word-break: break-all;
}

.source-card a:hover {
    text-decoration: underline;
}

/* Monitored Sources */
.monitored-sources {
    margin-top: 1rem;
}

.source-group-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    overflow: hidden;
}

.source-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    overflow: hidden;
    min-width: 0;
}

.source-group h4 {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--rule-light);
}

.source-group-count {
    font-weight: 400;
    color: var(--text-caption);
    font-size: 0.75rem;
}

.monitored-source-list {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 1;
    column-gap: 1.5rem;
}

.monitored-source-list li {
    padding: 0.2rem 0;
    break-inside: avoid;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.monitored-source-list a {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.78rem;
    transition: color 0.15s;
}

.monitored-source-list a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Sources action buttons */
.sources-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

/* Methodology modal */
.methodology-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10001;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem;
    overflow-y: auto;
}

.methodology-overlay.active {
    display: flex;
}

.methodology-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.methodology-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 1;
}

.methodology-modal-header h3 {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 1.15rem;
    margin: 0;
    color: var(--text-primary);
}

.methodology-modal-close {
    background: none;
    border: none;
    color: var(--text-caption);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.methodology-modal-close:hover {
    color: var(--text-primary);
}

.methodology-modal-body {
    padding: 1.5rem;
}

.methodology-modal-body > p {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1.25rem;
}

.scoring-tier {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.scoring-tier h4 {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.scoring-tier p {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.scoring-tier-penalty {
    opacity: 0.75;
}

.tier-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    white-space: nowrap;
}

.tier-incident { background: #D9EF5633; color: #D9EF56; }
.tier-primary { background: #3b82f633; color: #3b82f6; }
.tier-secondary { background: #10b98133; color: #10b981; }
.tier-location { background: #f59e0b33; color: #f59e0b; }
.tier-penalty { background: #6b728033; color: #9ca3af; }
.tier-exclude { background: #6b728033; color: #6b7280; }

details {
    margin-top: 0.5rem;
}

details summary {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    color: var(--accent);
    cursor: pointer;
    user-select: none;
}

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

.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.keyword-tag {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    background: var(--bg-accent);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.keyword-tag-es {
    border-color: #f59e0b44;
    color: #f59e0b;
}

.keyword-divider {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-caption);
    width: 100%;
    margin-top: 0.25rem;
}

/* Footer - Mobile */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 1.5rem 1rem;
    text-align: center;
    margin-top: 2rem;
}

footer p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.5;
}

.footer-nonprofit {
    margin-top: 0.75rem;
    font-size: 0.75rem !important;
    color: var(--text-tertiary) !important;
    font-style: italic;
}

.footer-nonprofit a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 2px;
}

.footer-nonprofit a:hover {
    color: var(--text-primary);
}

.last-updated {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Section intro text */
.section > p {
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Section subheadings */
.section h3 {
    font-size: 1rem;
    margin: 1.25rem 0 0.75rem;
    color: var(--text-secondary);
}

/* ========== TABLET (min-width: 600px) ========== */
@media (min-width: 600px) {
    .header-wordmark {
        justify-content: center;
        position: relative;
    }

    .donate-btn {
        position: absolute;
        right: 0;
        background: #d9ef56;
        color: #000;
        border-color: #d9ef56;
    }

    .donate-btn:hover {
        background: #c8dd4e;
        border-color: #c8dd4e;
    }

    .donate-btn:active {
        background: #b8cc46;
        border-color: #b8cc46;
    }

    header {
        padding: 2.5rem 1.5rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .hero-stats {
        gap: 0.75rem;
    }

    .hero-stat {
        padding: 0.75rem 1.25rem;
    }

    .hero-stat-number {
        font-size: 2rem;
    }

    .hero-stat-label {
        font-size: 0.75rem;
    }

    .header-subtitle {
        font-size: 1rem;
    }

    .urgent-banner {
        margin: 1.5rem -1.5rem -2.5rem;
        font-size: 0.9rem;
    }

    nav {
        padding: 0.875rem 1rem;
        overflow-x: visible;
    }

    .nav-container {
        flex-wrap: wrap;
        justify-content: center;
        min-width: auto;
    }

    .nav-btn,
    .search-trigger {
        font-size: 0.8rem;
        padding: 0.625rem 1rem;
    }

    main {
        padding: 2rem 1.5rem;
        max-width: 1000px;
        margin: 0 auto;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .featured-callout {
        padding: 1.5rem;
    }

    .featured-callout p {
        font-size: 1.25rem;
    }

    .featured-callout .featured-stat {
        font-size: 2.5rem;
    }

    /* Stats: 2 columns on tablet */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1.5rem;
    }

    .stat-value {
        font-size: 3rem;
    }

    /* Cases: still 1 column but with more padding */
    .case-card {
        padding: 1.5rem;
    }

    .case-card.with-photo {
        grid-template-columns: 200px 1fr;
        align-items: start;
    }

    .case-photo {
        aspect-ratio: 1;
        max-width: 200px;
    }

    .case-photo.portrait {
        max-width: 200px;
    }

    .case-card h3 {
        font-size: 1.2rem;
    }

    .human-quote {
        padding: 2rem;
    }

    .human-quote blockquote {
        font-size: 1.25rem;
    }

    /* Sources: 2 columns */
    .source-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* Monitored sources: 2-col grid, 2-col lists for large groups */
    .source-group-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .monitored-source-list {
        columns: 2;
    }

    footer {
        padding: 2.5rem;
    }

    footer p {
        font-size: 0.9rem;
        max-width: 600px;
        margin: 0 auto;
    }
}

/* ========== DESKTOP (min-width: 900px) ========== */
@media (min-width: 900px) {
    header {
        padding: 3rem 2rem;
    }

    header h1 {
        font-size: 2.5rem;
    }

    .hero-stats {
        gap: 1rem;
    }

    .hero-stat {
        padding: 1rem 1.5rem;
    }

    .hero-stat-number {
        font-size: 2.5rem;
    }

    .hero-stat-label {
        font-size: 0.8rem;
    }

    .header-subtitle {
        font-size: 1.1rem;
        max-width: 700px;
    }

    .nav-btn,
    .search-trigger {
        font-size: 0.85rem;
        padding: 0.625rem 1.125rem;
    }

    main {
        padding: 3rem 2rem;
        max-width: 1200px;
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }

    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .featured-callout {
        padding: 2rem;
    }

    .featured-callout p {
        font-size: 1.35rem;
    }

    .featured-callout .featured-stat {
        font-size: 3rem;
    }

    /* Stats: 3 columns on desktop */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }

    .stat-card {
        padding: 1.75rem;
    }

    .stat-card h3 {
        font-size: 0.75rem;
    }

    .stat-value {
        font-size: 3.5rem;
    }

    .stat-context {
        font-size: 0.9rem;
    }

    /* Cases: 2 columns on desktop */
    .case-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    /* Prevent fatal cards from bleeding into adjacent grid column */
    .case-grid .case-card.fatal {
        margin: 0;
    }

    .case-card {
        padding: 1.75rem;
    }

    .case-card h3 {
        font-size: 1.25rem;
    }

    .case-description {
        font-size: 0.95rem;
    }

    .human-quote blockquote {
        font-size: 1.4rem;
    }

    /* Sources: 3-4 columns */
    .source-list {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.25rem;
    }

    /* Monitored sources: 3-col grid, 3-col lists for Regional/States Newsroom */
    .source-group-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .monitored-source-list {
        columns: 3;
    }

    .search-input {
        max-width: 400px;
    }
}

/* ========== LARGE DESKTOP (min-width: 1200px) ========== */
@media (min-width: 1200px) {
    header h1 {
        font-size: 3rem;
    }

    .hero-stat-number {
        font-size: 3rem;
    }

    main {
        max-width: 1400px;
    }

    /* Stats: 4 columns on large desktop */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .stat-value {
        font-size: 4rem;
    }
}

/* Corporate Network: stats grid expanded to 5 columns at >=1200px so the
   live USASpending card sits inline with the four legacy stat cards. */
@media (min-width: 1200px) {
    #corporate .stats-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ========== TOUCH DEVICE OPTIMIZATIONS ========== */
@media (hover: none) and (pointer: coarse) {
    .nav-btn,
    .search-trigger {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .search-input {
        min-height: 48px;
    }

    .stat-card:hover,
    .case-card:hover {
        transform: none;
    }

    /* Larger tap targets for links */
    .case-source a,
    .stat-source a,
    .source-card a,
    td a {
        padding: 0.375rem 0;
        display: inline-block;
    }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode only — no system preference switching */

/* ========== CORPORATE NETWORK VISUALIZATION ========== */
.filter-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-primary);
}

#network-viz {
    position: relative;
    overflow: visible;
}

#network-viz svg {
    width: 100%;
    height: 100%;
}

.node-label {
    font-size: 10px;
    fill: var(--text-primary);
    pointer-events: none;
    text-anchor: middle;
}

.node-tooltip {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.75rem;
    max-width: 250px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.node-tooltip h4 {
    margin-bottom: 0.375rem;
    color: var(--text-primary);
}

.node-tooltip p {
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

@media (min-width: 600px) {
    .filter-btn {
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
    }

    #network-viz {
        height: 550px;
    }

    .node-label {
        font-size: 11px;
    }
}

@media (min-width: 900px) {
    #network-viz {
        height: 600px;
    }

    .node-label {
        font-size: 12px;
    }
}

/* ========== WORKSITE RAIDS MAP ========== */
#raids-map-viz {
    position: relative;
    min-height: 350px;
}

#raids-map-viz svg {
    width: 100%;
    display: block;
}

.raid-state {
    fill: var(--bg-accent);
    stroke: none;
}
.raid-state-border {
    stroke: #5a5758;
    stroke-width: 0.7;
    stroke-linejoin: round;
}
.state-label {
    font-family: Inter, sans-serif;
    font-size: 8px;
    font-weight: 600;
    fill: #6b6768;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
    user-select: none;
}

.raid-dot {
    stroke: var(--bg-primary);
    stroke-width: 1.5;
    cursor: pointer;
    transition: opacity 0.3s;
}

.raid-dot:hover {
    stroke-width: 2.5;
    stroke: var(--text-primary);
    filter: brightness(1.2);
}

.raid-dot.filtered-out {
    opacity: 0.08 !important;
    pointer-events: none;
}

@keyframes raidPulse {
    0% { opacity: 0.6; transform: scale(1); }
    100% { opacity: 0; transform: scale(2.5); }
}

.raid-pulse {
    fill: none;
    stroke-width: 1.5;
    transform-box: fill-box;
    transform-origin: center;
    animation: raidPulse 2.5s ease-out infinite;
    pointer-events: none;
}

.raid-pulse.filtered-out,
.mega-label.filtered-out {
    display: none !important;
}

.raid-tooltip {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.75rem;
    max-width: 280px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    display: none;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
}

.raid-tooltip h4 {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    margin: 0 0 0.375rem;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.raid-tooltip p {
    color: var(--text-secondary);
    margin: 0 0 0.25rem;
    line-height: 1.4;
}

.raid-tooltip .tooltip-arrests {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--danger);
}

.raid-tooltip .tooltip-industry {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.raid-row-highlight {
    outline: 2px solid var(--accent) !important;
    outline-offset: -2px;
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-card)) !important;
    transition: background 0.3s, outline 0.3s;
}

.raid-filter[data-industry="agriculture"]::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #2d6a4f; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.raid-filter[data-industry="restaurant"]::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #d97706; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.raid-filter[data-industry="meatpacking"]::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #dc2626; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.raid-filter[data-industry="construction"]::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #7c3aed; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.raid-filter[data-industry="manufacturing"]::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #2563eb; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.raid-filter[data-industry="retail"]::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #6b7280; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

@media (max-width: 599px) {
    #raids-map-viz { min-height: 250px; }
    .raid-tooltip { max-width: 200px; font-size: 0.7rem; }
}

/* ========== DETENTION CENTERS MAP ========== */
#detention-map-container {
    position: relative;
}
.detention-filter {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.8rem;
    transition: all 0.2s;
}
.detention-filter:hover { border-color: var(--accent); color: var(--text-primary); }
.detention-filter.active { background: var(--text-primary); color: var(--bg-card); border-color: var(--text-primary); }
.detention-filter[data-type="existing"]::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #9ca3af; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.detention-filter[data-type="new"]::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #dc2626; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.detention-filter[data-type="military"]::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #2563eb; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.detention-filter[data-type="denied"]::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #6b7280; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

/* ========== GEO FILTER DROPDOWN ========== */
.geo-filter-wrapper {
    position: relative;
    display: inline-block;
    margin-left: 0.5rem;
}
.geo-filter-trigger {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    transition: all 0.2s;
    white-space: nowrap;
}
.geo-filter-trigger:hover { border-color: var(--accent); color: var(--text-primary); }
.geo-filter-trigger.geo-filter-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.geo-filter-icon { margin-right: 0.2rem; }
.geo-filter-caret { font-size: 0.6rem; margin-left: 0.15rem; opacity: 0.7; }
.geo-filter-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    width: 280px;
    max-height: 380px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.geo-filter-search {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    outline: none;
    box-sizing: border-box;
}
.geo-filter-search::placeholder { color: var(--text-caption); }
.geo-filter-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
}
.geo-filter-preset-btn {
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.6rem;
    transition: all 0.15s;
}
.geo-filter-preset-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.geo-filter-preset-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.geo-filter-state-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.4rem 0.6rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.15rem;
    max-height: 220px;
}
.geo-filter-state-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.25rem;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.65rem;
    color: var(--text-secondary);
    transition: background 0.15s;
}
.geo-filter-state-item:hover { background: var(--bg-secondary); }
.geo-filter-state-item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 13px;
    height: 13px;
    cursor: pointer;
}
.geo-filter-clear {
    display: block;
    width: 100%;
    padding: 0.45rem;
    border: none;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-caption);
    cursor: pointer;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.65rem;
    text-align: center;
    transition: all 0.15s;
}
.geo-filter-clear:hover { color: var(--accent); background: var(--bg-card); }

/* State highlight on maps when geo filter is active */
.geo-selected {
    fill: var(--accent) !important;
    fill-opacity: 0.18 !important;
    stroke: var(--accent) !important;
    stroke-width: 1.5 !important;
}

/* Mobile adjustments */
@media (max-width: 599px) {
    .geo-filter-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 60vh;
        border-radius: 12px 12px 0 0;
        z-index: 1000;
    }
    .geo-filter-trigger { font-size: 0.65rem; padding: 0.3rem 0.5rem; }
}

#detention-map-viz { width: 100%; min-height: 400px; }
.detention-state { fill: var(--bg-accent, #f0f0f0); stroke: none; }
.detention-state-border { stroke: #5a5758; stroke-width: 0.7; stroke-linejoin: round; }
.detention-dot-existing { fill: #9ca3af; opacity: 0.5; stroke: var(--bg-primary); stroke-width: 1; cursor: pointer; transition: all 0.3s; }
.detention-dot-existing:hover { opacity: 1; stroke: var(--text-primary); stroke-width: 2; }
.detention-dot-new { fill: #dc2626; cursor: pointer; opacity: 0.85; stroke: var(--bg-primary); stroke-width: 1.5; transition: all 0.3s; }
.detention-dot-new:hover { opacity: 1; filter: brightness(1.2); stroke: var(--text-primary); stroke-width: 2.5; }
.detention-dot-military { fill: #2563eb; cursor: pointer; opacity: 0.85; stroke: var(--bg-primary); stroke-width: 1.5; transition: all 0.3s; }
.detention-dot-military:hover { opacity: 1; filter: brightness(1.2); stroke: var(--text-primary); stroke-width: 2.5; }
.detention-dot-denied { fill: #6b7280; cursor: pointer; opacity: 0.5; stroke: var(--bg-primary); stroke-width: 1; transition: all 0.3s; }
.detention-dot-denied:hover { opacity: 0.8; stroke: var(--text-primary); stroke-width: 2; }
.detention-dot-hold-room { fill: transparent; stroke: #ea580c; stroke-width: 1.5; cursor: pointer; transition: all 0.3s; opacity: 0.9; }
.detention-dot-hold-room:hover { stroke-width: 2.5; fill: rgba(234, 88, 12, 0.15); }
.detention-dot-federal { fill: #0891b2; cursor: pointer; opacity: 0.85; stroke: var(--bg-primary); stroke-width: 1.3; transition: all 0.3s; }
.detention-dot-federal:hover { opacity: 1; filter: brightness(1.2); stroke: var(--text-primary); stroke-width: 2.2; }
.detention-dot-staging { fill: #14b8a6; cursor: pointer; opacity: 0.85; stroke: var(--bg-primary); stroke-width: 1.3; transition: all 0.3s; }
.detention-dot-staging:hover { opacity: 1; filter: brightness(1.15); stroke: var(--text-primary); stroke-width: 2.2; }
.detention-dot-state-run { fill: #a855f7; cursor: pointer; opacity: 0.95; stroke: var(--bg-primary); stroke-width: 1.2; transition: all 0.3s; }
.detention-dot-state-run:hover { opacity: 1; filter: brightness(1.15); stroke: var(--text-primary); stroke-width: 2; }
.detention-dot-offshore { stroke-dasharray: 3,2; }
.detention-dot-offshore:hover { stroke-dasharray: 2,1.5; }

/* Hover state triggered by detention-map.js JS on mouseenter */
.detention-dot-hover { stroke: var(--text-primary) !important; stroke-width: 2.5 !important; opacity: 1 !important; }
.detention-dot-hold-room.detention-dot-hover { fill: rgba(234, 88, 12, 0.22) !important; stroke-width: 2.8 !important; }

/* Suppress hover on filtered-out markers — no pointer events + hide */
.detention-dot-existing.filtered-out,
.detention-dot-new.filtered-out,
.detention-dot-military.filtered-out,
.detention-dot-denied.filtered-out,
.detention-dot-hold-room.filtered-out,
.detention-dot-federal.filtered-out,
.detention-dot-staging.filtered-out,
.detention-dot-state-run.filtered-out {
    pointer-events: none !important;
}

/* Keep strokes crisp across zoom levels — without this, a 1px stroke on a */
/* circle inside the zoomed map group renders as 8px at max zoom. */
.detention-dot-existing,
.detention-dot-new,
.detention-dot-military,
.detention-dot-denied,
.detention-dot-hold-room,
.detention-dot-federal,
.detention-dot-staging,
.detention-dot-state-run,
.detention-dot-offshore,
.detention-css-pulse {
    vector-effect: non-scaling-stroke;
}


/* Map legend — uniform flex row, consistent swatch sizing */
.detention-legend {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem 1rem;
    align-items: center;
}
.detention-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1;
    cursor: help;
}
.detention-legend .legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    box-sizing: border-box;
    flex-shrink: 0;
}
.detention-legend .legend-swatch-circle {
    border-radius: 50%;
    border: 1.5px solid var(--bg-primary);
}
.detention-legend .legend-swatch-diamond {
    transform: rotate(45deg);
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--bg-primary);
    margin: 0 2px;
}
.detention-legend .legend-swatch-square {
    border: 1.5px solid var(--bg-primary);
    border-radius: 1px;
}
.detention-legend .legend-swatch-triangle {
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 12px solid currentColor;
    background: transparent !important;
    border-radius: 0;
    margin-top: 1px;
}

/* Filter chip color dots + hover popover */
.detention-filter {
    position: relative;
    padding-left: 1.55rem;
}
/* CSS-only popover using the chip's title attribute.
   Shows a well-styled explanatory tooltip on hover, far more visible than native title=. */
.detention-filter[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 0.5rem 0.7rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.4;
    width: 240px;
    white-space: normal;
    z-index: 50;
    box-shadow: 0 6px 18px rgba(0,0,0,0.22);
    pointer-events: none;
}
.detention-filter[title]:hover {
    /* keep chip above other filters while its popover is visible */
    z-index: 10;
}
.detention-filter::before {
    content: '';
    display: inline-block;
    position: absolute;
    left: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid var(--bg-primary);
    box-sizing: border-box;
}
.detention-filter[data-type="all"] { padding-left: 0.75rem; }
.detention-filter[data-type="all"]::before { display: none; }
.detention-filter[data-type="existing"]::before { background: #9ca3af; opacity: 0.7; }
.detention-filter[data-type="hold_room"]::before { background: transparent; border-color: #ea580c; border-width: 2px; }
.detention-filter[data-type="federal"]::before { background: #0891b2; }
.detention-filter[data-type="state_run"]::before {
    background: transparent;
    border: none;
    /* Triangle shape via border trick */
    width: 0; height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid #a855f7;
    border-radius: 0;
    top: calc(50% - 5px);
    transform: none;
}
.detention-filter[data-type="new"]::before { background: #dc2626; }
.detention-filter[data-type="military"]::before {
    background: #2563eb;
    transform: translateY(-50%) rotate(45deg);
    border-radius: 1px;
}
.detention-filter[data-type="offshore"]::before {
    background: #2563eb;
    transform: translateY(-50%) rotate(45deg);
    border-radius: 1px;
    border-style: dashed;
    border-width: 1.5px;
    border-color: var(--text-caption);
}
.detention-filter[data-type="staging"]::before {
    background: #14b8a6;
    border-radius: 1px;
    width: 9px; height: 9px;
}
.detention-filter[data-type="denied"]::before { background: #6b7280; opacity: 0.6; }
.detention-pulse { fill: none; stroke: #dc2626; stroke-width: 2; opacity: 0; pointer-events: none; }
@keyframes detentionPulse {
    0% { opacity: 0.6; transform: scale(1); }
    100% { opacity: 0; transform: scale(2.5); }
}
.detention-css-pulse {
    fill: none;
    stroke-width: 1.5;
    transform-box: fill-box;
    transform-origin: center;
    animation: detentionPulse 2.5s ease-out infinite;
    pointer-events: none;
}

.detention-css-pulse.filtered-out,
.mega-bed-label.filtered-out {
    display: none !important;
}
.detention-tooltip {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.8rem;
    max-width: 280px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    display: none;
}
.detention-tooltip .tooltip-name { font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.detention-tooltip .tooltip-location { color: var(--text-secondary); font-size: 0.75rem; }
.detention-tooltip .tooltip-beds { color: #dc2626; font-size: 1.1rem; font-weight: 700; margin: 4px 0; }
.detention-tooltip .tooltip-cost { color: var(--text-secondary); font-size: 0.75rem; }
.detention-tooltip .tooltip-status { display: inline-block; padding: 2px 6px; border-radius: 3px; font-size: 0.7rem; font-weight: 600; margin-top: 4px; }
/* Legend classes kept for backward compat */
.detention-legend-item { display: flex; align-items: center; gap: 4px; }
.detention-legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.detention-legend-diamond { width: 10px; height: 10px; background: #2563eb; transform: rotate(45deg); display: inline-block; }
.detention-card-highlight { outline: 3px solid #2563eb; outline-offset: 4px; transition: outline-color 0.3s; }
.filtered-out { opacity: 0.08 !important; }

@media (max-width: 599px) {
    #detention-map-viz { min-height: 250px; }
    .detention-tooltip { max-width: 200px; font-size: 0.7rem; }
    #detention-map-container > div:first-child div:first-child { flex-direction: column; }
}

/* ========== MAP ENHANCEMENTS: Zoom, Legend, Playback, Choropleth ========== */
.map-reset-zoom {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}
.map-reset-zoom:hover { color: var(--text-primary); border-color: var(--accent); }

.map-minimap { pointer-events: none; }
.minimap-viewport { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.8; }

.ne-inset-label {
    font-family: Inter, sans-serif;
    font-size: 8px;
    font-weight: 600;
    fill: var(--text-caption);
    letter-spacing: 0.3px;
}
.ne-inset-outline {
    stroke: var(--text-caption);
    stroke-width: 1;
    stroke-dasharray: 4,2;
    fill: none;
    opacity: 0.5;
    pointer-events: none;
}
.ne-inset-dot { transition: opacity 0.2s; }

.map-choropleth-toggle {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    transition: all 0.2s;
    margin-left: auto;
}
.map-choropleth-toggle:hover { border-color: var(--accent); color: var(--text-primary); }
.map-choropleth-toggle.active { background: var(--bg-accent); border-color: var(--accent); color: var(--text-primary); }

#raids-timeline-scrubber {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border);
    display: none;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
}
.map-playback-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    line-height: 1;
}
.map-playback-btn:hover { border-color: var(--accent); }

#raids-timeline-handle {
    transition: left 0.1s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

@media (max-width: 599px) {
    .map-reset-zoom { font-size: 0.6rem; padding: 3px 8px; }
    .ne-inset { display: none !important; }
    .ne-inset-outline { display: none; }
    #raids-timeline-scrubber { padding: 0.4rem 0.5rem; }
}

/* ========== GLOBAL SEARCH OVERLAY ========== */
.search-trigger {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-tertiary);
    padding: 0.875rem 1rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.search-trigger:hover {
    color: var(--text-primary);
}

.search-trigger svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
}

.search-trigger kbd {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.55rem;
    background: var(--bg-accent);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.1rem 0.3rem;
    color: var(--text-caption);
    line-height: 1;
    margin-left: 0.15rem;
}

.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10003;
    padding: 10vh 1rem 1rem;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.search-overlay.active {
    display: block;
}

.search-modal {
    max-width: 640px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: 0 24px 48px rgba(0,0,0,0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}

.search-modal-input-wrap {
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem;
}

.search-modal-input-wrap svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-tertiary);
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
}

.search-modal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 1.1rem;
    padding: 1rem 0;
    outline: none;
}

.search-modal-input::placeholder {
    color: var(--text-caption);
}

.search-modal-close {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-caption);
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
    cursor: pointer;
    flex-shrink: 0;
}

.search-modal-close:hover {
    border-color: var(--text-tertiary);
    color: var(--text-secondary);
}

.search-results {
    overflow-y: auto;
    padding: 0.5rem 0;
    overscroll-behavior: contain;
}

.search-results:empty::before {
    content: '';
}

.search-no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-caption);
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.85rem;
}

.search-group-label {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-caption);
    padding: 0.75rem 1.25rem 0.375rem;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    cursor: pointer;
    transition: background 0.1s;
    border-left: 3px solid transparent;
}

.search-result-item:hover,
.search-result-item.active {
    background: var(--bg-accent);
}

.search-result-item.active {
    border-left-color: var(--accent);
}

.search-result-badge {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.search-result-badge[data-cat="deaths"] { background: #D9EF5633; color: #D9EF56; }
.search-result-badge[data-cat="children"] { background: #d9770633; color: #f59e0b; }
.search-result-badge[data-cat="citizens"] { background: #3b82f633; color: #60a5fa; }
.search-result-badge[data-cat="worksite"] { background: #7c3aed33; color: #a78bfa; }
.search-result-badge[data-cat="schools"] { background: #f9731633; color: #fb923c; }
.search-result-badge[data-cat="corporate"] { background: #10b98133; color: #34d399; }
.search-result-badge[data-cat="detention-centers"] { background: #6b728033; color: #9ca3af; }
.search-result-badge[data-cat="statistics"] { background: #4460D833; color: #4460D8; }
.search-result-badge[data-cat="latest-news"] { background: #f5f5f522; color: #d4d4d4; }
.search-result-badge[data-cat="sources"] { background: #22c55e33; color: #4ade80; }

.search-result-text {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.15rem;
}

.search-result-title mark {
    background: none;
    color: var(--accent);
    font-weight: 600;
}

.search-result-snippet {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    color: var(--text-caption);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-snippet mark {
    background: none;
    color: var(--text-secondary);
    font-weight: 500;
}

.search-footer {
    border-top: 1px solid var(--border);
    padding: 0.5rem 1.25rem;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.65rem;
    color: var(--text-caption);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-footer kbd {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.6rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.1rem 0.3rem;
    color: var(--text-caption);
}

@keyframes searchHighlightPulse {
    0% { outline: 3px solid var(--accent); outline-offset: 4px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
    100% { outline: 3px solid transparent; outline-offset: 4px; background: transparent; }
}

.search-highlight {
    animation: searchHighlightPulse 3s ease-out forwards;
}

@media (max-width: 599px) {
    .search-overlay {
        padding: 2vh 0.5rem 0.5rem;
    }

    .search-modal {
        max-height: 60dvh;
        border-radius: 10px;
    }

    .search-trigger kbd {
        display: none;
    }

    .search-trigger {
        padding: 0.625rem 1rem;
    }
}

/* ========== CSV DOWNLOAD BUTTONS ========== */
.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-accent);
    border: 1px solid var(--border);
    color: var(--text-caption);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    vertical-align: middle;
    margin-left: 0.5rem;
}

.download-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-card);
}

.download-btn svg {
    width: 10px;
    height: 10px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}


.download-all-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.download-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-accent);
    border: 1px solid var(--border);
    color: var(--text-caption);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.2s;
    white-space: nowrap;
}

.download-all-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-card);
}

.download-all-btn svg {
    width: 10px;
    height: 10px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}


/* ========== UNIFIED MAP ========== */

.unified-map-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.unified-layer-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.unified-layer-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-caption);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.unified-layer-toggle:hover {
    border-color: var(--text-caption);
}

.unified-layer-toggle.active {
    background: var(--bg-accent);
    color: var(--text-primary);
    border-color: var(--text-caption);
}

.layer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.unified-mode-toggles {
    display: flex;
    gap: 0.375rem;
    margin-left: auto;
}

.unified-mode-toggle {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-caption);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.unified-mode-toggle:hover {
    border-color: var(--text-caption);
}

.unified-mode-toggle.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

#unified-map-container {
    position: relative;
    min-height: 400px;
}

#unified-map-viz svg {
    display: block;
}

.unified-map-state {
    fill: var(--bg-accent);
    stroke: none;
    transition: opacity 0.15s;
}

.unified-map-border {
    stroke: #5a5758;
    stroke-width: 0.7;
}

.unified-heatmap-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.unified-map-tooltip {
    position: absolute;
    display: none;
    opacity: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    max-width: 280px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: var(--text-primary);
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: opacity 0.15s ease;
}

.unified-map-tooltip h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.unified-map-tooltip p {
    margin: 0.15rem 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.tooltip-layer {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-top: 0.375rem;
}

.tooltip-nav-link {
    margin-top: 0.5rem !important;
    color: var(--accent) !important;
    font-weight: 600;
    font-size: 0.7rem !important;
    cursor: pointer;
}

.unified-state-tooltip {
    position: absolute;
    display: none;
    opacity: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    max-width: 180px;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    color: var(--text-primary);
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: opacity 0.15s ease;
    line-height: 1.4;
}

.unified-globe {
    pointer-events: none;
}

.unified-map-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.unified-stat-total {
    font-size: 0.85rem;
}

.unified-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
}

@media (max-width: 599px) {
    .unified-map-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .unified-mode-toggles {
        margin-left: 0;
    }
    .unified-layer-toggles {
        gap: 0.25rem;
    }
    .unified-layer-toggle {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }
    #unified-map-container {
        min-height: 280px;
    }
}

/* ========== TIMELINE VIEW ========== */

.timeline-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--rule-light);
}

.timeline-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.timeline-filter-label {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-caption);
    margin-right: 0.25rem;
}

.timeline-filter-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.timeline-viz {
    position: relative;
    min-height: 200px;
}

.timeline-count {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    color: var(--text-caption);
    margin-bottom: 1rem;
}

.timeline-count strong {
    color: var(--text-primary);
}

/* Mini-map */
.timeline-minimap {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.minimap-bar {
    transition: opacity 0.15s ease;
}

.minimap-bar:hover {
    opacity: 0.8 !important;
}

/* Overview: month density bars */
.timeline-month-bar {
    padding: 0.75rem 1rem;
    border-left: 3px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: background 0.15s ease, border-color 0.15s ease;
    margin-bottom: 0.25rem;
}

.timeline-month-bar:hover {
    background: var(--bg-secondary);
    border-left-color: var(--accent);
}

.timeline-month-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.4rem;
}

.timeline-month-name {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.timeline-month-count {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    color: var(--text-caption);
}

.timeline-bar-track {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-tertiary, var(--border));
    margin-bottom: 0.4rem;
}

.timeline-bar-segment {
    height: 100%;
    min-width: 3px;
    transition: width 0.2s ease;
}

.timeline-month-cats {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.timeline-cat-tag {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.6rem;
    color: var(--text-caption);
    border-left: 3px solid;
    padding-left: 0.35rem;
}

/* Drill-down: back button and heading */
.timeline-back-btn {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
}

.timeline-back-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.timeline-drill-heading {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* Drill-down: horizontal SVG wrapper */
.timeline-horizontal-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    cursor: grab;
}

.timeline-horizontal-wrapper:active {
    cursor: grabbing;
}

.timeline-svg {
    display: block;
}

.timeline-dot-svg {
    transition: r 0.15s ease;
}

/* Magnifying glass lens */
.timeline-lens circle:first-child {
    filter: drop-shadow(0 0 6px rgba(107, 163, 199, 0.4));
}

/* Drill-down: event list */
.timeline-event-list {
    margin-top: 1.25rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.timeline-event-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0.5rem;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.timeline-event-item:hover {
    background: var(--bg-secondary);
}

.timeline-event-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 0.35rem;
}

.timeline-event-info {
    flex: 1;
    min-width: 0;
}

.timeline-event-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}

.timeline-event-badge {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

.timeline-event-date {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    color: var(--text-caption);
}

.timeline-event-title {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}

.timeline-event-snippet {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 0.25rem;
}

/* Tooltip */
.timeline-tooltip {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    max-width: 220px;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: none;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
}

.timeline-tip-badge {
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 0.3rem;
}

.timeline-tip-date {
    font-size: 0.7rem;
    color: var(--text-caption);
    margin-bottom: 0.2rem;
}

.timeline-tip-title {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Detail panel — positioned absolutely near the clicked dot */
.timeline-detail-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 1.25rem;
    max-width: 360px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    animation: timelineDetailIn 0.2s ease-out;
}

@keyframes timelineDetailIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.timeline-detail-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-caption);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.timeline-detail-close:hover {
    color: var(--text-primary);
}

.timeline-detail-badge {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 0.4rem;
}

.timeline-detail-date {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    color: var(--text-caption);
    margin-bottom: 0.3rem;
}

.timeline-detail-title {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.timeline-detail-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.timeline-detail-source {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    color: var(--text-caption);
    margin-bottom: 0.75rem;
}

.timeline-detail-source a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 2px;
}

.timeline-detail-source a:hover {
    color: var(--accent);
}

.timeline-view-in-tab {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.timeline-view-in-tab:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.timeline-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-caption);
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.9rem;
}

/* Timeline responsive — tablet+ */
@media (min-width: 600px) {
    .timeline-controls {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

/* Timeline reduced motion */
@media (prefers-reduced-motion: reduce) {
    .timeline-detail-panel {
        animation: none;
    }
    .timeline-dot-svg {
        transition: none;
    }
}

/* ========== EMBED BUTTONS & MODAL ========== */
.embed-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--bg-accent);
    border: 1px solid var(--border);
    color: var(--text-tertiary);
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.embed-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

/* Timeline viz: align embed button with the "Showing X incidents" count line above */
.timeline-viz .embed-btn {
    top: -1.5rem;
}

.embed-btn svg {
    flex-shrink: 0;
}

[data-embed-id]:hover .embed-btn,
.embed-btn:focus {
    opacity: 1;
}

/* Prominent embed button for D3 visualizations (maps, graphs) — sits inline with filter buttons */
.embed-viz-btn {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid #6366f1;
    color: #a5b4fc;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    margin-left: auto;
    white-space: nowrap;
}

.embed-viz-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: #818cf8;
    color: #e0e7ff;
    transform: scale(1.04);
}

.embed-viz-btn:active {
    background: rgba(99, 102, 241, 0.45);
    border-color: #a5b4fc;
    color: #fff;
}


.embed-viz-btn svg {
    flex-shrink: 0;
    width: 13px;
    height: 13px;
}

.embed-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10002;
    padding: 8vh 1rem 1rem;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.embed-overlay.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.embed-modal {
    width: 100%;
    max-width: 520px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    overflow: hidden;
}

.embed-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.embed-modal-header h3 {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.embed-modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.embed-modal-close:hover {
    color: var(--text-primary);
}

.embed-modal-body {
    padding: 1.25rem;
}

.embed-label {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-caption);
    display: block;
    margin-bottom: 0.4rem;
}

.embed-method-toggle {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.embed-method-btn {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    padding: 0.25rem 0.7rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.embed-method-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.embed-theme-toggle {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.embed-theme-btn {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    padding: 0.25rem 0.7rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.embed-theme-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Region picker (third-country map embed) — mirrors the theme toggle */
.embed-region-toggle { display: flex; gap: 0.4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.embed-region-btn {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif; font-size: 0.7rem;
    padding: 0.25rem 0.7rem; border: 1px solid var(--border); background: transparent;
    color: var(--text-secondary); border-radius: 4px; cursor: pointer; transition: all 0.15s;
}
.embed-region-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.embed-code {
    width: 100%;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.6rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.7rem;
    resize: none;
    margin-bottom: 0.6rem;
    line-height: 1.5;
}

.embed-copy-btn {
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.45rem;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.embed-copy-btn:hover {
    opacity: 0.9;
}

.embed-preview {
    width: 100%;
    height: 200px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
}

/* ========== COLLECTION / PICK MODE ========== */

/* Chips used in both modal and pick bar */
.embed-collection-list {
    margin-bottom: 0.75rem;
}

.embed-collection-items,
.embed-pick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.embed-collection-chip {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    background: var(--bg-accent);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.2rem 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.embed-chip-remove {
    background: none;
    border: none;
    color: var(--text-caption);
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0 0.1rem;
}

.embed-chip-remove:hover {
    color: var(--danger);
}

/* "Add More" button in modal */
.embed-add-more-btn {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    background: transparent;
    color: var(--accent);
    border: 1px dashed var(--border);
    border-radius: 4px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.35rem;
}

.embed-add-more-btn:hover {
    border-color: var(--accent);
    background: var(--bg-accent);
}

.embed-single-add-more {
    margin-bottom: 0.75rem;
}

/* Pick banner inside modal — shown during pick mode */
.embed-pick-banner {
    background: var(--bg-accent);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.embed-pick-banner p {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.embed-pick-banner strong {
    color: var(--text-primary);
}

.embed-pick-done-btn {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.embed-pick-done-btn:hover {
    filter: brightness(1.15);
}

/* Highlight selected items during pick mode */
.embed-pick-mode [data-embed-id].embed-selected {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Make embed buttons always visible during pick mode */
.embed-pick-mode .embed-btn {
    opacity: 1 !important;
}

/* ========== SELECTION BAR (pick mode — desktop & mobile) ========== */
.embed-selection-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.embed-selection-bar.active {
    transform: translateY(0);
}

.embed-selection-bar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.85rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.embed-selection-bar-info {
    flex: 1;
    min-width: 0;
}

.embed-selection-bar-count {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    display: inline;
    letter-spacing: 0.01em;
}

.embed-selection-bar-hint {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    color: var(--text-caption);
    margin-left: 0.75rem;
    font-style: italic;
}

.embed-selection-bar-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin-top: 0.4rem;
}

.embed-selection-bar-chips:empty {
    display: none;
}

.embed-selection-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.embed-selection-bar-cancel {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    background: transparent;
    color: var(--text-caption);
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.embed-selection-bar-cancel:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.embed-selection-bar-done {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.embed-selection-bar-done svg {
    width: 12px;
    height: 12px;
}

.embed-selection-bar-done:hover {
    filter: brightness(1.15);
    box-shadow: 0 2px 8px rgba(200,50,50,0.3);
}

.embed-selection-bar-done:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    filter: none;
}

/* Mobile: stack layout, larger touch targets, safe area inset */
@media (max-width: 768px) {
    .embed-selection-bar {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .embed-selection-bar-inner {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 1rem;
        gap: 0.6rem;
    }
    .embed-selection-bar-info {
        text-align: center;
    }
    .embed-selection-bar-hint {
        display: block;
        margin-left: 0;
        margin-top: 0.15rem;
    }
    .embed-selection-bar-chips {
        justify-content: center;
    }
    .embed-selection-bar-actions {
        justify-content: stretch;
        gap: 0.5rem;
    }
    .embed-selection-bar-cancel,
    .embed-selection-bar-done {
        flex: 1;
        justify-content: center;
        padding: 0.65rem 0.75rem;
        font-size: 0.8rem;
        -webkit-tap-highlight-color: transparent;
    }
    .embed-selection-bar-done {
        padding: 0.7rem 0.75rem;
    }
}

/* Section embed buttons */
.embed-section-btn {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    background: var(--bg-accent);
    color: var(--text-caption);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    margin-left: 0.75rem;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.embed-section-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.embed-section-btn svg {
    width: 10px;
    height: 10px;
}

/* ========== SHARE BUTTONS (Phase 3: Deep Links) ========== */

.share-btn {
    position: absolute;
    top: 0.5rem;
    right: 5.5rem;
    background: var(--bg-accent);
    border: 1px solid var(--border);
    color: var(--text-tertiary);
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.share-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

[data-embed-id]:hover .share-btn,
.share-btn:focus {
    opacity: 1;
}

.share-section-btn {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    background: var(--bg-accent);
    color: var(--text-caption);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    margin-left: 0.5rem;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.share-section-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.share-section-btn svg {
    width: 10px;
    height: 10px;
}

/* ========== FILTER BUILDER MODAL (Phase 4) ========== */

.filter-builder-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10001;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem;
    overflow-y: auto;
}

.filter-builder-overlay.active {
    display: flex;
}

.filter-builder-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 700px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.filter-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.filter-builder-header h3 {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.filter-builder-close {
    background: none;
    border: none;
    color: var(--text-caption);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.filter-builder-close:hover {
    color: var(--text-primary);
}

.filter-builder-body {
    padding: 1.25rem;
}

.filter-builder-fields {
    margin-bottom: 1.25rem;
}

.filter-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    margin-bottom: 0.75rem;
}

.filter-checkbox {
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.filter-checkbox input[type="checkbox"] {
    accent-color: var(--accent);
}

.filter-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.filter-field {
    flex: 1;
    min-width: 0;
}

.filter-builder-fields .embed-label {
    margin-top: 0.75rem;
}

.filter-builder-fields .embed-label:first-child {
    margin-top: 0;
}

.filter-builder-fields select,
.filter-builder-fields input[type="text"],
.filter-builder-fields input[type="number"],
.filter-builder-fields input[type="date"] {
    width: 100%;
    padding: 0.4rem 0.5rem;
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

.filter-builder-fields select:focus,
.filter-builder-fields input:focus {
    border-color: var(--accent);
}

/* Visualization mode: when a map is selected in the Filter Embed builder,
   hide the card-only fields (categories, city, year, dates, keyword, industry,
   max-results, exclude). The State filter remains visible because maps honor it. */
.filter-builder-body[data-viz^="map-"] .filter-cards-only {
    display: none;
}

.filter-builder-output {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.filter-embed-code {
    width: 100%;
    padding: 0.5rem;
    font-family: 'DM Mono', monospace, monospace;
    font-size: 0.75rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    resize: vertical;
}

.filter-copy-btn {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.45rem 1rem;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: filter 0.2s;
}

.filter-copy-btn:hover {
    filter: brightness(1.15);
}

.filter-preview {
    width: 100%;
    min-height: 250px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    margin-top: 0.5rem;
}

.filter-embed-trigger {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-tertiary);
    padding: 0.875rem 1rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-embed-trigger:hover {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

.filter-embed-trigger svg {
    width: 12px;
    height: 12px;
}

/* ---- Multi-state selector ---- */
.filter-state-select {
    position: relative;
}

.filter-state-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.35rem;
}

.filter-state-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--accent);
    color: #fff;
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.filter-state-chip-x {
    cursor: pointer;
    opacity: 0.7;
    font-size: 0.8rem;
    line-height: 1;
}

.filter-state-chip-x:hover {
    opacity: 1;
}

.filter-state-search {
    width: 100%;
    padding: 0.4rem 0.5rem;
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

.filter-state-search:focus {
    border-color: var(--accent);
}

.filter-state-dropdown {
    display: none;
    position: absolute;
    z-index: 10;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 0.25rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.filter-state-dropdown.open {
    display: block;
}

.filter-state-dropdown label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
}

.filter-state-dropdown label:hover {
    background: var(--bg-accent, rgba(255,255,255,0.05));
}

.filter-state-dropdown label.hidden {
    display: none;
}

/* ---- Metro area presets ---- */
.filter-metro-presets {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    padding: 0.5rem 0.6rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.filter-metro-presets .embed-label {
    margin-top: 0 !important;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    color: var(--text-caption);
}

.filter-metro-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.filter-metro-btns button {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-metro-btns button:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}

.filter-metro-btns button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ---- Exclude management (filter builder) ---- */
.filter-exclude-section {
    margin-top: 0.5rem;
}

.filter-exclude-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.35rem;
}

.filter-exclude-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-exclude-chip-x {
    cursor: pointer;
    color: var(--danger, #dc2626);
    font-size: 0.8rem;
    line-height: 1;
    flex-shrink: 0;
}

.filter-exclude-chip-x:hover {
    opacity: 0.7;
}

.filter-exclude-hint {
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    font-size: 0.7rem;
    color: var(--text-caption);
    font-style: italic;
}

@media (max-width: 768px) {
    .filter-builder-overlay {
        padding: 0.5rem;
    }

    .filter-row {
        flex-direction: column;
        gap: 0;
    }

    .filter-checkboxes {
        gap: 0.25rem 0.5rem;
    }

    .filter-embed-trigger span {
        display: none;
    }

    .filter-metro-btns {
        gap: 0.2rem;
    }
}

/* ========== DEEP LINK HIGHLIGHT PULSE ========== */

@keyframes highlightPulse {
    0% { box-shadow: 0 0 0 0 rgba(107, 163, 199, 0.7); }
    50% { box-shadow: 0 0 0 8px rgba(107, 163, 199, 0.3); }
    100% { box-shadow: 0 0 0 0 rgba(107, 163, 199, 0); }
}

.highlight-pulse {
    animation: highlightPulse 1.5s ease-out 2;
}

/* Mobile adjustments for embed UI */
@media (max-width: 768px) {
    /* Always show embed/share buttons on touch devices (no hover) */
    .embed-btn,
    .share-btn {
        opacity: 1;
    }

    /* Section action buttons: stack below title text on mobile */
    .embed-section-btn,
    .share-section-btn,
    .download-btn {
        display: flex;
        width: fit-content;
        margin-left: 0;
        margin-top: 0.35rem;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    nav {
        display: none;
    }

    .section {
        display: block !important;
        page-break-inside: avoid;
    }

    .case-card, .stat-card, .source-card {
        break-inside: avoid;
    }

    .embed-btn,
    .embed-viz-btn,
    .embed-overlay,
    .embed-section-btn,
    .share-btn,
    .share-section-btn,
    .download-btn,
    .download-all-bar {
        display: none !important;
    }

    .timeline-controls,
    .timeline-view-in-tab {
        display: none;
    }

    .timeline-detail-panel {
        animation: none;
    }

    body {
        background: white;
        color: black;
    }

    .stat-value {
        color: #2563eb;
    }

    a {
        color: #2563eb;
    }
}

/* ========== INLINE STYLE EXTRACTIONS ========== */

/* -- Overview Map Cards -- */
.overview-maps {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
    grid-template-columns: 1fr 1fr;
}

.overview-map-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.overview-map-card--full {
    grid-column: 1 / -1;
}

.overview-card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.overview-card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.overview-card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
}

.overview-card-link {
    font-size: 0.75rem;
    color: var(--accent);
}

.overview-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-family: 'DM Sans', sans-serif;
}

.overview-map-embed {
    width: 100%;
    height: 300px;
    position: relative;
}

.overview-map-embed--tall {
    height: 350px;
}

.overview-card-footer {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
}

.overview-card-footer strong {
    color: var(--text-primary);
}

.overview-card-footer .highlight-danger {
    color: var(--danger);
}

/* -- Overview Nav Cards (section navigation) -- */
.overview-sections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.overview-nav-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.overview-nav-stat {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.overview-nav-stat--danger {
    color: var(--danger);
}

.overview-nav-stat--accent {
    color: var(--accent);
}

.overview-nav-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    margin-top: 0.25rem;
}

.overview-nav-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* -- Corporate Network: category border colors -- */
.card-cat-detention {
    border-left: 3px solid #ef4444;
}

.card-cat-tech {
    border-left: 3px solid #3b82f6;
}

.card-cat-data-broker {
    border-left: 3px solid #f59e0b;
}

.card-cat-transport {
    border-left: 3px solid #10b981;
}

.card-cat-construction {
    border-left: 3px solid #8b5cf6;
}

.card-cat-bounty {
    border-left: 3px solid #dc2626;
}

.card-cat-other {
    border-left: 3px solid #6b7280;
}

/* Tags matching card categories (thinner border) */
.case-tag[class*="tag-cat-"] {
    padding-left: 0.5rem;
    margin-left: 0.25rem;
}

.tag-cat-detention {
    border-left: 2px solid #ef4444;
}

.tag-cat-tech {
    border-left: 2px solid #3b82f6;
}

.tag-cat-data-broker {
    border-left: 2px solid #f59e0b;
}

.tag-cat-transport {
    border-left: 2px solid #10b981;
}

.tag-cat-construction {
    border-left: 2px solid #8b5cf6;
}

.tag-cat-bounty {
    border-left: 2px solid #dc2626;
}

.tag-cat-other {
    border-left: 2px solid #6b7280;
}

/* -- Detention Center status tags -- */
.tag-status-purchased {
    border-left: 3px solid #dc2626;
    padding-left: 0.5rem;
}

.tag-status-planned {
    border-left: 3px solid #f59e0b;
    padding-left: 0.5rem;
}

.tag-status-operational {
    border-left: 3px solid #2563eb;
    padding-left: 0.5rem;
}

.tag-status-denied {
    border-left: 3px solid #6b7280;
    padding-left: 0.5rem;
}

.tag-status-beds {
    border-left: 3px solid #dc2626;
    padding-left: 0.5rem;
}

.tag-status-info {
    border-left: 3px solid #3b82f6;
    padding-left: 0.5rem;
}

/* -- Corporate Network section subheadings -- */
.corporate-subheading {
    margin: 1.5rem 0 1rem;
    color: var(--text-secondary);
}

.corporate-subheading--spaced {
    margin: 2rem 0 0.75rem;
    color: var(--text-secondary);
}

/* -- Corporate Network methodology toggle -- */
.corporate-methodology {
    margin: 0 0 1.5rem;
}

.corporate-methodology > summary {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-caption);
    cursor: pointer;
    user-select: none;
    padding: 0.6rem 0.75rem;
    background: var(--bg-secondary);
    border-left: 3px solid var(--border-strong);
    border-radius: 2px;
    transition: color 0.15s ease;
}

.corporate-methodology > summary:hover {
    color: var(--text-primary);
}

.corporate-methodology[open] > summary {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.corporate-methodology .methodology-note {
    max-width: none;
    margin: 0;
}

.corporate-methodology .methodology-note p {
    margin: 0 0 0.75rem;
}

.corporate-methodology .methodology-note p:last-child {
    margin-bottom: 0;
}

.corporate-data-vintage {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.75rem !important;
}

/* -- Corporate Network headline stat row (above network viz) -- */
.corporate-headline-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem 2rem;
    margin-bottom: 0.5rem;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
}

.corporate-headline-stat {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.corporate-headline-stat__num {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.corporate-headline-stat__num--danger {
    color: var(--danger);
}

.corporate-headline-stat__label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.05rem;
}

.corporate-headline-stat__source {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.corporate-headline-stat__source a {
    color: var(--accent);
    text-decoration: none;
}

.corporate-headline-stat__source a:hover {
    text-decoration: underline;
}

/* -- Investigation badges (Sludge, GSA Schedule, etc.) -- */
.case-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: -0.25rem 0 0.85rem;
}

.badge-investigation {
    display: inline-flex;
    align-items: center;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.55rem;
    border-radius: 3px;
    text-decoration: none;
    border: 1px solid;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.badge-investigation--sludge {
    color: #f59e0b;
    border-color: #f59e0b66;
    background: #f59e0b14;
}

.badge-investigation--sludge:hover {
    background: #f59e0b26;
    color: #fbbf24;
}

/* -- Network legend dots -- */
.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 4px;
}

.legend-item {
    margin-right: 1rem;
}

/* -- Contractor directory table -- */
.table-scroll {
    overflow-x: auto;
    margin-bottom: 2rem;
}

.contractor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.contractor-table thead tr {
    border-bottom: 2px solid var(--border);
    text-align: left;
}

.contractor-table th {
    padding: 0.6rem 0.75rem;
    color: var(--text-primary);
}

.contractor-table th.sortable {
    cursor: pointer;
    white-space: nowrap;
}

/* -- Contractor filter bar -- */
.contractor-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: flex-end;
    margin-bottom: 0.75rem;
    padding: 0.75rem 0.9rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.contractor-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    flex: 1 1 160px;
}

.contractor-filter-field--search {
    flex: 2 1 220px;
}

.contractor-filter-field label {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-caption);
}

.contractor-filter-field input[type="text"],
.contractor-filter-field select {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    line-height: 1.3;
    width: 100%;
    box-sizing: border-box;
}

.contractor-filter-field input[type="text"]:focus,
.contractor-filter-field select:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}

.contractor-filter-field--checkbox {
    flex: 0 1 auto;
    align-self: flex-end;
}

.contractor-filter-field--checkbox label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-primary);
    cursor: pointer;
    padding-bottom: 0.4rem;
}

.contractor-filter-field--checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* -- Contractor results count + clear filters -- */
.contractor-results-count {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.contractor-results-count strong {
    color: var(--text-primary);
    font-weight: 600;
}

.contractor-clear-filters {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.25rem 0.6rem;
    border-radius: 3px;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    cursor: pointer;
    line-height: 1.2;
}

.contractor-clear-filters:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    color: var(--accent);
}

/* -- Contractor pagination -- */
.contractor-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: center;
    align-items: center;
    margin: 1rem 0 2rem;
    font-family: 'Inter', sans-serif;
}

.pagination-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.35rem 0.7rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1.2;
    min-width: 2.25rem;
    text-align: center;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn--current {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    font-weight: 600;
}

.pagination-btn--current:hover:not(:disabled) {
    background: var(--accent);
    color: #ffffff;
}

.pagination-ellipsis {
    color: var(--text-caption);
    padding: 0 0.25rem;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    .contractor-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .contractor-filter-field {
        flex: 1 1 auto;
    }
    .contractor-filter-field--checkbox label {
        padding-bottom: 0;
    }
    .contractor-pagination {
        gap: 0.2rem;
    }
    .pagination-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
        min-width: 2rem;
    }
}

/* -- Form styles -- */
.form-label {
    display: block;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 16px;
}

textarea.form-input {
    resize: vertical;
    font-family: inherit;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
}

.form-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
}

.form-consent-label input[type="checkbox"] {
    margin-top: 0.25rem;
}

.form-consent-text {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.form-submit-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.875rem 2rem;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

/* -- Utility spacing -- */
.mt-2 {
    margin-top: 2rem;
}

.mb-1-5 {
    margin-bottom: 1.5rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

.mt-1-5 {
    margin-top: 1.5rem;
}

/* -- Misc one-offs -- */
.header-logo {
    height: 2rem;
    opacity: 0.85;
}

.masthead--accent {
    color: var(--danger);
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.link-muted {
    color: var(--text-secondary);
    text-decoration: underline;
    text-decoration-color: var(--accent);
}

.footnote-star {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.hidden {
    display: none;
}

/* Overview page responsive */
@media (max-width: 768px) {
    .overview-maps {
        grid-template-columns: 1fr !important;
    }
    .overview-maps .overview-map-card {
        grid-column: auto !important;
    }
    .overview-sections {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 480px) {
    .overview-sections {
        grid-template-columns: 1fr !important;
    }
}

/* =========================================================
   Facilities Table (JS-rendered via js/facilities-table.js)
   ========================================================= */

.facilities-table-filters {
    margin: 1.5rem 0 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 0.8rem;
}

.facilities-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.facilities-filter-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-caption);
    margin-right: 0.35rem;
}

.facilities-filter-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.facilities-filter-chip {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: inherit;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.facilities-filter-chip:hover { background: var(--bg-secondary, rgba(0,0,0,0.04)); border-color: var(--text-caption); }
.facilities-filter-chip.active { background: var(--text-primary); color: var(--bg-primary); border-color: var(--text-primary); }
.facilities-filter-chip .chip-count { font-size: 0.7rem; opacity: 0.7; }

.facilities-search, .facilities-state {
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
}
.facilities-search { min-width: 220px; }
.facilities-search:focus, .facilities-state:focus {
    outline: 2px solid var(--accent, #ea580c);
    outline-offset: -1px;
}

.facilities-reset-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    transition: all 0.15s;
}
.facilities-reset-btn:hover { border-color: var(--danger); color: var(--danger); }

.facilities-count {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: var(--text-caption);
    margin: 0.25rem 0 0.75rem 0.25rem;
}

.facilities-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Inter', 'DM Sans', sans-serif;
    font-size: 0.85rem;
}
.facilities-table th,
.facilities-table td {
    padding: 0.55rem 0.7rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.facilities-table thead th {
    background: var(--bg-card);
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-caption);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 2;
}
.facilities-table th.sortable { cursor: pointer; user-select: none; }
.facilities-table th.sortable:hover { color: var(--text-primary); }
.facilities-table tbody tr:hover { background: var(--bg-card); }
.facilities-table .col-type { white-space: nowrap; min-width: 105px; }
.facilities-table .col-name { min-width: 240px; }
.facilities-table .col-city { min-width: 120px; }
.facilities-table .col-state { width: 50px; }
.facilities-table .col-capacity, .facilities-table .col-population { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.facilities-table .col-source { min-width: 130px; white-space: nowrap; }
.facilities-table .col-flags { min-width: 150px; }
.facilities-table .pop-meta { font-size: 0.65rem; color: var(--text-caption); margin-left: 0.25rem; text-transform: uppercase; letter-spacing: 0.04em; }
.facilities-table .source-label {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border-left: 3px solid var(--text-caption);
    cursor: help;
}
.facilities-table .source-ice-official-feb-2026 { border-left-color: #6b7280; }
.facilities-table .source-vera-feb-2026 { border-left-color: #d4a017; }
.facilities-table .source-hold-room-2025-oct { border-left-color: #ea580c; }
.facilities-table .source-state-run-2026 { border-left-color: #a855f7; }
.facilities-table .source-expansion-2026 { border-left-color: #dc2626; }
.facilities-table .capacity-na { color: var(--text-caption); font-style: italic; font-size: 0.75rem; }
.facilities-table .cell-dash { color: var(--text-caption); }
.facilities-table .ice-code-inline {
    display: inline-block;
    font-family: 'JetBrains Mono', 'Menlo', monospace;
    font-size: 0.65rem;
    color: var(--text-caption);
    background: var(--bg-card);
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 0.3rem;
}

/* Type badges (used in facilities table + tooltips) */
.type-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-weight: 500;
    white-space: nowrap;
}
.type-badge.type-official_ice { background: #e5e7eb; color: #374151; }
.type-badge.type-hold_room { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.type-badge.type-federal { background: #cffafe; color: #0e7490; }
.type-badge.type-state_run { background: #f5e9ff; color: #7e22ce; }
.type-badge.type-military_base { background: #dbeafe; color: #1e40af; }
.type-badge.type-staging { background: #ccfbf1; color: #0f766e; }
.type-badge.type-offshore { background: #dbeafe; color: #1e40af; border: 1px dashed #2563eb; }

/* Flag badges — high contrast on both light and dark card backgrounds */
.badge {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 0.25rem;
    white-space: nowrap;
    line-height: 1.2;
}
/* Overcapacity: red background with WHITE text + dark outline for readability on both themes */
.badge-overcapacity {
    background: #fef2f2;
    color: #991b1b;
    border: 1.5px solid #dc2626;
}
.badge-violations {
    background: #fff7ed;
    color: #9a3412;
    border: 1.5px solid #ea580c;
}
.badge-no-signage { background: #fef3c7; color: #78350f; border: 1px solid #92400e; }
.badge-offshore { background: #dbeafe; color: #1e40af; border: 1px dashed #2563eb; }
.badge-state-run { background: #f5e9ff; color: #6b21a8; border: 1px solid #c084fc; }
.badge-no-coords { background: #e5e7eb; color: #4b5563; }

/* Freshness dot */
.freshness-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid var(--bg-primary);
    cursor: help;
}
.freshness-dot.freshness-official { background: #6b7280; }
.freshness-dot.freshness-vera { background: #d4a017; }
.freshness-dot.freshness-holdroom { background: #ea580c; }
.freshness-dot.freshness-state { background: #a855f7; }
.freshness-dot.freshness-expansion { background: #dc2626; }
.freshness-dot.freshness-other { background: #9ca3af; }

.table-error {
    padding: 2rem;
    text-align: center;
    color: var(--text-caption);
    font-style: italic;
}

/* Vera callout banner — plain light/dark readability */
.callout-banner {
    box-sizing: border-box;
}
.callout-banner-danger {
    background: var(--bg-card);
}

/* Mobile tweaks for facilities table */
@media (max-width: 768px) {
    .facilities-table {
        font-size: 0.75rem;
    }
    .facilities-table .col-source,
    .facilities-table .col-flags {
        display: none;
    }
    .facilities-table th,
    .facilities-table td {
        padding: 0.4rem 0.5rem;
    }
    .facilities-search { min-width: 140px; }
}

/* ========== CORPORATE FILTER PILLS (shared by network + treemap) ========== */
.corporate-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
.corporate-filter-bar .filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.corporate-filter-bar .filter-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ========== CORPORATE NETWORK BANNER ========== */
.network-banner {
    padding: 0.65rem 1rem 0.55rem;
    border-bottom: 1px solid var(--border);
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    color: var(--text-primary);
    line-height: 1.35;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: baseline;
}
.network-banner__main { font-weight: 600; }
.network-banner__sub { color: var(--text-caption); font-size: 0.72rem; }
@media (max-width: 600px) {
    .network-banner { padding: 0.55rem 0.75rem; font-size: 0.72rem; }
}

/* ========== CORPORATE VIZ MODE TOGGLE ========== */
.viz-mode-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
}
.viz-mode-toggle .viz-mode-label {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-caption);
    margin-right: 0.25rem;
}
.viz-mode-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.85rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.viz-mode-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.viz-mode-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}
.viz-mode-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ========== CORPORATE TREEMAP + NODE TOOLTIPS ========== */
.corporate-treemap-svg .leaf-rect { transition: fill-opacity 0.15s ease; }
.corporate-treemap-svg .leaf-rect:hover { fill-opacity: 1; }
.treemap-tooltip,
.node-tooltip {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.7rem 0.85rem;
    font-size: 0.72rem;
    max-width: 280px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    line-height: 1.4;
}
.treemap-tooltip h4,
.node-tooltip h4 {
    margin: 0 0 0.4rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    color: var(--text-primary);
    line-height: 1.25;
}
.treemap-tooltip p,
.node-tooltip p {
    margin: 0.18rem 0;
    color: var(--text-secondary);
}
.treemap-tooltip .tip-cat,
.node-tooltip .tip-cat {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.62rem;
    color: var(--text-caption);
}
.treemap-tooltip .tip-amount,
.node-tooltip .tip-amount {
    color: var(--text-primary);
    font-weight: 600;
}
.treemap-tooltip .tip-gsa,
.node-tooltip .tip-gsa {
    color: #22c55e;
    font-size: 0.65rem;
    margin-top: 0.3rem;
}
.treemap-tooltip .tip-hint,
.node-tooltip .tip-hint {
    color: var(--text-caption);
    font-size: 0.62rem;
    font-style: italic;
    margin-top: 0.4rem;
    border-top: 1px solid var(--border);
    padding-top: 0.3rem;
}

@media (max-width: 600px) {
    .viz-mode-toggle { padding: 0.5rem 0.5rem; gap: 0.3rem; }
    .viz-mode-btn { padding: 0.35rem 0.6rem; font-size: 0.7rem; }
}

/* ===== Article feed: New badge + per-tab TOC ===== */
.article-feed { /* layout-neutral: cards keep their existing grid/stack flow */ }

.case-badge-new {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    background: var(--accent);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    margin-bottom: 0.5rem;
    vertical-align: middle;
}

/* When the badge sits inside the .case-meta tag row, keep it a pill (override
   the row's `span { display: inline }`), nudge it left of the first tag, and
   drop the row's " · " separator that would otherwise trail the pill. */
.case-meta .case-badge-new {
    display: inline-block;
    margin: 0 0.4rem 0 0;
}
.case-meta .case-badge-new::after {
    content: '';
    margin: 0;
}

.tab-toc {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin: 0 0 1.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
}
.tab-toc-label {
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.78rem;
}
.tab-toc a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 2px;
}
.tab-toc a:hover { text-decoration-thickness: 2px; }
