/* Command Center threat visuals: live ransomware globe + India threat band (assets/js/threat-viz.js).
   Colours come from the site tokens in theme.css, so both themes work; red is local to these widgets. */
html { --tv-red: 255 77 109; }
html.light { --tv-red: 190 18 60; }

/* The globe and India panels stay dark in the light theme too: dark showcase cards on a light page.
   A deep teal (not pure black) so they sit comfortably on the light background. */
html.light .tv-dark {
    --c-bg: 6 20 25;
    --c-surface: 10 31 38;
    --c-surface-2: 13 40 48;
    --c-ink: 230 243 244;
    --c-primary: 94 234 212;
    --c-accent: 45 212 191;
    --c-accent-2: 167 139 250;
    --c-accent-3: 52 211 153;
    --c-gold: 240 200 80;
    --c-muted: 155 184 189;
    --c-deep: 8 30 37;
    --c-shade: 0 0 0;
    --c-on-accent: 6 20 25;
    --tv-red: 255 92 122;
    color-scheme: dark;
}
html.light .tv-stage.tv-dark,
html.light .tv-band.tv-dark { box-shadow: 0 18px 40px rgb(15 23 42 / 0.18); border-color: rgb(15 23 42 / 0.2); }
html.light .tv-kpis.tv-dark .tv-kpi { box-shadow: 0 8px 20px rgb(15 23 42 / 0.12); }

/* ── Globe: observatory-style card (deep teal, mono HUD, labelled nodes) ── */
.tv-globe {
    aspect-ratio: 1 / 1.02;
    background:
        radial-gradient(60% 55% at 50% 46%, rgb(20 78 88 / 0.85), transparent 72%),
        radial-gradient(120% 100% at 50% 0%, rgb(9 36 43), rgb(5 16 20));
    border-color: rgb(94 234 212 / 0.18);
}
.tv-globe .tv-hud { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 10px; letter-spacing: 0.06em; color: rgb(153 222 216 / 0.9); }
.tv-globe .tv-hud .dim { color: rgb(148 163 184 / 0.7); }
.tv-globe .tv-corner { border-color: rgb(94 234 212 / 0.45); }
.tv-labels { position: absolute; inset: 0; pointer-events: none; }
.tv-label {
    position: absolute; left: 0; top: 0; pointer-events: auto; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
    font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
    color: rgb(226 240 255); text-decoration: none;
    background: rgb(6 24 30 / 0.82); border: 1px solid rgb(45 212 191 / 0.45); border-radius: 4px; padding: 3px 7px;
    box-shadow: 0 0 12px rgb(45 212 191 / 0.12); transition: opacity 0.25s, border-color 0.15s, color 0.15s;
}
.tv-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: rgb(45 212 191); box-shadow: 0 0 6px rgb(45 212 191); }
.tv-label b { color: rgb(253 164 175); font-weight: 600; }
.tv-label.live { border-color: rgb(240 200 80 / 0.7); color: rgb(253 224 140); }
.tv-label.live::before { background: rgb(240 200 80); box-shadow: 0 0 6px rgb(240 200 80); }
.tv-label:hover, .tv-label:focus-visible { border-color: rgb(45 212 191); color: rgb(255 255 255); z-index: 3; outline: none; box-shadow: 0 0 0 2px rgb(45 212 191 / 0.35); }
.tv-label[data-back="1"] { opacity: 0; pointer-events: none; }
.tv-label[data-back="1"]:focus-visible { opacity: 1; }
/* Expand / collapse */
.tv-expand {
    position: absolute; top: 12px; right: 12px; z-index: 4; width: 38px; height: 38px; display: grid; place-items: center;
    border-radius: 10px; cursor: pointer; color: rgb(45 212 191);
    background: rgb(7 27 33 / 0.85); border: 1px solid rgb(45 212 191 / 0.6); transition: box-shadow 0.15s, border-color 0.15s;
}
.tv-expand:hover, .tv-expand:focus-visible { border-color: rgb(45 212 191); box-shadow: 0 0 0 3px rgb(45 212 191 / 0.25); outline: none; }
.tv-expand .material-symbols-outlined { font-size: 20px; }
.tv-globe .tv-hud.tr { right: 62px; }
.tv-backdrop { position: fixed; inset: 0; z-index: 999; background: rgb(2 10 12 / 0.78); backdrop-filter: blur(4px); }
.tv-globe.tv-expanded {
    position: fixed; z-index: 1000; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: min(94vw, 92vh); max-width: none; aspect-ratio: 1 / 1; border-radius: 16px;
    box-shadow: 0 30px 80px rgb(0 0 0 / 0.55);
}
.tv-globe.tv-expanded .tv-label { font-size: 12px; }
body.tv-lock { overflow: hidden; }

