/* Steadygate live demo. Theme tokens first; everything else uses them. */

:root {
  --bg: #f7f8fa;
  --fg: #1a1d23;
  --muted: #5d6573;
  --card: #ffffff;
  --border: #d9dde4;
  --pass: #116329;
  --fail: #cf222e;
  --warn: #7d5300;
  --accent: #3b5bdb;
  --accent-fg: #ffffff;
  --code-bg: #eef0f4;
  --pass-bg: #e6f4ea;
  --fail-bg: #fdecee;
  --warn-bg: #fdf3d8;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 2px 8px rgba(16, 24, 40, 0.05);
  --radius: 10px;
  --gutter: 16px;
  --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;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --fg: #e6e8eb;
    --muted: #9aa3b0;
    --card: #171b21;
    --border: #2c333d;
    --pass: #3fb950;
    --fail: #ff7b72;
    --warn: #d29922;
    --accent: #7c9bff;
    --accent-fg: #0f1216;
    --code-bg: #1f252d;
    --pass-bg: rgba(63, 185, 80, 0.14);
    --fail-bg: rgba(255, 123, 114, 0.12);
    --warn-bg: rgba(210, 153, 34, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 var(--font);
  overflow-wrap: break-word;
}

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

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

:not(pre) > code {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0 0 0.75em;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  background: var(--card);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  z-index: 10;
}

.skip:focus {
  top: 0.5rem;
}

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

/* Hero */

.hero {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.eyebrow {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(2rem, 7vw, 3.25rem);
  letter-spacing: -0.02em;
}

.hero h1 span {
  display: inline-block;
}

.lede {
  font-size: 1.125rem;
  color: var(--muted);
  max-width: 60ch;
}

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

.verdict-chip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.9rem;
}

.verdict-chip strong {
  color: var(--fg);
}

.verdict-chip .exit {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.chip-note {
  color: var(--muted);
  font-size: 0.8rem;
}

.chip-note::before {
  content: "· ";
}

.is-pass {
  color: var(--pass);
  background: var(--pass-bg);
}

.is-fail {
  color: var(--fail);
  background: var(--fail-bg);
}

.is-warn {
  color: var(--warn);
  background: var(--warn-bg);
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

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

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

/* How it works */

.how {
  padding-top: 2.5rem;
}

.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.step p {
  margin: 0;
  color: var(--muted);
}

.step-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  color: var(--fg);
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-right: 0.25rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.8rem;
  vertical-align: 0.1em;
}

@media (min-width: 760px) {
  .steps {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

.section-lede {
  color: var(--muted);
  max-width: 62ch;
}

/* Demo */

.demo {
  margin-top: 2.5rem;
  padding: 2.5rem 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 0;
}

.demo-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr);
  /* On a phone the knobs sit right above the output, so moving one shows the verdict. */
  grid-template-areas:
    "pick"
    "knobs"
    "output";
}

.demo-pick {
  grid-area: pick;
  min-width: 0;
}

.demo-knobs {
  grid-area: knobs;
  min-width: 0;
}

.demo-output {
  grid-area: output;
  min-width: 0;
}

@media (min-width: 760px) {
  .demo-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-areas:
      "pick output"
      "knobs output";
    grid-template-rows: auto 1fr;
    align-items: start;
  }
}

.suite-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--code-bg);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.suite-tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.5rem 0.5rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.suite-tab[aria-pressed="true"] {
  background: var(--card);
  color: var(--fg);
  box-shadow: var(--shadow);
}

.scenarios {
  display: grid;
  gap: 0.5rem;
}

.scenario {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}

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

.scenario[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.scenario-label {
  display: block;
  font-weight: 600;
}

.scenario-caption {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.15rem;
}

/* Live knobs */

.demo-knobs {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0.85rem 1rem 1rem;
}

.knobs-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.knobs {
  min-height: 8rem;
}

.status-note {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

.status-note:empty {
  display: none;
}

.status-note::before {
  content: "";
  flex: 0 0 auto;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-0.05rem);
}

.status-note[data-state="loading"]::before {
  background: var(--warn);
  animation: pulse 1.2s ease-in-out infinite;
}

.status-note[data-state="ready"]::before {
  background: var(--pass);
}

.status-note[data-state="ready"] {
  color: var(--fg);
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-note[data-state="loading"]::before {
    animation: none;
  }
}

.knob-cases {
  display: grid;
  gap: 0.6rem;
}

.knob-case {
  min-width: 0;
}

.knob-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
}

.knob-name {
  font-size: 0.9rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.knob-value {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.knob-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.1rem;
}

.toggle,
.step-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  border-radius: 6px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.toggle {
  padding: 0.15rem 0.6rem;
  min-height: 1.9rem;
}

.toggle:hover:not(:disabled),
.step-btn:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: var(--accent);
}

.toggle[aria-pressed="true"][data-toggle="crashed"] {
  border-color: var(--fail);
  background: var(--fail-bg);
  color: var(--fail);
}

.toggle[aria-pressed="true"][data-toggle="dropped"] {
  border-color: var(--warn);
  background: var(--warn-bg);
  color: var(--warn);
}

.toggle:disabled,
.step-btn:disabled,
.step-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
}

