:root {
  color-scheme: light dark;
  --canvas: #f7f8fb;
  --surface: #fff;
  --ink: #1b2432;
  --muted: #505e6f;
  --line: #dbe1ea;
  --accent: #214b9b;
  --active: #e7effd;
  --code: #eef2f8;
  --terminal: #172339;
  --terminal-ink: #f0f5ff;
  --radius: .65rem;
  font: 16px/1.65 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #111722;
    --surface: #161e2c;
    --ink: #edf1fa;
    --muted: #b0bbca;
    --line: #354156;
    --accent: #a9c7ff;
    --active: #253a60;
    --code: #202e44;
    --terminal: #0d1422;
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 5.5rem; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: .13em; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: .18rem solid var(--accent);
  outline-offset: .18rem;
}
.skip-link { position: absolute; left: -999rem; }
.skip-link:focus { left: 1rem; top: .65rem; z-index: 3; background: var(--surface); padding: .45rem .8rem; }
.site-header {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 92rem;
  margin-inline: auto;
  padding: .7rem clamp(1rem, 2.6vw, 2.6rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.identity, .header-links { display: flex; align-items: center; gap: .75rem; }
.brand { color: var(--ink); font-size: 1.1rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.version {
  padding: .08rem .45rem;
  font: .75rem/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
  border-radius: .35rem;
  background: var(--active);
}
.header-links { font-size: .88rem; }
.layout {
  max-width: 92rem;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(10rem, 13rem) minmax(0, 1fr) minmax(9rem, 12rem);
  gap: clamp(1rem, 3vw, 3rem);
  padding: 2.4rem clamp(1rem, 2.6vw, 2.6rem) 4rem;
}
.site-nav, .contents { align-self: start; position: sticky; top: 5rem; max-height: calc(100vh - 6rem); overflow: auto; }
.nav-name { color: var(--muted); font-size: .82rem; font-weight: 700; margin: 0 0 .7rem; }
.site-nav ul, .contents ul { list-style: none; padding: 0; margin: 0; }
.site-nav a, .contents a { display: block; text-decoration: none; line-height: 1.35; }
.site-nav a { padding: .55rem .6rem; border-radius: .35rem; color: var(--ink); font-weight: 530; }
.site-nav a[aria-current="page"], .site-nav a:hover { background: var(--active); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 720; }
.contents { border-left: 1px solid var(--line); padding-left: .95rem; }
.contents a { color: var(--muted); font-size: .82rem; padding: .32rem .1rem; }
.contents a:hover { color: var(--accent); }
main { min-width: 0; }
.doc-content { max-width: 54rem; margin-inline: auto; }
h1, h2, h3, h4 { line-height: 1.22; overflow-wrap: anywhere; }
h1 { margin: 0 0 1.1rem; font-size: clamp(2rem, 4.5vw, 3.2rem); letter-spacing: -.036em; }
h2 { font-size: clamp(1.4rem, 2.5vw, 1.75rem); margin: 2.4rem 0 .8rem; padding-top: .8rem; border-top: 1px solid var(--line); }
h3 { font-size: 1.15rem; margin: 1.65rem 0 .5rem; }
h4 { font-size: 1rem; margin: 1.4rem 0 .5rem; }
p { margin: .75rem 0 1.05rem; }
.lead { color: var(--muted); font-size: 1.1rem; max-width: 48rem; }
li + li { margin-top: .25rem; }
.site-nav li + li, .contents li + li { margin-top: .12rem; }
ul, ol, dl { margin: .7rem 0 1.2rem; padding-inline-start: 1.4rem; }
dt { font-weight: 700; }
dd { margin: .12rem 0 .9rem; }
code, kbd, pre { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
code, kbd { font-size: .9em; border-radius: .24rem; background: var(--code); padding: .1em .27em; overflow-wrap: anywhere; }
pre {
  max-width: 100%;
  overflow: auto;
  padding: .95rem 1.05rem;
  margin: 1rem 0 1.35rem;
  background: var(--terminal);
  border-radius: var(--radius);
  color: var(--terminal-ink);
  font-size: .87rem;
  line-height: 1.58;
  tab-size: 4;
}
pre code { padding: 0; font-size: inherit; background: transparent; overflow-wrap: normal; }
.callout, .note {
  margin: 1.3rem 0;
  padding: .8rem 1rem;
  border: 1px solid var(--line);
  border-inline-start: .25rem solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}
.callout :first-child, .note :first-child { margin-top: 0; }
.callout :last-child, .note :last-child { margin-bottom: 0; }
.table-wrap { overflow-x: auto; margin: 1rem 0 1.4rem; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; background: var(--surface); }
th, td { text-align: left; vertical-align: top; border: 1px solid var(--line); padding: .48rem .64rem; }
th { background: var(--code); }
td p:last-child { margin-bottom: 0; }
.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
  margin: 1rem 0;
}
.doc-card { display: block; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.doc-card:hover { border-color: var(--accent); }
.doc-card strong { color: var(--accent); text-decoration: underline; text-underline-offset: .17em; }
.doc-card span { display: block; margin-top: .3rem; color: var(--muted); font-size: .9rem; }
.doc-footer { max-width: 54rem; margin: 3rem auto 0; border-top: 1px solid var(--line); padding-top: 1rem; display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .9rem; }
.small-nav { display: none; }

@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(9rem, 11rem) minmax(0, 1fr); }
  .contents { display: none; }
}
@media (max-width: 700px) {
  html { scroll-padding-top: 1rem; }
  .site-header { position: static; }
  .layout { display: block; padding-top: 1.05rem; }
  .site-nav { display: none; }
  .small-nav { display: block; margin-bottom: 1.55rem; border-bottom: 1px solid var(--line); padding-bottom: .75rem; }
  .small-nav summary { cursor: pointer; font-weight: 680; color: var(--ink); }
  .small-nav ul { list-style: none; margin-bottom: .15rem; padding-inline-start: .55rem; }
  .small-nav a[aria-current="page"] { font-weight: 750; }
}
@media (max-width: 410px) {
  .header-links { gap: .4rem; font-size: .79rem; }
  .identity { gap: .38rem; }
  .doc-grid { grid-template-columns: 1fr; }
}
@media print {
  .site-header, .site-nav, .small-nav, .contents, .doc-footer { display: none; }
  .layout { display: block; padding: 0; }
  .doc-content { color: #000; }
  pre { color: #000; background: #eee; white-space: pre-wrap; }
}

.contents .h3, .small-contents .h3 { padding-inline-start: .7rem; }
.small-contents { display: none; }

@media (max-width: 1080px) {
  .small-contents { display: block; margin: 0 0 1.5rem; }
  .small-contents summary { cursor: pointer; color: var(--muted); font-size: .9rem; font-weight: 650; }
  .small-contents ul { list-style: none; padding-inline-start: .9rem; font-size: .9rem; }
}
@media print { .small-contents { display: none; } }
