/* ==========================================================================
   docling.org — "detection blueprint" design system
   Warm paper, ink, one signal orange. The interface borrows Docling's own
   visual language: crop marks, layout boxes and the labels Docling assigns
   (section_header, table, chart, code …). No gradients, no glass.
   Tokens on :root; dark ("drafting ink") under the OS media query (guarded so
   an explicit light choice wins) and under [data-theme="dark"] for the toggle.
   ========================================================================== */

@property --cm { syntax: "<color>"; inherits: true; initial-value: transparent; }

:root {
  color-scheme: light;
  --bg: #f3f0e8;
  --bg-2: #ece8dd;
  --surface: #fbfaf6;
  --surface-2: #f6f3ec;
  --sheet: #ffffff;
  --ink: #141413;
  --ink-2: #3d3b36;
  --muted: #6b675e;
  --faint: #8f8a7e;
  --line: #ddd8cb;
  --line-2: #c6bfae;
  --accent: #e0531f;          /* signal orange — marks, boxes, focus */
  --accent-ink: #b8400f;      /* text-safe orange (4.9:1 on paper) */
  --accent-soft: rgba(224, 83, 31, .08);
  --accent-mark: rgba(224, 83, 31, .22);
  --accent-2: var(--accent);
  --code-bg: #161614;
  --code-ink: #ebe6da;
  --code-line: #2b2a25;
  --good: #1b7a55;
  --warn: #9a6200;
  --bad: #b8321f;
  --header-bg: rgba(243, 240, 232, .9);
  --shadow: 0 1px 0 rgba(20, 20, 19, .04);
  --shadow-2: 0 18px 40px -28px rgba(20, 20, 19, .35);
  /* data-viz categorical slots (validated on #fbfaf6) + neutral context */
  --s1: #e0531f; --s2: #2a64b3; --s3: #1b8a68; --s4: #b07d0c;
  --s5: #a8467a; --s6: #4f7d1f; --s7: #6b5fc7; --s8: #c23a3a;
  --ctx: #aaa497;
  --grid: #e6e1d5;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .055 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --radius: 4px;
  --radius-lg: 6px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --wrap: 1200px;
  --prose: 740px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f0d; --bg-2: #141412; --surface: #181815; --surface-2: #1c1c19; --sheet: #f4f1ea;
    --ink: #ece8de; --ink-2: #c3beb1; --muted: #948f83; --faint: #6a665c;
    --line: #2a2924; --line-2: #3d3b34;
    --accent: #ff6a3d; --accent-ink: #ff8c63; --accent-soft: rgba(255, 106, 61, .09); --accent-mark: rgba(255, 106, 61, .28);
    --code-bg: #121210; --code-line: #2a2924;
    --good: #4cc08a; --warn: #e6b04a; --bad: #ff7a64;
    --header-bg: rgba(15, 15, 13, .9);
    --shadow: 0 1px 0 rgba(0, 0, 0, .3); --shadow-2: 0 24px 50px -30px rgba(0, 0, 0, .9);
    --s1: #e65a2a; --s2: #4f87d6; --s3: #2aa37e; --s4: #b8860f;
    --s5: #c4638f; --s6: #6a9a30; --s7: #8a7fdc; --s8: #df5555;
    --ctx: #57544c; --grid: #24231f;
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0d; --bg-2: #141412; --surface: #181815; --surface-2: #1c1c19; --sheet: #f4f1ea;
  --ink: #ece8de; --ink-2: #c3beb1; --muted: #948f83; --faint: #6a665c;
  --line: #2a2924; --line-2: #3d3b34;
  --accent: #ff6a3d; --accent-ink: #ff8c63; --accent-soft: rgba(255, 106, 61, .09); --accent-mark: rgba(255, 106, 61, .28);
  --code-bg: #121210; --code-line: #2a2924;
  --good: #4cc08a; --warn: #e6b04a; --bad: #ff7a64;
  --header-bg: rgba(15, 15, 13, .9);
  --shadow: 0 1px 0 rgba(0, 0, 0, .3); --shadow-2: 0 24px 50px -30px rgba(0, 0, 0, .9);
  --s1: #e65a2a; --s2: #4f87d6; --s3: #2aa37e; --s4: #b8860f;
  --s5: #c4638f; --s6: #6a9a30; --s7: #8a7fdc; --s8: #df5555;
  --ctx: #57544c; --grid: #24231f;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0; background: var(--bg) var(--grain); color: var(--ink);
  font: 400 16.5px/1.7 var(--font); font-feature-settings: "ss01", "tnum" 0;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden;
}
:lang(zh) body, :lang(ja) body, body:lang(zh), body:lang(ja) { line-height: 1.85; letter-spacing: .01em; }
img, svg { max-width: 100%; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--accent-mark); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--bg); padding: 8px 14px; }
.skip:focus { left: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.12; letter-spacing: -.03em; font-weight: 600; margin: 0; }
:lang(zh) h1, :lang(ja) h1, :lang(zh) h2, :lang(ja) h2 { letter-spacing: 0; line-height: 1.3; }
.serif { font-weight: 350; color: var(--muted); letter-spacing: -.035em; }
:lang(zh) .serif, :lang(ja) .serif { letter-spacing: 0; font-weight: 400; }
code, kbd, pre { font-family: var(--mono); font-size: .86em; }
:not(pre) > code { background: var(--surface-2); color: var(--ink); padding: .1em .38em; border-radius: 2px; border: 1px solid var(--line); word-break: break-word; }
kbd { border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: .05em .4em; background: var(--surface); }

