/*
 * threats-v1.css — design variant v1 of the threat board (openspec/changes/threat-board
 * task 4.0b). Built with the `impeccable` skill only (craft, then audit) against
 * docs/DESIGN.md's existing terminal-operator-console language — no new colors, no new
 * shadows, no gradients: the owner's brief was "futuristic, with graphs" INSIDE that
 * language, not a new one.
 *
 * Every custom property below is a reference to the tokens already defined in
 * public_html/style.css's :root (not redeclared with different values — this file reads
 * them, never redefines bg-primary/accent/etc). Scoped under a `tv1-` prefix so nothing
 * here collides with the neutral board's `.threats-*` classes or the sibling v0/v2
 * variants. A 4pt spacing scale (layout.md guidance) is declared locally since the site
 * has no shared spacing tokens yet.
 */

.tv1-board {
  --tv1-space-1: 4px;
  --tv1-space-2: 8px;
  --tv1-space-3: 12px;
  --tv1-space-4: 16px;
  --tv1-space-5: 24px;
  --tv1-space-6: 32px;
  display: flex;
  flex-direction: column;
  gap: var(--tv1-space-6);
  font-family: var(--font-ui);
}

.tv1-board h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--tv1-space-3);
  letter-spacing: -0.01em;
}

.tv1-board h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 var(--tv1-space-2);
}

.tv1-muted { color: var(--text-secondary); font-size: 0.8125rem; }

.tv1-empty {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--tv1-space-5);
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: center;
}

/* ---------------------------------------------------------------------------------------
   Status strip — live pulse, time-since-last-attack readout, three compact period counters.
   Deliberately not a "hero metric" tile: the numbers sit in one dense row, same size,
   none of them inflated into a giant display figure.
   --------------------------------------------------------------------------------------- */

.tv1-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tv1-space-5);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--tv1-space-4) var(--tv1-space-5);
}

.tv1-pulse-group {
  display: flex;
  align-items: baseline;
  gap: var(--tv1-space-3);
  flex: 1 1 260px;
}

.tv1-pulse {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
  margin-bottom: 2px;
}

.tv1-pulse::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0.55;
  animation: tv1-pulse-ring 2.2s ease-out infinite;
}

@keyframes tv1-pulse-ring {
  0%   { transform: scale(0.6); opacity: 0.55; }
  100% { transform: scale(2.1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tv1-pulse::after { animation: none; opacity: 0.25; }
}

.tv1-tsla-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tv1-tsla-value {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-left: var(--tv1-space-2);
}

.tv1-counters {
  display: flex;
  gap: var(--tv1-space-5);
  flex-wrap: wrap;
  margin-left: auto;
}

.tv1-counter {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 86px;
}

.tv1-counter-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tv1-counter-value {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.tv1-counter-value small {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 0.75rem;
  margin-left: 2px;
}

/* ---------------------------------------------------------------------------------------
   Lookup — terminal-prompt styling: a leading accent-colored glyph instead of a generic
   bordered input, consistent with the terminal register but distinct from the neutral
   board's plain .cpage-tool-form treatment.
   --------------------------------------------------------------------------------------- */

.tv1-lookup {
  background: var(--bg-console);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--tv1-space-4) var(--tv1-space-5);
}

.tv1-lookup h2 { margin-bottom: var(--tv1-space-2); }

.tv1-lookup-form {
  display: flex;
  align-items: center;
  gap: var(--tv1-space-2);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.9375rem;
}

.tv1-lookup-prompt {
  color: var(--accent);
  flex: none;
  user-select: none;
}

.tv1-lookup-form label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.tv1-lookup-form input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: inherit;
  padding: var(--tv1-space-2) 0;
}

.tv1-lookup-form input:focus-visible {
  outline: none;
  border-bottom-color: var(--accent);
}

.tv1-lookup-form button {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.8125rem;
  padding: var(--tv1-space-2) var(--tv1-space-4);
  min-height: 36px;
  cursor: pointer;
}

.tv1-lookup-form button:hover { background: var(--accent-hover); }

.tv1-lookup-result {
  margin-top: var(--tv1-space-3);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  min-height: 1.2em;
}

.tv1-lookup-result a { color: var(--accent); }

/* ---------------------------------------------------------------------------------------
   Two-column working grid — live wire + hourly chart on the left, top-ASN / top-country
   bars on the right. Collapses to one column well before 390px.
   --------------------------------------------------------------------------------------- */

.tv1-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--tv1-space-5);
  align-items: start;
}

