/* ═══ 七日世界教学站 · 共享样式 ═══
   设计方向：深空观测台 —— 星光流动背景 + 玻璃面板 + 紧凑克制的排版
   唯一允许出现原始色值的地方就是这里的 :root 令牌块 */
:root {
  --bg:      oklch(17% 0.03 264);
  --bg-glow-1: oklch(30% 0.09 280 / 0.5);
  --bg-glow-2: oklch(30% 0.07 210 / 0.35);
  --bg-glow-3: oklch(28% 0.06 90 / 0.18);
  --surface: oklch(22% 0.028 264 / 0.72);
  --surface-solid: oklch(22% 0.028 264);
  --fg:      oklch(94% 0.012 260);
  --muted:   oklch(72% 0.02 260);
  --border:  oklch(88% 0.02 260 / 0.14);
  --accent:  oklch(82% 0.115 195);
  --star:    oklch(85% 0.1 90);

  --accent-soft: color-mix(in oklch, var(--accent) 16%, transparent);
  --fg-soft:     color-mix(in oklch, var(--fg) 7%, transparent);

  --font-display: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'IBM Plex Mono', ui-monospace, Menlo, monospace;

  /* 排版整体降级：小一号、少喧哗，信息靠层级而不是靠字号压人 */
  --fs-h1: clamp(30px, 4vw, 46px);
  --fs-h2: clamp(21px, 2.6vw, 28px);
  --fs-h3: 17px;
  --fs-lead: 16px;
  --fs-body: 15.5px;
  --fs-meta: 13px;

  --gap-xs: 8px;
  --gap-sm: 12px;
  --gap-md: 20px;
  --gap-lg: 32px;
  --gap-xl: 56px;
  --gap-2xl: 96px;
  --container: 1080px;
  --gutter: 28px;

  --radius: 10px;
  --radius-lg: 16px;
}

/* ─── reset & base ─── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  /* 星云底色：固定不随滚动，星光画布叠在其上 */
  background:
    radial-gradient(56rem 34rem at 12% -6%, var(--bg-glow-1), transparent 62%),
    radial-gradient(48rem 30rem at 96% 8%, var(--bg-glow-2), transparent 60%),
    radial-gradient(40rem 26rem at 70% 108%, var(--bg-glow-3), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; }
::selection { background: var(--accent-soft); color: var(--fg); }

/* 内容浮于星光之上 */
.topnav, .mobilemenu, main, .pagefoot { position: relative; z-index: 1; }

/* ─── 星光流动画布（由 site.js 注入） ─── */
#starfield {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ─── layout ─── */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(44px, 6vw, 76px); }
.section + .section { border-top: 1px solid var(--border); }
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--gap-md); }
.row { display: flex; align-items: center; gap: var(--gap-md); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap-md); }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--gap-xl); align-items: start; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: var(--gap-xl); align-items: start; }
@media (max-width: 920px) {
  .grid-2, .grid-3, .grid-4, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .topnav nav { display: none; }
  .topnav .navtoggle { display: inline-flex !important; }
}

/* ─── type ─── */
.h1, h1 { font-family: var(--font-display); font-size: var(--fs-h1); line-height: 1.12; letter-spacing: -0.02em; margin: 0; font-weight: 700; }
.h2, h2 { font-family: var(--font-display); font-size: var(--fs-h2); line-height: 1.22; letter-spacing: -0.012em; margin: 0; font-weight: 650; }
.h3, h3 { font-size: var(--fs-h3); font-weight: 600; line-height: 1.35; letter-spacing: -0.005em; margin: 0; }
.lead { font-size: var(--fs-lead); line-height: 1.65; color: var(--muted); max-width: 58ch; margin: 0; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--gap-sm);
}
.meta { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--muted); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
/* 正文内强调：浅色发光代替加粗轰炸 */
strong { color: var(--fg); font-weight: 600; }

