/*
 * The marketing site's styles.
 *
 * The colour values are copied from the console's tokens
 * (packages/console/src/styles/tokens.css), which explains why both columns
 * are hand-authored rather than derived. --tx-2 is the exception: body, card,
 * sidebar and footer copy use it, so the light value is darker than the
 * console token and the dark value is lighter. Each clears WCAG AA (4.5:1)
 * on --bg, --panel and --panel-2. Same rules otherwise: the neutral base
 * carries no colour, green means fresh / live only, and the screenshot is the
 * one saturated thing on the page. The theme follows the visitor's system
 * setting; there is no toggle on a page with nothing to sign into.
 */

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

:root {
  color-scheme: light;
  --bg: oklch(0.982 0.002 100);
  --panel: oklch(1 0 0);
  --panel-2: oklch(0.968 0.002 100);
  --line: oklch(0.895 0.003 100);
  --line-2: oklch(0.935 0.003 100);
  --tx: oklch(0.245 0.005 100);
  /* Darker than the console's --tx-2. #4e4d4a is about 8.5:1 on white. */
  --tx-2: oklch(0.42 0.005 100);
  --tx-3: oklch(0.635 0.005 100);
  --green: oklch(0.505 0.115 150);
  --green-bg: oklch(0.962 0.028 150);
  --green-line: oklch(0.865 0.055 150);
  --green-dot: oklch(0.6 0.13 150);
  --term-bg: oklch(0.22 0.006 265);
  --term-tx: oklch(0.88 0.005 265);
  --term-dim: oklch(0.64 0.008 265);
  --shadow: 0 1px 2px rgba(20, 20, 18, 0.05), 0 1px 1px rgba(20, 20, 18, 0.04);
  --shadow-lg: 0 24px 60px -24px rgba(20, 20, 18, 0.25);

  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: oklch(0.165 0.004 265);
    --panel: oklch(0.199 0.005 265);
    --panel-2: oklch(0.235 0.005 265);
    --line: oklch(0.285 0.006 265);
    --line-2: oklch(0.245 0.006 265);
    --tx: oklch(0.945 0.004 265);
    /* Lighter than the console's dark --tx-2, so the same copy stays above
       7:1 on --panel-2, the lightest surface it sits on. */
    --tx-2: oklch(0.74 0.008 265);
    --tx-3: oklch(0.545 0.008 265);
    --green: oklch(0.8 0.14 150);
    --green-bg: oklch(0.285 0.055 150);
    --green-line: oklch(0.385 0.075 150);
    --green-dot: oklch(0.78 0.15 150);
    --term-bg: oklch(0.135 0.005 265);
    --term-tx: oklch(0.9 0.005 265);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  }
}

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

/* A class that sets `display` (`.shot img` is `block`) beats the browser's own
   `[hidden] { display: none }`, so `hidden` would silently do nothing. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}

.mono {
  font-family: var(--mono);
  font-size: 0.9em;
  /* Long URLs in running text would otherwise widen the page on phones.
     break-word, not anywhere: it leaves table column widths alone. */
  overflow-wrap: break-word;
}

.muted {
  color: var(--tx-2);
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 16px;
  top: 16px;
  z-index: 10;
  background: var(--panel);
  padding: 8px 12px;
  border-radius: 6px;
}

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

/* Header ---------------------------------------------------------------- */

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in oklch, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-2);
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
}

.wordmark {
  font-size: 18px;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 15px;
}

.nav a {
  color: var(--tx-2);
  text-decoration: none;
}

.nav a:hover {
  color: var(--tx);
}

.nav .nav-signin {
  color: var(--tx);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 14px;
  background: var(--panel);
}

/* The phone control. Hidden up here so the desktop row is the links alone.
   The panel is an ordinary flex row at this width: it is not a disclosure,
   so the links stay in the tab order and the accessibility tree. */
.nav-toggle {
  display: none;
}

