/* ════════════════════════════════════════════════════════════
   The AI Predictions Tracker — visual styles (v2 redesign, June 2026)
   Shared by /ai-predictions/ (predictions), stats.html, sources.html.
   See tests/ai-predictions-mockup-C-grouped.html for the design source.
   ════════════════════════════════════════════════════════════ */

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

:root {
  --bg: #0a0a0b;
  --surface: #131318;
  --rule: #1d1d24;
  --rule-strong: #2c2c34;
  --text: #ecebe8;
  --text-2: #a3a0aa;
  --text-3: #6a6772;
  --accent: #38bdf8;

  /* prediction status */
  --debunked: #f87171;
  --partial:  #fbbf24;
  --confirmed:#34d399;
  --open:     #94a3b8;
  --untrack:  #a78bfa;

  /* topic colours (used on stats page section headers) */
  --topic-jobs: #fb923c;
  --topic-productivity: #34d399;
  --topic-capabilities: #38bdf8;
  --topic-geopolitics: #f87171;
  --topic-market: #fbbf24;
  --topic-society: #e879f9;

  /* sources tier colours */
  --tier-1: #fbbf24;
  --tier-2: #38bdf8;
  --tier-3: #34d399;
  --tier-4: #a78bfa;
  --tier-5: #fb923c;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  min-height: 100vh;
}

.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

/* ── Top nav (Predictions · Stats · Sources) ─────────────────── */
.page-nav { display: flex; gap: 6px; margin-bottom: 2rem; flex-wrap: wrap; }
.nav-link {
  display: inline-block;
  font-size: 12.5px;
  color: var(--text-2);
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all 0.15s ease;
}
.nav-link:hover { color: var(--text); border-color: var(--rule-strong); background: var(--rule); }
.nav-link.active {
  background: rgba(56, 189, 248, 0.10);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.nav-link.active:hover { background: rgba(56, 189, 248, 0.10); }

/* ── Hero ─────────────────────────────────────────────────────── */
.hero { margin-bottom: 2rem; }
.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.brand-link {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.brand-link:hover { opacity: 0.75; text-decoration: underline; text-underline-offset: 3px; }
h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 12px;
}
h1 .accent { color: var(--accent); }
.lede {
  font-size: 15px;
  color: var(--text-2);
  max-width: 620px;
  line-height: 1.65;
}
.lede strong { color: var(--text); font-weight: 600; }

/* ── Filter block (status + topic rows) ───────────────────────── */
.filter-block {
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-row .label {
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-right: 8px;
  font-weight: 600;
  width: 50px;
  flex-shrink: 0;
}
.chip {
  background: transparent;
  border: 1px solid var(--rule-strong);
  color: var(--text-2);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s ease;
}
.chip:hover { color: var(--text); border-color: var(--text-3); }
.chip.on {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(56, 189, 248, 0.06);
}

/* ── Group (section by status, or by topic on stats page) ─────── */
.group { margin-bottom: 2.75rem; }
.group-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 10px 10px 0 0;
  border-top: 3px solid;
  background: var(--surface);
  border-bottom: 1px solid var(--rule-strong);
}
.group-head .name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.group-head .count {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.group-head .sub {
  font-size: 13px;
  color: var(--text-2);
  margin-left: auto;
  text-align: right;
  line-height: 1.45;
  max-width: 380px;
}

/* status-coloured group heads (predictions page) */
.group.debunked    .group-head { border-top-color: var(--debunked); }
.group.debunked    .group-head .name { color: var(--debunked); }
.group.partial     .group-head { border-top-color: var(--partial); }
.group.partial     .group-head .name { color: var(--partial); }
.group.open        .group-head { border-top-color: var(--open); }
.group.open        .group-head .name { color: var(--open); }
.group.confirmed   .group-head { border-top-color: var(--confirmed); }
.group.confirmed   .group-head .name { color: var(--confirmed); }
.group.untrackable .group-head { border-top-color: var(--untrack); }
.group.untrackable .group-head .name { color: var(--untrack); }

/* topic-coloured group heads (stats page) */
.group.jobs         .group-head { border-top-color: var(--topic-jobs); }
.group.jobs         .group-head .name { color: var(--topic-jobs); }
.group.productivity .group-head { border-top-color: var(--topic-productivity); }
.group.productivity .group-head .name { color: var(--topic-productivity); }
.group.capabilities .group-head { border-top-color: var(--topic-capabilities); }
.group.capabilities .group-head .name { color: var(--topic-capabilities); }
.group.market       .group-head { border-top-color: var(--topic-market); }
.group.market       .group-head .name { color: var(--topic-market); }
.group.geopolitics  .group-head { border-top-color: var(--topic-geopolitics); }
.group.geopolitics  .group-head .name { color: var(--topic-geopolitics); }
.group.society      .group-head { border-top-color: var(--topic-society); }
.group.society      .group-head .name { color: var(--topic-society); }

/* tier-coloured group heads (sources page) */
.group.tier-1 .group-head { border-top-color: var(--tier-1); }
.group.tier-1 .group-head .name { color: var(--tier-1); }
.group.tier-2 .group-head { border-top-color: var(--tier-2); }
.group.tier-2 .group-head .name { color: var(--tier-2); }
.group.tier-3 .group-head { border-top-color: var(--tier-3); }
.group.tier-3 .group-head .name { color: var(--tier-3); }
.group.tier-4 .group-head { border-top-color: var(--tier-4); }
.group.tier-4 .group-head .name { color: var(--tier-4); }
.group.tier-5 .group-head { border-top-color: var(--tier-5); }
.group.tier-5 .group-head .name { color: var(--tier-5); }

.group-body { background: var(--surface); border-radius: 0 0 10px 10px; }

/* ── Item card (monochrome, no status indicator) ──────────────── */
.item {
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--rule);
}
.item:last-child { border-bottom: 0; }
.item.hidden { display: none; }

.item-meta {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
  font-weight: 500;
}
.item-meta .sep { color: var(--rule-strong); margin: 0 7px; }

/* verbatim quote (predictions): serif italic */
.item-quote {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-size: 21px;
  line-height: 1.32;
  letter-spacing: -0.005em;
  color: var(--text);
  margin: 0 0 10px 0;
  text-wrap: balance;
}

/* stat headline (stats): serif, regular weight, not italic */
.item-stat {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 21px;
  font-weight: 500;
  line-height: 1.32;
  letter-spacing: -0.005em;
  color: var(--text);
  margin: 0 0 10px 0;
  text-wrap: balance;
}

.item-attribution { font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.item-attribution .name { color: var(--text-2); font-weight: 600; }

.item-body {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 14px;
}
.item-body strong { color: var(--text); font-weight: 600; }
.item-body em { color: var(--text); font-style: italic; }

.item-foot {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}
.item-foot a.source {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted rgba(56, 189, 248, 0.35);
  padding-bottom: 1px;
}
.item-foot a.source:hover { border-bottom-style: solid; }
.item-foot .spacer { flex: 1; }

/* ── Expand toggle ────────────────────────────────────────────── */
details.expand { margin: 0; }
details.expand summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-3);
  list-style: none;
  padding: 4px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  transition: color 0.15s ease;
}
details.expand summary::-webkit-details-marker { display: none; }
details.expand summary::after {
  content: '↓';
  font-size: 11px;
  transition: transform 0.15s ease;
}
details.expand[open] summary::after { transform: rotate(180deg); }
details.expand summary:hover { color: var(--text-2); }

