/* Page layout. Tokens come from tokens.css; element defaults from base.css.
   Structure is sections and hairlines, not cards: one accent colour, one
   radius of 2px, no shadows. */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.mono,
code,
kbd,
pre,
.docs-nav,
.pillar__num,
.spec__row dt {
  font-family: var(--font-mono);
}

/* ── Header ─────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper);
  border-bottom: var(--hairline) solid var(--rule);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-decoration: none;
  white-space: nowrap;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: var(--hairline) solid var(--rule-strong);
  font-size: 10px;
  line-height: 1;
  color: var(--accent);
}

.site-nav {
  display: none;
  gap: var(--space-md);
  margin-inline-start: auto;
}

.site-nav a {
  font-size: var(--text-sm);
  color: var(--ink-2);
  text-decoration: none;
}

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

.site-nav a[aria-current="page"] {
  color: var(--ink);
}

.header-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-2xs);
}

.header-github {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: var(--text-xs);
  line-height: 1;
  text-decoration: none;
}

.header-github:hover {
  background: var(--paper-3);
  color: var(--accent);
}

/* The global focus ring squares off 2px corners; the pill keeps its shape. */
.header-github:focus-visible {
  border-radius: 999px;
}

.header-github svg {
  flex: none;
}

.header-tools .header-download {
  margin-inline-start: var(--space-2xs);
  padding: 6px 12px;
  font-size: var(--text-xs);
  white-space: nowrap;
}

@media (max-width: 639px) {
  .site-header__inner {
    gap: var(--space-xs);
  }

  /* The download button lives in the hero on a phone. */
  .header-tools .header-download {
    display: none;
  }

  .header-github {
    padding: 8px 9px;
  }
}

/* Below this width the word leaves the pill so the controls stay on one row. */
@media (max-width: 359px) {
  .header-github {
    padding: 10px;
  }

  .header-github span {
    display: none;
  }
}

.tool-btn {
  padding: 3px 7px;
  border: var(--hairline) solid var(--rule);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--ink-2);
  transition: color 120ms ease, border-color 120ms ease;
}

.tool-btn:hover {
  color: var(--accent);
  border-color: var(--rule-strong);
}

/* ── Buttons ────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 8px 14px;
  border: var(--hairline) solid var(--ink);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.btn--primary {
  background: var(--ink);
  color: var(--paper);
}

.btn--primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn--ghost {
  border-color: var(--rule-strong);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Hero: one column, no screenshot ───────────────────────────── */

.hero {
  padding-block: var(--space-xl) var(--space-2xl);
  border-bottom: var(--hairline) solid var(--rule);
}

.hero__inner {
  display: grid;
  gap: var(--space-md);
  align-items: end;
}

.hero__kicker {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero__title {
  max-width: 22ch;
  margin-top: var(--space-xs);
  font-size: var(--text-display);
  letter-spacing: -0.025em;
}

.hero__lead {
  max-width: 54ch;
  margin-top: var(--space-sm);
  color: var(--ink-2);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
}

/* Three facts, set as a short reference list on the right of the hero at
   wide widths. The rule above is the only decoration. */
.hero__facts {
  display: grid;
  gap: var(--space-2xs);
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--muted);
}

.hero__facts dt {
  display: flex;
  gap: var(--space-2xs);
}

.hero__facts dt::before {
  content: "·";
  color: var(--accent);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin-top: var(--space-md);
}

/* ── Pillars: the four points ──────────────────────────────────── */

.pillar {
  padding-block: var(--space-xl);
  border-bottom: var(--hairline) solid var(--rule);
  scroll-margin-top: var(--header-h);
}

.pillar__grid {
  display: grid;
  gap: var(--space-md);
  align-items: start;
}

.pillar__body > * {
  min-width: 0;
}

.pillar__num {
  font-size: clamp(1.5rem, 1.2vw + 1.1rem, 1.875rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.pillar__title {
  max-width: 24ch;
  margin-top: var(--space-3xs);
  font-size: var(--text-2xl);
  letter-spacing: -0.015em;
}

.pillar__claim {
  max-width: 42ch;
  margin-top: var(--space-2xs);
  color: var(--ink-2);
  font-size: var(--text-md);
  line-height: var(--leading-snug);
}

/* Three short tags under the claim. They replace the old definition list:
   the same facts, one line instead of twelve. */
.pillar__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin-top: var(--space-sm);
  padding: 0;
  list-style: none;
}

.pillar__tags li {
  padding: 2px 7px;
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--ink-2);
  white-space: nowrap;
}

/* Full-width bands: the panorama under the hero and the comment editor.
   They carry the page, so they get the whole container width. */
