/* AuxPipe website. The palette is the app's own (src/theme.rs), so the page
   and the window a buyer opens afterwards look like one product.

   Every size, colour, radius and duration below comes from a token in
   :root. Change a token, not a component, to change the look. */

:root {
  color-scheme: dark;

  /* Colour, named by role. Text tokens reach WCAG AA (4.5:1) on both the
     page and the cards; --color-border-control reaches 3:1 on the page. */
  --color-bg: #0b0c10;
  --color-surface: #14161c;
  --color-surface-hover: #1a1d25;
  --color-inset: #0e1015;
  --color-border: #23262f;
  --color-border-strong: #313642;
  --color-border-control: #5f6676;
  --color-text: #e8eaf0;
  --color-text-muted: #99a0af;
  --color-text-subtle: #80879a;
  --color-accent: #5b8cff;          /* links, icons, focus: 6.2:1 on the page */
  --color-primary: #3566ea;         /* filled buttons: white text at 4.95:1 */
  --color-primary-hover: #2f60e0;
  --color-primary-active: #2a58d4;
  --color-on-primary: #ffffff;
  --color-media: #3fc9f0;
  --color-voice: #b57bff;
  --color-success: #3ddc97;
  --color-warning: #f5b34a;
  --color-error: #ff6b6b;
  --color-focus: var(--color-accent);

  /* Spacing: an 8 px scale, with 4 px and 12 px for fine steps. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Type. */
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-size-sm: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-h2: clamp(1.75rem, 3vw, 2.25rem);
  --font-size-h1: clamp(2.25rem, 4.6vw, 3.5rem);

  /* Shape and depth. */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-media: 0 24px 64px rgba(0, 0, 0, 0.55);

  /* Layout and motion. */
  --header-height: 64px;
  --target: 44px;                   /* smallest touch target */
  --gutter: 20px;
  --duration: 150ms;

  /* Motion. Everything below only runs when the reader has not asked for
     reduced motion, and nothing is hidden where an animation cannot run. */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --duration-enter: 700ms;
  --stagger: 90ms;
  --rise: 18px;
  --duration-flow: 2.6s;
  --duration-glow: 14s;
  --pulse-size: 6px;
  --node-size: 18px;
  --neon-color: var(--color-accent);
  --neon-thickness: 2px;
  --neon-glow: 18px;
  --duration-neon: 7s;
  --duration-sweep: 9s;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + var(--space-4)); }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font: var(--font-size-md)/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* Links in running text are underlined, so colour is not the only cue. */
a { color: var(--color-accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--font-size-h1); font-weight: 700; }
h2 { font-size: var(--font-size-h2); font-weight: 650; }
h3 { font-size: var(--font-size-lg); font-weight: 600; }

/* One visible focus treatment for everything that takes focus. */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.wrap { width: min(1120px, 100% - 2 * var(--gutter)); margin-inline: auto; }

section { padding: var(--space-9) 0; }
.band { background: linear-gradient(180deg, rgba(20, 22, 28, 0.6), rgba(20, 22, 28, 0)); border-top: 1px solid var(--color-border); }
.section-lead { color: var(--color-text-muted); max-width: 640px; margin: var(--space-4) 0 0; font-size: var(--font-size-lg); }

.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 20;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text);
}
.skip-link:focus { top: var(--space-3); }

/* ---------------------------------------------------------------- nav -- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 12, 16, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.nav-row { display: flex; align-items: center; gap: var(--space-5); height: var(--header-height); }
.brand {
  display: flex; align-items: center; gap: var(--space-3); min-height: var(--target);
  color: var(--color-text); font-weight: 650; font-size: var(--font-size-lg); text-decoration: none;
}
.nav-wide { flex: 1; }
.nav-links { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-1); }
.nav-links a {
  display: flex; align-items: center; min-height: var(--target); padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted); font-size: var(--font-size-sm); text-decoration: none;
}
.nav-links a:hover { color: var(--color-text); background: var(--color-surface-hover); }
.nav-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
.nav-actions .button { white-space: nowrap; }

.menu-button {
  display: none; align-items: center; justify-content: center; flex: none;
  width: var(--target); height: var(--target); padding: 0; cursor: pointer;
  color: var(--color-text); background: transparent;
  border: 1px solid var(--color-border-control); border-radius: var(--radius-pill);
}
.menu-button:hover { background: var(--color-surface-hover); }
.menu-icon { width: 20px; height: 20px; }

/* The panel only exists on narrow screens; see the media query below. */
.nav-panel { display: none; }

