/* Apgar landing. Tokens follow apgar_src/ui/DESIGN.md. */

:root {
  --bg: #f7f6fa;
  --surface: #ffffff;
  --surface-raised: #f9f8fb;
  --border: #e8e4ee;
  --border-strong: #d4cede;
  --text: #1d1728;
  --text-muted: #6b6379;
  --accent: #5f4fd1;
  --accent-text: #ffffff;
  --pass: #16774b;
  --pass-bg: #ecf7f1;
  --fail: #b4262c;
  --fail-bg: #fdf0f0;
  --inconclusive: #8f4c00;
  --inconclusive-bg: #fdf4e7;
  --info: #1d5ea8;
  --info-bg: #edf4fb;
  --sidebar: #211a2e;
  --sidebar-text: #c8c0d6;
  --sidebar-muted: #8d84a0;
  --sidebar-active: #342a47;
  --sidebar-strong: #ffffff;

  /* The hero and terminals are always dark, so they use the dark theme tokens. */
  --ink-bg: var(--sidebar);
  --ink-surface: #18151f;
  --ink-raised: #1f1b28;
  --ink-border: #2b2636;
  --ink-border-strong: #3a3447;
  --ink-text: #ece9f2;
  --ink-strong: #f5f2fa;
  --ink-muted: #a29bb1;
  --ink-accent: #9c8ef6;
  --ink-pass: #52d497;
  --ink-pass-bg: #10281c;
  --ink-fail: #ff7a78;
  --ink-fail-bg: #35171a;
  --ink-inconclusive: #f2b85a;
  --ink-inconclusive-bg: #33260f;
  --ink-info: #7db4f5;

  --font-sans: "Geist", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --wrap: 1200px;
  --gutter: 24px;
  --nav-h: 60px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121019;
  --surface: #18151f;
  --surface-raised: #1f1b28;
  --border: #2b2636;
  --border-strong: #3a3447;
  --text: #ece9f2;
  --text-muted: #a29bb1;
  --accent: #9c8ef6;
  --accent-text: #120f1a;
  --pass: #52d497;
  --pass-bg: #10281c;
  --fail: #ff7a78;
  --fail-bg: #35171a;
  --inconclusive: #f2b85a;
  --inconclusive-bg: #33260f;
  --info: #7db4f5;
  --info-bg: #12243a;
  --sidebar: #0d0b13;
  --sidebar-text: #c2bbd0;
  --sidebar-muted: #857d96;
  --sidebar-active: #231e30;
  --sidebar-strong: #f5f2fa;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

code,
pre,
kbd {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}

svg {
  display: block;
}

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

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 500;
}