.panorama {
  padding-block: var(--space-lg) 0;
  border-bottom: var(--hairline) solid var(--rule);
  padding-bottom: var(--space-xl);
}

/* Two ways in: the command a person runs, the sentence an agent takes. */
.run {
  display: grid;
  gap: var(--space-lg);
  margin-top: var(--space-sm);
}

.run__col {
  min-width: 0;
}

.run__label {
  margin-bottom: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.08em;
  color: var(--muted);
}

.run__say {
  padding: var(--space-sm) var(--space-md);
  border-left: 2px solid var(--accent);
  background: var(--surface-2);
  font-size: var(--text-md);
  line-height: var(--leading-body);
}

.run__note {
  margin-top: var(--space-xs);
  color: var(--ink-2);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

/* Below 700px the panorama would shrink to a 0.15x thumbnail. Keep it
   readable and let the reader swipe instead. */
@media (max-width: 700px) {
  .panorama__scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .shot .panorama__scroll img {
    width: 860px;
    max-width: none;
  }
}

.term {
  margin: 0;
  padding: var(--space-sm) var(--space-md);
  overflow-x: auto;
  background: #16181c;
  color: #c8ccd4;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.75;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.term code {
  font: inherit;
  white-space: pre;
}

@media (min-width: 860px) {
  .run {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: start;
  }
}

.pillar--wide .wide-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2xs) var(--space-sm);
  margin-bottom: var(--space-sm);
}

.pillar--wide .pillar__title {
  margin: 0;
}

.pillar--wide .pillar__claim {
  margin: 0;
  color: var(--ink-2);
}

.pillar--wide .pillar__tags {
  margin: 0 0 0 auto;
}

/* ── Screenshots ───────────────────────────────────────────────── */

.shot {
  margin: 0;
  min-width: 0;
}

/* The caption lives inside the frame border, so a screenshot costs one box
   and one hairline, not two boxes. */
.frame {
  border: var(--hairline) solid var(--rule);
  background: var(--paper-2);
  overflow: hidden;
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
}

/* Crops smaller than the column keep their natural size, centred, so the UI
   inside them stays crisp instead of being upscaled. The figure fills the
   column and the frame centres inside it. */
.shot--small .frame {
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
}

figcaption {
  padding: 5px 8px;
  border-top: var(--hairline) solid var(--rule);
  font-size: var(--text-2xs);
  color: var(--muted);
  text-wrap: pretty;
}

figcaption code {
  color: var(--ink-2);
}

/* ── Compact "also in the workbench" list ──────────────────────── */

.section {
  padding-block: var(--space-xl);
  border-bottom: var(--hairline) solid var(--rule);
  scroll-margin-top: var(--header-h);
}

.section--tight {
  padding-block: var(--space-lg);
}

.section__head {
  max-width: 58ch;
  margin-bottom: var(--space-md);
}

.section__title {
  font-size: var(--text-xl);
  letter-spacing: -0.01em;
}

.section__lead {
  margin-top: var(--space-2xs);
  color: var(--ink-2);
  font-size: var(--text-md);
  line-height: var(--leading-snug);
}

.more {
  display: grid;
  gap: 0;
  margin-top: var(--space-sm);
  padding: var(--space-xs) 0 0;
  padding-inline-start: 0;
  border-top: var(--hairline) solid var(--rule);
  list-style: none;
  counter-reset: more;
}

/* Not a grid: an inline <kbd> inside a grid container becomes its own grid
   item and the line explodes. Absolute placement keeps the text one run. */
.more li {
  position: relative;
  padding: 3px 0 3px 1.9rem;
  font-size: var(--text-xs);
  color: var(--ink-2);
  counter-increment: more;
}

.more li::before {
  content: counter(more, decimal-leading-zero);
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--muted);
}

/* ── Code blocks ───────────────────────────────────────────────── */

.split {
  display: grid;
  gap: var(--space-md);
}

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

.install__code {
  display: grid;
  gap: var(--space-sm);
}

.install__line {
  margin-top: var(--space-sm);
  font-size: var(--text-2xs);
  color: var(--muted);
  overflow-wrap: anywhere;
}



.split > * {
  min-width: 0;
}

.codeblock {
  border: var(--hairline) solid var(--rule);
  background: var(--code-bg);
  overflow: hidden;
}

.codeblock + .codeblock,
.codeblock + .table-wrap,
.table-wrap + .table-wrap {
  margin-top: var(--space-sm);
}

.codeblock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  padding: 4px 6px 4px 10px;
  border-bottom: var(--hairline) solid var(--rule);
  font-size: var(--text-2xs);
  color: var(--muted);
}

