/* ============================================================================
   WorkBuddy Guide - Editorial Pixel Theme
   设计原则：
   - 像素只做记忆点，不做阅读负担
   - 绿色负责聚焦，黑白负责秩序
   - 减少柔和渐变和胶囊按钮
   - 装饰服务于章节、路径或状态
   ============================================================================ */

/* ---------- Design Tokens ---------- */
:root {
  --brand: #d8f238;
  --brand-strong: #bce52e;
  --brand-soft: #eef6d1;
  --brand-ink: #355e18;
  --ink: #12140f;
  --ink-soft: #2a2e25;
  --paper: #f5f7f0;
  --surface: #ffffff;
  --surface-raised: #fafbf6;
  --text: #1a1d15;
  --text-secondary: #62675e;
  --text-muted: #8b9085;
  --line: #d9ddd2;
  --line-soft: #e9ece2;
  --code-bg: #f0f3ea;
  --code-text: #2a2e25;
  --quote-bg: #eef6d1;
  --quote-border: #355e18;
  --link: #355e18;
  --link-hover: #1f3d0e;
  --shadow-hard: 4px 4px 0 var(--ink);
  --shadow-soft: 0 1px 0 rgba(18, 20, 15, 0.06);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --header-h: 64px;
  --sidebar-w: 280px;
  --font-cn: "PingFang SC", "Microsoft YaHei", "Source Han Sans CN", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-en: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Menlo, Consolas, monospace;
  --font-pixel: "Press Start 2P", "VT323", ui-monospace, monospace;
  --max-w: 1180px;
  --max-w-narrow: 760px;
  --transition: 180ms cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
  --brand: #d8f238;
  --brand-strong: #c8e733;
  --brand-soft: #2a3a10;
  --brand-ink: #bce52e;
  --ink: #f3f5ed;
  --ink-soft: #d9ddd0;
  --paper: #0f110d;
  --surface: #181b15;
  --surface-raised: #20241c;
  --text: #f3f5ed;
  --text-secondary: #aeb4a7;
  --text-muted: #7a8073;
  --line: #33392e;
  --line-soft: #262a22;
  --code-bg: #1c2018;
  --code-text: #d9ddd0;
  --quote-bg: #1f2912;
  --quote-border: #bce52e;
  --link: #d8f238;
  --link-hover: #e9f87a;
  --shadow-hard: 4px 4px 0 #000;
  --shadow-soft: 0 1px 0 rgba(0, 0, 0, 0.4);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
body { margin: 0; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; }
img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; background: none; border: none; padding: 0; color: inherit; }
a { color: inherit; text-decoration: none; }
input, button, textarea, select { font: inherit; }

/* ---------- Base ---------- */
html, body { background: var(--paper); color: var(--text); }
body {
  font-family: var(--font-cn);
  font-size: 17px;
  line-height: 1.8;
  font-weight: 400;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in oklab, var(--paper) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 17px;
  color: var(--ink);
  font-family: var(--font-en);
}
.brand-mark {
  width: 28px;
  height: 28px;
  background: var(--brand);
  border: 1.5px solid var(--ink);
  position: relative;
  flex: 0 0 auto;
  box-shadow: 2px 2px 0 var(--ink);
  /* Pixel W pattern */
}
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  background: var(--ink);
}
.brand-mark::before {
  width: 4px; height: 14px;
  top: 7px; left: 6px;
  box-shadow: 6px 0 0 var(--ink);
}
.brand-mark::after {
  width: 4px; height: 4px;
  top: 6px; left: 6px;
  box-shadow: 6px 0 0 var(--ink);
}
.brand-text { display: inline-flex; align-items: baseline; gap: 4px; }
.brand-accent { color: var(--brand-ink); font-weight: 500; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 16px;
}
.site-nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14.5px;
  transition: var(--transition);
  position: relative;
}
.site-nav a:hover { color: var(--ink); background: var(--surface-raised); }
.site-nav a.is-active {
  color: var(--ink);
  background: var(--brand);
  font-weight: 700;
}

