/* Hallmark · genre: modern-minimal · macrostructure: Long Document (prose pages) + Task Form (form pages) · theme: custom teal-195 (anchor hue 195, light+dark) · nav: N9 edge-aligned minimal · footer: Ft2 inline single line · pre-emit critique: P4 H4 E4 S4 R5 V4 · contrast: pass (46–50) · tokens: locked */
/* phase 3: no new token · components added: Untrusted, CopyField, JumpLinks, Tag status variants · pre-emit critique: P4 H4 E4 S4 R5 V4 */

/* Tokens. Colour literals and font stacks live here and in the @font-face rules only. */
:root {
  color-scheme: light dark;

  --color-paper: oklch(97% 0.006 195);
  --color-surface: oklch(99% 0.003 195);
  --color-sunken: oklch(94% 0.008 195);
  --color-ink: oklch(20% 0.012 195);
  --color-muted: oklch(44% 0.012 195);
  --color-rule: oklch(88% 0.008 195);
  --color-border: oklch(58% 0.012 195);
  --color-accent: oklch(45% 0.077 195);
  --color-accent-hover: oklch(40% 0.069 195);
  --color-accent-ink: oklch(98% 0.010 195);
  --color-danger: oklch(47% 0.170 27);
  --color-danger-hover: oklch(42% 0.160 27);
  --color-danger-ink: oklch(98% 0.009 27);
  --color-danger-surface: oklch(95% 0.025 27);
  --color-ok: oklch(43% 0.100 155);
  --color-warn: oklch(44% 0.096 70);
  --color-warn-surface: oklch(95% 0.040 85);

  --font-sans:
    "Geist", "Geist Fallback", system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
  --font-mono:
    "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.75rem;
  --lh-body: 1.5;
  --lh-label: 1.4;
  --lh-heading: 1.25;
  --lh-display: 1.15;
  --weight-regular: 400;
  --weight-bold: 700;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --w-page: 40rem;
  --w-form: 28rem;
  --measure: 65ch;
  --control-h: 3rem;
  --icon-size: 1.25rem;
  --radius: 0.5rem;
  --radius-sm: 0.25rem;
  --ring-w: 2px;
  --ring-offset: 2px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-micro: 120ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-paper: oklch(15% 0.008 195);
    --color-surface: oklch(19% 0.010 195);
    --color-sunken: oklch(12% 0.008 195);
    --color-ink: oklch(94% 0.006 195);
    --color-muted: oklch(75% 0.012 195);
    --color-rule: oklch(30% 0.010 195);
    --color-border: oklch(58% 0.012 195);
    --color-accent: oklch(78% 0.100 195);
    --color-accent-hover: oklch(84% 0.090 195);
    --color-accent-ink: oklch(16% 0.020 195);
    --color-danger: oklch(72% 0.150 27);
    --color-danger-hover: oklch(77% 0.130 27);
    --color-danger-ink: oklch(16% 0.020 27);
    --color-danger-surface: oklch(24% 0.050 27);
    --color-ok: oklch(78% 0.120 155);
    --color-warn: oklch(80% 0.110 80);
    --color-warn-surface: oklch(24% 0.040 85);
  }
}

/* Self-hosted Geist 1.9.2 (SIL OFL 1.1, see /assets/fonts/OFL.txt). U+202F is absent from the
   font: never use it, use U+00A0. */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/geist-sans-1.9.2.woff2") format("woff2");
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/geist-mono-regular-1.9.2.woff2") format("woff2");
}

/* Metric-matched fallback so the font swap causes no layout shift. */
@font-face {
  font-family: "Geist Fallback";
  src: local("Arial");
  size-adjust: 105.54%;
  ascent-override: 95.22%;
  descent-override: 27.95%;
  line-gap-override: 0%;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow-x: clip;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--lh-body);
}

h1,
h2,
h3 {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--text-xl);
  line-height: var(--lh-display);
  text-wrap: balance;
}

h2 {
  font-size: var(--text-lg);
  line-height: var(--lh-heading);
  text-wrap: balance;
}

h3 {
  font-size: var(--text-base);
  line-height: var(--lh-heading);
  letter-spacing: 0;
}

