/* ==========================================================================
   BLACKOPS MARKET AUDIT — core stylesheet
   Independent OSINT audit desk for Tor marketplaces.
   Design language: "research terminal" — dark, dense, monospace data,
   high-contrast editorial prose. No external fonts, no CDNs, no trackers.
   ========================================================================== */

/* --- 1. Tokens ---------------------------------------------------------- */

:root {
  --bg:        #08090b;
  --bg-elev:   #0d1014;
  --surface:   #12161c;
  --surface-2: #171c24;
  --surface-3: #1d232c;
  --border:    #242c36;
  --border-2:  #313a46;

  --text:      #e6edf3;
  --text-2:    #a9b6c3;
  --text-3:    #7e8b98;

  --accent:    #94a3b4;
  --accent-2:  #8a94a1;
  --accent-dim:#1b2027;
  --on-accent: #052a12;
  --ok:        #38bdf8;
  --info:      #a78bfa;
  --cyan:      #38bdf8;
  --amber:     #fbbf24;
  --red:       #f87171;
  --violet:    #a78bfa;
  --blue:      #60a5fa;

  /* Semantic status aliases. --ok is deliberately NOT the brand accent:
     the accent is neutral grey, "verified/active" is cyan. */
  --warn:      var(--amber);
  --bad:       var(--red);
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --maxw: 1240px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.32);

  --hdr-h: 60px;
}

[data-theme="light"] {
  --bg:        #f5f7f9;
  --bg-elev:   #ffffff;
  --surface:   #ffffff;
  --surface-2: #f1f4f7;
  --surface-3: #e6ebf0;
  --border:    #d9e0e7;
  --border-2:  #c2ccd6;
  --text:      #10161d;
  --text-2:    #3d4a57;
  --text-3:    #64717f;
  --accent:    #4b5563;
  --accent-2:  #374151;
  --accent-dim:#e5e7eb;
  --on-accent: #ffffff;
  --ok:        #0369a1;
  --info:      #6d28d9;
  --cyan:      #0369a1;
  --amber:     #8a5200;
  --red:       #b91c1c;
  --violet:    #6d28d9;
  --blue:      #1d4ed8;
  --shadow: 0 1px 2px rgba(16,22,29,.06), 0 8px 24px rgba(16,22,29,.08);
}

/* The accent is a neutral steel grey in both themes. --on-accent carries the
   text colour that sits on top of an accent-coloured surface. */
[data-theme="light"] .nav a[aria-current="page"] { color: var(--accent-2); }

/* --- 2. Reset ----------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--hdr-h) + 18px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* faint grid texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(127,160,190,.030) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127,160,190,.030) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 78%);
}

img, svg { max-width: 100%; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: #05230f; padding: 10px 16px; font-weight: 700;
}
.skip-link:focus { left: 12px; top: 12px; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* --- 3. Typography ------------------------------------------------------ */

h1, h2, h3, h4 { line-height: 1.24; margin: 0 0 .5em; font-weight: 750; letter-spacing: -.015em; }
h1 { font-size: clamp(1.95rem, 4.4vw, 3.05rem); }
h2 { font-size: clamp(1.42rem, 2.7vw, 1.95rem); margin-top: 2.4em; }
h3 { font-size: clamp(1.12rem, 1.9vw, 1.32rem); margin-top: 1.9em; }
h4 { font-size: 1.02rem; margin-top: 1.5em; letter-spacing: .01em; }

p { margin: 0 0 1.15em; }

a { text-decoration-color: color-mix(in srgb, var(--cyan) 45%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--cyan); }

code, kbd, samp {
  font-family: var(--mono); font-size: .88em;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: .1em .38em; border-radius: 4px; color: var(--text);
}
pre {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; overflow-x: auto; font-size: .84rem; line-height: 1.6;
}
pre code { background: none; border: 0; padding: 0; }