.tv-callout {
    position: absolute; top: 60px; right: 16px; display: flex; align-items: flex-start; gap: 8px; pointer-events: none;
    max-width: 230px; padding: 9px 13px; border-radius: 14px;
    background: rgb(7 27 33 / 0.88); border: 1px solid rgb(45 212 191 / 0.55); box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
    font-size: 11.5px; line-height: 1.4; color: rgb(190 216 218); transition: opacity 0.4s;
}
.tv-callout .material-symbols-outlined { font-size: 20px; color: rgb(45 212 191); }
.tv-callout b { display: block; color: rgb(255 255 255); font-size: 13px; }
.tv-callout.gone { opacity: 0; }
.tv-legend-row {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 18px; margin-top: 14px;
    font-size: 13px; color: rgb(var(--c-muted));
}
.tv-legend-row b { color: rgb(var(--c-ink)); font-variant-numeric: tabular-nums; }
.tv-key { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.tv-key.victims { background: rgb(var(--tv-red)); box-shadow: 0 0 0 2px rgb(45 212 191 / 0.55); }
.tv-key.india { background: rgb(var(--c-gold)); }
.tv-help { text-align: center; font-size: 12.5px; color: rgb(var(--c-muted)); margin: 6px 0 0; }
.tv-globe ~ .tv-actions { justify-content: center; }

/* Buttons under the globe: a light one for the worldwide view, a teal one (matching the globe) for India */
.tv-btn.light { background: rgb(240 253 250); color: rgb(6 30 34); border: 1px solid rgb(153 246 228); }
.tv-btn.light:hover { background: rgb(255 255 255); box-shadow: 0 6px 16px rgb(15 23 42 / 0.12); }
.tv-btn.navy {
    background: linear-gradient(180deg, rgb(16 58 66), rgb(7 27 33)); color: rgb(226 240 255);
    border: 1px solid rgb(45 212 191 / 0.45);
}
.tv-btn.navy:hover { border-color: rgb(45 212 191); box-shadow: 0 6px 16px rgb(7 27 33 / 0.35); }

/* India Threat Picture: the same deep teal as the globe, lighter than the near-black panel */
.tv-band.tv-dark {
    --tv-land: 28 74 80;
    background:
        radial-gradient(55% 85% at 28% 48%, rgb(20 78 88 / 0.85), transparent 72%),
        radial-gradient(120% 120% at 50% 0%, rgb(9 36 43), rgb(5 16 20));
    border-color: rgb(94 234 212 / 0.18);
}
.tv-band.tv-dark .tv-map { border-right-color: rgb(94 234 212 / 0.14); }
.tv-band.tv-dark .tv-map .st { stroke: rgb(6 24 29); }
.tv-kpis.tv-dark .tv-kpi {
    background: linear-gradient(180deg, rgb(12 44 52), rgb(7 27 33));
    border-color: rgb(94 234 212 / 0.18);
}
@media (max-width: 767px) {
    .tv-callout { display: none; }
    .tv-label { font-size: 10px; padding: 2px 5px; }
}

.tv-stage {
    position: relative;
    border: 1px solid rgb(var(--c-primary) / 0.18);
    border-radius: 14px;
    overflow: hidden;
    background:
        radial-gradient(120% 90% at 50% 40%, rgb(var(--c-deep) / 0.9), transparent 70%),
        rgb(var(--c-surface));
}
.tv-globe { aspect-ratio: 1 / 0.92; width: 100%; }
.tv-globe canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.tv-globe canvas:active { cursor: grabbing; }
.tv-hud {
    position: absolute; pointer-events: none; font-family: 'Space Grotesk', sans-serif;
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.6;
    color: rgb(var(--c-muted) / 0.85);
}
.tv-hud b { color: rgb(var(--c-primary)); font-weight: 600; }
.tv-hud.tl { top: 14px; left: 16px; }
.tv-hud.tr { top: 14px; right: 16px; text-align: right; }
.tv-hud.bl { bottom: 12px; left: 16px; }
.tv-hud.br { bottom: 12px; right: 16px; text-align: right; }
.tv-hud .sw { display: inline-block; width: 14px; height: 2px; vertical-align: 3px; margin: 0 4px 0 10px; }
.tv-corner { position: absolute; width: 14px; height: 14px; border-color: rgb(var(--c-primary) / 0.5); pointer-events: none; }
.tv-corner.a { top: 8px; left: 8px; border-top: 1px solid; border-left: 1px solid; }
.tv-corner.b { top: 8px; right: 8px; border-top: 1px solid; border-right: 1px solid; }
.tv-corner.c { bottom: 8px; left: 8px; border-bottom: 1px solid; border-left: 1px solid; }
.tv-corner.d { bottom: 8px; right: 8px; border-bottom: 1px solid; border-right: 1px solid; }
.tv-hint {
    position: absolute; left: 50%; bottom: 38px; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
    font-size: 12px; color: rgb(var(--c-muted)); border: 1px solid rgb(var(--c-primary) / 0.15);
    background: rgb(var(--c-surface) / 0.85); border-radius: 999px; padding: 4px 12px;
}
.tv-status {
    position: absolute; inset: auto 16px 64px; text-align: center; font-size: 13px; color: rgb(var(--c-muted));
    pointer-events: none;
}

.tv-tip {
    position: absolute; z-index: 5; min-width: 200px; max-width: 250px; cursor: pointer;
    background: rgb(var(--c-surface) / 0.94); border: 1px solid rgb(var(--c-primary) / 0.4);
    border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.45; color: rgb(var(--c-ink));
    box-shadow: 0 10px 30px rgb(var(--c-shade) / 0.35); backdrop-filter: blur(6px); transition: border-color 0.15s;
}
.tv-tip:hover { border-color: rgb(var(--c-primary)); }
.tv-tip .t-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15px; }
.tv-tip .t-row { color: rgb(var(--c-muted)); }
.tv-tip .t-row b { color: rgb(var(--c-ink)); font-variant-numeric: tabular-nums; }
.tv-tip a { display: inline-block; margin-top: 6px; font-weight: 700; color: rgb(var(--c-primary)); text-decoration: none; }
/* The whole card is the link target, not only its last line */
.tv-tip a::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }

