/* ========== EMBEDDABLE WIDGET STYLES ========== */
/* Self-contained stylesheet for /embed.html. Duplicates select rules
   from main.css so the embed page has zero dependency on the main sheet. */

/* ---------- Dark theme (default) ---------- */
:root {
    --bg-primary: #1A1819;
    --bg-secondary: #222021;
    --bg-card: #2a2728;
    --bg-accent: #3a3738;
    --text-primary: #F6F3EA;
    --text-secondary: #d9d6cd;
    --text-tertiary: #a09d94;
    --text-caption: #7a776e;
    --text-muted: #5a574e;
    --accent: #4460D8;
    --border: #3a3738;
    --border-strong: #4a4748;
    --rule-light: #3a3738;
    --danger: #D9EF56;
    --danger-bg: #2a2b1a;
    --warning: #D9EF56;
    --success: #568B55;
}

/* ---------- Light theme (via ?theme=light) ---------- */
html.light {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --bg-accent: #f0f0f0;
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-tertiary: #555555;
    --text-caption: #888888;
    --text-muted: #999999;
    --accent: #2563eb;
    --border: #e5e5e5;
    --border-strong: #cccccc;
    --rule-light: #e5e5e5;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --warning: #d97706;
    --success: #16a34a;
}

/* ---------- Base ---------- */
* {
    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: 16px;
    padding: 12px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); }

/* ---------- Stat cards ---------- */
.stat-card {
    background: var(--bg-secondary);
    padding: 1.25rem;
    position: relative;
    border-radius: 4px;
}

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

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

.stat-value {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 2rem;
    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-number {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
}

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

.stat-context {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-top: 0.4rem;
    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.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.4rem;
    color: var(--danger);
}

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

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

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

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

/* ---------- Case cards ---------- */
.case-card {
    background: var(--bg-primary);
    padding: 1.25rem 0;
    position: relative;
}

.case-card.fatal {
    background: var(--danger-bg);
    padding: 1.25rem;
    border-left: 3px solid var(--danger);
    border-radius: 4px;
}

.case-card.child {
    background: var(--bg-secondary);
    padding: 1.25rem;
    border-left: 3px solid var(--warning);
    border-radius: 4px;
}

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

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

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

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

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

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

.case-meta span {
    display: inline;
}

.case-meta span::after {
    content: ' \00b7  ';
}

.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: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

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

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

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

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

/* ---------- Investigation badges (Sludge, EFF, GSA, 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;
}

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

/* ---------- Human quotes (inside case cards) ---------- */
.human-quote {
    border-top: 1px solid var(--rule-light);
    border-bottom: 1px solid var(--rule-light);
    padding: 1rem 0;
    margin: 1rem 0;
}

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

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

/* ---------- Attribution bar ---------- */
.embed-attribution {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.6rem;
    color: var(--text-caption);
    text-align: right;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    margin-top: 10px;
}

.embed-attribution a {
    color: var(--accent);
    text-decoration: none;
}

.embed-attribution a:hover {
    text-decoration: underline;
}

/* ---------- Loading / error states ---------- */
.embed-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-tertiary);
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.85rem;
}

.embed-error {
    text-align: center;
    padding: 2rem;
    color: var(--danger);
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.85rem;
}

/* ========== COLLECTION EMBEDS (Phase 1) ========== */

.embed-collection {
    display: flex;
    gap: 12px;
}

.embed-layout-column {
    flex-direction: column;
}

.embed-layout-row {
    flex-direction: row;
    flex-wrap: wrap;
}

.embed-layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.embed-layout-row .embed-collection-item {
    flex: 1 1 200px;
    min-width: 200px;
}

.embed-collection-item {
    min-width: 0;
}

.embed-error-inline {
    padding: 0.75rem;
    color: var(--danger);
    font-size: 0.8rem;
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 4px;
}

