/* ============================================================
   知微 ZhiWei · Design System
   Linear skeleton (minimal / precise) + Supabase data-green accent
   Light-first, dark-toggleable.
   ============================================================ */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- Tokens: light (default) ---------- */
:root {
  /* accent: Supabase-ish emerald = data / growth / hit-rate */
  --accent: #1D9E75;
  --accent-hover: #17b981;
  --accent-weak: #E1F5EE;
  --accent-ink: #0F6E56;

  /* linear lavender kept as a secondary/link tint */
  --violet: #5e6ad2;

  /* ink */
  --ink: #16181d;
  --ink-muted: #4b5058;
  --ink-subtle: #6b7280;
  --ink-tertiary: #9aa1ab;

  /* surface */
  --canvas: #ffffff;
  --surface-1: #f8f9fb;
  --surface-2: #f2f4f7;
  --surface-3: #eceef2;
  --hairline: #e5e8ec;
  --hairline-strong: #d3d7dd;

  /* semantic status (capability boundary badges) */
  --ok: #1D9E75;      --ok-bg: #E1F5EE;
  --arch: #BA7517;    --arch-bg: #FAEEDA;
  --road: #6b7280;    --road-bg: #f2f4f7;
  --danger: #E24B4A;  --danger-bg: #FCEBEB;

  /* radius */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-pill: 9999px;

  /* spacing base 4px */
  --sp-xs: 8px; --sp-sm: 12px; --sp-md: 16px; --sp-lg: 24px; --sp-xl: 32px; --sp-2xl: 48px; --sp-section: 96px;

  --maxw: 1200px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --shadow-sm: 0 1px 2px rgba(16,24,40,.04);
  --shadow-md: 0 4px 16px rgba(16,24,40,.06);
}

