/* Rule Radar — shared shell and card styling for index.html and archive.html.
   Rule Radar commits to one visual world — a dark ops-console/HUD — on
   purpose, the way a neon arcade screen or a letterpress invite would.
   No light-theme fork: background and colors are painted explicitly so
   it holds regardless of the viewer's OS theme.

   Anything that renders a brief's cards lives here so the two pages can't
   drift apart again. Page-specific chrome (the radar, pull-to-refresh and
   filter UI on the front page; the search box and edition list on the
   archive) stays inline in that page. */

:root {
  --bg: #080B10;
  --panel: #0F151F;
  --panel-2: #151D2A;
  --line: #223046;
  --line-bright: #34496A;
  --ink: #DCEEF2;
  --ink-soft: #7E97AB;
  --ink-faint: #4C6072;
  --cyan: #3FEEDD;
  --cyan-ink: #0A2A28;
  --cyan-soft: rgba(63, 238, 221, 0.12);
  --cyan-glow: rgba(63, 238, 221, 0.45);
  --red: #FF5D6C;
  --red-soft: rgba(255, 93, 108, 0.14);
  --amber: #FFB13B;
  --amber-soft: rgba(255, 177, 59, 0.14);
  --violet: #9C90FF;
  --violet-soft: rgba(156, 144, 255, 0.14);
  --green: #3FEE7A;
  --green-ink: #0A2A13;
  --green-soft: rgba(63, 238, 122, 0.14);
  --focus: #3FEEDD;
  --sev-critical: var(--red);
  --sev-critical-soft: var(--red-soft);
  --sev-high: var(--amber);
  --sev-high-soft: var(--amber-soft);
  --sev-medium: var(--violet);
  --sev-medium-soft: var(--violet-soft);
  /* Pages override these; the fallbacks are the front page's sizes. */
  --title-size: 36px;
  --title-size-sm: 27px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { overflow-x: hidden; width: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  width: 100%;
  overflow-wrap: break-word;
  /* Locks horizontal panning/bounce on iOS while leaving vertical scroll alone. */
  touch-action: pan-y;
}
/* faint CRT scanlines — decorative only, never blocks input */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: repeating-linear-gradient(
    0deg, rgba(220, 238, 242, 0.025) 0px, rgba(220, 238, 242, 0.025) 1px,
    transparent 1px, transparent 3px
  );
}
.wrap { max-width: 860px; margin: 0 auto; padding: 0 24px 72px; position: relative; z-index: 1; }

.topband {
  background: var(--panel);
  border-bottom: 1px solid var(--line-bright);
  box-shadow: 0 1px 0 var(--cyan-soft);
  position: relative; z-index: 1;
  /* viewport-fit=cover lets the background reach the true top edge
     (under the Dynamic Island/notch) — push the actual content below
     the device's unsafe zone instead of letting it render under it. */
  padding-top: env(safe-area-inset-top, 0px);
}
.topband-inner { max-width: 860px; margin: 0 auto; padding: 12px 24px; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--cyan);
}
.eyebrow::before { content: "> "; color: var(--ink-faint); }
.date { font-family: "IBM Plex Mono", monospace; font-size: 11.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.topband-actions { display: flex; align-items: baseline; gap: 14px; }
.lang-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.lang-btn {
  appearance: none; cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px; letter-spacing: 0.08em;
  background: none; border: none; padding: 3px 8px;
  color: var(--ink-faint);
  transition: background 0.12s ease, color 0.12s ease;
}
.lang-btn + .lang-btn { border-left: 1px solid var(--line); }
.lang-btn:hover { color: var(--ink); }
.lang-btn[aria-pressed="true"] { background: var(--cyan); color: var(--cyan-ink); font-weight: 600; }
.lang-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

header.hero { padding: 40px 0 8px; }
h1.title {
  font-family: "Orbitron", "IBM Plex Sans", sans-serif;
  font-weight: 800;
  font-size: var(--title-size);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0 0 10px;
  text-wrap: balance;
  color: var(--ink);
  text-shadow: 0 0 22px var(--cyan-glow);
}
.cursor { display: inline-block; color: var(--cyan); animation: blink 1.1s step-end infinite; margin-left: 2px; }
p.subtitle { margin: 0; color: var(--ink-soft); font-size: 15.5px; max-width: 60ch; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
}

.abstract-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--cyan); margin: 26px 0 8px;
}
.abstract {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 30px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 4px;
}
.abstract p { margin: 0 0 12px; }
.abstract p:last-child { margin-bottom: 0; }
.abstract strong { font-weight: 700; }

