/*
 * ThreadPort site. One idea carries the page: a thread that leaves one agent's terminal and enters the next.
 * Everything else stays quiet: cool paper, navy ink, a teal thread, amber only where the thread touches a port.
 */
:root {
  --paper: #f0f2f4;
  --surface: #ffffff;
  --sunken: #e3e7ec;
  --ink: #172033;
  --muted: #56627a;
  --line: #cdd3dc;
  --thread: #0b6b74;
  --thread-soft: #d3ecee;
  --port: #8a5200;
  --port-dot: #f0a202;
  /* The logo's two ends: where the thread leaves one agent and where it arrives. */
  --thread-start: #1fa3a3;
  --thread-end: #845ef7;
  --fail: #b43f16;
  --ok: #1d7a46;
  --term-bg: #172033;
  --term-ink: #dfe6f0;
  --term-muted: #93a1b8;
  --term-fail: #ff9a76;
  --term-ok: #7fd6a3;
  --term-prompt: #3fc1c9;

  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-code: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Menlo, monospace;

  /* 4px spacing scale */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4rem;
  --s9: 6rem;

  /* Radii follow hierarchy: windows are softest, controls tighter, inline code tightest. */
  --r-window: 10px;
  --r-control: 6px;
  --r-inline: 3px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0f1622;
    --surface: #162031;
    --sunken: #1c2940;
    --ink: #e6eaf0;
    --muted: #a3afc2;
    --line: #2a3547;
    --thread: #3fc1c9;
    --thread-soft: #173a44;
    --port: #f5b83d;
    --port-dot: #f5b83d;
    --thread-start: #3ecfcf;
    --thread-end: #9b7bff;
    --fail: #ff9a76;
    --ok: #7fd6a3;
    --term-bg: #0a101a;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --paper: #0f1622;
  --surface: #162031;
  --sunken: #1c2940;
  --ink: #e6eaf0;
  --muted: #a3afc2;
  --line: #2a3547;
  --thread: #3fc1c9;
  --thread-soft: #173a44;
  --port: #f5b83d;
  --port-dot: #f5b83d;
  --thread-start: #3ecfcf;
  --thread-end: #9b7bff;
  --fail: #ff9a76;
  --ok: #7fd6a3;
  --term-bg: #0a101a;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--s8);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font-body);
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

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

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

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

code,
kbd,
pre {
  font-family: var(--font-code);
  font-size: 0.875em;
}

:not(pre) > code {
  background: var(--sunken);
  padding: 0.1em 0.35em;
  border-radius: var(--r-inline);
}

kbd {
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--r-inline);
  padding: 0 0.35em;
  background: var(--surface);
}

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

.skip-link {
  position: absolute;
  left: var(--s4);
  top: -3rem;
  background: var(--ink);
  color: var(--paper);
  padding: var(--s2) var(--s4);
  border-radius: var(--r-control);
  z-index: 10;
}

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

.shell {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  gap: var(--s5);
  min-height: 3.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--ink);
  font: 700 1.125rem/1 var(--font-display);
  text-decoration: none;
}

.brand-mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
}

/* The logo has its own dark tile; a hairline keeps its edge visible on the dark theme. */
.brand-mark,
.vscode-heading img {
  box-shadow: 0 0 0 1px var(--line);
}

.nav-links {
  display: flex;
  gap: var(--s5);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
}

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

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font: 600 0.8125rem/1 var(--font-body);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--muted);
}

.icon-button svg {
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}

.icon-sun,
[data-theme-active='dark'] .icon-moon {
  display: none;
}

[data-theme-active='dark'] .icon-sun {
  display: block;
}

/* GitHub pill: the mark and the live star count, as on GitHub's own buttons. */
.github-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  height: 2.25rem;
  padding: 0 var(--s4) 0 var(--s2);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 500 1rem/1 var(--font-body);
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.github-link:hover {
  background: var(--ink);
  color: var(--surface);
}

.github-mark {
  width: 1.5rem;
  height: 1.5rem;
  fill: currentColor;
  flex: none;
}

