/* LLM Architecture Atlas — shared stylesheet. Light/dark via data-theme on <html>. */

:root {
  --bg: #fafafa;
  --bg-raise: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --border: #e2e4e9;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --nd: #9a3412;
  --nd-bg: #fff7ed;
  --na: #8b5cf6;
  --diff: #fef3c7;
  --code-bg: #f1f3f5;
  --hover: #f3f4f6;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

html[data-theme="dark"] {
  --bg: #111318;
  --bg-raise: #171a21;
  --fg: #e5e7eb;
  --muted: #9ca3af;
  --border: #2a2f3a;
  --accent: #60a5fa;
  --accent-soft: #1b2a44;
  --nd: #fdba74;
  --nd-bg: #2a1c10;
  --na: #c4b5fd;
  --diff: #3a3120;
  --code-bg: #20242e;
  --hover: #1d212b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  font-size: 15px;
}

/* ---------- nav ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 20px;
  background: var(--bg-raise);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.topnav .brand {
  font-weight: 700;
  margin-right: 16px;
  color: var(--fg);
  letter-spacing: 0.2px;
}
.topnav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.topnav a:hover { color: var(--fg); background: var(--hover); }
.topnav a.active { color: var(--accent); font-weight: 600; }
#theme-toggle {
  margin-left: auto;
  border: 1px solid var(--border);
  background: var(--bg-raise);
  color: var(--fg);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 15px;
}

/* ---------- layout ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 60px; }
h1 { font-size: 1.7rem; margin: 8px 0 4px; }
h2 { font-size: 1.25rem; margin: 28px 0 10px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
h3 { font-size: 1.05rem; margin: 22px 0 8px; }
h4 { font-size: 0.95rem; margin: 16px 0 6px; color: var(--muted); }
.lede { color: var(--muted); margin: 6px 0 18px; }
.subtitle { color: var(--muted); margin: 4px 0 12px; }
.muted { color: var(--muted); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 5px; font-size: 0.88em; }

.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); text-decoration: none; }

/* ---------- timeline strip (home) ---------- */
.timeline-strip {
  position: relative;
  height: 88px;
  margin: 10px 0 22px;
  border-bottom: 1px solid var(--border);
}
.tl-item {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--fg);
  min-width: 0;
}
.tl-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
  margin-bottom: 6px;
}
.tl-name { font-size: 11.5px; color: var(--muted); white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.tl-item:hover .tl-name { color: var(--accent); }
.tl-axis {
  position: absolute;
  bottom: -20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 10px; align-items: center; }
.filters input[type="search"] {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-raise);
  color: var(--fg);
}
.filters select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-raise);
  color: var(--fg);
  font-size: 13px;
  max-width: 170px;
}

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-raise);
  box-shadow: var(--shadow);
  margin: 10px 0 18px;
}
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
thead th {
  position: sticky;
  top: 0;
  background: var(--bg-raise);
  z-index: 2;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--accent); }
thead th.sorted-asc::after { content: " ▲"; font-size: 10px; }
thead th.sorted-desc::after { content: " ▼"; font-size: 10px; }
tbody tr:hover { background: var(--hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.model-cell a { font-weight: 600; color: var(--fg); }
.model-cell a:hover { color: var(--accent); }
.cmp-col { width: 30px; }

/* provenance-aware cells */
.nd { color: var(--nd); font-style: italic; text-decoration: underline dotted; cursor: help; }
.na { color: var(--na); cursor: help; }
.nd-cell, .na-cell { background: transparent; }

/* badges */
.badge {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  border: 1px solid var(--border);
  text-decoration: none;
}
.badge:hover { text-decoration: none; filter: brightness(1.08); }

.report-link { margin: 10px 0; }

/* spec sheet */
table.sub th { width: 38%; font-weight: 500; color: var(--muted); background: transparent; border-bottom: 1px solid var(--border); text-transform: none; letter-spacing: 0; }
table.sub td { white-space: normal; }
table.variants td, table.bench td { white-space: nowrap; }
sup.fn a { color: var(--accent); text-decoration: none; font-size: 11px; }
ol.footnotes { font-size: 12.5px; color: var(--muted); }
ol.footnotes li { margin-bottom: 4px; }
.footnotes-h { margin-top: 26px; }

.taglist { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.taglist li { background: var(--code-bg); padding: 2px 10px; border-radius: 999px; font-size: 12.5px; }

ul.claims li { margin-bottom: 6px; }
.ref { color: var(--muted); font-size: 12px; }
.relatives li { margin-bottom: 6px; }

/* compare */
#compare { margin-top: 22px; }
#compare .diff { background: var(--diff); font-weight: 600; }
#compare td { white-space: normal; min-width: 140px; }
#compare .rowlabel { color: var(--muted); font-size: 12px; width: 220px; }
#compare .grouplabel { font-weight: 700; color: var(--fg); background: var(--code-bg); }
#compare .sel-count { color: var(--muted); font-size: 13px; }
#compare .clear-cmp { font-size: 13px; margin-left: 12px; }

/* vertical timeline */
.v-timeline { border-left: 2px solid var(--border); margin: 14px 0 0 6px; padding-left: 22px; }
.v-item { position: relative; margin-bottom: 22px; }
.v-item::before {
  content: "";
  position: absolute;
  left: -29px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.v-date { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.v-content { margin-top: 2px; }

/* categories index */
.cat-list { list-style: none; padding: 0; }
.cat-list li { margin-bottom: 10px; }
.cat-rule { font-size: 13px; color: var(--muted); }

/* about / methodology markdown */
main blockquote { border-left: 3px solid var(--border); margin: 10px 0; padding: 4px 14px; color: var(--muted); }
main pre { background: var(--code-bg); padding: 12px 14px; border-radius: 10px; overflow-x: auto; font-size: 13px; }
main table th, main table td { white-space: normal; }

footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 20px 40px;
  color: var(--muted);
  font-size: 12.5px;
  border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  .topnav { flex-wrap: wrap; padding: 8px 12px; }
  .topnav .brand { width: 100%; margin-bottom: 2px; }
  main { padding: 16px 12px 50px; }
  th, td { padding: 6px 8px; font-size: 12.5px; }
  h1 { font-size: 1.4rem; }
}