.lede { font-size: 1.1rem; color: var(--text-2); max-width: 74ch; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

.eyebrow {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .19em;
  text-transform: uppercase; color: var(--accent); font-weight: 600;
  margin: 0 0 .85rem; display: block;
}
.eyebrow.warn { color: var(--amber); }
.eyebrow.bad  { color: var(--red); }

.lede + .eyebrow { margin-top: 1.6rem; }

/* --- 4. Header / nav ---------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 90;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-in { display: flex; align-items: center; gap: 20px; height: var(--hdr-h); }

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 7px; display: block;
  background: var(--surface-2); border: 1px solid var(--border-2);
  object-fit: cover; image-rendering: auto;
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: .92rem; font-weight: 750; letter-spacing: -.01em; }
.brand-sub  { font-family: var(--mono); font-size: .64rem; color: var(--text-3); letter-spacing: .1em; text-transform: uppercase; }

.nav { display: flex; gap: 3px; margin-left: auto; align-items: center; }
.nav a {
  color: var(--text-2); font-size: .875rem; padding: 7px 11px; border-radius: var(--radius-sm);
  white-space: nowrap; font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

.hdr-tools { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer; font-family: var(--mono); font-size: .82rem;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }

.tor-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-2); border-color: var(--border-2);
  background: var(--surface-2);
  padding: 5px 9px; border-radius: 999px; font-weight: 600;
}
.tor-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }

.nav-toggle { display: none; }

/* --- 5. Progress + reading rail ---------------------------------------- */

.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--cyan)); z-index: 95;
}

/* --- 6. Hero ------------------------------------------------------------ */

.hero { padding: clamp(2.6rem, 6vw, 4.6rem) 0 1.2rem; position: relative; z-index: 1; }
.hero h1 { max-width: 20ch; }
.hero .lede { margin-top: 1.1rem; }

.hero-meta {
  display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 1.7rem;
  padding-top: 1.3rem; border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: .76rem; color: var(--text-3);
}
.hero-meta b { color: var(--text-2); font-weight: 600; }

/* --- 7. Buttons / chips ------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 17px; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 650; cursor: pointer; border: 1px solid transparent;
  font-family: inherit; transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 1.6rem; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; font-weight: 600;
  border: 1px solid var(--border-2); color: var(--text-2); background: var(--surface-2);
  white-space: nowrap;
}
.chip.ok   { color: var(--ok);   border-color: color-mix(in srgb, var(--ok) 42%, transparent);   background: color-mix(in srgb, var(--ok) 11%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 42%, transparent); background: color-mix(in srgb, var(--warn) 11%, transparent); }
.chip.bad  { color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 42%, transparent);  background: color-mix(in srgb, var(--bad) 11%, transparent); }
.chip.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 42%, transparent); background: color-mix(in srgb, var(--info) 11%, transparent); }
.chip.vio  { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 42%, transparent); background: color-mix(in srgb, var(--blue) 11%, transparent); }

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 7px; }
.status-dot.pulse { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* --- 8. Cards / panels -------------------------------------------------- */

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px;
}
.panel-tight { padding: 16px 18px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-sidebar { grid-template-columns: minmax(0,1fr) 300px; align-items: start; gap: 34px; }

.section { padding: clamp(2.4rem, 5vw, 4rem) 0; position: relative; z-index: 1; }
.section + .section { border-top: 1px solid var(--border); }
.section-head { margin-bottom: 1.9rem; }
.section-head h2 { margin-top: 0; }
.section-head p { color: var(--text-2); max-width: 78ch; margin-bottom: 0; }

/* --- 9. Trust score widget --------------------------------------------- */

.score-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }

.score-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.score-card::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--band, var(--accent));
}
.score-card.is-defunct { --band: var(--red); }
.score-card.is-caution  { --band: var(--amber); }
.score-card.is-ok      { --band: var(--accent); }

.score-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.score-name { font-size: 1.12rem; font-weight: 750; letter-spacing: -.01em; }
.score-name a { color: inherit; }
.score-status { margin: 0 0 18px; font-family: var(--mono); font-size: .74rem; letter-spacing: .05em; }