/* ------------------------------------------------------------ buttons -- */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--target); padding: 0 var(--space-5); border-radius: var(--radius-pill);
  background: var(--color-primary); color: var(--color-on-primary);
  font: inherit; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
}
.button:hover { background: var(--color-primary-hover); }
.button:active { background: var(--color-primary-active); transform: translateY(1px); }
.button.small { padding: 0 var(--space-4); font-size: var(--font-size-sm); }
.button.ghost { background: transparent; color: var(--color-text); border-color: var(--color-border-control); }
.button.ghost:hover { background: var(--color-surface-hover); }
.button.ghost:active { background: var(--color-surface); }

/* --------------------------------------------------------------- hero -- */
.hero { padding: var(--space-8) 0; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 720px; height: 720px;
  background: radial-gradient(circle, rgba(91, 140, 255, 0.18), transparent 62%);
  pointer-events: none;
}
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: var(--space-8); align-items: center; position: relative; }
.eyebrow {
  margin: 0 0 var(--space-4);
  color: var(--color-media); font-weight: 600; font-size: var(--font-size-sm);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.lead { color: var(--color-text-muted); font-size: var(--font-size-lg); margin: var(--space-5) 0 0; max-width: 560px; }
.cta { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-6); }
/* A requirement, not a footnote: readable size and contrast. */
.fine { color: var(--color-text-muted); font-size: var(--font-size-sm); margin: var(--space-4) 0 0; max-width: 560px; }
.hero-shot { justify-self: center; }
.hero-shot img {
  width: 100%; max-width: 520px; height: auto; border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-strong);
  box-shadow: var(--shadow-media);
}

/* ------------------------------------------------------------ trailer -- */
.trailer { padding-top: var(--space-5); }
.trailer-video {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; margin-top: var(--space-6);
  background: #000; border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-strong);
  box-shadow: var(--shadow-media);
}

/* --------------------------------------------------------------- flow -- */
.flow { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-7); }
.flow-sources { display: flex; flex-direction: column; gap: var(--space-3); }
.node {
  background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); min-width: 150px; display: flex; flex-direction: column; gap: 2px;
}
.node strong { font-size: var(--font-size-md); }
.node span { color: var(--color-text-muted); font-size: var(--font-size-sm); }
.node.media { border-left: 3px solid var(--color-media); }
.node.voice { border-left: 3px solid var(--color-voice); }
.node.accent { border-color: rgba(91, 140, 255, 0.55); background: linear-gradient(180deg, rgba(91, 140, 255, 0.12), var(--color-surface)); }
.arrow { flex: 1; min-width: 18px; height: 2px; background: linear-gradient(90deg, var(--color-border-strong), var(--color-accent)); position: relative; }
.arrow::after {
  content: ""; position: absolute; right: -1px; top: -4px;
  border: 5px solid transparent; border-left-color: var(--color-accent); border-right: 0;
}

/* ----------------------------------------------------------- features -- */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); margin-top: var(--space-6); }
.card { background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius-lg); }
/* Feature cards are not links, so they have no hover state. */
.feature { padding: var(--space-5); }
.feature p { color: var(--color-text-muted); margin: var(--space-2) 0 0; }
.icon {
  width: 40px; height: 40px; padding: var(--space-2); margin-bottom: var(--space-4);
  color: var(--color-accent); background: rgba(91, 140, 255, 0.1); border-radius: var(--radius-sm);
}

