/* Try Autonomi, in the Autonomi brand system.
   Source of truth: github.com/WithAutonomi/brand (private) — BRAND.md and
   dist/tokens.flat.json. Values here are the brand's semantic tokens under this
   page's own names; where a default is bent it says so and why.

   The seven WOFF2 cuts below are included with the owner's approval and
   self-hosted. Method and FK Roman remain commercial fonts, licensed for use
   and not for redistribution: they may be served from an Autonomi site, and
   they must not be published in a public repository. Inter and IBM Plex Mono
   are OFL. */

/* Primary — Method. Foundry weights are its own: Regular is 500, Medium 600. */
@font-face {
  font-family: "Method";
  src: url("fonts/Method-Regular.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Method";
  src: url("fonts/Method-Medium.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "FK Roman Standard";
  src: url("fonts/FKRomanStandard-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* Body — Inter */
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* Mono — IBM Plex Mono */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --paper: var(--page-background);
  --page: #ebeff5;
  --paper-raised: #ffffff;
  --ink-inverse: #ffffff;

  /* Voice and structure. Black is gone: the brand keeps it for icon strokes,
     never text. */
  --ink: #232a59;
  --ink-soft: rgba(35, 42, 89, 0.8);
  --rule: rgba(35, 42, 89, 0.25);
  --edge: #c5cdd7;
  --grey-500: #8994a3;
  --control-edge: #232a59;

  /* Red-deep for small text and errors. */
  --signal: #e91337;
  --signal-text: #e91337;

  /* Data is moving: status.live, with status.live-pulse behind a live dot. The
     green is a fill, so meaningful marks carry a blue edge to clear 3:1. */
  --live: #97ffa0;
  --live-edge: #232a59;
  --live-pulse: #03e916;
  --status-attention: #8bc5ff;
  --live-soft: rgba(151, 255, 160, 0.35);

  --focus: #232a59;
  --action-primary: #232a59;
  --action-hover: #97ffe7;
  /* Jim's selected blue masthead, near-white hero and aqua lower surfaces. */
  --masthead-background: #cfecfb;
  --hero-background: #f7fcff;
  --page-background: color-mix(in srgb, var(--action-hover) 70%, var(--hero-background));
  --status-background: var(--paper-raised);
  --headline-colour: var(--signal-text);
  --card-rule: color-mix(in srgb, var(--page) 80%, transparent);
  --card-shadow: 0 6px 5px rgba(0, 0, 0, 0.04), 0 1px 10px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.04);

  /* Five connection phases, ordered setup -> payload, built only from named
     values: the two greys, the blue at opacity.state, the blue, and the live
     green. A ramp for data like this is a gap in the system. */
  --wf-ice: #8994a3;
  --wf-dtls: rgba(35, 42, 89, 0.62);
  --wf-handshake: rgba(35, 42, 89, 0.8);
  --wf-lookup: #232a59;
  --wf-chunk: #97ffa0;

  --serif: "Method", "Inter", sans-serif;
  --display-serif: "FK Roman Standard", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  /* Body sizes follow the brand; Jim specified the desktop hero at 64px. */
  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: 1.75rem;
  --step-3: 4rem;

  --gutter: clamp(1.1rem, 0.6rem + 2.2vw, 3rem);
  --measure: 34rem;
  --radius-button: 6px;
  --radius-pill: 999px;
  /* One palette, like autonomi.com: no dark variant. */
  color-scheme: light only;
  background: var(--hero-background);
}

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

[hidden] {
  display: none !important;
}

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

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

body {
  margin: 0;
  background: var(--page-background);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  padding-inline: var(--gutter);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.3;
  /* Method's own weights: Regular is 500, Medium 600. */
  font-weight: 500;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

a {
  color: var(--ink);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

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

:focus-visible {
  outline: 2.5px solid var(--focus);
  outline-offset: 3px;
}

/* Jim's Figma buttons: Method Medium, 38px high, with an inside stroke. */
button {
  font: inherit;
  cursor: pointer;
}

.primary,
.quiet {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  border-radius: var(--radius-button);
  height: 38px;
  padding: 7px 15px;
  line-height: 24px;
  border: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

@media (pointer: coarse) {
  .primary,
  .quiet {
    min-height: 44px;
  }
}

/* Solid blue: the action that matters. */
.primary {
  background: var(--action-primary);
  color: var(--paper-raised);
}

/* The hollow voice: Method Medium, Title Case, a 1px blue border, no fill. */
.quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.primary:hover:not(:disabled),
.quiet:hover:not(:disabled),
#save-link:hover {
  background: var(--paper-raised);
  box-shadow: inset 0 0 0 1px var(--ink);
  color: var(--ink);
}

.home-link.quiet:hover {
  background: var(--action-hover);
  box-shadow: none;
}

.primary:active:not(:disabled),
.quiet:active:not(:disabled) {
  transform: translateY(1px);
}

.primary:disabled,
.quiet:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

#get-button {
  width: 89px;
  white-space: nowrap;
  text-transform: capitalize;
}

.address-form:has(#cancel-button:not([hidden])) #get-button {
  width: auto;
}

#get-button:disabled {
  background: color-mix(in srgb, var(--ink) 10%, var(--hero-background));
  color: color-mix(in srgb, var(--ink) 60%, var(--hero-background));
  opacity: 1;
}


/* Masthead */

.masthead {
  position: relative;
  z-index: 1;
  margin-inline: calc(-1 * var(--gutter));
  padding: 1.25rem;
  padding-bottom: 0;
  background: var(--masthead-background);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem 1.5rem;
}

.home-link {
  justify-self: start;
  padding-left: 8px;
  gap: 10px;
}

.home-arrow {
  width: 24px;
  height: 24px;
  flex: none;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  justify-self: center;
  gap: 0.625rem;
}

.wordmark-logo {
  display: block;
  width: auto;
  height: 1.5rem;
}

.wordmark-try {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
}

/* White status surface against the blue masthead. */
.network-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 7px;
  border-radius: var(--radius-button);
  background: var(--status-background);
  justify-self: end;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink);
}

