:root {
  color-scheme: light dark;

  --bg: hsl(0, 9%, 7%);
  --surface: hsl(0, 6%, 10%);
  --surface-elevated: hsl(0, 6%, 14%);
  --text: hsl(0, 15%, 94%);
  --body-text: hsl(0, 4%, 74%);
  --muted: hsl(0, 3%, 62%);
  --subtle: hsl(0, 2%, 49%);
  --rule: hsl(0, 3%, 28%);
  --rule-subtle: hsl(0, 4%, 19%);
  --tint: #7fd858;
  --tint-hover: #9be47a;

  --ok: #7fd858;
  --ok-bg: rgba(127, 216, 88, 0.12);
  --warn: #e5b552;
  --warn-bg: rgba(229, 181, 82, 0.12);
  --danger: #d47455;
  --danger-bg: rgba(212, 116, 85, 0.14);

  --helmet-shell: #f1ecec;
  --helmet-shade: #b7b1b1;
  --helmet-visor: #131010;
  --helmet-stroke: #4b4646;
  --helmet-glint: #f1ecec;

  --font-mono: "Berkeley Mono", "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
  --font-sans: var(--font-mono);
  --font-display: var(--font-mono);

  --reading-width: 1080px;
  --wide-width: 1080px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: hsl(0, 20%, 99%);
    --surface: hsl(0, 8%, 95%);
    --surface-elevated: hsl(0, 8%, 90%);
    --text: hsl(0, 5%, 12%);
    --body-text: hsl(0, 2%, 28%);
    --muted: hsl(0, 1%, 42%);
    --subtle: hsl(0, 1%, 56%);
    --rule: hsl(0, 2%, 75%);
    --rule-subtle: hsl(0, 1%, 85%);
    --tint: #2d8a14;
    --tint-hover: #1f660c;

    --ok: #2d8a14;
    --ok-bg: rgba(45, 138, 20, 0.09);
    --warn: #a66a08;
    --warn-bg: rgba(166, 106, 8, 0.09);
    --danger: #b54526;
    --danger-bg: rgba(181, 69, 38, 0.10);
    --helmet-shell: #d8d3d1;
    --helmet-shade: #9e9896;
    --helmet-visor: #181515;
    --helmet-stroke: #3a3535;
    --helmet-glint: #ffffff;
  }
}

html[data-theme="light"] {
  --bg: hsl(0, 20%, 99%);
  --surface: hsl(0, 8%, 95%);
  --surface-elevated: hsl(0, 8%, 90%);
  --text: hsl(0, 5%, 12%);
  --body-text: hsl(0, 2%, 28%);
  --muted: hsl(0, 1%, 42%);
  --subtle: hsl(0, 1%, 56%);
  --rule: hsl(0, 2%, 75%);
  --rule-subtle: hsl(0, 1%, 85%);
  --tint: #2d8a14;
  --tint-hover: #1f660c;
  --ok: #2d8a14;
  --ok-bg: rgba(45, 138, 20, 0.09);
  --warn: #a66a08;
  --warn-bg: rgba(166, 106, 8, 0.09);
  --danger: #b54526;
  --danger-bg: rgba(181, 69, 38, 0.10);
  --helmet-shell: #d8d3d1;
  --helmet-shade: #9e9896;
  --helmet-visor: #181515;
  --helmet-stroke: #3a3535;
  --helmet-glint: #ffffff;
}

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

html {
  background-color: var(--bg);
  color: var(--body-text);
  font-family: var(--font-mono);
  font-size: 14.5px;
  line-height: 1.65;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

@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;
  }
}

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--bg);
  border-bottom: 1px solid var(--rule-subtle);
}

.nav-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 36px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-left: 1px solid var(--rule-subtle);
  border-right: 1px solid var(--rule-subtle);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  min-height: 36px;
}

.brand-logo-svg {
  height: 26px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a,
.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.nav-links a:hover,
.theme-btn:hover {
  color: var(--text);
  background-color: var(--surface);
  border-color: var(--rule-subtle);
}

.nav-links a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
  background-color: var(--surface);
  border-color: var(--rule);
}

.theme-btn {
  border-color: var(--rule-subtle);
}

.nav-links a.btn-primary {
  background-color: var(--text);
  color: var(--bg);
  font-weight: 600;
  padding: 4px 13px;
  margin-left: 4px;
  border-color: var(--text);
}