/* -------------------------------------------------------------- setup -- */
.setup-grid { display: grid; grid-template-columns: 1.3fr 0.9fr; gap: var(--space-7); align-items: start; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: var(--space-6) 0 0; display: grid; gap: var(--space-5); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 40px 1fr; column-gap: var(--space-4); }
.steps li::before {
  content: counter(step); grid-row: span 2;
  width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center;
  background: var(--color-inset); border: 1px solid var(--color-border-strong); color: var(--color-accent); font-weight: 700;
}
.steps h3 { padding-top: var(--space-2); }
.steps p { color: var(--color-text-muted); margin: var(--space-1) 0 0; }
.requirements { padding: var(--space-5); }
.requirements dl { margin: var(--space-4) 0 0; display: grid; grid-template-columns: auto 1fr; gap: var(--space-3) var(--space-4); }
.requirements dt { color: var(--color-text-subtle); font-size: var(--font-size-sm); }
.requirements dd { margin: 0; font-size: var(--font-size-sm); }

/* ------------------------------------------------------------ roadmap -- */
/* A wire down the left, a node per stage. The colour of a stage is its own
   token, so the wire shades from one stage into the next. */
.roadmap { list-style: none; margin: var(--space-7) 0 0; padding: 0; max-width: 760px; }
.stage {
  --tone: var(--color-border-control);
  position: relative; padding: 0 0 var(--space-7) var(--space-7);
  view-timeline: --stage block;
}
.stage.done    { --tone: var(--color-success); --next-tone: var(--color-accent); }
.stage.active  { --tone: var(--color-accent);  --next-tone: var(--color-warning); }
.stage.pending { --tone: var(--color-warning); --next-tone: var(--color-voice); }
.stage.planned { --tone: var(--color-voice);   --next-tone: var(--color-media); }
.stage.finish  { --tone: var(--color-media); padding-bottom: 0; }

.stage-node {
  position: absolute; left: 0; top: 2px; width: var(--node-size); height: var(--node-size);
  border-radius: var(--radius-pill); border: 2px solid var(--tone);
  background: color-mix(in srgb, var(--tone) 22%, var(--color-bg));
}
.stage.finish .stage-node { box-shadow: 0 0 0 var(--space-1) color-mix(in srgb, var(--tone) 20%, transparent); }
/* The track the wire runs in, then the drawn wire on top of it. */
.stage-wire {
  position: absolute; left: calc(var(--node-size) / 2 - 1px); top: calc(var(--node-size) + var(--space-1));
  bottom: var(--space-1); width: 2px; background: var(--color-border); border-radius: var(--radius-pill);
}
.stage-fill {
  position: absolute; inset: 0; border-radius: inherit; transform-origin: top;
  background: linear-gradient(var(--tone), var(--next-tone));
}
/* Hidden unless motion is welcome; see below. */
.stage-pulse { display: none; }

