/* Sess public pages: one design system for sess.si and docs.sess.si.
   System fonts only; no remote assets. Light and dark themes: the default follows
   prefers-color-scheme without JavaScript; site.js may set html[data-theme] from a stored choice.
   Every text/background pair meets WCAG 2.2 AA in both themes. No animation. */

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

/* The Sess token roles (packages/design-tokens src/roles.ts, D-L4): every name below that the
   token build declares carries exactly its token value here, in the light block and in both dark
   blocks (packages/design-tokens/test/surfaces.test.ts). Values that reference Open Props are
   written resolved (Open Props 1.7.23, MIT, packages/design-tokens/vendor/open-props). The
   site-only properties after them are layout widths and the colours no role covers yet (the
   draft and planned cue, the PUT/PATCH badge and the hero mark). */

:root {
  /* Scale roles */
  --font: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --type-xs: 0.8125rem;
  --type-sm: 0.875rem;
  --type-md: 0.9375rem;
  --type-base: 1rem;
  --type-lg: 1.125rem;
  --type-xl: 1.5rem;
  --type-2xl: 1.75rem;
  --type-display: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);
  --type-hero: clamp(2.5rem, 1.5rem + 4.2vw, 4.25rem);
  --weight-regular: 400;
  --weight-strong: 600;
  --weight-heading: 650;
  --leading-body: 1.55;
  --leading-heading: 1.25;
  --leading-subheading: 1.35;
  --leading-control: 1.2;
  --tracking-heading: -0.01em;
  --space-2: 0.25rem;
  --space-3: 0.375rem;
  --space-4: 0.5rem;
  --space-5: 0.625rem;
  --space-6: 0.75rem;
  --space-8: 1rem;
  --space-10: 1.25rem;
  --space-12: 1.5rem;
  --space-14: 1.75rem;
  --space-16: 2rem;
  --space-20: 2.5rem;
  --space-24: 3rem;
  --space-32: 4rem;
  --space-48: 6rem;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --border-width: 1px;
  --edge-width: 4px;
  --focus-width: 3px;
  --focus-offset: 2px;
  --control-height: 2.75rem;

  /* Colour roles: light */
  --canvas: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #f6f6f7;
  --text: #111113;
  --text-2: #3c3d42;
  --muted: #5d5f66;
  --border: #e6e6e9;
  --control: #7c7e86;
  --accent: #0b5cd5;
  --accent-soft: #eef4fe;
  --action: #111113;
  --on-action: #ffffff;
  --focus: #0b5cd5;
  --danger: #9b1c1c;
  --danger-soft: #fdeded;
  --success: #0b5a2f;
  --success-soft: #e9f6ee;

  /* Site only: layout */
  --header-h: 3.5rem;
  --measure: 44rem;
  --site-max: 72rem;
  --docs-max: 90rem;

  /* Site only: light colours */
  --hero-mark: #cfcfd4;
  --draft-bg: #fff7e2;
  --draft-line: #c99a1b;
  --draft-ink: #5c4000;
  --put-bg: #fff3e1;
  --put-ink: #774100;
  color-scheme: light;
}

