/* spartito.dev: hand-written, no build step. Light and dark follow the system setting.
   "Spartito" is Italian for a musical score: faint staff lines are the one decorative motif. */

:root {
  color-scheme: light dark;
  --bg: #fafafd;
  --bg-alt: #f3f3f9;
  --surface: #ffffff;
  --surface-2: #f4f4f9;
  --text: #14142b;
  --muted: #4b4b63;
  --border: #e2e2ed;
  --border-strong: #cfcfe0;
  --accent: #5046e5;
  --accent-hover: #4338ca;
  --accent-text: #4b41e0;
  --accent-soft: #eeedfd;
  --on-accent: #ffffff;
  --tab-on: #5046e5;
  --tab-on-text: #ffffff;
  --line: #5046e5;
  --ok: #12703a;
  --ok-soft: #e4f5ea;
  --warn: #9a4a00;
  --warn-soft: #fdf0de;
  --staff: rgba(80, 70, 229, 0.11);
  --staff-line: rgba(80, 70, 229, 0.2);
  --glow-1: rgba(80, 70, 229, 0.17);
  --glow-2: rgba(128, 112, 255, 0.12);
  --code-bg: #15152a;
  --code-border: #15152a;
  --code-text: #ececf6;
  --code-muted: #a9a9c6;
  --code-chip: #26264a;
  --code-chip-text: #d4d1ff;
  --shadow-sm: 0 1px 2px rgba(20, 20, 50, 0.06), 0 2px 6px rgba(20, 20, 50, 0.04);
  --shadow: 0 1px 2px rgba(20, 20, 50, 0.05), 0 8px 24px -6px rgba(30, 25, 90, 0.12);
  --shadow-lg: 0 2px 4px rgba(20, 20, 50, 0.04), 0 24px 60px -16px rgba(40, 30, 140, 0.28);
  --radius: 16px;
  --radius-sm: 10px;
  --max: 76rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --section-y: clamp(4rem, 3rem + 4vw, 6.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b14;
    --bg-alt: #10101b;
    --surface: #14141f;
    --surface-2: #1c1c2b;
    --text: #ececf5;
    --muted: #a9a9c1;
    --border: #262639;
    --border-strong: #37374f;
    --accent: #5046e5;
    --accent-hover: #6158f0;
    --accent-text: #aaa5ff;
    --accent-soft: #211e4a;
    --on-accent: #ffffff;
    --tab-on: #8f88ff;
    --tab-on-text: #0b0b14;
    --line: #8f88ff;
    --ok: #5fd68e;
    --ok-soft: #12291c;
    --warn: #f3b35a;
    --warn-soft: #2d2010;
    --staff: rgba(170, 165, 255, 0.1);
    --staff-line: rgba(170, 165, 255, 0.2);
    --glow-1: rgba(80, 70, 229, 0.3);
    --glow-2: rgba(128, 112, 255, 0.14);
    --code-bg: #07070e;
    --code-border: #262639;
    --code-text: #ececf6;
    --code-muted: #a2a2bf;
    --code-chip: #1f1f38;
    --code-chip-text: #d4d1ff;
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 12px 30px -10px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 30px 80px -20px rgba(80, 70, 229, 0.35);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

a {
  color: var(--accent-text);
  text-underline-offset: 0.18em;
}

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

/* No border-radius here: the outline follows each element's own corners (a code block keeps its
   rounded ones). */
:focus-visible {
  outline: 3px solid var(--accent-text);
  outline-offset: 3px;
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}

:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.05em 0.35em;
  white-space: nowrap;
}

h1,
h2,
h3,
h4 {
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
}

h2 {
  font-size: clamp(2rem, 1.35rem + 2.3vw, 3rem);
  letter-spacing: -0.03em;
  line-height: 1.08;
  font-weight: 750;
  text-wrap: balance;
}

h3 {
  font-size: 1.125rem;
  font-weight: 650;
}

p {
  margin: 0;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 0.75rem + 2vw, 2.5rem);
}

.vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}

.skip:focus {
  top: 1rem;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  min-height: 4rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 750;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  width: 30px;
  height: 30px;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

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

.site-nav .nav-gh {
  color: var(--text);
  border: 1px solid var(--border-strong);
}

/* Hero */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(3rem, 2rem + 3.5vw, 5rem) 0 clamp(4rem, 3rem + 4vw, 6.5rem);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(44rem 30rem at 82% 38%, var(--glow-1), transparent 70%),
    radial-gradient(36rem 26rem at 8% -8%, var(--glow-2), transparent 70%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2.5rem, 1.5rem + 3vw, 4rem);
  align-items: center;
}

