:root {
  --bg: #ffffff; --fg: #1b1f24; --muted: #59636e; --line: #d8dee4; --soft: #f6f8fa;
  --accent: #0b5cd5; --accent-fg: #ffffff; --code-bg: #f3f5f7; --focus: #b35900;
  --maxw: 74ch; --side: 17rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419; --fg: #e6e9ed; --muted: #9aa5b1; --line: #2a323b; --soft: #161c23;
    --accent: #6cb0ff; --accent-fg: #0f1419; --code-bg: #1a2129; --focus: #ffb454;
  }
}
* { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 1rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-underline-offset: .15em; }
a:focus-visible, .table-wrap:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-fg); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.top { display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--soft); position: sticky; top: 0; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--fg); text-decoration: none; font-size: 1.1rem; }
.meta { color: var(--muted); font-size: .9rem; }
.gh { margin-left: auto; }
.layout { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); gap: 2rem; max-width: 90rem; margin: 0 auto; padding: 0 1rem; }
.side { padding: 1.5rem 0; font-size: .95rem; position: sticky; top: 3.6rem; align-self: start; max-height: calc(100vh - 3.6rem); overflow: auto; }
.side h2 { border: 0; padding: 0; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 1.2rem 0 .3rem; }
.side h2:first-child { margin-top: 0; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side a { display: block; padding: .25rem .6rem; border-radius: 6px; color: var(--fg); text-decoration: none; }
.side a:hover { background: var(--soft); }
.side a[aria-current="page"] { background: var(--soft); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 var(--accent); }
main { padding: 1.5rem 0 3rem; max-width: var(--maxw); min-width: 0; }
h1 { font-size: 2rem; line-height: 1.2; margin: .2rem 0 .6rem; }
h2 { font-size: 1.4rem; margin: 2.2rem 0 .6rem; padding-top: .4rem; border-top: 1px solid var(--line); line-height: 1.3; }
h3 { font-size: 1.12rem; margin: 1.6rem 0 .4rem; }
h1, h2, h3, h4 { scroll-margin-top: 4.5rem; }
.lede { color: var(--muted); font-size: 1.1rem; margin-top: 0; }
p, ul, ol, pre, .table-wrap, blockquote { margin: .8rem 0; }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--code-bg); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--code-bg); padding: .9rem 1rem; border-radius: 8px; overflow: auto; border: 1px solid var(--line); line-height: 1.5; }
pre code { background: none; padding: 0; font-size: .88rem; }
blockquote { border-left: 4px solid var(--line); padding: .1rem 1rem; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { padding: .5rem .75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { background: var(--soft); white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { font-weight: 600; width: 14rem; background: var(--soft); }
img { max-width: 100%; height: auto; }
.muted { color: var(--muted); }
.tag { font-size: .75rem; border: 1px solid var(--line); border-radius: 999px; padding: .05rem .5rem; color: var(--muted); }
.cards { list-style: none; padding: 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.cards a { display: flex; flex-direction: column; gap: .2rem; height: 100%; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--fg); background: var(--soft); }
.cards a:hover { border-color: var(--accent); }
.cards strong { color: var(--accent); }
.cards span { color: var(--muted); font-size: .9rem; }
.foot { border-top: 1px solid var(--line); padding: 1rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; color: var(--muted); font-size: .88rem; max-width: 90rem; margin: 0 auto; }
@media (max-width: 52rem) {
  .layout { display: block; padding: 0 1rem; }
  .side { position: static; max-height: none; padding: 1rem 0 0; border-bottom: 1px solid var(--line); columns: 2; column-gap: 1.5rem; }
  .side h2 { break-after: avoid; }
  .side li { break-inside: avoid; }
  h1 { font-size: 1.65rem; }
}
@media print { .top, .side, .skip, .foot a { display: none; } .layout { display: block; } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