/* Dark theme: by system preference unless the reader chose light, or by explicit choice. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0c0c0d;
    --surface: #151517;
    --surface-2: #1b1b1e;
    --text: #ededee;
    --text-2: #cfd0d4;
    --muted: #a3a5ab;
    --border: #26262a;
    --control: #75777f;
    --accent: #7cb0ff;
    --accent-soft: #14213a;
    --action: #ededee;
    --on-action: #0c0c0d;
    --focus: #7cb0ff;
    --danger: #ffa3a3;
    --danger-soft: #341616;
    --success: #86dba6;
    --success-soft: #0f2a1a;
    --hero-mark: #4b4c53;
    --draft-bg: #2a2310;
    --draft-line: #a68629;
    --draft-ink: #f2d892;
    --put-bg: #2f2511;
    --put-ink: #f1c477;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --canvas: #0c0c0d;
  --surface: #151517;
  --surface-2: #1b1b1e;
  --text: #ededee;
  --text-2: #cfd0d4;
  --muted: #a3a5ab;
  --border: #26262a;
  --control: #75777f;
  --accent: #7cb0ff;
  --accent-soft: #14213a;
  --action: #ededee;
  --on-action: #0c0c0d;
  --focus: #7cb0ff;
  --danger: #ffa3a3;
  --danger-soft: #341616;
  --success: #86dba6;
  --success-soft: #0f2a1a;
  --hero-mark: #4b4c53;
  --draft-bg: #2a2310;
  --draft-line: #a68629;
  --draft-ink: #f2d892;
  --put-bg: #2f2511;
  --put-ink: #f1c477;
  color-scheme: dark;
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--surface);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--type-base);
  line-height: 1.65;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* A long unbroken word (an identifier in prose) wraps instead of widening the page. */
  overflow-wrap: break-word;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

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

main:focus {
  outline: none;
}

/* Anchored targets clear the sticky header. */
[id] {
  scroll-margin-top: calc(var(--header-h) + var(--space-8));
}

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

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

.skip-link {
  position: absolute;
  left: var(--space-6);
  top: -10rem;
  z-index: 50;
  padding: var(--space-4) var(--space-8);
  background: var(--action);
  color: var(--on-action);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: var(--space-6);
}

code,
pre,
kbd {
  font-family: var(--mono);
}

:not(pre) > code {
  padding: 0.1em 0.35em;
  font-size: 0.875em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow-wrap: break-word;
}

/* Short tokens in tables stay on one line (the table region scrolls if it must). */
td code {
  white-space: nowrap;
}

[hidden] {
  display: none;
}

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4) var(--space-12);
  max-width: var(--docs-max);
  min-height: var(--header-h);
  margin: 0 auto;
  padding: var(--space-4) var(--space-12);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
}

.brand-word {
  height: 0.9375rem;
  width: auto;
  aspect-ratio: 958 / 152;
}

.primary-nav {
  flex: 1;
}

.primary-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-12);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--type-sm);
}

.primary-nav a {
  color: var(--muted);
  text-decoration: none;
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  color: var(--text);
}

.primary-nav .nav-search {
  margin-left: auto;
}

.search-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  min-width: 9rem;
}

.icon {
  width: 0.875rem;
  height: 0.875rem;
}

.primary-nav a.button-primary {
  color: var(--on-action);
}

.theme-slot:empty {
  display: none;
}

.theme-toggle {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: var(--type-sm);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text);
}

/* ------------------------------------------------------------------ buttons and badges */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: var(--type-sm);
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}

.button-primary {
  background: var(--action);
  color: var(--on-action);
}

.button-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--control);
}

.button-secondary:hover {
  border-color: var(--text);
}

.button-lg {
  padding: 0.7rem 1.3rem;
  font-size: var(--type-base);
}

.draft-badge,
.planned-badge {
  display: inline-block;
  padding: 0 0.45em;
  border: 1px solid var(--draft-line);
  border-radius: 5px;
  background: var(--draft-bg);
  color: var(--draft-ink);
  font-size: var(--type-xs);
  font-weight: 600;
  line-height: 1.6;
  white-space: normal;
}

