/* Robot Vault documentation — readable light paper, with Ingotron blue used
   only for links, focus, and current-location cues. */

@font-face {
  font-family: 'Space Grotesk';
  src: url('/fonts/space-grotesk-var.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono-var.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */

:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --bg-raise: #fbfaf8;
  --bg-sunken: #edebe4;
  --code-bg: #efede7;
  --ink: #14181f;
  --ink-dim: #4e5663;
  --ink-faint: #5f6773;
  --accent: #3d5680;
  --accent-dim: #8b9ab4;
  --accent-wash: rgba(61, 86, 128, 0.1);
  --line: rgba(20, 24, 31, 0.14);
  --line-soft: rgba(20, 24, 31, 0.07);
  --line-strong: rgba(20, 24, 31, 0.28);
  --pass: #14724a;
  --overlay: rgba(20, 24, 31, 0.34);
  --lift: 0 16px 32px -20px rgba(20, 24, 31, 0.28);
  --mark: rgba(138, 90, 8, 0.18);

  --font-grot: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --topbar-h: 3.5rem;
  --sidebar-w: 16.5rem;
  --toc-w: 14rem;
  --measure: 42rem;
  --pad: clamp(1.15rem, 3.2vw, 2.5rem);
  --maxw: 96rem;
  --ease-out: cubic-bezier(0.16, 0.84, 0.24, 1);
  --radius: 2px;

  /* arrow leaving a box — masked, so it inherits the link's colour */
  --icon-ext: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 9.2V13a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h3.8'/%3E%3Cpath d='M9.6 2.4H14v4.4M14 2.4 7.6 8.8'/%3E%3C/svg%3E");
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0b0e14;
  --bg-raise: #0e1219;
  --bg-sunken: #080b10;
  --code-bg: #0e1219;
  --ink: #e8e6df;
  --ink-dim: #b7bfca;
  --ink-faint: #9ba5b2;
  --accent: #a8bddf;
  --accent-dim: #687896;
  --accent-wash: rgba(168, 189, 223, 0.14);
  --line: rgba(232, 230, 223, 0.18);
  --line-soft: rgba(232, 230, 223, 0.1);
  --line-strong: rgba(232, 230, 223, 0.3);
  --pass: #73dba5;
  --overlay: rgba(4, 6, 10, 0.62);
  --lift: 0 16px 32px -20px rgba(0, 0, 0, 0.72);
  --mark: rgba(224, 168, 62, 0.24);
}

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 1.5rem);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-grot);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 1px;
}

.mono {
  font-family: var(--font-mono);
  font-weight: 450;
  font-variant-ligatures: none;
  letter-spacing: 0.005em;
}

.icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  transform: translateY(-140%);
  background: var(--bg-raise);
  border: 1px solid var(--accent);
  color: var(--ink);
  padding: 0.6rem 1.1rem;
  font-size: 0.85rem;
  transition: transform 0.2s var(--ease-out);
}
.skip:focus {
  transform: translateY(0);
}

.rail-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}

/* ---------- topbar ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line-soft);
}
@supports not (backdrop-filter: blur(1px)) {
  .topbar {
    background: var(--bg);
  }
}

.topbar-in {
  height: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-width: 0;
}
.brand-name {
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  white-space: nowrap;
}
.brand-rule {
  align-self: center;
  width: 1px;
  height: 1.05rem;
  background: var(--line);
}
.brand-product {
  font-size: 0.95rem;
  font-weight: 380;
  color: var(--ink-dim);
  white-space: nowrap;
  transition: color 0.25s var(--ease-out);
}
.brand:hover .brand-product {
  color: var(--ink);
}
.brand-version {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 0.08rem 0.38rem;
  white-space: nowrap;
  align-self: center;
}

.topbar-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink-dim);
  cursor: pointer;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), background-color 0.2s var(--ease-out);
}
.icon-btn:hover {
  color: var(--ink);
  border-color: var(--line);
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 2rem;
  padding: 0 0.55rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-faint);
  font-family: var(--font-grot);
  font-size: 0.86rem;
  cursor: pointer;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.search-trigger:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.search-trigger .icon {
  width: 14px;
  height: 14px;
}
.search-trigger-text {
  min-width: 6.5rem;
  text-align: left;
}
.search-trigger kbd {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1;
  padding: 0.2rem 0.32rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-faint);
}

/* three-position switch: system / light / dark, with a sliding thumb so the
   state is one glance rather than a guess about what the icon will do next */