.codeblock pre {
  padding: var(--space-xs) 10px;
  font-size: var(--text-sm);
  color: var(--ink);
  /* Long install commands must stay readable in a half-width column.
     break-word only splits tokens that cannot fit at all; plain spaces wrap
     first, so a flag such as -DestinationPath is never cut in half. */
  white-space: pre-wrap;
  overflow-wrap: break-word;
  tab-size: 2;
}

.copy-btn {
  padding: 2px 6px;
  border: var(--hairline) solid var(--rule);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--ink-2);
  transition: color 120ms ease, border-color 120ms ease;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--rule-strong);
}

.copy-btn[data-copied="true"] {
  color: var(--add);
  border-color: var(--add);
}

/* ── Tables ────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border: var(--hairline) solid var(--rule);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  text-align: start;
}

/* The stage table: keep the state column tight and right-aligned. */
table.stages th:first-child,
table.stages td:first-child {
  width: 4.5rem;
}

table.stages th:last-child,
table.stages td:last-child {
  width: 8rem;
  text-align: end;
}

caption {
  padding: 5px 10px;
  border-bottom: var(--hairline) solid var(--rule);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-align: start;
}

th,
td {
  padding: 6px 10px;
  border-bottom: var(--hairline) solid var(--rule);
  text-align: start;
  vertical-align: top;
}

thead th {
  color: var(--muted);
  font-weight: 400;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

td code,
th code {
  font-size: 0.9em;
  white-space: nowrap;
}

td.mono {
  color: var(--muted);
  font-size: var(--text-2xs);
}

.fine {
  margin-top: var(--space-2xs);
  font-size: var(--text-2xs);
  color: var(--muted);
}

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

.tag {
  display: inline-block;
  padding: 0 6px;
  border: var(--hairline) solid var(--rule-strong);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--ink-2);
  white-space: nowrap;
}

.tag--ok {
  border-color: var(--add);
  color: var(--add);
}

.tag--todo {
  color: var(--muted);
}

/* ── Docs layout: permanent sidebar ────────────────────────────── */

.docs-layout {
  display: grid;
  gap: var(--space-lg);
  padding-block: var(--space-md) var(--space-xl);
  align-items: start;
}

.docs-aside {
  min-width: 0;
}

.docs-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border: var(--hairline) solid var(--rule);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ink);
}

.docs-toggle__mark {
  color: var(--accent);
}

.docs-nav {
  display: none;
  font-size: var(--text-sm);
}

.docs-nav__group {
  padding-top: var(--space-sm);
  color: var(--muted);
  font-size: var(--text-2xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-nav__list,
.docs-nav__sub {
  margin-top: var(--space-3xs);
  list-style: none;
}

.docs-nav__list a,
.docs-nav__sub a {
  display: block;
  padding: 3px 8px;
  border-inline-start: 2px solid transparent;
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.45;
}

.docs-nav__list a:hover,
.docs-nav__sub a:hover {
  color: var(--ink);
  border-inline-start-color: var(--rule-strong);
}

.docs-nav__list a[aria-current="location"],
.docs-nav__sub a[aria-current="location"] {
  color: var(--accent);
  border-inline-start-color: var(--accent);
}

.docs-nav__sub {
  padding-inline-start: var(--space-xs);
}

.docs-nav__sub a {
  font-size: var(--text-2xs);
  color: var(--muted);
}

.docs-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0% 0 0 / 55%);
  z-index: 20;
}

.docs-main {
  min-width: 0;
  max-width: 37rem;
}

.docs-head {
  padding-bottom: var(--space-sm);
  border-bottom: var(--hairline) solid var(--rule);
}