.skip:focus {
  top: 12px;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.btn-primary {
  background: var(--ink-accent);
  color: #120f1a;
}

.btn-primary:hover {
  background: color-mix(in oklab, var(--ink-accent) 86%, white);
}

.btn-ghost-ink {
  border-color: var(--ink-border-strong);
  color: var(--ink-strong);
  background: color-mix(in oklab, var(--ink-surface) 60%, transparent);
}

.btn-ghost-ink:hover {
  border-color: color-mix(in oklab, var(--ink-accent) 50%, var(--ink-border-strong));
  background: var(--ink-raised);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  color: var(--ink-strong);
  background: var(--ink-raised);
}

.icon-btn-ink {
  border-color: var(--ink-border);
}

/* Nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: color-mix(in oklab, var(--ink-bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  color: var(--ink-text);
  transition: border-color 0.2s ease;
}

.nav.is-scrolled {
  border-bottom-color: var(--ink-border);
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-strong);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  color: var(--ink-accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

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

.nav-links a[aria-current="true"] {
  color: var(--ink-strong);
  background: var(--ink-raised);
}

.nav-ext svg {
  width: 12px;
  height: 12px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-gh {
  height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

.nav-menu {
  display: none;
}

[data-theme="light"] .when-dark,
[data-theme="dark"] .when-light {
  display: none;
}

/* Hero */

.hero {
  position: relative;
  margin-top: calc(var(--nav-h) * -1);
  padding: calc(var(--nav-h) + 44px) 0 88px;
  background-color: var(--ink-bg);
  color: var(--ink-text);
  isolation: isolate;
  overflow: hidden;
}

/* Chart paper: a fine grid with a heavier line every fifth cell, the way monitor paper is ruled. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgb(156 142 246 / 0.09) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(156 142 246 / 0.09) 1px, transparent 1px),
    linear-gradient(to right, rgb(156 142 246 / 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(156 142 246 / 0.04) 1px, transparent 1px);
  background-size:
    60px 60px,
    60px 60px,
    12px 12px,
    12px 12px;
  background-position: -1px -1px;
  mask-image: radial-gradient(ellipse 90% 80% at 30% 20%, black 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 30% 20%, black 30%, transparent 85%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 520px at -6% -10%, rgb(95 79 209 / 0.5), transparent 60%),
    radial-gradient(700px 500px at 105% 30%, rgb(95 79 209 / 0.18), transparent 60%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 560px);
  column-gap: 56px;
  align-items: start;
}

.hero-copy {
  padding-top: 12px;
}

.eyebrow {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  color: color-mix(in oklab, var(--ink-accent) 80%, white);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
}

.eyebrow-tag {
  padding: 3px 8px;
  white-space: nowrap;
  border: 1px solid color-mix(in oklab, var(--ink-accent) 45%, transparent);
  border-radius: 999px;
  color: var(--ink-strong);
  letter-spacing: 0.08em;
}

.hero h1 {
  margin-top: 22px;
  max-width: 11em;
  color: var(--ink-strong);
  font-size: clamp(40px, 4.6vw, 68px);
  font-weight: 560;
  letter-spacing: -0.045em;
  line-height: 0.98;
  text-wrap: balance;
}

.hero-lede {
  margin-top: 24px;
  max-width: 32em;
  color: var(--ink-muted);
  font-size: 18px;
  line-height: 1.6;
}

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

.hero-meta {
  margin-top: 20px;
  color: var(--ink-muted);
  font-size: 14px;
}

.hero-meta-sep {
  margin: 0 4px;
}

/* Release monitor: the baseline release on the left, the new release on the right, the way the mark is split. */

.monitor-fig {
  min-width: 0;
}

.monitor {
  --base-c: color-mix(in oklab, var(--ink-accent) 45%, var(--ink-muted));
  position: relative;
  padding: 16px;
  border: 1px solid var(--ink-border);
  border-radius: 12px;
  background: color-mix(in oklab, var(--ink-surface) 92%, transparent);
  color: var(--ink-text);
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 0.2),
    0 30px 80px -30px rgb(0 0 0 / 0.6);
}

.monitor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.monitor-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  min-width: 0;
  font-size: 14px;
}