.status-light {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--status-attention);
  flex: none;
  isolation: isolate;
}

/* Steady green once the page is ready to try; the pulse is kept for "Live",
   after nodes have actually answered. */
.network-status[data-state="ready"] .status-light,
.network-status[data-state="connecting"] .status-light,
.network-status[data-state="live"] .status-light {
  background: var(--live);
}

/* The pulse behind a live dot is the signal green, and only there. */
.network-status[data-state="live"] .status-light::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: var(--live-pulse);
  animation: statusPulse 2s ease-out infinite;
  z-index: -1;
}

.network-status[data-state="error"] .status-light {
  background: var(--signal);
  border-color: var(--signal);
}

@keyframes statusPulse {
  from {
    transform: scale(0.45);
    opacity: 0.8;
  }

  to {
    transform: scale(1);
    opacity: 0;
  }
}

main {
  max-width: 78rem;
  margin: 0 auto;
}

/* Stage */

/* Full-width colour bands. */
.stage,
.outcome {
  background: var(--paper);
  margin-inline: calc(50% - 50vw);
  padding-inline: max(var(--gutter), calc(50vw - 39rem + var(--gutter)));
}

.stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
  grid-template-areas: "intro featured" "form featured";
  grid-template-rows: auto 1fr;
  column-gap: clamp(2rem, 7.5vw, 7rem);
  align-items: start;
  padding-inline: max(var(--gutter), calc((100vw - 89rem) / 2 + var(--gutter)));
  padding-block: 148px 16px;
  background: var(--hero-background);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: clamp(90px, 14vw, 200px);
  background: var(--masthead-background);
  mask: url("top-fade.png") center / 100% 100% no-repeat;
  mask-mode: alpha;
  pointer-events: none;
}

.stage > * {
  position: relative;
}

.stage-copy {
  grid-area: intro;
  display: grid;
  gap: 0;
  min-width: 0;
}

/* What came back, beside the network that fetched it. */
.outcome {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
  padding-block: clamp(1.25rem, 3vw, 2.5rem);
  scroll-margin-top: 1rem;
}

/* Before a file is asked for there is nothing to show on the left, so the
   picture of the network takes the whole band. */