p {
  margin: 0;
  min-width: 0;
  max-width: var(--measure);
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

:focus-visible {
  outline: var(--ring-w) solid var(--color-accent);
  outline-offset: var(--ring-offset);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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

.icon {
  flex: none;
  width: var(--icon-size);
  height: var(--icon-size);
}

/* Skip link: first focusable element, visible on focus only */
.skip-link {
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  padding-inline: var(--space-4);
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-weight: var(--weight-bold);
  text-decoration: none;
}

.skip-link:not(:focus) {
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Shell */
.wrap {
  width: 100%;
  max-width: calc(var(--w-page) + 2 * var(--space-8));
  margin-inline: auto;
  padding-inline-start: max(var(--space-4), env(safe-area-inset-left));
  padding-inline-end: max(var(--space-4), env(safe-area-inset-right));
}

.site-header {
  border-bottom: 1px solid var(--color-rule);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: var(--space-6);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  color: var(--color-ink);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
  line-height: var(--lh-heading);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.nav {
  flex: 1 0 100%;
}

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

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  border-bottom: 2px solid transparent;
  color: var(--color-ink);
  text-decoration: none;
  white-space: nowrap;
}

.nav a[aria-current="page"] {
  border-bottom-color: var(--color-accent);
  font-weight: var(--weight-bold);
}

main {
  padding-block: var(--space-12) var(--space-16);
}

main:focus {
  outline: none;
}

.site-footer {
  border-top: 1px solid var(--color-rule);
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: var(--lh-label);
}

.site-footer .wrap {
  display: grid;
  gap: var(--space-1);
  padding-block: var(--space-6) var(--space-4);
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
}

/* Long document: continuous prose, sections spaced by --space-8 */
.prose {
  display: grid;
  gap: var(--space-8);
  min-width: 0;
}

.prose > header,
.prose > section {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.prose > header {
  gap: var(--space-6);
}

/* Card: flat surface, never nested in another card */
.card {
  min-width: 0;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
}

.card > * + * {
  margin-block-start: var(--space-3);
}

.card blockquote {
  margin: 0;
  max-width: var(--measure);
  font-size: var(--text-lg);
  font-weight: var(--weight-regular);
  line-height: var(--lh-label);
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

/* Buttons: 48px, one border width in every state, ring as outline */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--control-h);
  padding-inline: var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  font-weight: var(--weight-bold);
  line-height: var(--lh-label);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  outline: var(--ring-w) solid transparent;
  outline-offset: var(--ring-offset);
  transition: transform var(--dur-micro) var(--ease-out);
}

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible,
.input:focus-visible {
  outline-color: var(--color-accent);
}

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

.btn--secondary {
  border-color: var(--color-border);
  color: var(--color-ink);
}

.btn--danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: var(--color-danger-ink);
}

.btn--danger-outline {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.btn--link {
  width: auto;
  padding-inline: 0;
  color: var(--color-accent);
  font-weight: var(--weight-regular);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.btn:disabled,
.btn[aria-disabled="true"],
.input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Defined for a later progressive enhancement; phase 2 never emits it. */
.btn[aria-busy="true"] {
  opacity: 0.7;
  cursor: progress;
  pointer-events: none;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Fields: label above, 16px input (no iOS zoom), helper slot that never moves the page */
.field {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.field label {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: var(--lh-label);
}

.input {
  width: 100%;
  min-width: 0;
  min-height: var(--control-h);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  outline: var(--ring-w) solid transparent;
  outline-offset: var(--ring-offset);
}

.input[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.input--code {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  line-height: var(--lh-display);
  letter-spacing: 0.35em;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.input--code:focus {
  border-color: var(--color-accent);
}

.field-message {
  display: flex;
  gap: var(--space-1);
  align-items: flex-start;
  min-height: 1lh;
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: var(--lh-label);
}

.field-message--error {
  color: var(--color-danger);
}

.field-message .icon {
  margin-block-start: 0.1em;
}

/* Alerts: filled surface, 1px border, icon and lead word; never a coloured side stripe */
.alert {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
}

.alert > .icon {
  margin-block-start: 0.125rem;
}

.alert-body {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.alert-lead {
  font-weight: var(--weight-bold);
}

.alert-text p {
  max-width: none;
}

.alert--info {
  background: var(--color-sunken);
}

.alert--success {
  border-color: var(--color-ok);
}

.alert--success > .icon {
  color: var(--color-ok);
}

.alert--warn {
  border-color: var(--color-warn);
  background: var(--color-warn-surface);
}

.alert--warn > .icon {
  color: var(--color-warn);
}

.alert--error {
  border-color: var(--color-danger);
  background: var(--color-danger-surface);
}

.alert--error > .icon {
  color: var(--color-danger);
}

/* Facts: who, where it goes */
.facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  margin: 0;
}

.facts > div {
  min-width: 0;
}

.facts dt {
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: var(--lh-label);
}

.facts dd {
  margin: 0;
  font-weight: var(--weight-bold);
  overflow-wrap: anywhere;
}

/* Figures: counters in Display size with tabular digits (probe status page) */
.facts--figures dd {
  font-size: var(--text-xl);
  line-height: var(--lh-display);
  font-variant-numeric: tabular-nums;
}

/* Figure: the compact send counter of /messages, 20px so it informs without out-weighing the list */
.facts--figure dd {
  font-size: var(--text-lg);
  line-height: var(--lh-heading);
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border: 1px solid transparent;
  background: var(--color-sunken);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: var(--lh-label);
  overflow-wrap: anywhere;
}

/* Text written by another person: a flat sunken box with a 1px border token, so the boundary
   survives forced colours and grayscale. Body size, weight 400, ink colour (UI-SPEC D13, D17). */
.untrusted {
  min-width: 0;
  background: var(--color-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-ink);
  overflow-wrap: anywhere;
}

.untrusted--inline {
  display: inline-block;
  max-width: 100%;
  min-width: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--lh-body);
  color: var(--color-ink);
  overflow-wrap: anywhere;
}

/* Message reading box (plan 03-08): the text of a message written by another person. Our fixed
   words are 14px bold; the sender's name and every part are body size, weight 400, ink. */
.untrusted-label {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-rule);
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: var(--lh-label);
  overflow-wrap: anywhere;
}

.untrusted-label .icon {
  display: inline-block;
  margin-inline-end: var(--space-2);
  vertical-align: -0.25em;
}

.untrusted-who {
  min-width: 0;
  color: var(--color-ink);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  overflow-wrap: anywhere;
}

.untrusted-parts {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
  padding: var(--space-4);
}

.untrusted-part {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.untrusted-heading {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: var(--lh-label);
}

.untrusted-text {
  min-width: 0;
  max-width: var(--measure);
  margin: 0;
  color: var(--color-ink);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--lh-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* An invisible character made visible: our own text, so bold is allowed here */
.marker {
  padding: 0 var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: var(--lh-label);
  white-space: nowrap;
}

/* The text to copy: Geist like every control, never mono. Read-only, focusable, scrolls inside */
.copyfield {
  display: block;
  width: 100%;
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--lh-body);
  resize: vertical;
  outline: var(--ring-w) solid transparent;
  outline-offset: var(--ring-offset);
}

.copyfield:focus-visible {
  outline-color: var(--color-accent);
}

/* In-page anchors of the reading page: 48px targets, wrapping */
.jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--space-3);
  min-width: 0;
}

.jump p {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: var(--lh-label);
}

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

.jump a {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.jump a:focus-visible {
  outline: var(--ring-w) solid var(--color-accent);
  outline-offset: var(--ring-offset);
}

/* Fingerprints agree: icon, sentence and colour */
.match {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  color: var(--color-ok);
  font-weight: var(--weight-bold);
}

/* Phase 3 pages (contacts, invitation link): one column of sections, 32px apart */
.flow-page {
  display: grid;
  gap: var(--space-8);
  max-width: var(--w-page);
  min-width: 0;
}

.flow-page--narrow {
  max-width: var(--w-form);
}

.flow-section {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

/* Two equal buttons: stacked on mobile, side by side from 40rem */
.actions--pair > form {
  min-width: 0;
}

/* Status tags: text and icon take the colour, the border stays a token */
.tag--attention {
  border-color: var(--color-border);
  color: var(--color-warn);
}

.tag--ok {
  border-color: var(--color-border);
  color: var(--color-ok);
}

.tag--neutral {
  border-color: var(--color-border);
  color: var(--color-muted);
}

/* Connected Claudes: rows, not a table. The action sits below the text, to its right from 40rem */
.devices {
  display: grid;
  gap: var(--space-6);
  min-width: 0;
}

.devices-head {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.account-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--space-4);
  row-gap: var(--space-1);
  min-width: 0;
}

.account-line form {
  margin: 0;
}

.rows {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}

.row > .row-action {
  margin-block-start: 0;
}

.row-main {
  display: grid;
  justify-items: start;
  gap: var(--space-2);
  min-width: 0;
}

.row-title {
  font-size: var(--text-base);
  line-height: var(--lh-heading);
  overflow-wrap: anywhere;
}

.row-meta {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: var(--lh-label);
}

.row-action {
  min-width: 0;
}

.empty {
  display: grid;
  gap: var(--space-4);
  max-width: var(--w-form);
  min-width: 0;
}

/* Status pages: headline, one or two sentences, one action */
.status {
  display: grid;
  gap: var(--space-6);
  max-width: var(--w-form);
  min-width: 0;
}

/* Form pages (sign-in, name): one narrow column, left edge shared with the wordmark */
.form-page {
  display: grid;
  gap: var(--space-6);
  max-width: var(--w-form);
  min-width: 0;
}

.form-page form {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
  margin: 0;
}

/* « ou » between the e-mail form and the Google link: a rule on each side of the word */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: var(--lh-label);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--color-border);
}

.caption {
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: var(--lh-label);
}

/* Consent page: the account is the heaviest block under the title */
.consent {
  max-width: var(--w-page);
}

.consent form {
  display: grid;
  gap: var(--space-6);
  min-width: 0;
  margin: 0;
}

.account-name {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  line-height: var(--lh-heading);
  overflow-wrap: anywhere;
}

.account-email {
  overflow-wrap: anywhere;
}

.consent .card form {
  display: block;
}

.scope-list {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding-inline-start: var(--space-6);
}

.scope-list li {
  overflow-wrap: anywhere;
}

.consequences {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
}

.verify {
  font-weight: var(--weight-bold);
}

/* Install guide: ordered steps, the number is text in the DOM */
.install {
  display: grid;
  gap: var(--space-6);
  min-width: 0;
}

.install-head {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.steps {
  display: grid;
  gap: var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  column-gap: var(--space-4);
  min-width: 0;
}

.step-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-bold);
  line-height: 1;
}

.step--done .step-marker {
  color: var(--color-ok);
  border-color: var(--color-ok);
}

.step-main {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
  padding-block-start: 0.25rem;
}

.step-main .actions {
  align-items: flex-start;
}

/* Selectable text blocks: wrap, never scroll sideways */
.cmd-block {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.cmd-label {
  color: var(--color-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: var(--lh-label);
}

.cmd {
  display: block;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--color-sunken);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--lh-body);
  -webkit-user-select: all;
  user-select: all;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cmd-hint {
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: var(--lh-label);
}

/* Screenshot slot: only rendered when the file exists */
.shot {
  margin: 0;
  min-width: 0;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: var(--color-sunken);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
}

.shot figcaption {
  margin-block-start: var(--space-2);
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: var(--lh-label);
}

/* Native disclosure, bordered like a card */
.details {
  min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
}

.details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--control-h);
  padding-inline: var(--space-4);
  font-weight: var(--weight-bold);
  cursor: pointer;
  list-style: none;
}

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

.details summary span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.details summary .icon {
  transition: transform var(--dur-micro) var(--ease-out);
}

.details[open] summary .icon {
  transform: rotate(180deg);
}

.details-body {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-4);
  padding-block-start: var(--space-1);
}

/* Sign-out is a real button in a POST form, drawn like the other navigation items */
.nav form {
  display: inline-flex;
  margin: 0;
}

.nav .btn--link {
  min-width: 0;
  color: var(--color-ink);
  text-decoration: none;
}

@media (min-width: 40rem) {
  .wrap {
    padding-inline-start: max(var(--space-8), env(safe-area-inset-left));
    padding-inline-end: max(var(--space-8), env(safe-area-inset-right));
  }

  .nav {
    flex: 0 1 auto;
  }

  .card {
    padding: var(--space-6);
  }

  .untrusted-parts {
    padding: var(--space-6);
  }

  .untrusted-label {
    padding-inline: var(--space-6);
  }

  .btn {
    width: auto;
  }

  .actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .actions--pair > * {
    flex: 1 1 0;
    min-width: 0;
  }

  .actions--pair .btn {
    width: 100%;
  }

  .facts > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    column-gap: var(--space-4);
  }

  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: var(--space-6);
  }
}

