:root {
  color-scheme: light;
  --blue: #1762bd;
  --blue-dark: #0b3d78;
  --blue-soft: #e8f1fc;
  --ink: #172033;
  --muted: #5c687a;
  --line: #dce4ef;
  --paper: #ffffff;
  --soft: #f3f7fc;
  --soon: #8a96a8;
  --tree-width: 292px;
  --nav-height: 58px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -8%, #eaf3fe 0%, transparent 58%),
    linear-gradient(180deg, #eef5ff 0%, #f7fafd 36%, #fff 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); }

.appbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--nav-height);
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(170%) blur(12px);
  -webkit-backdrop-filter: saturate(170%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--blue-dark);
  font-weight: 700;
  font-size: 18px;
}

.brand svg { display: block; }

.appbar .spacer { flex: 1; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.guide-search {
  position: relative;
  flex: 0 1 280px;
  min-width: 140px;
}

.guide-search input {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.guide-search input:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.guide-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 280px;
  max-height: 360px;
  overflow: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px -16px rgba(23, 32, 51, 0.35);
  z-index: 80;
}

.guide-search-hit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}

.guide-search-hit:hover,
.guide-search-hit.is-active { background: var(--blue-soft); }

.guide-search-hit strong { font-size: 13px; }
.guide-search-hit span { font-size: 11px; color: var(--muted); }

