/*
 * wiki.css — the editorial pages: the /agents landing, /docs and /research.
 *
 * Hand-written rather than Tailwind utilities for the reason CLAUDE.md gives for
 * the DCA peer panel: css/tailwind.css is *compiled*, so a class that only these
 * pages use can be missing from the bundle, and a missing utility fails silently.
 * Everything here is one file the pages link, with nothing to rebuild.
 *
 * Tokens are --w-*, light first with .dark overriding, matching the --t-* set in
 * base.html (and falling back to a readable page if the class is ever dropped).
 * Light mode uses a warm paper plane rather than the dashboards' slate-50: these
 * are reading pages, and the grid is drawn on the paper. Dark mode keeps the
 * site's own slate-950 so the sticky header does not change colour between a
 * dashboard and a doc.
 *
 * Contrast was checked, not eyeballed: --w-muted is 5.5:1 on the light paper and
 * 7:1 on dark, and every accent ink clears AA on the surface it sits on. The one
 * deliberately faint colour is --w-grid, which is decoration.
 */

:root {
  --w-paper:       #f6f6f1;
  --w-grid:        rgba(15, 23, 42, .045);
  --w-ink:         #13161b;
  --w-body:        #3d4450;
  --w-muted:       #5c6470;
  --w-line:        #e1e2da;
  --w-line-strong: #c9cbc1;
  --w-card:        #ffffff;
  --w-well:        #efefe8;
  --w-accent:      #4338ca;
  --w-accent-line: #c7d2fe;
  --w-accent-soft: rgba(79, 70, 229, .075);
  --w-num:         #c2410c;
  --w-good:        #047857;
  --w-bad:         #b91c1c;
  --w-warn:        #a16207;
  --w-term:        #0e1216;
  --w-term-line:   #242a31;
  --w-shadow:      0 1px 2px rgba(16, 24, 40, .04), 0 18px 40px -22px rgba(16, 24, 40, .22);

  /* Display: Fraunces when the (non-blocking) web font arrives, otherwise the
     best serif each platform already has. The Han fallbacks are named before
     the generic `serif` because that resolves to SimSun on Windows, which is
     unreadable bold at display sizes; YaHei is the better failure there. */
  --w-serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia,
             'Songti SC', 'Noto Serif SC', 'Source Han Serif SC', 'PingFang SC',
             'Microsoft YaHei', serif;
  /* Reading serif for leads and figures. Georgia's old-style numerals are part
     of the look, so it leads here even where Fraunces has loaded. */
  --w-read:  Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Songti SC',
             'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', serif;
  --w-mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.dark {
  --w-paper:       #020617;
  --w-grid:        rgba(148, 163, 184, .06);
  --w-ink:         #f1f5f9;
  --w-body:        #cbd5e1;
  --w-muted:       #94a3b8;
  --w-line:        #1e293b;
  --w-line-strong: #334155;
  --w-card:        #0b1222;
  --w-well:        #0a101d;
  --w-accent:      #a5b4fc;
  --w-accent-line: #3730a3;
  --w-accent-soft: rgba(99, 102, 241, .13);
  --w-num:         #fb923c;
  --w-good:        #34d399;
  --w-bad:         #f87171;
  --w-warn:        #facc15;
  --w-term:        #03060d;
  --w-term-line:   #1f2937;
  --w-shadow:      0 1px 2px rgba(0, 0, 0, .35), 0 22px 48px -24px rgba(0, 0, 0, .7);
}

/* ── The page plane ──────────────────────────────────────────────────────────
   On <body>, not a wrapper, so the grid runs edge to edge under a centred
   column without a 100vw trick (which overflows by the scrollbar's width on
   Windows). `html.dark body.w-paper` is spelled out because Tailwind's
   `.dark .dark\:bg-slate-950` on the same element is (0,2,0) and would win. */
body.w-paper,
html.dark body.w-paper {
  background-color: var(--w-paper);
  background-image:
    linear-gradient(var(--w-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--w-grid) 1px, transparent 1px);
  background-size: 44px 44px;
  background-position: center -1px;
}

.w-wrap { max-width: 1180px; margin: 0 auto; }
.w-wide { max-width: 1260px; margin: 0 auto; }

/* ── Type ─────────────────────────────────────────────────────────────────── */
.w-kicker {
  font-family: var(--w-mono); font-size: 12px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--w-accent);
}
.w-kicker.is-quiet { color: var(--w-muted); }
html[lang^="zh"] .w-kicker { letter-spacing: .08em; }

