/* SPDX-License-Identifier: Apache-2.0 */
:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --ink: #1c1c1a;
  --muted: #6b6b66;
  --line: #e4e4e0;
  --accent: #0b6e57;
  --accent-soft: #e3f2ed;
  --code-bg: #f0f0ec;
  --heading: #14231f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312;
    --panel: #1c1c1a;
    --ink: #e8e8e3;
    --muted: #97948a;
    --line: #2c2c28;
    --accent: #3ebc98;
    --accent-soft: #17352c;
    --code-bg: #232320;
    --heading: #ffffff;
  }
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 1.2rem;
  padding: 0.65rem 1.4rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--heading); }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); }
.topnav { display: flex; gap: 0.9rem; margin-left: auto; font-size: 0.92rem; }

.layout { display: flex; max-width: 1120px; margin: 0 auto; }
.sidebar {
  width: 250px; flex: 0 0 250px;
  padding: 1.2rem 1rem 3rem;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  position: sticky; top: 54px; height: calc(100vh - 54px);
}
.sidebar input {
  width: 100%; padding: 0.4rem 0.6rem; margin-bottom: 1rem;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--ink);
}
.nav-section {
  margin: 1rem 0 0.3rem; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
}
.nav-item {
  display: block; padding: 0.25rem 0.5rem; border-radius: 5px;
  color: var(--ink); font-size: 0.9rem;
}
.nav-item:hover { background: var(--accent-soft); text-decoration: none; }
.nav-item.hidden { display: none; }

.content {
  flex: 1; min-width: 0;
  padding: 1.6rem 2rem 3rem;
}
.content h1, .content h2, .content h3, .content h4 { color: var(--heading); }
.content h1 { font-size: 1.7rem; margin-top: 0; }
.content h2 { font-size: 1.3rem; border-bottom: 1px solid var(--line); padding-bottom: 0.3rem; }
.crumb { color: var(--muted); font-size: 0.82rem; margin: 0 0 0.4rem; }

table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.9rem; }
th, td { border: 1px solid var(--line); padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
th { background: var(--accent-soft); }
tr:nth-child(even) td { background: var(--panel); }

code { background: var(--code-bg); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.88em; }
pre {
  background: var(--code-bg); padding: 0.9rem 1rem; border-radius: 8px;
  overflow-x: auto; border: 1px solid var(--line);
}
pre code { background: none; padding: 0; }

blockquote {
  margin: 1rem 0; padding: 0.4rem 1rem;
  border-left: 3px solid var(--accent); background: var(--panel);
  color: var(--muted);
}
hr { border: none; border-top: 1px solid var(--line); margin: 1.6rem 0; }

.toc {
  float: right; width: 230px; margin: 0 0 1rem 1.4rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  padding: 0.6rem 0.8rem; font-size: 0.82rem;
}
.toc-title { font-weight: 700; margin: 0 0 0.3rem; color: var(--heading); }
.toc ul { margin: 0; padding-left: 1rem; list-style: none; }
.toc-l2 { padding-left: 1rem; }
.toc-l3 { padding-left: 2rem; }
.toc a { color: var(--muted); }

.pager { display: flex; justify-content: space-between; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }

footer { margin-top: 2rem; color: var(--muted); font-size: 0.82rem; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; position: static; height: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .toc { float: none; width: 100%; margin: 0 0 1rem; }
}