:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-muted: #f1f3f8;
  --border: #e3e6ee;
  --text: #161b2c;
  --text-muted: #5f677b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0fe;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;

  /* Статусы прогона — фиксированная статусная палитра */
  --passed: #0ca30c;
  --failed: #d03b3b;
  --broken: #ec835a;
  --skipped: #a3a7b3;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);

  color-scheme: light;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1120;
    --surface: #161a2c;
    --surface-muted: #1c2136;
    --border: #283049;
    --text: #e8eaf3;
    --text-muted: #9ca3b9;
    --primary: #7c74ff;
    --primary-hover: #918aff;
    --primary-soft: #252a4b;
    --grid: #2c2c2a;
    --baseline: #383835;
    --skipped: #6b7183;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
  padding: 1px 5px;
  background: var(--surface-muted);
  border-radius: 5px;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

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

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.topnav {
  display: flex;
  gap: 24px;
}

.topnav a {
  color: var(--text-muted);
  font-size: 0.94rem;
  font-weight: 500;
  text-decoration: none;
}

.topnav a:hover {
  color: var(--text);
}

/* ---------- Hero ---------- */

.hero {
  padding-top: 72px;
  padding-bottom: 32px;
}

.eyebrow {
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

h1 {
  max-width: 760px;
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.lead {
  max-width: 680px;
  margin-top: 20px;
  font-size: 1.12rem;
  color: var(--text-muted);
}

.hero-actions,
.author-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 11px 18px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background-color 0.15s, border-color 0.15s;
}

.btn:focus-visible,
.topnav a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  color: #fff;
  background: var(--primary);
}

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

.btn-secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-muted);
}

/* ---------- Sections ---------- */

.section {
  padding-top: 56px;
}

.section-head {
  margin-bottom: 20px;
}

h2 {
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.section-head p {
  margin-top: 6px;
}

h3 {
  font-size: 1.08rem;
  margin-bottom: 4px;
}

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

.grid {
  display: grid;
  gap: 16px;
}

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

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.principles {
  margin-top: 28px;
  gap: 28px;
}

.principles p {
  font-size: 0.95rem;
}

.checks {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.checks li {
  position: relative;
  padding-left: 26px;
  margin-top: 10px;
}

.checks li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.45em;
  width: 12px;
  height: 7px;
  border-left: 2px solid var(--passed);
  border-bottom: 2px solid var(--passed);
  transform: rotate(-45deg);
}

/* ---------- Status ---------- */

.stats {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.stat-hero .stat-value {
  font-size: 2.6rem;
}

.status-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--surface-muted);
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.ok::before {
  background: var(--passed);
}

.status-pill.bad::before {
  background: var(--failed);
}

.key {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.key-passed {
  background: var(--passed);
}

.key-failed {
  background: var(--failed);
}

.key-broken {
  background: var(--broken);
}

.key-skipped {
  background: var(--skipped);
}

.chart-card {
  position: relative;
  margin: 0;
}

.chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-title {
  font-weight: 600;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart svg {
  display: block;
  width: 100%;
  height: 220px;
  overflow: visible;
}

.chart .grid-line {
  stroke: var(--grid);
  stroke-width: 1;
}

.chart .baseline {
  stroke: var(--baseline);
  stroke-width: 1;
}

.chart .tick {
  font-size: 11px;
  fill: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.chart .hit {
  fill: transparent;
  cursor: default;
}

.chart .col.dim {
  opacity: 0.45;
}

.tooltip {
  position: absolute;
  z-index: 5;
  min-width: 150px;
  padding: 10px 12px;
  font-size: 0.85rem;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.tooltip strong {
  display: block;
  margin-bottom: 4px;
}

.tooltip .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tooltip .row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.tooltip b {
  font-variant-numeric: tabular-nums;
}

.table-view {
  margin-top: 12px;
  font-size: 0.9rem;
}

.table-view summary {
  cursor: pointer;
  color: var(--text-muted);
}

.table-view table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.table-view th,
.table-view td {
  padding: 6px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.table-view th:first-child,
.table-view td:first-child {
  text-align: left;
}

.notice {
  color: var(--text-muted);
}

/* ---------- Pipeline ---------- */

.pipeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.pipeline li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px;
  font-size: 0.92rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pipeline li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -10px;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--baseline);
  border-right: 2px solid var(--baseline);
  transform: translateY(-50%) rotate(45deg);
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 6px 12px;
  font-size: 0.88rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* ---------- Author ---------- */

.author {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
}

.author-role {
  margin: 4px 0 12px;
  font-weight: 600;
}

.author-links {
  margin-top: 20px;
}

.footer {
  padding-top: 48px;
  padding-bottom: 40px;
  font-size: 0.88rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-hero {
    grid-column: 1 / -1;
  }

  .pipeline {
    grid-template-columns: 1fr;
  }

  .pipeline li:not(:last-child)::after {
    top: auto;
    right: auto;
    bottom: -10px;
    left: 28px;
    transform: rotate(135deg);
  }
}

@media (max-width: 720px) {
  .container {
    padding: 0 16px;
  }

  .topnav {
    display: none;
  }

  .hero {
    padding-top: 40px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .author {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
