@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-400.woff2") format("woff2");
}

/* The same variable names and values as packages/ui/src/styles/globals.css,
   so the manual reads as part of the product. */
:root {
  color-scheme: light;
  --background: oklch(0.994 0.002 250);
  --foreground: oklch(0.214 0.014 253);
  --card: oklch(1 0 0);
  --primary: oklch(0.512 0.114 58);
  --primary-foreground: oklch(0.995 0.003 85);
  --primary-subtle: oklch(0.957 0.024 78);
  --muted: oklch(0.966 0.004 250);
  --muted-foreground: oklch(0.468 0.013 253);
  --accent: oklch(0.941 0.006 250);
  --destructive: oklch(0.505 0.183 27);
  --success: oklch(0.492 0.104 158);
  --warning: oklch(0.522 0.126 72);
  --border: oklch(0.896 0.005 250);
  --border-strong: oklch(0.622 0.016 253);
  --ring: oklch(0.512 0.114 58);
  --sidebar: oklch(0.977 0.003 250);
  --editor-canvas: oklch(0.898 0.007 252);
  --insertion: oklch(0.498 0.132 214);
  --radius: 0.375rem;
  --font-sans:
    "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:
    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --topbar: 3.25rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: oklch(0.203 0.011 253);
    --foreground: oklch(0.938 0.004 250);
    --card: oklch(0.246 0.013 253);
    --primary: oklch(0.763 0.129 72);
    --primary-foreground: oklch(0.203 0.032 62);
    --primary-subtle: oklch(0.322 0.046 68);
    --muted: oklch(0.276 0.012 253);
    --muted-foreground: oklch(0.714 0.011 250);
    --accent: oklch(0.322 0.014 253);
    --destructive: oklch(0.714 0.178 25);
    --success: oklch(0.724 0.124 158);
    --warning: oklch(0.782 0.124 78);
    --border: oklch(0.338 0.012 253);
    --border-strong: oklch(0.586 0.016 253);
    --ring: oklch(0.763 0.129 72);
    --sidebar: oklch(0.232 0.012 253);
    --editor-canvas: oklch(0.128 0.009 253);
    --insertion: oklch(0.706 0.108 212);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: oklch(0.203 0.011 253);
  --foreground: oklch(0.938 0.004 250);
  --card: oklch(0.246 0.013 253);
  --primary: oklch(0.763 0.129 72);
  --primary-foreground: oklch(0.203 0.032 62);
  --primary-subtle: oklch(0.322 0.046 68);
  --muted: oklch(0.276 0.012 253);
  --muted-foreground: oklch(0.714 0.011 250);
  --accent: oklch(0.322 0.014 253);
  --destructive: oklch(0.714 0.178 25);
  --success: oklch(0.724 0.124 158);
  --warning: oklch(0.782 0.124 78);
  --border: oklch(0.338 0.012 253);
  --border-strong: oklch(0.586 0.016 253);
  --ring: oklch(0.763 0.129 72);
  --sidebar: oklch(0.232 0.012 253);
  --editor-canvas: oklch(0.128 0.009 253);
  --insertion: oklch(0.706 0.108 212);
}

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

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

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: 400 1rem/1.65 var(--font-sans);
  font-kerning: normal;
}

a {
  color: var(--primary);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 2px;
}

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

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 50;
  padding: 0.5rem 0.75rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius);
}
.skip:focus {
  top: 0.5rem;
}

.icon {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--topbar);
  padding: 0 1rem;
  background: var(--background);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--foreground);
  font-weight: 600;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font: 400 0.6875rem/1 var(--font-mono);
}
.brand-sub {
  color: var(--muted-foreground);
  font-weight: 400;
}
.version {
  margin-left: auto;
  color: var(--muted-foreground);
  font: 400 0.75rem/1 var(--font-mono);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
}
.icon-button:hover {
  background: var(--accent);
}
.theme-button .icon:last-child {
  display: none;
}
:root[data-theme-resolved="dark"] .theme-button .icon:first-child {
  display: none;
}
:root[data-theme-resolved="dark"] .theme-button .icon:last-child {
  display: block;
}
.menu-button,
.close-button {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr) 13rem;
  max-width: 88rem;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: var(--topbar);
  height: calc(100vh - var(--topbar));
  overflow-y: auto;
  padding: 1.25rem 1rem 2rem;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
}
.sidebar-head {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  color: var(--muted-foreground);
}
.search .icon {
  position: absolute;
  left: 0.625rem;
  width: 1rem;
  height: 1rem;
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 2.25rem;
  padding: 0 0.75rem 0 2.125rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  font-size: 0.9375rem;
}
.search input::placeholder {
  color: var(--muted-foreground);
}
.search input:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 0;
}

.search-results {
  margin-top: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.search-results p {
  margin: 0.25rem 0.5rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}
.search-results ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
.search-results a {
  display: block;
  padding: 0.5rem;
  border-radius: var(--radius);
  color: var(--foreground);
  text-decoration: none;
}
.search-results a:hover,
.search-results a:focus-visible {
  background: var(--accent);
}
.search-results strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
}
.search-results small {
  display: block;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  line-height: 1.45;
}
.search-results mark {
  background: var(--primary-subtle);
  color: inherit;
}

.nav {
  margin-top: 1.25rem;
}
.nav-group + .nav-group {
  margin-top: 1.25rem;
}
.nav-label {
  margin: 0 0 0.375rem 0.5rem;
  color: var(--muted-foreground);
  font: 400 0.6875rem/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav ul,
.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav a {
  display: block;
  padding: 0.3125rem 0.5rem;
  border-radius: var(--radius);
  color: var(--foreground);
  font-size: 0.9375rem;
  line-height: 1.4;
  text-decoration: none;
}
.nav a:hover {
  background: var(--accent);
}
.nav a[aria-current="page"] {
  background: var(--primary-subtle);
  color: var(--foreground);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--primary);
}

