/* Shared open-source site system (AdvFab · Public Edge · Among Clusters).
   Same tokens as the RE8CH commercial cloud sites; each site only sets --accent. */
:root {
  color-scheme: light;
  --paper: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --ok: #059669;
  --warn: #c27c0e;
  --bad: #d14343;
  --unknown: #94a3b8;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
:root[data-site="advfab"] { --accent: #0d9488; --accent-ink: #0f766e; --accent-soft: rgba(13, 148, 136, .1); }
:root[data-site="public-edge"] { --accent: #e0700b; --accent-ink: #b45309; --accent-soft: rgba(224, 112, 11, .1); }
:root[data-site="among-clusters"] { --accent: #6d5dfc; --accent-ink: #5442e6; --accent-soft: rgba(109, 93, 252, .1); }

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #07111d;
  --surface: #0c1828;
  --surface-2: #102236;
  --ink: #eef4fb;
  --muted: #9aabbf;
  --faint: #6b7d93;
  --line: rgba(226, 236, 248, .12);
  --line-strong: rgba(226, 236, 248, .22);
  --ok: #34d399;
  --warn: #f5b942;
  --bad: #f87171;
  --unknown: #6b7d93;
}
:root[data-theme="dark"][data-site="advfab"] { --accent: #2dd4bf; --accent-ink: #5eead4; --accent-soft: rgba(45, 212, 191, .12); }
:root[data-theme="dark"][data-site="public-edge"] { --accent: #fb923c; --accent-ink: #fdba74; --accent-soft: rgba(251, 146, 60, .12); }
:root[data-theme="dark"][data-site="among-clusters"] { --accent: #a397ff; --accent-ink: #c4bcff; --accent-soft: rgba(163, 151, 255, .14); }

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; line-height: 1.5; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); overflow-x: clip; }
a { color: inherit; }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
code { font-family: var(--mono); font-size: .92em; }

.shell { min-height: 100svh; overflow-x: clip; }
.wrap { margin: 0 auto; max-width: 1200px; padding: 0 clamp(16px, 4vw, 32px); }
.eyebrow { align-items: center; color: var(--accent-ink); display: inline-flex; font-size: 13px; font-weight: 750; gap: 10px; letter-spacing: .08em; text-transform: uppercase; }
.eyebrow .tag { border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .04em; padding: 2px 8px; }

.button { align-items: center; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); cursor: pointer; display: inline-flex; font-size: 14px; font-weight: 650; gap: 8px; justify-content: center; min-height: 40px; padding: 0 16px; text-decoration: none; transition: border-color .15s, background .15s; }
.button:hover { border-color: var(--faint); }
.button.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.button.primary:hover { opacity: .9; }

/* Hero */
.hero { padding: clamp(40px, 7vw, 88px) 0 clamp(40px, 6vw, 72px); }
.hero-grid { align-items: center; display: grid; gap: clamp(28px, 5vw, 64px); grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.hero h1 { font-size: clamp(36px, 4.6vw, 56px); font-weight: 820; letter-spacing: -.035em; line-height: 1.04; margin: 18px 0 20px; text-wrap: balance; }
:lang(zh) .hero h1 { letter-spacing: -.01em; line-height: 1.15; }
.lead { color: var(--muted); font-size: clamp(16px, 1.6vw, 19px); line-height: 1.6; max-width: 560px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.stats { border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 32px; padding-top: 18px; }
.stats div { border-left: 1px solid var(--line); min-width: 0; padding: 0 14px; }
.stats div:first-child { border-left: 0; padding-left: 0; }
.stats span { color: var(--muted); display: block; font-size: 13px; font-weight: 600; }
.stats strong { display: block; font-size: clamp(20px, 2.2vw, 26px); font-variant-numeric: tabular-nums; font-weight: 780; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; }

/* Figure (signature interaction) */
.figure { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; overflow: hidden; }
.figure-head { align-items: center; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: space-between; padding: 12px 16px; }
.figure-head b { font-size: 14px; }
.figure-head small { color: var(--muted); font-size: 12px; }
.figure-body { position: relative; }
.figure svg { display: block; height: auto; width: 100%; }
.figure-foot { border-top: 1px solid var(--line); display: grid; gap: 12px; padding: 14px 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legend span { align-items: center; color: var(--muted); display: inline-flex; font-size: 12px; gap: 6px; }
.legend i { border-top: 2px solid currentColor; display: inline-block; width: 18px; }
.legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
.k-ready { color: var(--ok); } .k-partial { color: var(--warn); } .k-stale { color: var(--bad); } .k-unknown { color: var(--unknown); }
.legend .k-partial i { border-top-style: dashed; } .legend .k-stale i { border-top-style: dotted; } .legend .k-unknown i { border-top-style: dashed; opacity: .8; }

.chips { align-content: flex-start; align-items: flex-start; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { align-items: center; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; display: inline-flex; font-size: 12.5px; font-weight: 600; gap: 6px; min-height: 30px; padding: 0 11px; }
.chip::before { background: var(--faint); border-radius: 50%; content: ""; height: 7px; width: 7px; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.chip[aria-pressed="true"]::before { background: var(--accent); }
.verdict { align-items: flex-start; border: 1px solid var(--line); border-left: 3px solid var(--bad); border-radius: 8px; display: grid; font-size: 13px; gap: 2px; padding: 9px 12px; }
.verdict b { font-size: 13px; }
.verdict span { color: var(--muted); }
.verdict[data-state="ok"] { border-left-color: var(--ok); }
.verdict[data-state="hold"] { border-left-color: var(--warn); }
.kv { display: grid; font-size: 12.5px; gap: 4px 14px; grid-template-columns: auto 1fr; }
.kv dt { color: var(--muted); }
.kv dd { font-family: var(--mono); margin: 0; overflow-wrap: anywhere; }
.mono-pane { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; font: 12.5px/1.6 var(--mono); margin: 0; overflow-x: auto; padding: 10px 12px; white-space: pre; }
.mono-pane .dim { color: var(--muted); }
.mono-pane .acc { color: var(--accent-ink); font-weight: 700; }
.mono-pane .ok { color: var(--ok); font-weight: 700; }
.mono-pane .bad { color: var(--bad); }
.mono-pane .warn { color: var(--warn); }

.svg-label { fill: var(--muted); font: 600 11px Inter, ui-sans-serif, system-ui, sans-serif; }
.svg-title { fill: var(--ink); font: 700 12.5px Inter, ui-sans-serif, system-ui, sans-serif; }
.svg-mono { fill: var(--muted); font: 10.5px var(--mono); }
.svg-box { fill: var(--surface); stroke: var(--line-strong); }
.svg-zone { fill: var(--surface-2); stroke: var(--line); }
.svg-node { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.hit { cursor: pointer; }
.hit:focus { outline: none; }
.hit:focus-visible .focus-ring, .hit[aria-pressed="true"] .focus-ring { stroke: var(--accent); stroke-width: 2; }

/* Sections */
.section { border-top: 1px solid var(--line); padding: clamp(48px, 7vw, 88px) 0; }
.section-head { display: grid; gap: 12px; margin-bottom: clamp(24px, 4vw, 40px); max-width: 760px; }
.section-head h2 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 800; letter-spacing: -.03em; line-height: 1.12; text-wrap: balance; }
:lang(zh) .section-head h2 { letter-spacing: -.01em; }
.section-head p { color: var(--muted); font-size: 16px; line-height: 1.65; }

.rows { border: 1px solid var(--line); border-radius: 12px; display: grid; overflow: hidden; }
.row { align-items: start; background: var(--surface); border-top: 1px solid var(--line); display: grid; gap: 8px 28px; grid-template-columns: 64px minmax(0, 260px) minmax(0, 1fr) auto; padding: 22px 24px; }
.row:first-child { border-top: 0; }
.row .idx { color: var(--accent-ink); font: 700 12px var(--mono); padding-top: 3px; }
.row h3 { font-size: 17px; font-weight: 750; }
.row p { color: var(--muted); line-height: 1.6; }
.row a { color: var(--accent-ink); font-size: 14px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.row a:hover { text-decoration: underline; }

.split { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; }
.panel h3 { align-items: center; display: flex; font-size: 15px; font-weight: 750; gap: 8px; margin-bottom: 14px; }
.panel h3::before { background: var(--accent); border-radius: 2px; content: ""; height: 12px; width: 4px; }
.panel.other h3::before { background: var(--faint); }
.panel ul { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
.panel li { border-top: 1px solid var(--line); color: var(--muted); line-height: 1.55; padding-top: 10px; }
.panel li:first-child { border-top: 0; padding-top: 0; }
.panel li b { color: var(--ink); font-weight: 650; }

.install { display: grid; gap: 24px; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.steps { counter-reset: step; display: grid; gap: 14px; list-style: none; margin: 0; padding: 0; }
.steps li { color: var(--muted); counter-increment: step; display: grid; gap: 12px; grid-template-columns: 28px 1fr; line-height: 1.55; }
.steps li::before { align-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--ink); content: counter(step); display: flex; font-size: 12px; font-weight: 700; height: 26px; justify-content: center; width: 26px; }
.code { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-width: 0; overflow: hidden; }
.code-head { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; padding: 8px 10px 8px 16px; }
.code-head span { color: var(--muted); font: 12px var(--mono); }
.copy { background: transparent; border: 1px solid var(--line-strong); border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 650; min-height: 28px; padding: 0 10px; }
.code pre { font: 13px/1.7 var(--mono); margin: 0; overflow-x: auto; padding: 16px; }
.code .c { color: var(--muted); }

.family { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.family a { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 8px; padding: 18px; text-decoration: none; transition: border-color .15s; }
.family a:hover { border-color: var(--line-strong); }
.family a[aria-current="page"] { border-color: var(--accent); }
.family .fam-mark { align-items: center; display: flex; gap: 10px; }
.family img { height: 26px; width: 26px; }
.family b { font-size: 15px; }
.family p { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.family small { color: var(--faint); font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }

.closing { align-items: center; display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; }
.closing p { color: var(--muted); line-height: 1.6; max-width: 640px; }

.sr { clip: rect(0 0 0 0); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }

@media (max-width: 960px) {
  .hero-grid, .install { grid-template-columns: minmax(0, 1fr); }
  .family { grid-template-columns: 1fr 1fr; }
  .row { grid-template-columns: 48px minmax(0, 1fr); }
  .row p, .row a { grid-column: 2; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; row-gap: 14px; }
  .stats div:nth-child(3) { border-left: 0; padding-left: 0; }
  .split, .family { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; padding: 18px; }
  .row p, .row a { grid-column: 1; }
  .panel { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* AdvFab Wiki (light system) */
.wiki-hero { align-items: end; display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr) 300px; padding: clamp(40px, 6vw, 72px) 0; }
.wiki-hero h1 { font-size: clamp(36px, 5vw, 56px); font-weight: 820; letter-spacing: -.035em; line-height: 1.06; margin: 16px 0; }
.snapshot-stamp { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; position: relative; }
.snapshot-stamp .pulse { background: var(--accent); border-radius: 50%; height: 8px; position: absolute; right: 18px; top: 20px; width: 8px; }
.snapshot-stamp p { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .06em; margin-bottom: 6px; text-transform: uppercase; }
.snapshot-stamp strong, .snapshot-stamp small { display: block; }
.snapshot-stamp small { color: var(--muted); font-family: var(--mono); font-size: 12px; margin-top: 6px; }
.wiki-layout { display: grid; gap: 48px; grid-template-columns: 180px minmax(0, 1fr); }
.wiki-toc { align-self: start; display: flex; flex-direction: column; font-size: 14px; gap: 10px; padding-top: 56px; position: sticky; top: 88px; }
.wiki-toc span { color: var(--accent-ink); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.wiki-toc a { color: var(--muted); text-decoration: none; }
.wiki-toc a:hover { color: var(--ink); }
.wiki-section { border-top: 1px solid var(--line); padding: 56px 0; scroll-margin-top: 80px; }
.wiki-section h2 { font-size: clamp(24px, 3vw, 34px); font-weight: 800; letter-spacing: -.025em; line-height: 1.15; margin: 10px 0 14px; max-width: 760px; }
.wiki-section > p:not(.section-index), .section-heading p { color: var(--muted); line-height: 1.65; max-width: 720px; }
.section-index { color: var(--accent-ink); font: 700 12px var(--mono); }
.flow { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 12px; grid-template-columns: repeat(7, auto); margin: 28px 0; padding: 16px 18px; }
.flow div { display: grid; gap: 2px; }
.flow span { color: var(--muted); font-size: 12.5px; }
.flow i { color: var(--accent); font-style: normal; }
.definition-grid, .metric-grid, .privacy-grid { display: grid; gap: 12px; }
.definition-grid { grid-template-columns: repeat(3, 1fr); }
.definition-grid article, .metric-grid article, .privacy-grid > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.definition-grid article > span { align-items: center; border: 1px solid var(--accent); border-radius: 50%; color: var(--accent-ink); display: inline-flex; font-weight: 800; height: 30px; justify-content: center; width: 30px; }
.definition-grid h3 { font-size: 16px; margin: 14px 0 6px; }
.definition-grid p { color: var(--muted); line-height: 1.55; }
.section-heading { align-items: flex-start; display: flex; gap: 24px; justify-content: space-between; }
.read-only { border: 1px solid var(--accent); border-radius: 6px; color: var(--accent-ink); font: 700 11px var(--mono); padding: 5px 8px; white-space: nowrap; }
.metric-grid { grid-template-columns: repeat(4, 1fr); margin: 24px 0; }
.metric-grid span, .metric-grid small { color: var(--muted); display: block; }
.metric-grid span { font-size: 13px; }
.metric-grid strong { display: block; font-size: 32px; letter-spacing: -.03em; margin: 6px 0; }
.metric-grid small { font-size: 12px; }
.state-panel { display: grid; gap: 28px; grid-template-columns: 1fr 1fr; margin-top: 24px; }
.state-panel h3 { color: var(--muted); font-size: 12px; letter-spacing: .06em; margin-bottom: 12px; text-transform: uppercase; }
.bars { display: grid; gap: 8px; }
.bar-row { align-items: center; display: grid; font-size: 13px; gap: 10px; grid-template-columns: 90px 1fr 32px; }
.bar-row > span { color: var(--muted); }
.bar-row > div { background: var(--surface-2); border-radius: 99px; height: 6px; overflow: hidden; }
.bar-row i { background: var(--unknown); display: block; height: 100%; }
.bar-row i.state-ready, .bar-row i.state-complete { background: var(--ok); }
.bar-row i.state-partial, .bar-row i.state-incomplete { background: var(--warn); }
.bar-row i.state-stale { background: var(--bad); }
.note { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin-top: 10px; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-top: 24px; overflow: auto; }
table { border-collapse: collapse; min-width: 680px; width: 100%; }
th, td { border-bottom: 1px solid var(--line); font-size: 13px; padding: 10px 14px; text-align: left; }
th { color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.state { border: 1px solid var(--line-strong); border-radius: 99px; display: inline-block; font-size: 12px; font-weight: 650; padding: 2px 8px; }
.state-ready { border-color: var(--ok); color: var(--ok); }
.state-partial { border-color: var(--warn); color: var(--warn); }
.state-stale { border-color: var(--bad); color: var(--bad); }
.privacy-grid { grid-template-columns: 1fr 1fr; margin: 24px 0; }
.privacy-grid h3 { font-size: 15px; margin: 0 0 8px; }
.privacy-grid li { color: var(--muted); line-height: 1.5; margin: 6px 0; }
.hash-explainer { border-left: 2px solid var(--accent); font-size: 14px; padding-left: 14px; }
.error { color: var(--bad); }
@media (max-width: 900px) {
  .wiki-hero, .wiki-layout, .state-panel, .privacy-grid, .definition-grid { grid-template-columns: 1fr; }
  .wiki-toc { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .flow { grid-template-columns: 1fr; }
  .flow i { justify-self: start; transform: rotate(90deg); }
}
@media (max-width: 560px) { .metric-grid { grid-template-columns: 1fr; } .section-heading { display: block; } .read-only { display: inline-block; margin-top: 12px; } }

.flow-line { animation: route-flow 1.1s linear infinite; }
@keyframes route-flow { to { stroke-dashoffset: -12; } }
.peer-lists { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.peer-lists b { display: block; font-size: 12px; letter-spacing: .04em; margin-bottom: 4px; text-transform: uppercase; }
.peer-lists .crosses b { color: var(--accent-ink); }
.peer-lists .stays b { color: var(--muted); }
.peer-lists ul { color: var(--muted); display: grid; font-size: 12.5px; gap: 2px; margin: 0; padding-left: 16px; }
.mono-pane div { display: flex; gap: 12px; justify-content: space-between; }
.mono-pane.lines div { display: block; }
.figure-split { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 640px) { .figure-split, .peer-lists { grid-template-columns: 1fr; } }
.fig-note { color: var(--faint); font-size: 12px; line-height: 1.5; }
.row-text { display: grid; gap: 4px; }
.row-text .q { color: var(--ink); font-weight: 600; }
