:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --surface-soft: #f4f1ec;
  --text: #1d1d1b;
  --muted: #696763;
  --line: #e4ddd4;
  --accent: #6f624f;
  --accent-soft: #ebe5dc;
  --shadow: 0 18px 45px rgba(51, 43, 32, .08);
  --radius: 22px;
  --content-width: 980px;
  --sidebar-width: 280px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(210, 196, 176, .35), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.72;
}
a { color: inherit; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 68px;
  padding: .75rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid rgba(228, 221, 212, .82);
  background: rgba(251, 250, 248, .88);
  backdrop-filter: blur(18px);
}
.site-title {
  flex: 0 0 auto;
  font-weight: 760;
  letter-spacing: -.03em;
  text-decoration: none;
  color: var(--text);
}
.primary-nav {
  display: flex;
  align-items: center;
  gap: .3rem;
  overflow-x: auto;
  scrollbar-width: thin;
  margin-left: auto;
}
.nav-link {
  white-space: nowrap;
  text-decoration: none;
  color: var(--muted);
  font-size: .92rem;
  padding: .45rem .7rem;
  border-radius: 999px;
  transition: background .18s ease, color .18s ease;
}
.nav-link:hover, .nav-link.is-active {
  color: var(--text);
  background: var(--accent-soft);
}
.menu-toggle {
  display: none;
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: .45rem .75rem;
  color: var(--text);
  font: inherit;
}
.home {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) 0 5rem;
}
.hero {
  padding: clamp(2.2rem, 6vw, 5rem);
  background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(244,241,236,.92));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 10px);
  box-shadow: var(--shadow);
}
.eyebrow {
  margin: 0 0 .7rem;
  color: var(--accent);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-weight: 760;
}
.hero h1 {
  margin: 0;
  font-size: clamp(2.35rem, 8vw, 5.4rem);
  line-height: .96;
  letter-spacing: -.075em;
  max-width: 820px;
}
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 1rem;
  margin-top: 1.4rem;
}
.section-card {
  display: block;
  min-height: 210px;
  padding: 1.25rem;
  text-decoration: none;
  background: rgba(255,255,255,.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(51, 43, 32, .055);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.section-card:hover {
  transform: translateY(-3px);
  border-color: #d1c5b7;
  box-shadow: var(--shadow);
}
.section-card h3 {
  margin: 0 0 1rem;
  font-size: 1.22rem;
  line-height: 1.2;
  letter-spacing: -.03em;
}
.card-topics {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.card-topics span {
  display: inline-flex;
  max-width: 100%;
  padding: .28rem .55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .79rem;
  line-height: 1.25;
}
.page-layout {
  display: grid;
  grid-template-columns: minmax(220px, var(--sidebar-width)) minmax(0, var(--content-width));
  gap: clamp(1.5rem, 4vw, 3rem);
  width: min(1320px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3.2rem) 0 6rem;
}
.sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding: 1rem;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.toc h2 {
  margin: 0 0 .8rem;
  font-size: .78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .14em;
}
.toc-link {
  display: block;
  padding: .42rem .55rem;
  margin: .06rem 0;
  border-radius: .8rem;
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  line-height: 1.25;
}
.toc-link:hover {
  color: var(--text);
  background: var(--accent-soft);
}
.toc-level-2 { padding-left: 1rem; font-size: .86rem; }
.toc-level-3, .toc-level-4 { padding-left: 1.45rem; font-size: .82rem; }
.content {
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2.4rem);
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow);
}
.content > *:first-child { margin-top: 0; }
.content h1 {
  margin: 0 0 2.1rem;
  font-size: clamp(2.15rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: -.07em;
}
.content h2, .content h3, .content h4, .content h5, .content h6 {
  scroll-margin-top: 90px;
  color: var(--text);
  letter-spacing: -.035em;
}
.content h2 { margin: 2.8rem 0 1rem; font-size: 2rem; line-height: 1.08; }
.content h3 { margin: 2.55rem 0 .95rem; font-size: 1.55rem; line-height: 1.15; }
.content h4 { margin: 2.2rem 0 .85rem; font-size: 1.25rem; line-height: 1.22; }
.content h5 { margin: 1.8rem 0 .65rem; font-size: 1.05rem; line-height: 1.28; color: var(--accent); }
.content h6 { margin: 1.4rem 0 .55rem; font-size: .95rem; line-height: 1.28; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.content p { margin: .8rem 0; }
.content ul, .content ol { padding-left: 1.35rem; }
.content li { margin: .28rem 0; }
.content li > ul, .content li > ol { margin-top: .25rem; }
.content strong { font-weight: 760; }
.content em { color: #4d4438; }
.content code {
  padding: .12rem .34rem;
  border: 1px solid #ddd3c6;
  border-radius: .45rem;
  background: var(--surface-soft);
  color: #4f4233;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .9em;
}
.content s {
  color: #887f75;
  text-decoration-color: #aa776f;
}
.content blockquote {
  margin: 1.2rem 0;
  padding: .9rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: var(--surface-soft);
  border-radius: 0 1rem 1rem 0;
}
.table-block {
  margin: 1.4rem 0;
}
.table-block > div:first-child:not(.table-scroll) {
  margin: 0 0 .65rem;
  font-weight: 760;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--accent);
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
}
.data-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: .94rem;
  line-height: 1.48;
}
.data-table th, .data-table td {
  padding: .78rem .9rem;
  border: 1px solid var(--line);
  vertical-align: top;
}
.data-table th {
  background: var(--surface-soft);
  text-align: left;
  color: var(--text);
  font-weight: 760;
}
.data-table tr:nth-child(even) td {
  background: rgba(244, 241, 236, .38);
}
figure {
  margin: 1.4rem 0;
  padding: .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: calc(var(--radius) - 8px);
}
figcaption {
  margin-top: .55rem;
  color: var(--muted);
  text-align: center;
  font-size: .9rem;
}
.search-panel {
  width: min(1120px, calc(100% - 2rem));
  margin: 1.2rem auto;
  padding: .9rem;
  background: rgba(255,255,255,.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(51, 43, 32, .05);
}
.page-layout + .search-panel {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  width: min(420px, calc(100% - 2rem));
  margin: 0;
}
.search-label {
  display: block;
  margin: 0 0 .45rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.search-box input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .65rem 1rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  outline: none;
}
.search-box input:focus {
  border-color: #c7b7a3;
  box-shadow: 0 0 0 4px rgba(199, 183, 163, .22);
}
.search-results {
  display: none;
  max-height: min(420px, 52vh);
  overflow: auto;
  margin-top: .75rem;
}
.search-results.is-visible { display: block; }
.result-item {
  display: block;
  padding: .75rem .85rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  text-decoration: none;
  background: var(--surface);
}
.result-item + .result-item { margin-top: .55rem; }
.result-title {
  display: block;
  font-weight: 760;
  line-height: 1.25;
}
.result-section {
  display: block;
  margin: .2rem 0;
  color: var(--accent);
  font-size: .82rem;
}
.result-snippet {
  display: block;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.35;
}
.result-empty {
  color: var(--muted);
  padding: .4rem .2rem;
  margin: 0;
}
mark {
  background: #efe0b8;
  color: inherit;
  border-radius: .28rem;
  padding: 0 .12rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 980px) {
  .topbar { flex-wrap: wrap; }
  .menu-toggle { display: inline-flex; }
  .primary-nav {
    display: none;
    flex: 1 0 100%;
    flex-direction: column;
    align-items: stretch;
    margin-left: 0;
    padding-top: .4rem;
    overflow: visible;
  }
  .primary-nav.is-open { display: flex; }
  .nav-link { padding: .68rem .8rem; }
  .page-layout {
    display: block;
    width: min(100% - 1rem, 940px);
    padding-top: 1rem;
  }
  .sidebar {
    position: static;
    max-height: none;
    margin-bottom: 1rem;
  }
  .toc {
    display: grid;
    gap: .15rem;
  }
  .content { padding: 1.1rem; }
  .page-layout + .search-panel {
    position: static;
    width: min(100% - 1rem, 940px);
    margin: 1rem auto 4rem;
  }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .home { width: min(100% - 1rem, 1120px); }
  .hero { padding: 1.4rem; }
  .section-grid { grid-template-columns: 1fr; }
  .content h1 { font-size: 2.25rem; }
  .data-table { min-width: 560px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
.content figure {
  margin: 1.35rem 0;
  padding: 1rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: center;
}
.content-image {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}
.content figcaption {
  margin-top: .55rem;
  color: var(--muted);
  font-size: .86rem;
}
.content blockquote {
  margin: 1.1rem 0;
  padding: 1rem 1.15rem;
  border-left: 4px solid var(--accent-soft);
  background: var(--surface-soft);
  border-radius: 0 16px 16px 0;
}
.content blockquote p:first-child { margin-top: 0; }
.content blockquote p:last-child { margin-bottom: 0; }
.direct-card {
  border-color: #d1c5b7;
}
