/*
 * Atmosphere documentation.
 *
 * The same material as the product: one pale clay lit from the top-left,
 * raised panels, carved wells and keycaps, with no borders anywhere. Values
 * are copied from template/src/styles/tokens/ so the docs read as part of the
 * product. This file has no build step and needs no network to work.
 */

/* ── tokens ──────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  --bg: #dfe5ec;
  --surface: #f3f6f9;
  --surface-top: #f7f9fb;
  --surface-bottom: #edf1f5;
  --slab: #e9eef3;
  --inset: #d1dae3;
  --key-top: #fbfcfd;
  --key-bottom: #eef2f6;
  --key-edge: #c9d2dc;

  --ink: #1f2733;
  --ink-2: #46505e;
  --ink-3: #5c6775;
  --ink-4: #8b95a3;
  --line: rgb(31 39 51 / 8%);

  --accent: #ff6a1f;
  --accent-2: #ff8447;
  --accent-edge: #b93f08;
  --accent-ink: #1f2733;
  --accent-text: #a8380a;
  --accent-soft: #ffe7da;
  --accent-glow: rgb(255 106 31 / 35%);
  --info: #5bb8ff;
  --info-text: #1a6099;
  --good: #3fae7e;
  --good-text: #1e6845;
  --warn: #f5c232;
  --warn-text: #7a5a05;
  --bad: #e2566b;
  --bad-text: #b02840;
  --focus-ring: rgb(255 106 31 / 45%);

  --hi: rgb(255 255 255 / 90%);
  --raise-hi: rgb(255 255 255 / 70%);
  --contact: rgb(31 39 51 / 8%);
  --lo: rgb(31 39 51 / 14%);
  --lo-2: rgb(31 39 51 / 10%);
  --well-lo: rgb(31 39 51 / 16%);
  --well-hi: rgb(255 255 255 / 75%);
  --well-rim: rgb(31 39 51 / 12%);
  --gloss: #fff;
  --scrim: rgb(31 39 51 / 38%);

  --raise:
    0 0 3px var(--contact), -6px -6px 14px var(--raise-hi), 10px 12px 28px var(--lo),
    inset 0 1px 0 var(--gloss);
  --raise-sm:
    0 0 3px var(--contact), -4px -4px 10px var(--raise-hi), 5px 6px 14px var(--lo),
    inset 0 1px 0 var(--gloss);
  --well:
    inset 0 0 3px var(--well-rim), inset 5px 5px 12px var(--well-lo),
    inset -4px -4px 10px var(--well-hi);
  --well-sm:
    inset 0 0 3px var(--well-rim), inset 3px 3px 8px var(--well-lo),
    inset -3px -3px 6px var(--well-hi);
  --well-xs: inset 2px 2px 5px var(--well-lo), inset -1px -1px 3px var(--well-hi);
  --key: 0 4px 0 var(--key-edge), 0 8px 14px var(--lo-2), inset 0 1px 0 var(--gloss);
  --key-hover: 0 5px 0 var(--key-edge), 0 10px 16px var(--lo-2), inset 0 1px 0 var(--gloss);
  --key-press: 0 1px 0 var(--key-edge), 0 3px 6px var(--lo-2), inset 0 1px 0 var(--gloss);
  --key-in:
    inset 0 0 3px var(--well-rim), inset 3px 3px 8px var(--lo), inset -3px -3px 6px var(--well-hi);

  --font-display: 'Gabarito', 'Avenir Next', system-ui, sans-serif;
  --font-body: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', menlo, consolas, monospace;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --side-w: 288px;
}

:root[data-theme='graphite'] {
  color-scheme: dark;

  --bg: #1e222a;
  --surface: #262b33;
  --surface-top: #2e343d;
  --surface-bottom: #2a2f38;
  /* One step below the panel, so table rows still read as slabs on graphite clay. */
  --slab: #22272e;
  --inset: #171b21;
  --key-top: #303742;
  --key-bottom: #262b33;
  --key-edge: #101319;

  --ink: #e9eef5;
  --ink-2: #b6c0ce;
  --ink-3: #98a3b2;
  --ink-4: #6e7887;
  --line: rgb(255 255 255 / 8%);

  --accent-text: #ff8447;
  --accent-soft: #3a2418;
  --accent-glow: rgb(255 106 31 / 40%);
  --info-text: #5bb8ff;
  --good-text: #5bd3a0;
  --warn-text: #f5c232;
  --bad-text: #f0879a;
  --focus-ring: rgb(255 106 31 / 55%);

  --hi: rgb(255 255 255 / 5%);
  --raise-hi: rgb(255 255 255 / 5%);
  --contact: rgb(0 0 0 / 30%);
  --lo: rgb(0 0 0 / 55%);
  --lo-2: rgb(0 0 0 / 45%);
  --well-lo: rgb(0 0 0 / 60%);
  --well-hi: rgb(255 255 255 / 4.5%);
  --well-rim: rgb(0 0 0 / 30%);
  --gloss: rgb(255 255 255 / 9%);
  --scrim: rgb(9 11 15 / 62%);
}

