/*
 * Bitcoin Echo components.
 *
 * Plain classes over tokens.css. A variant of a component is a class. A
 * state is an attribute (native, ARIA, or data-state where neither has a
 * word for it) and never a class, so a state that is drawn is also a
 * state that is announced.
 */

/* Marks and icons. Each is a mask: the shape is cut from whatever colour
   the element sets, so one drawing serves both themes and every surface. */

:root {
  --mark-valid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cmask id='m'%3E%3Crect width='16' height='16' fill='%23fff'/%3E%3Cpath d='M4.5 8.2l2.3 2.3 4.7-5' fill='none' stroke='%23000' stroke-width='1.8'/%3E%3C/mask%3E%3Ccircle cx='8' cy='8' r='8' mask='url(%23m)'/%3E%3C/svg%3E");
  --mark-invalid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cmask id='m'%3E%3Crect width='16' height='16' fill='%23fff'/%3E%3Cpath d='M4.5 4.5l7 7M11.5 4.5l-7 7' fill='none' stroke='%23000' stroke-width='1.8'/%3E%3C/mask%3E%3Crect width='16' height='16' mask='url(%23m)'/%3E%3C/svg%3E");
  --mark-tampered: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cmask id='m'%3E%3Crect width='16' height='16' fill='%23fff'/%3E%3Cpath d='M8 4v5M8 10.8v1.4' fill='none' stroke='%23000' stroke-width='1.8'/%3E%3C/mask%3E%3Cpath d='M8 0l8 8-8 8-8-8z' mask='url(%23m)'/%3E%3C/svg%3E");
  --mark-pending: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.6'%3E%3Ccircle cx='8' cy='8' r='7' stroke-dasharray='2.2 2.2'/%3E%3Cpath d='M8 4.5V8l2.5 1.5'/%3E%3C/svg%3E");
  --mark-dot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3C/svg%3E");
  --mark-ring: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='5.2' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E");
  --mark-done: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cmask id='m'%3E%3Crect width='16' height='16' fill='%23fff'/%3E%3Cpath d='M4 8.3l2.7 2.7L12 5.2' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/mask%3E%3Crect width='16' height='16' mask='url(%23m)'/%3E%3C/svg%3E");
  --mark-warning: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cmask id='m'%3E%3Crect width='16' height='16' fill='%23fff'/%3E%3Cpath d='M8 6v4.2M8 11.8v1.4' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/mask%3E%3Cpath d='M8 1l7.5 14h-15z' mask='url(%23m)'/%3E%3C/svg%3E");
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.8'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8'/%3E%3C/svg%3E");
  --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5'%3E%3Cpath d='M3.5 3.5l9 9M12.5 3.5l-9 9'/%3E%3C/svg%3E");
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6'/%3E%3C/svg%3E");
  --icon-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5'%3E%3Crect x='5.5' y='5.5' width='8' height='8'/%3E%3Cpath d='M10.5 5.5v-3h-8v8h3'/%3E%3C/svg%3E");
  --icon-external: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5'%3E%3Cpath d='M6.5 3.5h-3v9h9v-3M9 3.5h3.5V7M12.5 3.5L7 9'/%3E%3C/svg%3E");
}

/* Base */

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

html {
  background: var(--color-ground);
  color: var(--color-ink);
  font-family: var(--font-serif);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-size: var(--text-md);
  line-height: var(--leading-snug);
}

[data-theme] {
  background: var(--color-ground);
  color: var(--color-ink);
}

::selection {
  background: var(--color-selection);
}

:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--focus-offset);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  display: inline-block;
  flex: none;
  width: 1rem;
  height: 1rem;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* Label: the small heading over a figure, a field group or a section. */

.label {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-rubric);
}

/* Link */

a {
  color: var(--color-link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--duration-fast) var(--ease-out);
}

a:visited {
  color: var(--color-link-visited);
}