.tv-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.tv-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
    text-decoration: none; transition: filter 0.15s, background 0.15s;
}
.tv-btn.solid { background: rgb(var(--c-primary)); color: rgb(var(--c-on-accent)); }
.tv-btn.solid:hover { filter: brightness(1.1); }
.tv-btn.ghost { border: 1px solid rgb(var(--c-primary) / 0.5); color: rgb(var(--c-primary)); }
.tv-btn.ghost:hover { background: rgb(var(--c-primary) / 0.08); }
.tv-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tv-chips a {
    font-size: 12px; color: rgb(var(--c-muted)); text-decoration: none; border: 1px solid rgb(var(--c-primary) / 0.15);
    border-radius: 999px; padding: 3px 10px; font-variant-numeric: tabular-nums;
}
.tv-chips a:hover { color: rgb(var(--c-primary)); border-color: rgb(var(--c-primary) / 0.5); }
.tv-chips b { color: rgb(var(--c-ink)); font-weight: 700; margin-left: 4px; }
.tv-btn:focus-visible, .tv-chips a:focus-visible, .tv-tip a:focus-visible { outline: 2px solid rgb(var(--c-primary)); outline-offset: 3px; }

/* ── India band ── */
.tv-band {
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    border: 1px solid rgb(var(--c-primary) / 0.18); border-radius: 14px; overflow: hidden; background: rgb(var(--c-surface));
}
.tv-map { position: relative; min-height: 440px; border-right: 1px solid rgb(var(--c-primary) / 0.12); overflow: hidden; }
.tv-map svg { display: block; width: 100%; height: 100%; }
.tv-map .st { stroke: rgb(var(--c-bg)); stroke-width: 0.6; transition: fill-opacity 0.2s; }
.tv-map a:hover .st, .tv-map a:focus .st { fill-opacity: 1 !important; stroke: rgb(var(--c-ink)); stroke-width: 1; }
.tv-map a:focus { outline: none; }
.tv-map .st.flash { animation: tv-flash 1.6s ease-out; }
@keyframes tv-flash { 0% { fill: rgb(var(--tv-red)); fill-opacity: 0.95; } 100% { fill: rgb(var(--c-primary)); } }
.tv-hot { fill: rgb(var(--c-primary)); }
.tv-hot-glow { fill: rgb(var(--c-primary)); opacity: 0.16; }
.tv-hot-ring { fill: none; stroke: rgb(var(--c-primary)); transform-box: fill-box; transform-origin: center; animation: tv-ring 2.4s ease-out infinite; }
@keyframes tv-ring { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(3.2); opacity: 0; } }
.tv-ping { fill: none; stroke: rgb(var(--tv-red)); stroke-width: 1.6; transform-box: fill-box; transform-origin: center; animation: tv-ping 1.8s ease-out forwards; }
.tv-ping.b { animation-delay: 0.35s; opacity: 0; }
.tv-ping-dot { fill: rgb(var(--tv-red)); animation: tv-pingdot 2.4s ease-out forwards; }
@keyframes tv-ping { from { transform: scale(0.4); opacity: 1; } to { transform: scale(6); opacity: 0; } }
@keyframes tv-pingdot { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
.tv-scan {
    position: absolute; left: 0; right: 0; top: 0; height: 90px; pointer-events: none; opacity: 0.5;
    background: linear-gradient(180deg, transparent, rgb(var(--c-primary) / 0.08) 70%, rgb(var(--c-primary) / 0.3) 99%, transparent);
    animation: tv-scan 7s linear infinite;
}
@keyframes tv-scan { from { transform: translateY(-90px); } to { transform: translateY(540px); } }
.tv-live {
    position: absolute; top: 12px; right: 14px; display: inline-flex; align-items: center; gap: 6px; pointer-events: none;
    font-family: 'Space Grotesk', sans-serif; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: rgb(var(--tv-red));
    border: 1px solid rgb(var(--tv-red) / 0.45); border-radius: 999px; padding: 3px 9px;
}
.tv-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: rgb(var(--tv-red)); animation: tv-blink 1.2s ease-in-out infinite; }
@keyframes tv-blink { 50% { opacity: 0.2; } }
.tv-legend {
    position: absolute; left: 16px; right: 16px; bottom: 14px; display: flex; align-items: center; gap: 10px; pointer-events: none;
    font-family: 'Space Grotesk', sans-serif; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: rgb(var(--c-muted));
}
.tv-legend .ramp { flex: 1; height: 6px; border-radius: 999px; background: linear-gradient(90deg, rgb(var(--c-primary) / 0.12), rgb(var(--c-primary))); }
.tv-toasts { position: absolute; inset: 0; pointer-events: none; }
.tv-toast {
    position: absolute; transform: translate(-50%, -130%); white-space: nowrap; font-size: 11px; color: rgb(var(--c-ink));
    background: rgb(var(--c-surface) / 0.9); border: 1px solid rgb(var(--tv-red) / 0.55); border-radius: 6px; padding: 3px 8px;
    animation: tv-toast 2.8s ease-out forwards;
}
@keyframes tv-toast { 0% { opacity: 0; margin-top: 8px; } 12%, 75% { opacity: 1; margin-top: 0; } 100% { opacity: 0; margin-top: -6px; } }