/* ─── topnav ─── */
.topnav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in oklch, var(--surface-solid) 72%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topnav-inner { display: flex; align-items: center; justify-content: space-between; padding-block: 13px; }
.topnav .logo { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; display: inline-flex; align-items: baseline; gap: 8px; }
.topnav .logo .ver { font-family: var(--font-mono); font-size: 11px; color: var(--star); font-weight: 400; }
.topnav nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav nav a {
  font-size: 14px; color: var(--muted); padding: 6px 12px; border-radius: 999px;
  transition: color 0.18s ease, background 0.18s ease;
}
.topnav nav a:hover { color: var(--fg); background: var(--fg-soft); }
.topnav nav a.active { color: var(--accent); background: var(--accent-soft); }
.topnav .navtoggle { display: none; }
/* 移动端折叠菜单 */
.mobilemenu { display: none; border-bottom: 1px solid var(--border); background: color-mix(in oklch, var(--surface-solid) 88%, transparent); backdrop-filter: blur(14px); }
.mobilemenu.open { display: block; }
.mobilemenu nav { display: flex; flex-direction: column; padding: 12px var(--gutter) 16px; gap: 4px; }
.mobilemenu nav a { padding: 11px 0; font-size: 15px; color: var(--fg); border-bottom: 1px solid var(--border); }
.mobilemenu nav a:last-child { border-bottom: 0; }

/* ─── buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 550;
  letter-spacing: -0.005em;
  transition: transform 0.06s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent); color: oklch(18% 0.03 264); border-color: var(--accent);
  box-shadow: 0 0 0 0 transparent;
}
.btn-primary:hover { box-shadow: 0 4px 22px var(--accent-soft), 0 0 14px var(--accent-soft); }
.btn-secondary { background: transparent; color: var(--fg); border-color: var(--border); }
.btn-secondary:hover { border-color: color-mix(in oklch, var(--fg) 40%, transparent); background: var(--fg-soft); }
.btn-ghost { background: transparent; color: var(--fg); border-color: transparent; padding-inline: 8px; }
.btn-ghost:hover { color: var(--accent); }
.btn-arrow::after { content: '→'; transition: transform 0.18s ease; }
.btn-arrow:hover::after { transform: translateX(3px); }
a:focus-visible, button:focus-visible, summary:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}

/* ─── cards（玻璃面板） ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in oklch, var(--accent) 45%, var(--border));
  box-shadow: 0 12px 32px oklch(10% 0.03 264 / 0.45), 0 0 18px var(--accent-soft);
}
.card-flat { background: transparent; border: 0; padding: 0; backdrop-filter: none; }
.card-flat:hover, .card-flat.card:hover { border-color: transparent; transform: none; box-shadow: none; }
.card h3 { margin-bottom: 8px; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ─── feature cell ─── */
.feature .feature-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--accent);
  margin-bottom: var(--gap-md);
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--accent-soft);
}
.feature h3 { margin-bottom: 6px; }
.feature p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ─── stat（数据锚点，收敛字号） ─── */
.stat .stat-num {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.6vw, 54px);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-weight: 700;
}
.stat .stat-label { color: var(--muted); font-size: 13.5px; margin-top: 8px; max-width: 26ch; }
.stat .stat-unit { font-size: 0.5em; opacity: 0.7; margin-left: 2px; }

/* ─── pill / tag / chip ─── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
}
.chip {
  display: inline-flex; align-items: center;
  padding: 7px 15px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13.5px;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); color: oklch(18% 0.03 264); border-color: var(--accent); }

/* ─── table ─── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.ds-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ds-table th, .ds-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.ds-table tr:last-child td { border-bottom: 0; }
.ds-table th { color: var(--muted); font-weight: 500; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.ds-table tbody tr { transition: background 0.15s ease; }
.ds-table tbody tr:hover { background: var(--fg-soft); }
.ds-table .num-col { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.ds-table .drop-yes { color: var(--accent); font-family: var(--font-mono); text-align: center; }
.table-note { color: var(--muted); font-size: 13px; margin-top: 12px; }

/* ─── callout（说明框） ─── */
.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.callout .callout-head {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}
.callout .callout-head strong { color: var(--fg); font-weight: 600; }
.callout p { margin: 0; font-size: 14.5px; color: var(--muted); }
.callout p strong { color: var(--fg); }
.callout p + p { margin-top: 8px; }

