/* ============================================================
   DESIGN TOKENS — "Evidence Ledger"
   Paper-cool background, ink navy text, mono citations,
   verdict-coded stamp badges instead of a single accent colour.
   ============================================================ */
:root {
  --paper: #F1F2EE;
  --paper-raised: #FBFBF9;
  --ink: #1C2431;
  --ink-soft: #4B5468;
  --ink-faint: #838C9C;
  --hairline: #D6D8CF;
  --accent: #2B3A67;
  --accent-soft: #DCE1EE;

  --v-supported: #2F6B4F;
  --v-mostly: #3A7D6E;
  --v-partly: #B7862B;
  --v-misleading: #B25A2C;
  --v-unsupported: #8A4A9E;
  --v-false: #A33B3B;
  --v-depends: #5A5A8C;

  --radius: 6px;
  --serif: "Source Serif 4", "Iowan Old Style", "Georgia", serif;
  --sans: "IBM Plex Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --shadow: 0 1px 2px rgba(28,36,49,0.06), 0 4px 14px rgba(28,36,49,0.06);
}

[data-theme="dark"] {
  --paper: #14181F;
  --paper-raised: #1B2129;
  --ink: #ECEAE3;
  --ink-soft: #B7BCC7;
  --ink-faint: #757D8C;
  --hairline: #2C333F;
  --accent: #8FA3E0;
  --accent-soft: #232B44;

  --v-supported: #59B98A;
  --v-mostly: #5FC2B0;
  --v-partly: #E0AC53;
  --v-misleading: #E38455;
  --v-unsupported: #C08AD6;
  --v-false: #E07272;
  --v-depends: #9797D6;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 4px 20px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}

a { color: var(--accent); }

.mono { font-family: var(--mono); }

::selection { background: var(--accent-soft); }

button {
  font-family: inherit;
  cursor: pointer;
}

/* -------------------------------------------------- HEADER */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
}

.header-top {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-mark {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.brand-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle, .icon-btn {
  border: 1px solid var(--hairline);
  background: var(--paper-raised);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--mono);
}
.theme-toggle:hover, .icon-btn:hover { border-color: var(--accent); }

nav.tabs {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* -------------------------------------------------- LAYOUT */
main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }
.view { display: none; }
.view.active { display: block; }

.view-intro {
  max-width: 760px;
  margin-bottom: 24px;
}
.view-intro h1 {
  font-family: var(--serif);
  font-size: 28px;
  margin: 0 0 8px;
}
.view-intro p {
  color: var(--ink-soft);
  margin: 0;
}

.disclaimer-strip {
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 24px;
}

/* -------------------------------------------------- SEARCH / FILTERS */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}

.search-box {
  flex: 1 1 260px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 10px 14px 10px 34px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 14px;
}
.search-box::before {
  content: "⌕";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 16px;
}

.filter-chip {
  border: 1px solid var(--hairline);
  background: var(--paper-raised);
  color: var(--ink-soft);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
[data-theme="dark"] .filter-chip.active { color: var(--paper); }

.result-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: 16px;
}

/* -------------------------------------------------- CARDS */
.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.fact-card {
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.fact-card .tab-strip {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 5px;
}

.fact-card-inner { padding: 20px 22px 20px 26px; }

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.verdict-stamp {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 9px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  transform: rotate(-1.5deg);
  display: inline-block;
}

.claim-title {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.35;
  margin: 0 0 12px;
}

.card-section { margin-top: 14px; }
.card-section h4 {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin: 0 0 6px;
}
.card-section p, .card-section ul { margin: 0; }
.card-section ul { padding-left: 18px; }
.card-section li { margin-bottom: 5px; }

.overclaim-warning {
  background: color-mix(in srgb, var(--v-misleading) 10%, var(--paper-raised));
  border: 1px solid var(--v-misleading);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 14px;
}
.overclaim-warning strong { color: var(--v-misleading); }

.source-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.source-list a { font-size: 13px; text-decoration: none; }
.source-list a:hover { text-decoration: underline; }

.card-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.updated-tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
}

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.mini-btn {
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
}
.mini-btn:hover { border-color: var(--accent); color: var(--accent); }
.mini-btn.copied { border-color: var(--v-supported); color: var(--v-supported); }

.details-panel {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}
.details-panel.open { display: block; }

/* -------------------------------------------------- GLOSSARY */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.glossary-term {
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
}
.glossary-term dt {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}
.glossary-term dd {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.glossary-term .g-source { display: block; margin-top: 8px; font-size: 11.5px; }

.glossary-banner {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 18px;
}

/* -------------------------------------------------- TOOLS */
.tool-section {
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.tool-section h2 {
  font-family: var(--serif);
  font-size: 20px;
  margin: 0 0 6px;
}
.tool-section > p.tool-desc {
  color: var(--ink-soft);
  font-size: 13.5px;
  margin: 0 0 16px;
}

.tool-input-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tool-input-row input, .tool-input-row textarea {
  flex: 1 1 260px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
}
.tool-input-row textarea { min-height: 110px; resize: vertical; }

.primary-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 13.5px;
}
.primary-btn:hover { opacity: 0.9; }

.denominator-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.denominator-list li {
  font-size: 14px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}
.denominator-list li strong { color: var(--accent); }

.result-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--paper);
  display: none;
}
.result-box.show { display: block; }

.source-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.source-type-btn {
  border: 1px solid var(--hairline);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 10px;
  text-align: left;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.source-type-btn:hover { border-color: var(--accent); }
.source-type-btn strong { display: block; font-size: 13.5px; color: var(--ink); margin-bottom: 2px; }

.tier-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 3px;
  font-weight: 700;
}

/* -------------------------------------------------- HYPOTHETICALS */
.hyp-card {
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.hyp-card h3 {
  font-family: var(--serif);
  font-size: 18px;
  margin: 0 0 8px;
}
.hyp-setup { color: var(--ink-soft); font-size: 14px; margin-bottom: 14px; }
.hyp-choices { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.hyp-choice-btn {
  border: 1px solid var(--hairline);
  background: var(--paper);
  padding: 9px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink);
}
.hyp-choice-btn:hover { border-color: var(--accent); }
.hyp-choice-btn.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .hyp-choice-btn.selected { color: var(--paper); }
.hyp-followup {
  display: none;
  font-size: 13.5px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.hyp-followup.show { display: block; }

/* -------------------------------------------------- TRANSCRIPT ARCHIVE */
.transcript-list { display: grid; gap: 10px; margin-top: 16px; }
.transcript-item {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
}
.transcript-item h5 { margin: 0 0 4px; font-family: var(--serif); font-size: 15px; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag-pill {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* -------------------------------------------------- FOOTER */
.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 24px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 12px;
}

/* -------------------------------------------------- MISC */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 13px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .header-top { flex-direction: column; align-items: flex-start; gap: 10px; }
}

.badge-row { display: flex; gap: 6px; flex-wrap: wrap; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}