.gauge-wrap { display: grid; place-items: center; margin: 4px 0 14px; }
.gauge { width: 168px; height: 168px; display: block; }
.gauge-track { fill: none; stroke: var(--surface-3); stroke-width: 11; }
.gauge-fill  { fill: none; stroke: var(--band, var(--accent)); stroke-width: 11; stroke-linecap: round;
               transition: stroke-dashoffset 1.1s cubic-bezier(.22,.9,.28,1); }
.gauge-val   { fill: var(--text); font-family: var(--mono); font-weight: 700; font-size: 38px; }
.gauge-den   { fill: var(--text-3); font-family: var(--mono); font-size: 11px; letter-spacing: .16em; }
.gauge-label { fill: var(--text-3); font-family: var(--mono); font-size: 10px; letter-spacing: .18em; }
.gauge-defunct { fill: var(--red); font-family: var(--mono); font-weight: 700; font-size: 15px; letter-spacing: .1em; }

.conf {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--border); padding-top: 12px; margin-top: auto;
  font-family: var(--mono); font-size: .7rem; color: var(--text-3);
}

/* --- 9b. Focus-mode score hero + context rows --------------------------- */
.score-hero {
  display: grid; grid-template-columns: 224px minmax(0,1fr); gap: 30px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; position: relative; overflow: hidden;
}
.score-hero::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--band, var(--accent)); }
.score-hero.is-defunct { --band: var(--red); }
.score-hero.is-caution { --band: var(--amber); }
.score-hero.is-ok { --band: var(--accent); }
.score-hero-gauge { display: grid; place-items: center; align-content: start; gap: 12px; }
.score-hero-gauge .gauge-wrap { margin: 0; }
.score-hero-gauge .conf { border-top: 1px solid var(--border); width: 100%; justify-content: center; gap: 8px; }
.score-hero-body .score-top { margin-bottom: 2px; }
.score-hero-body p { max-width: 72ch; }
.score-hero-body .score-list { margin-top: 6px; }

.ctx-block {
  margin-top: 18px; border: 1px dashed var(--border-2); border-radius: var(--radius);
  padding: 18px 20px; background: var(--bg-elev);
}
.ctx-title {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-3); margin: 0 0 10px;
}
.ctx-row {
  display: grid; grid-template-columns: 148px 92px 46px 112px minmax(0,1fr) 18px;
  gap: 14px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none;
}
.ctx-row:last-of-type { border-bottom: 0; }
.ctx-row:hover { text-decoration: none; }
.ctx-row:hover .ctx-name { color: var(--accent); }
.ctx-name { font-weight: 650; font-size: .95rem; }
.ctx-score { font-family: var(--mono); font-size: .95rem; text-align: right; }
.ctx-band { font-family: var(--mono); font-size: .72rem; color: var(--text-3); }
.ctx-note { font-size: .84rem; color: var(--text-3); line-height: 1.45; }
.ctx-go { color: var(--text-3); font-family: var(--mono); text-align: right; }

/* --- 9c. FAQ ------------------------------------------------------------ */
.faq { margin: 0; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:first-child { border-top: 1px solid var(--border); }
.faq-item summary {
  cursor: pointer; padding: 17px 0; font-weight: 650; font-size: 1.02rem;
  list-style: none; display: flex; gap: 14px; align-items: baseline; color: var(--text);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "+"; font-family: var(--mono); color: var(--accent); flex: 0 0 auto; }
.faq-item[open] summary::before { content: "\2212"; }
.faq-item[open] summary { margin-bottom: 0; }
.faq-item p { margin: 0 0 20px; color: var(--text-2); max-width: 80ch; }

.score-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.score-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .82rem; }
.score-list .lbl { color: var(--text-2); }
.score-list .val { font-family: var(--mono); color: var(--text-3); font-size: .76rem; }
.bar { grid-column: 1 / -1; height: 4px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--band, var(--accent)); border-radius: 3px;
         transition: width .9s cubic-bezier(.22,.9,.28,1); }