a:hover {
  color: var(--color-ink);
}

/* Button */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--size-target);
  padding: 0 var(--space-5);
  border: var(--border-edge);
  border-radius: var(--radius-none);
  background: transparent;
  color: var(--color-ink);
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  line-height: 1;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}

.button:visited {
  color: var(--color-ink);
}

.button:hover {
  border-color: var(--color-ink);
  color: var(--color-ink);
}

.button:active {
  background: var(--color-rule);
}

.button[aria-pressed="true"] {
  background: var(--color-ink);
  border-color: var(--color-ink);
  color: var(--color-ground);
}

.button-primary,
.button-primary:visited,
.button-primary:hover {
  background: var(--color-orange);
  color: var(--color-on-orange);
}

.button-primary {
  border-color: var(--color-orange);
}

.button-primary:active {
  background: var(--color-orange-pressed);
}

.button-quiet {
  padding: 0 var(--space-3);
  border-color: transparent;
}

.button-quiet:hover {
  border-color: var(--color-edge);
}

.button-compact {
  min-height: 2rem;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
}

.button:disabled,
.button[aria-disabled="true"] {
  border-color: var(--color-rule);
  background: transparent;
  color: var(--color-ink-2);
  cursor: not-allowed;
}

.button-primary:disabled,
.button-primary[aria-disabled="true"] {
  background: var(--color-rule);
}

.button[aria-busy="true"] {
  cursor: progress;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: var(--size-target);
  height: var(--size-target);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-ink-2);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}

.icon-button:hover {
  color: var(--color-ink);
}

.icon-button-compact {
  width: 1.75rem;
  height: 1.75rem;
}

/* Text field and select */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  max-width: 28rem;
}

.field-hint {
  font-size: var(--text-sm);
  color: var(--color-ink-2);
}

/* An error is told by weight, a mark and words. Red belongs to the
   "invalid" verdict and is not used here. */
.field-error {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.field-error::before {
  content: "";
  flex: none;
  align-self: center;
  width: 1rem;
  height: 1rem;
  background: var(--color-rubric);
  -webkit-mask: var(--mark-warning) center / contain no-repeat;
  mask: var(--mark-warning) center / contain no-repeat;
}

.input,
.select select {
  width: 100%;
  min-height: var(--size-target);
  padding: var(--space-2) var(--space-3);
  border: var(--border-edge);
  border-radius: var(--radius-none);
  background: var(--color-panel);
  color: var(--color-ink);
  font-family: inherit;
  font-size: var(--text-md);
  line-height: var(--leading-snug);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.input-data {
  font-family: var(--font-mono);
}

.input::placeholder {
  color: var(--color-ink-2);
  opacity: 1;
}

.input:hover,
.select select:hover {
  border-color: var(--color-ink);
}

.input:read-only {
  background: transparent;
}

.input:disabled,
.select select:disabled {
  border-color: var(--color-rule);
  background: transparent;
  color: var(--color-ink-2);
  cursor: not-allowed;
}

.input[aria-invalid="true"] {
  border: var(--border-width-strong) solid var(--color-ink);
}

.select {
  position: relative;
  display: flex;
}

.select select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: var(--space-7);
  cursor: pointer;
}

.select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: var(--space-3);
  width: 1rem;
  height: 1rem;
  margin-top: -0.5rem;
  background: var(--color-ink);
  -webkit-mask: var(--icon-chevron) center / contain no-repeat;
  mask: var(--icon-chevron) center / contain no-repeat;
  pointer-events: none;
}

/* Checkbox and radio. Chosen is an orange fill with an ink mark and an
   ink edge: the edge and the mark hold the contrast, the fill the brand. */

.choice {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  cursor: pointer;
}

.choice input {
  -webkit-appearance: none;
  appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.1em 0 0;
  border: var(--border-edge);
  border-radius: var(--radius-none);
  background: var(--color-panel);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out);
}

