/* cmx-megasheet 站点 · 设计系统
 * 单一事实源：所有颜色/间距/圆角用 CSS 变量，主题切换只翻变量（html[data-theme]）。
 * 品牌渐变：科技蓝 #4f7cff → 智能紫 #7c5cff → 青 #23d5c8。
 */
:root {
  --brand-1: #4f7cff;
  --brand-2: #7c5cff;
  --brand-3: #23d5c8;
  --grad: linear-gradient(120deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1160px;
  --mono: "SF Mono", ui-monospace, "SFMono-Regular", Consolas, Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ── 浅色（默认）── */
html[data-theme="light"] {
  --bg: #f6f8fd;
  --bg-2: #eef1fb;
  --surface: rgba(255, 255, 255, .72);
  --surface-solid: #ffffff;
  --card-brd: rgba(20, 30, 70, .10);
  --ink: #1a2138;
  --ink-2: #47506b;
  --ink-3: #79839e;
  --line: rgba(20, 30, 70, .10);
  --glow: rgba(79, 124, 255, .16);
  --code-bg: #0f1524;
  --code-ink: #d6def0;
  --nav-bg: rgba(246, 248, 253, .82);
  --shadow: 0 10px 30px -12px rgba(20, 30, 70, .22);
}

/* ── 深色 ── */
html[data-theme="dark"] {
  --bg: #0b0e17;
  --bg-2: #10141f;
  --surface: rgba(24, 29, 44, .66);
  --surface-solid: #161b29;
  --card-brd: rgba(255, 255, 255, .08);
  --ink: #e9edf7;
  --ink-2: #aab3cc;
  --ink-3: #79839e;
  --line: rgba(255, 255, 255, .09);
  --glow: rgba(124, 92, 255, .22);
  --code-bg: #05080f;
  --code-ink: #d6def0;
  --nav-bg: rgba(11, 14, 23, .78);
  --shadow: 0 14px 40px -14px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 15.5px;
  -webkit-font-smoothing: antialiased;
  transition: background .35s var(--ease), color .35s var(--ease);
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* ── 背景装饰：网格 + 浮动光斑 ── */
.bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-grid {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  opacity: .5;
}
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.orb-1 { width: 460px; height: 460px; background: var(--brand-1); top: -160px; left: -120px; }
.orb-2 { width: 420px; height: 420px; background: var(--brand-2); top: -80px; right: -140px; opacity: .4; }
.orb-3 { width: 380px; height: 380px; background: var(--brand-3); top: 380px; left: 40%; opacity: .28; }

/* ── 顶栏 ── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-family: var(--mono); font-weight: 800; font-size: 13px;
  box-shadow: 0 4px 14px -3px var(--glow);
}
.nav-links { display: flex; gap: 4px; margin-left: 8px; flex: 1; }
.nav-link {
  padding: 8px 14px; border-radius: 9px; font-size: 14px; color: var(--ink-2);
  transition: .16s var(--ease);
}
.nav-link:hover { color: var(--ink); background: var(--surface); }
.nav-link.active { color: var(--brand-1); background: var(--glow); font-weight: 600; }
html[data-theme="dark"] .nav-link.active { color: #a9bcff; }
.nav-tools { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  height: 38px; min-width: 38px; padding: 0 11px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 14px; font-family: var(--sans); display: inline-flex; align-items: center; gap: 6px;
  transition: .16s var(--ease);
}
.icon-btn:hover { border-color: var(--brand-1); color: var(--brand-1); }
.lang-btn { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.nav-toggle { display: none; }

/* ── Hero ── */
.hero { position: relative; padding: 92px 0 64px; }
.eyebrow {
  display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--brand-1); padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--card-brd); background: var(--surface); margin-bottom: 22px;
}
.hero h1 { font-size: clamp(34px, 5.6vw, 60px); line-height: 1.08; margin: 0 0 18px; letter-spacing: -.02em; font-weight: 780; }
.hero .lead { font-size: clamp(16px, 2vw, 19px); color: var(--ink-2); max-width: 720px; margin: 0 0 30px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: .16s var(--ease);
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 26px -8px var(--glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -10px var(--glow); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand-1); color: var(--brand-1); }
/* ── 统计条 ── */
.stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 46px; }
.stat {
  flex: 1; min-width: 140px; padding: 20px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--card-brd); backdrop-filter: blur(10px);
}
.stat .num { font-size: 34px; font-weight: 800; font-family: var(--mono); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .lbl { font-size: 13px; color: var(--ink-3); margin-top: 4px; }

/* ── 区块 ── */
.section { padding: 66px 0; }
.section-sm { padding: 40px 0; }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 42px; }
.section-head .eyebrow { margin-bottom: 14px; }
.section-title { font-size: clamp(26px, 3.6vw, 38px); margin: 0 0 12px; letter-spacing: -.02em; font-weight: 740; }
.section-desc { color: var(--ink-2); font-size: 16px; margin: 0; }

/* ── 卡片网格 ── */
.grid { display: grid; gap: 18px; }
.feat-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--card-brd); border-radius: var(--radius);
  padding: 26px; backdrop-filter: blur(10px); transition: .18s var(--ease);
}
.card:hover { border-color: var(--brand-1); transform: translateY(-3px); box-shadow: var(--shadow); }
.card-pad { padding: 30px; }
.feat-ico {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 22px;
  background: var(--glow); margin-bottom: 16px;
}
.feat-title { font-size: 17px; margin: 0 0 8px; font-weight: 660; }
.feat-desc { color: var(--ink-2); font-size: 14px; margin: 0; }