.nav-links a.btn-primary:hover {
  opacity: 0.9;
  background-color: var(--text);
  color: var(--bg);
}

main {
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: 52px 36px 56px;
  border-left: 1px solid var(--rule-subtle);
  border-right: 1px solid var(--rule-subtle);
}

h1, h2, h3 {
  font-family: var(--font-mono);
  color: var(--text);
  margin: 0;
}

h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.025em;
  margin-bottom: 14px;
}

h2 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.02em;
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid var(--rule-subtle);
  margin-bottom: 14px;
}

.wide-breakout + h2 {
  margin-top: 34px;
}

details.hig-disclosure + h2 {
  border-top: none;
  padding-top: 0;
  margin-top: 28px;
}

h3 {
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 24px;
  margin-bottom: 6px;
}

p {
  margin: 0 0 16px;
  color: var(--body-text);
}

p.lead {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 24px;
}

p.secondary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
}

a:hover {
  color: var(--tint);
  text-decoration-color: var(--tint);
}

strong {
  font-weight: 600;
  color: var(--text);
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background-color: var(--surface);
  color: var(--text);
  padding: 1.5px 5px;
  border-radius: 3px;
  border: 1px solid var(--rule-subtle);
}

h1 code, h2 code, h3 code, strong code {
  color: inherit;
}

pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background-color: var(--surface);
  color: var(--text);
  padding: 16px 18px;
  border-radius: 4px;
  border: 1px solid var(--rule-subtle);
  overflow-x: auto;
  margin: 14px 0 20px;
}

pre code {
  background: none;
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: inherit;
}

.syn-c {
  color: var(--subtle);
}

.syn-p {
  color: var(--ok);
  user-select: none;
  font-weight: 600;
}

.syn-ok {
  color: var(--ok);
  font-weight: 600;
}

.syn-warn {
  color: var(--warn);
  font-weight: 600;
}

.syn-err {
  color: var(--danger);
  font-weight: 600;
}

.syn-flag {
  color: var(--muted);
}

.install-box {
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 14px 16px;
  margin: 20px 0 12px;
}

.segmented-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.segmented-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  background-color: var(--bg);
  padding: 3px;
  border-radius: 4px;
  border: 1px solid var(--rule-subtle);
}

.seg-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 10px;
  min-height: 27px;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn[aria-selected="true"] {
  background-color: var(--surface-elevated);
  color: var(--text);
  border-color: var(--rule);
  font-weight: 600;
}

.cmd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: var(--bg);
  border: 1px solid var(--rule-subtle);
  padding: 10px 14px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.cmd-text {
  overflow-x: auto;
  white-space: nowrap;
}

.cmd-text code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

.cmd-prompt {
  color: var(--ok);
  user-select: none;
  margin-right: 8px;
}

.copy-action {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background-color: var(--surface-elevated);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 5px 11px;
  min-height: 28px;
  cursor: pointer;
  flex-shrink: 0;
}

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

.install-caption {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.wide-breakout {
  width: 100%;
  margin-top: 20px;
  margin-bottom: 24px;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.split-grid > pre,
.split-grid > .invariants-box {
  margin: 0;
}

.invariants-box {
  background-color: var(--surface);
  border: 1px solid var(--rule-subtle);
  border-radius: 4px;
  padding: 16px 18px;
  margin: 14px 0 20px;
}

.invariants-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.invariants-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-subtle);
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.invariants-list li:first-child {
  padding-top: 0;
}

.invariants-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.invariants-list strong {
  color: var(--text);
}

.chart-card {
  background-color: var(--surface);
  border: 1px solid var(--rule-subtle);
  border-radius: 4px;
  padding: 20px 22px 16px;
  margin: 0;
}

.chart-header {
  margin-bottom: 14px;
}

.chart-title {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.chart-subtitle {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-footnote {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--rule-subtle);
  line-height: 1.5;
}

.table-scroll {
  overflow-x: auto;
}

table.hig-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

table.hig-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

table.hig-table td {
  padding: 13px 14px 13px 0;
  border-bottom: 1px solid var(--rule-subtle);
  vertical-align: top;
}

table.hig-table tr:last-child td {
  border-bottom: none;
}

table.hig-table td:last-child,
table.hig-table th:last-child {
  padding-right: 0;
}

.verdict-line {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  white-space: nowrap;
}

table.hig-table td:first-child > strong {
  white-space: nowrap;
}

.verdict-mark {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  margin-right: 6px;
}

.mark-ok { color: var(--ok); }
.mark-warn { color: var(--warn); }
.mark-danger { color: var(--danger); }

.cell-note {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.45;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.chip-ok {
  color: var(--ok);
  background-color: var(--ok-bg);
  border-color: rgba(127, 216, 88, 0.28);
}

.chip-warn {
  color: var(--warn);
  background-color: var(--warn-bg);
  border-color: rgba(240, 180, 41, 0.28);
}

.chip-danger {
  color: var(--danger);
  background-color: var(--danger-bg);
  border-color: rgba(242, 95, 92, 0.28);
}

.inspector-panel {
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 18px 20px;
}

.inspector-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule-subtle);
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.control-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.control-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 62px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.toggle-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid var(--rule-subtle);
  background-color: var(--bg);
}

.toggle-check:hover {
  color: var(--text);
  border-color: var(--rule);
}

.inspector-verdict-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-subtle);
  font-family: var(--font-mono);
  font-size: 13.5px;
}

