/* Generated by .github/scripts/build_docs.py. The palette lives in
   ../assets/tokens.css, shared with the listing page. */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.75;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 6px;
  z-index: 10;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 2.5rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

nav {
  position: sticky;
  top: 2rem;
  align-self: start;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  font-size: 0.92rem;
}

.brand {
  display: block;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 1.5rem;
}

.nav-section {
  margin: 1.25rem 0 0.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

nav ul, .toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

nav li a {
  display: block;
  padding: 0.25rem 0.6rem;
  margin-left: -0.6rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
}

nav li a:hover { background: var(--code-bg); color: var(--text); }
nav li a.active { background: var(--accent); color: var(--accent-text); }

main { min-width: 0; }

article > *:first-child { margin-top: 0; }

h1, h2, h3, h4 { line-height: 1.35; margin: 2rem 0 0.75rem; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; border-bottom: 1px solid var(--border); padding-bottom: 0.35rem; }
h3 { font-size: 1.15rem; }

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
}

pre code { background: none; padding: 0; }

blockquote {
  margin: 1.25rem 0;
  padding: 0.1rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* Figures are SVG and scale to whatever width is left, but never past their
   natural size: past it the labels grow larger than the body text. */
figure {
  margin: 1.5rem 0;
  overflow-x: auto;
}

figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.table-scroll { overflow-x: auto; margin: 1.25rem 0; }

table { border-collapse: collapse; width: 100%; font-size: 0.94rem; }
th, td { border: 1px solid var(--border); padding: 0.5rem 0.7rem; text-align: left; vertical-align: top; }
th { background: var(--code-bg); }

.toc {
  float: right;
  margin: 0 0 1.5rem 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.88rem;
  max-width: 18rem;
}

.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); }
.toc .level-3 { padding-left: 1rem; }

.cards { list-style: none; padding: 0; display: grid; gap: 1rem; }

.cards a {
  display: block;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}

.cards a:hover { border-color: var(--accent); }
.card-title { display: block; font-weight: 700; }
.card-id { display: block; font-size: 0.85rem; color: var(--muted); font-family: ui-monospace, monospace; }
.card-desc { display: block; margin-top: 0.5rem; color: var(--muted); }

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--muted);
}

@media (max-width: 52rem) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  nav { position: static; max-height: none; }
  .toc { float: none; max-width: none; margin-left: 0; }
}