.nav-panel {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav a[aria-current] {
  color: var(--tx);
  font-weight: 500;
}

/* Hero ------------------------------------------------------------------ */

.hero {
  padding: 96px 0 56px;
  text-align: center;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 4px 12px;
  border: 1px solid var(--green-line);
  background: var(--green-bg);
  color: var(--green);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-dot);
  box-shadow: 0 0 0 0 var(--green-dot);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in oklch, var(--green-dot) 60%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 8px transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dot {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}

.hero h1 {
  font-size: clamp(40px, 7vw, 72px);
  max-width: 14ch;
}

.lede {
  max-width: 60ch;
  margin: 24px 0 0;
  font-size: clamp(17px, 2vw, 20px);
  color: var(--tx-2);
  text-wrap: pretty;
}

.ctas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 20px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--tx);
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.btn:hover {
  border-color: var(--tx-3);
}

.btn-primary {
  background: var(--tx);
  border-color: var(--tx);
  color: var(--bg);
}

.btn-primary:hover {
  border-color: var(--tx);
  opacity: 0.9;
}

/* A labelled example of the screenshot URL, not a stray line of debug text.
   The chip shrinks to the URL and the breaks are the <wbr> marks after each
   slash, so a phone wraps at a path segment. */
.url-example {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin: 28px 0 0;
  padding: 10px 16px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: left;
}

.url-example figcaption {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--tx-2);
}

.url-example code {
  font-family: var(--mono);
  font-size: clamp(12px, 1.5vw, 14px);
  line-height: 1.45;
  color: var(--tx);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.slot {
  color: var(--green);
}

/* The live screenshot -------------------------------------------------- */

.shot-section {
  padding-bottom: 40px;
}

.shot {
  margin: 0 auto;
  max-width: 1040px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.shot-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  background: var(--panel-2);
}

.shot-dots {
  display: inline-flex;
  gap: 6px;
}

.shot-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  /* --line is 1.1:1 on --panel-2 in dark and vanishes. --tx-3 clears 3:1,
     the bar for a non-text mark, in both themes. */
  background: var(--tx-3);
}

