:root {
  --bg: #f7f5ef;
  --paper: #fffdf8;
  --ink: #1f2933;
  --muted: #68717b;
  --line: #ded8cc;
  --accent: #0f766e;
  --accent-2: #b45309;
  --code-bg: #f3ede3;
  --code-ink: #26343f;
  --code-line: #d8c9b5;
  --shadow: 0 18px 45px rgba(36, 30, 20, 0.08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 118, 110, .42) rgba(31, 41, 51, .06);
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: rgba(31, 41, 51, .045);
}
*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  background: rgba(15, 118, 110, .36);
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 118, 110, .56);
  background-clip: padding-box;
}
*::-webkit-scrollbar-corner {
  background: transparent;
}
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(15,118,110,.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(180,83,9,.04) 1px, transparent 1px),
    var(--bg);
  background-size: 34px 34px;
  font-family: ui-serif, "Noto Serif SC", "Songti SC", Georgia, serif;
}
a { color: inherit; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 245, 239, .92);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.brand strong { display: block; font-size: 16px; letter-spacing: .02em; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #53606b;
  text-decoration: none;
  font: 700 13px/1 ui-sans-serif, system-ui, sans-serif;
  white-space: nowrap;
  transition: color .16s ease, border-color .16s ease;
}
.topnav a:hover {
  color: var(--ink);
}
.topnav a.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  background: transparent;
}
.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 220px;
  gap: 28px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 26px 28px 80px;
}
.sidebar, .toc {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  scrollbar-gutter: stable;
}
.sidebar {
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, .76);
  box-shadow: var(--shadow);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sidebar-head p, .toc p {
  margin: 0 0 12px;
  color: var(--accent-2);
  font: 700 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}
.sidebar-toggle { display: none; }
.search { position: relative; margin-bottom: 18px; }
.search input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font: 14px/1.4 ui-sans-serif, system-ui, sans-serif;
}
.search-results {
  position: absolute;
  left: 0; right: 0; top: 48px;
  z-index: 10;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  max-height: 340px;
  overflow: auto;
  scrollbar-gutter: stable;
}
.search-results a { display: block; padding: 12px; text-decoration: none; border-bottom: 1px solid var(--line); }
.search-results strong { display: block; font-size: 14px; }
.search-results small { color: var(--muted); }
.nav-section { margin: 0 0 18px; }
.nav-section h2 {
  margin: 0 0 8px;
  font: 700 13px/1.4 ui-sans-serif, system-ui, sans-serif;
  color: var(--accent);
}
.nav-section ol { list-style: none; margin: 0; padding: 0; }
.nav-section a {
  display: block;
  padding: 7px 9px;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  font: 13px/1.45 ui-sans-serif, system-ui, sans-serif;
}
.nav-section a:hover, .nav-section a.active {
  color: var(--ink);
  background: rgba(15, 118, 110, .08);
  border-left-color: var(--accent);
}
.content {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.article-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.article {
  max-width: 860px;
  margin: 0 auto;
  padding: 42px 28px 72px;
}
.article h1 {
  margin: 0 0 28px;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.08;
  letter-spacing: 0;
}
.article h2 {
  margin: 48px 0 18px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 28px;
  line-height: 1.25;
}
.article h3 { margin: 30px 0 12px; font-size: 21px; }
.article h4 { margin: 24px 0 10px; font-size: 17px; }
.article h1, .article h2, .article h3, .article h4 { scroll-margin-top: 88px; }
.article p, .article li, .article td, .article th {
  font-size: 16px;
  line-height: 1.86;
}
.article p { margin: 12px 0; }
.article a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.article img { max-width: 100%; height: auto; }
.missing-image { display: block; padding: 12px; border: 1px dashed var(--muted); color: var(--muted); }
.article .task-list-item { list-style: none; }
.article blockquote {
  margin: 22px 0;
  padding: 14px 18px;
  border-left: 4px solid var(--accent);
  background: #edf5f2;
  color: #2d4850;
}
.article code {
  border: 1px solid var(--code-line);
  background: #f7f1e8;
  color: #344754;
  padding: 1px 5px;
  border-radius: 3px;
  font: 0.92em/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.article pre {
  overflow: auto;
  margin: 22px 0;
  padding: 18px;
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid var(--code-line);
  border-left: 4px solid var(--accent-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.article pre code { padding: 0; border: 0; background: transparent; color: inherit; }
.article pre,
.table-wrap {
  scrollbar-color: rgba(15,118,110,.42) rgba(31,41,51,.06);
}
.article pre::-webkit-scrollbar-track {
  background: rgba(31,41,51,.05);
}
.article pre::-webkit-scrollbar-thumb {
  background: rgba(15,118,110,.36);
  background-clip: padding-box;
}
.article pre::-webkit-scrollbar-thumb:hover {
  background: rgba(15,118,110,.56);
  background-clip: padding-box;
}
.table-wrap { overflow: auto; margin: 22px 0; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { border: 1px solid var(--line); padding: 10px 12px; vertical-align: top; }
th { background: rgba(180,83,9,.08); text-align: left; }
.toc {
  padding: 16px 0;
  color: var(--muted);
  font: 13px/1.5 ui-sans-serif, system-ui, sans-serif;
}
.toc-nav { padding-right: 6px; }
.toc a {
  display: block;
  padding: 5px 8px 5px 12px;
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.toc a:hover { color: var(--accent); }
.toc a.active {
  border-left-color: var(--accent);
  background: rgba(15, 118, 110, .08);
  color: var(--accent);
  font-weight: 700;
}
.toc-l3 { padding-left: 24px !important; }
.toc-l4 { padding-left: 38px !important; font-size: 12px; }
.toc-empty { color: var(--muted); }
.home-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 72px 28px 90px;
}
.home-hero {
  max-width: 820px;
  margin-bottom: 38px;
}
.eyebrow {
  color: var(--accent-2);
  font: 700 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}
.home h1 {
  margin: 0 0 20px;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 1.02;
  letter-spacing: 0;
}
.home-hero p:not(.eyebrow) {
  max-width: 700px;
  color: #4b5563;
  font-size: 18px;
  line-height: 1.8;
}
.primary-link {
  display: inline-flex;
  margin-top: 14px;
  padding: 12px 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.home-card {
  position: relative;
  min-height: 214px;
  padding: 22px;
  border: 1px solid var(--line);
  background: rgba(255,253,248,.78);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.home-card[href]:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: #fff;
}
.home-card.is-planned {
  color: var(--ink);
}
.home-card span {
  display: block;
  color: var(--accent-2);
  font: 700 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.home-card strong {
  display: block;
  margin-top: 22px;
  font-size: 20px;
}
.home-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.5;
}
.home-card em {
  position: absolute;
  left: 22px;
  bottom: 18px;
  display: inline-flex;
  padding: 4px 8px;
  border: 1px solid var(--line);
  color: var(--accent);
  background: rgba(15, 118, 110, .06);
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  font-style: normal;
}
@media (max-width: 1180px) {
  .shell { grid-template-columns: 290px minmax(0, 1fr); }
  .toc { display: none; }
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .topbar { padding: 0 16px; }
  .brand small { display: none; }
  .topnav {
    max-width: 58vw;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { padding: 0 10px; }
  .shell { display: block; padding: 14px; }
  .sidebar { position: relative; top: auto; max-height: none; margin-bottom: 14px; }
  .content { margin: 0; }
  .article-meta { display: block; padding: 12px 16px; }
  .article { padding: 28px 18px 56px; }
  .home-main { padding: 44px 18px 70px; }
  .home-grid { grid-template-columns: 1fr; }
}
