/*
 * threats-v0.css — design-vote variant V0 of the /threats board (openspec/changes/
 * threat-board task 4.0b, frontend-design skill bake-off).
 *
 * Scope: every rule lives under .tv0-page so this file can never leak onto any other
 * page (the neutral board, v1, v2) — it is published next to threats-v1.css/
 * threats-v2.css and all three load only on their own /threats/design/v{n}/ route.
 *
 * Tokens: only --bg-primary/--bg-secondary/--bg-card/--border-color/--border-hover/
 * --text-primary/--text-secondary/--accent/--accent-hover/--warning/--error/--info
 * from style.css:3-40 (docs/DESIGN.md) are referenced here — no new hex color is
 * introduced anywhere in this file. Chart + chip colors are drawn from exactly five
 * of those tokens (accent, accent-hover, info, warning, error), the "max 6 hues"
 * budget this task sets, with text-secondary reserved for muted copy only (not used
 * as a data-ink color), shapes/radii/elevation follow docs/DESIGN.md's rule (flat
 * panels, 1px hairline, no box-shadow, the four named radius steps) — no
 * backdrop-filter, no drop-shadowed card.
 *
 * Idea: a mission-control console reading the same sensors the rest of the site
 * already renders as plain tables. HUD corner brackets on panels, a one-shot
 * staggered reveal on load, a scanning hairline across the hero, a live pulse next
 * to "time since last attack" — all CSS-only, all `transform`/`opacity`, all
 * dropped under prefers-reduced-motion.
 */

.tv0-page {
  --tv0-glow: rgba(63, 185, 80, 0.35);
}

.tv0-page .cpage-hero { margin-bottom: 20px; }

/* ---- banner from the dispatcher (shared across v0/v1/v2) gets a quieter look here ---- */
.threats-variant-banner {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: inline-block;
  margin-bottom: 18px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* ---- staggered reveal: one orchestrated load, not scattered micro-motion ---- */
.tv0-reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: tv0In 0.5s ease-out forwards;
}
.tv0-reveal:nth-of-type(1) { animation-delay: 0.02s; }
.tv0-reveal:nth-of-type(2) { animation-delay: 0.08s; }
.tv0-reveal:nth-of-type(3) { animation-delay: 0.14s; }
.tv0-reveal:nth-of-type(4) { animation-delay: 0.20s; }
.tv0-reveal:nth-of-type(5) { animation-delay: 0.26s; }
.tv0-reveal:nth-of-type(6) { animation-delay: 0.32s; }
.tv0-reveal:nth-of-type(7) { animation-delay: 0.38s; }
.tv0-reveal:nth-of-type(8) { animation-delay: 0.44s; }
.tv0-reveal:nth-of-type(9) { animation-delay: 0.50s; }
@keyframes tv0In { to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .tv0-reveal { opacity: 1; transform: none; animation: none; }
}

/* ---- HUD panel: flat surface, hairline border, four corner brackets ---- */
.tv0-panel {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin: 0 0 20px;
}
.tv0-panel::before, .tv0-panel::after,
.tv0-panel > .tv0-br::before, .tv0-panel > .tv0-br::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid var(--accent-border, rgba(63, 185, 80, 0.4));
  opacity: 0.8;
  pointer-events: none;
}
.tv0-panel::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.tv0-panel::after { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.tv0-panel > .tv0-br::before { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.tv0-panel > .tv0-br::after { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.tv0-panel h2 {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tv0-panel h2 svg { width: 14px; height: 14px; flex: none; color: var(--accent); }

/* ---- hero stat strip: mission-clock readout ---- */
.tv0-hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 14px;
}
.tv0-stat {
  background: var(--bg-secondary);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.tv0-stat::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--tv0-glow), transparent 45%);
  opacity: 0.06;
  pointer-events: none;
}
.tv0-stat-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.tv0-stat-nums {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}
.tv0-stat-num { font-size: 20px; color: var(--text-primary); font-weight: 600; line-height: 1; }
.tv0-stat-num small { font-size: 10.5px; color: var(--text-secondary); font-weight: 400; letter-spacing: 0.02em; display: block; margin-top: 3px; text-transform: none; }

.tv0-tsla {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--bg-primary);
}
.tv0-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
  box-shadow: 0 0 0 0 var(--tv0-glow);
  animation: tv0Pulse 2s ease-out infinite;
}
@keyframes tv0Pulse {
  0% { box-shadow: 0 0 0 0 var(--tv0-glow); }
  70% { box-shadow: 0 0 0 7px rgba(63, 185, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}
@media (prefers-reduced-motion: reduce) { .tv0-pulse { animation: none; } }
.tv0-tsla strong { color: var(--text-primary); font-size: 14px; }

/* ---- scanning hairline under the hero ---- */
.tv0-scan {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 18px 0 22px;
  position: relative;
  overflow: hidden;
  opacity: 0.6;
}
.tv0-scan::after {
  content: '';
  position: absolute;
  top: 0; left: -30%;
  width: 30%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: tv0Scan 3.4s linear infinite;
}
@keyframes tv0Scan { from { left: -30%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .tv0-scan::after { animation: none; display: none; } }

/* ---- lookup ---- */
.tv0-lookup-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tv0-lookup-row input {
  flex: 1 1 260px;
  min-width: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 11px 13px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13.5px;
}
.tv0-lookup-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.tv0-lookup-row button {
  flex: 0 0 auto;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius);
  padding: 11px 20px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  font-family: var(--font-ui);
}
.tv0-lookup-row button:hover { background: var(--accent-hover); }
.tv0-lookup-row button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tv0-lookup-hint {
  margin: 7px 0 0;
  font-size: 11.5px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}
.tv0-lookup-result {
  margin: 10px 0 0;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 1.4em;
}
.tv0-lookup-result a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 2px; }
.tv0-lookup-result a:hover { text-decoration-color: var(--accent); }

/* ---- layout grids ---- */
.tv0-grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tv0-grid-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tv0-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tv0-chart-wrap { position: relative; height: 220px; min-width: 0; }
.tv0-chart-wrap canvas { max-width: 100%; }
.tv0-top5 li { min-width: 0; }
.tv0-top5 a { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---- top5 sidebar ---- */
.tv0-top5 { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tv0-top5 li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--bg-primary);
}
.tv0-top5 a { color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--border-hover); text-underline-offset: 2px; font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12.5px; }
.tv0-top5 a:hover { color: var(--accent); }
.tv0-top5-rank { color: var(--text-secondary); font-size: 11px; width: 1.4em; flex: none; }
.tv0-top5-score { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12px; color: var(--warning); font-weight: 600; margin-left: auto; }

