:root {
  --day-paper: #F4F6F5;
  --day-ink: #1A1D2E;
  --day-ink-soft: #545B6D;
  --day-rule: #D3D9D7;
  --day-main: #2F5FD7;
  --day-gate: #D9600F;
  --day-shepherd: #7B4FD6;
  --day-memory: #12866A;

  --night-paper: #10131D;
  --night-ink: #E7EAF2;
  --night-ink-soft: #9CA3B6;
  --night-rule: #2A3040;
  --night-main: #6C9CFC;
  --night-gate: #FF9457;
  --night-shepherd: #B49CF8;
  --night-memory: #46D49E;

  --paper: var(--day-paper);
  --ink: var(--day-ink);
  --ink-soft: var(--day-ink-soft);
  --rule: var(--day-rule);
  --line-main: var(--day-main);
  --line-gate: var(--day-gate);
  --line-shepherd: var(--day-shepherd);
  --line-memory: var(--day-memory);

  --font: "Overpass", "Segoe UI", system-ui, sans-serif;
  --measure: 34em;
  --gutter: 16px;
  color-scheme: light;
}

.invert {
  --paper: var(--night-paper);
  --ink: var(--night-ink);
  --ink-soft: var(--night-ink-soft);
  --rule: var(--night-rule);
  --line-main: var(--night-main);
  --line-gate: var(--night-gate);
  --line-shepherd: var(--night-shepherd);
  --line-memory: var(--night-memory);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: var(--night-paper);
    --ink: var(--night-ink);
    --ink-soft: var(--night-ink-soft);
    --rule: var(--night-rule);
    --line-main: var(--night-main);
    --line-gate: var(--night-gate);
    --line-shepherd: var(--night-shepherd);
    --line-memory: var(--night-memory);
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .invert {
    --paper: var(--day-paper);
    --ink: var(--day-ink);
    --ink-soft: var(--day-ink-soft);
    --rule: var(--day-rule);
    --line-main: var(--day-main);
    --line-gate: var(--day-gate);
    --line-shepherd: var(--day-shepherd);
    --line-memory: var(--day-memory);
    color-scheme: light;
  }
}

:root[data-theme="dark"] {
  --paper: var(--night-paper);
  --ink: var(--night-ink);
  --ink-soft: var(--night-ink-soft);
  --rule: var(--night-rule);
  --line-main: var(--night-main);
  --line-gate: var(--night-gate);
  --line-shepherd: var(--night-shepherd);
  --line-memory: var(--night-memory);
  color-scheme: dark;
}
:root[data-theme="dark"] .invert {
  --paper: var(--day-paper);
  --ink: var(--day-ink);
  --ink-soft: var(--day-ink-soft);
  --rule: var(--day-rule);
  --line-main: var(--day-main);
  --line-gate: var(--day-gate);
  --line-shepherd: var(--day-shepherd);
  --line-memory: var(--day-memory);
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.55;
  overflow-x: hidden;
}

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

a { color: inherit; }

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

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  z-index: 10;
}
.skip:focus { top: 8px; }

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

@media (min-width: 720px) {
  :root { --gutter: 40px; }
}

/* Map stroke and marker classes, shared by the SVG map, legend and brand mark */
.ln-main { stroke: var(--line-main); fill: none; }
.ln-gate { stroke: var(--line-gate); fill: none; }
.ln-shepherd { stroke: var(--line-shepherd); fill: none; }
.ln-memory { stroke: var(--line-memory); fill: none; }
.tick-main { fill: var(--line-main); }
.tick-gate { fill: var(--line-gate); }
.tick-shepherd { fill: var(--line-shepherd); }
.ring { fill: var(--paper); stroke: var(--ink); stroke-width: 3.5; }

