/* TrumpLexicon — tokens follow the validated reference palette (light + dark). */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #2a78d6;       /* marks */
  --accent-text: #256abf;  /* text in the accent hue (5.3:1) */
  --accent-wash: rgba(42, 120, 214, 0.1);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --focus: #2a78d6;
  /* heat maps: diverging, falling (blue) / steady (gray) / rising (red); all pass 4.5:1 as text */
  --heat-m2: #104281;
  --heat-m1: #256abf;
  --heat-0: #52514e;
  --heat-p1: #c63d3c;
  --heat-p2: #9c2626;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --accent-text: #6da7ec;
    --accent-wash: rgba(57, 135, 229, 0.12);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --focus: #6da7ec;
    --heat-m2: #9ec5f4;
    --heat-m1: #5598e7;
    --heat-0: #c3c2b7;
    --heat-p1: #e66767;
    --heat-p2: #f5a3a3;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #3987e5;
  --accent-text: #6da7ec;
  --accent-wash: rgba(57, 135, 229, 0.12);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --focus: #6da7ec;
  --heat-m2: #9ec5f4;
  --heat-m1: #5598e7;
  --heat-0: #c3c2b7;
  --heat-p1: #e66767;
  --heat-p2: #f5a3a3;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  overflow-x: hidden;
}
a { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* header */
header.site { border-bottom: 1px solid var(--grid); background: var(--surface); }
header.site .wrap { display: flex; align-items: center; gap: 20px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 750; font-size: 19px; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent-text); }
nav.main { display: flex; gap: 16px; margin-left: auto; }
nav.main a { color: var(--ink-2); text-decoration: none; font-size: 14px; padding: 6px 2px; border-bottom: 2px solid transparent; }
nav.main a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

main.wrap { padding-top: 20px; padding-bottom: 48px; }
.lede { color: var(--ink-2); margin: 4px 0 16px; max-width: 70ch; }

/* search */
.search { position: relative; max-width: 640px; }
.search input {
  width: 100%; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--axis); background: var(--surface); color: var(--ink);
}
.search input::placeholder { color: var(--muted); }
.suggest {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.suggest button {
  display: flex; justify-content: space-between; gap: 12px; width: 100%; font: inherit; text-align: left;
  border: 0; background: none; color: var(--ink); padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.suggest button:hover, .suggest button[aria-selected="true"] { background: var(--surface-2); }
.suggest .n { color: var(--muted); font-variant-numeric: tabular-nums; }

/* filter row */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 16px 0; }
.filters .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-right: 2px; }
.seg { display: inline-flex; border: 1px solid var(--axis); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button {
  font: inherit; font-size: 13px; border: 0; background: none; color: var(--ink-2); padding: 6px 10px; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--grid); }
.seg button[aria-pressed="true"] { background: var(--accent-wash); color: var(--ink); font-weight: 600; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 13px; border: 1px solid var(--axis); background: var(--surface); color: var(--ink-2);
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: var(--accent-wash); }
.chip[aria-pressed="true"]::before { content: "\2713\00a0"; font-weight: 700; }

/* cards + layout */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px; min-width: 0;
}
.card-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head .sub { color: var(--muted); font-size: 13px; }
.card-head .spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.loading { opacity: 0.55; transition: opacity 0.15s; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* stat tiles */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.tile .k { font-size: 13px; color: var(--ink-2); }
.tile .v { font-size: 24px; font-weight: 650; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
@media (max-width: 600px) { .tile .v { font-size: 19px; white-space: normal; } }

/* charts */
.chart { width: 100%; height: 360px; }
.chart.cloud { height: 440px; }
.chart.heat { height: 400px; }
.chart.short { height: 220px; }
@media (max-width: 600px) { .chart { height: 300px; } .chart.cloud { height: 360px; } .chart.heat { height: 340px; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend .line { width: 16px; height: 2px; border-radius: 1px; display: inline-block; }
.heat-scale { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.heat-scale .key { display: inline-flex; align-items: center; gap: 5px; }
.heat-scale .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.link-btn { font: inherit; font-size: 13px; color: var(--accent-text); background: none; border: 0; padding: 2px 0; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* tables */
.table-wrap { overflow-x: auto; max-height: 420px; overflow-y: auto; border: 1px solid var(--grid); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
th { position: sticky; top: 0; background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--ink-2); }

/* ranked lists */
ol.rank { list-style: none; margin: 0; padding: 0; }
ol.rank li { display: grid; grid-template-columns: minmax(0, 1fr) 120px 76px; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--grid); }
ol.rank li:last-child { border-bottom: 0; }
ol.rank .w { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol.rank .w a { color: var(--ink); text-decoration: none; }
ol.rank .w a:hover { color: var(--accent-text); text-decoration: underline; }
ol.rank .m { text-align: right; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
ol.rank .m b { color: var(--ink); font-weight: 600; }
@media (max-width: 420px) { ol.rank li { grid-template-columns: minmax(0, 1fr) 90px 64px; } }
.spark { display: block; width: 100%; height: 28px; overflow: visible; }

/* new words */
.wordlist { display: flex; flex-wrap: wrap; gap: 8px; }
.wordlist a {
  display: inline-flex; gap: 6px; align-items: baseline; text-decoration: none; color: var(--ink);
  border: 1px solid var(--grid); border-radius: 8px; padding: 4px 10px; background: var(--surface);
}
.wordlist a:hover { border-color: var(--accent); }
.wordlist small { color: var(--muted); font-variant-numeric: tabular-nums; }

/* usage examples */
.kwic { list-style: none; margin: 0; padding: 0; }
.kwic li { padding: 12px 0; border-bottom: 1px solid var(--grid); }
.kwic li:last-child { border-bottom: 0; }
.kwic .meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 4px; }
.kwic .meta .t { color: var(--ink-2); font-weight: 600; }
.kwic q { quotes: "\201C" "\201D"; color: var(--ink); }
.kwic mark { background: var(--accent-wash); color: var(--ink); font-weight: 650; border-radius: 3px; padding: 0 2px; box-shadow: inset 0 -2px 0 var(--accent); }

/* compare */
.compare { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--grid); border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 14px; background: var(--surface); }
.pill .line { width: 14px; height: 2px; border-radius: 1px; }
.pill button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.compare input { font: inherit; font-size: 14px; padding: 5px 10px; border-radius: 999px; border: 1px dashed var(--axis); background: var(--surface); color: var(--ink); width: 180px; }

/* prose */
.prose { max-width: 72ch; }
.prose h2 { margin: 24px 0 8px; }
.prose p, .prose li { color: var(--ink-2); }
.prose code { font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

footer.site { border-top: 1px solid var(--grid); color: var(--muted); font-size: 13px; padding: 20px 0 32px; }
footer.site a { color: var(--ink-2); }

/* floating tooltip for SVG sparklines */
.tip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font-size: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14); white-space: nowrap;
}
.tip b { font-weight: 650; }
.tip .s { color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fgroup { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
