/* Spotter Docs. No build step, no dependencies.
   Three columns on wide viewports (sidebar / article / on-this-page), two
   below 1100px, and a slide-in drawer below 820px. */

:root {
  color-scheme: light dark;
  --bg: #fafafa;
  --surface: #fafafa;
  --fg: #18181b;
  --muted: #52525b;
  --border: #e4e4e7;
  --code-bg: #f4f4f5;
  --accent: #4d8a06;
  --accent-soft: #4d8a061a;
  --sidebar-w: 17rem;
  --toc-w: 14rem;
  --topbar-h: 3.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18181b;
    --surface: #1c1c1f;
    --fg: #f4f4f5;
    --muted: #a1a1aa;
    --border: #3f3f46;
    --code-bg: #27272a;
    --accent: #7ddb0f;
    --accent-soft: #7ddb0f1f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 40;
}
.skip:focus { left: 0; }

/* ── Top bar ─────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  font-weight: 700;
  color: inherit;
  text-decoration: none;
}

.drawer-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-left: -0.4rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: none;
  color: inherit;
  cursor: pointer;
}
.drawer-toggle .bars { display: grid; gap: 3px; }
.drawer-toggle .bars i {
  display: block;
  width: 14px;
  height: 1.5px;
  background: currentColor;
}

.locale { margin-left: auto; position: relative; }

.locale select {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 1.7rem 0.3rem 0.6rem;
  cursor: pointer;
}

.locale::after {
  content: "";
  position: absolute;
  right: 0.65rem;
  top: 50%;
  width: 0.35rem;
  height: 0.35rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* ── Layout ──────────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 0 2rem;
  max-width: 88rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.sidebar,
.toc {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.75rem 0 3rem;
  font-size: 0.9rem;
}

.article {
  min-width: 0;
  padding: 2rem 0 4rem;
}

@media (max-width: 1100px) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 0 1.25rem; }
  .drawer-toggle { display: inline-flex; }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    z-index: 25;
    width: min(20rem, 84vw);
    max-height: none;
    padding: 1.5rem 1.25rem 3rem;
    background: var(--bg);
    border-right: 1px solid var(--border);
    transform: translateX(-102%);
    transition: transform 0.18s ease;
  }
  .sidebar.open { transform: none; }

  .scrim {
    position: fixed;
    inset: var(--topbar-h) 0 0;
    z-index: 20;
    background: #0009;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */

.sidebar .section { margin-bottom: 1.4rem; }

.sidebar .section-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.25rem 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}

.sidebar .section-title .chevron {
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.sidebar .section[data-collapsed="true"] .chevron { transform: rotate(-45deg); }
.sidebar .section[data-collapsed="true"] ul { display: none; }

.sidebar ul {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  border-left: 1px solid var(--border);
}

.sidebar li a {
  display: block;
  margin-left: -1px;
  padding: 0.3rem 0.6rem;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.4;
}
.sidebar li a:hover { color: var(--fg); }

.sidebar li a[aria-current="page"] {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--fg);
  font-weight: 600;
}

/* ── On this page ────────────────────────────────────────────────────── */

.toc h2 {
  margin: 0 0 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li a {
  display: block;
  padding: 0.25rem 0;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.4;
}
.toc li a:hover { color: var(--fg); }
.toc li a.active { color: var(--accent); }
.toc li.h3 a { padding-left: 0.85rem; font-size: 0.85rem; }

/* ── Article ─────────────────────────────────────────────────────────── */

.article article { max-width: 44rem; }
.article h1 { font-size: 1.7rem; line-height: 1.25; margin-top: 0; }
.article h2 { font-size: 1.2rem; margin-top: 2.2rem; scroll-margin-top: calc(var(--topbar-h) + 1rem); }
.article h3 { font-size: 1rem; margin-top: 1.6rem; scroll-margin-top: calc(var(--topbar-h) + 1rem); }
.article a { color: var(--accent); }

.article code {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  font-size: 0.9em;
}
.article pre {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
}
.article pre code { background: none; padding: 0; }
.article blockquote {
  border-left: 3px solid var(--border);
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
}
.article img { max-width: 100%; }
.article table { border-collapse: collapse; display: block; overflow-x: auto; }
.article th, .article td { border: 1px solid var(--border); padding: 0.4rem 0.7rem; }

.notice {
  margin: 0 0 1.5rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
  font-size: 0.9rem;
}

.notice-dismiss {
  margin-left: 0.9rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
}

.page-foot {
  max-width: 44rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}
.page-foot a { color: inherit; }

.noscript { max-width: 44rem; margin: 0 auto; padding: 2rem 1.25rem; }