@media (min-width: 68rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
  padding: 0.3rem 0.8rem 0.3rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 550;
  box-shadow: var(--shadow-sm);
}

.pill .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hero h1 {
  font-size: clamp(2.5rem, 1.55rem + 3.6vw, 4.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin: 0 0 1.4rem;
  text-wrap: balance;
}

.hero h1 .accent {
  color: var(--accent-text);
}

.lede {
  font-size: clamp(1.1rem, 1rem + 0.45vw, 1.3rem);
  line-height: 1.55;
  color: var(--muted);
  max-width: 36rem;
}

.lede strong {
  color: var(--text);
  font-weight: 650;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0 0;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 1.35rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 650;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.button.primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 8px 20px -8px rgba(80, 70, 229, 0.7);
}

.button.primary:hover {
  background: var(--accent-hover);
}

.button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

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

.button:hover {
  transform: translateY(-1px);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.9rem;
}

.meta li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.meta .icon {
  color: var(--accent-text);
  width: 1.05rem;
  height: 1.05rem;
}

/* The score: you, Maestro and three projects (staves) with their leads and agents. */

.score-wrap {
  position: relative;
  width: 100%;
  max-width: 46rem;
  margin: 0;
}

/* Two staves of five faint lines behind the diagram card, seen only in the gap to its left and
   out to the right edge (the hero clips them): they never reach the text column or the caption.
   Only when the hero has two columns; stacked, there is no room beside the card. */
@media (min-width: 68rem) {
  .score-wrap::before {
    content: "";
    position: absolute;
    top: 3rem;
    bottom: 9rem;
    left: -1.5rem;
    right: -100vw;
    z-index: -1;
    background:
      repeating-linear-gradient(to bottom, var(--staff) 0 1px, transparent 1px 14px) 0 0 / 100% 57px no-repeat,
      repeating-linear-gradient(to bottom, var(--staff) 0 1px, transparent 1px 14px) 0 100% / 100% 57px no-repeat;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 1.5rem);
    mask-image: linear-gradient(to right, transparent, #000 1.5rem);
  }
}

.score {
  container-type: inline-size;
  margin: 0;
  padding: clamp(1rem, 0.6rem + 1.5vw, 1.6rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  line-height: 1.35;
}

.score-caption {
  margin: 0.9rem 0.25rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.n {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  padding: 0.5rem 0.75rem;
  min-width: 0;
}

.n b {
  font-weight: 650;
}

.n small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.n-you {
  display: inline-flex;
  border-style: dashed;
  border-radius: 999px;
  padding: 0.35rem 0.9rem 0.35rem 14px;
  font-weight: 650;
}

.n-you .icon {
  color: var(--accent-text);
}

.n-maestro {
  display: inline-flex;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  padding: 0.5rem 1.1rem 0.5rem 8px;
  box-shadow: 0 10px 24px -10px rgba(80, 70, 229, 0.8);
}

.n-maestro small {
  color: var(--on-accent);
}

.n-maestro svg {
  width: 30px;
  height: 30px;
  flex: none;
}

/* A vertical connector with the message going down on the left, the answer going up. */
.down-up {
  display: flex;
  gap: 1.25rem;
  margin-left: 23px;
  padding: 0.4rem 0 0.4rem 1rem;
  background: linear-gradient(var(--line), var(--line)) 0 0 / 2px 100% no-repeat;
  color: var(--muted);
  font-size: 0.78rem;
}

.down-up span:last-child {
  color: var(--ok);
  font-weight: 600;
}

.system {
  margin-left: 23px;
}

.staff {
  position: relative;
  padding: 0 0 0.9rem 1.5rem;
  border-left: 2px solid var(--line);
}

.staff:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

/* The branch from the spine to the staff, and the last part of the spine. */
.staff::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 0;
  width: 1.15rem;
  height: 0.8rem;
  border-left: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  border-bottom-left-radius: 8px;
}

.staff-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.6rem;
  min-height: 1.6rem;
  margin: 0 0 0.5rem;
}

/* After the project's name, a staff of five faint lines, as in a score. */
.staff-head::after {
  content: "";
  flex: 1 1 3rem;
  height: 17px;
  background: repeating-linear-gradient(to bottom, var(--staff-line) 0 1px, transparent 1px 4px);
}

.proj {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
}

.tag.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.tag .icon {
  width: 0.9rem;
  height: 0.9rem;
}

/* A staff: the lead, then its agents stacked like the notes of a chord, on faint staff lines. */
.staff-row {
  position: relative;
  display: grid;
  grid-template-columns: auto 1.4rem minmax(0, 1fr);
  align-items: center;
  padding: 0.35rem 0.4rem;
}

.n-lead {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  border: 2px solid var(--line);
  padding: 0.4rem 0.75rem;
}

.wire {
  position: relative;
  align-self: stretch;
}

/* From the lead to each agent: a bracket on the left of the agents. */
.wire::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: var(--line);
}