.site-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.theme-toggle {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: var(--transition);
}
.theme-toggle:hover {
  color: var(--ink);
  background: var(--surface-raised);
  border-color: var(--line);
}
.theme-toggle .ico-moon { display: none; }
[data-theme="dark"] .theme-toggle .ico-sun { display: none; }
[data-theme="dark"] .theme-toggle .ico-moon { display: inline-block; }

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--ink);
  transition: var(--transition);
}
.nav-toggle:hover { background: var(--surface-raised); border-color: var(--line); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* ---------- Page Wrap ---------- */
.page-wrap {
  flex: 1;
  display: flex;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  padding: 32px 24px 64px;
  gap: 48px;
  align-items: flex-start;
}
.page-wrap.has-sidebar { align-items: stretch; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  max-height: calc(100vh - var(--header-h) - 64px);
  overflow-y: auto;
  scrollbar-width: thin;
  border-right: 1px solid var(--line);
  padding-right: 24px;
}
.sidebar-inner {
  padding: 4px 0 24px;
}
.sb-group { margin-bottom: 22px; }
.sb-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 12px 8px;
  font-family: var(--font-en);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sb-group-title::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--brand);
  border: 1px solid var(--ink);
  flex: 0 0 auto;
}
.sb-list { list-style: none; }
.sb-item a {
  display: block;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  transition: var(--transition);
  border-left: 2px solid transparent;
  margin-left: -2px;
}
.sb-item a:hover {
  color: var(--ink);
  background: var(--surface-raised);
  border-left-color: var(--line);
}
.sb-item.is-active a {
  color: var(--ink);
  font-weight: 700;
  background: var(--brand-soft);
  border-left-color: var(--brand-ink);
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}
.article {
  max-width: 100%;
}
.article-head {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px dashed var(--line);
}
.article-title {
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 12px;
  font-family: var(--font-cn);
}
.article-title::before {
  content: "▍";
  color: var(--brand-ink);
  margin-right: 4px;
  font-size: 0.85em;
}
.article-body {
  font-size: 17px;
  line-height: 1.85;
  color: var(--text);
}

/* Article Prose */
.article-body > * + * { margin-top: 1.1em; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 {
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  scroll-margin-top: calc(var(--header-h) + 16px);
  letter-spacing: -0.01em;
}
.article-body h2 {
  font-size: clamp(22px, 3vw, 30px);
  margin: 2.2em 0 0.7em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
  display: inline-block;
  position: relative;
}
.article-body h2::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  background: var(--brand);
  border: 1.5px solid var(--ink);
  margin-right: 10px;
  vertical-align: 2px;
  box-shadow: 2px 2px 0 var(--ink);
}
.article-body h3 {
  font-size: clamp(18px, 2.4vw, 22px);
  margin: 1.6em 0 0.5em;
  padding-left: 12px;
  border-left: 3px solid var(--brand-ink);
}
.article-body h4 {
  font-size: 17px;
  margin: 1.3em 0 0.4em;
  color: var(--text);
}
.article-body p {
  text-align: justify;
  text-justify: inter-character;
  word-break: break-word;
}
.article-body strong { font-weight: 700; color: var(--ink); }
.article-body em { font-style: italic; color: var(--ink-soft); }
.article-body a {
  color: var(--link);
  font-weight: 500;
  border-bottom: 1px solid color-mix(in oklab, var(--link) 30%, transparent);
  transition: var(--transition);
  padding-bottom: 1px;
}
.article-body a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
  background: var(--brand-soft);
}
.article-body ul, .article-body ol {
  padding-left: 1.6em;
  margin: 1em 0;
}
.article-body li { margin: 0.4em 0; }
.article-body li::marker { color: var(--brand-ink); font-weight: 700; }
.article-body li > ul, .article-body li > ol { margin: 0.4em 0; }
.article-body ul li { list-style: none; position: relative; }
.article-body ul li::before {
  content: "▸";
  color: var(--brand-ink);
  position: absolute;
  left: -1.1em;
  top: 0.05em;
  font-size: 0.85em;
}
.article-body ol { list-style: decimal; }
.article-body ol li::marker { color: var(--brand-ink); font-weight: 700; }