.theme-switch {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px;
  height: 2rem;
}
.theme-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc((100% - 4px) / 3);
  height: calc(100% - 4px);
  background: var(--accent-wash);
  border: 1px solid var(--accent-dim);
  border-radius: 1px;
  transform: translateX(calc(var(--pos, 0) * 100%));
  transition: transform 0.32s var(--ease-out);
  pointer-events: none;
}
.theme-opt {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 100%;
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.2s var(--ease-out);
}
.theme-opt .icon {
  width: 14px;
  height: 14px;
}
.theme-opt:hover {
  color: var(--ink-dim);
}
.theme-opt[aria-checked='true'] {
  color: var(--accent);
}

/* ---------- shell ---------- */

.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  /* the fixed topbar's height lives here, so the sticky sidebar and TOC begin
     below the bar rather than behind it on first paint */
  padding: var(--topbar-h) var(--pad) 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  column-gap: clamp(1.5rem, 3vw, 3.25rem);
  align-items: start;
}

/* ---------- sidebar ---------- */

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100svh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.sidebar-in {
  padding: 2rem 0 3rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.sidebar .rail-label {
  padding-left: 1rem;
  margin-bottom: 0.9rem;
}

.nav-list {
  list-style: none;
  border-left: 1px solid var(--line-soft);
}
.nav-link {
  position: relative;
  display: block;
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  transition: background-color 0.2s var(--ease-out);
}
/* the active marker is the rail taking the accent — the same idiom the
   marketing site uses for its station rail */
.nav-link::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 1px;
  background: transparent;
  transition: background-color 0.25s var(--ease-out);
}
.nav-link:hover::before {
  background: var(--line-strong);
}
.nav-link.is-current::before {
  background: var(--accent);
  top: 0;
  bottom: 0;
}
.nav-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--ink-dim);
  line-height: 1.4;
  transition: color 0.2s var(--ease-out);
}
.nav-note {
  display: block;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--ink-faint);
  margin-top: 0.12rem;
}
.nav-link:hover .nav-title {
  color: var(--ink);
}
.nav-link.is-current .nav-title {
  color: var(--ink);
  font-weight: 480;
}

.sidebar-foot {
  margin-top: auto;
  padding: 1.2rem 0.6rem 0 1rem;
  border-top: 1px solid var(--line-soft);
  margin-right: 0.6rem;
}
.sidebar-foot p {
  font-size: 0.74rem;
  line-height: 1.55;
  color: var(--ink-faint);
}
.sidebar-foot p:first-child {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.45rem;
}
.sidebar-foot p:first-child span {
  color: var(--accent);
}

.scrim {
  display: none;
}

/* ---------- document column ---------- */

.doc {
  min-width: 0;
  padding-top: 2.5rem;
}

/* Prose keeps a reading measure; tables and code are allowed to run wider,
   because a 12-column configuration table squeezed into 42rem is unreadable. */
.prose {
  display: grid;
  grid-template-columns: [text-start] min(var(--measure), 100%) [text-end] minmax(0, 14rem) [wide-end];
}
.prose > * {
  grid-column: text-start / text-end;
  min-width: 0;
}
.prose > .table-wrap,
.prose > .code {
  grid-column: text-start / wide-end;
}

.doc-source {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.72rem;
  color: var(--ink-faint);
  padding-bottom: 0.9rem;
  margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--line-soft);
}
.doc-source-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.doc-source-path {
  color: var(--ink-dim);
}

/* ---------- prose typography ---------- */

.prose h1 {
  font-size: clamp(2rem, 4.4vw, 2.75rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.028em;
  text-wrap: balance;
  margin-bottom: 1.4rem;
}
.prose h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.7rem);
  font-weight: 430;
  line-height: 1.22;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-top: 3.6rem;
  padding-top: 1.7rem;
  margin-bottom: 1rem;
  border-top: 1px solid var(--line-soft);
}
.prose h3 {
  font-size: 1.14rem;
  font-weight: 520;
  line-height: 1.35;
  letter-spacing: -0.012em;
  margin-top: 2.5rem;
  margin-bottom: 0.7rem;
}
.prose h4 {
  font-size: 0.98rem;
  font-weight: 560;
  line-height: 1.4;
  margin-top: 1.9rem;
  margin-bottom: 0.5rem;
  color: var(--ink);
}
.prose h5,
.prose h6 {
  font-size: 0.86rem;
  font-weight: 560;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  margin-top: 1.7rem;
  margin-bottom: 0.4rem;
}
.prose > h1:first-of-type {
  margin-top: 0;
}