/* ── base ────────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 24px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.d-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.d-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.d-ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.d-skip {
  position: fixed;
  z-index: 100;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--key);
  transform: translateY(-200%);
}

.d-skip:focus {
  transform: none;
}

/* ── scrollbars: a carved groove with a clay key riding in it ────────────── */
/*
 * Chrome, Edge and Safari draw these. Chrome ignores every ::-webkit-scrollbar
 * rule on an element that also sets scrollbar-width or scrollbar-color, so the
 * standard properties live only in the @supports block below, for Firefox.
 */
::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

/* The groove is 10px wide; the thumb is 8px, so a dark rim shows all round it. */
::-webkit-scrollbar-track {
  border: 3px solid transparent;
  border-radius: 999px;
  background: var(--sb-groove, var(--inset)) padding-box;
  box-shadow: var(--well-xs);
}

::-webkit-scrollbar-thumb {
  min-height: 48px;
  border: 4px solid transparent;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--key-top), var(--key-bottom)) padding-box;
  box-shadow:
    inset 0 -2px 0 var(--key-edge),
    inset 0 1px 0 var(--gloss);
}

::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, var(--accent-2), var(--accent)) padding-box;
  box-shadow:
    inset 0 -2px 0 var(--accent-edge),
    inset 0 1px 0 rgb(255 255 255 / 45%);
}

::-webkit-scrollbar-corner,
::-webkit-scrollbar-button {
  display: none;
  background: transparent;
}

/* The smaller scrollers inside the page: the menu, the outline, code, tables. */
.d-nav::-webkit-scrollbar,
.d-toc::-webkit-scrollbar,
.d-code pre::-webkit-scrollbar,
.d-table::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

.d-nav::-webkit-scrollbar-track,
.d-toc::-webkit-scrollbar-track,
.d-code pre::-webkit-scrollbar-track,
.d-table::-webkit-scrollbar-track {
  border-width: 3px;
}

.d-nav::-webkit-scrollbar-thumb,
.d-toc::-webkit-scrollbar-thumb,
.d-code pre::-webkit-scrollbar-thumb,
.d-table::-webkit-scrollbar-thumb {
  min-height: 32px;
  min-width: 32px;
  border-width: 4px;
}

/* Inside a well the groove would vanish into the well, so it carves deeper. */
.d-toc,
.d-code pre {
  --sb-groove: var(--bg);
}

@supports not selector(::-webkit-scrollbar) {
  html {
    scrollbar-color: var(--key-edge) var(--bg);
  }

  .d-nav,
  .d-toc,
  .d-code pre,
  .d-table {
    scrollbar-color: var(--key-edge) transparent;
    scrollbar-width: thin;
  }
}

/* ── keycap ──────────────────────────────────────────────────────────────── */
.d-key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--key-top), var(--key-bottom));
  box-shadow: var(--key);
  color: var(--ink);
  font: 600 14px/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms var(--ease);
}

.d-key:hover {
  box-shadow: var(--key-hover);
  transform: translateY(-1px);
}

.d-key:active {
  box-shadow: var(--key-press);
  transform: translateY(3px);
  transition-duration: 90ms;
}

.d-key--icon {
  justify-content: center;
  width: 42px;
  padding: 0;
}

/* ── layout ──────────────────────────────────────────────────────────────── */
.d-app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  gap: 24px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px;
}