/* ─── 步骤列表 ─── */
.step { display: grid; grid-template-columns: 48px 1fr; gap: var(--gap-md); padding: 22px 0; border-top: 1px solid var(--border); }
.step-num {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid color-mix(in oklch, var(--accent) 40%, var(--border));
  border-radius: 999px;
  font-family: var(--font-mono); font-size: 14px; color: var(--accent); font-weight: 600;
  background: var(--accent-soft);
  box-shadow: 0 0 12px var(--accent-soft);
}
.step h3 { margin-bottom: 6px; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ─── log row（列表行） ─── */
.log-row {
  display: grid; grid-template-columns: 130px 1fr 110px;
  gap: var(--gap-lg); padding: 20px 0;
  border-top: 1px solid var(--border); align-items: baseline;
}
.log-row .meta { color: var(--muted); }
.log-row h3 { font-size: 17px; margin: 0 0 4px; transition: color 0.18s ease; }
.log-row p { margin: 0; color: var(--muted); font-size: 14px; }
.log-row .pull { text-align: right; }
a.loglink:hover h3 { color: var(--accent); }
@media (max-width: 920px) {
  .log-row { grid-template-columns: 1fr; gap: 6px; }
  .log-row .pull { text-align: left; }
}

/* ─── FAQ 折叠 ─── */
.faq { border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 4px; cursor: pointer; list-style: none;
  font-size: 16px; font-weight: 600;
  transition: color 0.18s ease;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; font-family: var(--font-mono); font-size: 19px; color: var(--accent);
  transition: transform 0.2s ease; flex-shrink: 0;
}
.faq details[open] summary::after { content: '−'; }
.faq summary:hover { color: var(--accent); }
.faq .faq-body { padding: 0 4px 20px; color: var(--muted); font-size: 14.5px; max-width: 72ch; }
.faq .faq-body p { margin: 0 0 10px; }
.faq .faq-body p:last-child { margin-bottom: 0; }
.faq .faq-body strong { color: var(--fg); }

/* ─── hero ─── */
.hero { padding-block: clamp(56px, 9vw, 110px); }
.hero-center { text-align: center; max-width: 40ch; margin-inline: auto; }
.hero h1 { margin-bottom: var(--gap-md); }
.hero .lead { margin-inline: auto; margin-bottom: var(--gap-lg); }
.hero-cta { display: inline-flex; gap: var(--gap-sm); flex-wrap: wrap; justify-content: center; }

/* ─── page header（子页页头：只有面包屑+小标，紧凑） ─── */
.pagehead { padding-block: clamp(28px, 4vw, 44px); text-align: center; }
.pagehead .eyebrow { margin-bottom: 10px; }
.pagehead h1 { margin-bottom: 12px; }
.pagehead .lead { margin-inline: auto; }
.crumbs { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.crumbs a:hover { color: var(--fg); }

/* ─── 关键词卡片 ─── */
.kw-card { position: relative; }
.kw-card .kw-type {
  position: absolute; top: 22px; right: 22px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em;
  color: var(--star);
}

/* ─── footer ─── */
.pagefoot { padding-block: var(--gap-xl); color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }
.pagefoot .row-between { flex-wrap: wrap; gap: var(--gap-md); }
.pagefoot a:hover { color: var(--fg); }

/* ─── 滚动渐显（site.js 添加 .rv，入视口后加 .in） ─── */
.rv { opacity: 0; transform: translateY(16px); }
.rv.in {
  opacity: 1; transform: none;
  transition: opacity 0.65s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.65s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--rv-delay, 0ms);
}
/* JS 不可用时兜底：不隐藏内容 */
.no-js .rv, html:not(.js) .rv { opacity: 1; transform: none; }

/* ─── 动效降级 ─── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; }
  .rv.in { transition: none; }
  .card, .card:hover { transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ─── AI 问答组件「星尘助手」（ai.js 注入） ─── */
.ai-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border: 1px solid color-mix(in oklch, var(--accent) 45%, var(--border));
  border-radius: 999px;
  background: color-mix(in oklch, var(--surface-solid) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--fg); font-size: 14.5px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 28px oklch(10% 0.03 264 / 0.5), 0 0 16px var(--accent-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.ai-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 34px oklch(10% 0.03 264 / 0.55), 0 0 24px var(--accent-soft); }
.ai-fab .ai-fab-star { color: var(--accent); }
.ai-fab.hide { opacity: 0; pointer-events: none; transform: translateY(8px); }

.ai-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 61;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 40px));
  display: flex; flex-direction: column;
  border: 1px solid color-mix(in oklch, var(--accent) 30%, var(--border));
  border-radius: var(--radius-lg);
  background: color-mix(in oklch, var(--surface-solid) 88%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px oklch(10% 0.03 264 / 0.6), 0 0 24px var(--accent-soft);
  overflow: hidden;
}
.ai-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
}
.ai-head-title { display: inline-flex; align-items: baseline; gap: 8px; font-weight: 650; font-size: 15px; }
.ai-head-title .ai-head-star { color: var(--accent); }
.ai-head-title .ai-head-sub { font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-weight: 400; }
.ai-head-actions { display: inline-flex; gap: 4px; }
.ai-iconbtn {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font-size: 15px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ai-iconbtn:hover { background: var(--fg-soft); color: var(--fg); }

.ai-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ai-msgs::-webkit-scrollbar { width: 6px; }
.ai-msgs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.ai-msg { display: flex; }
.ai-msg.ai-user { justify-content: flex-end; }
.ai-bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px; line-height: 1.6;
  word-break: break-word;
}
.ai-msg.ai-ai .ai-bubble { background: var(--fg-soft); border: 1px solid var(--border); border-top-left-radius: 4px; color: var(--fg); }
.ai-msg.ai-user .ai-bubble { background: var(--accent); border-top-right-radius: 4px; color: oklch(18% 0.03 264); }
.ai-bubble a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.ai-msg.ai-user .ai-bubble a { color: inherit; }
.ai-bubble code { font-family: var(--font-mono); font-size: 13px; background: var(--fg-soft); padding: 1px 5px; border-radius: 5px; }
/* 关键：display:flex 会压过 hidden 属性，必须显式写回，否则面板永远关不掉 */
.ai-panel[hidden] { display: none; }
/* 流式输出中的打字机光标 */
.ai-bubble.typing::after {
  content: '▍';
  color: var(--accent);
  margin-left: 1px;
  animation: ai-blink 0.85s steps(2, start) infinite;
}
@keyframes ai-blink { to { visibility: hidden; } }

.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.ai-chip {
  padding: 5px 11px;
  border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.ai-chip:hover { border-color: var(--accent); color: var(--accent); }

.ai-form { display: flex; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--border); }
.ai-input {
  flex: 1; min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--fg-soft); color: var(--fg); font: inherit; font-size: 14px;
}
.ai-input::placeholder { color: var(--muted); }
.ai-input:focus { outline: none; border-color: var(--accent); }
.ai-send {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 999px;
  background: var(--accent); color: oklch(18% 0.03 264);
  font-size: 15px; cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.ai-send:hover { transform: translateY(-1px); }
.ai-send:disabled { opacity: 0.5; cursor: default; transform: none; }

@media (max-width: 520px) {
  .ai-fab { right: 14px; bottom: 14px; padding: 11px 16px; }
  .ai-panel { right: 10px; bottom: 10px; }
}