/* ---------- crop marks (shared) ---------- */
.card, .viz, .tool, .stage, .diagram, .tldr, .feedback, .embed, .result-card, .kpi, .opt { position: relative; }
.card::before, .viz::before, .tool::before, .stage::before, .diagram::before, .tldr::before, .embed::before {
  --cm: var(--line-2); --cl: 11px; --cw: 1.5px;
  content: ""; position: absolute; inset: -1px; pointer-events: none; z-index: 2;
  background:
    linear-gradient(var(--cm), var(--cm)) top left / var(--cl) var(--cw),
    linear-gradient(var(--cm), var(--cm)) top left / var(--cw) var(--cl),
    linear-gradient(var(--cm), var(--cm)) top right / var(--cl) var(--cw),
    linear-gradient(var(--cm), var(--cm)) top right / var(--cw) var(--cl),
    linear-gradient(var(--cm), var(--cm)) bottom left / var(--cl) var(--cw),
    linear-gradient(var(--cm), var(--cm)) bottom left / var(--cw) var(--cl),
    linear-gradient(var(--cm), var(--cm)) bottom right / var(--cl) var(--cw),
    linear-gradient(var(--cm), var(--cm)) bottom right / var(--cw) var(--cl);
  background-repeat: no-repeat;
  transition: --cm .25s, background-size .3s cubic-bezier(.2,.7,.2,1);
}
.stage::before, .tool::before { --cm: var(--ink); }

/* ---------- independence ribbon ---------- */
.ribbon { font: 500 11.5px/1.4 var(--mono); letter-spacing: .02em; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--bg-2); }
.ribbon .wrap { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 7px 0; text-align: center; }
.ribbon a { color: var(--ink-2); }
.ribbon .dot { width: 6px; height: 6px; background: var(--accent); flex-shrink: 0; animation: rec 2s steps(1) infinite; }
@keyframes rec { 50% { opacity: .25; } }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 650; letter-spacing: -.03em; font-size: 17px; flex-shrink: 0; }
.brand svg { width: 28px; height: 28px; flex-shrink: 0; }
.brand small { display: block; font: 500 10px var(--mono); color: var(--muted); letter-spacing: .04em; margin-top: 3px; line-height: 1.1; text-transform: uppercase; }
:lang(zh) .brand small, :lang(ja) .brand small { text-transform: none; letter-spacing: .02em; }
.brand-txt { line-height: 1.05; }
.nav-main { display: flex; gap: 2px; margin-left: 14px; padding: 0; margin-block: 0; }
.nav-main > li { list-style: none; position: relative; }
.nav-link { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; color: var(--ink-2); text-decoration: none; font-size: 14.5px; font-weight: 500; background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav-link::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .25s cubic-bezier(.2,.7,.2,1); }
.nav-link:hover, .nav-link[aria-expanded="true"], .nav-link.active { color: var(--ink); }
.nav-link:hover::after, .nav-link.active::after, .nav-link[aria-expanded="true"]::after { transform: none; }
.nav-link svg { width: 12px; height: 12px; transition: transform .2s; }
.nav-link[aria-expanded="true"] svg { transform: rotate(180deg); }
.mega { position: absolute; top: calc(100% + 12px); left: -12px; width: 640px; padding: 8px; background: var(--surface); border: 1px solid var(--ink); box-shadow: 6px 6px 0 var(--accent-soft), var(--shadow-2); display: grid; grid-template-columns: 1fr 1fr; gap: 0; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .16s, transform .16s, visibility .16s; }
.mega.narrow { width: 380px; grid-template-columns: 1fr; }
.mega.open { opacity: 1; visibility: visible; transform: none; }
.mega a { position: relative; display: flex; gap: 12px; padding: 12px; text-decoration: none; color: var(--ink); align-items: flex-start; border: 1px solid transparent; }
.mega a:hover, .mega a:focus-visible { background: var(--bg); border-color: var(--line); }
.mega .mi { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line-2); color: var(--ink); flex-shrink: 0; transition: color .2s, border-color .2s; }
.mega a:hover .mi { color: var(--accent); border-color: var(--accent); }
.mega .mi svg { width: 17px; height: 17px; }
.mega b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.mega span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; text-decoration: none; transition: border-color .15s, color .15s; }
.icon-btn:hover { color: var(--ink); border-color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
.lang { position: relative; }
.lang-btn { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; align-items: center; font: 600 11.5px var(--mono); letter-spacing: .06em; }
.lang-menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--ink); box-shadow: var(--shadow-2); padding: 4px; min-width: 170px; display: none; }
.lang-menu.open { display: block; }
.lang-menu a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; text-decoration: none; color: var(--ink); font-size: 14px; }
.lang-menu a:hover { background: var(--bg); }
.lang-menu a[aria-current] { color: var(--accent-ink); font-weight: 600; }
.lang-menu small { color: var(--muted); font-family: var(--mono); }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}
.menu-btn { display: none; }
.drawer { display: none; }