.agents {
  position: relative;
  display: grid;
  gap: 0.45rem;
  padding-left: 0.9rem;
}

/* The bracket joining the agents: each draws its part of it. */
.n-agent::after {
  content: "";
  position: absolute;
  left: calc(-0.9rem - 1px);
  top: calc(-0.225rem - 1px);
  bottom: calc(-0.225rem - 1px);
  width: 2px;
  background: var(--line);
}

.n-agent:first-child::after {
  top: 50%;
}

.n-agent:last-child::after {
  bottom: 50%;
}

.n-agent:only-child::after {
  display: none;
}

.n-agent {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 0.55rem;
  row-gap: 0.1rem;
  align-items: center;
  padding: 0.45rem 0.65rem;
}

.n-agent::before {
  content: "";
  position: absolute;
  left: calc(-0.9rem - 1px);
  top: 50%;
  width: 0.9rem;
  height: 2px;
  background: var(--line);
}

.n-agent > .note {
  grid-row: span 2;
}

.n-agent code {
  font-size: 0.8rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
}

.n-agent .who {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.45rem;
  min-width: 0;
}

.n-agent .where {
  grid-column: 2 / 4;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  min-width: 0;
}

.n-agent .where.prose {
  font-family: var(--font);
}

.n-agent .where .icon {
  width: 0.85rem;
  height: 0.85rem;
}

/* The note head: the agent's state. */
.note {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--line);
}

.is-done .note {
  border-color: var(--ok);
  background: var(--ok);
}

.state {
  grid-column: 3;
  grid-row: 1;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--accent-text);
}

.is-done .state {
  color: var(--ok);
}

@container (max-width: 30rem) {
  .staff-head::after {
    display: none;
  }
  .staff-row {
    grid-template-columns: minmax(0, 1fr);
    background: none;
    padding: 0;
  }
  .n-lead {
    justify-self: start;
    flex-direction: row;
    align-items: baseline;
    gap: 0.5rem;
  }
  .wire {
    display: none;
  }
  .agents {
    margin-left: 1.2rem;
    padding: 0.6rem 0 0 0.9rem;
  }
  .n-agent:first-child::after,
  .n-agent:only-child::after {
    display: block;
    top: calc(-0.6rem - 1px);
  }
}

/* Narrowest (360px screens): the role and the state share the first row, the agent's name gets
   the second to itself, so a long name cannot run into the state. */
@container (max-width: 19rem) {
  .n-agent {
    column-gap: 0.4rem;
    padding-inline: 0.5rem;
  }
  .n-agent .who {
    display: contents;
  }
  .n-agent > .note {
    grid-row: span 3;
  }
  .n-agent .who b {
    grid-column: 2;
    grid-row: 1;
  }
  .n-agent .who code {
    grid-column: 2 / 4;
    grid-row: 2;
  }
  .n-agent .where {
    grid-row: 3;
  }
}

/* Sections */

.section {
  padding: var(--section-y) 0;
}

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

.section-head {
  max-width: 44rem;
  margin: 0 auto clamp(2.5rem, 2rem + 2vw, 3.75rem);
  text-align: center;
}

.kicker {
  display: inline-block;
  margin: 0 0 0.9rem;
  color: var(--accent-text);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-head p:not(.kicker) {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 1.125rem;
}

/* Features: a grid of cards of different sizes. */

.bento {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-flow: dense;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 40rem) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card.wide {
    grid-column: span 2;
  }
}