.content {
  min-width: 0;
  padding: 2.5rem 3rem 3rem;
  outline: none;
}

.toc {
  position: sticky;
  top: var(--topbar);
  align-self: start;
  max-height: calc(100vh - var(--topbar));
  overflow-y: auto;
  padding: 2.75rem 1rem 2rem 0;
}
.toc a {
  display: block;
  padding: 0.25rem 0 0.25rem 0.75rem;
  border-left: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  line-height: 1.4;
  text-decoration: none;
}
.toc a:hover {
  color: var(--foreground);
  border-left-color: var(--border-strong);
}

.prose {
  max-width: 46rem;
}
.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--primary);
  font: 400 0.75rem/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.prose h1 {
  margin: 0 0 1rem;
  font-size: 2.125rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.prose h1 + p {
  color: var(--muted-foreground);
  font-size: 1.125rem;
  line-height: 1.55;
}
.prose h2 {
  margin: 2.75rem 0 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.3;
}
.prose h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
}
.prose h4 {
  margin: 1.5rem 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
}
.anchor {
  color: inherit;
  text-decoration: none;
}
.anchor:hover {
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
}
.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1rem;
}
.prose li + li {
  margin-top: 0.375rem;
}
.prose li > ul,
.prose li > ol {
  margin: 0.375rem 0 0;
}
.prose ol {
  padding-left: 1.75rem;
}
.prose ol > li::marker {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}
.prose ul {
  padding-left: 1.25rem;
}
.prose ul > li::marker {
  color: var(--muted-foreground);
}
.prose strong {
  font-weight: 600;
}
.prose hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose code {
  padding: 0.0625rem 0.3125rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.6);
  background: var(--muted);
  font: 400 0.875em/1.5 var(--font-mono);
  overflow-wrap: anywhere;
}
.prose pre {
  position: relative;
  margin: 0 0 1.25rem;
  padding: 0.875rem 1rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  font: 400 0.8125rem/1.6 var(--font-mono);
}
.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  overflow-wrap: normal;
}

.table-wrap {
  margin: 0 0 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.5;
}
.prose th,
.prose td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.prose th {
  background: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.prose tr:last-child td {
  border-bottom: 0;
}
.prose td code {
  white-space: nowrap;
}

.callout {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--insertion);
  border-radius: var(--radius);
  background: var(--card);
}
.callout.tip {
  border-left-color: var(--success);
}
.callout.warning {
  border-left-color: var(--destructive);
}
.callout-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin: 0 0 0.25rem !important;
  font-size: 0.875rem;
  font-weight: 600;
}
.callout.note .callout-label .icon {
  color: var(--insertion);
}
.callout.tip .callout-label .icon {
  color: var(--success);
}
.callout.warning .callout-label .icon {
  color: var(--destructive);
}
.callout > :last-child {
  margin-bottom: 0;
}

blockquote {
  margin: 0 0 1rem;
  padding-left: 1rem;
  border-left: 3px solid var(--border-strong);
  color: var(--muted-foreground);
}

.shot {
  margin: 1.5rem 0 1.75rem;
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--editor-canvas);
}
.shot.phone img {
  width: auto;
  max-width: 100%;
  max-height: 42rem;
  margin: 0 auto;
}
.shot figcaption {
  margin-top: 0.5rem;
  color: var(--muted-foreground);
  font: 400 0.75rem/1.5 var(--font-mono);
  text-align: center;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 46rem;
  margin-top: 3.5rem;
}
.pager-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--foreground);
  text-decoration: none;
}
.pager-link:hover {
  border-color: var(--border-strong);
  background: var(--muted);
}
.pager-link small {
  display: block;
  color: var(--muted-foreground);
  font: 400 0.6875rem/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pager-link.next {
  justify-content: flex-end;
  text-align: right;
}
.footer {
  max-width: 46rem;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: oklch(0.128 0.009 253 / 0.45);
}

@media (max-width: 80rem) {
  .layout {
    grid-template-columns: 16rem minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
}

@media (max-width: 56rem) {
  .layout {
    display: block;
  }
  .menu-button,
  .close-button {
    display: inline-grid;
  }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: min(20rem, 88vw);
    height: auto;
    transform: translateX(-100%);
    visibility: hidden;
    transition:
      transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0s linear 200ms;
  }
  body.nav-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .content {
    padding: 1.75rem 1rem 2.5rem;
  }
  .prose h1 {
    font-size: 1.75rem;
  }
  .prose h2 {
    font-size: 1.25rem;
  }
  .pager {
    grid-template-columns: 1fr;
  }
}

/* Tables become one labelled card per row on phones, so nothing scrolls
   sideways; each cell repeats its column heading from data-label. */
@media (max-width: 40rem) {
  .table-wrap {
    overflow: visible;
    border: 0;
  }
  .prose table,
  .prose tbody,
  .prose tr,
  .prose td {
    display: block;
  }
  .prose thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .prose tr {
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
  }
  .prose td {
    padding: 0.5rem 0.75rem;
  }
  .prose td + td {
    border-top: 1px solid var(--border);
  }
  .prose tr:last-child td {
    border-bottom: 0;
  }
  .prose td:first-child {
    background: var(--muted);
    font-weight: 600;
  }
  .prose td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.125rem;
    color: var(--muted-foreground);
    font: 400 0.6875rem/1.4 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .prose td code {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  body.nav-open .sidebar {
    transition: none;
  }
}

@media print {
  .topbar,
  .sidebar,
  .toc,
  .pager,
  .skip {
    display: none;
  }
  .layout {
    display: block;
  }
  .content {
    padding: 0;
  }
}