.article-body blockquote {
  margin: 1.5em 0;
  padding: 14px 20px;
  background: var(--quote-bg);
  border-left: 4px solid var(--quote-border);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
  font-size: 16px;
}
.article-body blockquote p { margin: 0.4em 0; }
.article-body blockquote p:first-child { margin-top: 0; }
.article-body blockquote p:last-child { margin-bottom: 0; }

.article-body hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 2.5em 0;
  position: relative;
}
.article-body hr::after {
  content: "◆";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  padding: 0 12px;
  color: var(--brand-ink);
  font-size: 10px;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 14.5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: block;
  overflow-x: auto;
}
.article-body th, .article-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.article-body th {
  background: var(--surface-raised);
  font-weight: 700;
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
}
.article-body tr:last-child td { border-bottom: 0; }
.article-body tr:hover td { background: var(--surface-raised); }

/* Code */
.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
}
.article-body pre {
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.65;
  margin: 1.4em 0;
  font-family: var(--font-mono);
}
.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
  font-weight: 400;
  border-radius: 0;
}
.article-body pre {
  position: relative;
}
.article-body pre::before {
  content: "";
  position: absolute;
  top: 10px; left: 10px;
  width: 10px; height: 10px;
  background: var(--brand);
  border: 1.5px solid var(--ink);
  border-radius: 50%;
}

/* Mermaid */
.article-body .mermaid {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 1.5em 0;
  text-align: center;
  overflow-x: auto;
}
.article-body .mermaid svg { max-width: 100%; height: auto; }

/* Image */
.article-body img {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin: 1.6em auto;
  box-shadow: 0 1px 0 rgba(18, 20, 15, 0.06);
  background: var(--surface);
  display: block;
}

/* External link removed (was external) */
.article-body .ext-link-removed {
  color: inherit;
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
  text-decoration-thickness: 1px;
  cursor: not-allowed;
  position: relative;
}
.article-body .ext-link-removed::after {
  content: " ⓧ";
  color: var(--text-muted);
  font-size: 0.7em;
  vertical-align: super;
  text-decoration: none;
  display: inline-block;
  margin-left: 2px;
}

/* Article Nav */
.article-nav {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 2px solid var(--ink);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.article-nav-cell { min-width: 0; }
.article-nav-cell a {
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: var(--transition);
  min-height: 64px;
  gap: 4px;
}
.article-nav-cell a:hover {
  border-color: var(--ink);
  background: var(--brand-soft);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}
.article-nav-prev { text-align: left; }
.article-nav-next { text-align: right; }
.article-nav-next a { align-items: flex-end; }
.article-nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-ink);
  font-family: var(--font-en);
}
.article-nav-title {
  font-size: 14.5px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.4;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: color-mix(in oklab, var(--paper) 80%, transparent);
  padding: 28px 24px;
  margin-top: auto;
}
.site-footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-text { font-size: 14px; font-weight: 500; color: var(--paper); }
.footer-meta { font-size: 12px; opacity: 0.6; font-family: var(--font-en); }

/* ============================================================================
   HOMEPAGE - Hero & Feature Cards
   ============================================================================ */