/* ---------- Tokens: dark ---------- */
:root[data-theme="dark"] {
  --accent: #2ecc9b;
  --accent-hover: #45e0b0;
  --accent-weak: #10241d;
  --accent-ink: #6fe3c0;
  --violet: #828fff;

  --ink: #f2f4f7;
  --ink-muted: #b7bdc7;
  --ink-subtle: #8a8f98;
  --ink-tertiary: #62666d;

  --canvas: #0b0d10;
  --surface-1: #14171b;
  --surface-2: #181c21;
  --surface-3: #1f242a;
  --hairline: #23272e;
  --hairline-strong: #333944;

  --ok: #2ecc9b;      --ok-bg: #10241d;
  --arch: #EF9F27;    --arch-bg: #2a2008;
  --road: #8a8f98;    --road-bg: #1f242a;
  --danger: #F09595;  --danger-bg: #2a1414;

  --shadow-sm: none;
  --shadow-md: 0 8px 30px rgba(0,0,0,.4);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  background: var(--canvas);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  transition: background .3s, color .3s;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

/* ---------- Layout ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: var(--sp-section) 0; }
.section-sm { padding: 56px 0; }
@media (max-width: 768px){ .section{ padding: 64px 0; } }

/* ---------- Typography ---------- */
.eyebrow {
  font-size: 13px; font-weight: 500; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent-ink);
}
:root[data-theme="dark"] .eyebrow { color: var(--accent); }
h1, .h1 { font-size: 56px; font-weight: 600; line-height: 1.08; letter-spacing: -0.03em; }
h2, .h2 { font-size: 38px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
h3, .h3 { font-size: 22px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
h4, .h4 { font-size: 17px; font-weight: 600; }
.lead { font-size: 19px; color: var(--ink-muted); line-height: 1.55; font-weight: 400; }
.muted { color: var(--ink-muted); }
.subtle { color: var(--ink-subtle); }
@media (max-width: 768px){
  h1,.h1{ font-size: 36px; } h2,.h2{ font-size: 28px; } .lead{ font-size: 17px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: inherit; font-size: 15px; font-weight: 500;
  padding: 10px 18px; border-radius: var(--r-md);
  border: 1px solid transparent; cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--canvas); color: var(--ink); border-color: var(--hairline-strong); }
.btn-secondary:hover { border-color: var(--ink-subtle); background: var(--surface-1); }
.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn-ghost:hover { color: var(--ink); }
.btn-lg { padding: 13px 24px; font-size: 16px; }

/* ---------- Cards ---------- */
.card {
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 24px; transition: all .2s;
}
.card:hover { border-color: var(--hairline-strong); box-shadow: var(--shadow-md); }
.card-flat { background: var(--surface-1); border: none; border-radius: var(--r-lg); padding: 24px; }

/* ---------- Status badges (capability boundary) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; padding: 3px 10px;
  border-radius: var(--r-pill); line-height: 1.4;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: var(--ok-bg); }
.badge-arch { color: var(--arch); background: var(--arch-bg); }
.badge-road { color: var(--road); background: var(--road-bg); }

/* ---------- Chips / tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; padding: 5px 12px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink-muted); border: 1px solid var(--hairline);
}

/* ---------- Grid helpers ---------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 900px){ .grid-3,.grid-4{ grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 640px){ .grid-2,.grid-3,.grid-4{ grid-template-columns: 1fr; } }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.nav-brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 16px; letter-spacing: -0.02em; }
.nav-logo { width: 26px; height: 26px; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  font-size: 14px; font-weight: 500; color: var(--ink-muted);
  padding: 7px 12px; border-radius: var(--r-md); transition: all .15s;
}
.nav-link:hover { color: var(--ink); background: var(--surface-1); }
.nav-link.active { color: var(--ink); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); border: 1px solid var(--hairline); background: var(--canvas);
  color: var(--ink-muted); cursor: pointer; transition: all .15s; font-size: 13px; font-weight: 500;
}
.icon-btn:hover { color: var(--ink); border-color: var(--hairline-strong); }
.nav-toggle { display: none; }
@media (max-width: 860px){
  .nav-links {
    position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--canvas); border-bottom: 1px solid var(--hairline);
    padding: 12px; box-shadow: var(--shadow-md);
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: all .2s;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-toggle { display: inline-flex; }
}

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--hairline); background: var(--surface-1); padding: 56px 0 40px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; }
@media (max-width: 768px){ .footer-grid{ grid-template-columns: 1fr 1fr; } }
.footer h5 { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 14px; }
.footer a { display: block; font-size: 14px; color: var(--ink-subtle); padding: 5px 0; transition: color .15s; }
.footer a:hover { color: var(--ink); }
.footer-bottom { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--hairline); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--ink-subtle); }

/* ---------- Hero ---------- */
.hero { padding: 96px 0 72px; text-align: center; }
.hero .lead { max-width: 640px; margin: 20px auto 0; }
.hero-cta { display: flex; gap: 12px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.hero-note { margin-top: 18px; font-size: 13px; color: var(--ink-tertiary); }

/* ---------- Section head ---------- */
.section-head { text-align: center; max-width: 680px; margin: 0 auto 48px; }
.section-head .lead { margin-top: 14px; }

/* ---------- Feature icon ---------- */
.feat-icon {
  width: 42px; height: 42px; border-radius: var(--r-md);
  background: var(--accent-weak); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
:root[data-theme="dark"] .feat-icon { color: var(--accent); }

/* ---------- Utilities ---------- */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }
.center { text-align: center; }
.mono { font-family: var(--font-mono); }
.divider { height: 1px; background: var(--hairline); border: none; margin: 0; }
[data-lang-en] { display: none; }
:root[data-lang="en"] [data-lang-zh] { display: none; }
:root[data-lang="en"] [data-lang-en] { display: revert; }

/* code block */
pre.code {
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: 16px 18px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px;
  line-height: 1.7; color: var(--ink);
}

/* ============================================================
   MOTION LAYER  ——  动效为「数据叙事」服务，不为炫技服务
   Constitution: every animation must serve data storytelling,
   never decoration for its own sake. Respect reduced-motion.
   ============================================================ */

/* ---------- Scroll reveal: staggered fade-up ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1);
  will-change: opacity, transform;
}
[data-reveal].in { opacity: 1; transform: none; }
/* stagger children by index via inline --i */
[data-reveal-stagger] > * {
  opacity: 0; transform: translateY(18px);
  transition: opacity .6s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1);
  transition-delay: calc(var(--i, 0) * 80ms);
}
[data-reveal-stagger].in > * { opacity: 1; transform: none; }

/* ---------- Big data figure (数据即视觉) ---------- */
.stat-figure {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-figure .unit { font-size: .5em; color: var(--ink-subtle); margin-left: 2px; }
.stat-figure.accent { color: var(--accent); }
.stat-label { margin-top: 10px; font-size: 14px; color: var(--ink-muted); }
.stat-block { text-align: center; padding: 8px 0; }

/* ---------- Bar draw-in (柱状进视口逐条长出) ---------- */
.bar-track { background: var(--surface-2); border-radius: var(--r-pill); height: 10px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  width: 0; transition: width 1.1s cubic-bezier(.16,1,.3,1);
}
[data-reveal].in .bar-fill { width: var(--w, 0%); }

/* ---------- Magnetic button ---------- */
.magnetic { transition: transform .18s cubic-bezier(.16,1,.3,1); }

/* ---------- Glass card hover-lift ---------- */
.card, .card-flat { will-change: transform; }
.card:hover, .lift:hover { transform: translateY(-3px); }
.lift { transition: transform .2s cubic-bezier(.16,1,.3,1), box-shadow .2s, border-color .2s; }
.lift:hover { box-shadow: var(--shadow-md); border-color: var(--accent); }

/* ---------- Hero ambient mesh (极淡动态渐变，浅色下几乎不打扰) ---------- */
.hero { position: relative; overflow: hidden; }
.hero-mesh {
  position: absolute; inset: -20% -10% auto -10%; height: 520px; z-index: 0;
  pointer-events: none; filter: blur(60px); opacity: .5;
  background:
    radial-gradient(40% 50% at 20% 30%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    radial-gradient(38% 46% at 80% 20%, color-mix(in srgb, var(--violet) 20%, transparent), transparent 70%),
    radial-gradient(46% 40% at 55% 60%, color-mix(in srgb, var(--accent-hover) 18%, transparent), transparent 72%);
  background-size: 180% 180%;
  animation: meshDrift 18s ease-in-out infinite alternate;
}
:root[data-theme="dark"] .hero-mesh { opacity: .38; }
.hero > .container { position: relative; z-index: 1; }
@keyframes meshDrift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 40%; }
  100% { background-position: 40% 100%; }
}

/* ---------- Flywheel (数据闭环飞轮) slow spin ---------- */
.flywheel-spin { animation: spinSlow 32s linear infinite; transform-origin: center; }
@keyframes spinSlow { to { transform: rotate(360deg); } }

/* ---------- Logo / platform marquee ---------- */
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.marquee-track { display: flex; gap: 40px; width: max-content; animation: marquee 26s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Link underline sweep ---------- */
.link-accent { color: var(--accent); position: relative; }
.link-accent::after {
  content:""; position:absolute; left:0; bottom:-2px; height:1.5px; width:0;
  background: var(--accent); transition: width .25s cubic-bezier(.16,1,.3,1);
}
.link-accent:hover::after { width:100%; }

/* ---------- Respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal], [data-reveal-stagger] > * { opacity: 1 !important; transform: none !important; transition: none !important; }
  .bar-fill { transition: none; }
  .hero-mesh, .flywheel-spin, .marquee-track { animation: none !important; }
}

/* ============================================================
   Document page layout (方案书 / 命中复盘 等长文档统一排版)
   Sticky TOC + 阅读友好正文，复用全站设计令牌
   ============================================================ */
.doc-hero {
  padding: 60px 0 26px; border-bottom: 1px solid var(--hairline);
  background: radial-gradient(900px 380px at 78% -20%, var(--accent-weak) 0%, transparent 60%);
}
.doc-hero .doc-kicker { color: var(--accent-ink); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.doc-hero h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin: 10px 0 12px; letter-spacing: -.02em; }
.doc-hero .doc-sub { color: var(--ink-subtle); font-size: 17px; max-width: 720px; line-height: 1.6; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.doc-meta .chip {
  font-size: 12px; color: var(--ink-subtle); background: var(--surface-2);
  border: 1px solid var(--hairline); border-radius: 999px; padding: 5px 12px;
}

.doc-layout { display: grid; grid-template-columns: 232px 1fr; gap: 48px; padding: 40px 0 80px; align-items: start; }
.doc-toc { position: sticky; top: 84px; font-size: 13.5px; }
.doc-toc .toc-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-tertiary); margin-bottom: 12px; }
.doc-toc a {
  display: block; color: var(--ink-subtle); padding: 6px 0 6px 14px; border-left: 2px solid var(--hairline);
  transition: color .18s, border-color .18s; line-height: 1.4;
}
.doc-toc a:hover { color: var(--ink); }
.doc-toc a.active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 600; }
.doc-toc a.lvl-3 { padding-left: 26px; font-size: 12.5px; }

.doc-body { max-width: 760px; min-width: 0; }
.doc-body h2 { font-size: 24px; margin: 44px 0 16px; padding-top: 8px; letter-spacing: -.01em; scroll-margin-top: 84px; }
.doc-body h2:first-child { margin-top: 0; }
.doc-body h3 { font-size: 18px; margin: 30px 0 12px; scroll-margin-top: 84px; }
.doc-body p { color: var(--ink-muted); line-height: 1.8; margin: 14px 0; }
.doc-body ul, .doc-body ol { color: var(--ink-muted); line-height: 1.8; margin: 14px 0; padding-left: 24px; }
.doc-body li { margin: 6px 0; }
.doc-body strong { color: var(--ink); font-weight: 650; }
.doc-body a { color: var(--accent-ink); }
.doc-body a:hover { text-decoration: underline; }
.doc-body img, .doc-body svg { max-width: 100%; height: auto; }
.doc-body hr { border: 0; border-top: 1px solid var(--hairline); margin: 36px 0; }
.doc-body blockquote {
  margin: 18px 0; padding: 12px 18px; border-left: 3px solid var(--accent);
  background: var(--accent-weak); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--ink-muted);
}
.doc-body table {
  width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px;
  border: 1px solid var(--hairline); border-radius: var(--r-md); overflow: hidden;
}
.doc-body th, .doc-body td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--hairline); }
.doc-body th { background: var(--surface-2); font-weight: 600; color: var(--ink); font-size: 13px; }
.doc-body tr:last-child td { border-bottom: 0; }
.doc-body tbody tr:hover td { background: var(--surface-1); }
.doc-body :not(pre) > code {
  font-family: var(--font-mono); font-size: .88em; background: var(--surface-2);
  border: 1px solid var(--hairline); border-radius: 5px; padding: 1px 6px; color: var(--accent-ink);
}
.doc-figure { margin: 24px 0; padding: 20px; background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); text-align: center; }
.doc-figure svg { max-width: 100%; height: auto; }
.doc-figure figcaption { margin-top: 12px; font-size: 13px; color: var(--ink-subtle); }

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; gap: 0; }
  .doc-toc { display: none; }
}