.d-side {
  position: sticky;
  inset-block-start: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: calc(100dvh - 40px);
  padding: 20px 14px 14px;
  border-radius: 30px;
  background: linear-gradient(160deg, var(--surface-top), var(--surface-bottom));
  box-shadow: var(--raise);
}

.d-side__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 6px;
}

.d-side__close {
  display: none;
}

.d-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.d-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow:
    0 4px 0 var(--accent-edge),
    0 10px 18px var(--accent-glow),
    inset 0 1px 0 rgb(255 255 255 / 50%);
  color: var(--accent-ink);
}

.d-mark svg {
  width: 23px;
  height: 23px;
}

.d-brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.d-brand__text b {
  font: 800 21px/1.1 var(--font-display);
  letter-spacing: -0.03em;
}

.d-brand__text small {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
}

.d-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  margin-inline: 4px;
  padding-inline: 14px;
  border-radius: 14px;
  background: var(--inset);
  box-shadow: var(--well);
  color: var(--ink-2);
}

.d-filter:focus-within {
  box-shadow:
    var(--well),
    0 0 0 3px var(--focus-ring);
}

.d-filter input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 500 14px var(--font-body);
  outline: none;
}

.d-filter input::placeholder {
  color: var(--ink-2);
}

.d-nav {
  flex: 1;
  min-height: 0;
  margin-inline: -4px;
  padding: 4px 8px 8px;
  overflow-y: auto;
}

.d-group + .d-group {
  margin-block-start: 14px;
}

.d-group__title {
  margin: 0 0 6px 10px;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.d-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 4px 10px 4px 4px;
  border-radius: 13px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
}

.d-link:hover {
  color: var(--ink);
  background: var(--slab);
}

.d-link__key {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: var(--inset);
  box-shadow: var(--well-sm);
}

.d-link.is-active {
  color: var(--ink);
  background: linear-gradient(180deg, var(--key-top), var(--key-bottom));
  box-shadow:
    0 3px 0 var(--key-edge),
    0 6px 12px var(--lo-2),
    inset 0 1px 0 var(--gloss);
}

.d-link.is-active .d-link__key {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow:
    0 2px 0 var(--accent-edge),
    inset 0 1px 0 rgb(255 255 255 / 45%);
  color: var(--accent-ink);
}

.d-nav__empty {
  margin: 8px 10px;
  color: var(--ink-3);
  font-size: 13px;
}

.d-scrim {
  display: none;
}

.d-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.d-top {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
}

.d-menu {
  display: none;
}

.d-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  color: var(--ink-3);
  font-size: 13.5px;
  font-weight: 600;
}

.d-crumb a {
  color: var(--ink-2);
  text-decoration: none;
}

.d-crumb a:hover {
  color: var(--ink);
}

.d-theme .d-ico--sun,
:root[data-theme='graphite'] .d-theme .d-ico--moon {
  display: none;
}

:root[data-theme='graphite'] .d-theme .d-ico--sun {
  display: block;
}

.d-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 24px;
  align-items: start;
}

.d-body:not(:has(.d-toc)) {
  grid-template-columns: minmax(0, 1fr);
}

.d-page {
  min-width: 0;
  max-width: 920px;
  padding: 44px 52px 36px;
  border-radius: 26px;
  background: linear-gradient(160deg, var(--surface-top), var(--surface-bottom));
  box-shadow: var(--raise);
  outline: none;
}

.d-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  max-width: 920px;
  padding: 4px 8px 12px;
  color: var(--ink-3);
  font-size: 13px;
}

.d-foot b {
  color: var(--ink-2);
}

/* ── on this page ────────────────────────────────────────────────────────── */
.d-toc {
  position: sticky;
  inset-block-start: 20px;
  max-height: calc(100dvh - 40px);
  padding: 18px 14px;
  overflow-y: auto;
  border-radius: 22px;
  background: var(--inset);
  box-shadow: var(--well);
  font-size: 13px;
}

.d-toc__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px 6px;
  color: var(--ink);
  font-weight: 700;
}

.d-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.d-toc a {
  display: block;
  padding: 6px 8px;
  border-radius: 10px;
  color: var(--ink-2);
  font-weight: 500;
  line-height: 1.35;
  text-decoration: none;
}

.d-toc a:hover {
  color: var(--ink);
}