.prose h2 .heading-anchor,
.prose h3 .heading-anchor,
.prose h4 .heading-anchor {
  display: inline-flex;
  align-items: center;
  margin-left: 0.45rem;
  color: var(--ink-faint);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out), color 0.2s var(--ease-out);
  vertical-align: middle;
}
.prose h2 .heading-anchor svg,
.prose h3 .heading-anchor svg,
.prose h4 .heading-anchor svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}
.prose :is(h2, h3, h4):hover .heading-anchor,
.prose .heading-anchor:focus-visible {
  opacity: 1;
  transform: translateX(0);
}
.prose .heading-anchor:hover {
  color: var(--accent);
}

.prose p,
.prose ul,
.prose ol,
.prose dl {
  margin-bottom: 1.15rem;
  color: var(--ink-dim);
}
.prose p {
  color: var(--ink-dim);
}
.prose strong {
  color: var(--ink);
  font-weight: 560;
}
.prose em {
  font-style: italic;
}

.prose ul,
.prose ol {
  padding-left: 1.35rem;
}
.prose li {
  margin-bottom: 0.45rem;
}
.prose li::marker {
  color: var(--accent-dim);
}
.prose ol > li::marker {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--ink-faint);
}
.prose li > ul,
.prose li > ol {
  margin-top: 0.45rem;
  margin-bottom: 0.2rem;
}
.prose li > p {
  margin-bottom: 0.5rem;
}

.prose a:not(.heading-anchor):not(.code-link) {
  color: var(--ink);
  border-bottom: 1px solid var(--accent-dim);
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.prose a:not(.heading-anchor):not(.code-link):hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
/* A link that leaves the appliance's own documentation says so — drawn with
   the same 1.4 stroke as the icon set, tinted from the surrounding text. */
.prose a.link-ext::after {
  content: '';
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-left: 0.3em;
  vertical-align: 0.04em;
  background: currentColor;
  opacity: 0.6;
  -webkit-mask: var(--icon-ext) center / contain no-repeat;
  mask: var(--icon-ext) center / contain no-repeat;
}
.prose a.link-ext:hover::after {
  opacity: 1;
}

.prose .code-link {
  border-bottom: 1px solid var(--accent-dim);
}
.prose .code-link:hover code {
  color: var(--accent);
  border-color: var(--accent-dim);
}
.prose .sect-ref {
  font-variant-numeric: tabular-nums;
}

.prose hr {
  grid-column: text-start / wide-end;
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.6rem 0;
}

/* inline code reads as a component of the sentence, not a chip pasted into it */
.prose code {
  font-family: var(--font-mono);
  font-size: 0.855em;
  font-weight: 450;
  font-variant-ligatures: none;
  color: var(--ink);
  background: var(--accent-wash);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 0.09em 0.34em;
  word-break: break-word;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.prose h1 code,
.prose h2 code,
.prose h3 code,
.prose h4 code {
  font-size: 0.9em;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

/* blockquote = the source's own callouts. 1px accent rule, raised plane. */
.prose blockquote {
  margin: 1.9rem 0;
  padding: 1.15rem 1.35rem;
  background: var(--bg-raise);
  border: 1px solid var(--line-soft);
  border-left: 1px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.prose blockquote > :last-child {
  margin-bottom: 0;
}
.prose blockquote p {
  color: var(--ink-dim);
  font-size: 0.955rem;
}
.prose blockquote strong {
  color: var(--ink);
}
.prose blockquote .code {
  margin: 1rem 0 0;
}

/* ---------- tables ---------- */

.table-wrap {
  margin: 1.8rem 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  scrollbar-width: thin;
  /* a fade on the right edge says "there is more" without a scrollbar */
  background:
    linear-gradient(to right, var(--bg) 30%, transparent) left / 2.5rem 100% no-repeat,
    linear-gradient(to left, var(--bg) 30%, transparent) right / 2.5rem 100% no-repeat,
    radial-gradient(farthest-side at 0 50%, var(--overlay), transparent) left / 0.7rem 100% no-repeat,
    radial-gradient(farthest-side at 100% 50%, var(--overlay), transparent) right / 0.7rem 100% no-repeat;
  background-attachment: local, local, scroll, scroll;
}
.table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  line-height: 1.6;
}
.prose thead th {
  text-align: left;
  font-weight: 500;
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-faint);
  background: var(--bg-sunken);
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.prose tbody td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-dim);
  vertical-align: top;
}
.prose tbody tr:last-child td {
  border-bottom: none;
}
.prose tbody td:first-child {
  color: var(--ink);
  white-space: nowrap;
}
.prose tbody td:first-child code {
  white-space: nowrap;
}
.prose tbody tr:hover td {
  background: var(--accent-wash);
}

/* ---------- code blocks ---------- */

.code {
  margin: 1.6rem 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
}
.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.32rem 0.4rem 0.32rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-sunken);
}
.code-lang {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
}
.code-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 0.22rem 0.5rem;
  cursor: pointer;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.code-copy:hover {
  color: var(--ink);
  border-color: var(--line);
}
.code-copy.is-done {
  color: var(--pass);
  border-color: transparent;
}
.code-copy .icon {
  width: 13px;
  height: 13px;
}

