/* =========================================================
   Arksc 笔记 · 个人技术博客
   纯静态样式，无外部依赖
   ========================================================= */

:root {
  --bg: #f7f5f0;
  --bg-soft: #efece5;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --ink: #1f2933;
  --ink-soft: #3e4c59;
  --muted: #6b7280;
  --line: #e3ded4;
  --line-strong: #d6cfc2;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d9f0ec;
  --warm: #b45309;
  --warm-soft: #fdf0dd;
  --code-bg: #17211f;
  --code-ink: #d7f3ec;
  --shadow-sm: 0 1px 2px rgba(31, 41, 51, .05);
  --shadow-md: 0 10px 30px rgba(31, 41, 51, .08);
  --radius: 14px;
  --radius-sm: 9px;
  --max: 1080px;
  --header-h: 72px;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #121615;
  --bg-soft: #181d1c;
  --surface: #1b211f;
  --surface-2: #161b1a;
  --ink: #e8ece9;
  --ink-soft: #c2cbc6;
  --muted: #94a09a;
  --line: #2b3431;
  --line-strong: #3a4541;
  --accent: #5eead4;
  --accent-strong: #99f6e4;
  --accent-soft: #14332f;
  --warm: #fbbf24;
  --warm-soft: #332812;
  --code-bg: #0c1211;
  --code-ink: #d7f3ec;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, .35);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(15, 118, 110, .06), transparent 32%),
    radial-gradient(circle at 88% 2%, rgba(180, 83, 9, .05), transparent 30%);
}

[data-theme="dark"] body::before {
  background-image:
    radial-gradient(circle at 12% 8%, rgba(94, 234, 212, .05), transparent 32%),
    radial-gradient(circle at 88% 2%, rgba(251, 191, 36, .04), transparent 30%);
}

::selection {
  background: var(--accent);
  color: #fff;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover { color: var(--accent); }

img { max-width: 100%; height: auto; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  line-height: 1.35;
  letter-spacing: .01em;
  margin: 0 0 .6em;
  color: var(--ink);
}

p { margin: 0 0 1.1em; }

ul, ol { margin: 0 0 1.2em; padding-left: 1.4em; }
li { margin: .35em 0; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4rem 0;
}

.container {
  width: min(100% - 40px, var(--max));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 999;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 8px;
  transition: top .2s;
}
.skip-link:focus { top: 12px; color: var(--bg); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, background .2s;
}

.site-header.scrolled {
  border-bottom-color: var(--line);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { color: var(--ink); }

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .02em;
  line-height: 1.25;
}
.brand-text small {
  font-weight: 400;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.site-nav a {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14.5px;
  transition: background .18s, color .18s;
}
.site-nav a:hover { background: var(--bg-soft); color: var(--ink); }
.site-nav a.active { color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 18px; height: 18px; }

.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }

.menu-toggle { display: none; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 76px 0 64px;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  gap: 56px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
  margin-bottom: 22px;
}
.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.hero h1 {
  font-size: clamp(38px, 5.4vw, 62px);
  line-height: 1.12;
  letter-spacing: -.02em;
  margin-bottom: 20px;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent-strong);
  position: relative;
  white-space: nowrap;
}
.hero h1 em::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 9px;
  background: var(--accent-soft);
  z-index: -1;
  border-radius: 3px;
}

.hero-lead {
  max-width: 560px;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.9;
  margin-bottom: 30px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: transform .18s, background .18s, box-shadow .18s, border-color .18s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-strong); color: #fff; box-shadow: var(--shadow-md); }
.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-soft);
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--line-strong); }
.btn svg { width: 16px; height: 16px; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 13px;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta svg { width: 15px; height: 15px; color: var(--accent); }

/* Hero notebook card */
.notebook {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transform: rotate(1.2deg);
  transition: transform .3s;
}
.notebook:hover { transform: rotate(0deg) translateY(-3px); }

.notebook::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.notebook-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px 13px 38px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.notebook-head strong { font-size: 13px; letter-spacing: .04em; }
.notebook-head span { font-size: 11px; color: var(--muted); }

.notebook-list { list-style: none; margin: 0; padding: 8px 20px 14px 38px; }
.notebook-list li { margin: 0; border-bottom: 1px dashed var(--line); }
.notebook-list li:last-child { border-bottom: 0; }
.notebook-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
}
.notebook-list a:hover { color: var(--accent-strong); }
.notebook-list .idx {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  width: 24px;
  flex-shrink: 0;
}
.notebook-list .tag {
  margin-left: auto;
  font-size: 10px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 2px 6px;
  flex-shrink: 0;
}