.d-toc a.is-active {
  color: var(--ink);
  font-weight: 700;
  background: var(--surface);
  box-shadow:
    0 2px 0 var(--key-edge),
    inset 0 1px 0 var(--gloss);
}

/* ── type ────────────────────────────────────────────────────────────────── */
.d-eyebrow {
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.d-page h1 {
  margin: 6px 0 0;
  font: 800 38px/1.05 var(--font-display);
  letter-spacing: -0.03em;
}

.d-lede {
  margin: 14px 0 0;
  max-width: 66ch;
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1.6;
}

.d-page h2 {
  position: relative;
  margin: 52px 0 12px;
  padding-block-start: 28px;
  font: 800 26px/1.15 var(--font-display);
  letter-spacing: -0.02em;
}

.d-page h2::before {
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  border-radius: 999px;
  background: var(--inset);
  box-shadow: var(--well-xs);
  content: '';
}

.d-page h3 {
  position: relative;
  margin: 32px 0 8px;
  font: 700 19px/1.25 var(--font-display);
  letter-spacing: -0.01em;
}

.d-page h4 {
  margin: 24px 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.d-anchor {
  position: absolute;
  inset-inline-start: -22px;
  color: var(--ink-4);
  font-weight: 700;
  text-decoration: none;
  opacity: 0;
}

.d-page h2 .d-anchor {
  inset-block-start: 28px;
}

h2:hover .d-anchor,
h3:hover .d-anchor,
.d-anchor:focus-visible {
  opacity: 1;
}

.d-page p,
.d-page ul,
.d-page ol {
  margin: 0 0 14px;
  max-width: 72ch;
}

.d-page ul,
.d-page ol {
  padding-inline-start: 22px;
}

.d-page li + li {
  margin-block-start: 5px;
}

.d-page li::marker {
  color: var(--ink-3);
  font-weight: 700;
}

.d-page strong {
  font-weight: 700;
}

.d-page hr {
  height: 6px;
  margin: 36px 0;
  border: 0;
  border-radius: 999px;
  background: var(--inset);
  box-shadow: var(--well-xs);
}

.d-page :not(pre) > code {
  padding: 2px 7px;
  border-radius: 7px;
  background: var(--inset);
  box-shadow: var(--well-xs);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

kbd {
  display: inline-block;
  min-width: 26px;
  padding: 1px 7px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--key-top), var(--key-bottom));
  box-shadow:
    0 2px 0 var(--key-edge),
    inset 0 1px 0 var(--gloss);
  font: 600 12.5px/1.6 var(--font-mono);
  text-align: center;
}

/* ── code ────────────────────────────────────────────────────────────────── */
.d-code {
  margin: 0 0 18px;
  border-radius: 18px;
  background: var(--inset);
  box-shadow: var(--well);
}

.d-code__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 0 18px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.d-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--key-top), var(--key-bottom));
  box-shadow:
    0 2px 0 var(--key-edge),
    0 4px 8px var(--lo-2),
    inset 0 1px 0 var(--gloss);
  color: var(--ink);
  font: 600 12.5px var(--font-body);
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.d-copy:active {
  box-shadow:
    0 0 0 var(--key-edge),
    inset 0 1px 0 var(--gloss);
  transform: translateY(2px);
}

.d-copy .d-ico {
  width: 15px;
  height: 15px;
}

.d-ico--done,
.d-copy.is-done .d-ico:first-child {
  display: none;
}

.d-copy.is-done .d-ico--done {
  display: block;
  color: var(--good-text);
}

.d-code pre {
  margin: 0;
  padding: 12px 18px 18px;
  overflow-x: auto;
  color: var(--ink);
  font: 13.5px/1.65 var(--font-mono);
  tab-size: 2;
}

.d-code .c {
  color: var(--ink-2);
  font-style: italic;
}

/* ── tables: flat slabs, never raised ────────────────────────────────────── */
.d-table {
  margin: 0 0 20px;
  overflow-x: auto;
}

.d-table table {
  width: 100%;
  border-spacing: 0 6px;
  border-collapse: separate;
  font-size: 14px;
  line-height: 1.5;
}

.d-table th {
  padding: 0 14px 2px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: start;
  text-transform: uppercase;
  white-space: nowrap;
}