details.disclose { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
details.disclose > summary {
  cursor: pointer; font-family: var(--mono); font-size: .74rem; color: var(--cyan);
  list-style: none; display: flex; align-items: center; gap: 7px; text-transform: uppercase; letter-spacing: .08em;
}
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::before { content: "+"; font-weight: 700; }
details.disclose[open] > summary::before { content: "\2212"; }
details.disclose[open] > summary { margin-bottom: 10px; }

/* --- 10. Incident feed -------------------------------------------------- */

.feed-controls {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding-bottom: 16px; margin-bottom: 6px; border-bottom: 1px solid var(--border);
}
.feed-controls .spacer { flex: 1 1 auto; }
.filter-btn {
  font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1px solid var(--border-2); color: var(--text-3);
}
.filter-btn:hover { color: var(--text); border-color: var(--text-3); }
.filter-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.filter-btn[aria-pressed="true"].sev-critical { background: var(--red); border-color: var(--red); color: var(--on-accent); }
.filter-btn[aria-pressed="true"].sev-high     { background: var(--amber); border-color: var(--amber); color: var(--on-accent); }
.filter-btn[aria-pressed="true"].sev-medium   { background: var(--cyan); border-color: var(--cyan); color: var(--on-accent); }
.filter-btn[aria-pressed="true"].sev-low      { background: var(--blue); border-color: var(--blue); color: var(--on-accent); }

.feed { list-style: none; margin: 0; padding: 0; }
.feed-item {
  display: grid; grid-template-columns: 92px minmax(0,1fr) auto; gap: 4px 20px;
  padding: 17px 0; border-bottom: 1px solid var(--border);
}
.feed-date { font-family: var(--mono); font-size: .78rem; color: var(--text-3); padding-top: 2px; }
.feed-date b { display: block; color: var(--text); font-size: .95rem; font-weight: 600; }
.feed-title { font-weight: 650; font-size: 1.02rem; margin: 0 0 3px; }
.feed-title a { color: var(--text); }
.feed-title a:hover { color: var(--accent); }
.feed-sum { margin: 0; color: var(--text-2); font-size: .9rem; }
.feed-meta { grid-column: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding-top: 2px; }
.feed-src { font-family: var(--mono); font-size: .68rem; color: var(--text-3); }
.feed-item.sev-critical { --sev: var(--red); }
.feed-item.sev-high     { --sev: var(--amber); }
.feed-item.sev-medium   { --sev: var(--cyan); }
.feed-item.sev-low      { --sev: var(--blue); }
.sev-mark { width: 3px; border-radius: 2px; background: var(--sev); grid-row: 1 / -1; grid-column: 1; margin-left: -14px; }
.feed-empty { padding: 40px 0; text-align: center; color: var(--text-3); font-family: var(--mono); }

/* --- 11. Article / prose ------------------------------------------------ */

.article { max-width: 78ch; }
.article h2 { padding-top: .4em; }
.article h3 { color: var(--text); }
.article > *:first-child { margin-top: 0; }
.article ul, .article ol { padding-left: 1.25em; margin: 0 0 1.15em; }
.article li { margin-bottom: .45em; }
.article li::marker { color: var(--accent); }
.article strong { color: var(--text); font-weight: 680; }
.article blockquote {
  margin: 1.6em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent);
  color: var(--text-2); font-style: italic;
}
.article blockquote cite { display: block; margin-top: .7em; font-size: .84rem; font-style: normal; color: var(--text-3); font-family: var(--mono); }
.article figure { margin: 1.8em 0; }
.article figcaption { font-size: .82rem; color: var(--text-3); margin-top: .6em; font-family: var(--mono); }

