/* SPDX-License-Identifier: Apache-2.0 */
/* Documentation pages rendered by scripts/build-site.mjs; palette shared with index.html. */
:root {
  --petrol: #00556E; --cyan: #00AFF0; --red: #D2001E;
  --paper: #FFFFFF; --wash: #F1F3F4; --tcyan: #E1F4FC; --line: #DADEE1; --ink: #14232A; --muted: #56656D; --link: #00556E;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #0E1A1F; --wash: #15252C; --tcyan: #0F2F3C; --line: #26363E; --ink: #E6ECEE; --muted: #9AAAB1; --link: #3FB6D6; --petrol: #0A6A86; }
}
:root[data-theme="dark"] { --paper: #0E1A1F; --wash: #15252C; --tcyan: #0F2F3C; --line: #26363E; --ink: #E6ECEE; --muted: #9AAAB1; --link: #3FB6D6; --petrol: #0A6A86; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--link); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 16px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.brand { color: var(--ink); text-decoration: none; font-weight: 600; }
.brand strong { color: var(--red); }
.toplinks { display: flex; gap: 1.1rem; }

.layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); max-width: 72rem; margin: 0 auto; }
.side { padding: 1.4rem 1rem 2rem 16px; border-right: 1px solid var(--line); font-size: .92rem;
  position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; }
.side summary { display: none; }
.side .group { margin: 1rem 0 .3rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.side .group:first-child { margin-top: 0; }
.side ul { list-style: none; padding: 0; margin: 0; }
.side li a { display: block; padding: .25rem .5rem; border-radius: 6px; color: var(--ink); text-decoration: none; }
.side li a:hover { background: var(--wash); }
.side li a[aria-current="page"] { background: var(--tcyan); color: var(--petrol); font-weight: 600; }

main { padding: 1.4rem 16px 3rem 2.2rem; min-width: 0; max-width: 56rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); line-height: 1.2; margin: .4rem 0 1rem; }
h2 { font-size: 1.35rem; margin: 2.2rem 0 .6rem; padding-top: .4rem; border-top: 1px solid var(--line); }
h3 { font-size: 1.1rem; margin: 1.6rem 0 .4rem; }
h4 { font-size: 1rem; margin: 1.2rem 0 .3rem; }
h1, h2, h3, h4 { scroll-margin-top: 1rem; }
.anchor { margin-left: .4rem; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; }
p, ul, ol { margin: .6rem 0; }
li { margin: .2rem 0; }
blockquote { margin: 1rem 0; padding: .4rem 1rem; border-left: 4px solid var(--petrol); background: var(--wash); border-radius: 0 8px 8px 0; }
code { font: .88em var(--mono); background: var(--wash); padding: .1em .3em; border-radius: 4px; overflow-wrap: anywhere; }
pre { background: var(--wash); padding: .9rem 1rem; border-radius: 8px; overflow-x: auto; }
pre code { background: none; padding: 0; overflow-wrap: normal; }
.table { overflow-x: auto; margin: 1rem 0; }
/* Identifiers in tables stay whole; the table scrolls sideways instead of breaking them. */
.table code { overflow-wrap: normal; white-space: nowrap; }
table { border-collapse: collapse; font-size: .92rem; min-width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
th { background: var(--wash); font-weight: 600; }
/* contents box, previous / next */
.toc { background: var(--wash); border-radius: 8px; padding: .7rem 1rem .8rem; margin: 1rem 0 1.4rem; font-size: .92rem; }
.toc p { margin: 0 0 .3rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0; columns: 2 16rem; column-gap: 2rem; }
.toc li { margin: .15rem 0; break-inside: avoid; }
.toc li.d3 { margin-left: 1rem; font-size: .88rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; }
.pager a { display: block; max-width: 48%; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 600; }
.pager a:hover { background: var(--wash); }
.pager a span { display: block; font-size: .78rem; font-weight: 400; color: var(--muted); }
.pager a[rel="next"] { margin-left: auto; text-align: right; }
footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted); }

@media (max-width: 52rem) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); padding: .6rem 16px; }
  .side summary { display: list-item; cursor: pointer; font-weight: 600; padding: .3rem 0; }
  .side[open] summary { margin-bottom: .6rem; }
  .side ul { display: flex; flex-wrap: wrap; gap: .2rem; }
  main { padding: 1.2rem 16px 3rem; }
}