.w-display {
  font-family: var(--w-serif); font-weight: 700; color: var(--w-ink);
  font-size: clamp(46px, 7.4vw, 100px); line-height: .98; letter-spacing: -.025em;
  margin: 18px 0 0; font-optical-sizing: auto; text-wrap: balance;
}
.w-h2 {
  font-family: var(--w-serif); font-weight: 700; color: var(--w-ink);
  font-size: clamp(32px, 4.3vw, 56px); line-height: 1.04; letter-spacing: -.02em;
  margin: 0; text-wrap: balance;
}
/* Han glyphs are square and already heavy at display sizes: a smaller scale,
   looser leading and no negative tracking, or a line of 汉字 collides. */
html[lang^="zh"] .w-display { font-size: clamp(38px, 6vw, 80px); line-height: 1.14; letter-spacing: 0; }
html[lang^="zh"] .w-h2 { font-size: clamp(28px, 3.6vw, 46px); line-height: 1.2; letter-spacing: 0; }
/* Chinese may break between any two characters, so a display line split 投 / 研
   through the middle of a word. keep-all confines breaks to punctuation and to
   <wbr> hints placed in the markup; overflow-wrap is the net for a run that
   still does not fit a narrow screen, so it wraps rather than overflows. */
html[lang^="zh"] :is(.w-display, .w-h2, .w-doc-title, .w-article-title, .w-post-link h2,
                     .w-prose h2, .w-card-title.is-serif) {
  word-break: keep-all; overflow-wrap: anywhere;
}

.w-lead {
  font-size: 19px; line-height: 1.62; color: var(--w-body);
  max-width: 38rem; margin: 26px 0 0;
}
.w-muted { color: var(--w-muted); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.w-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; align-items: center; }
.w-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 6px;
  font-size: 15px; font-weight: 650; line-height: 1; text-decoration: none;
  color: var(--w-ink); background: var(--w-card);
  border: 1px solid var(--w-line-strong);
  transition: border-color .15s, background-color .15s, transform .15s;
}
.w-btn:hover { border-color: var(--w-ink); }
.w-btn:focus-visible { outline: 2px solid var(--w-accent); outline-offset: 2px; }
.w-btn-primary { color: var(--w-paper); background: var(--w-ink); border-color: var(--w-ink); }
.w-btn-primary:hover { transform: translateY(-1px); }
.w-btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.w-textlink { color: var(--w-accent); font-weight: 600; font-size: 15px; text-decoration: none; }
.w-textlink:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Product bar (docs + research) ────────────────────────────────────────── */
.w-bar {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 4px 0 16px; margin-bottom: 8px; border-bottom: 1px solid var(--w-line);
}
.w-bar-brand {
  display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none;
  font-family: var(--w-serif); font-weight: 700; font-size: 21px; color: var(--w-ink);
}
.w-bar-brand small {
  font-family: var(--w-mono); font-weight: 500; font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--w-muted);
}
.w-bar-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.w-bar-nav a {
  font-size: 14px; font-weight: 550; color: var(--w-body); text-decoration: none;
  padding: 6px 0;
}
.w-bar-nav a:hover { color: var(--w-ink); }
.w-bar-nav a.is-current { color: var(--w-ink); box-shadow: inset 0 -2px 0 var(--w-accent); }
.w-bar .w-btn { margin-left: auto; }
@media (max-width: 640px) {
  .w-bar { gap: 12px; }
  .w-bar-nav { order: 3; width: 100%; gap: 16px; overflow-x: auto; flex-wrap: nowrap; }
  .w-bar-nav a { white-space: nowrap; }
}

/* ── Sections ─────────────────────────────────────────────────────────────── */
.w-section { padding-top: 104px; }
.w-section-head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.25fr);
  gap: 24px; align-items: end; margin-bottom: 30px;
}
.w-section-head .w-kicker { padding-bottom: 12px; }
.w-section-head p.w-lead { grid-column: 2; margin-top: 0; font-size: 17px; }
@media (max-width: 860px) {
  .w-section { padding-top: 72px; }
  .w-section-head { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .w-section-head p.w-lead { grid-column: 1; }
  .w-section-head .w-kicker { padding-bottom: 0; }
}

.w-grid4, .w-grid5, .w-grid3 { display: grid; gap: 14px; }
.w-grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.w-grid5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.w-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1080px) {
  .w-grid5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .w-grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .w-grid5, .w-grid4, .w-grid3 { grid-template-columns: minmax(0, 1fr); }
}