.choice input[type="radio"] {
  border-radius: var(--radius-full);
}

.choice input:hover {
  border-color: var(--color-ink);
}

.choice input:checked {
  border-color: var(--color-ink);
  background: var(--color-orange);
}

.choice input:checked::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  background: var(--color-on-orange);
  -webkit-mask: var(--icon-check) center / contain no-repeat;
  mask: var(--icon-check) center / contain no-repeat;
}

.choice input[type="radio"]:checked::before {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-full);
  -webkit-mask: none;
  mask: none;
}

.choice input:disabled {
  border-color: var(--color-rule);
  background: transparent;
  cursor: not-allowed;
}

.choice input:disabled:checked {
  background: var(--color-rule);
}

.choice input:disabled:checked::before {
  background: var(--color-ink-2);
}

.choice input:disabled + span {
  color: var(--color-ink-2);
}

/* Card and figure */

.card {
  padding: var(--space-5);
  border: var(--border-rule);
  background: var(--color-panel);
}

.card-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
}

a.card {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color var(--duration-fast) var(--ease-out);
}

a.card:hover {
  border-color: var(--color-ink);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
}

.stat-value small {
  font-size: var(--text-md);
  color: var(--color-ink-2);
}

/* Table */

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

.table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

.table th,
.table td {
  padding: var(--space-3) var(--space-5) var(--space-3) 0;
  text-align: left;
  vertical-align: baseline;
  white-space: nowrap;
}

.table th {
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: var(--border-ink);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-ink-2);
}

.table td {
  border-bottom: var(--border-rule);
}

.table .num {
  text-align: right;
}

.table th[aria-sort="ascending"]::after {
  content: " \2191";
  color: var(--color-ink);
}

.table th[aria-sort="descending"]::after {
  content: " \2193";
  color: var(--color-ink);
}

.table tbody tr:hover {
  background: var(--color-panel);
}

.table tr[aria-selected="true"] {
  background: var(--color-panel);
  box-shadow: inset var(--border-width-marker) 0 0 var(--color-orange);
}

.table tr[aria-selected="true"] > :first-child {
  padding-left: var(--space-3);
  font-weight: var(--weight-bold);
}

/* Feed: rows that arrive over time, newest first. */

.feed {
  margin: 0;
  padding: 0;
  border-top: var(--border-rule);
  list-style: none;
}

.feed-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: var(--space-1) var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: var(--border-rule);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.feed-time {
  color: var(--color-ink-2);
}

.feed-note {
  grid-column: 2 / -1;
  font-family: var(--font-serif);
  color: var(--color-ink-2);
}

/* Badge: a mark and a word. The verdicts take their colours; a status
   takes orange only while it is happening now. */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  white-space: nowrap;
}

.badge[data-verdict]::before,
.badge[data-status]::before {
  content: "";
  flex: none;
  width: 1rem;
  height: 1rem;
  background: var(--badge-color, var(--color-ink));
  -webkit-mask: var(--badge-mark) center / contain no-repeat;
  mask: var(--badge-mark) center / contain no-repeat;
}

.badge[data-verdict="valid"] {
  --badge-color: var(--color-valid);
  --badge-mark: var(--mark-valid);
}

.badge[data-verdict="invalid"] {
  --badge-color: var(--color-invalid);
  --badge-mark: var(--mark-invalid);
}

.badge[data-verdict="tampered"] {
  --badge-color: var(--color-tampered);
  --badge-mark: var(--mark-tampered);
}

.badge[data-verdict="pending"] {
  --badge-color: var(--color-pending);
  --badge-mark: var(--mark-pending);
}

.badge[data-status="now"] {
  --badge-color: var(--color-live);
  --badge-mark: var(--mark-dot);
}

.badge[data-status="idle"] {
  --badge-color: var(--color-ink-2);
  --badge-mark: var(--mark-ring);
}

