:root {
  color-scheme: light;
  --bg: #fbfbfa;
  --panel: #ffffff;
  --panel-soft: #f5f5f3;
  --text: #1f2428;
  --muted: #697177;
  --line: #e4e2dc;
  --accent: #2f6f58;
  --accent-soft: #e8f2ed;
  --code: #f3f2ef;
  --shadow: 0 18px 50px rgba(31, 36, 40, 0.08);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 24px 24px, rgba(47, 111, 88, 0.08) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  border-right: 1px solid var(--line);
  background: rgba(251, 251, 250, 0.92);
  backdrop-filter: blur(18px);
  padding: 24px 18px;
  overflow-y: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #cfd7d2;
  border-radius: 7px;
  background: linear-gradient(180deg, #ffffff, #ecf1ed);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.search-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 28px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.search-trigger:hover {
  border-color: #c7d4ce;
  box-shadow: var(--shadow);
}

.search-trigger:active {
  transform: translateY(1px);
}

kbd {
  border: 1px solid var(--line);
  border-bottom-color: #cbc8c0;
  border-radius: 5px;
  background: var(--panel-soft);
  color: #7a807d;
  padding: 2px 6px;
  font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.nav-group {
  margin-top: 26px;
}

.nav-group h2,
.toc h2 {
  margin: 0 0 10px;
  color: #8a908c;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-link {
  display: block;
  border-radius: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  padding: 8px 10px;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}

.nav-link:hover,
.nav-link.active {
  background: var(--accent-soft);
  color: #214d3e;
}

.mobile-bar {
  display: none;
}

.content {
  min-width: 0;
}

.article-wrap {
  display: grid;
  grid-template-columns: minmax(0, 760px) 220px;
  gap: 64px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 54px 32px 96px;
}

.article {
  min-width: 0;
}

.article-header {
  margin-bottom: 42px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.article h1 {
  margin: 0;
  color: #202522;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 0.98;
  letter-spacing: 0;
}

.lead {
  margin: 18px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.article h2 {
  margin: 46px 0 14px;
  color: #252a27;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.article h3 {
  margin: 30px 0 10px;
  color: #2c312e;
  font-size: 18px;
  line-height: 1.25;
}

.article p,
.article li {
  color: #4f5753;
  font-size: 16px;
  line-height: 1.78;
}

.article p {
  margin: 0 0 18px;
}

.article ul,
.article ol {
  margin: 0 0 22px;
  padding-left: 24px;
}

.article a {
  color: var(--accent);
  font-weight: 650;
  text-decoration-color: rgba(47, 111, 88, 0.28);
  text-underline-offset: 3px;
}

.article code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--code);
  color: #28473d;
  padding: 0.14em 0.38em;
  font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace;
}

.article pre {
  overflow-x: auto;
  border: 1px solid #d9ddd8;
  border-radius: 10px;
  background: #202522;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 18px;
}

.article pre code {
  border: 0;
  background: transparent;
  color: #edf1ed;
  padding: 0;
}

.article blockquote {
  margin: 24px 0;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 14px 18px;
}

.toc {
  position: sticky;
  top: 34px;
  align-self: start;
  color: var(--muted);
  font-size: 13px;
}

.toc a,
.toc span {
  display: block;
  border-left: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 0 6px 13px;
  text-decoration: none;
}

.toc .toc-level-3 {
  padding-left: 25px;
}

.toc a:hover {
  color: var(--accent);
  border-left-color: var(--accent);
}

.search-dialog[hidden] {
  display: none;
}

.search-dialog {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: start center;
  padding-top: 12vh;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 37, 34, 0.26);
  backdrop-filter: blur(6px);
}

.search-panel {
  position: relative;
  width: min(720px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 26px 80px rgba(31, 36, 40, 0.18);
}

.search-panel label {
  display: block;
}

.search-panel label span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.search-panel input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 18px 20px;
  font: 500 18px inherit;
}

.search-results {
  max-height: min(520px, 60vh);
  overflow-y: auto;
  padding: 8px;
}

.result {
  display: block;
  border-radius: 10px;
  color: var(--text);
  padding: 14px;
  text-decoration: none;
}

.result:hover,
.result:focus {
  outline: 0;
  background: var(--accent-soft);
}

.result strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.result span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.empty {
  color: var(--muted);
  padding: 28px 16px;
  text-align: center;
}

@media (max-width: 980px) {
  .shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .mobile-bar {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: rgba(251, 251, 250, 0.94);
    backdrop-filter: blur(18px);
    padding: 14px 16px;
  }

  .search-trigger.compact {
    width: auto;
    margin: 0;
  }

  .article-wrap {
    display: block;
    padding: 36px 20px 72px;
  }

  .toc {
    display: none;
  }
}
