/* Threat Wire. Layout: masthead + KEV strip, then a two-column wire (advisories rail | news stream).
   Colors use --card/--text so the site page can hand its own colors to the embedded app. */
:root {
  --bg: #eef1f4;
  --card: #ffffff;
  --text: #141c26;
  --muted: #5b6878;
  --line: #d5dbe3;
  --accent: #1f5fd1;
  --hot: #c2410c;
  --hot-bg: #fff1e8;
  --ok: #15803d;
  --bad: #b91c1c;
  --chip: #e3e8ef;
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141b; --card: #171e28; --text: #e4e9f0; --muted: #8d9aab; --line: #2a3442;
    --accent: #6ea2ff; --hot: #fb923c; --hot-bg: #2a1a10; --ok: #4ade80; --bad: #f87171; --chip: #222b38;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141b; --card: #171e28; --text: #e4e9f0; --muted: #8d9aab; --line: #2a3442;
  --accent: #6ea2ff; --hot: #fb923c; --hot-bg: #2a1a10; --ok: #4ade80; --bad: #f87171; --chip: #222b38;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 48px;
}
.wrap { max-width: 1240px; margin: 0 auto; display: grid; gap: 20px; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* masthead */
header.mast { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; border-bottom: 3px solid var(--text); padding-bottom: 12px; }
.brand h1 { font-family: var(--font-display); font-stretch: 75%; font-weight: 800; font-size: clamp(34px, 6vw, 52px); line-height: .95; margin: 0; letter-spacing: -.01em; text-transform: uppercase; }
.brand p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
button.refresh { font: 600 13px var(--font-body); background: var(--text); color: var(--bg); border: 0; padding: 8px 14px; border-radius: 4px; cursor: pointer; }
button.refresh:hover { background: var(--accent); }
button.refresh[disabled] { opacity: .6; cursor: progress; }

/* KEV strip */
section.kev { background: var(--card); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.kev-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.kev-head h2, .col h2 { font-family: var(--font-display); font-stretch: 85%; font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: 0; }
.kev-head span { font-size: 12px; color: var(--muted); }
.kev-scroll { overflow-x: auto; }
table.kev-t { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.kev-t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 16px; }
.kev-t td { padding: 8px 16px; border-top: 1px solid var(--line); vertical-align: top; }
.kev-t td.cve a { color: var(--hot); font-weight: 600; }
.kev-t td.mono { white-space: nowrap; }
.tag-rw { display: inline-block; font-size: 11px; font-weight: 600; color: var(--hot); background: var(--hot-bg); padding: 1px 6px; border-radius: 3px; margin-left: 6px; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar input[type=search] { flex: 1 1 240px; min-width: 0; font: 14px var(--font-body); padding: 8px 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--card); }
.seg button { font: 500 13px var(--font-body); border: 0; background: transparent; color: var(--muted); padding: 7px 11px; cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--text); color: var(--bg); }
.toggle { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.src { font: 500 12px var(--font-body); border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 4px 9px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.src .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.src[data-state=ok] .dot { background: var(--ok); }
.src[data-state=fail] .dot { background: var(--bad); }
.src[data-state=loading] .dot { animation: pulse 1s infinite alternate; }
.src[aria-pressed=false] { opacity: .45; text-decoration: line-through; }
.src .n { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
@keyframes pulse { from { opacity: .2 } to { opacity: 1 } }

/* columns */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.col { display: grid; gap: 0; min-width: 0; }
.col h2 { padding-bottom: 8px; border-bottom: 1px solid var(--text); display: flex; justify-content: space-between; }
.col h2 small { font: 400 12px var(--font-mono); letter-spacing: 0; text-transform: none; color: var(--muted); }
article.item { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; gap: 4px; min-width: 0; }
article.item.hot { border-left: 3px solid var(--hot); padding-left: 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); align-items: center; }
.meta .who { font-weight: 600; color: var(--text); text-transform: uppercase; letter-spacing: .05em; font-size: 11px; }
.meta .new { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--accent); border: 1px solid var(--accent); padding: 0 5px; border-radius: 3px; }
.item h3 { margin: 0; font-family: var(--font-display); font-stretch: 92%; font-weight: 600; font-size: 17px; line-height: 1.3; text-wrap: balance; overflow-wrap: anywhere; }
.alerts .item h3 { font-size: 15px; }
.item p { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 70ch; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font: 11px var(--font-mono); background: var(--chip); color: var(--text); padding: 1px 6px; border-radius: 3px; }
.tag.hot { background: var(--hot-bg); color: var(--hot); font-weight: 600; }
.empty { padding: 24px 0; color: var(--muted); font-size: 14px; }
.skel { height: 64px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, transparent, var(--chip), transparent); background-size: 200% 100%; animation: sh 1.4s infinite linear; }
@keyframes sh { from { background-position: 200% 0 } to { background-position: -200% 0 } }
footer { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
footer code, .notice code { font-family: var(--font-mono); }
.notice { background: var(--hot-bg); color: var(--text); border: 1px solid var(--hot); border-radius: 6px; padding: 10px 14px; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .skel, .src[data-state=loading] .dot { animation: none; } }

.src[data-state=stale] .dot { background: var(--muted); }
[hidden] { display: none !important; }
.more { display: block; width: 100%; font: 500 12px var(--font-body); color: var(--muted); background: transparent; border: 0; border-top: 1px solid var(--line); padding: 9px; cursor: pointer; }
.more:hover { color: var(--accent); }
footer a { color: var(--accent); }

/* the Install app button (js/install-app.js) */
.install-app { flex-basis: 100%; }
.btn.ghost { font: 600 13px var(--font-body); background: transparent; color: var(--text); border: 1px solid var(--line); padding: 7px 13px; border-radius: 4px; cursor: pointer; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

/* phones: each vulnerability as a small block instead of a wide table row */
@media (max-width: 600px) {
  table.kev-t { min-width: 0; }
  .kev-t thead { display: none; }
  .kev-t tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
  .kev-t tr:first-child { border-top: 0; }
  .kev-t td { padding: 0; border: 0; }
  .kev-t td:nth-child(2), .kev-t td:nth-child(3) { grid-column: 1 / -1; }
  .kev-t td:nth-child(2) { color: var(--muted); font-size: 12px; }
  .kev-t td:nth-child(4) { grid-row: 1; grid-column: 2; color: var(--muted); }
  .kev-t td:nth-child(5) { display: none; }
  .kev-t td[colspan] { grid-column: 1 / -1; }
}

/* embedded in the site page (../threatwire.html): no masthead, no outer padding */
.embedded body { background: transparent; padding: 0; }
.embedded .wrap { max-width: none; }
.embedded .brand { display: none; }
.embedded header.mast { border-bottom: 0; padding-bottom: 0; }