.pipeline-steps {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.pipeline-steps li {
  display: grid;
  grid-template-columns: 28px 180px 1fr auto;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-subtle);
  font-size: 12.5px;
}

.pipeline-steps li:last-child {
  border-bottom: none;
}

.pipeline-steps li.step-muted {
  opacity: 0.52;
}

.step-num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--subtle);
}

.step-title {
  font-weight: 600;
  color: var(--text);
}

.step-detail {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.step-state {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.step-state.state-ok { color: var(--ok); }
.step-state.state-warn { color: var(--warn); }
.step-state.state-danger { color: var(--danger); }

.agent-matrix {
  background-color: var(--surface);
  border: 1px solid var(--rule-subtle);
  border-radius: 4px;
  padding: 16px 18px;
  margin: 16px 0 24px;
}

.agent-group-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-group-title span {
  font-weight: 400;
  color: var(--muted);
}

.agent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.agent-tags:last-child {
  margin-bottom: 0;
}

.agent-tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
  background-color: var(--bg);
  border: 1px solid var(--rule-subtle);
  padding: 3px 8px;
  border-radius: 3px;
}

details.hig-disclosure {
  border-bottom: 1px solid var(--rule-subtle);
  padding: 13px 0;
}

details.hig-disclosure:first-of-type {
  border-top: 1px solid var(--rule-subtle);
}

details.hig-disclosure:last-child {
  border-bottom: none;
}

details.hig-disclosure summary {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
}

details.hig-disclosure summary::-webkit-details-marker {
  display: none;
}

details.hig-disclosure summary::after {
  content: "[+]";
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

details.hig-disclosure[open] summary::after {
  content: "[-]";
}

details.hig-disclosure .disclosure-body {
  padding-top: 10px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

footer.hig-footer {
  max-width: var(--reading-width);
  margin: 0 auto 44px;
  padding: 20px 36px 24px;
  border-top: 1px solid var(--rule-subtle);
  border-left: 1px solid var(--rule-subtle);
  border-right: 1px solid var(--rule-subtle);
  border-bottom: 1px solid var(--rule-subtle);
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 720px) {
  .nav-inner {
    height: auto;
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
    border-left: none;
    border-right: none;
  }
  .site-header nav {
    width: 100%;
    min-width: 0;
  }
  .nav-links {
    width: 100%;
    flex-wrap: wrap;
    gap: 4px;
    padding-bottom: 2px;
  }
  .nav-links a,
  .theme-btn,
  .nav-links a.btn-primary {
    font-size: 11px;
    padding: 4px 6px;
    min-height: 28px;
    margin-left: 0;
  }
  .nav-links li:last-child {
    margin-left: auto;
  }
  main {
    padding: 36px 16px 48px;
    border-left: none;
    border-right: none;
  }
  footer.hig-footer {
    padding: 20px 16px 24px;
    border-left: none;
    border-right: none;
  }
  .wide-breakout {
    width: 100%;
    margin: 20px 0 24px;
    transform: none;
  }
  h1 {
    font-size: 24px;
  }
  h2 {
    font-size: 17.5px;
  }
  .split-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .pipeline-steps li {
    grid-template-columns: 24px 1fr auto;
    row-gap: 4px;
  }
  .step-state {
    grid-column: 3;
    grid-row: 1;
  }
  .step-detail {
    grid-column: 2 / -1;
    grid-row: 2;
  }
  .inspector-verdict-row .status-chip {
    white-space: normal;
  }
}