.code-body {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.code pre.shiki {
  margin: 0;
  padding: 1rem 1.1rem;
  background: transparent !important;
  font-family: var(--font-mono);
  font-size: 0.845rem;
  font-weight: 400;
  line-height: 1.72;
  font-variant-ligatures: none;
  tab-size: 2;
  min-width: max-content;
}
.code pre.shiki code {
  display: block;
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}
.shiki,
.shiki span {
  color: var(--sk-dark);
}
:root[data-theme='light'] .shiki,
:root[data-theme='light'] .shiki span {
  color: var(--sk-light);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .shiki,
  :root:not([data-theme='dark']) .shiki span {
    color: var(--sk-light);
  }
}
.shiki .line {
  display: block;
  min-height: 1.72em;
}

/* the LICENSE ships as fixed-width plain text; show it as typed */
.plaintext {
  margin: 1.6rem 0;
  padding: 1.3rem 1.4rem;
  background: var(--code-bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.75;
  color: var(--ink-dim);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.plaintext code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* ---------- inline (narrow) table of contents ---------- */

.toc-inline {
  margin-bottom: 2rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg-raise);
}
.toc-inline summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 0.95rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
  list-style: none;
}
.toc-inline summary::-webkit-details-marker {
  display: none;
}
.toc-inline summary .icon {
  transition: transform 0.25s var(--ease-out);
}
.toc-inline[open] summary .icon {
  transform: rotate(180deg);
}
.toc-inline ul {
  list-style: none;
  padding: 0 0.95rem 0.9rem;
  margin: 0;
}
.toc-inline li {
  margin: 0;
}
.toc-inline a {
  display: block;
  padding: 0.28rem 0;
  font-size: 0.87rem;
  color: var(--ink-dim);
  border: none;
}
.toc-inline a:hover {
  color: var(--accent);
}

/* ---------- table of contents (right rail) ---------- */

.toc {
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100svh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.toc-in {
  padding: 2.9rem 0 3rem;
}
.toc .rail-label {
  margin-bottom: 0.85rem;
  padding-left: 0.9rem;
}
.toc-nav {
  position: relative;
  border-left: 1px solid var(--line-soft);
}
/* one authored moment: the marker glides between entries as you read, rather
   than each entry flicking its own state on and off */
.toc-thumb {
  position: absolute;
  left: -1px;
  top: 0;
  width: 1px;
  height: 1px;
  background: var(--accent);
  transform-origin: top;
  transform: translateY(var(--toc-y, 0)) scaleY(var(--toc-h, 0));
  transition: transform 0.4s var(--ease-out), opacity 0.25s var(--ease-out);
  opacity: 0;
}
.toc-thumb.is-on {
  opacity: 1;
}
.toc-list {
  list-style: none;
}
.toc-item a {
  display: block;
  padding: 0.32rem 0.4rem 0.32rem 0.9rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-faint);
  transition: color 0.2s var(--ease-out);
}
.toc-l3 a {
  padding-left: 1.75rem;
  font-size: 0.79rem;
}
.toc-item a:hover {
  color: var(--ink-dim);
}
.toc-item a.is-active {
  color: var(--ink);
}

/* ---------- pager ---------- */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 4.5rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--line-soft);
}
.pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  transition: border-color 0.25s var(--ease-out), background-color 0.25s var(--ease-out);
}
.pager-link.is-empty {
  border-color: transparent;
}
.pager-link:not(.is-empty):hover {
  border-color: var(--line-strong);
  background: var(--bg-raise);
}
.pager-next {
  text-align: right;
  align-items: flex-end;
}
.pager-dir {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-faint);
}
.pager-dir .icon {
  width: 13px;
  height: 13px;
}
.pager-title {
  font-size: 0.98rem;
  color: var(--ink-dim);
  transition: color 0.25s var(--ease-out);
}
.pager-link:hover .pager-title {
  color: var(--ink);
}