.outcome:has(> .result[hidden]) {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

.outcome:has(> .result[hidden]) .map {
  max-width: 42rem;
  width: 100%;
}

.eyebrow {
  display: block;
  margin-bottom: 3rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

h1 {
  font-family: var(--display-serif);
  font-size: var(--step-3);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--headline-colour);
  text-wrap: balance;
}

.lede {
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  margin-block: 1rem 2rem;
}

/* Address plate */

.address-form {
  grid-area: form;
  min-width: 0;
  display: grid;
  gap: 12px;
}

.address-label {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--card-rule);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.address-plate,
.preview,
.waterfall-scroll,
.event-log {
  background: var(--paper-raised);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
}

.address-plate {
  overflow: clip;
}

.address-plate:focus-within {
  outline: 2.5px solid var(--focus);
  outline-offset: 3px;
}

.address-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  gap: 0.5rem;
  padding: 18px 15px;
}

.address-plate textarea {
  display: block;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1.3;
  letter-spacing: 0.1em;
  width: 100%;
  max-width: 100%;
  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (min-width: 861px) and (max-width: 1200px) {
  .address-plate textarea {
    height: 4.3em;
  }
}

.address-plate textarea::placeholder {
  color: color-mix(in srgb, var(--ink) 30%, var(--paper-raised));
  opacity: 1;
}

.address-count {
  justify-self: end;
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
}

.address-help {
  padding-inline: 15px;
  font-size: 12px;
  color: var(--ink-soft);
}

.form-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.4rem;
}

.address-form > .form-actions {
  margin: 4px 0 0 5px;
}

.form-error {
  border-left: 3px solid var(--signal);
  padding: 0.5rem 0 0.5rem 0.9rem;
  color: var(--ink);
}

/* Result */