.star-count {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.menu-button {
  display: none;
}

.version-pill {
  text-decoration: none;
  padding: 0 var(--s2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font: 500 0.75rem/1.6 var(--font-code);
  color: var(--muted);
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: var(--s7);
  align-items: center;
  padding-block: var(--s9) var(--s8);
}

.hero h1 {
  font-size: clamp(2.5rem, 1.6rem + 4vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variation-settings: 'opsz' 96;
}

.lede {
  margin-top: var(--s5);
  max-width: 34rem;
  font-size: 1.1875rem;
  color: var(--muted);
}

.install {
  margin-top: var(--s6);
}

.install-label {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: var(--s2);
}

.install-box {
  display: flex;
  align-items: center;
  gap: var(--s3);
  max-width: 26rem;
  padding: var(--s2) var(--s2) var(--s2) var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
}

.install-box code {
  flex: 1;
  background: none;
  padding: 0;
  font-size: 0.9375rem;
  overflow-x: auto;
  white-space: nowrap;
}

.copy-button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0 var(--s4);
  border-radius: var(--r-control);
  border: 0;
  background: var(--ink);
  color: var(--paper);
  font: 600 0.875rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
}

.copy-button:hover,
.button:hover {
  background: var(--thread);
  color: var(--surface);
}

.copy-button[data-copied] {
  background: var(--ok);
  color: var(--surface);
}

.availability {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
  margin: var(--s5) 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  font-weight: 500;
}

.availability li,
.status-line {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}

.status {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  flex: none;
}

/* Shape differs as well as color, so status never depends on color alone. */
.status-live {
  background: var(--ok);
}

.status-soon {
  border: 2px solid var(--port-dot);
  background: transparent;
}

/* Handoff demo: the page's one orchestrated moment */
.handoff-demo {
  margin: 0;
  display: grid;
}

.terminal {
  background: var(--term-bg);
  color: var(--term-ink);
  border-radius: var(--r-window);
  overflow: hidden;
  box-shadow: 0 1px 0 var(--line);
}

.terminal-from {
  width: 88%;
}

.terminal-to {
  width: 88%;
  justify-self: end;
}

.terminal-bar {
  display: flex;
  justify-content: space-between;
  padding: var(--s2) var(--s4);
  font: 500 0.75rem/1.4 var(--font-code);
  color: var(--term-muted);
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
}

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

.terminal-body {
  margin: 0;
  padding: var(--s4);
  font-size: 0.8125rem;
  line-height: 1.65;
  overflow-x: auto;
}

/* Lines stay inline: the newlines in the <pre> already break them. */
.terminal-body .line {
  display: inline;
}

.prompt {
  color: var(--term-prompt);
  margin-right: 0.5ch;
}

.terminal .muted {
  color: var(--term-muted);
}

.terminal .ok {
  color: var(--term-ok);
}

.terminal .fail {
  color: var(--term-fail);
}

.thread {
  position: relative;
  height: 6rem;
}

.thread svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.thread-path {
  fill: none;
  stroke: var(--thread);
  stroke-width: 3;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.thread::before,
.thread::after {
  content: '';
  position: absolute;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--port-dot);
  border: 3px solid var(--paper);
  z-index: 1;
}

.thread::before {
  left: calc(10% - 0.375rem);
  top: -0.375rem;
  background: var(--thread-start);
}

.thread::after {
  right: calc(10% - 0.375rem);
  bottom: -0.375rem;
  background: var(--thread-end);
}

.thread-label {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  padding: var(--s1) var(--s3);
  background: var(--paper);
  border: 1px solid var(--thread);
  border-radius: 999px;
  font: 500 0.75rem/1.4 var(--font-code);
  color: var(--thread);
  white-space: nowrap;
}

/* Played by main.js; without JavaScript or with reduced motion the finished state shows. */
.handoff-demo.is-playing .terminal-body .line {
  visibility: hidden;
}

.handoff-demo.is-playing .terminal-body .line.is-visible {
  visibility: visible;
}

.handoff-demo.is-playing .thread svg {
  /* The thread runs left to right, so a wipe draws it without depending on stroke lengths. */
  clip-path: inset(0 100% 0 0);
}

.handoff-demo.is-playing .thread-label,
.handoff-demo.is-playing .thread::after {
  opacity: 0;
}

.handoff-demo.is-playing .terminal-to {
  opacity: 0.55;
}

/* Transitions belong to the handoff itself, so starting or replaying hides everything at once. */
.handoff-demo.is-playing.is-handed-off .thread svg {
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.9s cubic-bezier(0.65, 0, 0.35, 1);
}

.handoff-demo.is-playing.is-handed-off .thread-label,
.handoff-demo.is-playing.is-handed-off .thread::after {
  transition: opacity 0.3s ease-out 0.8s;
}

.handoff-demo.is-playing.is-handed-off .terminal-to {
  transition: opacity 0.4s ease-out 0.8s;
}

.handoff-demo.is-playing.is-handed-off .thread-label,
.handoff-demo.is-playing.is-handed-off .thread::after,
.handoff-demo.is-playing.is-handed-off .terminal-to {
  opacity: 1;
}

.handoff-demo {
  position: relative;
}

.replay-button {
  position: absolute;
  right: 0;
  bottom: calc(-1 * var(--s6));
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 0.8125rem/1 var(--font-body);
  cursor: pointer;
  padding: var(--s1) 0;
}

.replay-button[hidden] {
  display: none;
}

.replay-button:hover {
  color: var(--thread);
}

.replay-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

@keyframes appear {
  to {
    opacity: 1;
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* Sections */
.section {
  padding-block: var(--s8);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: var(--s7);
  align-items: start;
}

/* Grid children may shrink below their content; long code scrolls or wraps instead of widening the page. */
.section > *,
.hero > * {
  min-width: 0;
}

.section h2,
.closing h2 {
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-intro p {
  margin-top: var(--s4);
  color: var(--muted);
  max-width: 36rem;
}

.checklist,
.feature-list {
  margin: var(--s5) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--s3);
}

.checklist li,
.feature-list li {
  position: relative;
  padding-left: var(--s5);
}

.checklist li::before,
.feature-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 0.75rem;
  height: 2px;
  background: var(--thread);
}

/* Context pack viewer */
.pack-viewer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-window);
  overflow: hidden;
}

.pack-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
}