.home-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 0 48px;
}
.hero {
  position: relative;
  background: var(--brand);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 56px 48px 48px;
  margin-bottom: 56px;
  box-shadow: 8px 8px 0 var(--ink);
  overflow: hidden;
}
.hero::before, .hero::after {
  content: "";
  position: absolute;
  background: var(--ink);
  pointer-events: none;
}
.hero::before {
  top: 14px; right: 14px;
  width: 80px; height: 80px;
  background:
    linear-gradient(var(--ink) 0 0) 0 0/100% 8px no-repeat,
    linear-gradient(var(--ink) 0 0) 0 16px/100% 8px no-repeat,
    linear-gradient(var(--ink) 0 0) 0 32px/100% 8px no-repeat,
    linear-gradient(var(--ink) 0 0) 0 48px/100% 8px no-repeat;
  opacity: 0.5;
  mask: radial-gradient(circle at center, transparent 30%, black 30%);
  -webkit-mask: radial-gradient(circle at center, transparent 30%, black 30%);
  display: none;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-en);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 4px 10px;
  border-radius: 3px;
  margin-bottom: 24px;
  box-shadow: 2px 2px 0 var(--ink);
}
.hero-tag-dot {
  width: 6px; height: 6px;
  background: var(--brand-ink);
  border-radius: 50%;
}
.hero h1 {
  font-size: clamp(40px, 6.5vw, 78px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0 0 20px;
  font-family: var(--font-cn);
}
.hero h1 em {
  font-style: normal;
  font-family: var(--font-en);
  color: var(--brand-ink);
  font-weight: 800;
  display: inline-block;
  position: relative;
  z-index: 1;
}
.hero-sub {
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 720px;
  margin: 0 0 32px;
  font-weight: 500;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14.5px;
  font-family: var(--font-en);
  letter-spacing: 0.01em;
  transition: var(--transition);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.btn-primary {
  background: var(--ink);
  color: var(--brand);
}
.btn-primary:hover {
  background: var(--ink-soft);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--brand-ink);
}
.btn-secondary:hover {
  background: var(--brand);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 40px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}
.stat {
  padding: 16px 18px;
  border-right: 1px solid var(--ink);
}
.stat:last-child { border-right: 0; }
.stat-num {
  font-family: var(--font-en);
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  display: block;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ---------- Section ---------- */
.section {
  margin: 64px 0;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
  gap: 16px;
  flex-wrap: wrap;
}
.section-title {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 800;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.01em;
  font-family: var(--font-cn);
}
.section-title em {
  font-style: normal;
  font-family: var(--font-en);
  color: var(--brand-ink);
  font-size: 0.8em;
  font-weight: 700;
  margin-right: 8px;
  letter-spacing: 0;
}
.section-aside {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-en);
}

/* ---------- Feature Cards ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.feature-card {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 200px;
  overflow: hidden;
}
.feature-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 32px; height: 4px;
  background: var(--brand);
  border-bottom: 1px solid var(--ink);
}
.feature-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
  border-color: var(--ink);
}
.feature-icon {
  width: 40px; height: 40px;
  background: var(--brand);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-en);
  font-weight: 800;
  color: var(--ink);
  font-size: 18px;
  margin-bottom: 16px;
  box-shadow: 2px 2px 0 var(--ink);
}
.feature-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.3;
}
.feature-desc {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 16px;
  flex: 1;
}
.feature-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-ink);
  font-family: var(--font-en);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.feature-card:hover .feature-link { color: var(--ink); }
.feature-link::after {
  content: "→";
  transition: transform 200ms;
  display: inline-block;
}
.feature-card:hover .feature-link::after { transform: translateX(3px); }

/* ---------- TOC / Reading Path ---------- */
.path-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.path-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  display: block;
  color: inherit;
}
.path-card:hover {
  border-color: var(--ink);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}
.path-num {
  display: inline-block;
  font-family: var(--font-en);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--ink);
  background: var(--brand);
  border: 1.5px solid var(--ink);
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 10px;
  box-shadow: 1.5px 1.5px 0 var(--ink);
}
.path-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 6px;
  line-height: 1.3;
}
.path-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

