:root {
  color-scheme: dark;

  --paper:     #111418;
  --side:      #0c0f12;
  --panel:     #1a1e24;
  --ink:       #dde1e6;
  --ink-soft:  #a9b0b9;
  --muted:     #6f7782;
  --rule:      #262c34;
  --accent:    #86b4e6;
  --accent-dim:#5f8ab8;

  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', 'Liberation Sans', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'DejaVu Sans Mono', Menlo, Consolas, monospace;

  --side-w: 13rem;
  --measure: 42rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-dim); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--accent); color: var(--paper); }

.frame {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--rule);
  background: var(--side);
  padding: 1.6rem 1.1rem 2rem;
  font-size: 0.92rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.4rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}
.brand img { width: 26px; height: 26px; }

.toc { list-style: none; margin: 0; padding: 0; }
.toc > li { margin: 0.05rem 0; }
.toc a {
  display: block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: var(--ink-soft);
  text-decoration: none;
}
.toc a:hover { background: var(--panel); color: var(--ink); }
.toc a[aria-current="page"] { color: var(--ink); background: var(--panel); }
.toc .group {
  margin: 1.2rem 0 0.3rem 0.5rem;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.side-foot { margin-top: 2rem; color: var(--muted); font-size: 0.8rem; }

.page { padding: 2.6rem clamp(1rem, 5vw, 4rem) 4rem; }
.page > * { max-width: var(--measure); }
.page > pre, .page > table, .page > .table-wrap, .page > .chain { max-width: calc(var(--measure) + 4rem); }

.crumb { margin: 0 0 0.3rem; font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }
h1 {
  margin: 0 0 1.6rem;
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h2 {
  margin: 2.6rem 0 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--rule);
  font-size: 1.22rem;
  font-weight: 650;
  line-height: 1.3;
}
h2 .num { font-family: var(--mono); color: var(--muted); font-weight: 400; margin-right: 0.6rem; }

h3 {
  margin: 1.8rem 0 0.4rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}
h3 + pre { margin-top: 0.3rem; }

p { margin: 0 0 1rem; }
ul.plain { padding-left: 1.2rem; }

code {
  font-family: var(--mono);
  font-size: 0.87em;
  color: var(--ink);
}
p code, li code, td code, dd code { background: var(--panel); padding: 0.05em 0.3em; border-radius: 3px; }
pre {
  margin: 0 0 1.2rem;
  padding: 0.85rem 1.1rem;
  overflow-x: auto;
  background: var(--panel);
  border-radius: 4px;
  font-size: 0.86rem;
  line-height: 1.5;
}
pre code { font-size: inherit; }

dl.opts { margin: 0 0 1.2rem; }
dl.opts dt { margin-top: 0.6rem; }
dl.opts dt code { font-size: 0.9rem; color: var(--accent); }
dl.opts dd { margin: 0.1rem 0 0 1.6rem; color: var(--ink-soft); }

.sn-toggle { display: none; }
.sn-marker {
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9em;
  vertical-align: super;
  line-height: 0;
  padding: 0.35em 0.4em;
  margin: 0 0.05em;
  border-radius: 3px;
  user-select: none;
}
.sn-marker:hover { background: var(--panel); }
.sidenote { display: none; }
.sn-toggle:checked ~ .sidenote {
  display: block;
  float: right;
  clear: right;
  width: 13rem;
  margin: 0.2rem -16rem 1rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.sidenote code { font-size: 0.85em; }

table {
  width: 100%;
  margin: 0.4rem 0 1.4rem;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th, td { text-align: left; vertical-align: top; padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; color: var(--muted); font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; }
td:first-child { white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.chain { margin: 1rem 0 1.4rem; padding: 0; list-style: none; font-family: var(--mono); font-size: 0.88rem; }
.chain li {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 1rem;
  padding: 0.35rem 0.8rem;
  border-left: 2px solid var(--rule);
  margin-left: 0.4rem;
}
.chain .what { font-family: var(--sans); color: var(--ink-soft); }

.releases { margin: 1.4rem 0; padding: 0; list-style: none; }
.releases li { display: flex; flex-wrap: wrap; gap: 0.2rem 1.2rem; align-items: baseline; padding: 0.45rem 0; border-bottom: 1px solid var(--rule); }
.releases .ver { min-width: 4.5rem; font-family: var(--mono); font-weight: 600; }
.releases .date { min-width: 6rem; font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }
.releases .for { color: var(--ink-soft); font-size: 0.92rem; }
.releases a { margin-left: auto; }

@media (max-width: 80rem) {
  .sn-toggle:checked ~ .sidenote {
    float: none;
    clear: none;
    width: auto;
    margin: 0.7rem 0;
    padding: 0.6rem 0.9rem;
    background: var(--panel);
    border-radius: 3px;
  }
}

@media (max-width: 52rem) {
  .frame { display: block; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule); padding: 1rem; }
  .brand { margin-bottom: 0.6rem; }
  .toc { display: flex; flex-wrap: wrap; gap: 0.2rem; }
  .toc .group, .side-foot { display: none; }
  .page { padding: 1.5rem 1rem 3rem; }
  .chain li { grid-template-columns: 1fr; gap: 0; }
}