.stage-label { font-size: var(--font-size-lg); color: var(--tone); }
.stage-items { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.stage-items li { color: var(--color-text-muted); padding-left: var(--space-4); position: relative; }
.stage-items li::before {
  content: ""; position: absolute; left: 0; top: 0.7em; width: var(--space-2); height: 2px;
  background: color-mix(in srgb, var(--tone) 60%, transparent); border-radius: var(--radius-pill);
}
.stage-note { color: var(--color-text-muted); margin: var(--space-2) 0 0; }

@keyframes wire-draw { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes node-reach {
  from { border-color: var(--color-border-strong); background: var(--color-bg); }
  to   { border-color: var(--tone); background: color-mix(in srgb, var(--tone) 22%, var(--color-bg)); }
}
@keyframes pulse-run { from { top: 0; } to { top: calc(100% - var(--pulse-size)); } }
@keyframes pulse-show { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: no-preference) {
  .stage-pulse {
    display: block; position: absolute; left: calc(1px - var(--pulse-size) / 2);
    width: var(--pulse-size); height: var(--pulse-size); border-radius: var(--radius-pill);
    background: var(--next-tone); box-shadow: 0 0 10px var(--next-tone);
    animation: pulse-run var(--duration-flow) linear infinite;
  }
  /* Tied to scrolling where the browser can: the wire draws as the stage
     passes, the node lights as the wire arrives, and the pulse only runs
     once its stretch is drawn. Elsewhere it is all simply there. */
  @supports (animation-timeline: view()) {
    .stage-fill {
      animation: wire-draw linear both;
      animation-timeline: --stage;
      animation-range: entry 70% cover 60%;
    }
    .stage-node {
      animation: node-reach linear both;
      animation-timeline: --stage;
      animation-range: entry 55% entry 85%;
    }
    .stage-body {
      animation: rise-in linear both;
      animation-timeline: --stage;
      animation-range: entry 40% entry 90%;
    }
    .stage-pulse {
      animation: pulse-run var(--duration-flow) linear infinite, pulse-show linear both;
      animation-timeline: auto, --stage;
      animation-range: normal, cover 55% cover 62%;
    }
  }
}

/* ---------------------------------------------------------------- faq -- */
/* Narrow for reading, but on the same left edge as every other section. */
#faq .wrap > * { max-width: 760px; }
details { border-bottom: 1px solid var(--color-border); }
details:first-of-type { margin-top: var(--space-5); border-top: 1px solid var(--color-border); }
summary {
  cursor: pointer; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-4);
  min-height: var(--target); padding: var(--space-4) 0;
}
summary::-webkit-details-marker { display: none; }
/* The sign is drawn, not read: a screen reader gets the empty text after
   "/", and already announces the row as expanded or collapsed. The first
   value is for browsers that do not know the "/" form. */
summary::after { content: "+"; content: "+" / ""; color: var(--color-text-muted); font-weight: 400; font-size: var(--font-size-xl); line-height: 1; }
details[open] summary::after { content: "\2212"; content: "\2212" / ""; }
summary:hover { color: var(--color-accent); }
details p { color: var(--color-text-muted); margin: 0 0 var(--space-5); }

/* ------------------------------------------------------------- policy -- */
/* --------------------------------------------------------------- news -- */
/* Steam announcements, fetched after load: see src/news.rs. Each post is a
   row like the questions below, its title with the date beside it; opening
   it shows the cover image, the text and the link to Steam. */
.news-list { margin: var(--space-5) 0 0; max-width: 760px; }
.news-list details:first-of-type { margin-top: 0; }
.news-title { flex: 1; text-wrap: balance; }
.news-date {
  color: var(--color-text-muted); font-size: var(--font-size-sm); font-weight: 400;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.news-text { padding: 0 0 var(--space-5); }
.news-cover {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: var(--radius-md); border: 1px solid var(--color-border); margin-bottom: var(--space-4);
}
.news-text h3 { margin: var(--space-5) 0 0; font-size: var(--font-size-md); }
.news-text p, .news-text li { color: var(--color-text-muted); text-wrap: pretty; }
.news-text p { margin: var(--space-3) 0 0; }
.news-text p:first-of-type { margin-top: 0; }
.news-text ul { margin: var(--space-3) 0 0; padding-left: var(--space-5); display: grid; gap: var(--space-2); }
.news-more { display: inline-block; margin-top: var(--space-4); font-weight: 600; }
.news-note { color: var(--color-text-muted); margin: var(--space-5) 0 0; }
.news-all { margin: var(--space-5) 0 0; }

/* The placeholders stand where the closed posts will. */
.news-skeleton {
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-4);
  min-height: var(--target); padding: var(--space-4) 0; border-bottom: 1px solid var(--color-border);
}
.news-skeleton:first-of-type { border-top: 1px solid var(--color-border); }
.skeleton-line { display: block; width: 55%; height: 14px; border-radius: var(--radius-pill); background: var(--color-surface-hover); }
.skeleton-line.short { width: 12%; height: 12px; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton-line { animation: skeleton-pulse 1.4s ease-in-out infinite alternate; }
}
@keyframes skeleton-pulse { from { opacity: 0.55; } to { opacity: 1; } }

/* Read out, not shown. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Running text: narrow for reading, on the same left edge as the rest. */
.policy { padding: var(--space-8) 0 var(--space-9); }
.policy .wrap > * { max-width: 760px; }
.policy h2 { font-size: var(--font-size-xl); margin-top: var(--space-7); }
.policy p { color: var(--color-text-muted); margin: var(--space-4) 0 0; }
.policy .section-lead { color: var(--color-text); }

/* -------------------------------------------------------------- guide -- */
/* A how-to page: running text like the policy, with the setup steps and the
   question rows of the product page. */
.guide { padding: var(--space-8) 0 var(--space-9); }
.guide .wrap > * { max-width: 760px; }
.guide h1, .guide h2, .guide h3 { text-wrap: balance; }
.guide h2 { font-size: var(--font-size-xl); margin-top: var(--space-7); }
.guide .wrap > p { color: var(--color-text-muted); margin: var(--space-4) 0 0; text-wrap: pretty; }
.guide .wrap > .section-lead { color: var(--color-text); font-size: var(--font-size-lg); }
/* The width cap above would otherwise lift the image's 100% limit on phones. */
.guide .wrap > .guide-shot {
  max-width: min(100%, 760px); margin-top: var(--space-6);
  border-radius: var(--radius-lg); border: 1px solid var(--color-border);
}
.guide-needs { margin: var(--space-4) 0 0; padding-left: var(--space-5); display: grid; gap: var(--space-2); color: var(--color-text-muted); }
.guide .steps { margin-top: var(--space-5); }
.guide .steps p { text-wrap: pretty; }
.guide .steps p + p { margin-top: var(--space-3); }
.guide-problems details:first-of-type { margin-top: var(--space-4); }
.guide .cta { margin-top: var(--space-5); }

/* ------------------------------------------------------------- footer -- */
footer { border-top: 1px solid var(--color-border); padding: var(--space-5) 0; color: var(--color-text-subtle); font-size: var(--font-size-sm); }
.footer-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4) var(--space-5); flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: var(--space-3); }
.footer-notes { margin: 0; }
.footer-links { display: flex; align-items: center; gap: var(--space-2) var(--space-5); flex-wrap: wrap; }
footer a { color: var(--color-text-muted); }
.footer-link, .footer-brand a { display: inline-flex; align-items: center; min-height: var(--target); }