.mode-tabs {
  display: inline-flex;
  padding: 3px;
  background: var(--sunken);
  border-radius: var(--r-control);
}

.mode-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 500 0.8125rem/1 var(--font-code);
  padding: var(--s2) var(--s3);
  border-radius: 4px;
  cursor: pointer;
}

.mode-tabs button[aria-selected='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line);
}

.budget {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.budget strong {
  color: var(--ink);
}

.budget-bar {
  width: 6rem;
  height: 6px;
  border-radius: 3px;
  background: var(--sunken);
  overflow: hidden;
}

.budget-bar span {
  display: block;
  width: var(--fill);
  height: 100%;
  background: var(--thread);
  transition: width 0.3s ease;
}

.pack {
  margin: 0;
  padding: var(--s4);
  height: 26rem;
  overflow: auto;
  font-size: 0.8125rem;
  line-height: 1.6;
  background: var(--surface);
}

@media (prefers-reduced-motion: no-preference) {
  .pack code.is-swapping {
    animation: swap-in 0.25s ease-out;
  }
}

@keyframes swap-in {
  from {
    opacity: 0.2;
  }
}

.pack .heading {
  color: var(--thread);
  font-weight: 500;
}

.pack .source {
  color: var(--muted);
}

.pack .failed {
  color: var(--fail);
}

.pack .added {
  color: var(--ok);
}

.pack .removed {
  color: var(--fail);
}

.pack-command {
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--muted);
}

.pack-command code {
  background: none;
  padding: 0;
}

/* Handoff steps: a real sequence, so numbering carries meaning here */
.steps {
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s5);
  padding-left: var(--s6);
  grid-template-columns: minmax(0, 1fr);
  position: relative;
  /* The rail is drawn in two layers: the track, then the part already scrolled past. */
  background:
    linear-gradient(var(--thread), var(--thread)) left top / 2px calc(var(--progress, 1) * 100%) no-repeat,
    linear-gradient(var(--line), var(--line)) left top / 2px 100% no-repeat;
}

.steps li {
  counter-increment: step;
  position: relative;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: calc(-1 * var(--s6) - 0.8rem + 1px);
  top: -0.1rem;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line);
  color: var(--muted);
  font: 600 0.8125rem/1 var(--font-body);
  transition:
    border-color 0.3s,
    color 0.3s,
    background-color 0.3s;
}

/* Without JavaScript every step is shown as reached. */
.steps li.is-reached::before,
html:not(.js) .steps li::before {
  border-color: var(--thread);
  color: var(--thread);
}

.steps h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.steps pre,
.redaction pre {
  margin: var(--s2) 0 0;
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  overflow-x: auto;
  line-height: 1.6;
}

.aside {
  grid-column: 1 / -1;
  padding: var(--s4) var(--s5);
  background: var(--thread-soft);
  border-radius: var(--r-control);
  max-width: 52rem;
}

/* Privacy */
.privacy-grid {
  display: grid;
  gap: var(--s6);
}

.facts {
  margin: 0;
  display: grid;
  gap: var(--s5);
}

.facts dt {
  font-weight: 600;
}

.facts dd {
  margin: var(--s1) 0 0;
  color: var(--muted);
}

.redaction {
  margin: 0;
}

.redaction figcaption {
  font-size: 0.875rem;
  color: var(--muted);
}

.redaction .stored {
  border-color: var(--thread);
}

.secret.is-redacted {
  background: var(--thread-soft);
  color: var(--thread);
  border-radius: var(--r-inline);
  animation: settle 1.2s ease-out;
}

@keyframes settle {
  from {
    box-shadow: 0 0 0 4px var(--thread-soft);
  }
}

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