/* ── 能力清单（键值行）── */
.cap-list { display: flex; flex-direction: column; gap: 12px; }
.cap-row {
  display: grid; grid-template-columns: 220px 1fr; gap: 20px; padding: 18px 22px;
  background: var(--surface); border: 1px solid var(--card-brd); border-radius: var(--radius-sm);
}
.cap-key { font-weight: 640; font-size: 15px; }
.cap-val { color: var(--ink-2); font-size: 14px; }
.cap-val code, .feat-desc code, .cap-key code { font-family: var(--mono); font-size: 12.5px; background: var(--glow); color: var(--brand-1); padding: 1px 6px; border-radius: 5px; }
html[data-theme="dark"] .cap-val code, html[data-theme="dark"] .feat-desc code { color: #a9bcff; }

/* ── 标签 ── */
.tag {
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 12px;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--card-brd); background: var(--surface); color: var(--ink-2);
}
.tag-ok { color: #17a673; border-color: rgba(34, 197, 122, .35); }
html[data-theme="dark"] .tag-ok { color: #4ade9b; }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, .7); }

/* ── 代码块 ── */
pre {
  background: var(--code-bg); color: var(--code-ink); border-radius: var(--radius-sm);
  padding: 20px 22px; overflow: auto; font-family: var(--mono); font-size: 13px; line-height: 1.66;
  border: 1px solid var(--line);
}
pre code { font-family: inherit; background: none; color: inherit; padding: 0; }
.cm { color: #7e8aa5; } .kw { color: #e0955b; } .st { color: #8fd08f; } .ty { color: #6fb8e6; } .fn { color: #e6c86f; } .nu { color: #d98fd0; }

/* ── 里程碑表 ── */
.ms-table { width: 100%; border-collapse: collapse; font-size: 13.5px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--card-brd); background: var(--surface); }
.ms-table th { text-align: left; padding: 12px 15px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); background: var(--bg-2); border-bottom: 1px solid var(--line); }
.ms-table td { padding: 11px 15px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.ms-table tr:last-child td { border-bottom: none; }
.ms-table tr:hover td { background: var(--glow); }
.ms-table .mid { font-family: var(--mono); font-weight: 700; color: var(--brand-1); white-space: nowrap; }
html[data-theme="dark"] .ms-table .mid { color: #a9bcff; }
.ms-table .cap { color: var(--ink); font-weight: 560; }

/* ── 面包屑 ── */
.breadcrumb { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }
.breadcrumb a:hover { color: var(--brand-1); }
.page-hero { position: relative; padding: 56px 0 30px; }
.page-title { font-size: clamp(28px, 4vw, 42px); margin: 0; letter-spacing: -.02em; font-weight: 760; }
.page-lead { color: var(--ink-2); font-size: 17px; max-width: 760px; margin: 14px 0 0; }

/* ── 实时嵌入表格 ── */
.live-embed {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--card-brd);
  box-shadow: var(--shadow); background: var(--surface-solid);
}
.live-embed cmx-megasheet { display: block; width: 100%; height: 460px; }
.embed-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--bg-2); font-family: var(--mono); font-size: 12px; color: var(--ink-3);
}
.embed-dot { width: 11px; height: 11px; border-radius: 50%; }
.embed-dot.r { background: #ff5f57; } .embed-dot.y { background: #febc2e; } .embed-dot.g { background: #28c840; }

/* ── 演示画廊卡片 ── */
.demo-card { display: block; position: relative; overflow: hidden; }
.demo-card .mid {
  display: inline-block; font-family: var(--mono); font-weight: 700; font-size: 12.5px; color: #fff;
  background: var(--grad); border-radius: 7px; padding: 3px 10px; margin-bottom: 10px;
}
.demo-card h3 { font-size: 16px; margin: 0 0 6px; font-weight: 640; }
.demo-card p { font-size: 13px; color: var(--ink-2); margin: 0; }
.demo-card .chk { margin-top: 12px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 7px; }
.demo-card .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); opacity: .4; }
.demo-card .dot.ok { background: #22c55e; opacity: 1; box-shadow: 0 0 7px rgba(34, 197, 94, .6); }
.demo-card .dot.no { background: #f0616d; opacity: 1; }
.demo-card .arrow { position: absolute; right: 18px; top: 18px; color: var(--ink-3); transition: .16s var(--ease); }
.demo-card:hover .arrow { color: var(--brand-1); transform: translate(3px, -3px); }

/* ── 页脚 ── */
.footer { border-top: 1px solid var(--line); padding: 32px 0; margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--ink-3); font-size: 13px; }

/* ── i18n 可见性：默认显示 zh，切 en 时翻转 ── */
html[data-lang="zh"] [data-lang-en] { display: none; }
html[data-lang="en"] [data-lang-zh] { display: none; }
/* 行内块保持 inline */
.i18n-inline { display: inline; }
html[data-lang="zh"] span[data-lang-en].i18n-inline,
html[data-lang="en"] span[data-lang-zh].i18n-inline { display: none; }

/* ── 滚动进入动画 ── */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ── 响应式 ── */
@media (max-width: 860px) {
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--nav-bg); backdrop-filter: blur(16px); padding: 12px; border-bottom: 1px solid var(--line); }
  .nav-links.open { display: flex; }
  .nav-toggle { display: inline-flex; }
  .cap-row { grid-template-columns: 1fr; gap: 8px; }
  .stat .num { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { transition: none; opacity: 1; transform: none; }
  * { scroll-behavior: auto; }
}