.badge[data-status="waiting"] {
  --badge-color: var(--color-pending);
  --badge-mark: var(--mark-pending);
}

.badge[data-status="done"] {
  --badge-mark: var(--icon-check);
}

.badge[data-status="failed"] {
  --badge-mark: var(--icon-close);
}

@media (forced-colors: active) {
  .badge::before,
  .icon {
    background: CanvasText;
  }
}

/* Hash. Each group of eight is an element and the gap between groups is
   a margin, so the groups are spacing and a copy gives the bare hash.
   Write the groups with no white space between them. */

.hash {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-style: normal;
  white-space: nowrap;
}

.hash > span + span {
  margin-left: 1ch;
}

.hash i {
  font-style: normal;
  color: var(--color-ink-2);
}

.hash-wrap > span:nth-child(4)::after {
  content: "\A";
  white-space: pre;
}

.hash-wrap > span:nth-child(5) {
  margin-left: 0;
}

.hash-short > span + span {
  margin-left: 0;
}

.hash-short > span:first-child::after {
  content: "\2026";
  color: var(--color-ink-2);
}

/* Two hashes to compare, one directly above the other. */
.hash-pair {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 var(--space-4);
  align-items: baseline;
  margin: 0;
}

.hash-pair dt {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-ink-2);
}

.hash-pair dd {
  margin: 0;
}

/* Progress. The fill is orange inside an edged track; a paused bar
   loses its colour. An unknown total is hatched and does not move. */

.progress {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 0.75rem;
  border: var(--border-edge);
  border-radius: var(--radius-none);
  background: var(--color-panel);
  color: var(--color-progress);
  overflow: hidden;
}

.progress::-webkit-progress-bar {
  background: var(--color-panel);
}

.progress::-webkit-progress-value {
  background: var(--color-progress);
  transition: width var(--duration-slow) var(--ease-out);
}

.progress::-moz-progress-bar {
  background: var(--color-progress);
}

.progress[data-state="paused"]::-webkit-progress-value {
  background: var(--color-ink-2);
}

.progress[data-state="paused"]::-moz-progress-bar {
  background: var(--color-ink-2);
}

.progress:indeterminate {
  background: repeating-linear-gradient(-45deg, var(--color-rule) 0 4px, var(--color-panel) 4px 8px);
}

.progress:indeterminate::-webkit-progress-bar {
  background: transparent;
}

.progress:indeterminate::-moz-progress-bar {
  width: 0;
}

.progress-note {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--color-ink-2);
}

/* Dialog and popover: the only things that float, and the only shadow. */

.dialog {
  width: min(32rem, calc(100% - 2 * var(--space-5)));
  padding: 0;
  border: var(--border-edge);
  background: var(--color-panel);
  color: var(--color-ink);
  box-shadow: var(--shadow-overlay);
}

.dialog::backdrop {
  background: var(--color-scrim);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-3) 0 var(--space-5);
}

.dialog-title {
  margin: var(--space-2) 0 0;
  font-size: var(--text-xl);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
}

.dialog-body {
  padding: var(--space-3) var(--space-5) var(--space-5);
}

.dialog-body > :first-child {
  margin-top: 0;
}

.dialog-body > :last-child {
  margin-bottom: 0;
}

.dialog-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: 0 var(--space-5) var(--space-5);
}

.popover {
  max-width: 22rem;
  padding: var(--space-4);
  border: var(--border-edge);
  background: var(--color-panel);
  color: var(--color-ink);
  box-shadow: var(--shadow-overlay);
  font-size: var(--text-sm);
}

/* Tooltip: only ever the name of a control that shows no words. */

.tip {
  position: relative;
  display: inline-flex;
}

.tip [role="tooltip"] {
  position: absolute;
  bottom: calc(100% + var(--space-1));
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-1) var(--space-2);
  background: var(--color-ink);
  color: var(--color-ground);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-fast) var(--ease-out), visibility var(--duration-fast);
  pointer-events: none;
}