/* ---- tables ---- */
.tv0-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tv0-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tv0-table th, .tv0-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.tv0-table th { color: var(--text-secondary); font-weight: 600; font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase; }
.tv0-table td { color: var(--text-primary); }
.tv0-table a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 2px; font-family: 'JetBrains Mono', 'Courier New', monospace; }
.tv0-table a:hover { text-decoration-color: var(--accent); }
.tv0-table .tv0-mono { font-family: 'JetBrains Mono', 'Courier New', monospace; color: var(--text-secondary); }
.tv0-table tbody tr:hover { background: var(--bg-card); }

/* ---- live feed rows ---- */
.tv0-wire-row { display: grid; grid-template-columns: 1fr; gap: 2px; }

/* ---- chips (reused threats_badges_strip() markup from render.php) ---- */
.tv0-page .threats-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.tv0-page .threats-chip {
  font-size: 10.5px;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
  padding: 2px 7px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  white-space: nowrap;
}
.tv0-page .threats-chip-tier.threats-tier-blocked { color: var(--error); border-color: var(--error); }
.tv0-page .threats-chip-tier.threats-tier-listed { color: var(--warning); border-color: var(--warning); }
.tv0-page .threats-chip-tier.threats-tier-recorded { color: var(--info); border-color: var(--info); }
.tv0-page .threats-chip-level { color: var(--text-primary); border-color: var(--border-hover); }
.tv0-page .threats-chip-badge { color: var(--accent); border-color: var(--accent-border, rgba(63, 185, 80, 0.4)); }

/* ---- surface tags on most-wanted rows ---- */
.tv0-sensors { display: flex; gap: 4px; flex-wrap: wrap; }
.tv0-sensor-tag {
  font-size: 10px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}

/* ---- empty states (honest, no invented data) ---- */
.tv0-empty {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 14px 0;
  font-style: normal;
}

/* ---- reused .threats-* fragment classes from lib/pages/threats.php ---- */
.tv0-page .threats-digests,
.tv0-page .threats-feeds-box { padding: 0; }
.tv0-page .threats-plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.tv0-page .threats-plain-list a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 2px; }
.tv0-page .threats-plain-list a:hover { text-decoration-color: var(--accent); }
.tv0-page .threats-muted { color: var(--text-secondary); font-size: 13px; }

/* ---- footer link row ---- */
.tv0-foot-link { margin-top: 24px; }
.tv0-foot-link a { color: var(--accent); }

/* ================= mobile ================= */
@media (max-width: 760px) {
  .tv0-hero-grid { grid-template-columns: 1fr; }
  .tv0-grid-2, .tv0-grid-charts, .tv0-grid-3 { grid-template-columns: 1fr; }
  .tv0-chart-wrap { height: 200px; }
}
@media (max-width: 420px) {
  .tv0-panel { padding: 14px 14px; }
  .tv0-stat { padding: 13px 14px; }
  .tv0-stat-num { font-size: 17px; }
  .tv0-lookup-row input, .tv0-lookup-row button { font-size: 13px; }
  .tv0-table { font-size: 11.5px; }
}