.result {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.result h2,
.featured h2 {
  font-family: var(--serif);
  font-size: var(--step-2);
  letter-spacing: -0.02em;
}

.result h2:focus {
  outline: none;
}

.result h2:focus-visible {
  outline: 2.5px solid var(--focus);
}

.preview {
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 6rem;
}

.preview img,
.preview video {
  display: block;
  max-width: 100%;
  max-height: 26rem;
  width: auto;
  height: auto;
}

.preview audio {
  width: 100%;
  padding: 1rem;
}

/* A stream starts before the video says how big it is, so its frame is kept
   at the usual 16:9 from the start rather than jumping when it learns. */
.preview[data-stream] {
  background: var(--ink);
}

.preview[data-stream] video {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: none;
  object-fit: contain;
}

.stream-status {
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.preview pre {
  margin: 0;
  width: 100%;
  max-height: 20rem;
  overflow: auto;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-note {
  padding: 1.25rem;
  color: var(--ink-soft);
  text-align: center;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.85rem 1.25rem;
  margin: 0;
}

.facts div {
  min-width: 0;
}

.facts dt {
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}

.facts dd {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.facts .fact-wide {
  grid-column: 1 / -1;
}

.facts .fact-wide dd {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  word-break: break-all;
}

/* Featured files */

.featured {
  grid-area: featured;
  display: grid;
  gap: 1.25rem;
}

.featured-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.featured-list .featured-row {
  position: relative;
  isolation: isolate;
  width: calc(100% + 30px);
  margin-inline: -15px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 1rem 15px;
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  text-align: left;
  font-weight: 400;
  font-size: var(--step-0);
  min-height: 3.6rem;
}

.featured-list .featured-row::before {
  content: "";
  position: absolute;
  inset: 0 15px;
  border-bottom: 1px solid var(--rule);
  pointer-events: none;
  z-index: -1;
}

.featured-list .featured-row:is(:hover, :focus-visible)::before {
  inset-inline: 0;
  background: color-mix(in srgb, var(--grey-500) 20%, transparent);
  border-block: 1px solid var(--grey-500);
}

/* The highlighted row owns the shared edge; do not stack two separators. */
.featured-list:has(> li:first-child > .featured-row:is(:hover, :focus-visible)) {
  border-top-color: transparent;
}

.featured-list > li:has(+ li > .featured-row:is(:hover, :focus-visible)) > .featured-row::before {
  border-bottom-color: transparent;
}

.featured-list .featured-row:is(:hover, :focus-visible) .featured-glyph {
  background: var(--ink);
  color: transparent;
}

.featured-list .featured-row:is(:hover, :focus-visible) .featured-glyph::after {
  opacity: 1;
}

.featured-glyph {
  position: relative;
  width: 2.6rem;
  height: 2.6rem;
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: var(--radius-button);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--ink);
}

.featured-glyph::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("download.svg") center / 17px 22px no-repeat;
  opacity: 0;
  pointer-events: none;
}

.featured-name {
  font-weight: 700;
  display: block;
}

.featured-note {
  display: block;
  font-size: var(--step--1);
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.featured-size {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.featured-empty {
  padding: 0.85rem 0;
  color: var(--ink-soft);
}

.featured-more {
  display: none;
  font-size: var(--step--1);
}

/* A video row also offers Stream. The row still downloads; the pill sits over
   its right edge, and the row's own size moves left to make room for it. */
.featured-streamable {
  position: relative;
}

.featured-streamable > .featured-row {
  padding-right: calc(15px + 6.5rem);
}

.featured-list .featured-stream {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 1;
  height: 32px;
  padding: 4px 12px 4px 10px;
  background: var(--paper-raised);
}

.featured-list .featured-stream:active:not(:disabled) {
  transform: translateY(calc(-50% + 1px));
}

/* A play triangle, drawn in the button's own colour. */
.featured-stream::before {
  content: "";
  width: 0;
  height: 0;
  border-block: 5px solid transparent;
  border-left: 8px solid currentColor;
}

/* In a narrow list the pill would squeeze a long name onto many lines, so it
   moves under the row's text instead. The list's own width decides, since the
   two-column layout narrows it on wide screens too. */
.featured-list {
  container-type: inline-size;
}

@container (max-width: 34rem) {
  .featured-streamable > .featured-row {
    padding-right: 15px;
    padding-bottom: calc(1rem + 32px + 0.6rem);
  }

  .featured-list .featured-stream {
    top: auto;
    bottom: 1rem;
    right: auto;
    left: calc(2.6rem + 0.9rem);
    transform: none;
  }

  .featured-list .featured-stream:active:not(:disabled) {
    transform: translateY(1px);
  }
}

/* The ring */

.map {
  margin: 0;
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 1rem;
}

#ring {
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: 1;
  display: block;
  overflow: visible;
}

/* You: a solid mark at the middle, with a slow ring going out from it while
   something is happening. */
.ring-browser {
  fill: var(--ink);
  stroke: none;
}

.ring-browser-glow {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.ring-browser-glow {
  animation: browserPulse 8s ease-out infinite;
}

#ring[data-busy="true"] .ring-browser-glow {
  animation-duration: 2.6s;
}

@keyframes browserPulse {
  from {
    transform: scale(0.78);
    opacity: 0.35;
  }
  to {
    transform: scale(1.55);
    opacity: 0;
  }
}

.ring-browser-label {
  fill: var(--ink-inverse);
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 800;
  text-anchor: middle;
}

.ring-browser-sub {
  fill: var(--ink-inverse);
  opacity: 0.72;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  text-anchor: middle;
}

/* The thread back to you. Strokes are kept at their screen width so the swarm
   stays drawn with the same line however far the view has pulled back. */
.ring-link {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  opacity: 0.55;
  vector-effect: non-scaling-stroke;
  transition: opacity 260ms ease, stroke 260ms ease;
}

.ring-link[data-state="answered"] {
  opacity: 0.8;
}

.ring-link[data-state="serving"] {
  stroke: var(--ink);
  stroke-width: 1.6;
  opacity: 0.75;
}

.ring-link[data-state="failed"] {
  stroke: var(--signal);
  stroke-dasharray: 2 5;
  opacity: 0.45;
}

/* A node that never answered is only news for a moment. It fades out with its
   thread, so an ordinary run is not left looking broken by the nodes that
   simply did not reply. Written after the failed rule so it wins on order. */
.ring-node-group,
.ring-link {
  transition: opacity 600ms ease, stroke 260ms ease;
}

.ring-node-group.is-faded,
.ring-link.is-faded {
  opacity: 0;
  pointer-events: none;
}

/* The swarm pulls back as it grows, so a busy network stays readable. */
.swarm-scene {
  transition: transform 900ms cubic-bezier(0.22, 0.8, 0.3, 1);
}

/* And it always turns, very slowly, so the page is never quite still. One turn
   for the whole swarm, so the room between bubbles is kept exactly. */
.swarm-sway {
  transform-origin: 320px 320px;
  animation: swarmSway 44s ease-in-out infinite alternate;
}

@keyframes swarmSway {
  from {
    transform: rotate(-2.4deg);
  }

  to {
    transform: rotate(2.4deg);
  }
}

/* Distance from you is the state; size and fill say the same thing again. */
.ring-node {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  transform-box: fill-box;
  transform-origin: center;
  transition: r 420ms cubic-bezier(0.22, 0.8, 0.3, 1), fill 260ms ease, stroke 260ms ease, opacity 260ms ease;
}

/* Every node that got as far as a connection keeps a beat of its own, so a
   swarm waiting on an answer never looks like a dead one. It beats at working
   pace while the moment on screen is a live one, and idles the rest of the
   time rather than stopping. */
.ring-node[data-state="open"],
.ring-node[data-state="answered"],
.ring-node[data-state="serving"] {
  animation: heartbeat 8s ease-in-out infinite;
  animation-delay: var(--beat, 0s);
}

#ring[data-busy="true"] .ring-node[data-state="open"],
#ring[data-busy="true"] .ring-node[data-state="answered"],
#ring[data-busy="true"] .ring-node[data-state="serving"] {
  animation-duration: 3.2s;
}

@keyframes heartbeat {
  0%,
  58%,
  100% {
    transform: scale(1);
  }

  70% {
    transform: scale(1.16);
  }

  84% {
    transform: scale(1.03);
  }
}

.ring-node[data-state="known"] {
  opacity: 0.62;
}

.ring-node[data-state="open"] {
  stroke-width: 2.4;
}

.ring-node[data-state="answered"] {
  fill: var(--ink);
}

.ring-node[data-state="serving"] {
  fill: var(--live);
  stroke: var(--live-edge);
  stroke-width: 2;
}

.ring-node[data-state="failed"] {
  fill: none;
  stroke: var(--signal-text);
  stroke-dasharray: 2 3;
  opacity: 0.9;
}

.ring-node-halo {
  fill: var(--live-soft);
  stroke: none;
}

/* A bubble pops when it arrives. */
.ring-bubble {
  transform-box: fill-box;
  transform-origin: center;
}

.ring-bubble.is-arriving {
  animation: bubblePop 520ms cubic-bezier(0.2, 1.5, 0.35, 1);
}

@keyframes bubblePop {
  from {
    opacity: 0;
    scale: 0.2;
  }
  62% {
    opacity: 1;
    scale: 1.3;
  }
  to {
    opacity: 1;
    scale: 1;
  }
}

/* An arrival, and every step a node takes after it, sends out one wave. The
   stroke keeps its screen width, so a wave reads the same however far the view
   has pulled back. */
.ring-ripple {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transform-box: fill-box;
  transform-origin: center;
  animation: ripple 900ms ease-out forwards;
}

@keyframes ripple {
  from {
    transform: scale(1);
    opacity: 0.6;
  }
  to {
    transform: scale(var(--reach, 3));
    opacity: 0;
  }
}

/* Travelling dots mean one thing only: chunk data on its way to you. Live,
   on, moving — the brand keeps signal green for dots, and this is dots. */
.ring-packet {
  fill: var(--live-pulse);
  stroke: var(--live-edge);
  stroke-width: 0.75;
  vector-effect: non-scaling-stroke;
}

figcaption {
  display: grid;
  gap: 0.85rem;
  font-size: var(--step--1);
  color: var(--ink-soft);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--paper);
}

.legend-swatch.known {
  opacity: 0.62;
}

.legend-swatch.answered {
  background: var(--ink);
}

.legend-swatch.serving {
  background: var(--live);
  border-color: var(--live-edge);
}

.legend-swatch.failed {
  border: 2px dashed var(--signal);
}

/* A soft sky wash marks a change of section, like the front page */

.wash {
  height: clamp(1.5rem, 4vw, 3rem);
  border-bottom: 1px solid var(--rule);
}

.stage + .wash {
  position: relative;
  height: clamp(90px, 14vw, 200px);
  margin-inline: calc(50% - 50vw);
  border: 0;
  background: linear-gradient(var(--hero-background), var(--page-background));
}

.stage + .wash::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--page-background);
  mask: url("bottom-fade.png") center / 100% 100% no-repeat;
  mask-mode: alpha;
  pointer-events: none;
}