.callout {
  border: 1px solid var(--border-2); border-left-width: 3px;
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 16px 18px; margin: 1.7em 0;
}
.callout > :last-child { margin-bottom: 0; }
.callout .c-title {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 700; margin-bottom: .6em; display: flex; align-items: center; gap: 8px;
}
.callout.note  { border-left-color: var(--cyan); }   .callout.note  .c-title { color: var(--cyan); }
.callout.warn  { border-left-color: var(--amber); }  .callout.warn  .c-title { color: var(--amber); }
.callout.danger{ border-left-color: var(--red); }    .callout.danger .c-title { color: var(--red); }
.callout.ok    { border-left-color: var(--ok); } .callout.ok    .c-title { color: var(--ok); }
.callout.law   { border-left-color: var(--violet); } .callout.law   .c-title { color: var(--violet); }

.keyfacts { list-style: none; padding: 0; margin: 1.6em 0; display: grid; gap: 0; }
.keyfacts li {
  display: grid; grid-template-columns: 200px minmax(0,1fr); gap: 16px;
  padding: 11px 0; border-bottom: 1px solid var(--border); margin: 0;
}
.keyfacts li:first-child { border-top: 1px solid var(--border); }
.keyfacts .k { font-family: var(--mono); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.keyfacts .v { color: var(--text); font-size: .94rem; }

/* --- 12. TOC ------------------------------------------------------------ */

.toc { position: sticky; top: calc(var(--hdr-h) + 22px); }
.toc-title {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 12px; font-weight: 600;
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 6px 0 6px 13px; font-size: .84rem; color: var(--text-3);
  border-left: 2px solid var(--border); line-height: 1.45;
}
.toc a:hover { color: var(--text-2); text-decoration: none; border-left-color: var(--border-2); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc a.sub { padding-left: 26px; font-size: .8rem; }
.toc-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }

/* --- 13. Tables --------------------------------------------------------- */

.table-wrap {
  overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); margin: 1.8em 0;
}
table { border-collapse: collapse; width: 100%; font-size: .88rem; min-width: 640px; }
thead th {
  background: var(--surface-2); text-align: left; padding: 12px 14px;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3); font-weight: 600; border-bottom: 1px solid var(--border-2);
  position: sticky; top: 0; z-index: 2; white-space: nowrap;
}
tbody td, tbody th { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; text-align: left; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
th[scope="row"] { font-weight: 650; color: var(--text); }
td.num { font-family: var(--mono); text-align: right; }
caption { caption-side: bottom; padding: 12px 14px; font-size: .8rem; color: var(--text-3); text-align: left; border-top: 1px solid var(--border); }

.cmp-table thead th.sortable { cursor: pointer; user-select: none; }
.cmp-table thead th.sortable:hover { color: var(--text); }
.cmp-table thead th .arrow { opacity: .35; margin-left: 5px; }
.cmp-table thead th[aria-sort] .arrow { opacity: 1; color: var(--accent); }
.cmp-table thead th[aria-sort="ascending"] .arrow { transform: rotate(180deg); display: inline-block; }

/* --- 14. Sliders / scenario model --------------------------------------- */

.scenario {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin: 1.6em 0;
}
.scenario-grid { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,1fr); gap: 30px; }
.scenario-weights { display: grid; gap: 13px; }
.sw { display: grid; grid-template-columns: 1fr 54px; gap: 4px 12px; align-items: center; }
.sw label { font-size: .85rem; color: var(--text-2); }
.sw output { font-family: var(--mono); font-size: .78rem; color: var(--accent); text-align: right; }
.sw input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); margin: 0; }
.sw input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--surface-3); border-radius: 3px; }
.sw input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--accent); margin-top: -5.5px; cursor: pointer; }
.sw input[type="range"]::-moz-range-track { height: 4px; background: var(--surface-3); border-radius: 3px; }
.sw input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: var(--accent); cursor: pointer; }

