/* 只需调整这里的颜色，就能分别改变三套主题。 */
:root,
[data-theme="night"] {
  color-scheme: dark;
  --bg: #101722;
  --text: #f4f6fa;
  --muted: #b3bdcb;
  --surface: #192330;
  --line: #354152;
  --accent: #a8cbed;
  --code: #202e40;
}
[data-theme="snow"] {
  color-scheme: light;
  --bg: #f5f5f7;
  --text: #1d1d1f;
  --muted: #5a5a63;
  --surface: #ffffff;
  --line: #d1d1d8;
  --accent: #1764a1;
  --code: #e8edf3;
}
[data-theme="lavender"] {
  color-scheme: light;
  --bg: #f3f0f8;
  --text: #30273d;
  --muted: #655a73;
  --surface: #fcfaff;
  --line: #d4ccdf;
  --accent: #714b95;
  --code: #e8e0f0;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
a:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
}
::selection { background: var(--accent); color: var(--bg); }
code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.wrap { width: min(1040px, calc(100% - 64px)); margin-inline: auto; }
.skip-link {
  position: absolute;
  z-index: 10;
  top: 12px;
  left: 16px;
  padding: 12px 18px;
  background: var(--surface);
  transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }
.site-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 36px;
  border-bottom: 1px solid var(--line);
}
.brand { margin-right: auto; font-size: 29px; font-weight: 700; letter-spacing: -1.5px; }
.site-nav { display: flex; gap: 28px; font-size: 14px; }
.site-nav a { display: inline-flex; min-height: 44px; align-items: center; }
.theme-control { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.theme-control label { color: var(--muted); }
.theme-control select {
  min-height: 44px;
  max-width: 116px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.eyebrow { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.hero { padding-block: 100px 108px; }
.hero h1 { margin: 0; font-size: clamp(42px, 6vw, 78px); line-height: 1.16; font-weight: 650; letter-spacing: -2px; }
.hero h1 span { display: block; }
.hero h1 code { display: block; margin-top: 10px; color: var(--accent); font-size: 1.28em; letter-spacing: -4px; }
.hero-copy { max-width: 580px; margin: 32px 0 24px; color: var(--muted); font-size: 19px; line-height: 1.9; }
.text-link { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; color: var(--accent); font-size: 15px; }
.section { padding-block: 68px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 30px; }
.section-heading h2 { margin: 0; font-size: 34px; font-weight: 650; letter-spacing: -0.8px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.article-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.article-card {
  display: flex;
  flex-direction: column;
  min-height: 290px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  transition: transform 180ms ease, border-color 180ms ease;
}
.article-card:hover { transform: translateY(-3px); color: var(--text); border-color: var(--accent); }
.card-number { color: var(--accent); font: 13px "SFMono-Regular", Consolas, monospace; }
.article-card h3 { margin: 34px 0 12px; font-size: 24px; line-height: 1.5; letter-spacing: -0.5px; font-weight: 600; }
.article-card p { margin: 0 0 30px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; color: var(--muted); font-size: 12px; }
.card-meta .arrow { color: var(--accent); font-size: 22px; }
.about-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; }
.about-title { margin: 0; font-size: clamp(28px, 3.4vw, 39px); line-height: 1.5; letter-spacing: -0.8px; font-weight: 600; }
.about-copy { margin: 2px 0 0; color: var(--muted); font-size: 17px; line-height: 2; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 0; }
.specs div { padding-top: 18px; border-top: 1px solid var(--line); }
.specs dt { margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.specs dd { margin: 0; font-size: 17px; line-height: 1.7; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding-block: 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.8; }

/* 文章页：标题有充足空间，正文控制在舒适的阅读宽度。 */
.story-header { max-width: 880px; margin: 0 auto; padding: 88px 0 54px; text-align: center; }
.story-header h1 { margin: 0; font-size: clamp(36px, 5vw, 64px); line-height: 1.2; font-weight: 650; letter-spacing: -1.5px; text-wrap: balance; }
.story-header h1 code { white-space: nowrap; font-size: 0.96em; }
.title-part { display: inline-block; white-space: nowrap; }
.story-subtitle { margin: 24px 0 0; color: var(--muted); font-size: 23px; line-height: 1.65; text-wrap: balance; }
.story-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 20px; margin-top: 24px; color: var(--muted); font-size: 13px; }
.story-body { max-width: 660px; margin: 0 auto; padding: 0 0 70px; }
.story-body p { margin: 0 0 24px; font-size: 21px; line-height: 1.85; overflow-wrap: break-word; }
.story-body h2 { margin: 52px 0 22px; font-size: 29px; font-weight: 600; line-height: 1.5; letter-spacing: -0.5px; }
.story-body pre { margin: 30px 0; padding: 22px 24px; overflow-x: auto; background: var(--code); border-radius: 12px; font-size: 16px; line-height: 1.8; }
.story-body p code { white-space: nowrap; font-size: 0.9em; }
.story-end { padding-top: 28px; margin-top: 44px; border-top: 1px solid var(--line); }
.pending { min-height: 48vh; }
.pending .story-body { text-align: center; }
.pending .story-body p { color: var(--muted); }

@media (max-width: 760px) {
  .article-grid { grid-template-columns: 1fr; }
  .article-card { min-height: 230px; }
  .article-card h3 { margin-top: 24px; }
  .about-layout { grid-template-columns: 1fr; gap: 24px; }
  .story-header { padding-top: 62px; }
}
@media (max-width: 520px) {
  .wrap { width: calc(100% - 40px); }
  .site-header { min-height: 114px; flex-wrap: wrap; gap: 0 16px; padding-block: 14px 8px; }
  .site-nav { order: 3; width: 100%; gap: 24px; font-size: 13px; }
  .theme-control label { font-size: 12px; }
  .hero { padding-block: 62px 66px; }
  .hero h1 { letter-spacing: -1.3px; }
  .hero h1 code { letter-spacing: -3px; }
  .hero-copy { margin-top: 26px; font-size: 17px; }
  .section { padding-block: 46px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; margin-bottom: 24px; }
  .section-heading h2 { font-size: 29px; }
  .article-card { padding: 24px; }
  .specs { grid-template-columns: 1fr; gap: 22px; }
  .site-footer { flex-direction: column; gap: 6px; padding-block: 24px; }
  .story-header { padding-block: 52px 38px; text-align: left; }
  .story-header h1 { max-width: 340px; font-size: 38px; }
  .story-subtitle { margin-top: 20px; font-size: 20px; }
  .story-meta { justify-content: flex-start; margin-top: 20px; }
  .story-body { padding-bottom: 48px; }
  .story-body p { font-size: 17px; line-height: 1.95; }
  .story-body h2 { margin-top: 40px; font-size: 25px; }
  .story-body pre { padding: 18px; font-size: 14px; }
  .pending .story-header, .pending .story-body { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .article-card:hover { transform: none; }
}
