/* ========== 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);
}

/* ========== 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;
}

.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;
}

/* ========== 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;
}

.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;
    }
}

/* ========== 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;
}

#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-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; }
#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-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-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;
}


/* ========== 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);
}

.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;
}

/* ========== 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) */
.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);
}

/* -- 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;
}

/* -- 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;
    }
}