.docs-head__kicker {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.docs-head__title {
  margin-top: var(--space-3xs);
  font-size: var(--text-2xl);
  letter-spacing: -0.015em;
}

.docs-head__lead {
  margin-top: var(--space-2xs);
  color: var(--ink-2);
  font-size: var(--text-md);
  line-height: var(--leading-snug);
}

.doc-section {
  padding-top: var(--space-lg);
  scroll-margin-top: calc(var(--header-h) + var(--space-xs));
}

.doc-section > h2 {
  padding-bottom: var(--space-3xs);
  font-size: var(--text-xl);
  letter-spacing: -0.01em;
}

.doc-section > h3 {
  margin-top: var(--space-md);
  font-size: var(--text-md);
  font-weight: 600;
}

.doc-section p,
.doc-section ul,
.doc-section ol,
.doc-section .codeblock,
.doc-section .table-wrap,
.doc-section .callout {
  margin-top: var(--space-xs);
}

.doc-section p {
  color: var(--ink-2);
  line-height: var(--leading-body);
}

.doc-section p code,
.doc-section li code {
  padding: 0 3px;
  background: var(--paper-3);
  color: var(--ink);
}

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

.bullets {
  padding-inline-start: 1.1em;
  color: var(--ink-2);
}

.bullets li + li,
.steps li + li {
  margin-top: 5px;
}

.steps {
  padding-inline-start: 1.5em;
  color: var(--ink-2);
}

.steps li::marker {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.callout {
  padding: var(--space-xs) var(--space-sm);
  border: var(--hairline) solid var(--rule);
  border-inline-start: 2px solid var(--accent);
  background: var(--paper-2);
  font-size: var(--text-sm);
  color: var(--ink-2);
}

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

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

kbd {
  padding: 0 4px;
  border: var(--hairline) solid var(--rule-strong);
  font-size: 0.85em;
  color: var(--ink);
}

.docs-foot {
  margin-top: var(--space-lg);
  padding-top: var(--space-sm);
  border-top: var(--hairline) solid var(--rule);
  font-size: var(--text-sm);
  color: var(--muted);
}

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

/* ── Footer ────────────────────────────────────────────────────── */

.site-footer {
  border-top: var(--hairline) solid var(--rule);
  padding-block: var(--space-md) var(--space-lg);
  color: var(--muted);
  font-size: var(--text-2xs);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
  align-items: baseline;
  justify-content: space-between;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-family: var(--font-mono);
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

/* ── 404 ───────────────────────────────────────────────────────── */

.error-page {
  display: grid;
  place-content: center;
  gap: var(--space-sm);
  min-height: 70vh;
  text-align: center;
}

.error-page__code {
  font-family: var(--font-mono);
  font-size: var(--text-display);
  color: var(--accent);
  line-height: 1;
}

/* ── Wider viewports ──────────────────────────────────────────── */

@media (max-width: 639px) {
  /* On a phone the label column would squeeze the value to two words per
     line, so the label keeps the narrower gutter instead. */
  .spec__row {
    grid-template-columns: minmax(0, 6.5rem) minmax(0, 1fr);
    gap: var(--space-xs);
  }
}

@media (min-width: 680px) {
  .more {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-xl);
  }

  .pillar__grid,
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-lg);
  }

  /* Alternate: pillars 02 and 04 put the screenshot on the left. Explicit
     placement keeps the HTML reading order valid. */
  .pillar--flip .pillar__body {
    grid-column: 2;
  }

  .pillar--flip .shot {
    grid-column: 1;
    grid-row: 1;
  }
}

@media (min-width: 900px) {
  .site-nav {
    display: flex;
  }

  .docs-layout {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    gap: var(--space-xl);
  }

  .docs-toggle {
    display: none;
  }

  .docs-aside {
    position: sticky;
    top: calc(var(--header-h) + var(--space-md));
    max-height: calc(100vh - var(--header-h) - var(--space-md) * 2);
    overflow-y: auto;
    padding-inline-end: var(--space-2xs);
  }

  .docs-nav {
    display: block;
  }

  .docs-overlay {
    display: none;
  }

  .docs-main {
    /* ~70 characters per line at the body size; measured in the browser,
       not guessed from a ch value, because ch is the width of "0". */
    max-width: 37rem;
    padding-top: var(--space-2xs);
  }
}

@media (min-width: 1000px) {
  .pillar {
    padding-block: var(--space-2xl);
  }

  .pillar__grid {
    grid-template-columns: minmax(0, 1fr) 460px;
    gap: var(--space-2xl);
    align-items: center;
  }

  /* The columns swap with the figure, so text keeps its measure and the
     screenshot keeps its width on both sides of the page. */
  .pillar--flip .pillar__grid {
    grid-template-columns: 460px minmax(0, 1fr);
  }

  .section {
    padding-block: var(--space-2xl);
  }

  .hero {
    padding-block: var(--space-2xl) var(--space-3xl);
  }

  /* Facts move to the right of the hero so the block fills its width
     instead of leaving half the page empty. */
  .hero__inner {
    grid-template-columns: minmax(0, 1fr) 15rem;
    gap: var(--space-2xl);
  }
}

/* The narrow-screen sidebar becomes an overlay panel. */
@media (max-width: 899px) {
  .docs-aside[data-open="true"] .docs-nav {
    display: block;
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 25;
    width: min(19rem, 86vw);
    padding: var(--space-md) var(--space-sm);
    background: var(--paper);
    border-inline-end: var(--hairline) solid var(--rule);
    overflow-y: auto;
  }
}

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