.tip:hover [role="tooltip"],
.tip:focus-within [role="tooltip"] {
  opacity: 1;
  visibility: visible;
}

/* Explanation in place. It opens where it stands and moves the page
   down; it never covers the thing it explains. */

.explain {
  border-top: var(--border-rule);
  border-bottom: var(--border-rule);
}

.explain summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--size-target);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-link);
  list-style: none;
  cursor: pointer;
}

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

.explain summary::before {
  content: "";
  flex: none;
  width: 1rem;
  height: 1rem;
  background: currentColor;
  -webkit-mask: var(--icon-chevron) center / contain no-repeat;
  mask: var(--icon-chevron) center / contain no-repeat;
  transform: rotate(-90deg);
  transition: transform var(--duration-fast) var(--ease-out);
}

.explain[open] summary::before {
  transform: none;
}

.explain > :not(summary) {
  max-width: var(--measure);
  margin: 0 0 var(--space-4);
  line-height: var(--leading-body);
}

/* Symbol and name, set inline so they follow the theme. */

.mark {
  flex: none;
  width: 1.2em;
  height: 1.2em;
}

.mark-disc {
  fill: var(--color-orange);
}

.mark-ring {
  fill: none;
  stroke: currentColor;
}

.lockup,
.lockup:visited,
.lockup:hover {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  min-height: var(--size-target);
  color: var(--color-ink);
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  line-height: 1;
  letter-spacing: var(--tracking-display);
  text-decoration: none;
  white-space: nowrap;
}

/* Navigation: across the top of the site, down the side of the GUI. */

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 var(--space-5);
  padding: var(--space-2) var(--space-6);
  border-bottom: var(--border-rule);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li a {
  display: inline-flex;
  align-items: center;
  min-height: var(--size-target);
  color: var(--color-ink);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  text-decoration: none;
}

.site-nav li a:hover {
  color: var(--color-rubric);
}

.site-nav li a[aria-current="page"] {
  box-shadow: inset 0 calc(-1 * var(--border-width-marker)) 0 var(--color-orange);
}

.rail {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  width: 14rem;
  padding: var(--space-5);
  border-right: var(--border-rule);
}

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

.rail li a {
  display: flex;
  align-items: center;
  min-height: var(--size-target);
  padding-left: var(--space-3);
  border-left: var(--border-width-marker) solid transparent;
  color: var(--color-ink);
  text-decoration: none;
  transition: border-color var(--duration-fast) var(--ease-out);
}

.rail li a:hover {
  border-left-color: var(--color-edge);
}

.rail li a[aria-current="page"] {
  border-left-color: var(--color-orange);
  font-weight: var(--weight-bold);
}

.rail-foot {
  margin-top: auto;
}

/* Empty and error states. Nothing-here is a dashed outline, the same
   dash as "not yet". A failure is a heavy ink outline. Each says what
   happened, what it means, and what can be done. */

.state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  max-width: 34rem;
  padding: var(--space-6);
  border: var(--border-width) dashed var(--color-edge);
}

.state[data-kind="error"] {
  border: var(--border-width-strong) solid var(--color-ink);
}

.state-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
}

.state p {
  margin: 0;
}

.state-detail {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-ink-2);
  overflow-wrap: anywhere;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  max-width: 40rem;
  padding: var(--space-4);
  border: var(--border-edge);
  background: var(--color-panel);
  font-size: var(--text-sm);
}

.notice::before {
  content: "";
  flex: none;
  width: 1rem;
  height: 1rem;
  margin-top: 0.15em;
  background: var(--color-rubric);
  -webkit-mask: var(--mark-warning) center / contain no-repeat;
  mask: var(--mark-warning) center / contain no-repeat;
}

.notice[data-kind="error"] {
  border: var(--border-width-strong) solid var(--color-ink);
}

/* Steps: where the reader is in a flow that runs in a fixed order. */