.stage + .wash[data-fade-active="true"] {
  background: var(--hero-background);
}

.stage > .fade-canvas,
.stage + .wash > .fade-canvas {
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  image-rendering: pixelated;
  pointer-events: none;
  display: none;
  z-index: 0;
}

.stage:has(> .fade-canvas) > :not(.fade-canvas) {
  z-index: 1;
}

[data-fade-active="true"]::before {
  display: none;
}

.stage[data-fade-active="true"] > .fade-canvas,
.stage + .wash[data-fade-active="true"] > .fade-canvas {
  display: block;
}

/* Lift the masthead transition without moving stage content. */
.stage::before,
.stage > .fade-canvas {
  top: calc(clamp(90px, 14vw, 200px) * -0.16);
}

/* What this tab is doing: one live line under the circle */

.narration {
  display: grid;
  gap: 0.75rem;
  min-height: 7.5rem;
  align-content: start;
}

.rail {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.4rem;
}

.rail li {
  flex: 1 1 0;
  display: flex;
}

.rail-step {
  flex: 1 1 auto;
  height: 3px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  /* A step not yet reached still has to be seen against the cream. */
  background: rgba(35, 42, 89, 0.55);
  transition: background-color 300ms ease, height 160ms ease;
  cursor: default;
  position: relative;
}

