:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #14181d;
  --line: #232a32;
  --ink: #e6edf3;
  --dim: #8b98a5;
  --acc: #4cc38a;
  --acc-ink: #06140d;
  --warn: #d29922;
  --bad: #f85149;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
/* The light palette, for the system setting and for the signed-cookie step's
   explicit choice. Declared twice because a media query cannot share a block
   with an attribute selector. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    color-scheme: light;
    --bg: #f6f8fa;
    --panel: #fff;
    --line: #d8dee4;
    --ink: #1f2328;
    --dim: #59636e;
    --acc: #1a7f37;
    --acc-ink: #fff;
  }
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f6f8fa;
  --panel: #fff;
  --line: #d8dee4;
  --ink: #1f2328;
  --dim: #59636e;
  --acc: #1a7f37;
  --acc-ink: #fff;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    15px/1.6 system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    sans-serif;
}
a {
  color: var(--acc);
}

header.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  padding: 12px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand span {
  color: var(--acc);
}
.strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 2px 10px;
  font: 12px/1.6 var(--mono);
  color: var(--dim);
}
.pill b {
  color: var(--ink);
  font-weight: 600;
}
.up {
  color: var(--acc);
}
.down {
  color: var(--bad);
}
.degraded {
  color: var(--warn);
}

.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 32px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.toc details {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 96px);
  overflow: auto;
}
.toc summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 10px;
}
.progress {
  color: var(--dim);
  font: 12px var(--mono);
  margin-left: 6px;
}
.chapters,
.chapters ol,
.links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.chapters > li {
  margin-bottom: 14px;
}
.chapter {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-bottom: 4px;
}
.chapters a,
.links a {
  display: block;
  padding: 3px 10px;
  border-left: 2px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}
.chapters a:hover,
.links a:hover {
  border-left-color: var(--dim);
}
.chapters a[aria-current] {
  border-left-color: var(--acc);
  color: var(--acc);
  font-weight: 600;
}
/* A step with a button pressed in it. */
.chapters a.done::after {
  content: ' \2713';
  color: var(--acc);
  font-size: 12px;
}
.aside-label {
  margin: 20px 0 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
}
.links a {
  color: var(--dim);
  font-size: 13px;
}

main {
  min-width: 0;
  max-width: 760px;
}
.step,
section {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  padding: 24px;
}
h1 {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
section h2 {
  margin: 0 0 10px;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.step p,
section p {
  margin: 0 0 14px;
  color: var(--dim);
  max-width: 68ch;
}
.outline {
  margin: 18px 0 22px;
  padding-left: 22px;
  color: var(--dim);
}
.outline li {
  margin-bottom: 6px;
}
.outline a {
  font-weight: 600;
  text-decoration: none;
}
code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--acc);
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}
button {
  font:
    500 14px system-ui,
    sans-serif;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
button:hover:not(:disabled) {
  border-color: var(--acc);
  color: var(--acc);
}
button.primary {
  background: var(--acc);
  border-color: var(--acc);
  color: var(--acc-ink);
}
button.primary:hover:not(:disabled) {
  color: var(--acc-ink);
  filter: brightness(1.1);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
input,
select {
  font: 13px var(--mono);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  min-width: 0;
}

pre {
  margin: 14px 0 0;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 12.5px/1.55 var(--mono);
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--dim);
}
pre:empty {
  display: none;
}
/* The declaration a step is about, set apart from the output under it. */
pre.code {
  color: var(--ink);
  max-height: none;
  margin: 0 0 16px;
  border-left: 3px solid var(--acc);
  white-space: pre;
  overflow-x: auto;
}
#src-out {
  margin: 14px 0 0;
}
pre.code .hl {
  color: var(--acc);
}
.note {
  margin: 12px 0 0;
  color: var(--dim);
  font-size: 13px;
}
.note b {
  color: var(--ink);
  font-weight: 600;
}
img.shot {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  image-rendering: pixelated;
  background: var(--bg);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.position {
  color: var(--dim);
  font-size: 13px;
  text-align: center;
}

/* The vitals step: a number and its label, wrapping to as many columns as fit. */
.vitals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.vital {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--bg);
}
.vital b {
  display: block;
  font: 600 17px/1.25 var(--mono);
  color: var(--ink);
  /* Tabular figures, so a counter ticking up does not shift the label under it. */
  font-variant-numeric: tabular-nums;
}
.vital span {
  font: 11px/1.5 var(--mono);
  color: var(--dim);
}
table.routes {
  width: 100%;
  border-collapse: collapse;
  font: 12px/1.6 var(--mono);
}
table.routes th {
  text-align: left;
  color: var(--dim);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  padding: 4px 8px 4px 0;
}
table.routes td {
  padding: 3px 8px 3px 0;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.routes td:first-child {
  color: var(--ink);
}

footer {
  max-width: 1120px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 18px 20px 28px;
  color: var(--dim);
  font-size: 13px;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 16px 16px 40px;
  }
  .toc details {
    position: static;
    max-height: none;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 12px;
    padding: 12px 14px;
  }
  .toc summary {
    margin-bottom: 0;
  }
  .toc details[open] summary {
    margin-bottom: 10px;
  }
  .step,
  section {
    padding: 18px 16px;
  }
  /* Not pinned: three rows of pills would hold a third of a phone screen. */
  header.top {
    position: static;
    padding: 10px 16px;
  }
  /* The overall status and uptime, plus any check that is not up. */
  .strip .pill:nth-child(n + 3):not(:has(.down, .degraded)) {
    display: none;
  }
  /* Pinned instead, so moving on never needs a scroll past the output. */
  .pager {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin: 12px -16px 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--line);
  }
  .position {
    font-size: 12px;
  }
  pre.code {
    font-size: 12px;
  }
  table.routes {
    display: block;
    overflow-x: auto;
  }
}