@media (min-width: 62rem) {
  .bento {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.card p {
  color: var(--muted);
  font-size: 0.98rem;
}

.card .more {
  margin-top: auto;
  padding-top: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.card .more:hover {
  text-decoration: underline;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: 0.4rem;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.card-icon .icon {
  width: 1.4rem;
  height: 1.4rem;
}

.card.feature {
  overflow: hidden;
  background:
    radial-gradient(28rem 16rem at 100% 0%, var(--glow-2), transparent 70%),
    var(--surface);
}

@media (min-width: 40rem) {
  .card.feature {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 1.5rem;
    align-items: center;
    padding: 1.75rem;
  }
  .card.feature > div {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    height: 100%;
  }
}

.card.feature h3 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.card.feature .art {
  margin: 0;
}

/* At most its natural size; its 15-unit labels in a 300-unit viewBox stay at 12px or more
   down to a 240px wide column, and the narrowest column is about 260px. */
.card.feature .art svg {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
  margin-inline: auto;
}

.art .trunk {
  stroke: var(--muted);
}

.art .branch {
  stroke: var(--line);
}

.art .dot-main {
  fill: var(--surface);
  stroke: var(--muted);
}

.art .dot-branch {
  fill: var(--line);
}

.art text {
  font-family: var(--mono);
  font-size: 15px;
  fill: var(--text);
}

.art text.label {
  fill: var(--muted);
  font-family: var(--font);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.2rem 0 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
}

.chips.flow li:not(:last-child)::after {
  content: " →";
  color: var(--muted);
}

.chips.flow li {
  border: 0;
  background: none;
  padding: 0;
}

.mini-code {
  margin: 0;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  color: var(--code-text);
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
}

.mini-code .c {
  color: var(--code-muted);
}

.also {
  max-width: 48rem;
  margin: 2rem auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.98rem;
}

/* How it works: four steps on one line, like notes on a staff. */

.how {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

@media (min-width: 56rem) {
  .how {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
  }
  .how::before {
    content: "";
    position: absolute;
    left: 2rem;
    right: 2rem;
    top: 1.25rem;
    height: 2px;
    background: linear-gradient(to right, var(--line), var(--ok));
  }
}

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

.how li::before {
  content: counter(step);
  position: relative;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 0 1rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 750;
  box-shadow: 0 0 0 6px var(--bg);
}

.how h3 {
  margin: 0 0 0.4rem;
}

.how p {
  color: var(--muted);
  font-size: 0.98rem;
}

.how-note {
  max-width: 48rem;
  margin: 2.5rem auto 0;
  padding: 0.9rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

/* Install */

.os {
  max-width: 56rem;
  margin: 0 auto;
}

.os-tabs {
  display: flex;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 1.75rem;
  padding: 0.3rem;
  gap: 0.25rem;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-2);
}

.os-tabs[hidden] {
  display: none;
}

.os-tabs button {
  min-width: 6.5rem;
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: 600 0.98rem var(--font);
  cursor: pointer;
}

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

/* The selected tab is filled: indigo with white text in light mode (6.3:1; 5.7:1 against the
   tab bar), light indigo with near-black text in dark mode (6.7:1; 5.7:1 against the bar). */
.os-tabs button[aria-selected="true"] {
  background: var(--tab-on);
  color: var(--tab-on-text);
  box-shadow: var(--shadow-sm);
}

.os-panel {
  padding: clamp(1.25rem, 0.8rem + 2vw, 2.25rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.os-panel + .os-panel {
  margin-top: 1.5rem;
}

.os-panel[hidden] {
  display: none;
}

.os-title {
  margin: 0 0 1.25rem;
  font-size: 1.35rem;
}

.tabs-on .os-title {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.isteps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: istep;
}

.isteps > li {
  position: relative;
  counter-increment: istep;
  padding: 0 0 1.6rem 3rem;
}

.isteps > li:last-child {
  padding-bottom: 0;
}

.isteps > li::before {
  content: counter(istep);
  position: absolute;
  left: 0;
  top: -0.1rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 750;
  font-size: 0.95rem;
}

.isteps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(1rem - 1px);
  top: 2.2rem;
  bottom: 0.3rem;
  width: 2px;
  background: var(--border);
}

.isteps h4 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

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

.isteps p + p,
.isteps .code + p {
  margin-top: 0.6rem;
}

.isteps .hint {
  font-size: 0.93rem;
}

.isteps .warn-line {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  color: var(--text);
}

.warn-line .icon {
  margin-top: 0.15em;
  color: var(--warn);
}

.code {
  position: relative;
  margin: 0.7rem 0 0;
}

pre {
  margin: 0;
  padding: 0.95rem 1.1rem;
  font-size: 0.875rem;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--code-border);
  border-radius: 12px;
  line-height: 1.65;
  tab-size: 4;
}

pre .c {
  color: var(--code-muted);
}

.has-copy pre {
  padding-top: 2.7rem;
}

.copy {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  padding: 0.3rem 0.7rem;
  font: 600 0.8rem var(--font);
  color: var(--code-chip-text);
  background: var(--code-chip);
  border: 1px solid #3b3b66;
  border-radius: 8px;
  cursor: pointer;
}

.copy:hover {
  border-color: var(--code-chip-text);
}

.copy:focus-visible {
  outline-color: var(--code-chip-text);
  outline-offset: 2px;
}

/* The copy fallback: the same text as the copy button would put on the clipboard. */
.copy-text {
  display: block;
  width: 100%;
  margin: 0.5rem 0 0;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--accent-text);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: 0.85rem/1.6 var(--mono);
  resize: vertical;
}

.copy-text[hidden] {
  display: none;
}

.unsupported {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
}

.unsupported .card-icon {
  flex: none;
  background: var(--warn-soft);
  color: var(--warn);
}

.unsupported h4 {
  margin: 0.45rem 0 0.5rem;
  font-size: 1.15rem;
}

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

.unsupported p + p {
  margin-top: 0.6rem;
}

.after-install {
  max-width: 56rem;
  margin: 1.75rem auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Docs */

.docs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  height: 100%;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.docs a:hover {
  transform: translateY(-2px);
  border-color: var(--accent-text);
}

.docs b {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 650;
}

.docs b::after {
  content: "→";
  color: var(--accent-text);
}

.docs span {
  color: var(--muted);
  font-size: 0.92rem;
}

.platform {
  max-width: 48rem;
  margin: 2.5rem auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Footer */

.site-footer {
  padding: 2.5rem 0 3rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.93rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.foot-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.foot-brand img {
  width: 28px;
  height: 28px;
}

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

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Motion: the running agents' note heads pulse; all of it off on request. */

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--line) 55%, transparent);
  }
  70% {
    box-shadow: 0 0 0 7px color-mix(in srgb, var(--line) 0%, transparent);
  }
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--line) 0%, transparent);
  }
}