/* -------------------------------------------------------- narrow widths -- */
@media (max-width: 980px) {
  .features { grid-template-columns: repeat(2, 1fr); }
  .hero-grid, .setup-grid { grid-template-columns: 1fr; }
  .hero-shot img { max-width: 440px; }
  .flow { flex-direction: column; align-items: stretch; }
  .flow-sources { flex-direction: row; }
  .flow-sources .node { flex: 1; }
  .arrow { width: 2px; height: 24px; min-width: 0; flex: none; align-self: center;
           background: linear-gradient(180deg, var(--color-border-strong), var(--color-accent)); }
  .arrow::after { right: -4px; top: auto; bottom: -1px; border: 5px solid transparent;
                  border-top-color: var(--color-accent); border-bottom: 0; }

  /* The section links and the language move into the menu. */
  .nav-wide, .lang-wide { display: none; }
  .menu-button { display: inline-flex; }
  .nav-panel {
    display: block; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--color-bg); border-bottom: 1px solid var(--color-border);
    padding: var(--space-2) 0 var(--space-4);
  }
  .nav-panel[hidden] { display: none; }
  .nav-panel .nav-links { flex-direction: column; gap: 0; }
  .nav-panel .nav-links a { min-height: 48px; padding: 0 var(--space-3); font-size: var(--font-size-md); }
  .nav-panel .button { margin-top: var(--space-3); width: 100%; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .features { grid-template-columns: 1fr; }
  .flow-sources { flex-direction: column; }
  section { padding: var(--space-8) 0; }
  .hero { padding: var(--space-7) 0; }
  .cta .button { flex: 1 1 auto; }
  .nav-row { gap: var(--space-3); }
}