section.group { margin-top: 44px; }
h2.group-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ink-faint);
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
h2.group-title::before { content: "// "; color: var(--line-bright); }

.cards { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--sev);
  border-radius: 6px;
  padding: 18px 20px 20px;
  position: relative;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover { border-color: var(--sev); box-shadow: 0 0 0 1px var(--sev-soft), 0 0 28px var(--sev-soft); }
.card::before, .card::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  border-color: var(--sev); opacity: 0; transition: opacity 0.15s ease; pointer-events: none;
}
.card::before { top: -1px; right: -1px; border-top: 2px solid; border-right: 2px solid; }
.card::after { bottom: -1px; left: -1px; border-bottom: 2px solid; border-left: 2px solid; }
.card:hover::before, .card:hover::after { opacity: 1; }
.card.top { box-shadow: 0 0 0 1px var(--cyan-soft), 0 0 30px var(--cyan-soft); }
.card.top:hover { box-shadow: 0 0 0 1px var(--cyan), 0 0 34px var(--cyan-soft); }

.top-flag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan-glow);
  margin-bottom: 8px;
}
.top-flag::before { content: "◆ "; }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
h3.card-title { margin: 0; font-size: 16.5px; font-weight: 600; line-height: 1.35; color: var(--ink); }

.meta { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 8px 0 12px; align-items: center; }
.meta a { color: var(--ink-soft); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.meta a:hover { color: var(--cyan); }
.chip, .tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 7px;
}
.sev-chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.03em;
  padding: 2px 7px; border-radius: 3px;
  color: var(--sev); background: var(--sev-soft); border: 1px solid var(--sev);
}
a.chip { text-decoration: none; }
a.chip:hover { color: var(--cyan); border-color: var(--line-bright); }

p.summary { margin: 0 0 14px; color: var(--ink); font-size: 14px; max-width: 68ch; }

.assess-chip {
  appearance: none; cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.03em;
  padding: 2px 7px; border-radius: 3px; white-space: nowrap; display: inline-block; flex-shrink: 0;
  border: 1px solid var(--sev); color: var(--sev); background: var(--sev-soft);
}
.assess-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.in-today { color: var(--ink-faint); font-style: italic; }
.rank-badge {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--cyan);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px;
  padding: 1px 6px; margin-right: 8px; vertical-align: middle;
}

.disclosures { margin: 12px 0 0; }
/* Toggles only — the panels are siblings of this row, not children, so
   opening one can never rewrap the buttons. */