.scenario-out { display: grid; gap: 14px; align-content: start; }
.fit { display: grid; gap: 7px; }
.fit-row { display: grid; grid-template-columns: 120px 1fr 46px; gap: 12px; align-items: center; }
.fit-name { font-size: .87rem; font-weight: 600; }
.fit-bar { height: 20px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.fit-bar i { display: block; height: 100%; border-radius: 4px; transition: width .5s cubic-bezier(.22,.9,.28,1); }
.fit-val { font-family: var(--mono); font-size: .8rem; color: var(--text-2); text-align: right; }
.fit-row.dead .fit-name { text-decoration: line-through; color: var(--text-3); }
.fit-row.dead .fit-bar { opacity: .3; }

.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.preset {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .05em;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text-2);
}
.preset:hover { color: var(--text); border-color: var(--text-3); }
.preset[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #052a12; font-weight: 700; }

/* --- 15. Radar chart ---------------------------------------------------- */

.radar-wrap { display: grid; place-items: center; padding: 10px 0; }
.radar { width: 100%; max-width: 520px; height: auto; }
.radar-grid { fill: none; stroke: var(--border); stroke-width: 1; }
.radar-axis { stroke: var(--border); stroke-width: 1; }
.radar-label { fill: var(--text-3); font-family: var(--mono); font-size: 10px; letter-spacing: .04em; }
.radar-area { fill-opacity: .16; stroke-width: 2; }
.radar-dot { stroke: var(--bg); stroke-width: 1.5; }
.radar-legend { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-top: 14px; }
.radar-legend span { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .76rem; color: var(--text-2); }
.radar-legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }

/* --- 16. Timeline ------------------------------------------------------- */

.timeline { list-style: none; margin: 1.6em 0; padding: 0 0 0 22px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 20px 18px; margin: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -27px; top: 7px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--border-2);
}
.timeline li.hot::before { border-color: var(--red); background: var(--red); }
.timeline li.ok::before   { border-color: var(--accent); background: var(--accent); }
.timeline time { font-family: var(--mono); font-size: .75rem; color: var(--text-3); display: block; margin-bottom: 3px; }
.timeline .tl-title { font-weight: 650; display: block; margin-bottom: 2px; }
.timeline p { margin: 0; font-size: .92rem; color: var(--text-2); }

/* --- 17. Sources -------------------------------------------------------- */

.sources { list-style: none; margin: 1.4em 0; padding: 0; display: grid; gap: 0; counter-reset: src; }
.sources li {
  counter-increment: src; display: grid; grid-template-columns: 30px 1fr auto; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border); font-size: .88rem; align-items: baseline;
}
.sources li::before { content: "[" counter(src) "]"; font-family: var(--mono); font-size: .74rem; color: var(--text-3); }
.sources .s-title { color: var(--text); }
.sources .s-pub { font-family: var(--mono); font-size: .72rem; color: var(--text-3); text-align: right; white-space: nowrap; }
.src-tier { font-family: var(--mono); font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }

/* --- 18. Verdict box ---------------------------------------------------- */

.verdict {
  border: 1px solid var(--border-2); border-radius: var(--radius);
  background: var(--surface); padding: 26px; margin: 2em 0; position: relative; overflow: hidden;
}
.verdict::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--band, var(--accent)); }
.verdict h2, .verdict h3 { margin: 0 0 .5em; font-size: 1.22rem; }
.verdict .v-score { font-family: var(--mono); font-size: 2.5rem; font-weight: 800; line-height: 1; color: var(--band, var(--accent)); }
.verdict-band { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-bottom: 6px; }
.verdict-band .v-meta { font-family: var(--mono); font-size: .78rem; color: var(--text-3); }

/* --- 19. Footer / legal ------------------------------------------------- */

.footer { border-top: 1px solid var(--border); background: var(--bg-elev); margin-top: 3rem; position: relative; z-index: 1; }
.footer-main { padding: 46px 0 30px; }
.footer-cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 34px; }
.footer h3 { font-family: var(--mono); font-size: .7rem; letter-spacing: .15em; text-transform: uppercase; color: var(--text-3); margin: 0 0 14px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer a { color: var(--text-2); font-size: .88rem; }
.footer a:hover { color: var(--accent); }
.footer p { font-size: .88rem; color: var(--text-3); }

.legal {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 34px 0; font-size: .84rem; color: var(--text-2);
}
.legal h2 {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--amber); margin: 0 0 14px; display: flex; align-items: center; gap: 9px;
}
.legal h3 { font-size: .88rem; margin: 18px 0 6px; color: var(--text); }
.legal p { margin-bottom: .8em; }
.legal ul { padding-left: 1.1em; margin: 0 0 .9em; }
.legal li { margin-bottom: .3em; }
.legal strong { color: var(--text); }
.legal .legal-cols { columns: 2; column-gap: 40px; }
@media (max-width: 760px) { .legal .legal-cols { columns: 1; } }