@media (max-width: 599px) {
    .embed-layout-row {
        flex-direction: column;
    }
    .embed-layout-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== SECTION EMBEDS (Phase 2) ========== */

.embed-section-title {
    font-family: 'Century Gothic', 'AppleGothic', 'Outfit', sans-serif;
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.25rem;
}

.embed-section-intro {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.embed-count-note {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

/* ========== COLLECTION / PICK MODE (Phase 1) ========== */

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

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

/* ========== SECTION EMBED BUTTONS (Phase 2) ========== */

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

/* ========== VISUALIZATION EMBEDS ========== */

/* ---------- Shared: filter buttons ---------- */
.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);
}

.filtered-out { opacity: 0.08 !important; }

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

/* ---------- 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,
.detention-css-pulse.filtered-out,
.mega-bed-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; }

/* ---------- Detention Centers Map ---------- */
#detention-map-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.detention-stats-bar { display: flex; gap: 1.5rem; flex-wrap: wrap; font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1rem; }
.detention-stats-bar strong { color: var(--text-primary); }

.detention-filter-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.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 (EMBED) ========== */
.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); }
.geo-selected { fill: var(--accent) !important; fill-opacity: 0.18 !important; stroke: var(--accent) !important; stroke-width: 1.5 !important; }

#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; cursor: pointer; transition: opacity 0.3s; }
.detention-dot-existing:hover { opacity: 1; }
.detention-dot-new { fill: #dc2626; cursor: pointer; opacity: 0.85; transition: all 0.3s; }
.detention-dot-new:hover { opacity: 1; filter: brightness(1.2); }
.detention-dot-military { fill: #2563eb; cursor: pointer; opacity: 0.85; transition: all 0.3s; }
.detention-dot-military:hover { opacity: 1; filter: brightness(1.2); }
.detention-dot-denied { fill: #6b7280; cursor: pointer; opacity: 0.5; stroke: #6b7280; stroke-width: 1; transition: all 0.3s; }
.detention-dot-denied:hover { opacity: 0.8; }
/* Post-April-2026 facility types — keep in sync with main.css */
.detention-dot-hold-room { fill: transparent; stroke: #ea580c; stroke-width: 1.5; cursor: pointer; opacity: 0.9; transition: all 0.3s; }
.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); }
.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); }
.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); }
.detention-dot-offshore { stroke-dasharray: 3,2; }
.detention-dot-offshore:hover { stroke-dasharray: 2,1.5; }
.detention-pulse { fill: none; stroke: #dc2626; stroke-width: 2; opacity: 0; pointer-events: none; }

/* Keep strokes crisp across zoom levels in embeds. */
.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;
}

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

.detention-legend { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 1rem; font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif; font-size: 0.75rem; color: var(--text-secondary); }
.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; }

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

/* ---------- Filter embed ---------- */
.embed-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
    flex-wrap: wrap;
}

.embed-filter-label {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.embed-filter-count {
    font-family: 'Outfit', 'Century Gothic', 'AppleGothic', sans-serif;
    font-size: 0.7rem;
    color: var(--text-caption);
    white-space: nowrap;
}

.embed-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-caption);
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    font-style: italic;
    font-size: 0.9rem;
}

.embed-inline-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
}

.embed-inline-table th {
    text-align: left;
    font-weight: 600;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.embed-inline-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.embed-inline-table tr:last-child td {
    border-bottom: none;
}

/* ---------- Preview exclude button ---------- */
.embed-exclude-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--bg-accent, #1a1a2e);
    border: 1px solid var(--border, #333);
    color: var(--text-caption, #888);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 5;
    padding: 0;
}
.case-card:hover .embed-exclude-btn,
div:hover > .embed-exclude-btn { opacity: 1; }
.embed-exclude-btn:hover {
    background: var(--danger, #dc2626);
    color: var(--bg-primary, #0a0a1a);
    border-color: var(--danger, #dc2626);
}

/* ---------- Viz responsive ---------- */
@media (min-width: 600px) {
    .filter-btn { font-size: 0.75rem; padding: 0.5rem 1rem; }
    #network-viz { height: 550px; }
    .node-label { font-size: 11px; }
    .timeline-controls { flex-direction: row; justify-content: space-between; align-items: center; }
}

@media (min-width: 900px) {
    #network-viz { height: 600px; }
    .node-label { font-size: 12px; }
}

@media (max-width: 599px) {
    #raids-map-viz { min-height: 250px; }
    .raid-tooltip { max-width: 200px; font-size: 0.7rem; }
    #detention-map-viz { min-height: 250px; }
    .detention-tooltip { max-width: 200px; font-size: 0.7rem; }
    .detention-stats-bar { flex-direction: column; gap: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .timeline-detail-panel { animation: none; }
}