.notebook-note {
  margin: 0;
  padding: 12px 20px 14px 38px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

/* ---------- Sections ---------- */

.section { padding: 62px 0; }
.section-tight { padding: 40px 0; }
.section-alt {
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}
.section-head h2 {
  font-size: clamp(24px, 3vw, 32px);
  margin: 0;
}
.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.section-head .more {
  font-size: 13.5px;
  text-decoration: none;
  white-space: nowrap;
  color: var(--accent-strong);
}
.section-head .more:hover { text-decoration: underline; }

/* Tutorial cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.tut-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 26px 24px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .22s, box-shadow .22s, border-color .22s;
  overflow: hidden;
}
.tut-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  color: inherit;
}
.tut-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 0;
  background: var(--accent);
  transition: height .25s;
}
.tut-card:hover::before { height: 100%; }

.tut-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 21px;
  margin-bottom: 18px;
}
.tut-card:nth-child(2) .tut-icon { background: var(--warm-soft); color: var(--warm); }
.tut-card:nth-child(3) .tut-icon { background: var(--bg-soft); color: var(--ink-soft); }

.tut-card h3 {
  font-size: 19px;
  margin-bottom: 8px;
  letter-spacing: 0;
}
.tut-card p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.75;
  margin-bottom: 18px;
  flex: 1;
}
.tut-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.tut-tags span {
  font-size: 10.5px;
  color: var(--muted);
  background: var(--bg-soft);
  border-radius: 4px;
  padding: 3px 7px;
  letter-spacing: .02em;
}
.tut-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}
.tut-foot .arrow { color: var(--accent-strong); font-size: 16px; transition: transform .2s; }
.tut-card:hover .tut-foot .arrow { transform: translateX(3px); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 20px;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.timeline li:last-child { border-bottom: 0; }
.timeline time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .02em;
}
.timeline a { color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; }
.timeline a:hover { color: var(--accent-strong); text-decoration: underline; }
.timeline .kind {
  font-size: 10.5px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}

/* Note / callout */
.note {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink-soft);
  padding: 16px 18px;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  margin: 24px 0;
}
.note strong { color: var(--accent-strong); }
.note.warn { border-left-color: var(--warm); background: var(--warm-soft); }
.note.warn strong { color: var(--warm); }

/* About strip */
.about-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
  padding: 34px 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.about-strip h2 { font-size: 24px; margin-bottom: 8px; }
.about-strip p { margin: 0; color: var(--muted); font-size: 14px; max-width: 680px; }
.about-strip .btn { white-space: nowrap; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 20px;
  padding: 46px 0 34px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr .7fr 1.1fr;
  gap: 36px;
}

.footer-brand p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 280px;
  line-height: 1.8;
}
.footer-brand .brand-mark { width: 34px; height: 34px; font-size: 19px; border-radius: 9px; }
.footer-brand .brand-text { font-size: 15px; }

.footer-col h3 {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 4px 0 12px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 7px 0; }
.footer-col a { color: var(--ink-soft); text-decoration: none; font-size: 13px; }
.footer-col a:hover { color: var(--accent-strong); text-decoration: underline; }

.footer-meta {
  text-align: right;
  color: var(--muted);
  font-size: 12px;
}
.footer-meta p { margin: 5px 0; }
.footer-meta .beian { line-height: 1.9; }
.footer-meta .beian a { color: var(--muted); text-decoration: none; }
.footer-meta .beian a:hover { color: var(--accent-strong); text-decoration: underline; }
.footer-meta .sep { margin: 0 6px; color: var(--line-strong); }
.footer-meta .disclaimer { font-size: 11px; opacity: .85; }

.footer-bottom {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.footer-bottom .beian {
  margin: 4px 0;
  font-size: 12px;
  color: var(--muted);
}
.footer-bottom .beian a {
  color: var(--muted);
  text-decoration: none;
}
.footer-bottom .beian a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}
.footer-bottom .disclaimer {
  margin: 5px 0;
  font-size: 11px;
  color: var(--muted);
  opacity: .85;
}
.footer-bottom .disclaimer a { color: var(--muted); }
.footer-bottom .disclaimer a:hover { color: var(--accent-strong); }