.draft {
  margin: var(--space-12) 0;
  padding: var(--space-8) var(--space-8) var(--space-8) var(--space-12);
  border: 1px solid var(--border);
  border-left: 3px solid var(--draft-line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.draft > :last-child {
  margin-bottom: 0;
}

.draft .draft-label {
  margin-top: 0;
  color: var(--draft-ink);
}

.callout {
  margin: var(--space-12) 0;
  padding: var(--space-8) var(--space-12);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.callout > :first-child {
  margin-top: 0;
}

.callout > :last-child {
  margin-bottom: 0;
}

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

.site-footer {
  margin-top: var(--space-48);
  border-top: 1px solid var(--border);
  padding: var(--space-24) var(--space-12) var(--space-16);
  font-size: var(--type-sm);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(10rem, 16rem) 1fr;
  gap: var(--space-16);
  max-width: var(--site-max);
  margin: 0 auto;
}

.footer-brand {
  color: var(--text);
}

.footer-logo {
  width: 3.5rem;
  height: auto;
  aspect-ratio: 974 / 1080;
}

.footer-brand p {
  margin: var(--space-6) 0 0;
  color: var(--muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: var(--space-12);
}

.footer-grid h2 {
  margin: 0 0 var(--space-4);
  font-size: var(--type-sm);
  font-weight: 600;
  color: var(--text);
}

.footer-grid ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-grid li {
  margin: 0.35rem 0;
  color: var(--muted);
}

/* In the footer a draft is a quiet note, not a highlighted block. */
.footer-grid .draft-badge {
  display: block;
  margin-top: 0.1rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.4;
}

/* The sidebar's "API key" cue on guides that need one (draft until accounts ship). */
.nav-note {
  margin-left: 0.35rem;
  padding: 0 0.35rem;
  border: 1px solid var(--control);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 500;
  white-space: nowrap;
}

.footer-grid a {
  color: var(--muted);
  text-decoration: none;
}

.footer-grid a:hover {
  color: var(--text);
  text-decoration: underline;
}

.fine-print {
  max-width: var(--site-max);
  margin: var(--space-16) auto 0;
  padding-top: var(--space-12);
  border-top: 1px solid var(--border);
  color: var(--muted);
}

@media (max-width: 40rem) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------ product page */

.site-main {
  display: block;
}

.section {
  max-width: var(--site-max);
  margin: 0 auto;
  padding: var(--space-32) var(--space-12);
}

/* A full-width tinted band whose content lines up with the other sections. */
.band {
  max-width: none;
  padding-inline: max(var(--space-12), calc((100% - var(--site-max)) / 2 + var(--space-12)));
  background: var(--canvas);
  border-block: 1px solid var(--border);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding-top: var(--space-48);
  padding-bottom: var(--space-32);
}

.hero > * {
  grid-column: 1;
}

.hero-mark {
  display: none;
}

@media (min-width: 60rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 15rem;
    column-gap: var(--space-32);
  }

  .hero-mark {
    display: block;
    grid-column: 2;
    grid-row: 1 / span 5;
    align-self: center;
    width: 15rem;
    height: 15rem;
    color: var(--hero-mark);
  }
}

.eyebrow {
  margin: 0 0 var(--space-8);
  font-size: var(--type-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.hero h1 {
  max-width: 16em;
  margin: 0 0 var(--space-12);
  font-family: var(--font);
  font-size: var(--type-hero);
  font-weight: 650;
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  max-width: var(--measure);
  margin: 0;
  font-size: var(--type-lg);
  line-height: 1.55;
  color: var(--text-2);
}

.supporting {
  margin: var(--space-8) 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin: var(--space-16) 0 0;
}

.actions .button {
  max-width: 100%;
  padding: 0.7rem 1.3rem;
  font-size: var(--type-base);
  /* A one-word label wider than a phone with enlarged text wraps inside its button. */
  overflow-wrap: anywhere;
}

.section h2 {
  margin: 0 0 var(--space-12);
  font-family: var(--font);
  font-size: var(--type-display);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: var(--space-8);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  counter-increment: step;
  padding: var(--space-12);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.steps > li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: var(--space-6);
  font-family: var(--mono);
  font-size: var(--type-sm);
  color: var(--muted);
}

.steps h3,
.card h3 {
  margin: 0 0 var(--space-4);
  font-size: var(--type-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.steps p,
.card p {
  margin: var(--space-4) 0;
  color: var(--text-2);
}

/* Card and step tracks never ask for more than the row has (min(100%, …)), so enlarged text on a
   narrow screen stacks them instead of scrolling the page sideways. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: var(--space-8);
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  padding: var(--space-12);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.card ul {
  margin: var(--space-4) 0 0;
  padding-left: 1.1rem;
  color: var(--text-2);
}

.card li + li {
  margin-top: var(--space-4);
}

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

/* A card's heading link. :where() keeps it at the specificity of the other link rules (one class,
   one element), so later link rules never sit below it in specificity. */
.card :where(h3) a {
  color: var(--text);
  text-decoration: none;
}

.card :where(h3) a:hover {
  text-decoration: underline;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: var(--space-16) var(--space-24);
  align-items: start;
}

.two-col ol {
  padding-left: 1.2rem;
  color: var(--text-2);
}

.planned {
  margin: var(--space-16) 0 0;
  color: var(--muted);
}

.section-lede {
  max-width: var(--measure);
  margin: 0;
  font-size: var(--type-lg);
  color: var(--text-2);
}

/* The four demos: two by two on wide screens, one column on phones. */
.demo-cards {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
}

.card .status {
  margin: var(--space-6) 0 var(--space-4);
}

.card .note {
  font-size: var(--type-sm);
  color: var(--muted);
}

/* "How it works" and other advanced detail, one click away (details/summary, no script). */
.advanced {
  margin: var(--space-8) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.advanced > summary {
  min-height: var(--control-height);
  padding: var(--space-6) var(--space-8);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.advanced:where([open]) > summary {
  border-bottom: 1px solid var(--border);
}

.advanced > :not(summary) {
  margin: var(--space-8);
}

/* ------------------------------------------------------------------ docs layout */

.docs-layout {
  max-width: var(--docs-max);
  margin: 0 auto;
  padding: 0 var(--space-12);
}

.docs-nav {
  margin: var(--space-8) 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.docs-nav > summary {
  padding: var(--space-6) var(--space-8);
  font-size: var(--type-sm);
  font-weight: 600;
  cursor: pointer;
}

.docs-nav nav {
  padding: 0 var(--space-8) var(--space-8);
}

.docs-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-nav ul ul {
  margin: var(--space-2) 0 var(--space-12);
}

.docs-nav a {
  display: block;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: var(--type-sm);
  color: var(--muted);
  text-decoration: none;
}

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

.docs-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
  font-weight: 600;
}

.nav-group {
  display: block;
  margin: var(--space-8) 0 var(--space-2);
  padding: 0 0.6rem;
  font-size: var(--type-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs-main {
  display: block;
  min-width: 0;
  padding: var(--space-16) 0 0;
}

.docs-toc {
  display: none;
}

@media (min-width: 60rem) {
  .docs-layout {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: var(--space-24);
  }

  .docs-nav {
    position: sticky;
    top: var(--header-h);
    align-self: start;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    margin: 0;
    padding: var(--space-12) 0;
    border: 0;
    border-radius: 0;
  }

  .docs-nav[open] > summary {
    display: none;
  }

  .docs-nav nav {
    padding: 0;
  }

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

@media (min-width: 80rem) {
  .docs-layout {
    grid-template-columns: 15rem minmax(0, 1fr) 13rem;
  }

  .docs-toc {
    display: block;
    position: sticky;
    top: var(--header-h);
    align-self: start;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: var(--space-16) 0;
  }

  .toc-inline {
    display: none;
  }
}

.page-toc {
  font-size: var(--type-sm);
}

.toc-title {
  margin: 0 0 var(--space-4);
  font-size: var(--type-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.toc-list a {
  display: block;
  padding: 0.2rem 0 0.2rem var(--space-6);
  border-left: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
}

.toc-list a:hover {
  color: var(--text);
  border-left-color: var(--text);
}

.toc-inline {
  margin: var(--space-12) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--type-sm);
}

.toc-inline > summary {
  padding: var(--space-6) var(--space-8);
  font-weight: 600;
  cursor: pointer;
}

.toc-inline nav {
  padding: 0 var(--space-8) var(--space-8);
}

/* Set by theme.js before first paint on narrow screens: the docs menu stays collapsed until
   site.js (or theme.js's DOMContentLoaded fallback) closes the details element, which is open
   by default for readers without JS. */
.docs-nav-pending .docs-nav > nav {
  display: none;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin: 0 0 var(--space-8);
  padding: 0;
  list-style: none;
  font-size: var(--type-sm);
  color: var(--muted);
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: var(--space-4);
  color: var(--control);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--text);
  text-decoration: underline;
}

.breadcrumbs [aria-current="page"] {
  color: var(--text);
}

.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-8);
  max-width: var(--measure);
  margin: var(--space-32) 0 0;
  padding-top: var(--space-12);
  border-top: 1px solid var(--border);
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: var(--space-8);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
}

.pager a:hover {
  border-color: var(--control);
}

.pager-next {
  text-align: right;
  grid-column: 2;
}

.pager-label {
  font-size: var(--type-xs);
  color: var(--muted);
}

.pager-title {
  color: var(--text);
  font-weight: 600;
}

/* Phones: previous and next stack, so a long title or enlarged text never widens the page. */
@media (max-width: 30rem) {
  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager-next {
    grid-column: 1;
  }
}

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

.prose {
  max-width: var(--measure);
  color: var(--text-2);
}

.prose-wide {
  max-width: 68rem;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose strong {
  color: var(--text);
}

.prose h1 {
  margin: 0 0 var(--space-8);
  font-family: var(--font);
  font-size: var(--type-display);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.prose h2 {
  margin: var(--space-24) 0 var(--space-6);
  font-size: var(--type-xl);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  scroll-margin-top: calc(var(--header-h) + var(--space-8));
}

.prose h3 {
  margin: var(--space-16) 0 var(--space-4);
  font-size: var(--type-lg);
  font-weight: 600;
  scroll-margin-top: calc(var(--header-h) + var(--space-8));
}

.prose h4 {
  margin: var(--space-12) 0 var(--space-4);
  font-size: var(--type-base);
  font-weight: 600;
  scroll-margin-top: calc(var(--header-h) + var(--space-8));
}

.heading-link {
  color: inherit;
  text-decoration: none;
}

.heading-link:hover {
  text-decoration: underline;
  text-decoration-color: var(--control);
}

.prose .lede {
  font-size: var(--type-lg);
  color: var(--muted);
}

.prose li + li {
  margin-top: var(--space-2);
}

.prose table,
.section table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--type-sm);
}

caption {
  padding-bottom: var(--space-4);
  text-align: left;
  font-weight: 600;
  color: var(--text);
}

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

th {
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: var(--space-8) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.table-wrap table {
  margin: 0;
}

.table-wrap caption {
  padding: var(--space-6) 0.75rem var(--space-4);
}

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

figure.code {
  position: relative;
  margin: var(--space-8) 0;
}

figure.code figcaption {
  min-height: 1.6rem;
  padding: 0 4.5rem var(--space-2) 0;
  font-size: var(--type-xs);
  font-weight: 600;
  color: var(--muted);
}

pre {
  margin: var(--space-4) 0 var(--space-8);
  padding: var(--space-8);
  overflow-x: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.8125rem;
  line-height: 1.6;
  tab-size: 2;
}

/* Sits on the caption row, at the right, above the code block. */
.copy-button {
  position: absolute;
  top: -0.2rem;
  right: 0;
  z-index: 1;
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: var(--type-xs);
  cursor: pointer;
}

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

dl.facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin: var(--space-8) 0;
}

dl.facts > div {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr);
  gap: var(--space-6);
}

dl.facts dt {
  font-weight: 600;
  color: var(--text);
}

dl.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 30rem) {
  dl.facts > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

/* ------------------------------------------------------------------ language tabs */

.tabs {
  margin: var(--space-8) 0;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
}

.tab {
  position: relative;
  display: inline-block;
  padding: var(--space-4) var(--space-6);
  border-bottom: 2px solid transparent;
  font-size: var(--type-sm);
  color: var(--muted);
  cursor: pointer;
}

/* The radio covers its label: visible, clickable and focusable, with no appearance of its own. */
.tab input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.tab input:focus-visible {
  outline: none;
}

.tab:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

.tab:has(input:checked) {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 600;
}

.tab-panel {
  display: none;
}

/* Up to twelve tabs (build.ts MAX_LABELLED_TABS); the legend is the tab list's first child. */
.tabs:has(.tab:nth-child(2) input:checked) .tab-panel:nth-child(1),
.tabs:has(.tab:nth-child(3) input:checked) .tab-panel:nth-child(2),
.tabs:has(.tab:nth-child(4) input:checked) .tab-panel:nth-child(3),
.tabs:has(.tab:nth-child(5) input:checked) .tab-panel:nth-child(4),
.tabs:has(.tab:nth-child(6) input:checked) .tab-panel:nth-child(5),
.tabs:has(.tab:nth-child(7) input:checked) .tab-panel:nth-child(6),
.tabs:has(.tab:nth-child(8) input:checked) .tab-panel:nth-child(7),
.tabs:has(.tab:nth-child(9) input:checked) .tab-panel:nth-child(8),
.tabs:has(.tab:nth-child(10) input:checked) .tab-panel:nth-child(9),
.tabs:has(.tab:nth-child(11) input:checked) .tab-panel:nth-child(10),
.tabs:has(.tab:nth-child(12) input:checked) .tab-panel:nth-child(11),
.tabs:has(.tab:nth-child(13) input:checked) .tab-panel:nth-child(12) {
  display: block;
}

@supports not selector(:has(*)) {
  .tab-panel {
    display: block;
  }
}

/* ------------------------------------------------------------------ add Sess to your agent */

/* One status per host, from the dated host matrix (apps/site/src/hosts.ts). "Not yet available"
   uses the draft colours; the other statuses are quiet outlined labels. */
.status-badge {
  display: inline-block;
  padding: 0 0.45em;
  border: 1px solid var(--control);
  border-radius: 5px;
  color: var(--text);
  font-size: var(--type-xs);
  font-weight: 600;
  line-height: 1.6;
}

.status-badge[data-status="not-yet-available"] {
  border-color: var(--draft-line);
  background: var(--draft-bg);
  color: var(--draft-ink);
}

.host-status {
  margin: var(--space-8) 0;
  color: var(--text-2);
}

.host-steps {
  display: grid;
  /* minmax(0, …): a long command scrolls inside its code block, never the page. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  padding-left: 1.2rem;
}

.host-note {
  color: var(--muted);
  font-size: var(--type-sm);
}

/* ------------------------------------------------------------------ API reference */

/* Long paths may break at any character on narrow screens; the badge column stays fixed. */
.op-list code {
  min-width: 0;
  background: none;
  border: 0;
  padding: 0;
  overflow-wrap: anywhere;
}

.operation,
.schema {
  margin: var(--space-24) 0;
  padding-top: var(--space-16);
  border-top: 1px solid var(--border);
}

.operation h3,
.schema h3 {
  margin-top: 0;
  font-size: var(--type-lg);
  overflow-wrap: anywhere;
}

.operation h3 code,
.schema h3 code {
  font-size: 0.95em;
  background: none;
  border: 0;
  padding: 0;
}

.operation-id {
  margin-top: 0;
  font-size: var(--type-sm);
  color: var(--muted);
}

.op-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4) var(--space-16);
}

.op-details,
.op-examples {
  min-width: 0;
}

/* Examples wrap long JSON lines rather than scrolling sideways. */
.op-examples pre {
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

@media (min-width: 100rem) {
  .op-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .op-grid-single {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Sticky beside the details, scrolling on its own so every response example is reachable. */
  .op-examples {
    position: sticky;
    top: calc(var(--header-h) + var(--space-8));
    align-self: start;
    max-height: calc(100vh - var(--header-h) - var(--space-16));
    overflow-y: auto;
    padding-right: var(--space-2);
  }
}

.method {
  display: inline-block;
  min-width: 3.6em;
  margin-right: 0.35em;
  padding: 0.05em 0.45em;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  vertical-align: 0.15em;
  background: var(--surface-2);
  color: var(--text);
}

.method-get {
  background: var(--success-soft);
  color: var(--success);
}

.method-post {
  background: var(--accent-soft);
  color: var(--accent);
}

.method-patch,
.method-put {
  background: var(--put-bg);
  color: var(--put-ink);
}

.method-delete {
  background: var(--danger-soft);
  color: var(--danger);
}

/* The operation index: one column, fixed-width method badges, paths aligned. */
.op-list {
  margin: var(--space-8) 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.op-list li + li {
  margin: 0;
  border-top: 1px solid var(--border);
}

.op-list a {
  display: flex;
  align-items: baseline;
  gap: var(--space-6);
  padding: 0.45rem var(--space-8);
  color: var(--text);
  text-decoration: none;
}

.op-list a:hover {
  background: var(--surface-2);
}

.op-list .method {
  flex: none;
  width: 6.5ch;
  min-width: 0;
  margin: 0;
}

.op-list a:hover code {
  text-decoration: underline;
}

.props {
  margin: var(--space-4) 0;
  padding: 0;
  list-style: none;
}

.props > .prop {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}

.prop-head {
  margin: 0;
}

.prop-name {
  font-weight: 600;
  color: var(--text);
}

.prop-type {
  font-size: var(--type-sm);
  color: var(--muted);
}

.prop p {
  margin: 0.2rem 0;
  font-size: var(--type-sm);
}

.req,
.opt {
  font-size: var(--type-xs);
  font-weight: 600;
}

.req {
  color: var(--danger);
}

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

.constraints,
.schema-type {
  margin: 0.25rem 0;
  font-size: var(--type-sm);
  color: var(--muted);
}

.nested {
  margin: var(--space-4) 0 0 0.2rem;
  padding-left: var(--space-8);
  border-left: 1px solid var(--border);
}

.body-schema {
  margin: var(--space-4) 0 var(--space-8);
}

.hash {
  overflow-wrap: anywhere;
}

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

.search-list {
  padding-left: 1.1rem;
}

.search-list p {
  margin: 0.1rem 0 var(--space-4);
  color: var(--muted);
  font-size: var(--type-sm);
}

[data-search-mount] label {
  display: block;
  font-weight: 600;
  color: var(--text);
}

[data-search-mount] input {
  width: 100%;
  max-width: 28rem;
  margin: var(--space-4) 0;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--control);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

/* ------------------------------------------------------------------ small screens */

@media (max-width: 59.99rem) {
  /* The header scrolls away on narrow screens, and the navigation takes its own row. */
  .site-header {
    position: static;
  }

  /* Two rows at most: logo and theme, then one horizontally scrollable row of links (no visible
     scrollbar; every link stays reachable by swipe and by Tab). */
  .primary-nav {
    flex-basis: 100%;
    order: 3;
    min-width: 0;
  }

  .primary-nav ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
    padding: 4px;
  }

  .primary-nav ul::-webkit-scrollbar {
    display: none;
  }

  .primary-nav li {
    flex: none;
  }

  .theme-slot {
    margin-left: auto;
  }
}

@media (max-width: 40rem) {
  .bar {
    padding: var(--space-4) var(--space-8);
  }

  .primary-nav ul {
    gap: var(--space-2) var(--space-8);
  }

  .primary-nav .nav-search {
    margin-left: 0;
  }

  .search-link {
    min-width: 0;
  }

  .section {
    padding: var(--space-24) var(--space-8);
  }

  .hero {
    padding-top: var(--space-24);
  }

  .docs-layout {
    padding: 0 var(--space-8);
  }
}