/* Shared type */
.section-intro h2, .fit h2, .contact h2 {
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.section-intro p, .contact p {
  margin-top: 18px;
  max-width: var(--measure);
  color: var(--ink-soft);
}

.button {
  display: inline-block;
  padding: 14px 22px 11px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.button:hover { background: var(--line-main); color: #fff; }

.text-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  text-decoration-color: var(--line-main);
  cursor: pointer;
}
.text-link:hover { text-decoration-thickness: 3px; }

/* Header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.375rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand-mark { width: 34px; height: 20px; }

.top nav { display: flex; gap: 18px; font-size: 1rem; }
.top nav a {
  text-decoration: none;
  text-underline-offset: 5px;
  text-decoration-thickness: 2px;
}
.top nav a:hover { text-decoration-line: underline; }

@media (max-width: 420px) {
  .top nav a[href="#route"] { display: none; }
}

/* Hero */
.hero {
  display: grid;
  gap: 48px;
  padding-block: 40px 72px;
}

.hero h1 {
  font-size: clamp(2.75rem, 1.6rem + 4.6vw, 4.75rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.035em;
  max-width: 9em;
  text-wrap: balance;
}

.lede {
  margin-top: 24px;
  max-width: var(--measure);
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.hero-actions {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
}

@media (min-width: 1080px) {
  .hero {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: center;
    gap: 56px;
    padding-block: 64px 112px;
  }
  .hero h1 { font-size: clamp(3.5rem, 1rem + 4vw, 4.5rem); max-width: none; }
  .lede { font-size: 1.3125rem; }
  .hero .app { padding-bottom: 150px; }
}

/* The inbox, drawn in the app's own dark theme in either page theme */
.app {
  --app-bg: #0B0E13;
  --app-card: #131820;
  --app-border: #29303B;
  --app-fg: #E6EAF0;
  --app-muted: #8B95A3;
  --app-info: #6C9CFC;
  --app-success: #46D49E;
  --app-warning: #F2C14E;
  --app-danger: #F4776F;
  --app-signal: #FF9457;
  --app-merged: #B49CF8;
  position: relative;
  background: var(--app-bg);
  color: var(--app-fg);
  border: 1px solid var(--app-border);
  border-radius: 14px;
  padding: 18px 18px 22px;
  font-size: 0.875rem;
  line-height: 1.35;
  box-shadow: 0 40px 70px -40px rgba(16, 19, 29, 0.55);
  overflow: hidden;
  isolation: isolate;
}

.app-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.app-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  font-size: 1.25rem;
  font-weight: 700;
}
.app-title svg { width: 20px; height: 20px; color: var(--app-info); }
.app-pill {
  padding: 3px 10px 2px;
  border: 1px solid var(--app-border);
  border-radius: 999px;
  color: var(--app-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.app-head, .app-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.5rem 4.5rem;
  align-items: center;
  gap: 12px;
}
.app-head {
  padding: 8px 12px;
  border: 1px solid var(--app-border);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--app-card);
  color: var(--app-muted);
  font-size: 0.75rem;
}
.app-rows {
  list-style: none;
  padding: 0;
  border: 1px solid var(--app-border);
  border-radius: 0 0 10px 10px;
  background: var(--app-card);
}
.app-row {
  padding: 11px 12px;
  border-top: 1px solid var(--app-border);
  max-height: 80px;
  transition: max-height 0.5s ease, padding 0.5s ease, opacity 0.5s ease 0.15s, background-color 1.2s ease;
}
.app-row:first-child { border-top: 0; }
.app-row.is-hidden { max-height: 0; padding-block: 0; opacity: 0; overflow: hidden; }
.app-row.is-fresh { background-color: color-mix(in srgb, var(--app-info) 12%, transparent); transition-duration: 0.5s, 0.5s, 0.5s, 0s; }

.app-issue {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 8px;
}
.app-key { color: var(--app-muted); font-size: 0.75rem; align-self: center; font-variant-numeric: tabular-nums; }
.app-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.app-src { grid-column: 2; color: var(--app-muted); font-size: 0.75rem; }

.badge, .conf {
  justify-self: start;
  padding: 2px 7px 1px;
  border: 1px solid currentColor;
  border-radius: 5px;
  font-size: 0.75rem;
  white-space: nowrap;
  background-color: color-mix(in srgb, currentColor 14%, transparent);
  transition: color 0.3s ease;
}
.badge[data-state="triage"], .badge[data-state="queued"] { color: var(--app-muted); }
.badge[data-state="planning"] { color: var(--app-info); }
.badge[data-state="plan-gate"] { color: var(--app-warning); }
.badge[data-state="coding"] { color: var(--app-info); }
.badge[data-state="review"] { color: var(--app-signal); }
.badge[data-state="merged"] { color: var(--app-merged); }
.badge[data-state="blocked"] { color: var(--app-danger); }
.badge[data-state="coding"]::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
  animation: blink 1.4s ease-in-out infinite;
}
.badge[data-state="planning"] {
  background-image: linear-gradient(90deg, transparent, color-mix(in srgb, var(--app-info) 35%, transparent), transparent);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}

.conf { font-variant-numeric: tabular-nums; }
.conf[data-band="low"] { color: var(--app-danger); }
.conf[data-band="mid"] { color: var(--app-warning); }
.conf[data-band="high"] { color: var(--app-success); }
.conf--none { border-color: transparent; background: none; color: var(--app-muted); }

.app-toast {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: min(300px, calc(100% - 28px));
  padding: 14px 16px;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  background: var(--app-card);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.6);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.app-toast.is-hidden { opacity: 0; transform: translateY(16px); }
.toast-title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.toast-title svg { width: 16px; height: 16px; color: var(--app-info); }
.toast-text { margin-top: 4px; color: var(--app-muted); font-size: 0.8125rem; }
.toast-actions { margin-top: 10px; display: flex; gap: 16px; align-items: center; color: var(--app-muted); font-size: 0.8125rem; }
.toast-open { padding: 4px 12px 3px; border-radius: 6px; background: var(--app-info); color: #0B0E13; font-weight: 700; }

@media (max-width: 560px) {
  .app { padding: 14px 12px 16px; }
  .app-head, .app-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
  .app-head span:nth-child(2), .app-head span:nth-child(3) { display: none; }
  .app-pill:not(#app-running) { display: none; }
  .app-toast { position: static; width: auto; margin-top: 12px; }
  .app-toast.is-hidden { display: none; }
}

@keyframes blink { 50% { opacity: 0.25; } }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* The route */
.route { padding-block: 24px 112px; }

.legend {
  list-style: none;
  padding: 0;
  margin-top: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.legend li { display: inline-flex; align-items: center; gap: 10px; }
.legend svg { width: 28px; height: 20px; flex: none; }

.map {
  position: relative;
  margin-top: 28px;
  min-height: 200px;
  overflow-x: clip;
  overflow-clip-margin: 12px;
}

.map-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.map-note {
  fill: var(--ink-soft);
  font-family: var(--font);
  font-size: 14px;
  font-style: italic;
}

.map .marker, .map .map-note, .map .stop, .map .ln-memory {
  opacity: 0;
  transition: opacity 0.45s ease var(--d, 0s);
}
.map.is-live .marker, .map.is-live .map-note, .map.is-live .stop, .map.is-live .ln-memory { opacity: 1; }

.ripple {
  fill: none;
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  animation: ripple 0.9s ease-out forwards;
  pointer-events: none;
}
@keyframes ripple {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(3.4); opacity: 0; }
}

.stop {
  --c: var(--line-main);
  position: absolute;
  left: var(--x);
  top: var(--y);
  margin: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  padding: 0;
}
.stop[data-line="gate"] { --c: var(--line-gate); }
.stop[data-line="shepherd"] { --c: var(--line-shepherd); }

.stop span {
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
  transition: text-decoration-color 0.2s ease;
}
.stop:hover span { text-decoration-color: var(--rule); }
.stop[aria-pressed="true"] span { text-decoration-color: var(--c); }

.stop--below { transform: translate(-50%, -14px); padding-top: 26px; }
.stop--above { transform: translate(-50%, calc(-100% + 14px)); padding-bottom: 26px; }
.stop--left { transform: translate(calc(-100% + 14px), -50%); padding-right: 30px; text-align: right; }
.stop--right { transform: translate(-14px, -50%); padding-left: 30px; }
.stop--below, .stop--above { padding-inline: 4px; }
.stop--left, .stop--right { padding-block: 6px; }

.token {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  padding: 3px 9px 1px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.8125rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  pointer-events: none;
  z-index: 2;
}

.token--dot {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 4px solid var(--paper);
  font-size: 0;
}

.map-fallback { padding-left: 1.25em; }

.board {
  --c: var(--line-main);
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 12px 48px;
  min-height: 15rem;
}
.board[data-line="gate"] { --c: var(--line-gate); }
.board[data-line="shepherd"] { --c: var(--line-shepherd); }
.board[data-line="memory"] { --c: var(--line-memory); }

.board-name {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.board-who {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.board-who svg { width: 28px; height: 20px; flex: none; }

.board-body { max-width: var(--measure); }
.board.is-changed .board-head, .board.is-changed .board-note, .board.is-changed .board-text {
  animation: board-in 0.32s ease-out;
}
@keyframes board-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.board-note {
  padding-left: 14px;
  border-left: 4px solid var(--c);
  font-weight: 600;
  margin-bottom: 10px;
}

.board-text { color: var(--ink-soft); }

.board-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
}

@media (min-width: 720px) {
  .board { grid-template-columns: minmax(12rem, 1fr) 2fr; min-height: 12rem; }
}

/* The score, on an inverted band */
.score {
  background: var(--paper);
  color: var(--ink);
  padding-block: 104px 112px;
}

.checks-head, .check {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) 28px;
  gap: 8px 32px;
}
.checks-head {
  margin-top: 56px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.checks { list-style: none; padding: 0; }
.check {
  padding-block: 20px;
  border-bottom: 1px solid var(--rule);
  transition: opacity 0.4s ease;
}
.check-what strong { display: block; font-size: 1.125rem; font-weight: 800; }
.check-what span { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 0.9375rem; }
.check-found { font-size: 1rem; }
.check-mark {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--line-main);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.45s ease 0.15s;
}
.checks.is-running .check:not(.is-done) { opacity: 0.3; }
.checks.is-running .check:not(.is-done) .check-mark { stroke-dashoffset: 24; }

@media (max-width: 719px) {
  .checks-head { display: none; }
  .check { grid-template-columns: minmax(0, 1fr) 28px; margin-top: 0; }
  .check-what { grid-column: 1; }
  .check-found { grid-column: 1; }
  .check-mark { grid-column: 2; grid-row: 1; }
  .checks { margin-top: 40px; border-top: 1px solid var(--rule); }
}

.result {
  margin-top: 48px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.result-label { font-size: 1.125rem; font-weight: 800; }
.result-value {
  font-size: clamp(2.5rem, 2rem + 2vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.calibrated {
  margin-top: 56px;
  max-width: var(--measure);
  color: var(--ink-soft);
}

.scale { margin-top: 64px; }

.scale-track {
  position: relative;
  display: flex;
  height: 10px;
  gap: 4px;
}
.seg { height: 100%; border-radius: 5px; }
.seg-stop {
  flex: 40;
  background: repeating-linear-gradient(90deg, var(--line-gate) 0 10px, transparent 10px 16px);
}
.seg-wait { flex: 30; background: var(--line-gate); }
.seg-go { flex: 30; background: var(--line-main); }

.scale-pin {
  position: absolute;
  left: var(--at);
  top: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--paper);
  border: 4px solid var(--ink);
}
.scale-pin span {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.scale-bands {
  list-style: none;
  padding: 0;
  margin-top: 18px;
  display: grid;
  gap: 14px;
  font-size: 1rem;
  color: var(--ink-soft);
}
.scale-bands li { opacity: 0.55; transition: opacity 0.25s ease; }
.scale-bands li.is-current { opacity: 1; color: var(--ink); }
.scale-bands strong {
  display: block;
  color: var(--ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 719px) {
  .scale-pin span { left: auto; right: -12px; transform: none; }
}

@media (min-width: 720px) {
  .scale-bands {
    grid-template-columns: 40fr 30fr 30fr;
    gap: 4px;
  }
  .scale-bands li { padding-right: 16px; }
}

#score-replay { margin-top: 28px; }

/* Fit */
.fit { padding-block: 112px 24px; }

.roles {
  margin-top: 40px;
  display: grid;
  font-size: clamp(1.75rem, 1.2rem + 2.6vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.12;
  color: var(--ink-soft);
}
.roles-line { display: block; }

.swap {
  display: inline-block;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-main);
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.12em;
}
.swap.is-out { animation: swap-out 0.22s ease-in forwards; }
.swap.is-in { animation: swap-in 0.3s ease-out; }
@keyframes swap-out { to { opacity: 0; transform: translateY(-0.35em); } }
@keyframes swap-in { from { opacity: 0; transform: translateY(0.35em); } }

.fit-cols {
  margin-top: 56px;
  display: grid;
  gap: 32px 48px;
}
.fit h3 { font-size: 1.125rem; font-weight: 800; }
.fit-cols p { margin-top: 6px; color: var(--ink-soft); }

@media (min-width: 900px) {
  .fit-cols { grid-template-columns: repeat(3, 1fr); }
}

/* Contact */
.contact { padding-block: 112px 96px; }
.contact .button { margin-top: 28px; }

.foot {
  padding-block: 0 40px;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.foot p { padding-top: 24px; border-top: 1px solid var(--rule); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