.tv-side { padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tv-kicker { display: inline-flex; align-items: center; gap: 8px; font-family: 'Space Grotesk', sans-serif; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: rgb(var(--c-accent-3)); }
.tv-kicker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--c-accent-3)); box-shadow: 0 0 10px rgb(var(--c-accent-3)); }
.tv-side h3 { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; color: rgb(var(--c-ink)); margin: 0; }
.tv-label { font-family: 'Space Grotesk', sans-serif; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: rgb(var(--c-muted)); margin-bottom: 6px; }
.tv-feed, .tv-trend { list-style: none; margin: 0; padding: 0; }
.tv-feed li {
    display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center;
    padding: 7px 0; border-bottom: 1px solid rgb(var(--c-primary) / 0.1); font-size: 13px; color: rgb(var(--c-ink));
}
.tv-feed li.on { background: linear-gradient(90deg, rgb(var(--tv-red) / 0.12), transparent); }
.tv-feed .sev { width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--c-primary)); }
.tv-feed .sev.crit { background: rgb(var(--tv-red)); box-shadow: 0 0 8px rgb(var(--tv-red)); }
.tv-feed .sev.high { background: rgb(var(--c-gold)); }
.tv-feed .what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-feed .what span { color: rgb(var(--c-muted)); }
.tv-feed .when { font-size: 11px; color: rgb(var(--c-muted)); font-variant-numeric: tabular-nums; }
.tv-trend li {
    display: grid; grid-template-columns: minmax(0, 1fr) 84px 32px 58px; gap: 10px; align-items: center;
    padding: 6px 0; border-bottom: 1px solid rgb(var(--c-primary) / 0.1); font-size: 13px; color: rgb(var(--c-ink));
}
.tv-trend svg { width: 84px; height: 24px; display: block; overflow: visible; }
.tv-trend .cnt, .tv-trend .chg { text-align: right; font-variant-numeric: tabular-nums; }
.tv-trend .chg { font-size: 11px; }
.tv-up { color: rgb(var(--tv-red)); }
.tv-down { color: rgb(var(--c-accent-3)); }
.tv-flat { color: rgb(var(--c-muted)); }
.tv-readout { font-size: 14px; color: rgb(var(--c-muted)); min-height: 2.6em; margin: 0; }
.tv-readout b { color: rgb(var(--c-ink)); }
.tv-empty { font-size: 13px; color: rgb(var(--c-muted)); padding: 8px 0; }