/* Agents */
.agents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.agents-table th,
.agents-table td {
  text-align: left;
  padding: var(--s3) var(--s4) var(--s3) 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.agents-table thead th {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

.agents-table tbody th {
  font-weight: 600;
  white-space: nowrap;
}

.agents-table td {
  color: var(--muted);
}

/* VS Code */
.vscode .status-line {
  margin: 0 0 var(--s3);
  color: var(--ok);
  font-weight: 600;
  font-size: 0.9375rem;
}

.vscode-heading {
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.vscode-heading img {
  flex: none;
  border-radius: 12px;
}

.vscode-install {
  margin-top: var(--s5);
  display: grid;
  gap: var(--s3);
  justify-items: start;
}

.vscode-install {
  justify-items: stretch;
  max-width: 30rem;
}

.vscode-install .button {
  justify-self: start;
}

/* The command is long: it wraps rather than scrolling or widening the page. */
.vscode-install .install-box code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.feature-list {
  margin-top: 0;
  padding: var(--s5) var(--s6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-window);
}

/* Closing */
.closing {
  padding-block: var(--s8) var(--s9);
  border-top: 1px solid var(--line);
  display: grid;
  justify-items: start;
  gap: var(--s5);
}

.closing .install-box {
  width: 100%;
}

.closing-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s5);
  font-weight: 500;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--s5);
  font-size: 0.875rem;
  color: var(--muted);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s3);
}

/* Page thread: the gutter line that fills as you read; ports light up beside each section. */
main {
  position: relative;
}

.page-thread {
  position: absolute;
  top: 0;
  bottom: 0;
  left: max(var(--s4), calc((100% - 72rem) / 2 - 3rem));
  width: 2px;
  background: linear-gradient(var(--thread), var(--thread)) left top / 2px var(--filled, 0) no-repeat,
    linear-gradient(to bottom, transparent, var(--line) 8rem, var(--line) calc(100% - 8rem), transparent);
  pointer-events: none;
}

.page-thread .port {
  position: absolute;
  left: 50%;
  width: 0.75rem;
  height: 0.75rem;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line);
  transition:
    background-color 0.3s,
    border-color 0.3s,
    scale 0.3s;
}

.page-thread .port.is-reached {
  background: var(--thread-end);
  border-color: var(--thread-end);
  scale: 1.15;
}

@media (max-width: 1360px) {
  .page-thread {
    display: none;
  }
}

.footer-links {
  display: flex;
  gap: var(--s5);
}

/* Responsive: tablet */
@media (max-width: 960px) {
  .hero,
  .section {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s6);
  }

  .hero {
    padding-block: var(--s8) var(--s7);
  }
}

/* Responsive: phone */
@media (max-width: 640px) {
  body {
    font-size: 1rem;
  }

  .menu-button {
    display: inline-grid;
  }

  .header-row {
    gap: var(--s3);
  }

  .header-actions {
    gap: var(--s1);
  }

  .brand {
    font-size: 1rem;
  }

  .github-link {
    padding: 0 var(--s3) 0 var(--s1);
    font-size: 0.9375rem;
  }

  #site-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: var(--s3) var(--s4) var(--s4);
  }

  #site-menu[data-open='true'] {
    display: block;
  }

  .nav-links {
    flex-direction: column;
    gap: 0;
  }

  .nav-links a {
    display: block;
    padding: var(--s3) 0;
    font-size: 1rem;
  }

  .terminal-from,
  .terminal-to {
    width: 100%;
  }

  /* Wrap rather than scroll sideways: short command lines read better than a hidden overflow. */
  .terminal-body,
  .steps pre,
  .redaction pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .install-box code {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .thread::before {
    left: calc(10% - 0.375rem);
  }

  .lede {
    font-size: 1.0625rem;
  }

  .pack {
    height: 22rem;
  }

  .steps {
    padding-left: var(--s5);
  }

  .steps li::before {
    left: calc(-1 * var(--s5) - 0.8rem - 1px);
  }

  .feature-list {
    padding: var(--s4) var(--s5);
  }

  .agents-table tbody th {
    white-space: normal;
  }
}

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

  .steps li::before,
  .page-thread .port {
    transition: none;
  }

  .budget-bar span {
    transition: none;
  }
}

/* 404 page */
.not-found {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: var(--s4);
}

.not-found h1 {
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
}

.not-found p {
  color: var(--muted);
}

.not-found-thread {
  width: 15rem;
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.not-found-thread circle {
  stroke: var(--ink);
}

.not-found-thread path {
  stroke: var(--thread);
}

.not-found-thread .loose {
  stroke-dasharray: 4 8;
  opacity: 0.6;
}

/* Very narrow phones: the brand keeps its mark and drops the word. */
@media (max-width: 359px) {
  .brand span {
    display: none;
  }
}
