:root,
html.dark {
  color-scheme: dark;
  /* The product's own tokens (src/styles.css, --aether-*). The docs used to
     carry a separate green palette, which made /docs look like a different
     product from the app it documents. */
  --bg: #181b2d;
  --surface: #22263b;
  --raised: #2d324a;
  --fg: #f2f3ff;
  --muted: #c1c5de;
  --subtle: #a6acc9;
  --border: #393e59;
  --line: #505878;
  --accent: #b7a9ff;
  --accent-fg: #1f1745;
  --warn: #dfbd75;
  --danger: #f49b91;
  --orb-warm: #b2ebff;
  --orb-cool: #9380f5;
  --shadow: 0 0 0 1px #393e59;
  --shadow-hover: 0 0 0 1px #505878;
  --hero-glow: rgb(183 169 255 / 0.12);
  --code-bg: #141726;
  --theme-color: #181b2d;
}

html.light {
  color-scheme: light;
  --bg: #f8f9fd;
  --surface: #ffffff;
  --raised: #f0f1f8;
  --fg: #25283e;
  --muted: #61667d;
  --subtle: #72768b;
  --border: #e3e5f0;
  --line: #cdd1e2;
  --accent: #6050cf;
  --accent-fg: #ffffff;
  --warn: #946318;
  --danger: #b63d3d;
  --orb-warm: #b2ebff;
  --orb-cool: #9380f5;
  --shadow: 0 0 0 1px #e3e5f0, 0 4px 14px -8px rgb(48 45 35 / 0.1);
  --shadow-hover: 0 0 0 1px #c6c4e4, 0 8px 24px -12px rgb(48 45 35 / 0.18);
  --hero-glow: rgb(96 80 207 / 0.1);
  --code-bg: #eceefa;
  --theme-color: #f8f9fd;
}

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

html {
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  overflow-x: clip;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
}

body {
  overflow-x: clip;
}

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
}

button:not(:disabled),
[role="button"]:not(:disabled) {
  cursor: pointer;
}

img,
svg {
  display: block;
}

h1,
h2,
h3,
.display {
  /* Manrope, not a serif: the app has no serif face anywhere. The tighter
     tracking and heavier weight are what make it read as a heading. */
  font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.03em;
  text-wrap: balance;
  font-weight: 600;
}