/* ---------- Page header (inner pages) ---------- */

.page-head {
  padding: 58px 0 40px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.page-head .eyebrow { margin-bottom: 18px; }
.page-head h1 {
  font-size: clamp(32px, 4.4vw, 48px);
  letter-spacing: -.01em;
  margin-bottom: 12px;
}
.page-head p {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.85;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 18px;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-strong); text-decoration: underline; }
.breadcrumb .sep { color: var(--line-strong); }

/* ---------- Tutorial index ---------- */

.tut-list { display: grid; gap: 18px; }

.tut-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.tut-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
  color: inherit;
}
.tut-row .num {
  font-family: var(--font-serif);
  font-size: 34px;
  color: var(--line-strong);
  line-height: 1;
  text-align: center;
}
.tut-row h2 { font-size: 20px; margin-bottom: 5px; }
.tut-row p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.tut-row .meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.tut-row .meta span {
  font-size: 10.5px;
  color: var(--muted);
  background: var(--bg-soft);
  padding: 2px 7px;
  border-radius: 4px;
}
.tut-row .go {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  font-size: 16px;
  transition: background .2s, transform .2s;
}
.tut-row:hover .go { background: var(--accent-soft); transform: translateX(2px); }

/* ---------- Article ---------- */

.article-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 56px;
  padding: 44px 0 70px;
  align-items: start;
}

.article {
  min-width: 0;
  max-width: 760px;
}

.article-header {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 30px;
}
.article-header h1 {
  font-size: clamp(30px, 3.8vw, 42px);
  letter-spacing: -.01em;
  line-height: 1.25;
  margin-bottom: 14px;
}
.article-header .dek {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.85;
  margin-bottom: 18px;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}
.article-meta span { display: inline-flex; align-items: center; gap: 5px; }
.article-meta svg { width: 14px; height: 14px; }

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.article-tags span {
  font-size: 10.5px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 3px 8px;
  letter-spacing: .02em;
}

.prose { font-size: 15.5px; line-height: 1.95; color: var(--ink-soft); }
.prose h2 {
  font-size: 25px;
  margin: 2.2em 0 .7em;
  padding-top: .2em;
  color: var(--ink);
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.prose h2:first-child { margin-top: 0; }
.prose h3 {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  margin: 1.8em 0 .55em;
  color: var(--ink);
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.prose h4 {
  font-family: var(--font-sans);
  font-size: 15.5px;
  font-weight: 700;
  margin: 1.5em 0 .4em;
  color: var(--ink);
}
.prose p { margin: 0 0 1.15em; }
.prose strong { color: var(--ink); font-weight: 700; }
.prose em { color: var(--ink); }

.prose a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
}
.prose a:hover { text-decoration-color: var(--accent); }

.prose ul,
.prose ol { margin: 0 0 1.2em; padding-left: 1.35em; }
.prose li { margin: .4em 0; }
.prose li::marker { color: var(--accent); }

.prose blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
  font-style: normal;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--ink);
  white-space: break-spaces;
}

.prose pre {
  margin: 1.5em 0;
  padding: 18px 20px;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
  box-shadow: var(--shadow-sm);
}
.prose pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
  white-space: pre;
}

.pre-wrap { position: relative; margin: 1.5em 0; }
.pre-wrap pre { margin: 0; }
.copy-btn {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 5px;
  background: rgba(255, 255, 255, .08);
  color: #b8d8d0;
  font-family: var(--font-sans);
  font-size: 10.5px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .18s, background .18s, color .18s;
}
.pre-wrap:hover .copy-btn,
.copy-btn:focus { opacity: 1; }
.copy-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.prose th,
.prose td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.prose th {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .02em;
}
.prose tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }

.prose .steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1.5em 0;
}
.prose .steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 42px;
  margin: 0 0 1em;
}
.prose .steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

/* TOC aside */
.article-aside {
  position: sticky;
  top: calc(var(--header-h) + 28px);
}
.toc {
  padding: 18px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.toc h2 {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; margin: 0; }
.toc a {
  display: block;
  padding: 5px 0 5px 24px;
  position: relative;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 12.5px;
  line-height: 1.55;
  border-radius: 4px;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--line-strong);
}
.toc a:hover { color: var(--accent-strong); background: var(--bg-soft); }
.toc a.active { color: var(--accent-strong); font-weight: 600; }