.w-card {
  display: block; position: relative; background: var(--w-card);
  border: 1px solid var(--w-line); border-radius: 8px; padding: 20px 20px 22px;
  color: var(--w-body); text-decoration: none;
}
a.w-card { transition: border-color .15s, transform .15s, box-shadow .15s; }
a.w-card:hover { border-color: var(--w-line-strong); transform: translateY(-2px); box-shadow: var(--w-shadow); }
a.w-card:focus-visible { outline: 2px solid var(--w-accent); outline-offset: 2px; }
.w-card-num { font-family: var(--w-mono); font-size: 12px; font-weight: 600; color: var(--w-num); }
.w-card-title {
  display: block; margin-top: 26px; font-size: 17px; font-weight: 650;
  color: var(--w-ink); line-height: 1.3;
}
.w-card-title.is-serif {
  margin-top: 0; font-family: var(--w-serif); font-weight: 700;
  font-size: 26px; line-height: 1.12; letter-spacing: -.01em;
}
.w-card-body { display: block; margin-top: 9px; font-size: 15px; line-height: 1.6; color: var(--w-body); }
.w-card-foot { display: block; margin-top: 16px; font-size: 13px; font-weight: 600; color: var(--w-accent); }
.w-card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px;
  color: var(--w-accent); background: var(--w-accent-soft);
}
.w-card-icon svg { width: 20px; height: 20px; }
.w-card-icon + .w-card-title { margin-top: 18px; }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.w-hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 56px; align-items: center; padding: 64px 0 8px;
}
@media (max-width: 1000px) {
  .w-hero { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-top: 28px; }
}

/* The run log. Dark in both themes on purpose -- a terminal is dark, and a
   light terminal on light paper would read as one more card. */