.d-table td {
  padding: 11px 14px;
  background: var(--slab);
  vertical-align: top;
}

.d-table td:first-child {
  border-start-start-radius: 12px;
  border-end-start-radius: 12px;
}

.d-table td:last-child {
  border-start-end-radius: 12px;
  border-end-end-radius: 12px;
}

.d-page .d-table code {
  overflow-wrap: normal;
}

.d-table td:first-child code {
  white-space: nowrap;
}

.d-table .r {
  text-align: end;
}

/* ── notes ───────────────────────────────────────────────────────────────── */
.d-note {
  margin: 0 0 18px;
  padding: 16px 20px;
  border-radius: 18px;
  background: var(--inset);
  box-shadow: var(--well);
}

.d-note__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-block-end: 4px;
  font-weight: 700;
}

.d-note--note .d-note__head {
  color: var(--info-text);
}

.d-note--tip .d-note__head {
  color: var(--good-text);
}

.d-note--warning {
  background: var(--accent-soft);
  box-shadow: none;
}

.d-note--warning .d-note__head {
  color: var(--accent-text);
}

.d-note__body p:last-child {
  margin-block-end: 0;
}

/* ── cards: links to other pages ─────────────────────────────────────────── */
.d-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin: 8px 0 24px;
}

.d-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(160deg, var(--surface-top), var(--surface-bottom));
  box-shadow: var(--raise-sm);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  transition: transform 260ms var(--ease);
}

.d-card:hover {
  transform: translateY(-3px);
}

.d-card b {
  font: 700 17px/1.25 var(--font-display);
}

.d-card span {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
}

.d-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin: 22px 0 8px;
}

.d-stat {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--inset);
  box-shadow: var(--well);
}

.d-stat b {
  display: block;
  font: 800 30px/1 var(--font-display);
  letter-spacing: -0.03em;
}

.d-stat span {
  display: block;
  margin-block-start: 8px;
  line-height: 1.35;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

/* ── pager ───────────────────────────────────────────────────────────────── */
.d-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-block-start: 52px;
}

.d-pager__key {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--key-top), var(--key-bottom));
  box-shadow: var(--key);
  color: var(--ink);
  text-decoration: none;
  transition: transform 160ms var(--ease);
}

.d-pager__key:hover {
  box-shadow: var(--key-hover);
  transform: translateY(-1px);
}

.d-pager__key:active {
  box-shadow: var(--key-press);
  transform: translateY(3px);
}

.d-pager__key span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.d-pager__key small {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
}

.d-pager__key b {
  font-size: 15px;
  line-height: 1.3;
}

.d-pager__key--next {
  justify-content: flex-end;
  text-align: end;
}

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (width <= 1280px) {
  .d-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .d-toc {
    display: none;
  }
}

@media (width <= 960px) {
  .d-app {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
  }

  .d-side {
    position: fixed;
    z-index: 50;
    inset: 12px auto 12px 12px;
    width: min(var(--side-w), calc(100vw - 48px));
    height: auto;
    transform: translateX(calc(-100% - 40px));
    transition: transform 260ms var(--ease);
  }

  .d-side__close,
  .d-menu {
    display: inline-flex;
  }

  .d-open .d-side {
    transform: none;
  }

  .d-open .d-scrim {
    position: fixed;
    z-index: 40;
    inset: 0;
    display: block;
    border: 0;
    background: var(--scrim);
  }

  .d-page {
    padding: 32px 24px 28px;
  }

  .d-anchor {
    display: none;
  }
}

@media (width <= 560px) {
  .d-app {
    padding: 12px;
  }

  .d-page {
    padding: 26px 16px 22px;
    border-radius: 22px;
  }

  .d-page h1 {
    font-size: 30px;
  }

  .d-page h2 {
    font-size: 22px;
  }

  .d-theme__label {
    display: none;
  }

  .d-theme {
    width: 42px;
    justify-content: center;
    padding: 0;
  }

  .d-pager {
    grid-template-columns: 1fr;
  }

  .d-code pre {
    padding-inline: 14px;
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .d-side,
  .d-top,
  .d-toc,
  .d-pager,
  .d-copy {
    display: none !important;
  }

  .d-app {
    display: block;
  }

  .d-page {
    box-shadow: none;
    max-width: none;
  }
}
