:root {
  --bg: #060913; --surface: #0b1020; --border: #1e293b;
  --text: #e2e8f0; --muted: #94a3b8; --accent: #6366f1; --accent-fg: #fff;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --max: 880px;
}
[data-theme="light"] {
  --bg: #f8fafc; --surface: #fff; --border: #e2e8f0;
  --text: #0f172a; --muted: #475569; --accent: #4f46e5;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; gap: .75rem;
  align-items: center; padding: .75rem 1rem; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; white-space: nowrap; }
.brand span { color: var(--accent); }
#search { flex: 1; min-width: 0; padding: .55rem .8rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .95rem; }
#theme-toggle { background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: .45rem .6rem; cursor: pointer; font-size: 1rem; }
main { max-width: var(--max); margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.foot { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .85rem; }
.grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card { display: block; padding: 1rem; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.card h3 { margin: 0 0 .25rem; }
.card p { margin: 0; color: var(--muted); font-size: .9rem; }
.tag { display: inline-block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: .1rem .5rem; margin-right: .3rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.filters button { background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: .35rem .75rem; cursor: pointer; font-size: .8rem; }
.filters button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.article h1 { font-size: 2rem; margin: 0 0 .25rem; }
.article .meta { color: var(--muted); margin-bottom: 1.5rem; }
.article section { margin: 1.75rem 0; }
.article h2 { font-size: 1.15rem; border-bottom: 1px solid var(--border); padding-bottom: .35rem; }
.article code, .term-mono { font-family: var(--mono); }
.toc { font-size: .85rem; }
.eli5 { background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-left: 3px solid var(--accent); padding: .75rem 1rem; border-radius: 0 8px 8px 0; }
.onething { font-size: 1.1rem; font-weight: 600; border: 1px dashed var(--accent); border-radius: 12px; padding: 1rem; }
.rail h2 { font-size: .95rem; color: var(--muted); }
@media (max-width: 600px) { .topbar { flex-wrap: wrap; } #search { order: 3; flex-basis: 100%; } }