/* Motion: colour changes only, hover devices only */
@media (hover: hover) and (pointer: fine) {
  a {
    transition:
      color var(--dur-micro) var(--ease-out),
      border-color var(--dur-micro) var(--ease-out);
  }

  a:hover {
    text-decoration-thickness: 2px;
  }

  .btn {
    transition:
      background-color var(--dur-micro) var(--ease-out),
      border-color var(--dur-micro) var(--ease-out),
      color var(--dur-micro) var(--ease-out),
      transform var(--dur-micro) var(--ease-out);
  }

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

  .btn--secondary:hover {
    background: var(--color-sunken);
  }

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

  .btn--danger-outline:hover {
    background: var(--color-danger-surface);
  }

  .btn--link:hover {
    text-decoration-thickness: 2px;
  }

  .input {
    transition:
      background-color var(--dur-micro) var(--ease-out),
      border-color var(--dur-micro) var(--ease-out);
  }

  .input:hover:not(:disabled) {
    background: var(--color-sunken);
  }

  .copyfield {
    transition:
      background-color var(--dur-micro) var(--ease-out),
      border-color var(--dur-micro) var(--ease-out);
  }

  .copyfield:hover {
    background: var(--color-sunken);
  }

  .jump a:hover {
    text-decoration-thickness: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn:active {
    transform: none;
  }

  .details summary .icon {
    transition-duration: 0ms;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto;
  }
}

@media (forced-colors: active) {
  .card,
  .skip-link,
  .alert,
  .tag,
  .cmd,
  .details,
  .step-marker {
    border: 1px solid CanvasText;
  }

  .btn,
  .input,
  .copyfield {
    border: 1px solid ButtonText;
  }

  .untrusted,
  .marker {
    border: 1px solid CanvasText;
  }

  :focus-visible,
  .btn:focus-visible,
  .input:focus-visible,
  .copyfield:focus-visible {
    outline-color: Highlight;
  }

  .nav a[aria-current="page"] {
    border-bottom-color: Highlight;
  }
}