.tv-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.tv-kpi { border: 1px solid rgb(var(--c-primary) / 0.15); border-radius: 10px; padding: 14px; background: rgb(var(--c-surface)); }
.tv-kpi .v { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 28px; line-height: 1.1; color: rgb(var(--c-ink)); font-variant-numeric: tabular-nums; }
.tv-kpi.alert .v { color: rgb(var(--tv-red)); }
.tv-kpi .k { font-size: 12px; color: rgb(var(--c-muted)); }
.tv-kpi .d { font-size: 11px; margin-top: 4px; }

@media (max-width: 1023px) {
    .tv-band { grid-template-columns: 1fr; }
    .tv-map { border-right: 0; border-bottom: 1px solid rgb(var(--c-primary) / 0.12); min-height: 380px; }
}
@media (max-width: 767px) {
    .tv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tv-hud.tr, .tv-hud.br { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .tv-hot-ring, .tv-live::before { animation: none; }
    .tv-scan { display: none; }
}

/* Day/night: switch between the live sun and a 24 h time-lapse (button added by threat-viz.js) */
.tv-lapse {
    position: absolute; top: 56px; left: 16px; z-index: 4; display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    padding: 5px 11px; border-radius: 999px; border: 1px solid rgb(45 212 191 / 0.6); background: rgb(7 27 33 / 0.85);
    font-family: 'Space Grotesk', sans-serif; font-size: 11.5px; font-weight: 600; color: rgb(226 240 255);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tv-lapse:hover, .tv-lapse:focus-visible { border-color: rgb(45 212 191); box-shadow: 0 0 0 3px rgb(45 212 191 / 0.25); outline: none; }
.tv-lapse .dot { width: 0; height: 0; border-style: solid; border-width: 4px 0 4px 7px; border-color: transparent transparent transparent rgb(45 212 191); }
.tv-lapse .dot.live { width: 7px; height: 7px; border: 0; border-radius: 50%; background: rgb(var(--tv-red)); animation: tv-blink 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .tv-lapse { display: none; } }