@keyframes flow {
  to {
    background-position: 0 24px;
  }
}

.is-running .note {
  animation: pulse 2s ease-out infinite;
}

.down-up.live {
  background: repeating-linear-gradient(to bottom, var(--line) 0 8px, transparent 8px 12px) 0 0 / 2px 24px repeat-y;
  animation: flow 1.6s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .button:hover,
  .card:hover,
  .docs a:hover {
    transform: none;
  }
}

/* Narrow screens */

@media (max-width: 40rem) {
  html {
    scroll-padding-top: 1rem;
  }
  body {
    font-size: 1rem;
  }
  .site-header {
    position: static;
  }
  .site-header .wrap {
    padding-top: 0.75rem;
    padding-bottom: 0.6rem;
  }
  .site-nav ul {
    margin-left: -0.7rem;
  }
  .site-nav a {
    padding: 0.35rem 0.6rem;
  }
  .isteps > li {
    padding-left: 0;
  }
  .isteps > li::before {
    top: -0.1rem;
    width: 1.8rem;
    height: 1.8rem;
  }
  .isteps h4 {
    padding-left: 2.5rem;
    min-height: 1.6rem;
  }
  .isteps > li:not(:last-child)::after {
    display: none;
  }
  /* The three tabs share the bar's width instead of overflowing it. */
  .os-tabs {
    width: 100%;
  }
  .os-tabs button {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 0.5rem;
  }
  .how li {
    padding-left: 3.25rem;
  }
  .how li::before {
    position: absolute;
    left: 0;
    top: -0.35rem;
  }
  .docs a {
    padding: 0.8rem 1rem;
  }
  .site-nav .nav-how {
    display: none;
  }
  .unsupported {
    flex-direction: column;
    gap: 0.5rem;
  }
}