.w-term {
  background: var(--w-term); border: 1px solid var(--w-term-line); border-radius: 10px;
  box-shadow: var(--w-shadow); overflow: hidden;
  font-family: var(--w-mono); font-size: 13px; line-height: 1.5; color: #d7dde5;
}
.w-term-bar {
  display: flex; align-items: center; gap: 7px; padding: 11px 14px;
  border-bottom: 1px solid var(--w-term-line); color: #9aa4b2; font-size: 12px;
}
.w-term-bar i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.w-term-bar i:nth-child(1) { background: #ef4444; }
.w-term-bar i:nth-child(2) { background: #f59e0b; }
.w-term-bar i:nth-child(3) { background: #22c55e; }
.w-term-bar b { font-weight: 600; color: #e5e7eb; margin-left: 8px; }
.w-term-bar em { margin-left: auto; font-style: normal; color: #86efac; }
.w-term-body { padding: 14px 16px 16px; }
.w-term-cmd { color: #e5e7eb; margin-bottom: 10px; overflow-wrap: anywhere; }
.w-term-cmd::before { content: '$ '; color: #fb923c; }
.w-log { list-style: none; margin: 0; padding: 0; }
.w-log li {
  display: grid; grid-template-columns: 22px minmax(0, 11.5em) minmax(0, 1fr) 18px;
  gap: 8px; align-items: baseline; padding: 3px 0; color: #7b8595;
  transition: color .25s;
}
.w-log .w-log-ico { text-align: center; }
.w-log .w-log-who { color: #aab3c0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-log .w-log-what { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-log .w-log-state { text-align: right; }
.w-log li[data-state="done"] { color: #9aa4b2; }
.w-log li[data-state="done"] .w-log-who { color: #e5e7eb; }
.w-log li[data-state="done"] .w-log-state::before { content: '✓'; color: #4ade80; }
.w-log li[data-state="active"] { color: #e5e7eb; }
.w-log li[data-state="active"] .w-log-who { color: #fde68a; }
.w-log li[data-state="active"] .w-log-state::before { content: '▸'; color: #fbbf24; animation: wBlink 1s steps(2, start) infinite; }
.w-log li[data-state="todo"] .w-log-state::before { content: '·'; color: #4b5563; }
.w-log li.is-divider { display: block; margin: 7px 0 4px; padding: 0; color: #5b6574; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.w-term-foot { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--w-term-line); color: #9aa4b2; }
.w-term-foot b { color: #86efac; font-weight: 600; }
@keyframes wBlink { to { visibility: hidden; } }
@media (max-width: 480px) {
  .w-log li { grid-template-columns: 20px minmax(0, 1fr) 16px; }
  .w-log .w-log-what { display: none; }
}

.w-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.w-chip {
  border: 1px solid var(--w-line); background: var(--w-card); border-radius: 6px;
  padding: 9px 6px 8px; text-align: center; font-family: var(--w-mono); font-size: 12.5px;
  color: var(--w-ink); cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.w-chip:hover { border-color: var(--w-line-strong); }
.w-chip:focus-visible { outline: 2px solid var(--w-accent); outline-offset: 2px; }
.w-chip[aria-pressed="true"] { border-color: var(--w-accent); box-shadow: inset 0 0 0 1px var(--w-accent); }
.w-chip small { display: block; margin-top: 2px; font-family: inherit; font-size: 10.5px; color: var(--w-muted); letter-spacing: .04em; }

.w-hero-note { margin: 18px 0 0; font-size: 13.5px; color: var(--w-muted); }
.w-more { margin: 18px 0 0; font-size: 15px; }
.w-grid-auto { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.w-run { margin: 0; }
/* Rows and the done line toggle `hidden`; `.w-log li` sets display:grid and
   would otherwise win over the UA's [hidden], leaving A-share rows showing on
   a US ticker. */
.w-run [hidden] { display: none !important; }
.w-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── Desk roster ──────────────────────────────────────────────────────────── */
.w-desk { border: 1px solid var(--w-line); border-radius: 10px; background: var(--w-card); overflow: hidden; }
.w-desk-row {
  display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px;
  padding: 16px 20px; align-items: center;
}
.w-desk-row + .w-desk-row { border-top: 1px solid var(--w-line); }
.w-desk-team { font-family: var(--w-mono); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--w-muted); }
.w-desk-seats { display: flex; flex-wrap: wrap; gap: 8px; }
.w-seat {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px 6px 9px;
  border-radius: 999px; border: 1px solid var(--w-line); background: var(--w-well);
  font-size: 13.5px; color: var(--w-ink); line-height: 1.2;
  box-shadow: inset 3px 0 0 var(--seat, var(--w-accent));
}
.w-seat-tag {
  font-family: var(--w-mono); font-size: 10px; letter-spacing: .06em;
  color: var(--w-num); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px;
}
@media (max-width: 700px) {
  .w-desk-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

/* ── Pricing ──────────────────────────────────────────────────────────────── */
.w-price-num { font-family: var(--w-read); font-size: 40px; font-weight: 700; color: var(--w-ink); line-height: 1; margin-top: 18px; display: block; }
.w-price-num small { font-family: var(--w-mono); font-size: 13px; font-weight: 500; color: var(--w-muted); margin-left: 6px; }
.w-price-per { display: block; margin-top: 8px; font-family: var(--w-mono); font-size: 12.5px; color: var(--w-muted); }
.w-card.is-free { background: var(--w-accent-soft); border-color: var(--w-accent-line); }

/* ── Boundary + footer strip ──────────────────────────────────────────────── */
.w-boundary {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 48px;
  margin-top: 104px; padding-top: 56px; border-top: 1px solid var(--w-line);
}
.w-boundary p { font-size: 17px; line-height: 1.7; color: var(--w-body); margin: 26px 0 0; }
@media (max-width: 860px) { .w-boundary { grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 72px; } }

.w-foot {
  display: flex; flex-wrap: wrap; gap: 14px 28px; justify-content: space-between; align-items: center;
  margin-top: 72px; padding: 18px 0 8px; border-top: 1px solid var(--w-line);
  font-size: 13.5px; color: var(--w-muted);
}
.w-foot b { font-family: var(--w-serif); font-size: 16px; color: var(--w-ink); }
.w-foot nav { display: flex; flex-wrap: wrap; gap: 18px; }
.w-foot a { color: var(--w-body); text-decoration: none; }
.w-foot a:hover { color: var(--w-ink); }

/* ── Docs layout ──────────────────────────────────────────────────────────── */
.w-docs {
  display: grid; grid-template-columns: 272px minmax(0, 1fr) 190px;
  gap: 44px; align-items: start; padding-top: 18px;
}
.w-side {
  position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto;
  background: var(--w-card); border: 1px solid var(--w-line); border-radius: 10px;
  padding: 12px 8px 14px;
}
.w-side summary { display: none; }
.w-side-search { padding: 4px 6px 10px; border-bottom: 1px solid var(--w-line); margin-bottom: 4px; }
.w-side-search label { display: block; font-family: var(--w-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--w-muted); margin: 2px 2px 6px; }
.w-side-search input {
  width: 100%; height: 38px; padding: 0 11px; border-radius: 6px; font-size: 14px;
  color: var(--w-ink); background: var(--w-well); border: 1px solid var(--w-line);
}
.w-side-search input:focus { outline: 2px solid var(--w-accent); outline-offset: 0; border-color: transparent; }
.w-side-group {
  font-family: var(--w-mono); font-size: 11px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--w-num); margin: 16px 10px 4px;
}
.w-side-link { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; }
.w-side-link b { display: block; font-size: 14px; font-weight: 600; color: var(--w-ink); }
.w-side-link span.w-side-desc { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--w-muted); }
.w-side-link:hover { background: var(--w-well); }
.w-side-link.is-current { background: var(--w-accent-soft); box-shadow: inset 0 0 0 1px var(--w-accent-line); }
.w-side-empty { display: none; padding: 10px; font-size: 13px; color: var(--w-muted); }
/* The filter and the contents list toggle `hidden`, and the UA's [hidden] rule
   loses to any author `display` of equal specificity loaded later — which is
   every rule in this file. Without this the filter hid nothing. */
.w-docs [hidden] { display: none !important; }

.w-toc { position: sticky; top: 88px; font-size: 13px; }
.w-toc .w-kicker { color: var(--w-num); font-size: 11px; font-weight: 600; }
.w-toc ol { list-style: none; margin: 10px 0 0; padding: 0; border-left: 1px solid var(--w-line); }
.w-toc a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; color: var(--w-muted); text-decoration: none; border-left: 2px solid transparent; }
.w-toc a:hover { color: var(--w-ink); }
.w-toc a.is-active { color: var(--w-ink); border-left-color: var(--w-accent); }

.w-doc-head { padding-bottom: 26px; border-bottom: 1px solid var(--w-line); margin-bottom: 8px; }
.w-doc-head .w-kicker { color: var(--w-accent); }
.w-doc-title {
  font-family: var(--w-serif); font-weight: 700; color: var(--w-ink);
  font-size: clamp(40px, 5.2vw, 68px); line-height: 1.02; letter-spacing: -.025em; margin: 12px 0 0;
}
html[lang^="zh"] .w-doc-title { font-size: clamp(34px, 4.4vw, 54px); line-height: 1.18; letter-spacing: 0; }
.w-doc-lead { font-size: 18.5px; line-height: 1.6; color: var(--w-body); margin: 18px 0 0; max-width: 44rem; }

.w-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 56px; }
.w-pager a { display: block; padding: 16px 18px; border: 1px solid var(--w-line); border-radius: 8px; background: var(--w-card); text-decoration: none; }
.w-pager a:hover { border-color: var(--w-line-strong); }
.w-pager small { display: block; font-family: var(--w-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--w-muted); }
.w-pager b { display: block; margin-top: 4px; font-size: 16px; color: var(--w-ink); }
.w-pager .is-next { text-align: right; grid-column: 2; }

@media (max-width: 1200px) {
  .w-docs { grid-template-columns: 250px minmax(0, 1fr); gap: 36px; }
  .w-toc { display: none; }
}
@media (max-width: 860px) {
  .w-docs { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 6px; }
  .w-side { position: static; max-height: none; padding: 0; }
  .w-side summary {
    display: flex; align-items: center; justify-content: space-between; cursor: pointer;
    padding: 12px 14px; font-weight: 600; font-size: 14px; color: var(--w-ink); list-style: none;
  }
  .w-side summary::-webkit-details-marker { display: none; }
  .w-side summary::after { content: '▾'; color: var(--w-muted); }
  .w-side[open] summary { border-bottom: 1px solid var(--w-line); }
  .w-side-inner { padding: 10px 8px 14px; }
}

/* ── Prose ────────────────────────────────────────────────────────────────── */
.w-prose { color: var(--w-body); font-size: 16.5px; line-height: 1.75; }
.w-prose > section { padding: 8px 0 18px; }
.w-prose > section + section { border-top: 1px solid var(--w-line); }
.w-prose h2 {
  font-family: var(--w-serif); font-weight: 700; color: var(--w-ink);
  font-size: clamp(28px, 3vw, 38px); line-height: 1.12; letter-spacing: -.015em;
  margin: 38px 0 14px; scroll-margin-top: 80px;
}
.w-prose h3 { font-family: var(--w-serif); font-weight: 700; color: var(--w-ink); font-size: 21px; line-height: 1.25; margin: 30px 0 8px; }
.w-prose p { margin: 0 0 16px; }
.w-prose ul, .w-prose ol { margin: 0 0 18px; padding-left: 1.35em; }
.w-prose ul { list-style: disc; }
.w-prose ol { list-style: decimal; }
.w-prose li { margin: 7px 0; padding-left: 2px; }
.w-prose li::marker { color: var(--w-muted); }
.w-prose strong { color: var(--w-ink); font-weight: 650; }
.w-prose a { color: var(--w-accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.w-prose code {
  font-family: var(--w-mono); font-size: .86em; color: var(--w-ink);
  background: var(--w-well); border: 1px solid var(--w-line); border-radius: 4px; padding: 1px 5px;
}
.w-prose pre {
  margin: 8px 0 20px; padding: 14px 16px; overflow-x: auto;
  background: var(--w-well); border: 1px solid var(--w-line); border-radius: 8px;
  font-family: var(--w-mono); font-size: 13.5px; line-height: 1.65; color: var(--w-ink);
}
.w-prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.w-table-wrap { overflow-x: auto; margin: 6px 0 20px; }
.w-prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
.w-prose th {
  text-align: left; font-weight: 600; font-size: 12.5px; color: var(--w-muted);
  border-bottom: 1px solid var(--w-line-strong); padding: 8px 12px 8px 0; white-space: nowrap;
}
.w-prose td { border-bottom: 1px solid var(--w-line); padding: 9px 12px 9px 0; vertical-align: top; }
.w-prose td.num, .w-prose th.num { text-align: right; font-family: var(--w-mono); font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.w-prose td.good { color: var(--w-good); }
.w-prose td.bad { color: var(--w-bad); }
.w-prose kbd { font-family: var(--w-mono); font-size: .82em; border: 1px solid var(--w-line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }

.w-callout {
  margin: 22px 0; padding: 14px 18px; border-left: 3px solid var(--w-accent);
  background: var(--w-well); border-radius: 0 8px 8px 0; font-size: 15.5px; line-height: 1.65;
}
.w-callout.is-warn { border-left-color: var(--w-num); }
.w-callout p:last-child { margin-bottom: 0; }

.w-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 24px;
  margin: 24px 0; padding: 22px 24px; border: 1px solid var(--w-line); border-radius: 10px;
  background: var(--w-well);
}
.w-stat-label { display: block; font-family: var(--w-mono); font-size: 11px; line-height: 1.4; letter-spacing: .12em; text-transform: uppercase; color: var(--w-muted); }
.w-stat-value { display: block; margin: 6px 0 2px; font-family: var(--w-read); font-weight: 700; font-size: 34px; line-height: 1.08; color: var(--w-ink); }
.w-stat-value.is-good { color: var(--w-good); }
.w-stat-value.is-bad { color: var(--w-bad); }
.w-stat-value.is-num { color: var(--w-num); }
/* Block, not inline: an inline span takes its line box from the parent's
   line-height, which inside .w-prose is the 1.75 body leading. */
.w-stat-note { display: block; font-size: 14px; line-height: 1.45; color: var(--w-body); }
@media (max-width: 640px) { .w-stats { grid-template-columns: minmax(0, 1fr); } }

.w-roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 10px 0 22px; }
.w-role {
  border: 1px solid var(--w-line); border-radius: 8px; background: var(--w-card);
  padding: 14px 16px; box-shadow: inset 3px 0 0 var(--seat, var(--w-accent));
}
.w-role-name { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; font-weight: 650; color: var(--w-ink); font-size: 15px; }
.w-role-name small { font-weight: 500; color: var(--w-muted); font-size: 12.5px; }
.w-role p { margin: 6px 0 0; font-size: 14.5px; line-height: 1.6; }
@media (max-width: 640px) { .w-roles { grid-template-columns: minmax(0, 1fr); } }

/* ── Research Lab ─────────────────────────────────────────────────────────── */
.w-lab-hero { padding: 72px 0 12px; max-width: 900px; }
.w-lab-hero .w-display { font-size: clamp(52px, 8vw, 112px); }
.w-postlist { list-style: none; margin: 72px 0 0; padding: 0; }
.w-postlist > li { padding: 34px 0 36px; border-top: 1px solid var(--w-line); display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 28px; }
.w-postlist > li:last-child { border-bottom: 1px solid var(--w-line); }
.w-post-date { font-family: var(--w-mono); font-size: 13px; color: var(--w-body); padding-top: 10px; }
.w-post-date small { display: block; margin-top: 4px; color: var(--w-muted); font-size: 12px; }
.w-post-link { text-decoration: none; }
.w-post-link h2 {
  font-family: var(--w-serif); font-weight: 700; color: var(--w-ink);
  font-size: clamp(30px, 3.6vw, 46px); line-height: 1.06; letter-spacing: -.02em; margin: 0;
  text-wrap: balance;
}
html[lang^="zh"] .w-post-link h2 { line-height: 1.22; letter-spacing: 0; }
.w-post-link:hover h2 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.w-post-sum { margin: 14px 0 0; font-size: 16.5px; line-height: 1.65; color: var(--w-body); max-width: 46rem; }
.w-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.w-tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--w-line-strong); background: var(--w-card);
  font-family: var(--w-mono); font-size: 11.5px; color: var(--w-body);
}
@media (max-width: 760px) {
  .w-postlist > li { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .w-post-date { padding-top: 0; }
}

.w-article { max-width: 760px; margin: 0 auto; padding-top: 40px; }
.w-article-trail { font-family: var(--w-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--w-muted); }
.w-article-trail a { color: inherit; text-decoration: none; }
.w-article-trail a:hover { color: var(--w-ink); }
.w-article-title {
  font-family: var(--w-serif); font-weight: 700; color: var(--w-ink);
  font-size: clamp(38px, 5.4vw, 62px); line-height: 1.04; letter-spacing: -.022em; margin: 14px 0 0;
  text-wrap: balance;
}
html[lang^="zh"] .w-article-title { font-size: clamp(32px, 4.4vw, 50px); line-height: 1.2; letter-spacing: 0; }
.w-article-meta { margin-top: 16px; font-family: var(--w-mono); font-size: 12.5px; color: var(--w-muted); }
.w-article-lead {
  font-family: var(--w-read); font-size: 19.5px; line-height: 1.62; color: var(--w-ink);
  margin: 22px 0 0; padding-bottom: 30px; border-bottom: 1px solid var(--w-line);
}
.w-article .w-prose > section + section { border-top: 0; }
.w-article .w-prose h2 { margin-top: 44px; }
.w-repro { margin-top: 20px; }
.w-article-foot { margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--w-line); font-size: 14px; line-height: 1.65; color: var(--w-muted); }

/* A figure of horizontal bars drawn in CSS: a handful of numbers does not need
   a charting library, and a canvas would need the CT.c() theme mapping. */
.w-hbars { margin: 10px 0 22px; display: grid; gap: 7px; }
.w-hbar-row { display: grid; grid-template-columns: minmax(0, 13em) minmax(0, 1fr) 5.2em; gap: 10px; align-items: center; font-size: 14px; }
.w-hbar-row .w-hbar-label { color: var(--w-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-hbar-track { position: relative; height: 12px; background: var(--w-well); border: 1px solid var(--w-line); border-radius: 3px; }
.w-hbar-fill { position: absolute; top: -1px; bottom: -1px; border-radius: 3px; background: var(--w-good); }
.w-hbar-fill.is-neg { background: var(--w-bad); }
.w-hbar-zero { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--w-line-strong); }
.w-hbar-val { text-align: right; font-family: var(--w-mono); font-size: 13px; font-variant-numeric: tabular-nums; color: var(--w-ink); }
@media (max-width: 560px) { .w-hbar-row { grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr) 4.6em; font-size: 13px; } }

@media (prefers-reduced-motion: reduce) {
  a.w-card, .w-btn, .w-log li { transition: none; }
  a.w-card:hover, .w-btn-primary:hover { transform: none; }
  .w-log li[data-state="active"] .w-log-state::before { animation: none; }
}