/* A step you have already seen can be replayed. */
.rail-step:not(:disabled) {
  cursor: pointer;
}

.rail-step:not(:disabled)::after {
  content: "";
  position: absolute;
  inset: -0.7rem 0;
}

.rail-step:not(:disabled):hover {
  height: 7px;
}

.rail-step[data-inspecting="true"] {
  height: 7px;
  background: var(--ink);
}

.rail-step[data-state="active"] {
  background: var(--ink);
  height: 7px;
  animation: railPulse 1.4s ease-in-out infinite;
}

.rail-step[data-state="done"] {
  background: var(--ink);
}

.rail-step[data-state="failed"] {
  background: var(--signal);
}

@keyframes railPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.narration-line {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 1rem + 0.9vw, 1.7rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}

.narration-live {
  justify-self: start;
  padding: 5px 12px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.3;
  border-radius: var(--radius-button);
  border: 1px solid var(--control-edge);
  background: transparent;
  color: var(--ink);
}

.narration-live:hover {
  background: var(--action-hover);
  border-color: var(--action-hover);
}

.narration-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.5rem;
  margin: 0;
  min-height: 2.4rem;
}

.narration-facts div {
  display: grid;
  gap: 0.1rem;
  animation: narrationIn 320ms ease backwards;
}

.narration-facts dt {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
}

.narration-facts dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.journey {
  padding-block: 0.5rem 3rem;
  display: grid;
  gap: 1.5rem;
}

.journey-total {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  min-height: 1.2em;
}

/* Waterfall */

.waterfall {
  position: relative;
  display: grid;
  gap: 0.9rem;
}

.waterfall-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}

.waterfall h3 {
  font-family: var(--serif);
  font-size: var(--step-2);
  letter-spacing: -0.02em;
}

.waterfall-note {
  color: var(--ink-soft);
  font-size: var(--step--1);
  max-width: 44rem;
}

.waterfall-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-soft);
}

.waterfall-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.waterfall-swatch {
  width: 0.9rem;
  height: 0.55rem;
  border-radius: 2px;
}

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

.waterfall-plot {
  min-width: 40rem;
  padding: 0.5rem 1rem 0.9rem;
}

.waterfall-axis {
  position: relative;
  height: 1.6rem;
  margin-left: 9rem;
  border-bottom: 1px solid var(--rule);
}

.waterfall-tick {
  position: absolute;
  bottom: 0.3rem;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.waterfall-tick:first-child {
  transform: none;
}

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

.waterfall-row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  align-items: center;
  min-height: 1.35rem;
  border-radius: 0.25rem;
}