.search-results { padding-left: 1.2em; }
.search-results li { margin: 0 0 16px; }
.search-crumb { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.search-results mark { background: #d9e8fb; color: inherit; padding: 0 2px; border-radius: 3px; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.prose th, .prose td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.ref-columns {
  columns: 3;
  column-gap: 24px;
  padding-left: 1.1em;
  margin: 0 0 16px;
}
.ref-columns li { break-inside: avoid; margin: 0 0 4px; }

.appbar a.tlink {
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 4px;
}

.appbar a.tlink:hover,
.appbar a.tlink[aria-current="page"] { color: var(--blue); }

.appbar a.tlink[aria-current="page"] { color: var(--blue-dark); }

.btn-open {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: #fff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
}

.btn-open:hover { background: #0f55a8; }

.tree-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.tree-toggle:focus-visible,
.appbar a:focus-visible,
.guide-tree a:focus-visible,
.guide-article a:focus-visible,
.pager a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.guide-shell {
  display: grid;
  grid-template-columns: var(--tree-width) minmax(0, 1fr);
  max-width: 1180px;
  margin: 0 auto;
  min-height: calc(100vh - var(--nav-height));
}

.guide-tree-wrap {
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
  overflow: auto;
  padding: 20px 12px 48px 18px;
  border-right: 1px solid var(--line);
  background: rgba(247, 250, 253, 0.72);
}

.guide-tree-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 8px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.guide-tree {
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-tree a {
  text-decoration: none;
  color: inherit;
}

.tree-home {
  display: block;
  margin: 0 4px 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.tree-home:hover { background: #fff; color: var(--blue); }

.tree-home[aria-current="page"] {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.tree-section {
  margin: 0 0 4px;
}

.tree-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.tree-section-head:hover { background: #fff; }

.tree-chev-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tree-chev-btn:hover { background: var(--blue-soft); color: var(--blue); }

.tree-section.is-current > .tree-section-head {
  background: #fff;
  color: var(--blue-dark);
}

.tree-num {
  flex: 0 0 auto;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--blue);
  letter-spacing: 0.02em;
}

.tree-section.is-soon .tree-num { color: var(--soon); }

.tree-section-title { flex: 1; min-width: 0; }

.tree-chev {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  color: var(--muted);
  transition: transform 0.16s ease;
}

.tree-section.is-open > .tree-section-head .tree-chev {
  transform: rotate(90deg);
}

.tree-pages {
  display: none;
  margin: 0 0 6px 22px;
  padding: 0 0 0 10px;
  list-style: none;
  border-left: 1px solid var(--line);
}

.tree-section.is-open > .tree-pages { display: block; }

.tree-pages a,
.tree-pages .tree-soon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.35;
  color: #2b3a52;
}

.tree-pages a:hover { background: #fff; color: var(--blue); }

.tree-pages a[aria-current="page"] {
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-weight: 600;
}

.tree-soon {
  color: var(--soon);
  cursor: default;
}

.soon-mark {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--soon);
}

.guide-main {
  min-width: 0;
  padding: 22px 36px 72px;
}

.crumbs {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--blue); }
.crumbs .sep { margin: 0 6px; color: #b6c2d2; }

.guide-article header h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: #10203c;
}

.byline {
  margin: 0 0 22px;
  font-size: 14px;
  color: #7a8799;
}

.prose {
  font-size: 16.5px;
  line-height: 1.7;
  color: #243047;
  max-width: 46rem;
}

.prose h2 {
  font-size: 22px;
  margin: 2.1rem 0 0.55rem;
  letter-spacing: -0.02em;
  color: #142542;
}

.prose h3 {
  font-size: 17px;
  margin: 1.45rem 0 0.45rem;
  color: #142542;
}

.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol {
  margin: 0 0 1.1rem;
  padding-left: 1.3rem;
}
.prose li { margin-bottom: 0.4rem; }
.prose a { font-weight: 600; }
.prose code,
.kbd {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.86em;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.08em 0.38em;
}

.prose pre {
  overflow-x: auto;
  margin: 1.2rem 0;
  padding: 14px 16px;
  background: #10203c;
  color: #e8f1fc;
  border-radius: 10px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13.5px;
  line-height: 1.55;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.figure {
  margin: 1.5rem 0;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 28px -18px rgba(11, 61, 120, 0.45);
}

.figure figcaption {
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.callout {
  margin: 1.4rem 0;
  padding: 14px 16px 14px 18px;
  border-radius: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  font-size: 15px;
  color: #2b3a52;
}

.callout[data-kind="tip"] { border-left-color: #2e9e5b; }
.callout[data-kind="warning"] {
  border-left-color: #c47b14;
  background: #fff8ec;
}

.callout .callout-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue-dark);
}

.callout[data-kind="tip"] .callout-label { color: #1f7a45; }
.callout[data-kind="warning"] .callout-label { color: #8a5608; }

.callout p { margin: 0 0 0.5rem; }
.callout p:last-child { margin: 0; }

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 1.4rem 0 0;
}

.topic-card {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-decoration: none;
  color: inherit;
}

.topic-card:hover { border-color: var(--blue); }

.topic-card .num {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--blue);
}

.topic-card strong {
  display: block;
  margin: 4px 0 4px;
  color: #10203c;
}

.topic-card span {
  display: block;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.45;
}

.topic-card.is-soon {
  opacity: 0.72;
  cursor: default;
}

.topic-card.is-soon:hover { border-color: var(--line); }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 36px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  max-width: 46rem;
}

.guide-related {
  margin: 32px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  max-width: 46rem;
}
.guide-related h2 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.guide-related ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.guide-related a {
  color: var(--blue);
  text-decoration: none;
  font-size: 14px;
  font-weight: 550;
}
.guide-related a:hover { text-decoration: underline; }

.pager a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 46%;
  text-decoration: none;
  color: var(--ink);
}

.pager a:hover { color: var(--blue); }
.pager .dir {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.pager .next { text-align: right; margin-left: auto; }

.site-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 24px 40px;
  color: #768397;
  font-size: 13px;
}

.site-footer a { color: #5c687a; text-decoration: none; }
.site-footer a:hover { color: var(--blue); }

.tree-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .tree-toggle { display: inline-flex; }
  .appbar a.tlink.hide-sm { display: none; }
  .guide-search { flex: 1 1 120px; min-width: 96px; }
  .ref-columns { columns: 2; }

  .guide-shell {
    grid-template-columns: 1fr;
  }

  .guide-tree-wrap {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    z-index: 50;
    width: min(86vw, 320px);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 12px 0 32px -18px rgba(23, 32, 51, 0.35);
    background: #f7fafd;
  }

  body.tree-open .guide-tree-wrap { transform: translateX(0); }

  .tree-backdrop {
    display: block;
    position: fixed;
    inset: var(--nav-height) 0 0 0;
    z-index: 40;
    background: rgba(16, 32, 60, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.tree-open .tree-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .guide-main { padding: 18px 18px 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .tree-chev,
  .guide-tree-wrap,
  .tree-backdrop { transition: none; }
}