.steps {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--size-target);
  color: var(--color-ink-2);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border: var(--border-edge);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.steps li[aria-current="step"] {
  color: var(--color-ink);
  font-weight: var(--weight-bold);
}

.steps li[aria-current="step"]::before {
  border-color: var(--color-ink);
  background: var(--color-orange);
  color: var(--color-on-orange);
}

.steps li[data-state="done"] {
  color: var(--color-ink);
}

.steps li[data-state="done"]::before {
  content: "";
  border: 0;
  background: var(--color-ink);
  -webkit-mask: var(--mark-done) center / contain no-repeat;
  mask: var(--mark-done) center / contain no-repeat;
}

/* Claim: a statement, whether its check passes, and how to rerun it. A
   check that passes is an ink tick, not the green of a valid block. */

.claim {
  padding: var(--space-5) 0;
  border-top: var(--border-rule);
}

.claim-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
}

.claim-title {
  flex: 1 1 20rem;
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
}

.claim dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-4);
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

.claim dt {
  padding-top: 0.15em;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-ink-2);
  white-space: nowrap;
}

.claim dd {
  margin: 0;
}

/* Prose: a long document. One column at the measure, set for reading. */

.prose {
  max-width: var(--measure);
  font-size: var(--text-md);
  line-height: var(--leading-body);
}

.prose > * {
  margin-top: 0;
  margin-bottom: 0;
}

.prose > * + * {
  margin-top: var(--space-4);
}

.prose h1,
.prose h2,
.prose h3 {
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
}

.prose h1 {
  font-size: var(--text-3xl);
  letter-spacing: var(--tracking-display);
}

.prose h2 {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: var(--border-rule);
  font-size: var(--text-xl);
}

.prose h3 {
  margin-top: var(--space-6);
  font-size: var(--text-lg);
}

.prose h4 {
  margin-top: var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-rubric);
}

.prose .lead {
  font-size: var(--text-lg);
  font-style: italic;
  line-height: var(--leading-snug);
}

.prose ul,
.prose ol {
  padding-left: var(--space-5);
}

.prose li + li {
  margin-top: var(--space-2);
}

.prose blockquote {
  margin-left: 0;
  margin-right: 0;
  padding-left: var(--space-5);
  border-left: var(--border-width-marker) solid var(--color-orange);
  font-size: var(--text-lg);
  font-style: italic;
  line-height: var(--leading-snug);
}

.prose blockquote > * {
  margin: 0;
}

.prose blockquote footer {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-style: normal;
  color: var(--color-ink-2);
}

.prose code {
  padding: 0.1em 0.3em;
  border: var(--border-rule);
  border-radius: var(--radius-small);
  background: var(--color-panel);
  font-family: var(--font-mono);
  font-size: 0.95em;
}

.prose pre {
  padding: var(--space-4);
  border: var(--border-rule);
  background: var(--color-panel);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  overflow-x: auto;
}

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

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

.prose th,
.prose td {
  padding: var(--space-2) var(--space-4) var(--space-2) 0;
  text-align: left;
  vertical-align: top;
}

.prose th {
  border-bottom: var(--border-ink);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-ink-2);
}

.prose td {
  border-bottom: var(--border-rule);
}

.prose hr,
.prose hr + * {
  margin-top: var(--space-7);
}

.prose hr {
  border: 0;
  border-top: var(--border-rule);
}

/* A heading straight after a rule does not draw a second rule. */
.prose hr + h2 {
  padding-top: 0;
  border-top: 0;
}

.prose .note {
  padding: var(--space-4) var(--space-5);
  border: var(--border-rule);
  background: var(--color-panel);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

.prose .note > * {
  margin: 0;
}

.prose .note > * + * {
  margin-top: var(--space-2);
}

.prose figure {
  margin-left: 0;
  margin-right: 0;
}

.prose figcaption {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-ink-2);
}