.waterfall-row:hover,
.waterfall-row:focus-visible {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.waterfall-label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-soft);
  padding-right: 0.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.waterfall-track {
  position: relative;
  height: 0.9rem;
}

.waterfall-life {
  position: absolute;
  top: 50%;
  height: 1px;
  background: var(--edge);
}

.waterfall-bar {
  position: absolute;
  top: 0.1rem;
  height: 0.7rem;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--paper-raised);
}

/* Still running: marked by an open end, not by fading the colour out. The
   marker is the surface colour, which clears 3:1 against every bar fill. */
.waterfall-bar.is-open {
  border-right: 2px dashed var(--paper-raised);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.kind-ice {
  background: var(--wf-ice);
}

.kind-dtls {
  background: var(--wf-dtls);
}

.kind-handshake {
  background: var(--wf-handshake);
}

.kind-lookup {
  background: var(--wf-lookup);
}

.kind-chunk {
  background: var(--wf-chunk);
  box-shadow: inset 0 0 0 1px var(--live-edge);
}

.waterfall-empty {
  padding: 1rem 0 0.4rem 9rem;
  color: var(--ink-soft);
  font-size: var(--step--1);
}

.waterfall-tip {
  position: absolute;
  z-index: 2;
  max-width: 22rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  background: var(--ink);
  color: var(--ink-inverse);
  font-size: 0.78rem;
  line-height: 1.4;
  pointer-events: none;
}

/* Event log */

.event-log summary {
  cursor: pointer;
  padding: 0.95rem 1.1rem;
  font-weight: 700;
}

.log-note {
  padding: 0 1.1rem 0.75rem;
  font-size: var(--step--1);
  color: var(--ink-soft);
  max-width: 48rem;
}

.log-lines {
  list-style: none;
  margin: 0;
  padding: 0.75rem 1.1rem 1.1rem;
  border-top: 1px solid var(--rule);
  max-height: 24rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.8;
}

.log-lines li {
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr);
  gap: 0.75rem;
}

.log-time {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.log-text {
  overflow-wrap: anywhere;
}

.log-lines li[data-kind="fault"] .log-text {
  color: var(--signal-text);
}

.log-lines li[data-kind="data"] .log-text {
  color: var(--ink);
  font-weight: 500;
}

/* Fine print */

.fine-print {
  border-top: 1px solid var(--rule);
  padding-block: 2rem 4rem;
  display: grid;
  gap: 1.25rem;
}

.fine-print-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1.5rem 2.5rem;
}

.fine-print-grid > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.fine-print h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
}

.fine-print p {
  color: var(--ink-soft);
  font-size: var(--step-0);
  max-width: 30rem;
}

.fine-print-grid > div > a {
  margin-top: auto;
  padding-top: 0.25rem;
}

/* Narrow screens */

@media (max-width: 1100px) {
  .network-status {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

@media (max-width: 860px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "intro" "featured" "form";
    grid-template-rows: auto;
    row-gap: 2rem;
  }

  .lede {
    margin-bottom: 0;
  }

  .map {
    position: static;
    max-width: 34rem;
    margin-inline: auto;
    width: 100%;
  }

  .outcome {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .masthead {
    padding: 1rem 0.75rem 0;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.5rem;
  }

  .wordmark {
    justify-self: end;
    gap: 0.5rem;
  }

  .wordmark-logo {
    height: 1.25rem;
  }

  h1 {
    font-size: clamp(2.5rem, 9vw, 4rem);
  }

  .address-plate textarea {
    min-height: 4.3em;
    font-size: 1rem;
  }

  /* Keep the centre label inside its disc. */
  .ring-browser-label {
    font-size: 18px;
  }

  .ring-browser-sub {
    font-size: 11px;
  }

  /* The status pill keeps its shape and its one line; at 13px tracked 0.15em
     this label wraps on a phone, so the type steps down rather than the pill. */
  .network-status {
    font-size: 0.625rem;
    letter-spacing: 0.1em;
  }
}

@media (max-width: 480px) {
  .result-actions > * {
    flex: 1 1 auto;
  }
}

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