/* Links inside low-contrast contexts must be distinguishable by more than
   colour alone, so they carry an explicit underline. Standalone links
   (buttons, feed headlines, nav) keep the clean treatment. */
p a, li a, blockquote a, caption a, figcaption a {
  text-decoration: underline; text-underline-offset: 3px;
}
p a.btn, li a.btn { text-decoration: none; }

.footer-bottom {
  border-top: 1px solid var(--border); padding: 18px 0;
  display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between;
  font-family: var(--mono); font-size: .74rem; color: var(--text-3);
}

/* --- 20. Misc ----------------------------------------------------------- */

.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  width: 40px; height: 40px; border-radius: 50%; display: none; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text-2);
  cursor: pointer; font-family: var(--mono);
}
.to-top.show { display: grid; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 1.2em 0; padding: 0; list-style: none; }
.note-inline { font-family: var(--mono); font-size: .8rem; color: var(--text-3); }

.notice-strip {
  border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
  background: color-mix(in srgb, var(--amber) 9%, transparent);
  border-radius: var(--radius-sm); padding: 13px 16px; margin: 1.6em 0;
  font-size: .9rem; color: var(--text);
}
.notice-strip strong { color: var(--amber); }

.backtotop-link { font-family: var(--mono); font-size: .8rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- 21. Responsive ----------------------------------------------------- */

/* The header must never overflow. The affiliation badge is the first thing
   to go: the same statement appears in the footer and in the legal block. */
@media (max-width: 1220px) {
  .tor-badge { display: none; }
}
@media (max-width: 1100px) {
  .nav a { padding: 7px 8px; font-size: .82rem; }
}

@media (max-width: 1080px) {
  .grid-sidebar { grid-template-columns: 1fr; }
  /* The aside carries the on-page contents, the snapshot and the related
     links. On narrow screens it moves above the article body so the
     contents are reachable without scrolling back up. */
  .grid-sidebar > aside { order: -1; }
  .toc { position: static; }
  .toc ol { max-height: 340px; overflow-y: auto; }
}
@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .score-grid { grid-template-columns: 1fr; }
  .scenario-grid { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .ctx-row { grid-template-columns: 1fr auto auto; row-gap: 6px; }
  .ctx-note, .ctx-band { grid-column: 1 / -1; }
  .ctx-go { display: none; }
  .nav {
    position: fixed; inset: var(--hdr-h) 0 auto 0; flex-direction: column; align-items: stretch;
    background: var(--bg-elev); border-bottom: 1px solid var(--border); padding: 12px; gap: 2px;
    max-height: calc(100vh - var(--hdr-h)); overflow-y: auto;
    transform: translateY(-130%); transition: transform .25s ease; box-shadow: var(--shadow);
  }
  .nav.open { transform: translateY(0); }
  .nav a { padding: 11px 12px; font-size: .95rem; }
  .nav-toggle { display: grid; }
}
@media (max-width: 760px) {
  .score-hero { grid-template-columns: 1fr; gap: 20px; padding: 20px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr; gap: 26px; }
  .feed-item { grid-template-columns: 74px minmax(0,1fr); gap: 4px 14px; }
  .feed-meta { grid-column: 2; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .sev-mark { display: none; }
  .keyfacts li { grid-template-columns: 1fr; gap: 3px; }
  .wrap { padding: 0 16px; }
  body { font-size: 16px; }
  .brand-sub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