/* ---------- footer ---------- */

.footer {
  margin-top: 4rem;
  padding: 2rem 0 3.5rem;
  border-top: 1px solid var(--line-soft);
}
.home .footer {
  margin-top: 0;
  padding: 2.5rem var(--pad) 4rem;
  border-top: 1px solid var(--line);
}
.footer-in {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}
.footer-legal {
  font-size: 0.82rem;
  color: var(--ink-dim);
}
.footer-note {
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.footer-note a {
  color: var(--ink-dim);
  border-bottom: 1px solid var(--line);
}
.footer-note a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent-dim);
}

/* ---------- search ---------- */

.search {
  width: min(46rem, calc(100vw - 2rem));
  max-height: min(34rem, calc(100vh - 8rem));
  margin: 0 auto;
  margin-top: clamp(2rem, 9vh, 6rem);
  padding: 0;
  background: var(--bg-raise);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--lift);
  overflow: hidden;
}
.search::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.search-in {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}
.search-field {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 0.6rem 0 1rem;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.search-field:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.search-field > .icon {
  color: var(--ink-faint);
  width: 15px;
  height: 15px;
}
.search-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: var(--font-grot);
  font-size: 1rem;
  padding: 0.95rem 0;
}
.search-input::placeholder {
  color: var(--ink-faint);
}
.search-input::-webkit-search-cancel-button {
  display: none;
}
.search-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  flex: 1;
}
.search-status {
  padding: 1.4rem 1.1rem;
  font-size: 0.87rem;
  color: var(--ink-faint);
  text-align: center;
}
.search-status:empty {
  display: none;
}
.search-results {
  list-style: none;
  padding: 0.4rem;
}
.search-results:empty {
  display: none;
}
.search-hit {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  border-left: 1px solid transparent;
}
.search-hit:hover,
.search-hit.is-active {
  background: var(--accent-wash);
  border-left-color: var(--accent);
}
.search-crumb {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-faint);
  margin-bottom: 0.18rem;
}
.search-title {
  display: block;
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.4;
}
.search-snippet {
  display: block;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink-faint);
  margin-top: 0.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search mark {
  background: var(--mark);
  color: var(--ink);
  border-radius: 1px;
  padding: 0 0.08em;
}
.search-foot {
  flex: none;
  display: flex;
  gap: 1.2rem;
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.68rem;
  color: var(--ink-faint);
  background: var(--bg-sunken);
}
.search-foot span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.search-foot kbd {
  font-family: var(--font-mono);
  border: 1px solid var(--line);
  border-radius: 1px;
  padding: 0 0.28rem;
  line-height: 1.4;
}
.search-close {
  display: none;
}

/* ---------- home ---------- */

/* The landing page is intentionally a small documentation index, not a
   marketing surface. It uses the same readable column and simple rules as a
   conventional docs home. */
.home {
  padding: calc(var(--topbar-h) + 2.25rem) var(--pad) 0;
}
.home > section {
  max-width: 70rem;
  margin: 0 auto;
  padding: 0 0 2.4rem;
}
.home h1,
.home h2 {
  color: var(--ink);
  font-weight: 580;
  letter-spacing: -0.018em;
}
.home h1 {
  max-width: 42rem;
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  line-height: 1.15;
}
.home h2 {
  font-size: 1.2rem;
  line-height: 1.3;
  margin-bottom: 0.85rem;
}
.home-intro {
  max-width: 50rem !important;
  border-bottom: 1px solid var(--line);
}
.home-intro p {
  max-width: 44rem;
  color: var(--ink-dim);
  font-size: 1rem;
  line-height: 1.65;
  margin-top: 0.8rem;
}
.home-intro p:last-child {
  font-size: 0.92rem;
}
.home-install {
  max-width: 50rem !important;
  border-bottom: 1px solid var(--line);
}
.home-command .code {
  margin: 0 0 1rem;
}
.home-install > p {
  max-width: 44rem;
  color: var(--ink-dim);
  font-size: 0.94rem;
  margin-top: 0.75rem;
}
.home a:not(.brand) {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}
.home a:not(.brand):hover {
  color: var(--ink);
}
.home-properties {
  max-width: 50rem !important;
  border-bottom: 1px solid var(--line);
}
.home-properties ul {
  list-style: none;
}
.home-properties li {
  color: var(--ink-dim);
  font-size: 0.94rem;
  line-height: 1.6;
  padding: 0.55rem 0;
}
.home-properties li + li {
  border-top: 1px solid var(--line-soft);
}
.home-properties strong {
  color: var(--ink);
  font-weight: 580;
}
.home-documents {
  max-width: 50rem !important;
}
.home-documents > ul {
  list-style: none;
  border-top: 1px solid var(--line);
}
.home-doc-item {
  padding: 0.9rem 0;
}
.home-doc-item + .home-doc-item {
  border-top: 1px solid var(--line-soft);
}
.home-doc-item > a {
  font-size: 1rem;
  font-weight: 580;
}
.home-doc-item p {
  color: var(--ink-dim);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-top: 0.18rem;
}
.home-doc-item span {
  display: block;
  color: var(--ink-faint);
  font-size: 0.76rem;
  margin-top: 0.2rem;
}
.home .footer {
  max-width: 70rem;
  margin: 0 auto;
  padding-left: 0;
  padding-right: 0;
}