.knob-case input[type="range"] {
  display: block;
  width: 100%;
  margin: 0.25rem 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.knob-case input[type="range"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.knob-case.is-dropped .knob-name,
.knob-case.is-dropped .knob-value {
  text-decoration: line-through;
  color: var(--muted);
}

.knob-latency {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.knob-hint {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.knob-stepper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-btn {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.1rem;
  line-height: 1;
}

.stepper-value {
  min-width: 6.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stepper-value strong {
  color: var(--fg);
  font-size: 1rem;
}

.loading,
.demo-error {
  color: var(--muted);
}

/* Output panel */

.output-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  transition: opacity 0.15s;
}

.output-body.is-stale {
  opacity: 0.5;
}

.engine-error {
  border: 1px solid var(--fail);
  background: var(--fail-bg);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.engine-error pre {
  white-space: pre-wrap;
  margin: 0.5rem 0 0;
}

.badge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 2px solid currentColor;
}

.badge-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.badge-text {
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--fg);
}

.badge-exit {
  flex-basis: 100%;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.badge-summary {
  flex-basis: 100%;
  margin: 0;
  color: var(--fg);
  font-size: 0.9rem;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 0.85rem 1rem;
  min-width: 0;
}

.panel-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

/* History strip */

.history svg {
  display: block;
  width: 100%;
  height: auto;
  color: var(--fg);
}

.history .axis {
  stroke: var(--border);
}

.history .median {
  stroke: var(--accent);
  stroke-width: 2;
}

.history .tolerance {
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.history .base-dot {
  fill: var(--fg);
}

.history .cand-dot {
  stroke: var(--card);
  stroke-width: 2;
}

.history .cand-dot.is-pass {
  fill: var(--pass);
}

.history .cand-dot.is-fail {
  fill: var(--fail);
}

.history .cand-dot.is-warn {
  fill: var(--warn);
}

.history text {
  fill: var(--muted);
  font-family: var(--font);
  font-size: 12px;
}

.history text.label-median {
  fill: var(--accent);
}

.history text.label-cand {
  fill: var(--fg);
  font-weight: 700;
}

.history-note {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* PR comment card, styled after a GitHub comment */

.pr {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.pr-avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  margin-top: 2px;
}

.pr-card {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}

.pr-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  padding: 0.45rem 0.75rem;
  background: var(--code-bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.pr-head .who {
  font-weight: 700;
}

.pr-head .bot {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.pr-head .when {
  color: var(--muted);
  font-weight: 400;
}

.md-toggle {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  border-radius: 6px;
  padding: 0.15rem 0.55rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.pr-body {
  padding: 0.75rem;
  font-size: 0.9rem;
}

.pr-body h3 {
  font-size: 1.05rem;
  margin: 0 0 0.6rem;
}

.pr-body table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
}

.pr-body th,
.pr-body td {
  border: 1px solid var(--border);
  padding: 0.3rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

.pr-body th {
  background: var(--code-bg);
}

.pr-body details {
  margin: 0 0 0.75rem;
}

.pr-body summary {
  cursor: pointer;
  font-weight: 600;
}

.pr-body ul {
  margin: 0.4rem 0 0;
  padding-left: 1.25rem;
}

.pr-body sub {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  vertical-align: baseline;
}

.md-raw {
  margin: 0;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--code-bg);
  overflow-x: auto;
  white-space: pre;
  font-size: 0.78rem;
}

/* Install */

.install {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.code-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
  box-shadow: var(--shadow);
  max-width: 760px;
}

.code-head {
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--code-bg);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.code-card pre {
  margin: 0;
  padding: 0.85rem;
  overflow-x: auto;
  line-height: 1.5;
}

.links {
  margin-top: 1rem;
}

/* Plain-language setup and checks */

.setup {
  padding-top: 2.5rem;
  scroll-margin-top: 1rem;
}

.explain {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (min-width: 760px) {
  .explain {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.explain-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.explain-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.explain-card p {
  margin: 0;
  color: var(--muted);
}

.suite-intro,
.knobs-lede {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.pick-title {
  margin: 1rem 0 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.tech-toggle {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font: inherit;
  font-size: 0.75rem;
  white-space: nowrap;
  cursor: pointer;
}

.tech-toggle[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.check {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.check-mark {
  border-radius: 6px;
  padding: 0 0.2rem;
  flex: 0 0 auto;
  line-height: 1.4;
}

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

.check-q {
  margin: 0;
  font-weight: 600;
}

.check-opt {
  margin-left: 0.4rem;
  padding: 0 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.check-a {
  margin: 0.15rem 0 0;
  color: var(--fg);
  font-size: 0.92rem;
}

.check-tech {
  display: none;
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.checks.show-tech .check-tech {
  display: block;
}

.pr-wrap > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 0;
}

.pr-wrap[open] > summary {
  margin-bottom: 0.5rem;
}

/* Footer */

.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer p {
  margin: 0 0 0.35rem;
}

.footer-note {
  color: var(--fg);
  font-weight: 600;
}

/* Install and audience */

.install-note {
  margin: 0.9rem 0 0;
  max-width: 46rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.install-soon {
  display: inline-block;
  box-sizing: border-box;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 0.65rem 1.1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
  text-decoration: none;
}

.who {
  padding-top: 2.5rem;
}

.not-for {
  margin: 1rem 0 0;
  color: var(--muted);
  font-style: italic;
}

.downloads {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
}

.downloads[hidden] {
  display: none;
}

.downloads li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
}

.download-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.trust {
  padding-top: 0.5rem;
  padding-bottom: 2.5rem;
}

.trust-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.trust-list li {
  position: relative;
  padding: 0.65rem 0.9rem 0.65rem 2.4rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.trust-list li::before {
  content: "\2713";
  position: absolute;
  left: 0.9rem;
  color: var(--pass);
  font-weight: 700;
}

@media (min-width: 760px) {
  .trust-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.install-soon code,
.install-note code,
.download-note code {
  overflow-wrap: anywhere;
  word-break: break-all;
}