/* ---------- Review report: data summary blocks ---------- */
.review-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 4px 0 28px; }
.review-kpis .rk {
  background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 18px 20px;
}
.review-kpis .rk-fig { font-size: 34px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1.1; }
.review-kpis .rk-fig.accent { color: var(--accent); }
.review-kpis .rk-fig .unit { font-size: 20px; margin-left: 1px; }
.review-kpis .rk-lbl { font-size: 12.5px; color: var(--ink-subtle); margin-top: 6px; }

.review-viz { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 0 0 34px; }
.rv-card { background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 22px 24px; }
.rv-card h3 { font-size: 16px; }
.kwc-row { display: grid; grid-template-columns: 68px 1fr auto; align-items: center; gap: 12px; margin: 9px 0; }
.kwc-key { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.kwc-track { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.kwc-track > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .9s cubic-bezier(.16,1,.3,1); }
.kwc-track > i.hit { background: linear-gradient(90deg, #F0894A, #E24B4A); } /* 红=高命中，国内语义 */
.kwc-meta { font-size: 11.5px; color: var(--ink-subtle); white-space: nowrap; }
.kwc-meta .tag { font-size: 10.5px; padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.kwc-meta .tag.ok { color: var(--ok); background: var(--ok-bg); }
.kwc-meta .tag.arch { color: var(--arch); background: var(--arch-bg); }
.kwc-meta .tag.road { color: var(--road); background: var(--road-bg); }

@media (max-width: 760px) {
  .review-kpis { grid-template-columns: repeat(2, 1fr); }
  .review-viz { grid-template-columns: 1fr; }
}