.aside-note {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}
.aside-note strong { color: var(--ink-soft); }

/* Article footer nav */
.article-foot {
  margin-top: 46px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}
.article-foot .license {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
  max-width: 430px;
}
.article-foot .license a { color: var(--muted); }
.article-foot .back {
  font-size: 13px;
  text-decoration: none;
  color: var(--accent-strong);
  white-space: nowrap;
}
.article-foot .back:hover { text-decoration: underline; }

.prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 28px;
}
.pn-card {
  display: block;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: border-color .2s, transform .2s;
}
.pn-card:hover { border-color: var(--line-strong); transform: translateY(-2px); color: inherit; }
.pn-card .label {
  display: block;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.pn-card .title { font-size: 14px; font-weight: 600; color: var(--ink); }
.pn-card.next { text-align: right; }

/* ---------- About page ---------- */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 30px;
}
.about-card {
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.about-card h2 { font-size: 20px; margin-bottom: 10px; }
.about-card p { color: var(--muted); font-size: 14px; margin-bottom: 0; }
.about-card ul { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.about-card li { margin: .5em 0; }
.about-card strong { color: var(--ink-soft); }

.about-hero {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  align-items: center;
}
.about-hero h1 { font-size: clamp(32px, 4vw, 44px); }
.about-hero p { color: var(--muted); font-size: 16px; }
.about-portrait {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.about-portrait .avatar {
  width: 78px;
  height: 78px;
  margin: 0 auto 14px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 700;
}
.about-portrait strong { display: block; font-size: 16px; }
.about-portrait span { color: var(--muted); font-size: 12px; }
.about-portrait .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 14px;
}
.about-portrait .tags span {
  font-size: 10.5px;
  background: var(--bg-soft);
  color: var(--muted);
  border-radius: 4px;
  padding: 3px 7px;
}

/* ---------- 404 ---------- */

.center-page {
  min-height: 62vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 70px 20px;
}
.center-page .code {
  font-family: var(--font-serif);
  font-size: clamp(72px, 14vw, 140px);
  line-height: 1;
  color: var(--line-strong);
  margin-bottom: 10px;
}
.center-page h1 { font-size: 28px; margin-bottom: 10px; }
.center-page p { color: var(--muted); max-width: 460px; margin: 0 auto 24px; }

/* ---------- Utilities ---------- */

.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .notebook { max-width: 520px; transform: none; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .article-wrap { grid-template-columns: 1fr; gap: 32px; }
  .article-aside { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-meta { text-align: left; grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--line); }
  .about-hero { grid-template-columns: 1fr; }
  .about-portrait { max-width: 340px; }
}

@media (max-width: 720px) {
  .container { width: min(100% - 32px, var(--max)); }
  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px 16px 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 11px 12px; font-size: 15px; }
  .menu-toggle { display: grid; }
  .header-actions { margin-left: 0; }
  .hero { padding: 48px 0 40px; }
  .hero h1 { font-size: clamp(34px, 9vw, 48px); }
  .hero-lead { font-size: 15.5px; }
  .section { padding: 44px 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .card-grid { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 78px 1fr; gap: 12px; }
  .timeline .kind { grid-column: 2; justify-self: start; margin-top: -4px; }
  .about-strip { grid-template-columns: 1fr; padding: 26px 24px; }
  .tut-row { grid-template-columns: 42px 1fr; gap: 14px; padding: 22px 20px; }
  .tut-row .num { font-size: 24px; }
  .tut-row .go { display: none; }
  .page-head { padding: 40px 0 30px; }
  .article-wrap { padding: 30px 0 50px; }
  .prose { font-size: 15px; }
  .prose h2 { font-size: 22px; }
  .prev-next { grid-template-columns: 1fr; }
  .pn-card.next { text-align: left; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-meta { padding-top: 18px; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .site-header, .site-footer, .article-aside, .prev-next, .article-foot .back { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .article-wrap { display: block; padding: 0; }
  .article { max-width: none; }
  .prose a { color: #000; text-decoration: none; }
  .prose pre { white-space: pre-wrap; background: #f3f3f3; color: #000; }
}