.expand-detail { display: none; }
.expand-detail.show { display: block; }
.expand-body {
  padding-top: 14px;
  margin-top: 10px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
}
.expand-body p { margin-bottom: 8px; }
.expand-body p:last-child { margin-bottom: 0; }
.expand-body .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 4px;
  font-weight: 600;
}
.expand-body .meta-line { font-size: 12.5px; color: var(--text-3); margin: 10px 0; }
.expand-body .meta-line strong { color: var(--text-2); }
.expand-body a {
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 1px dotted var(--rule-strong);
}
.expand-body a:hover { color: var(--text); }

/* yellow conflict / quality flag callout */
.conflict-note, .quality-note {
  font-size: 12.5px;
  color: var(--partial);
  padding: 10px 14px;
  background: rgba(251, 191, 36, 0.06);
  border-left: 2px solid rgba(251, 191, 36, 0.5);
  border-radius: 0 4px 4px 0;
  margin: 12px 0;
  line-height: 1.5;
}
.conflict-note strong, .quality-note strong { color: var(--partial); }

/* green clean-source note (stats page) */
.quality-clean {
  font-size: 12.5px;
  color: var(--confirmed);
  padding: 10px 14px;
  background: rgba(52, 211, 153, 0.06);
  border-left: 2px solid rgba(52, 211, 153, 0.5);
  border-radius: 0 4px 4px 0;
  margin: 12px 0;
  line-height: 1.5;
}
.quality-clean strong { color: var(--confirmed); }

/* ── Sources page extras ──────────────────────────────────────── */
.tier-note {
  font-size: 13px;
  color: var(--text-2);
  padding: 12px 18px;
  background: rgba(251, 191, 36, 0.04);
  border-left: 2px solid rgba(251, 191, 36, 0.4);
  margin-bottom: 0;
  line-height: 1.6;
}
.tier-note strong { color: var(--partial); font-weight: 600; }

.source-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.source-name .region {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  margin-left: 8px;
  letter-spacing: 0.04em;
}

.feedback-block {
  margin-top: 3rem;
  padding: 24px 28px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
}
.feedback-block .label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.feedback-block h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.feedback-block .lede {
  font-size: 13.5px;
  color: var(--text-2);
  margin: 0 0 1.25rem 0;
  max-width: 580px;
  line-height: 1.6;
}
.feedback-ctas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.feedback-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-2);
  transition: all 0.15s ease;
}
.feedback-cta:hover { color: var(--text); border-color: var(--accent); }
.feedback-cta .icon {
  font-size: 18px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.1);
  border-radius: 6px;
  color: var(--accent);
  flex-shrink: 0;
}
.feedback-cta strong { display: block; font-size: 13px; color: var(--text); font-weight: 600; }
.feedback-cta span.sub { font-size: 11.5px; color: var(--text-3); }

/* ── Loading / empty / error states ───────────────────────────── */
.loading, .empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-3);
  font-size: 14px;
}

/* ── Footer note + copyright ──────────────────────────────────── */
.footer-note {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.7;
}
.footer-note strong { color: var(--text-2); }
.footer-note a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted rgba(56, 189, 248, 0.4);
  padding-bottom: 1px;
}
.copyright {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  text-align: center;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.03em;
}
.copyright a {
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 1px dotted var(--rule-strong);
  padding-bottom: 1px;
  transition: color 0.15s ease;
}
.copyright a:hover { color: var(--text); }

@media (max-width: 640px) {
  h1 { font-size: 28px; }
  .group-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .group-head .sub { text-align: left; margin-left: 0; }
}