@media (max-width: 720px) {
  .tv1-grid { grid-template-columns: 1fr; }
}

.tv1-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--tv1-space-4);
}

.tv1-card + .tv1-card { margin-top: var(--tv1-space-5); }

.tv1-chart-wrap {
  position: relative;
  height: 220px;
}

.tv1-chart-wrap--bar { height: 190px; }

/* ---------------------------------------------------------------------------------------
   Live wire — a stream, not a table (the neutral board already owns the table treatment);
   new rows get a brief accent flash so the "live" claim is visible, then settle.
   --------------------------------------------------------------------------------------- */

.tv1-wire-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--tv1-space-2);
  max-height: 360px;
  overflow-y: auto;
}

.tv1-wire-row {
  display: grid;
  grid-template-columns: 112px 128px 1fr;
  gap: var(--tv1-space-3);
  align-items: baseline;
  padding: var(--tv1-space-2) var(--tv1-space-2);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  transition: background-color 1.4s ease-out;
}

@media (max-width: 560px) {
  .tv1-wire-row { grid-template-columns: 1fr; gap: 2px; }
}

.tv1-wire-row--new { background-color: var(--accent-dim); transition: none; }

@media (prefers-reduced-motion: reduce) {
  .tv1-wire-row { transition: none; }
}

.tv1-wire-time {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.tv1-wire-ip {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.tv1-wire-ip:hover { color: var(--accent-hover); }

.tv1-wire-sentence { color: var(--text-secondary); }

/* ---------------------------------------------------------------------------------------
   Chips — tier/level/badge, visually distinct from the neutral board's pill chips: a
   leading square swatch plus uppercase text instead of a filled pill.
   --------------------------------------------------------------------------------------- */

.tv1-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.tv1-chip::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--text-secondary);
  flex: none;
}

.tv1-chip--blocked { color: var(--error); }
.tv1-chip--blocked::before { background: var(--error); }
.tv1-chip--listed { color: var(--warning); }
.tv1-chip--listed::before { background: var(--warning); }
.tv1-chip--recorded { color: var(--text-secondary); }
.tv1-chip--recorded::before { background: var(--text-secondary); }

/* ---------------------------------------------------------------------------------------
   Tables — Most Wanted, hoster responses. Dense, mono IPs/numbers, one hairline per row.
   --------------------------------------------------------------------------------------- */

.tv1-table-wrap { overflow-x: auto; }

.tv1-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.tv1-table caption { text-align: left; }

.tv1-table th, .tv1-table td {
  padding: var(--tv1-space-2) var(--tv1-space-3);
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: top;
}

.tv1-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tv1-table tbody tr:hover { background: var(--bg-card); }

.tv1-table a.tv1-ip {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  color: var(--accent);
  text-decoration: none;
}

.tv1-table a.tv1-ip:hover { color: var(--accent-hover); }

.tv1-num {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* ---------------------------------------------------------------------------------------
   Two-up secondary intel row (hoster responses / credentials) and lists (digests / feeds).
   --------------------------------------------------------------------------------------- */

.tv1-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--tv1-space-5);
}

@media (max-width: 640px) {
  .tv1-pair { grid-template-columns: 1fr; }
}

.tv1-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.tv1-list li { margin-bottom: 4px; }
.tv1-list a { color: var(--accent); }

.tv1-cred-col + .tv1-cred-col { margin-top: var(--tv1-space-4); }

/* ---------------------------------------------------------------------------------------
   Footer link to /threats/about and cross-link back to the design hub.
   --------------------------------------------------------------------------------------- */

.tv1-footnote {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.tv1-footnote a { color: var(--accent); }

/* Focus ring — same outline every focusable control on the site already uses. */
.tv1-board a:focus-visible,
.tv1-board button:focus-visible,
.tv1-board input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------------------------
   Mobile (<=390-932px). The two-up pair and the status strip's counter row are the two
   spots dense enough to need an explicit stack below 480px.
   --------------------------------------------------------------------------------------- */

@media (max-width: 480px) {
  .tv1-status { flex-direction: column; align-items: stretch; }
  .tv1-counters { margin-left: 0; gap: var(--tv1-space-4); }
  .tv1-lookup-form { flex-wrap: wrap; }
  .tv1-lookup-form input { flex: 1 1 100%; order: 2; }
  .tv1-lookup-form button { order: 3; }
}