.disclosures-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.disclosure-toggle {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase;
  background: none; border: 1px solid var(--line); border-radius: 4px;
  padding: 6px 10px;
  color: var(--ink-soft);
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.disclosure-toggle:hover { border-color: var(--line-bright); color: var(--ink); }
.disclosure-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.disclosure-toggle .chevron { display: inline-block; transition: transform 0.12s ease; }
.disclosure-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.disclosure-panel { display: block; margin-top: 8px; }
.disclosure-panel.chip-panel, .disclosure-panel .chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.disclosure-prose {
  margin: 0; padding-top: 8px;
  font-size: 13px; line-height: 1.55; color: var(--ink-soft); max-width: 68ch;
}
.disclosure-panel .chip-row + .disclosure-prose { margin-top: 2px; }
.disclosure-panel[hidden] { display: none; }

.term { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel-2); }
.term-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; background: rgba(255, 255, 255, 0.02); border-bottom: 1px solid var(--line); }
.term-bar-label { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.term-bar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.term-bar .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.term-bar .dot.r { background: #FF5F57; }
.term-bar .dot.y { background: #FEBC2E; }
.term-bar .dot.g { background: #28C840; }
.term-title { margin-left: 8px; font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: 0.06em; color: var(--ink-faint); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.copy-btn {
  appearance: none; cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 3px; white-space: nowrap;
  background: none; border: 1px solid var(--line); color: var(--ink-soft);
  transition: border-color 0.12s ease, color 0.12s ease;
}
.copy-btn:hover { border-color: var(--line-bright); color: var(--ink); }
.copy-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.copy-btn.copied { border-color: var(--cyan); color: var(--cyan); }
.confidence-badge {
  appearance: none; cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 3px; white-space: nowrap; flex-shrink: 0;
}
.confidence-badge:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.confidence-badge.confidence-high { background: var(--green); border: 1px solid var(--green); color: var(--green-ink); }
.confidence-badge.confidence-medium { background: var(--amber-soft); border: 1px solid var(--amber); color: var(--amber); }
.confidence-badge.confidence-low { background: transparent; border: 1px solid var(--line-bright); color: var(--ink-faint); }
pre.query {
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink);
}
.querynote { font-family: "IBM Plex Mono", monospace; font-size: 11.5px; color: var(--ink-faint); margin: 8px 0 0; line-height: 1.5; }

.text-filter {
  display: block; width: 100%; margin: 0 0 20px;
  padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace; font-size: 13.5px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.text-filter::placeholder { color: var(--ink-faint); }
.text-filter:focus { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan-soft); }

.copy-md-btn {
  appearance: none; cursor: pointer;
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; letter-spacing: 0.03em; text-transform: uppercase;
  background: none; border: 1px solid var(--line); border-radius: 4px;
  padding: 7px 12px;
  color: var(--ink-soft);
  transition: border-color 0.12s ease, color 0.12s ease;
}
.copy-md-btn:hover { border-color: var(--line-bright); color: var(--ink); }
.copy-md-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.copy-md-btn.copied { border-color: var(--cyan); color: var(--cyan); }

.card-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Brief cue when you arrive via a #card- link, so the target is obvious
   without permanently changing how it looks. */
.card-targeted {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 34px var(--cyan-soft);
}
@media (prefers-reduced-motion: no-preference) {
  .card-targeted { transition: box-shadow 0.3s ease, border-color 0.3s ease; }
}

.copy-link-btn {
  appearance: none; cursor: pointer;
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; letter-spacing: 0.03em; text-transform: uppercase;
  background: none; border: 1px solid var(--line); border-radius: 4px;
  padding: 7px 12px;
  color: var(--ink-soft);
  transition: border-color 0.12s ease, color 0.12s ease;
}
.copy-link-btn:hover { border-color: var(--line-bright); color: var(--ink); }
.copy-link-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.copy-link-btn.copied { border-color: var(--cyan); color: var(--cyan); }

.status-note {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0 0 20px;
}
.status-note.error { color: var(--red); }
.retry-link, .clear-link {
  appearance: none; background: none; border: none; padding: 0;
  font: inherit; color: var(--cyan); text-decoration: underline;
  text-underline-offset: 2px; cursor: pointer;
}
.retry-link:focus-visible, .clear-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

footer {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.6;
}
footer::before { content: "// "; }
footer .generated { display: block; margin-top: 6px; color: var(--ink-faint); }
footer a { color: var(--ink-soft); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
footer a:hover { color: var(--cyan); }

@media (max-width: 640px) {
  h1.title { font-size: var(--title-size-sm); }
  .card-head { flex-direction: column; }
}