p {
  text-wrap: pretty;
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 80;
  padding: 0.6rem 0.9rem;
  border-radius: 0.75rem;
  background: var(--accent);
  color: var(--accent-fg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 12px 12px 0;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto;
  height: 56px;
  padding: 0 12px 0 14px;
  border-radius: 1rem;
  background: color-mix(in oklab, var(--surface) 95%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
}

.wordmark-name {
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.wordmark-mark {
  width: 28px;
  height: 28px;
}

.top-links {
  display: none;
  align-items: center;
  gap: 4px;
}

.top-links a,
.crumb {
  padding: 8px 12px;
  border-radius: 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.top-links a:hover,
.crumb:hover {
  background: var(--raised);
  color: var(--fg);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 0.75rem;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.icon-btn {
  width: 40px;
  color: var(--muted);
}

.icon-btn:hover {
  background: var(--raised);
  color: var(--fg);
}

.btn-ghost {
  padding: 0 14px;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--raised);
  color: var(--fg);
}

.btn-primary {
  padding: 0 16px;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 500;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.menu-btn {
  display: grid;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 80px;
  gap: 28px;
}

/* A grid item defaults to min-width:auto, so one wide code block or table
   stretches the whole column past the viewport — on a phone the headings were
   cut off mid-word, hidden rather than fixed by the overflow-x:clip above.
   The children that are legitimately wide scroll inside themselves (`pre` has
   overflow-x, tables sit in .table-wrap). */
.layout > main {
  min-width: 0;
}

.sidebar {
  display: none;
}

.sidebar-nav {
  display: grid;
  gap: 2px;
}

.nav-group {
  margin-top: 18px;
  padding: 0 10px 6px;
  color: var(--subtle);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-group:first-child {
  margin-top: 0;
}

.sidebar a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 0.7rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.sidebar a:hover,
.sidebar a.active {
  background: var(--raised);
  color: var(--fg);
}

.sidebar a.active {
  box-shadow: var(--shadow);
}

.page {
  display: none;
  min-width: 0;
}

.page.active {
  display: block;
  animation: rise 0.35s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.kicker {
  margin: 8px 0 0;
  color: var(--subtle);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 10px 0 0;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.1;
}

.lede {
  max-width: 42rem;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

h2 {
  margin: 48px 0 0;
  font-size: 1.85rem;
  line-height: 1.2;
}

h3 {
  margin: 28px 0 0;
  font-size: 1.25rem;
  line-height: 1.3;
}

.page p,
.page li {
  line-height: 1.65;
}

.page p {
  margin: 12px 0 0;
  color: var(--muted);
}

.page ul,
.page ol {
  margin: 12px 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.page li + li {
  margin-top: 6px;
}

.page strong {
  color: var(--fg);
  font-weight: 550;
}

.cards {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.card {
  padding: 18px 18px 16px;
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card h3 {
  margin-top: 0;
}

.card p:first-of-type {
  margin-top: 8px;
}

.card a {
  color: var(--accent);
}

.toc a {
  display: inline-flex;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 22px;
}

.stat {
  padding: 16px;
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat b {
  display: block;
  font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.steps {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 16px 16px 14px;
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.step-n {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.8rem;
  font-weight: 600;
}

.step h3 {
  margin: 2px 0 0;
}

.flow {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.flow-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--raised);
  color: var(--fg);
  font-size: 0.82rem;
}

.arrow {
  color: var(--subtle);
  font-size: 0.9rem;
}

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: var(--muted);
}

td:first-child,
code.k {
  color: var(--fg);
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.8rem;
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-need {
  background: color-mix(in oklab, var(--accent) 18%, transparent);
  color: var(--accent);
}

.badge-opt {
  background: var(--raised);
  color: var(--muted);
}

.badge-env {
  background: color-mix(in oklab, var(--warn) 18%, transparent);
  color: var(--warn);
}

pre {
  position: relative;
  margin: 14px 0 0;
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: 1rem;
  background: var(--code-bg);
  box-shadow: var(--shadow);
  color: var(--fg);
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.55;
}

.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 0.55rem;
  background: var(--raised);
  color: var(--muted);
  font-size: 0.72rem;
}

.copy:hover {
  color: var(--fg);
}

.callout {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.callout.warn {
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--warn) 35%, transparent);
}

.callout p {
  margin: 0;
}

.note-title {
  display: block;
  margin-bottom: 4px;
  color: var(--fg);
  font-size: 0.82rem;
  font-weight: 600;
}

.footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 40px;
  color: var(--subtle);
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.search-wrap {
  position: relative;
  margin: 8px 0 18px;
}

.search-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  border: 0;
  border-radius: 0.75rem;
  background: var(--raised);
  color: var(--fg);
  box-shadow: var(--shadow);
  outline: none;
}

.search-wrap input:focus {
  box-shadow: var(--shadow-hover);
}

.search-wrap svg {
  position: absolute;
  top: 11px;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--subtle);
}

.search-hits {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 20;
  margin-top: 6px;
  padding: 6px;
  border-radius: 0.9rem;
  background: var(--surface);
  box-shadow: var(--shadow-hover);
}

.search-hits.open {
  display: grid;
}

.search-hits button {
  padding: 9px 10px;
  border-radius: 0.65rem;
  text-align: left;
  color: var(--muted);
  font-size: 0.86rem;
}

.search-hits button:hover,
.search-hits button[aria-selected="true"] {
  background: var(--raised);
  color: var(--fg);
}

.search-hits small {
  display: block;
  color: var(--subtle);
  font-size: 0.72rem;
}

.drawer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
}

.drawer.open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(6 10 12 / 0.55);
}

.drawer-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 14px;
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow-hover);
}

.toc-mobile {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toc-mobile a {
  display: block;
  padding: 7px 0;
  color: var(--muted);
}

.toc-mobile a:hover {
  color: var(--fg);
}

@media (min-width: 720px) {
  .top-links {
    display: flex;
  }

  .stat-row {
    grid-template-columns: repeat(4, 1fr);
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .menu-btn {
    display: none;
  }
}

@media (min-width: 980px) {
  .layout {
    grid-template-columns: 240px minmax(0, 1fr);
    padding-top: 28px;
  }

  .sidebar {
    display: block;
    position: sticky;
    top: 88px;
    align-self: start;
    max-height: calc(100dvh - 108px);
    overflow: auto;
    padding-right: 8px;
  }

  .toc-mobile {
    display: none;
  }

  .cards.three {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

  .page.active {
    animation: none;
  }
}