.shot-url {
  font-size: 12px;
  color: var(--tx-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/*
 * The homepage figure is `projects-cards@latest.png`: self-screenshot.mjs
 * crops the console to its header and the project cards at 800 CSS px, two
 * card columns wide, at DPR 3. So the page shows it whole, with no crop
 * numbers to keep in step with the console. A phone is too narrow for two
 * cards at a readable size, so there the frame shows the left half: the
 * header and the first card.
 *
 * The checkerboard on the frame is the placeholder: an image that has not
 * painted yet is transparent, so it shows through, and the img's width and
 * height attributes reserve the space. `--panel` is white; this is not.
 */
.shot img {
  display: block;
  width: 100%;
  height: auto;
}

.shot-frame {
  overflow: hidden;
  background-color: var(--panel-2);
  background-image: conic-gradient(var(--line) 0 25%, transparent 0 50%, var(--line) 0 75%, transparent 0);
  background-size: 16px 16px;
}

@media (max-width: 640px) {
  .shot-frame img {
    width: 200%;
    max-width: none;
  }
}

.shot-fallback {
  margin: 0;
  padding: 48px 24px;
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
  color: var(--tx-2);
}

.shot-fallback .mono {
  display: block;
  margin: 8px 0;
  color: var(--tx);
  white-space: nowrap;
  overflow-x: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.shot figcaption {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--tx-2);
  border-top: 1px solid var(--line-2);
}

/* Sections -------------------------------------------------------------- */

.section {
  padding: 88px 0;
}

.section-alt {
  background: var(--panel-2);
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}

.section h2,
.final h2 {
  font-size: clamp(28px, 4vw, 40px);
}

.section-lede {
  max-width: 62ch;
  margin: 12px 0 0;
  font-size: 18px;
  color: var(--tx-2);
}

.steps {
  list-style: none;
  padding: 0;
  margin: 48px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

/* Below about 1020px a third of the row is narrower than the workflow
   snippet's longest line (`project: acme/dashboard`), so the steps stack. */
@media (max-width: 1020px) {
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Each card spans four rows of the list (number, heading, text, code) and
   shares them through subgrid, so the code wells in a row line up and match
   the tallest one at every width, without a fixed height that could clip. */
.step {
  display: grid;
  grid-row: span 4;
  grid-template-rows: subgrid;
  row-gap: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.step-n {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
  margin-bottom: 16px;
  justify-self: start;
}

.step h3 {
  font-size: 20px;
}

.step p {
  margin: 8px 0 20px;
  color: var(--tx-2);
  font-size: 16px;
}

.code,
.terminal pre {
  margin: 0;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--term-bg);
  color: var(--term-tx);
  font: 400 13px/1.6 var(--mono);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklch, var(--term-tx) 45%, transparent) transparent;
}

.step .mono,
.card .mono,
.lede .mono,
.section-lede .mono,
.agents .mono {
  /* A hyphen is a soft wrap opportunity. `overflow-wrap: break-word` on
     `.mono` does not remove it, so `@pr-142` and `screenery verify-publish`
     still split in the visual-testing cards after PR #485 (that nowrap
     covered `.step` only). The whole token stays on one line. */
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
}

.step .code,
.card .code {
  /* A wrapped line restarts at the left edge (YAML reads as a new key) and
     a URL or `diff-baseline` breaks at a hyphen. Keep each source line
     intact. `min-width: 0` lets the grid item shrink so the card does not
     widen the page. */
  min-width: 0;
  max-width: 100%;
  white-space: pre;
}

.step .code {
  /* Subgrid stretches this well to the tallest sibling. The inner code is
     what truncates, so a long URL ellipsizes on its own line. */
  overflow: hidden;
}

.step .code code,
.card .code,
#testing .terminal pre {
  /* Overlay scrollbars do not paint until the pointer hovers, so a clipped
     token looks broken. Ellipsis marks the cut. The full line stays in the
     element, so selecting it still copies every character. */
  overflow-x: hidden;
  text-overflow: ellipsis;
}

.step .code code {
  display: block;
}

/* Visual regression testing ------------------------------------------- */

.split,
.agents {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 56px;
  align-items: center;
}

/* A screenshot in a split column: the URL bar's nowrap text would otherwise
   set the figure's minimum width and push a phone page sideways. */
.split .shot {
  width: 100%;
}

.split .shot-url {
  min-width: 0;
}

.agents .muted {
  margin-top: 16px;
}

.terminal {
  padding: 20px;
  border-radius: 12px;
  background: var(--term-bg);
  color: var(--term-tx);
  box-shadow: var(--shadow-lg);
  /* Grid item: without this, a nowrap pre's min-content widens the page. */
  min-width: 0;
}

.terminal pre {
  padding: 8px 0 18px;
  white-space: pre-wrap;
}

#testing .terminal pre {
  /* The diff mock is columns of tokens (`pr-142`, `payment-form`). pre-wrap
     breaks those at the hyphen. The agent terminal stays pre-wrap so its
     sentence wraps at spaces. */
  white-space: pre;
}

.terminal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.terminal-label {
  font: 500 12px/1 var(--mono);
  color: var(--term-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.prompt {
  color: var(--term-dim);
}

.copy {
  font: 500 12px/1 var(--mono);
  color: var(--term-tx);
  background: transparent;
  border: 1px solid color-mix(in oklch, var(--term-tx) 25%, transparent);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

.copy:hover {
  border-color: var(--term-tx);
}

.terminal-foot {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid color-mix(in oklch, var(--term-tx) 15%, transparent);
  font-size: 14px;
  color: var(--term-dim);
}

.terminal-foot a {
  color: var(--term-tx);
}

/* Visual regression testing: the parts .agents does not share -------- */

.kicker {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.split + .grid {
  margin-top: 56px;
}

.st {
  color: var(--term-dim);
}

/* Terminal-only colours: the panel is dark in both themes, so these are
   the dark column's green and amber, not the page's. */
.st-changed {
  color: oklch(0.825 0.12 78);
}

.st-added {
  color: oklch(0.8 0.14 150);
}

.card .code {
  margin-top: 16px;
}

/* At 320px the longest YAML line (`project: acme/dashboard`) is a few
   characters wider than the card. A slightly smaller face and tighter
   padding let that line finish instead of ending on an ellipsis. The embed
   URL is still longer than the card; it truncates. */
@media (max-width: 340px) {
  .step .code,
  .card .code {
    padding-left: 8px;
    padding-right: 8px;
    font-size: 11.5px;
  }

  /* The diff mock's longest line is `screenery_diff from: latest  to: pr-142`.
     At 11.5px that line still ends inside `pr-142`. 10.5px fits the whole
     token in the card. */
  #testing .terminal {
    padding-left: 10px;
    padding-right: 10px;
  }

  #testing .terminal pre {
    padding-left: 6px;
    padding-right: 6px;
    font-size: 10.5px;
  }
}

/* Features -------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 48px;
}

.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.card h3 {
  font-size: 18px;
}

.card p {
  margin: 8px 0 0;
  color: var(--tx-2);
  font-size: 16px;
}

/* Closing call to action ----------------------------------------------- */

.final {
  padding: 96px 0;
  text-align: center;
  border-top: 1px solid var(--line-2);
}

.final-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The non-breaking space in "embedded&nbsp;it." keeps the last word off a
   line of its own; balance evens out the line lengths above it. */
.final .section-lede {
  text-wrap: balance;
}

/* Footer ---------------------------------------------------------------- */

.foot {
  border-top: 1px solid var(--line-2);
  padding: 28px 0;
  font-size: 16px;
  color: var(--tx-2);
}

.foot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-small {
  font-weight: 500;
  color: var(--tx);
}

.foot-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.foot-nav a {
  text-decoration: none;
}

.foot-nav a:hover {
  color: var(--tx);
}

/* Docs ------------------------------------------------------------------ */

.doc {
  max-width: 760px;
  padding-top: 56px;
  padding-bottom: 88px;
}

.doc h1 {
  font-size: clamp(32px, 5vw, 44px);
}

.doc h2 {
  font-size: 24px;
  margin: 48px 0 0;
  scroll-margin-top: 24px;
}

.doc p,
.doc ul {
  margin: 12px 0 0;
}

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

/* A multi-line block scrolls sideways, so YAML indentation and lined-up
   columns survive: a wrapped line would restart at the left edge. A one-line
   snippet (a URL, a Markdown embed, a command) has no layout to keep, so it
   wraps and stays on a phone's screen. */
.doc .code {
  margin-top: 12px;
  white-space: pre;
}

.doc .code-wrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.doc table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 15px;
}

.doc th,
.doc td {
  text-align: left;
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.doc th {
  font-weight: 500;
  color: var(--tx-2);
}

/* Every table sits in one of these, so a wide table scrolls inside its own
   box on a phone instead of widening the page. The wrapper scrolls, not the
   table: display: block on a <table> can cost it its table semantics in a
   screen reader. role="region", tabindex="0" and an aria-label in the HTML
   let a keyboard user focus the box and scroll it with the arrow keys. */
.table-scroll {
  margin-top: 16px;
  overflow-x: auto;
}

.table-scroll > table {
  margin-top: 0;
}

.doc-crumb {
  margin: 0 0 12px;
  color: var(--tx-2);
}

.doc-crumb a {
  text-decoration: none;
}

.doc-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 28px;
  padding: 16px 0;
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
  font-size: 14px;
  color: var(--tx-2);
}

.doc-toc a {
  text-decoration: none;
}

.doc-toc a:hover {
  color: var(--tx);
}

.doc-rule {
  padding: 14px 16px;
  border: 1px solid var(--green-line);
  border-radius: 8px;
  background: var(--green-bg);
  font-weight: 500;
}

.doc-list {
  list-style: none;
  padding: 0;
  margin-top: 32px;
}

.doc-list li {
  padding: 20px 0;
  border-top: 1px solid var(--line-2);
}

.doc-list a {
  font-size: 20px;
  font-weight: 600;
}

.doc-list p {
  margin: 6px 0 0;
  color: var(--tx-2);
}

/* Guides ---------------------------------------------------------------
   A guide is the full header width, so its left edge is the logo's edge. The
   reading column stays 760px, left-aligned under the logo rather than a
   centred block that sits off the header grid. :where() keeps this
   max-width at zero specificity, so .section-lede's 62ch still wins.
   Copy is 16px (lede, description, body) and 15px (TOC, crumb, inline code),
   in the same --tx-2 the reading-type test holds to AA. Code listings keep
   their own 13px: they scroll and are not running copy. */

.doc.guide {
  max-width: 1120px;
}

:where(.doc.guide) > * {
  max-width: 760px;
}

.doc.guide .section-lede {
  font-size: 16px;
}

.doc.guide .doc-crumb,
.doc.guide .doc-toc,
.doc.guide .mono:not(.code) {
  font-size: 15px;
}

/* Docs pages share the marketing header, then a sidebar of every doc.
   The article keeps .doc; the shell is what makes room for the list. */

.docs-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  column-gap: 48px;
  align-items: start;
  padding-top: 32px;
  padding-bottom: 88px;
}

.docs-layout > .doc {
  max-width: none;
  min-width: 0;
  padding-top: 8px;
  padding-bottom: 0;
}

/* The list is about 870px tall at 15px. It has no scroll box of its own: a box
   shorter than the list hid the open page's highlight below its fold, and
   with no script nothing scrolls it into view. It stays put only on a window
   tall enough to show all of it; elsewhere it scrolls with the page. */
.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px 8px 0;
  font-size: 15px;
  line-height: 1.4;
}