/* ---------- Reading Guide Page ---------- */
.guide-block {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin: 24px 0;
}
.guide-block h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 12px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.guide-block h2::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--brand);
  border: 1.5px solid var(--ink);
}
.guide-block p, .guide-block li { color: var(--text); }
.guide-block p { margin: 0.6em 0; }

/* ---------- Index page content (bluebook overview, part intros) ---------- */
.index-content {
  max-width: 980px;
  margin: 0 auto;
}
.index-content h2 {
  margin-top: 2em;
}
.part-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0 48px;
}
.part-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  transition: var(--transition);
  display: block;
  color: inherit;
}
.part-card:hover {
  border-color: var(--ink);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}
.part-card-label {
  font-family: var(--font-en);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--ink);
  background: var(--brand);
  border: 1.5px solid var(--ink);
  padding: 2px 8px;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 10px;
  box-shadow: 1.5px 1.5px 0 var(--ink);
}
.part-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 6px;
}
.part-card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 0 12px;
}
.part-card-link {
  font-family: var(--font-en);
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-ink);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.part-card:hover .part-card-link { color: var(--ink); }

/* ---------- Mobile ---------- */
@media (max-width: 960px) {
  :root { --sidebar-w: 240px; }
  .page-wrap { gap: 32px; padding: 24px 20px 56px; }
  .hero { padding: 40px 32px 36px; box-shadow: 5px 5px 0 var(--ink); }
  .hero-stats { grid-template-columns: 1fr; }
  .stat { border-right: 0; border-bottom: 1px solid var(--ink); }
  .stat:last-child { border-bottom: 0; }
  .article-body { font-size: 16px; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 280px; }
  .site-header-inner { padding: 0 16px; gap: 12px; }
  .brand-text { font-size: 15px; }
  .site-nav { display: none; }
  .nav-toggle { display: inline-flex; }
  .site-nav.is-open {
    display: flex;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 12px;
    gap: 4px;
    margin: 0;
    z-index: 90;
  }
  .site-nav.is-open a { width: 100%; }
  .page-wrap { padding: 16px 16px 48px; gap: 0; flex-direction: column; }
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    width: 100%;
    max-height: calc(100vh - var(--header-h));
    background: var(--paper);
    z-index: 95;
    padding: 20px 20px 32px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    transform: translateY(-100%);
    transition: transform 250ms cubic-bezier(.4,0,.2,1);
    visibility: hidden;
    overflow-y: auto;
  }
  .sidebar.is-open { transform: translateY(0); visibility: visible; }
  .article-title { font-size: 28px; }
  .article-body { font-size: 16px; line-height: 1.78; }
  .article-body h2 { font-size: 22px; }
  .article-body h3 { font-size: 18px; }
  .hero h1 { font-size: 38px; }
  .hero-sub { font-size: 16px; }
  .hero { padding: 32px 24px 28px; box-shadow: 4px 4px 0 var(--ink); }
  .article-nav { grid-template-columns: 1fr; gap: 12px; }
  .article-nav-next { text-align: left; }
  .article-nav-next a { align-items: flex-start; }
  .site-footer-inner { flex-direction: column; align-items: flex-start; gap: 6px; }
  .article-body pre { padding: 14px 16px; font-size: 13px; }
  .article-body img { margin: 1.2em auto; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 32px; }
  .article-title { font-size: 24px; }
  .feature-card, .path-card, .part-card { padding: 18px; }
  .stat-num { font-size: 24px; }
}

/* ---------- Backdrop overlay for mobile sidebar ---------- */
body.sidebar-open::after {
  content: "";
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
}

/* ---------- Selection ---------- */
::selection {
  background: var(--brand);
  color: var(--ink);
}

/* ---------- Print ---------- */
@media print {
  .site-header, .sidebar, .article-nav, .site-footer, .nav-toggle, .theme-toggle { display: none !important; }
  .page-wrap { padding: 0; }
  .article-body a { color: var(--ink); border-bottom: 0; }
}