/* Too narrow for the name next to the button: the icon stays. */
@media (max-width: 399px) {
  .brand-name { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .menu-button, .nav-links a, summary {
    transition: background-color var(--duration) ease, color var(--duration) ease, transform var(--duration) ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button:active { transform: none; }
}

/* ------------------------------------------------------------- motion -- */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(var(--rise)); }
  to   { opacity: 1; transform: none; }
}
@keyframes settle-in {
  from { opacity: 0; transform: translateY(var(--rise)) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
/* The signal running from each source, through AuxPipe, into the call. */
@keyframes flow-across { from { left: 0; } to { left: calc(100% - var(--pulse-size)); } }
@keyframes flow-down   { from { top: 0; }  to { top: calc(100% - var(--pulse-size)); } }
@keyframes glow-drift {
  0%, 100% { transform: translate(0, 0); opacity: 1; }
  50%      { transform: translate(-6%, 4%); opacity: 0.75; }
}

@media (prefers-reduced-motion: no-preference) {
  /* The hero arrives in reading order: eyebrow, title, lead, buttons, then
     the window beside them. */
  .hero-copy > * { animation: rise-in var(--duration-enter) var(--ease-out) both; }
  .hero-copy > :nth-child(2) { animation-delay: calc(var(--stagger) * 1); }
  .hero-copy > :nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
  .hero-copy > :nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
  .hero-copy > :nth-child(5) { animation-delay: calc(var(--stagger) * 4); }
  .hero-shot { animation: settle-in var(--duration-enter) var(--ease-out) calc(var(--stagger) * 3) both; }
  .hero::before { animation: glow-drift var(--duration-glow) ease-in-out infinite; }

  .arrow::before {
    content: ""; position: absolute; top: calc(50% - var(--pulse-size) / 2);
    width: var(--pulse-size); height: var(--pulse-size); border-radius: var(--radius-pill);
    background: var(--color-media); box-shadow: 0 0 10px var(--color-media);
    animation: flow-across var(--duration-flow) linear infinite;
  }
  /* Each hop starts a little after the one before, so the pulse reads as
     one signal travelling left to right. */
  .flow > .arrow:nth-of-type(2)::before { animation-delay: calc(var(--duration-flow) / 3); }
  .flow > .arrow:nth-of-type(3)::before { animation-delay: calc(var(--duration-flow) * 2 / 3); }

  /* Sections reveal as they scroll in, where the browser can tie an
     animation to scrolling. Elsewhere they are simply there. */
  @supports (animation-timeline: view()) {
    .trailer-video, .flow, .feature, .steps li, .requirements, details {
      animation: rise-in linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 35%;
    }
  }
}

/* A light running around a frame, after Originkit's Neon Border: a conic
   gradient with two bright arcs, masked to a thin ring and turned by
   animating its start angle. Behind the screenshot, an unmasked, blurred
   copy is the glow. Without @property the angle cannot animate, and the
   ring simply stays still. */
@property --neon-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
@keyframes neon-orbit { to { --neon-angle: 360deg; } }

/* A band of the app's media and voice colours passing through the headline,
   after Originkit's Gradient Text. */
@keyframes colour-sweep {
  from { background-position: 100% 0; }
  to   { background-position: 0 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-shot { position: relative; isolation: isolate; border-radius: var(--radius-lg); }
  .node.accent { position: relative; }
  .hero-shot::before, .hero-shot::after, .node.accent::before {
    content: ""; position: absolute; inset: calc(-1 * var(--neon-thickness));
    border-radius: inherit; padding: var(--neon-thickness); pointer-events: none;
    background: conic-gradient(from var(--neon-angle),
      transparent 0deg, var(--neon-color) 50deg, transparent 100deg,
      transparent 180deg, var(--neon-color) 230deg, transparent 280deg);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    animation: neon-orbit var(--duration-neon) linear infinite;
  }
  /* The glow sits under the opaque screenshot, so only its halo shows. */
  .hero-shot::after {
    z-index: -1; padding: 0;
    -webkit-mask: none; mask: none;
    filter: blur(var(--neon-glow)); opacity: 0.9;
  }
}

/* Text drawn with a background must not vanish where the system replaces
   colours, so the sweep only runs where it does not. */
@media (prefers-reduced-motion: no-preference) and (forced-colors: none) {
  .hero h1 {
    background: linear-gradient(100deg,
      var(--color-text) 0 38%, var(--color-media) 46%, var(--color-voice) 54%,
      var(--color-text) 62% 100%);
    background-size: 300% 100%;
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    animation: rise-in var(--duration-enter) var(--ease-out) both,
               colour-sweep var(--duration-sweep) ease-in-out var(--duration-enter) infinite alternate;
    animation-delay: calc(var(--stagger) * 1), var(--duration-enter);
  }
}

@media (prefers-reduced-motion: no-preference) and (max-width: 980px) {
  /* The diagram stacks on narrow screens, so the pulse runs downward. */
  .arrow::before {
    top: 0; left: calc(50% - var(--pulse-size) / 2);
    animation-name: flow-down;
  }
}