.docs-nav-label {
  margin: 16px 0 4px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  /* --tx-3 is about 3.4:1 on white. Group labels are text, so they use
     the same secondary colour as the links. */
  color: var(--tx-2);
}

.docs-nav a {
  display: block;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--tx-2);
  text-decoration: none;
}

.docs-nav a:hover {
  color: var(--tx);
  background: var(--panel-2);
}

.docs-nav a[aria-current="page"] {
  color: var(--tx);
  background: var(--panel-2);
  font-weight: 500;
  box-shadow: inset 2px 0 0 var(--tx);
}

@media (min-width: 901px) and (min-height: 980px) {
  .docs-nav {
    position: sticky;
    top: 80px;
  }
}

/* One column: the article comes first and the full list follows it, so a
   phone opens on the page it asked for. The skip link and the DOM order are
   unchanged. */
@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 32px;
  }

  .docs-nav {
    order: 2;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    padding: 8px;
    background: var(--panel);
  }
}

/* 404 ------------------------------------------------------------------- */

/* The body is a column: header, the message filling the space, footer.
   dvh, where supported, leaves out the phone browser's own bars, so the
   footer is on screen at first paint. */
.page-404 {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* main.notfound, not .notfound: the narrow-screen `.wrap { padding: 0 16px }`
   comes later and would otherwise reset the vertical padding to 0. */
main.notfound {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-top: 64px;
  padding-bottom: 64px;
}

.notfound h1 {
  font-size: clamp(32px, 5vw, 48px);
}

/* Narrow screens -------------------------------------------------------- */

@media (max-width: 900px) {
  .steps,
  .grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .split,
  .agents {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
}

@media (max-width: 640px) {
  .wrap {
    padding: 0 16px;
  }
  /* The bar used to drop every link but Sign in, and the frosted background
     (translucent colour plus backdrop-filter) smeared whatever sat under it.
     A solid bar, and the same links in a solid drawer, leaves nothing blurred
     behind the header. Above 640px the earlier rules still draw the desktop row. */
  .top {
    background: var(--bg);
    backdrop-filter: none;
  }

  .nav {
    gap: 8px;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--tx);
    cursor: pointer;
    appearance: none;
  }

  .nav-toggle-bars,
  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    position: relative;
  }

  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    content: '';
    position: absolute;
    left: 0;
  }

  .nav-toggle-bars::before {
    top: -5px;
  }

  .nav-toggle-bars::after {
    top: 5px;
  }

  .nav-toggle[aria-expanded='true'] .nav-toggle-bars {
    background: transparent;
  }

  .nav-toggle[aria-expanded='true'] .nav-toggle-bars::before {
    top: 0;
    transform: rotate(45deg);
  }

  .nav-toggle[aria-expanded='true'] .nav-toggle-bars::after {
    top: 0;
    transform: rotate(-45deg);
  }

  .nav-panel {
    display: none;
  }

  .nav-toggle[aria-expanded='true'] + .nav-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1;
    margin: 0;
    padding: 8px 16px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--line-2);
    box-shadow: var(--shadow);
  }

  .nav-toggle[aria-expanded='true'] + .nav-panel a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 8px;
    color: var(--tx);
  }

  .hero {
    padding: 64px 0 40px;
  }
  .section,
  .final {
    padding: 64px 0;
  }
}