/* ---------- responsive ---------- */

@media (max-width: 1200px) {
  .shell {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
  .prose {
    grid-template-columns: [text-start] min(var(--measure), 100%) [text-end] minmax(0, 12rem) [wide-end];
  }
}

/* The inline contents stand in for the right rail, so it hides exactly where
   the rail appears (1201px) — not at the sidebar breakpoint, which would leave
   1001–1200px with no table of contents at all. */
@media (min-width: 1201px) {
  .toc-inline {
    display: none;
  }
}

@media (max-width: 1000px) {
  body.nav-open {
    overflow: hidden;
    overscroll-behavior: none;
  }
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 35;
    width: min(19rem, 84vw);
    height: calc(100svh - var(--topbar-h));
    padding: 0 1rem 0 var(--pad);
    background: var(--bg-raise);
    border-right: 1px solid var(--line);
    transform: translateX(-102%);
    transition: transform 0.34s var(--ease-out);
    visibility: hidden;
  }
  body.nav-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    box-shadow: var(--lift);
  }
  /* The scrim stays laid out so it can fade, but it must not intercept a
     single tap while the nav is closed — `visibility` and `pointer-events`
     carry the closed state, never `display` (an author `display` beats the
     UA's `[hidden] { display: none }` and would make the whole page dead). */
  .scrim {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0;
    z-index: 34;
    background: var(--overlay);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s var(--ease-out), visibility 0s linear 0.3s;
  }
  body.nav-open .scrim {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.3s var(--ease-out), visibility 0s;
  }
  .doc {
    padding-top: 1.8rem;
  }
  .prose {
    grid-template-columns: [text-start] minmax(0, 1fr) [text-end wide-end];
  }
  .search-trigger-text,
  .search-trigger kbd {
    display: none;
  }
  .search-trigger {
    width: 2rem;
    padding: 0;
    justify-content: center;
  }
}

@media (max-width: 760px) {
  :root {
    --topbar-h: 3.25rem;
  }
  body {
    font-size: 0.97rem;
  }
  .home {
    padding-top: calc(var(--topbar-h) + 1.65rem);
  }
  .home > section {
    padding-bottom: 1.9rem;
  }
  .home h1 {
    font-size: 1.85rem;
  }
  .topbar-menu {
    margin-left: -0.4rem;
  }
  .brand-product,
  .brand-rule {
    display: none;
  }
  .prose h2 {
    margin-top: 2.8rem;
    padding-top: 1.4rem;
  }
  .pager {
    grid-template-columns: minmax(0, 1fr);
  }
  .footer-in {
    flex-direction: column;
  }
  .search {
    margin-top: 0;
    width: 100vw;
    max-width: 100vw;
    max-height: 100svh;
    height: 100svh;
    border: none;
  }
  .search-in {
    height: 100%;
    max-height: 100svh;
  }
  .search-close {
    display: inline-flex;
  }
  .search-foot {
    display: none;
  }
  .code pre.shiki {
    font-size: 0.79rem;
    padding: 0.85rem 0.9rem;
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
  }
}

/* ---------- print ---------- */

@media print {
  .topbar,
  .sidebar,
  .toc,
  .toc-inline,
  .pager,
  .search,
  .scrim,
  .heading-anchor,
  .code-bar {
    display: none !important;
  }
  .shell {
    display: block;
    padding: 0;
  }
  .doc {
    padding-top: 0;
  }
  .prose {
    display: block;
    max-width: none;
  }
  body {
    background: #fff;
    color: #000;
  }
}