/* ---------- buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 20px; height: 46px; border-radius: 0; font: 600 15px var(--font); text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: transform .18s cubic-bezier(.2,.7,.2,1), box-shadow .18s cubic-bezier(.2,.7,.2,1), background .2s, color .2s; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; transition: transform .2s; }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { transform: translate(-3px, -3px); box-shadow: 3px 3px 0 var(--accent); }
.btn-primary:hover svg { transform: translateX(3px); }
.btn-ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.btn-sm { height: 36px; padding: 0 13px; font-size: 13.5px; }

/* ---------- hero (home) ---------- */
.hero { position: relative; padding: 76px 0 40px; isolation: isolate; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .7; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 48px 48px; -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%); mask-image: linear-gradient(180deg, #000, transparent 70%); }
.hero-grid { display: grid; grid-template-columns: 1.08fr 1fr; gap: 56px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; font: 500 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); padding: 8px 11px; border: 1px solid var(--ink); background: var(--surface); }
:lang(zh) .eyebrow, :lang(ja) .eyebrow { letter-spacing: .03em; }
.eyebrow .pulse { width: 7px; height: 7px; background: var(--accent); animation: rec 2s steps(1) infinite; }
.hero h1 { font-size: clamp(40px, 4.7vw, 66px); line-height: 1; letter-spacing: -.048em; margin: 24px 0 22px; font-weight: 600; }
:lang(zh) .hero h1, :lang(ja) .hero h1 { font-size: clamp(34px, 4.6vw, 58px); line-height: 1.2; letter-spacing: -.01em; }
.hero h1 .serif { color: var(--ink); font-weight: 600; letter-spacing: inherit; background-image: linear-gradient(var(--accent-mark), var(--accent-mark)); background-repeat: no-repeat; background-position: 0 88%; background-size: 100% .28em; padding: 0 .04em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.js .hero h1 .serif { background-size: 0 .28em; animation: mark 1.1s .5s cubic-bezier(.6,0,.2,1) forwards; }
@keyframes mark { to { background-size: 100% .28em; } }
.lede { font-size: 19px; line-height: 1.6; color: var(--ink-2); max-width: 58ch; margin: 0; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 28px; font: 500 12.5px var(--mono); color: var(--muted); }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta svg { width: 14px; height: 14px; color: var(--accent); }

/* the scan stage */
.stage { padding: 0; background: var(--surface); border: 1px solid var(--ink); box-shadow: 10px 10px 0 var(--accent-soft); }
.stage-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font: 500 11.5px var(--mono); color: var(--muted); background: var(--surface-2); }
.stage-top i { display: none; }
.stage-top::before { content: ""; width: 7px; height: 7px; background: var(--accent); animation: rec 2s steps(1) infinite; }
.stage-top .ttl { color: var(--ink-2); }
.stage-top .ver { margin-left: auto; color: var(--accent-ink); }
.stage-body { display: grid; grid-template-columns: 1fr 1.1fr; gap: 0; }
.page-mock { position: relative; aspect-ratio: 8.5/11; background: var(--sheet); margin: 18px; padding: 9% 8%; overflow: hidden; color: #1b1b19; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 12px 24px -16px rgba(0,0,0,.4); cursor: crosshair; }
.page-mock .ln { height: 5px; background: #d9d5ca; margin: 0 0 5px; }
.page-mock .ln.w9 { width: 92%; } .page-mock .ln.w8 { width: 80%; } .page-mock .ln.w7 { width: 70%; } .page-mock .ln.w6 { width: 60%; } .page-mock .ln.w4 { width: 42%; }
.page-mock .ttl { height: 11px; width: 74%; background: #1d1d1b; margin: 2px auto 6px; }
.page-mock .sub { height: 6px; width: 46%; background: #8c877c; margin: 0 auto 12px; }
.page-mock .h { height: 7px; width: 38%; background: #3a3833; margin: 10px 0 7px; }
.page-mock .tbl { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 2px; margin: 8px 0; }
.page-mock .tbl i { height: 7px; background: #e8e4da; }
.page-mock .tbl i.hd { background: #b3ad9f; }
.page-mock .fig { height: 50px; margin: 8px 0; background: #ece8de; position: relative; overflow: hidden; }
.page-mock .fig::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: 8px; height: 30px; background: repeating-linear-gradient(90deg, #b3ad9f 0 7px, transparent 7px 13px); clip-path: polygon(0 60%, 14% 40%, 28% 70%, 42% 20%, 57% 45%, 71% 10%, 86% 35%, 100% 0, 100% 100%, 0 100%); }
.page-mock .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scanline { position: absolute; left: 0; right: 0; height: 2px; top: -2px; background: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft), 0 -26px 30px -6px var(--accent-soft); pointer-events: none; }
.scanline::after { content: "SCAN"; position: absolute; right: 4px; top: 4px; font: 600 7px/1 var(--mono); color: var(--accent); letter-spacing: .1em; }
.bbox { position: absolute; border: 1.25px solid currentColor; opacity: 0; transform: scale(1.04); transition: opacity .3s, transform .45s cubic-bezier(.2,.7,.2,1); pointer-events: none; background: color-mix(in srgb, currentColor 7%, transparent); }
.bbox::before { content: attr(data-l); position: absolute; top: -10px; left: -1.25px; font: 600 7px/1 var(--mono); padding: 1.5px 4px; background: currentColor; letter-spacing: .03em; }
.bbox::after { content: attr(data-l); position: absolute; top: -10px; left: -1.25px; font: 600 7px/1 var(--mono); padding: 1.5px 4px; color: #fff; letter-spacing: .03em; }
.bbox.on { opacity: 1; transform: none; }
.el-title { color: var(--s1); } .el-text { color: var(--s2); } .el-table { color: var(--s3); } .el-picture { color: var(--s5); } .el-header { color: var(--s4); } .el-list { color: var(--s6); }
.xhair { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s; }
.page-mock:hover .xhair { opacity: 1; }
.xhair i { position: absolute; background: var(--accent); }
.xhair .xh { left: 0; right: 0; height: 1px; top: var(--y, 50%); }
.xhair .xv { top: 0; bottom: 0; width: 1px; left: var(--x, 50%); }
.xhair b { position: absolute; left: calc(var(--x, 50%) + 6px); top: calc(var(--y, 50%) + 6px); font: 600 8px/1 var(--mono); color: #fff; background: var(--ink); padding: 3px 5px; white-space: nowrap; }
.out-panel { display: flex; flex-direction: column; min-width: 0; background: var(--code-bg); border-left: 1px solid var(--ink); overflow: hidden; }
.out-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--code-line); }
.out-tabs button { flex: 1; font: 600 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #8a857a; background: none; border: 0; border-right: 1px solid var(--code-line); padding: 10px 4px; cursor: pointer; }
.out-tabs button:last-child { border-right: 0; }
.out-tabs button[aria-selected="true"] { color: #fff; background: #1f1f1c; box-shadow: inset 0 -2px 0 var(--accent); }
.out-code { flex: 1; margin: 0; padding: 14px; font: 11.2px/1.7 var(--mono); color: var(--code-ink); white-space: pre-wrap; word-break: break-word; overflow: hidden; min-height: 280px; }
.out-code .cur { display: inline-block; width: 6px; height: 13px; background: var(--accent); vertical-align: -2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.stage-steps { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.stage-steps span { font: 600 10.5px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--faint); padding: 10px 12px; border-right: 1px solid var(--line); position: relative; transition: color .3s; }
.stage-steps span:last-child { border-right: 0; }
.stage-steps span::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.stage-steps span.on { color: var(--ink); }
.stage-steps span.on::after { transform: none; }

/* ---------- stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin: 64px 0 0; }
.stat { padding: 22px 18px 20px; border-right: 1px solid var(--line); position: relative; }
.stat:last-child { border-right: 0; }
.stat::before { content: attr(data-n); position: absolute; top: 10px; right: 12px; font: 500 10px var(--mono); color: var(--faint); }
.stat b { display: block; font: 500 34px/1.05 var(--mono); letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat span { display: block; font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.stat-src { font: 500 11.5px var(--mono); color: var(--faint); margin-top: 12px; }

/* ---------- sections ---------- */
.section { padding: 104px 0 0; }
.section-head { max-width: 780px; margin-bottom: 40px; }
.section-head.center { margin-inline: auto; text-align: center; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font: 500 11.5px var(--mono); color: var(--accent-ink); letter-spacing: .1em; text-transform: uppercase; }
.kicker::before { content: ""; width: 18px; height: 1px; background: currentColor; }
.section h2, .h2 { font-size: clamp(32px, 4vw, 52px); letter-spacing: -.045em; margin: 14px 0 16px; line-height: 1.02; }
:lang(zh) .section h2, :lang(ja) .section h2 { letter-spacing: 0; line-height: 1.3; }
.section-head p { font-size: 18px; color: var(--ink-2); margin: 0; }

/* pipeline explainer */
.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); counter-reset: st; border: 1px solid var(--line); }
.pipe { position: relative; padding: 22px 18px 20px; border-right: 1px solid var(--line); background: var(--surface); transition: background .25s; }
.pipe:last-child { border-right: 0; }
.pipe:hover { background: var(--surface-2); }
.pipe::before { counter-increment: st; content: "0" counter(st); font: 500 11px var(--mono); color: var(--accent-ink); }
.pipe h3 { font-size: 17px; margin: 10px 0 6px; letter-spacing: -.02em; }
.pipe p { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.55; }
.pipe .t { margin-top: 14px; font: 500 11.5px var(--mono); color: var(--ink); padding-top: 10px; border-top: 1px dashed var(--line-2); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cards > * { min-width: 0; }
.cards.two { grid-template-columns: repeat(2, 1fr); }
.cards.four { grid-template-columns: repeat(4, 1fr); }
.viz-stack { display: grid; gap: 18px; max-width: 980px; }
.viz-stack .viz { margin-top: 0; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 24px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); transition: transform .25s cubic-bezier(.2,.7,.2,1), border-color .25s, box-shadow .25s; }
a.card:hover { border-color: var(--line-2); transform: translateY(-3px); box-shadow: var(--shadow-2); }
a.card:hover::before { --cm: var(--accent); --cl: 22px; --cw: 2px; }
.card .ci { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line-2); color: var(--ink); margin-bottom: 8px; transition: color .25s, border-color .25s, background .25s; }
a.card:hover .ci { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.card .ci svg { width: 19px; height: 19px; }
.card h3 { font-size: 19px; letter-spacing: -.025em; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.card .more { margin-top: auto; padding-top: 12px; font: 600 12px var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink); display: inline-flex; gap: 8px; align-items: center; }
:lang(zh) .card .more, :lang(ja) .card .more { text-transform: none; letter-spacing: 0; }
a.card:hover .more { color: var(--accent-ink); }
.card .tag { position: absolute; top: 16px; right: 16px; font: 500 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); border: 1px solid currentColor; padding: 3px 6px; }

/* ---------- page hero (guides) ---------- */
.page-hero { position: relative; padding: 56px 0 44px; border-bottom: 1px solid var(--ink); isolation: isolate; overflow: hidden; }
.page-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .75; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 32px 32px; -webkit-mask-image: linear-gradient(100deg, transparent 35%, #000 85%); mask-image: linear-gradient(100deg, transparent 35%, #000 85%); }
.page-hero::after { content: attr(data-coord); position: absolute; right: 16px; bottom: 12px; font: 500 10.5px var(--mono); color: var(--faint); letter-spacing: .05em; }
.crumbs { display: flex; gap: 8px; align-items: center; font: 500 12px var(--mono); color: var(--muted); margin-bottom: 22px; flex-wrap: wrap; padding: 0; list-style: none; letter-spacing: .02em; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--faint); }
.page-hero h1 { font-size: clamp(36px, 4.8vw, 62px); letter-spacing: -.05em; line-height: 1; max-width: 20ch; margin: 16px 0 20px; }
:lang(zh) .page-hero h1, :lang(ja) .page-hero h1 { letter-spacing: 0; line-height: 1.25; max-width: 24ch; }
.page-hero .lede { font-size: 19.5px; max-width: 64ch; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.chip { display: inline-flex; align-items: center; gap: 7px; font: 500 11.5px var(--mono); color: var(--ink-2); padding: 6px 10px; border: 1px solid var(--line-2); background: var(--surface); letter-spacing: .01em; }
.chip svg { width: 13px; height: 13px; color: var(--ink); }
.chip.ok svg { color: var(--good); }
.tldr { margin-top: 32px; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); max-width: 880px; }
.tldr::before { --cm: var(--ink); }
.tldr b.k { display: inline-block; font: 600 10.5px var(--mono); color: var(--bg); background: var(--ink); text-transform: uppercase; letter-spacing: .1em; padding: 3px 7px; margin-bottom: 12px; }
.tldr ul { margin: 0; padding-left: 0; list-style: none; counter-reset: tl; }
.tldr li { margin: 7px 0; color: var(--ink-2); position: relative; padding-left: 30px; }
.tldr li::before { counter-increment: tl; content: "0" counter(tl); position: absolute; left: 0; top: .35em; font: 500 11px var(--mono); color: var(--accent-ink); }

/* ---------- article layout ---------- */
.doc { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 64px; padding: 48px 0 40px; }
.toc { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; font-size: 13.5px; padding-right: 6px; }
.toc b { display: block; font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin-bottom: 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); counter-reset: tc; }
.toc li { counter-increment: tc; }
.toc a { display: grid; grid-template-columns: 22px 1fr; padding: 6px 0 6px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc a::before { content: counter(tc, decimal-leading-zero); font: 500 10.5px/1.9 var(--mono); color: var(--faint); }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--ink); border-left-color: var(--accent); font-weight: 550; }
.toc a.on::before { color: var(--accent-ink); }
.toc .toc-cta { margin-top: 22px; padding: 14px; border: 1px dashed var(--line-2); font-size: 13px; color: var(--muted); }
.toc .toc-cta a { display: inline; padding: 0; border: 0; color: var(--accent-ink); }
.toc .toc-cta a::before { content: none; }
.prose { max-width: var(--prose); min-width: 0; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 { font-size: 32px; margin-top: 2.3em; padding-top: .2em; letter-spacing: -.04em; scroll-margin-top: 92px; }
.prose h3 { font-size: 21px; margin-top: 1.8em; letter-spacing: -.025em; }
.prose h2 + p, .prose h3 + p { margin-top: .6em; }
.prose p, .prose li { color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .4em 0; }
.prose ul > li::marker { color: var(--accent); content: "▪  "; font-size: .8em; }
.prose ol > li::marker { color: var(--faint); font-family: var(--mono); font-size: .85em; }
.prose .anchor { margin-left: 10px; color: var(--faint); text-decoration: none; opacity: 0; font-weight: 400; font-family: var(--mono); font-size: .6em; vertical-align: middle; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; color: var(--accent-ink); }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.4em 0; }
.prose .wide { width: min(1040px, calc(100vw - 32px)); max-width: none; }
.prose blockquote { margin-left: 0; padding: 4px 0 4px 18px; border-left: 2px solid var(--accent); color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14.2px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 500 10.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); white-space: nowrap; border-bottom-color: var(--line-2); }
tbody th { font: 600 13px var(--font); letter-spacing: 0; text-transform: none; color: var(--ink); white-space: normal; }
:lang(zh) th, :lang(ja) th { letter-spacing: .02em; text-transform: none; font-size: 12px; }
tr:last-child td, tr:last-child th { border-bottom: 0; }
td code { white-space: nowrap; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--surface-2); }
caption { caption-side: bottom; text-align: left; font: 500 11.5px var(--mono); color: var(--muted); padding: 10px 14px; border-top: 1px solid var(--line); }
.yes { color: var(--good); font-weight: 600; } .no { color: var(--bad); font-weight: 600; } .part { color: var(--warn); font-weight: 600; }

/* code blocks */
.code { position: relative; margin-top: 1.2em; background: var(--code-bg); border: 1px solid var(--code-line); overflow: hidden; }
.code::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: .9; }
.code-bar { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 16px; border-bottom: 1px solid var(--code-line); font: 500 11px var(--mono); color: #8a857a; letter-spacing: .03em; }
.code-bar .lang-tag { text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.code-bar .ttl { color: #c9c4b8; }
.copy { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font: 600 11px var(--mono); letter-spacing: .04em; text-transform: uppercase; color: #c9c4b8; background: transparent; border: 1px solid #3a3933; padding: 5px 9px; cursor: pointer; transition: all .15s; }
.copy:hover { color: #121210; background: #ebe6da; border-color: #ebe6da; }
.copy svg { width: 12px; height: 12px; }
.copy.ok { color: #121210; background: var(--accent); border-color: var(--accent); }
.code pre { margin: 0; padding: 16px 18px 16px 20px; overflow-x: auto; color: var(--code-ink); font-size: 13.4px; line-height: 1.72; tab-size: 4; }
.code pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
.t-c { color: #75705f; font-style: italic; } .t-s { color: #b9d38c; } .t-k { color: #ff9466; } .t-n { color: #e9c66b; }
.t-f { color: #8cc2ff; } .t-t { color: #f0d68f; } .t-o { color: #7fd6c2; } .t-v { color: #f0a7c0; } .t-p { color: #75705f; user-select: none; } .t-a { color: #a8cfe9; }
.code.out pre { color: #bdb8ab; }
.code-note { font: 500 12px var(--mono); color: var(--muted); margin-top: .5em !important; }

/* callouts */
.callout { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 16px 18px 16px 16px; border: 1px solid var(--line); border-left: 3px solid var(--c, var(--ink)); background: var(--surface); }
.callout svg { width: 19px; height: 19px; margin-top: 3px; color: var(--c, var(--ink)); }
.callout p { margin: 0; color: var(--ink-2); }
.callout p + p { margin-top: .5em; }
.callout.note { --c: var(--s2); }
.callout.tip { --c: var(--good); }
.callout.warn { --c: var(--warn); background: color-mix(in srgb, var(--warn) 5%, var(--surface)); }
.callout.measured { --c: var(--accent); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }

/* steps */
.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps > li { position: relative; padding: 2px 0 20px 54px; margin: 0 !important; }
.steps > li::before { counter-increment: step; content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 0; width: 34px; height: 30px; display: grid; place-items: center; font: 500 12.5px var(--mono); color: var(--bg); background: var(--ink); }
.steps > li::after { content: ""; position: absolute; left: 16.5px; top: 36px; bottom: 4px; width: 1px; background: repeating-linear-gradient(var(--line-2) 0 4px, transparent 4px 8px); }
.steps > li:last-child::after { display: none; }
.steps > li > b:first-child { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* diagrams */
.diagram { margin-top: 1.6em; padding: 22px; border: 1px solid var(--line); background: var(--surface); overflow-x: auto; }
.diagram svg { display: block; width: 100%; min-width: 560px; height: auto; }
.diagram figcaption { font: 500 11.5px var(--mono); color: var(--muted); margin-top: 12px; }
.dg-box { fill: var(--surface-2); stroke: var(--line-2); stroke-width: 1.2; rx: 2px; ry: 2px; }
.dg-box.acc { fill: color-mix(in srgb, var(--accent) 7%, var(--surface)); stroke: var(--accent); }
.dg-box.acc2 { fill: var(--surface); stroke: var(--ink); }
.dg-t { fill: var(--ink); font: 600 13px var(--font); }
.dg-s { fill: var(--muted); font: 400 11.5px var(--font); }
.dg-m { fill: var(--muted); font: 500 10.5px var(--mono); }
.dg-line { stroke: var(--line-2); stroke-width: 1.5; fill: none; }
.dg-flow { stroke: var(--accent); stroke-width: 1.8; fill: none; stroke-dasharray: 4 6; animation: flow 1.1s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -20; } }
.dg-arrow { fill: var(--line-2); }
.dg-arrow.acc { fill: var(--accent); }

/* ---------- charts ---------- */
.viz { margin: 1.8em 0 0; padding: 22px 22px 16px; border: 1px solid var(--line); background: var(--surface); }
.viz figcaption { display: block; margin-bottom: 14px; }
.viz-title { display: block; font-weight: 600; font-size: 16.5px; color: var(--ink); letter-spacing: -.02em; }
.viz-sub { display: block; font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; font-size: 13px; color: var(--ink-2); }
.lg { display: inline-flex; align-items: center; gap: 7px; }
.key { display: inline-block; width: 10px; height: 10px; background: var(--c); }
.key.ln { height: 2px; width: 16px; }
.viz-plot { position: relative; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); }
.chart .grid { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .axis { stroke: var(--ink); stroke-width: 1; }
.chart .tick { fill: var(--muted); font: 500 10.5px var(--mono); font-variant-numeric: tabular-nums; }
.chart .label { fill: var(--ink-2); font-size: 13px; font-weight: 500; }
.chart .value { fill: var(--ink); font: 600 11.5px var(--mono); font-variant-numeric: tabular-nums; }
.chart .end-label { fill: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.chart .annot { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .annot-t { fill: var(--muted); font: 500 10.5px var(--mono); }
.chart .bar, .chart .col { fill: var(--c, var(--s1)); }
.chart .bar.dim { opacity: .38; }
.chart .line { stroke: var(--c, var(--s1)); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--c, var(--s1)); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .crosshair { stroke: var(--accent); stroke-width: 1; opacity: 0; pointer-events: none; }
.chart.hovering .crosshair { opacity: 1; }
.s1 { --c: var(--s1); } .s2 { --c: var(--s2); } .s3 { --c: var(--s3); } .s4 { --c: var(--s4); }
.s5 { --c: var(--s5); } .s6 { --c: var(--s6); } .s7 { --c: var(--s7); } .s8 { --c: var(--s8); } .ctx { --c: var(--ctx); }
.chart .bar, .chart .col { transition: opacity .2s; }
.chart:has(.bar:hover) .bar:not(:hover), .chart:has(.col:hover) .col:not(:hover) { opacity: .5; }
.js .viz:not(.in) .bar { transform: scaleX(0); }
.js .viz:not(.in) .col { transform: scaleY(0); }
.js .viz:not(.in) .line { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .viz:not(.in) .dot, .js .viz:not(.in) .value, .js .viz:not(.in) .end-label { opacity: 0; }
.chart .bar { transform-box: fill-box; transform-origin: left center; transition: transform .9s cubic-bezier(.2,.7,.2,1) calc(var(--i, 0) * 70ms), opacity .2s; }
.chart .col { transform-box: fill-box; transform-origin: center bottom; transition: transform .8s cubic-bezier(.2,.7,.2,1) calc(var(--i, 0) * 25ms), opacity .2s; }
.chart .line { stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 1.6s cubic-bezier(.4,.1,.2,1); }
.chart .dot, .chart .value, .chart .end-label { transition: opacity .5s .9s; }
.viz-source { font: 500 11px var(--mono); color: var(--faint); margin: 14px 0 0; letter-spacing: .01em; }
.viz-source a { color: var(--muted); }
.viz-table { margin-top: 10px; font-size: 13.5px; }
.viz-table summary { cursor: pointer; color: var(--muted); font: 500 11.5px var(--mono); width: max-content; text-transform: uppercase; letter-spacing: .06em; }
:lang(zh) .viz-table summary, :lang(ja) .viz-table summary { text-transform: none; }
.viz-table summary:hover { color: var(--accent-ink); }
.viz-table .table-wrap { margin-top: 10px; max-height: 340px; }
.tip { position: fixed; z-index: 90; pointer-events: none; background: var(--ink); color: var(--bg); font: 500 12px/1.45 var(--mono); padding: 7px 10px; max-width: 280px; border-left: 2px solid var(--accent); opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.tip.on { opacity: 1; transform: none; }

/* ---------- tools ---------- */
.tool { margin-top: 1.6em; border: 1px solid var(--ink); background: var(--surface); box-shadow: 10px 10px 0 var(--accent-soft); }
.tool-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.tool-head h3 { font-size: 16px; letter-spacing: -.02em; }
.tool-head .badge { font: 600 10px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--bg); background: var(--accent); padding: 3px 7px; }
.tool-head .right { margin-left: auto; display: flex; gap: 8px; }
.tool-body { padding: 20px; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 0; }
.tool-grid > .pane { padding: 20px; min-width: 0; }
.tool-grid > .pane + .pane { border-left: 1px solid var(--line); background: var(--surface-2); }
.field { margin-bottom: 18px; }
.field > label, .field > .lbl { display: block; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink); margin-bottom: 9px; }
:lang(zh) .field > label, :lang(ja) .field > label, :lang(zh) .field > .lbl, :lang(ja) .field > .lbl { text-transform: none; letter-spacing: .02em; font-size: 12px; }
.field .hint { display: block; font: 400 12.5px var(--font); color: var(--muted); margin-top: 6px; line-height: 1.5; text-transform: none; letter-spacing: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button, .seg label { font: 500 13px var(--font); color: var(--ink-2); padding: 7px 12px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; transition: all .15s; }
.seg button:hover, .seg label:hover { border-color: var(--ink); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg label { display: inline-flex; gap: 7px; align-items: center; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.seg input { accent-color: var(--accent); margin: 0; }
input[type="text"], input[type="search"], input[type="number"], select, textarea { width: 100%; font: 400 14.5px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 0; padding: 10px 12px; transition: border-color .15s, box-shadow .15s; }
textarea { font-family: var(--mono); font-size: 13px; min-height: 120px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 3px 3px 0 var(--accent); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14px; color: var(--ink-2); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch input { appearance: none; width: 36px; height: 20px; background: var(--line-2); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: #fff; transition: transform .2s cubic-bezier(.2,.7,.2,1); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.switch small { display: block; color: var(--muted); font-size: 12.5px; }
.out-tabs-l { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.out-tabs-l button { font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: none; border: 0; padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
:lang(zh) .out-tabs-l button, :lang(ja) .out-tabs-l button { text-transform: none; letter-spacing: .02em; font-size: 12px; }
.out-tabs-l button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tool .code { margin-top: 0; }
.explain { margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.explain b { font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink); }
.explain ul { margin: 6px 0 0; padding-left: 18px; }
.explain li { margin: 3px 0; }
.explain code { font-size: 12px; }
.result-card { padding: 16px; border: 1px solid var(--line); background: var(--surface); margin-bottom: 12px; border-left: 3px solid var(--ink); }
.result-card:first-child { border-left-color: var(--accent); }
.result-card h4 { font-size: 16px; margin-bottom: 4px; }
.result-card .why { font-size: 13.5px; color: var(--muted); margin: 6px 0 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 600 10.5px var(--mono); letter-spacing: .04em; padding: 3px 8px; background: var(--accent-soft); color: var(--accent-ink); }
.pill.g { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); }
.pill.w { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.pill.b { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.searchbox { position: relative; }
.searchbox svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.searchbox input { padding-left: 38px; height: 48px; font-size: 15px; border-color: var(--ink); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.filters button { font: 500 12px var(--mono); padding: 6px 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.filters button:hover { border-color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filters button .n { opacity: .6; margin-left: 4px; font-variant-numeric: tabular-nums; }
.count-line { font: 500 11.5px var(--mono); color: var(--muted); margin: 14px 0 10px; }
.opt-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.opt { border-bottom: 1px solid var(--line); background: var(--surface); padding: 14px 16px; transition: background .15s; }
.opt:hover { background: var(--surface-2); }
.opt[hidden] { display: none; }
.opt-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.opt-h code { font-size: 13.5px; font-weight: 600; background: none; border: 0; padding: 0; color: var(--ink); }
.opt-h .ty { font: 500 11px var(--mono); color: var(--muted); }
.opt-h .df { font: 500 11px var(--mono); color: var(--accent-ink); margin-left: auto; }
.opt p { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.opt .ch { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.opt .ch code { font-size: 11.5px; }
.opt .grp { font: 600 10px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink); }
mark { background: var(--accent-mark); color: inherit; padding: 0 1px; }

/* chunk visualizer */
.chunk-stream { display: grid; gap: 8px; max-height: 560px; overflow: auto; padding-right: 4px; }
.chunk { border: 1px solid var(--line); border-left: 3px solid var(--c, var(--s1)); padding: 10px 12px; background: var(--surface); font-size: 13px; }
.chunk .ch-h { display: flex; gap: 8px; align-items: center; font: 500 11px var(--mono); color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.chunk .ch-h b { color: var(--ink); }
.chunk .ctx { color: var(--accent-ink); font-size: 12px; margin-bottom: 4px; font-weight: 600; }
.chunk .tx { color: var(--ink-2); white-space: pre-wrap; word-break: break-word; max-height: 7.5em; overflow: hidden; -webkit-mask: linear-gradient(#000 70%, transparent); mask: linear-gradient(#000 70%, transparent); }
.chunk.open .tx { max-height: none; -webkit-mask: none; mask: none; }
.tokbar { height: 4px; background: var(--line); margin-top: 8px; overflow: hidden; }
.tokbar i { display: block; height: 100%; background: var(--c, var(--s1)); }
.tokbar.over i { background: var(--bad); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-bottom: 14px; border: 1px solid var(--line); }
.kpi { padding: 12px; background: var(--surface); border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi b { display: block; font: 500 22px var(--mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--muted); }

/* ---------- FAQ ---------- */
.faq { max-width: 880px; border-top: 1px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 20px 48px 20px 0; position: relative; font-weight: 600; font-size: 17.5px; color: var(--ink); letter-spacing: -.02em; transition: color .15s; }
.faq summary:hover { color: var(--accent-ink); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; display: grid; place-items: center; font: 400 18px/1 var(--mono); color: var(--ink); border: 1px solid var(--line-2); transition: transform .25s, background .2s, color .2s; }
.faq details[open] summary::after { content: "−"; background: var(--ink); color: var(--bg); border-color: var(--ink); }
.faq .a { padding: 0 0 22px; color: var(--ink-2); max-width: 72ch; }
.faq .a p { margin: 0 0 .7em; }

/* ---------- next / related ---------- */
.related { margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--ink); }
.related h2 { font-size: 24px !important; margin: 0 0 18px !important; }
.related .cards { grid-template-columns: repeat(3, 1fr); }
.related .card { padding: 18px; }
.related .card h3 { font-size: 16px; }
.feedback { margin-top: 40px; padding: 20px 22px; border: 1px dashed var(--line-2); background: transparent; font-size: 14.5px; color: var(--ink-2); }
.feedback a { font-weight: 600; }
.sources { font-size: 13.5px; color: var(--muted); }
.sources li { color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { margin-top: 128px; border-top: 1px solid var(--ink); background: var(--bg-2); padding: 56px 0 0; font-size: 14px; overflow: hidden; }
.foot-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 40px; }
.foot-grid h4 { font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin-bottom: 14px; }
.foot-grid ul { list-style: none; margin: 0; padding: 0; }
.foot-grid li { margin: 8px 0; }
.foot-grid a { color: var(--ink-2); text-decoration: none; }
.foot-grid a:hover { color: var(--accent-ink); }
.foot-about a svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.foot-about p { color: var(--muted); margin: 12px 0; max-width: 46ch; line-height: 1.6; }
.disclaimer { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; }
.disclaimer p { margin: 0; max-width: 78ch; }
.disclaimer a { color: var(--ink-2); }
.foot-mark { position: relative; margin: 40px auto 0; width: min(var(--wrap), 100% - 32px); }
.foot-mark span { display: block; font: 700 clamp(64px, 16.5vw, 232px)/.8 var(--font); letter-spacing: -.07em; color: transparent; -webkit-text-stroke: 1px var(--line-2); white-space: nowrap; user-select: none; transform: translateY(14%); }
.foot-mark::before { content: "page_footer"; position: absolute; left: 0; top: -18px; font: 600 10px/1 var(--mono); color: var(--bg); background: var(--accent); padding: 3px 6px; letter-spacing: .04em; }
.foot-mark::after { content: ""; position: absolute; left: 0; right: 0; top: -2px; bottom: 0; border: 1px solid var(--accent); border-bottom: 0; pointer-events: none; }

/* ---------- reveal ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.js [data-reveal].in { opacity: 1; transform: none; }
.js .viz[data-reveal] { opacity: 1; transform: none; }

/* ---------- live layout detection (scroll) ---------- */
.det-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 40; pointer-events: none; }
.det-box { position: absolute; border: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 4%, transparent); opacity: 0; transform: scale(1.025); transition: opacity .35s ease, transform .5s cubic-bezier(.2,.7,.2,1); }
.det-box.on { opacity: 1; transform: none; }
.det-box.off { opacity: 0; transition: opacity .7s ease; }
.det-box b { position: absolute; left: -1.5px; top: -19px; font: 600 10px/1 var(--mono); letter-spacing: .03em; color: #fff; background: var(--accent); padding: 4px 6px; white-space: nowrap; }
.det-box i { position: absolute; width: 7px; height: 7px; background: var(--accent); }
.det-box i:nth-of-type(1) { left: -4px; top: -4px; } .det-box i:nth-of-type(2) { right: -4px; top: -4px; }
.det-box i:nth-of-type(3) { left: -4px; bottom: -4px; } .det-box i:nth-of-type(4) { right: -4px; bottom: -4px; }

/* demo embed */
.embed { overflow: hidden; border: 1px solid var(--ink); background: var(--surface); box-shadow: 10px 10px 0 var(--accent-soft); }
.embed-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font: 500 12px var(--mono); color: var(--ink-2); background: var(--surface-2); flex-wrap: wrap; }
.embed-bar .live { width: 7px; height: 7px; background: var(--good); animation: rec 2s steps(1) infinite; }
.embed-bar a { margin-left: auto; }
.embed iframe { display: block; width: 100%; height: 860px; border: 0; background: var(--surface); }
.embed-load { display: grid; place-items: center; gap: 14px; height: 420px; text-align: center; padding: 24px; color: var(--muted); }

/* ---------- responsive ---------- */
@keyframes drawer-in { from { opacity: 0; transform: translateY(-8px); } }
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat:nth-child(3) { border-right: 0; }
  .stat:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .pipeline { grid-template-columns: repeat(3, 1fr); }
  .pipe:nth-child(3) { border-right: 0; }
  .pipe:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .doc { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }
  .cards.four { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .nav-main, .nav-right .gh, .nav-right .lang { display: none; }
  .menu-btn { display: inline-grid; }
  .drawer { display: none; position: fixed; inset: 62px 0 0; z-index: 49; background: var(--bg); padding: 16px 16px 40px; overflow: auto; }
  .drawer.open { display: block; animation: drawer-in .22s cubic-bezier(.2,.7,.2,1); }
  .ribbon .r2 { display: none; }
  .drawer h4 { font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin: 22px 0 8px; }
  .drawer a { display: block; padding: 12px 4px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
  .drawer .langs { display: flex; flex-wrap: wrap; gap: 8px; }
  .drawer .langs a { border: 1px solid var(--line-2); padding: 8px 12px; font-size: 14px; }
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .cards, .related .cards { grid-template-columns: repeat(2, 1fr); }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-grid > .pane + .pane { border-left: 0; border-top: 1px solid var(--line); }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding: 40px 0 24px; }
  .lede, .page-hero .lede { font-size: 17px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { border-bottom: 1px solid var(--line); }
  .stat:nth-child(3) { border-right: 1px solid var(--line); }
  .stat:nth-child(2n) { border-right: 0; }
  .stat:nth-last-child(-n+2) { border-bottom: 0; }
  .stat b { font-size: 26px; }
  .pipeline { grid-template-columns: 1fr; }
  .pipe { border-right: 0 !important; border-bottom: 1px solid var(--line); }
  .pipe:last-child { border-bottom: 0; }
  .cards, .cards.two, .cards.four, .related .cards { grid-template-columns: 1fr; }
  .section { padding-top: 76px; }
  .stage { box-shadow: 6px 6px 0 var(--accent-soft); }
  .stage-body { grid-template-columns: 1fr; }
  .page-mock { max-height: 300px; aspect-ratio: auto; height: 300px; }
  .out-panel { border-left: 0; border-top: 1px solid var(--ink); }
  .out-code { min-height: 200px; }
  .stage-steps span { padding: 9px 6px; font-size: 9.5px; }
  .prose h2 { font-size: 26px; }
  .viz { padding: 16px 12px 12px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(2) { border-right: 0; }
  .foot-grid { grid-template-columns: 1fr; }
  .brand small { display: none; }
  .embed iframe { height: 720px; }
  .tool { box-shadow: 6px 6px 0 var(--accent-soft); }
  .tool-grid > .pane, .tool-body { padding: 16px; }
  .hero-cta .btn { flex: 1 1 auto; }
  .page-hero::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .js .hero h1 .serif { background-size: 100% .28em; }
  .det-layer { display: none; }
}
@media print {
  .site-header, .ribbon, .toc, .site-footer, .copy, .tool, .drawer, .det-layer { display: none !important; }
  body { background: #fff; color: #000; }
}