.monitor-agent {
  color: var(--ink-strong);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.monitor-metric {
  color: var(--ink-muted);
  font-size: 13px;
}

.arms {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  margin-top: 12px;
}

.arm {
  min-width: 0;
  padding: 10px 12px 11px;
  border: 1px solid var(--ink-border);
  border-radius: 8px;
  background: var(--ink-bg);
  transition: border-color 0.3s ease;
}

.arm-base {
  border-style: dashed;
  border-color: var(--ink-border-strong);
}

.arm-kind {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.arm-kind svg {
  flex: none;
  width: 16px;
  height: 16px;
}

.arm-base .arm-kind svg {
  color: var(--base-c);
}

.arm-new .arm-kind svg {
  color: var(--ink-accent);
}

.arm-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.arm-rel {
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
}

.arm-val {
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
  line-height: 1.2;
  transition: color 0.3s ease;
}

.arm-base .arm-val {
  color: var(--base-c);
}

.arm-meta {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.4;
}

.arms-vs {
  align-self: center;
  padding: 0 10px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.monitor[data-tone="fail"] .arm-new {
  border-color: color-mix(in oklab, var(--ink-fail) 55%, var(--ink-border));
}

.monitor[data-tone="fail"] .arm-new .arm-val {
  color: var(--ink-fail);
}

.monitor[data-tone="pass"] .arm-new {
  border-color: color-mix(in oklab, var(--ink-pass) 55%, var(--ink-border));
}

.monitor[data-tone="pass"] .arm-new .arm-val {
  color: var(--ink-pass);
}

.monitor-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.seg {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--ink-border);
  border-radius: 8px;
  background: var(--ink-bg);
}

.seg button {
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.seg button:hover {
  color: var(--ink-strong);
}

.seg button[aria-checked="true"] {
  background: var(--ink-raised);
  color: var(--ink-strong);
  box-shadow: inset 0 0 0 1px var(--ink-border-strong);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  background: var(--surface-raised);
  color: var(--text-muted);
  box-shadow: inset 0 0 0 1px var(--border);
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge[data-tone="inconclusive"] {
  background: var(--inconclusive-bg);
  color: var(--inconclusive);
  box-shadow: none;
}

.badge[data-tone="fail"] {
  background: var(--fail-bg);
  color: var(--fail);
  box-shadow: none;
}

.badge[data-tone="pass"] {
  background: var(--pass-bg);
  color: var(--pass);
  box-shadow: none;
}

.monitor .badge {
  background: var(--ink-raised);
  color: var(--ink-muted);
  box-shadow: inset 0 0 0 1px var(--ink-border-strong);
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.monitor .badge[data-tone="inconclusive"] {
  background: var(--ink-inconclusive-bg);
  color: var(--ink-inconclusive);
  box-shadow: none;
}

.monitor .badge[data-tone="fail"] {
  background: var(--ink-fail-bg);
  color: var(--ink-fail);
  box-shadow: none;
}

.monitor .badge[data-tone="pass"] {
  background: var(--ink-pass-bg);
  color: var(--ink-pass);
  box-shadow: none;
}

/* Chart */

.chart {
  margin-top: 12px;
  padding: 10px 12px 6px 46px;
  border: 1px solid var(--ink-border);
  border-radius: 8px;
  background: var(--ink-bg);
}

.chart-head {
  position: relative;
  height: 16px;
  margin-bottom: 8px;
}

.chart-region,
.chart-check {
  position: absolute;
  top: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
}

.chart-region::before {
  content: "";
  width: 10px;
  border-top: 2px solid currentColor;
}

.chart-region-base {
  padding-right: 6px;
  color: var(--base-c);
}

.chart-region-base::before {
  border-top-style: dotted;
}

.chart-region-new {
  padding-left: 6px;
  color: var(--ink-accent);
  transition: color 0.3s ease;
}

.monitor[data-tone="fail"] .chart-region-new {
  color: var(--ink-fail);
}

.monitor[data-tone="pass"] .chart-region-new {
  color: var(--ink-pass);
}

.chart-check {
  right: 0;
  color: var(--ink-muted);
}

.chart-plot {
  position: relative;
  height: 172px;
}

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

.chart-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chart-labels span,
.chart-x span {
  position: absolute;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.chart-labels .y {
  right: calc(100% + 8px);
  transform: translateY(-50%);
}

.chart-labels .y-base {
  color: var(--base-c);
}

.chart-labels .y-tol {
  color: var(--ink-fail);
}

.chart-labels .tol {
  right: 4px;
  transform: translateY(-130%);
  color: var(--ink-fail);
  opacity: 0.85;
}

.chart-labels .decided {
  top: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  transform: translateX(6px);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chart-labels .decided.is-left {
  transform: translateX(-100%) translateX(-6px);
}

.chart-labels .decided.is-on {
  opacity: 1;
}

.chart-labels .decided[data-tone="fail"] {
  background: var(--ink-fail-bg);
  color: var(--ink-fail);
}

.chart-labels .decided[data-tone="pass"] {
  background: var(--ink-pass-bg);
  color: var(--ink-pass);
}

.chart-x {
  position: relative;
  height: 18px;
  margin-top: 6px;
}

.chart-x span {
  top: 2px;
  transform: translateX(-50%);
}

.chart-x span:last-child {
  transform: translateX(-100%);
}

.chart-x .x-base {
  color: var(--base-c);
}

/* SVG parts, with non scaling strokes so the stretched viewBox keeps crisp lines. */
.chart svg * {
  vector-effect: non-scaling-stroke;
}

.c-grid {
  stroke: var(--ink-border);
  stroke-width: 1;
}

.c-zero {
  stroke: var(--ink-border-strong);
  stroke-width: 1;
}

.c-base-zone {
  fill: var(--ink-accent);
  opacity: 0.05;
}

.c-base-line {
  fill: none;
  stroke: var(--base-c);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.c-base-ref {
  stroke: var(--base-c);
  stroke-width: 1.5;
  stroke-dasharray: 1 4;
  stroke-linecap: round;
}

.c-release {
  stroke: var(--ink-accent);
  stroke-width: 1;
  opacity: 0.55;
}

.c-zone {
  fill: var(--ink-fail);
  opacity: 0.06;
}

.c-tol {
  stroke: var(--ink-fail);
  stroke-width: 1.25;
  stroke-dasharray: 5 4;
  opacity: 0.75;
}

.c-band {
  fill: var(--ink-accent);
  opacity: 0.22;
  transition:
    fill 0.3s ease,
    opacity 0.3s ease;
}

.c-whisk {
  stroke: var(--ink-accent);
  stroke-width: 1;
  opacity: 0.45;
  transition: stroke 0.3s ease;
}

.c-line {
  fill: none;
  stroke: var(--ink-accent);
  stroke-width: 1.75;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: stroke 0.3s ease;
}

.c-dot {
  fill: none;
  stroke: var(--ink-strong);
  stroke-width: 6;
  stroke-linecap: round;
}

.c-head {
  fill: none;
  stroke: var(--ink-accent);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke 0.3s ease;
}

.c-decided {
  stroke-width: 1.25;
  stroke: transparent;
  transition: stroke 0.3s ease;
}

[data-tone="fail"] .c-band {
  fill: var(--ink-fail);
  opacity: 0.24;
}

[data-tone="fail"] .c-line,
[data-tone="fail"] .c-whisk,
[data-tone="fail"] .c-head {
  stroke: var(--ink-fail);
}

[data-tone="fail"] .c-decided.is-on {
  stroke: var(--ink-fail);
}

[data-tone="pass"] .c-band {
  fill: var(--ink-pass);
  opacity: 0.22;
}

[data-tone="pass"] .c-line,
[data-tone="pass"] .c-whisk,
[data-tone="pass"] .c-head {
  stroke: var(--ink-pass);
}

[data-tone="pass"] .c-decided.is-on {
  stroke: var(--ink-pass);
}

[data-tone="pass"] .c-zone {
  opacity: 0.03;
}

/* Channel: the messages Apgar posts for this release. All three share one grid cell, so the card never resizes. */

.channel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--ink-border);
}

.channel-name {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.channel-stack {
  display: grid;
  margin-top: 8px;
}

.msg {
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: 10px;
  align-items: start;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease,
    visibility 0s linear 0.35s;
}

.msg.is-on {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.35s ease,
    transform 0.35s ease,
    visibility 0s;
}

.msg-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #5f4fd1;
  color: #fff;
}

.msg-avatar svg {
  width: 20px;
  height: 20px;
}

.msg-from {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-strong);
  font-weight: 600;
  line-height: 1.3;
}

.msg-tag {
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--ink-raised);
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.msg-title {
  margin-top: 2px;
}

.msg-title b {
  color: var(--ink-strong);
}

.msg code {
  padding: 1px 4px;
  border: 1px solid var(--ink-border);
  border-radius: 3px;
  background: var(--ink-raised);
  color: #e8912d;
  font-size: 12px;
}

.msg-att {
  margin-top: 4px;
  padding: 1px 0 1px 12px;
  border-left: 4px solid #1d9bd1;
  color: var(--ink-text);
}

.msg-att[data-tone="fail"] {
  border-left-color: #e01e5a;
}

.msg-att[data-tone="pass"] {
  border-left-color: #2eb67d;
}

.msg-att p + p {
  margin-top: 2px;
}

.msg-ctx {
  color: var(--ink-muted);
  font-size: 12px;
}

.msg-link {
  color: #1d9bd1;
}

/* Sections: a ruled chart, with the label in the left margin. */

.sect {
  padding: 112px 0;
  border-top: 1px solid var(--border);
}

.sect:first-of-type {
  border-top: 0;
}

.sect-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
}

.sect-label {
  position: sticky;
  top: calc(var(--nav-h) + 32px);
  align-self: start;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-top: 14px;
  border-top: 2px solid var(--text);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.sect-num {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.sect-body {
  min-width: 0;
}

.sect h2 {
  max-width: 18em;
  color: var(--text);
  font-size: clamp(32px, 3.8vw, 50px);
  font-weight: 560;
  letter-spacing: -0.04em;
  line-height: 1.02;
  text-wrap: balance;
}

.sect-lede {
  margin-top: 20px;
  max-width: 40em;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1.6;
}

.sect-lede code,
.step code,
.term-note code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 0.86em;
}

.sub {
  margin-top: 64px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cols-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.cols-3 > * {
  padding: 24px;
}

.cols-3 > * + * {
  border-left: 1px solid var(--border);
}

.cols-3 h3,
.cols-3 h4 {
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.cols-3 p {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
}

/* Problem logs */

.split-logs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.log {
  padding: 20px 22px 22px;
}

.log-after {
  border-left: 1px solid var(--border);
  background: color-mix(in oklab, var(--fail-bg) 55%, var(--surface));
}

.log-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-pass {
  background: var(--pass);
}

.dot-fail {
  background: var(--fail);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--fail) 18%, transparent);
}

.log-lines {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-feature-settings: "tnum";
}

.log-lines li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px dashed var(--border);
  color: var(--text);
}

.log-lines li:first-child {
  border-top: 0;
}

.log-lines li > :last-child {
  color: var(--text-muted);
  text-align: right;
}

.log-delta li {
  grid-template-columns: minmax(0, 1fr) auto 76px;
}

.log-delta li > :nth-child(2) {
  color: var(--text-muted);
}

.ok {
  color: var(--pass);
}

.log-lines .bad {
  color: var(--fail);
  font-weight: 500;
}

.log-lines .flat {
  color: var(--text-muted);
}

.gap h4::before {
  content: "";
  display: block;
  width: 18px;
  height: 2px;
  margin-bottom: 14px;
  background: var(--border-strong);
}

/* Value tiles */

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 44px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.tile {
  padding: 26px 24px 28px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
}

.tile:hover {
  background: var(--surface);
}

.tile h3 {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tile p:last-child {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
}

/* Steps */

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin-top: 44px;
  counter-reset: step;
}

.step {
  position: relative;
  padding-top: 26px;
}

.step::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 0;
  right: -24px;
  height: 1px;
  background: var(--border-strong);
}

.step:last-child::before {
  right: 0;
  background: linear-gradient(to right, var(--border-strong), transparent);
}

.step-n {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

.step h3 {
  margin-top: 6px;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.step p {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
}

.steps + .code {
  margin-top: 48px;
}

.code,
.term {
  min-width: 0;
  border: 1px solid var(--ink-border);
  border-radius: 8px;
  background: var(--ink-surface);
  color: var(--ink-text);
  overflow: hidden;
}

[data-theme="light"] .code,
[data-theme="light"] .term {
  border-color: var(--sidebar);
  background: var(--sidebar);
}

.code-head,
.term-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 42px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--ink-border);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

[data-theme="light"] .code-head,
[data-theme="light"] .term-head {
  border-bottom-color: var(--sidebar-active);
}

.code pre,
.term pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
}

.code .k {
  color: var(--ink-muted);
}

.code .cm {
  color: color-mix(in oklab, var(--ink-accent) 55%, var(--ink-muted));
}

.code mark {
  padding: 1px 3px;
  border-radius: 3px;
  background: color-mix(in oklab, var(--ink-accent) 26%, transparent);
  color: var(--ink-strong);
}

.copy {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}

.copy:hover {
  color: var(--ink-strong);
  background: var(--ink-raised);
}

.copy svg {
  width: 15px;
  height: 15px;
}

.copy .copy-ok {
  display: none;
  color: var(--ink-pass);
}

.copy.is-done .copy-i {
  display: none;
}

.copy.is-done .copy-ok {
  display: block;
}

/* Metrics */

.metric-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 44px;
}

.mgroup {
  padding: 8px 20px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.mgroup h3 {
  margin-top: 14px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.mgroup h3 + table {
  margin-top: 4px;
}

.mgroup table + h3 {
  margin-top: 22px;
}

.mgroup table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.mgroup th {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
}

.mgroup td {
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  color: var(--text);
}

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

.mgroup th:nth-child(2),
.mgroup td:nth-child(2) {
  width: 104px;
  color: var(--text-muted);
}

.mgroup th:last-child,
.mgroup td:last-child {
  width: 80px;
  text-align: right;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}

.mgroup th:last-child {
  font-family: var(--font-sans);
}

.dir {
  display: inline-block;
  width: 14px;
  color: var(--fail);
  font-family: var(--font-mono);
}

.tip {
  position: relative;
  display: inline-block;
}

.tip-btn {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: underline dotted color-mix(in oklab, var(--text-muted) 70%, transparent);
  text-underline-offset: 4px;
  cursor: help;
}

.tip-body {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 5;
  width: max-content;
  max-width: min(280px, 70vw);
  padding: 8px 10px;
  border: 1px solid var(--ink-border);
  border-radius: 6px;
  background: var(--ink-raised);
  color: var(--ink-text);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.12s ease,
    visibility 0.12s;
}

/* Keeps the tooltip open while the pointer crosses the gap above the name. */
.tip-body::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 8px;
}

.tip:hover .tip-body,
.tip:focus-within .tip-body {
  opacity: 1;
  visibility: visible;
}

/* Stack: the existing tools stay neutral, Apgar is the one accent box. */

.stack-fig {
  margin-top: 44px;
}

.stack-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.stack-wide {
  max-width: 860px;
}

.stack-tall {
  display: none;
  max-width: 420px;
}

.st-node rect {
  fill: var(--surface);
  stroke: var(--border-strong);
  stroke-width: 1;
}

.st-title {
  fill: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.st-sub {
  fill: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
}

.st-label {
  fill: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.st-edge {
  fill: none;
  stroke: color-mix(in oklab, var(--text-muted) 55%, var(--bg));
  stroke-width: 1.25;
}

.st-head {
  fill: none;
  stroke: color-mix(in oklab, var(--text-muted) 55%, var(--bg));
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.st-in,
.st-pull,
.st-head-accent {
  stroke: var(--accent);
}

.st-in,
.st-pull {
  stroke-dasharray: 4 4;
}

.st-apgar rect {
  fill: color-mix(in oklab, var(--accent) 10%, var(--surface));
  stroke: var(--accent);
  stroke-width: 1.5;
}

.st-halo {
  fill: none;
  stroke: color-mix(in oklab, var(--accent) 50%, transparent);
  stroke-dasharray: 3 4;
}

.st-logo {
  color: var(--accent);
}

/* Traces moving along the OTLP and Langfuse edges. */
.st-flow {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 0.1 18;
  animation: st-flow 1.4s linear infinite;
}

@keyframes st-flow {
  to {
    stroke-dashoffset: -18.1;
  }
}

.stack-points {
  margin-top: 32px;
}

/* Below this width the wide diagram's labels get too small, so the flow turns vertical. */
@media (max-width: 760px) {
  .stack-wide {
    display: none;
  }

  .stack-tall {
    display: block;
  }
}

/* Get started */

.term {
  margin-top: 36px;
}

/* The tabs reach over the head's bottom border, so the active underline
   covers it without overflowing the scroll box. */
.term-tabs {
  display: flex;
  align-self: stretch;
  gap: 4px;
  margin: 0 0 -1px -8px;
  overflow-x: auto;
}

.term-tabs button {
  position: relative;
  height: 100%;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.term-tabs button:hover {
  color: var(--ink-strong);
}

.term-tabs button[aria-selected="true"] {
  color: var(--ink-strong);
}

.term-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  background: var(--ink-accent);
}

.term pre code {
  color: var(--ink-text);
}

/* The prompt is drawn by CSS so it stays out of the copied text. */
.term .t-p::before {
  content: "$ ";
  color: var(--ink-muted);
  opacity: 0.6;
}

.term .t-cmd {
  color: var(--ink-accent);
}

.term .t-flag {
  color: var(--ink-info);
}

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

.term .t-sub {
  color: var(--ink-pass);
}

.term .t-dim {
  color: var(--ink-muted);
  opacity: 0.7;
}

.term-note {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--ink-border);
  color: var(--ink-muted);
  font-size: 14px;
}

[data-theme="light"] .term-note {
  border-top-color: var(--sidebar-active);
}

.term-note strong {
  color: var(--ink-text);
  font-weight: 500;
}

.term-note code {
  border-color: var(--ink-border);
  background: var(--ink-raised);
  color: var(--ink-text);
}

.next {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.next a {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 40px 16px 18px;
  transition: background-color 0.15s ease;
}

.next a + a {
  border-left: 1px solid var(--border);
}

.next a:hover {
  background: var(--surface-raised);
}

.next span {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.next em {
  color: var(--text-muted);
  font-size: 13px;
  font-style: normal;
}

.next svg {
  position: absolute;
  right: 16px;
  top: 18px;
  width: 14px;
  height: 14px;
  color: var(--accent);
  transition: transform 0.15s ease;
}

.next a:hover svg {
  transform: translateX(3px);
}

/* Community */

.community {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 36px;
}

.community a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 0.15s ease;
}

.community a:hover {
  border-color: color-mix(in oklab, var(--accent) 50%, var(--border));
}

.community-n {
  margin-bottom: 32px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
}

.community a > span:not(.community-n) {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.community em {
  color: var(--text-muted);
  font-size: 14px;
  font-style: normal;
  line-height: 1.5;
}

/* Footer */

.foot {
  padding: 64px 0 32px;
  background: var(--ink-bg);
  color: var(--ink-muted);
  border-top: 1px solid var(--ink-border);
}

.foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 48px;
}

.foot-brand p {
  margin-top: 12px;
  font-size: 14px;
}

.foot-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, auto));
  gap: 48px;
}

.foot-cols div {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.foot-h {
  color: var(--ink-strong);
  font-size: 13px;
  font-weight: 600;
}

.foot-cols a {
  font-size: 14px;
  transition: color 0.15s ease;
}

.foot-cols a:hover {
  color: var(--ink-strong);
}

.foot-base {
  margin-top: 56px;
}

.foot-base p {
  padding-top: 20px;
  border-top: 1px solid var(--ink-border);
  font-size: 13px;
}

/* Responsive */

@media (max-width: 1080px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 48px;
  }

  .hero h1 {
    max-width: 13em;
    font-size: clamp(40px, 7vw, 68px);
  }

  .monitor-fig {
    max-width: 600px;
  }

  .sect-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .sect-label {
    position: static;
    justify-self: start;
    padding-right: 24px;
  }

  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 36px;
  }

  .step:nth-child(2)::before {
    right: 0;
    background: linear-gradient(to right, var(--border-strong), transparent);
  }

  .community {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .next {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .next a:nth-child(3) {
    border-left: 0;
  }

  .next a:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

}

@media (max-width: 900px) {
  .nav-links {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin: 0;
    padding: 8px var(--gutter) 16px;
    border-bottom: 1px solid var(--ink-border);
    background: var(--ink-bg);
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    padding: 10px 8px;
    font-size: 15px;
  }

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

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

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

  .cols-3 > * + * {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

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

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

  .log-after {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

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

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }

  .term-tabs {
    gap: 0;
  }

  .term-tabs button {
    padding: 0 5px;
  }

  .hero {
    padding: calc(var(--nav-h) + 40px) 0 64px;
  }

  .hero-lede,
  .sect-lede {
    font-size: 16px;
  }

  .hero-meta-sep {
    display: none;
  }

  .hero-meta-license {
    display: block;
  }

  .nav-gh span {
    display: none;
  }

  .nav-gh {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .monitor {
    padding: 12px;
  }

  .arms {
    column-gap: 8px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .arms-vs {
    display: none;
  }

  .arm {
    padding: 8px 10px 9px;
  }

  .arm-kind {
    letter-spacing: 0.02em;
  }

  .arm-val {
    font-size: 17px;
  }

  .chart {
    padding-left: 40px;
  }

  .chart-plot {
    height: 160px;
  }

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

  .msg-avatar {
    display: none;
  }

  .sect {
    padding: 72px 0;
  }

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

  .step::before,
  .step:nth-child(2)::before {
    right: 0;
  }

  .mgroup {
    padding: 8px 14px 10px;
  }

  .mgroup th:nth-child(2),
  .mgroup td:nth-child(2) {
    width: 84px;
    padding-left: 8px;
  }

  .mgroup th:last-child,
  .mgroup td:last-child {
    width: 64px;
  }

  .log-delta li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .log-delta li > :nth-child(2) {
    grid-column: 1;
    grid-row: 2;
    font-size: 12px;
  }

  .log-delta li > :last-child {
    grid-row: 1 / span 2;
    align-self: center;
  }

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

  .next a + a,
  .next a:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .community a {
    min-height: 0;
  }

  .foot-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .st-flow {
    display: none;
  }
}
