/*
  r3kal website styles. Brand colors from the r3kal brand kit, and surfaces that match
  the desktop app's themes. No inline styles anywhere: the
  site's Content-Security-Policy is style-src 'self'.
*/

/* ---------- Fonts (vendored Geist, SIL OFL 1.1: /fonts/OFL.txt) ---------- */

@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Regular.ttf?v=6a5d5f9e7dcd") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Medium.ttf?v=e68c64f8af78") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-SemiBold.ttf?v=a690e797cf4a") format("truetype");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Theme tokens ---------- */

:root {
  color-scheme: light;
  /* The brand: red. Bright to deep is the logo's gradient; there is no second accent colour. */
  --brand-bright: #FF3B4A;
  --brand: #E3152F;
  --brand-deep: #B30D26;

  --bg: #FFFFFF;
  --bg-alt: #F4F4F5;
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;
  --border: #E4E4E7;
  --text: #18181B;
  --muted: #52525B;
  /* Accent as text on light: the deep red, 5.5:1 or more on the page, the alt page and the tint. */
  --accent: #B30D26;
  --on-accent: #FFFFFF;
  /* The filled accent under white words (primary buttons, the demo's pills): a shade under the logo's red, so white on it
     is 5.0:1 (on #FF3D4D it would be 3.5:1); hover is the deep red, 7.0:1. The bright reds #FF3B4A and #FF3D4D
     are for the logo, glows and other places with no words on them. */
  --accent-strong: #DC1430;
  --accent-strong-hover: #B30D26;
  --on-accent-strong: #FFFFFF;
  --accent-tint: rgba(220, 20, 48, 0.08);
  --accent-glow: rgba(255, 59, 74, 0.28);
  --hero-glow: rgba(255, 59, 74, 0.1);
  /* The highlight, used sparingly: tag chips and small badges, the active tab's line, glows, focus and selection.
     It is the deep red (no second colour); as words on light it is 5.5:1 or more on its tint. */
  --highlight: #B30D26;
  --highlight-strong: #B30D26;
  --on-highlight-strong: #FFFFFF;
  --highlight-tint: rgba(179, 13, 38, 0.08);
  --highlight-glow: rgba(227, 21, 47, 0.3);
  --hero-glow-accent: rgba(179, 13, 38, 0.07);
  --selection: rgba(255, 59, 74, 0.22);
  --code-bg: #F4F4F5;
  --shadow: 0 1px 2px rgba(24, 24, 27, 0.06), 0 8px 24px rgba(24, 24, 27, 0.08);
  --shadow-lift: 0 2px 4px rgba(24, 24, 27, 0.06), 0 18px 40px rgba(24, 24, 27, 0.14);
  --header-bg: rgba(255, 255, 255, 0.82);
  --horizon-line: rgba(220, 20, 48, 0.16);
  --aurora-opacity: 0.5;
  --grain-opacity: 0.05;
  --focus: #DC1430;
  /* Gradient text: every stop is at least 3:1 on the page background (large text only). */
  --title-grad-1: #FF3B4A;
  --title-grad-2: #E3152F;
  --title-grad-3: #B30D26;
  /* The paid plan's gold badge. */
  --gold-1: #FFD978;
  --gold-2: #F5B83D;
  --on-gold: #2B1A00;

  --radius: 20px;
  --radius-small: 12px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #18181B;
    --bg-alt: #131316;
    --surface: #1F1F23;
    --surface-raised: #27272A;
    --border: #34343A;
    --text: #FAFAFA;
    --muted: #A1A1AA;
    /* Accent as text, rings and small fills: the light red, dark text on it. */
    --accent: #FF6B78;
    --on-accent: #18181B;
    --accent-strong: #DC1430;
    --accent-strong-hover: #B30D26;
    --on-accent-strong: #FFFFFF;
    --accent-tint: rgba(255, 61, 77, 0.12);
    --accent-glow: rgba(255, 59, 74, 0.34);
    --hero-glow: rgba(255, 59, 74, 0.16);
    --highlight: #FF8A94;
    --highlight-strong: #B30D26;
    --on-highlight-strong: #FFFFFF;
    --highlight-tint: rgba(255, 61, 77, 0.12);
    --highlight-glow: rgba(255, 61, 77, 0.4);
    --hero-glow-accent: rgba(179, 13, 38, 0.2);
    /* Selected words: a deep red wash, so the text, muted, accent and highlight words stay 4.5:1 or more on it. */
    --selection: rgba(179, 13, 38, 0.35);
    --code-bg: #131316;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.4), 0 18px 40px rgba(0, 0, 0, 0.5);
    --header-bg: rgba(24, 24, 27, 0.8);
    --horizon-line: rgba(255, 61, 77, 0.2);
    --aurora-opacity: 0.6;
    --grain-opacity: 0.07;
    --focus: #FF6B78;
    --title-grad-1: #FF8A94;
    --title-grad-2: #FF3D4D;
    --title-grad-3: #E3152F;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #18181B;
  --bg-alt: #131316;
  --surface: #1F1F23;
  --surface-raised: #27272A;
  --border: #34343A;
  --text: #FAFAFA;
  --muted: #A1A1AA;
  /* Accent as text, rings and small fills: the light red, dark text on it. */
  --accent: #FF6B78;
  --on-accent: #18181B;
  --accent-strong: #DC1430;
  --accent-strong-hover: #B30D26;
  --on-accent-strong: #FFFFFF;
  --accent-tint: rgba(255, 61, 77, 0.12);
  --accent-glow: rgba(255, 59, 74, 0.34);
  --hero-glow: rgba(255, 59, 74, 0.16);
  --highlight: #FF8A94;
  --highlight-strong: #B30D26;
  --on-highlight-strong: #FFFFFF;
  --highlight-tint: rgba(255, 61, 77, 0.12);
  --highlight-glow: rgba(255, 61, 77, 0.4);
  --hero-glow-accent: rgba(179, 13, 38, 0.2);
  /* Selected words: a deep red wash, so the text, muted, accent and highlight words stay 4.5:1 or more on it. */
  --selection: rgba(179, 13, 38, 0.35);
  --code-bg: #131316;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.4), 0 18px 40px rgba(0, 0, 0, 0.5);
  --header-bg: rgba(24, 24, 27, 0.8);
  --horizon-line: rgba(255, 61, 77, 0.2);
  --aurora-opacity: 0.6;
  --grain-opacity: 0.07;
  --focus: #FF6B78;
  --title-grad-1: #FF8A94;
  --title-grad-2: #FF3D4D;
  --title-grad-3: #E3152F;
}

/* Logo variants: the dark wordmark on light, the white one on dark. */
.logo-on-dark { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-on-light { display: none; }
  :root:not([data-theme="light"]) .logo-on-dark { display: block; }
}

:root[data-theme="dark"] .logo-on-light { display: none; }
:root[data-theme="dark"] .logo-on-dark { display: block; }

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

p {
  margin: 0 0 1em;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

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

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

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

main:focus {
  outline: none;
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}

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

[hidden] {
  display: none !important;
}

.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 720px) {
  .wrap {
    padding: 0 32px;
  }
}

.wrap-narrow {
  max-width: 820px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-small);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Trial offer ---------- */

/* A floating card, bottom-centre on phones and bottom-right on wider screens. It's in the page
   with the hidden attribute, and offer.js (which site.js imports) shows it, so without the script it never appears. It
   slides in once, after a short pause, and can't be clicked or focused until it does (the
   keyframes start hidden); with reduced motion the global rule below removes the animation
   and it's simply there. It isn't a dialog: nothing behind it is blocked. While it's shown,
   offer.js marks <html> with .offer-open and sets --offer-space to the card's measured height
   plus its bottom gap, so focused content and the page's end scroll clear of it; the values
   here are the fallbacks for each layout. */
.trial-offer {
  position: fixed;
  z-index: 60;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  padding: 14px 52px 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-lift);
  font-size: 0.92rem;
  line-height: 1.45;
  animation: offer-in 0.5s var(--ease-out) 1.6s both;
}

/* When the card waited for the consent answer, it opens right after it. */
.trial-offer-now {
  animation-delay: 0s;
}

@media (min-width: 720px) {
  .trial-offer {
    left: auto;
    right: 24px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    width: 360px;
    padding: 18px 52px 18px 20px;
    font-size: 0.95rem;
  }
}

.trial-offer-text {
  margin: 0 0 12px;
  color: var(--muted);
}

.trial-offer-badge {
  display: inline-block;
  margin-right: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--highlight-strong);
  color: var(--on-highlight-strong);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.trial-offer-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}

.trial-offer-link:hover {
  text-decoration: underline;
}

.trial-offer-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.trial-offer-close:hover {
  background: var(--accent-tint);
  color: var(--text);
}

.offer-open {
  --offer-space: calc(200px + env(safe-area-inset-bottom, 0px));
  scroll-padding-bottom: var(--offer-space);
}

@media (min-width: 720px) {
  .offer-open {
    --offer-space: calc(230px + env(safe-area-inset-bottom, 0px));
  }
}

.offer-open body {
  padding-bottom: var(--offer-space);
}

@keyframes offer-in {
  from { visibility: hidden; opacity: 0; transform: translateY(16px); }
  to { visibility: visible; opacity: 1; transform: none; }
}

@media print {
  .trial-offer {
    display: none;
  }
}

/* ---------- Consent pop-up and Settings ---------- */

/* The first-visit pop-up: a rounded card that blocks nothing, in the page with the hidden
   attribute, shown by consent.js. Accept and Decline have the same style and size. The offer
   card waits until it's answered, so the two are never on screen together, and if its text
   is taller than a phone can spare it scrolls. While it's shown,
   consent.js marks <html> with .consent-open and sets --consent-space to its measured height,
   so focused content and the page's end scroll clear of it; these values are the fallbacks. */
.consent {
  position: fixed;
  z-index: 61;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  max-height: 60vh;
  overflow-y: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-lift);
  font-size: 0.92rem;
  line-height: 1.45;
}

@media (min-width: 900px) {
  .consent {
    right: auto;
    left: 24px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    width: 440px;
    padding: 18px 20px;
  }
}

.consent-text {
  margin: 0 0 12px;
  color: var(--muted);
}

.consent-text strong {
  color: var(--text);
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.consent-actions .button {
  flex: 0 1 112px;
  min-height: 42px;
  padding: 8px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.consent-settings,
.footer-link {
  min-height: 42px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.footer-link {
  padding: 8px 0;
}

.footer-settings {
  margin: 0;
}

.consent-open {
  --consent-space: calc(240px + env(safe-area-inset-bottom, 0px));
  scroll-padding-bottom: var(--consent-space);
}

.consent-open body {
  padding-bottom: var(--consent-space);
}

.settings {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-lift);
  overflow: auto;
}

.settings::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.settings h2 {
  margin: 0;
  font-size: 1.4rem;
}

.settings h3 {
  margin: 20px 0 4px;
  font-size: 1rem;
}

.settings p {
  margin: 8px 0;
  color: var(--muted);
}

.settings-status {
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.settings-close:hover {
  background: var(--accent-tint);
  color: var(--text);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.settings-main {
  font-weight: 600;
}

.settings-label {
  display: grid;
  gap: 2px;
}

.settings-label small {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.switch {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--muted);
  border-radius: 999px;
  background: var(--bg-alt);
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--muted);
  transition: transform 0.15s ease;
}

.switch[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent);
}

.switch[aria-checked="true"]::after {
  background: var(--on-accent);
  transform: translateX(20px);
}

@media print {
  .consent {
    display: none;
  }
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 24px;
  min-height: 64px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
}

.logo {
  width: 96px;
  height: auto;
}

.site-nav {
  order: 3;
  flex-basis: 100%;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--accent-tint);
}

.theme-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.3s var(--ease-out), border-color 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: rotate(-20deg);
}

.theme-icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-icon-moon { display: block; }
}

:root[data-theme="dark"] .theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-moon { display: block; }

@media (min-width: 820px) {
  .header-inner {
    flex-wrap: nowrap;
  }

  .site-nav {
    order: 0;
    flex-basis: auto;
    margin-left: auto;
  }

  .theme-toggle {
    margin-left: 0;
  }
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.button-primary {
  background: var(--accent-strong);
  color: var(--on-accent-strong);
  box-shadow: 0 6px 22px var(--accent-glow);
}

.button-primary:hover {
  transform: translateY(-2px);
  background: var(--accent-strong-hover);
  box-shadow: 0 10px 30px var(--accent-glow);
  text-decoration: none;
}

.button-ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.button-ghost:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 56px 0 0;
  isolation: isolate;
}

@media (min-width: 900px) {
  .hero {
    padding-top: 88px;
  }
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(48% 42% at 0% 0%, var(--hero-glow), transparent 70%),
    radial-gradient(44% 40% at 100% 12%, var(--hero-glow-accent), transparent 70%);
}

/*
  Hero background, three layers on the page colour:
  - a perspective grid in faint brand red that fades into a horizon and glides
    towards the viewer for a few passes, then rests;
  - soft aurora colour fields (the brand reds) that drift and turn
    slowly behind the phone, never behind the headline, so text contrast holds;
  - a fine grain from the site's own noise SVG, for texture.
  Every motion stops on its own, and replay.js plays it again when the visitor returns. Reduced motion shows it still; forced colours hide it.
*/

.horizon {
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: 0;
  height: 62%;
  background-image:
    linear-gradient(var(--horizon-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--horizon-line) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(520px) rotateX(64deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.6) 35%, transparent 85%);
  mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.6) 35%, transparent 85%);
  animation: horizon-glide 7s linear 4 forwards;
}

.grain {
  position: absolute;
  inset: 0;
  background-image: url("../img/noise.svg?v=6c11d1b96684");
  background-size: 180px 180px;
  opacity: var(--grain-opacity);
}

.hero-backdrop::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 96px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--bg));
}

/* The aurora: two blurred colour fields, placed by their container. */
.aurora {
  position: absolute;
  z-index: -1;
  pointer-events: none;
  opacity: var(--aurora-opacity);
}

.aurora::before,
.aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.aurora::before {
  background:
    radial-gradient(closest-side at 32% 38%, rgba(255, 59, 74, 0.75), rgba(255, 59, 74, 0)),
    radial-gradient(closest-side at 70% 68%, rgba(179, 13, 38, 0.7), rgba(179, 13, 38, 0)),
    radial-gradient(closest-side at 64% 22%, rgba(255, 138, 148, 0.5), rgba(255, 138, 148, 0));
  filter: blur(36px);
  animation: aurora-drift 15s ease-in-out 4 alternate forwards;
}

.aurora::after {
  inset: 12%;
  background: conic-gradient(from 0deg, rgba(227, 21, 47, 0), rgba(227, 21, 47, 0.55), rgba(255, 59, 74, 0) 38%, rgba(179, 13, 38, 0.4) 68%, rgba(227, 21, 47, 0));
  filter: blur(44px);
  animation: aurora-turn 28s linear 2 forwards;
}

/* Behind the phone: the demo is the hero's anchor, so the colour sits there. */
.hero-demo {
  position: relative;
}

.hero-demo > .aurora {
  inset: -18% -30% 4%;
}

/* On the 404 page there's no phone: the colour sits in the top corner. */
.aurora-corner {
  top: -30%;
  right: -20%;
  width: min(720px, 90vw);
  height: min(720px, 90vw);
}

.hero-inner {
  display: grid;
  gap: 40px;
  align-items: center;
}

@media (min-width: 900px) {
  .hero-inner {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 56px;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.hero-title {
  font-size: clamp(2.3rem, 7.4vw, 4.4rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.hero-title-line {
  display: block;
}

.hero-title-punch {
  margin-top: 0.12em;
  background: linear-gradient(120deg, var(--title-grad-1), var(--title-grad-2) 55%, var(--title-grad-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.word-cycle {
  display: inline-block;
  height: 1.12em;
  overflow: hidden;
  vertical-align: bottom;
}

.word-track {
  display: flex;
  flex-direction: column;
  /* Three cycles, then it rests on the first word again. */
  animation: word-cycle 10s var(--ease-out) 3 forwards;
}

.word-track span {
  display: block;
  height: 1.12em;
  line-height: 1.12;
  background: linear-gradient(120deg, var(--title-grad-1), var(--title-grad-2) 55%, var(--title-grad-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.lede {
  max-width: 38em;
  margin-top: 22px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-facts li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero-facts li::before {
  content: "";
  width: 6px;
  height: 11px;
  margin: 0 4px 3px 2px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
}

/*
  Hero demo: an illustration of saving a video, shown on a phone, drawn after the app as it
  is now: a video in another app, Share, r3kal in the share menu, r3kal's one share screen
  (title, preview, the Tags dropdown opening in place, Watch-Later, Cancel and Save), what it
  saved, and the library. One 20 s timeline, shared by every scene, plays three times and then
  rests on its last frame, the library. The resting styles below ARE that library frame, so
  with no animation (reduced motion, or an old browser) the phone shows it.
*/

.hero-demo {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-width: 0;
}

.demo-caption {
  max-width: 300px;
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.phone {
  --demo-time: 20s;
  --demo-loops: 3;
  position: relative;
  width: min(280px, 100%);
  aspect-ratio: 9 / 18.6;
  padding: 10px;
  border-radius: 44px;
  background: #18181B;
  box-shadow: inset 0 0 0 2px #34343A, 0 30px 60px rgba(24, 24, 27, 0.35), 0 0 0 1px var(--border);
}

.phone::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 8;
  width: 84px;
  height: 22px;
  margin-left: -42px;
  border-radius: 12px;
  background: #000000;
}

.phone-screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 34px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 0;
}

.phone-screen b {
  font-weight: 600;
}

.phone-screen small {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
}

.demo-status {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 6px 26px 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  animation: demo-status var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

.status-icons {
  display: inline-flex;
  gap: 3px;
  align-items: flex-end;
}

.status-icons i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: currentColor;
}

.status-icons i:nth-child(1) { height: 5px; }
.status-icons i:nth-child(2) { height: 7px; }
.status-icons i:nth-child(3) { height: 9px; }

.status-icons i:nth-child(4) {
  width: 18px;
  height: 9px;
  margin-left: 4px;
  border-radius: 3px;
}

/* Scene 1: the video. */
.demo-video {
  position: absolute;
  inset: 0;
  z-index: 2;
  color: #FFFFFF;
  background:
    radial-gradient(circle at 50% 40%, #F6CF7A 0 17%, #E9A940 18% 23%, #FFFFFF 24% 29%, rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle at 30% 75%, #6C8F3A 0 6%, rgba(108, 143, 58, 0) 7%),
    linear-gradient(165deg, #4A3323, #1A110B 70%);
  opacity: 0;
  visibility: hidden;
  animation: demo-video var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

.video-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.25);
}

.video-progress::after {
  content: "";
  display: block;
  height: 100%;
  background: #FFFFFF;
  transform-origin: left;
  transform: scaleX(1);
  animation: demo-progress var(--demo-time) linear var(--demo-loops) forwards;
}

.video-rail {
  position: absolute;
  right: 8px;
  bottom: 96px;
  display: grid;
  gap: 14px;
  justify-items: center;
  font-size: 10.5px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.rail-item {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
}

.rail-item svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.video-meta {
  position: absolute;
  left: 12px;
  right: 60px;
  bottom: 18px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.video-meta p {
  margin: 0 0 4px;
}

.video-handle {
  font-weight: 600;
  font-size: 12.5px;
}

.video-caption {
  font-size: 11px;
}

.video-sound {
  font-size: 10.5px;
  opacity: 0.9;
}

/* A tap: a ripple that grows and fades. */
.tap {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  opacity: 0;
  pointer-events: none;
}

.tap-share {
  top: 14px;
  animation: demo-tap-share var(--demo-time) ease-out var(--demo-loops) forwards;
}

.tap-r3kal {
  top: 22px;
  background: var(--accent);
  animation: demo-tap-r3kal var(--demo-time) ease-out var(--demo-loops) forwards;
}

/* Scene 2: the share sheet. */
.demo-scrim {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  animation: demo-scrim var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

.demo-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 8px 12px 18px;
  border-radius: 20px 20px 0 0;
  background: var(--surface-raised);
  color: var(--text);
  transform: translateY(105%);
  animation: demo-sheet var(--demo-time) cubic-bezier(0.16, 1, 0.3, 1) var(--demo-loops) forwards;
}

.sheet-grabber {
  display: block;
  width: 36px;
  height: 4px;
  margin: 0 auto 10px;
  border-radius: 2px;
  background: var(--border);
}

.sheet-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.sheet-preview > span:last-child {
  min-width: 0;
}

.sheet-preview b {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sheet-thumb {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.sheet-apps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 10px 0;
}

.sheet-app {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 6px 0;
  border-radius: 12px;
  font-size: 9.5px;
  overflow: hidden;
}

.sheet-app-r3kal {
  font-weight: 600;
  animation: demo-pick var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

.app-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.app-icon svg {
  width: 20px;
  height: 20px;
}

/* Illustration colours of other apps in the demo share sheet (Messages green, Mail blue, Notes yellow): not brand colours. */
.app-message { background: #34C759; }
.app-mail { background: #1E88FF; }
.app-notes { background: #FFD60A; color: #6B5800; }

.app-more {
  background: var(--bg-alt);
  color: var(--muted);
  border: 1px solid var(--border);
}

.sheet-actions {
  display: grid;
  gap: 6px;
}

.sheet-actions span {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--bg-alt);
  font-size: 11.5px;
}

/* Scene 3: r3kal's own share screen, as the app's share sheet lays it out (one screen, top to bottom): the mark and
   "Share to r3kal" with the small saved check, the title, the preview of the library card, the Tags dropdown (which
   opens in place on its tiles, "New tag" first), Watch-Later, and Cancel and Save floating at the bottom right. */
.demo-form {
  position: absolute;
  top: 46px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 8px 12px 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
  transform: translateY(105%);
  animation: demo-form var(--demo-time) cubic-bezier(0.16, 1, 0.3, 1) var(--demo-loops) forwards;
}

.form-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}

.form-head img {
  flex: none;
  width: 26px;
  height: 26px;
}

/* The saved check: the accent's text shade, with the mark cut out in the sheet's own colour. */
.form-check {
  display: grid;
  flex: none;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
}

.form-check svg {
  width: 9px;
  height: 9px;
}

.form-head .form-check {
  animation: demo-check var(--demo-time) ease-out var(--demo-loops) forwards;
}

.form-ask {
  animation: demo-ask var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

.form-caption {
  display: block;
  margin: 0 0 3px 2px;
  color: var(--muted);
  font-size: 10px;
}

.form-field {
  display: block;
  margin-bottom: 9px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-alt);
  overflow: hidden;
  font-size: 11.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.demo-form .form-card {
  margin-bottom: 9px;
}

.form-card-tag {
  opacity: 0;
  animation: demo-picked var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

/* A row that is one button: the Tags dropdown, and Watch-Later. */
.form-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  font-size: 11.5px;
}

.form-row-text {
  flex: 1;
  min-width: 0;
}

.form-row-text small {
  font-size: 9.5px;
}

.form-summary {
  display: grid;
}

.form-summary > span {
  grid-area: 1 / 1;
}

.summary-none {
  animation: demo-unpicked var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

.summary-picked {
  opacity: 0;
  animation: demo-picked var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

.form-chevron,
.form-clock {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.form-chevron {
  animation: demo-chevron var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

/* The tags' tiles, three a row: closed until the Tags row is tapped, then they open where they are. */
.form-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 0;
  margin-bottom: 8px;
  overflow: hidden;
  animation: demo-tiles var(--demo-time) cubic-bezier(0.16, 1, 0.3, 1) var(--demo-loops) forwards;
}

.form-tile {
  position: relative;
  display: grid;
  gap: 2px;
  justify-items: center;
  padding-top: 8px;
  overflow: hidden;
  font-size: 9.5px;
  font-weight: 500;
  white-space: nowrap;
}

.tile-pic {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.tile-new {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

.form-tile-pick .tile-pic {
  animation: demo-tile-pick var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

.tile-tick {
  position: absolute;
  top: -5px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--highlight-strong);
  color: var(--on-highlight-strong);
  opacity: 0;
  animation: demo-picked var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

.tile-tick svg {
  width: 8px;
  height: 8px;
}

/* Watch-Later's switch, off. */
.form-switch {
  flex: none;
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: var(--border);
  box-shadow: inset 0 0 0 1px var(--border);
}

.form-switch::after {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  margin: 2px;
  border-radius: 50%;
  background: #FFFFFF;
}

/* What the screen says once Save is tapped, held for a moment so it can be read, as in the app's tutorial (the real
   share screen closes as soon as Save is written). */
.form-done {
  position: absolute;
  top: 46%;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  opacity: 0;
  animation: demo-done var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

.form-done b {
  min-width: 0;
}

/* Cancel and Save, floating at the bottom right. Save is red, so Cancel is neutral with a clear edge, as in the app's red theme. */
.form-buttons {
  position: absolute;
  right: 12px;
  bottom: 16px;
  display: flex;
  gap: 8px;
  animation: demo-ask var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

.form-button {
  position: relative;
  padding: 7px 15px;
  border: 1px solid var(--muted);
  border-radius: 999px;
  background: var(--surface-raised);
  box-shadow: 0 4px 12px rgba(24, 24, 27, 0.18);
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 600;
}

.form-save {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: var(--on-accent-strong);
}

.tap-tags,
.tap-tile {
  background: var(--accent);
}

.tap-tags {
  animation: demo-tap-tags var(--demo-time) ease-out var(--demo-loops) forwards;
}

.tap-tile {
  animation: demo-tap-tile var(--demo-time) ease-out var(--demo-loops) forwards;
}

.tap-save {
  animation: demo-tap-save var(--demo-time) ease-out var(--demo-loops) forwards;
}

/* Scene 4: the library, as the app's home screen lays it out (top to bottom): the tools (Refresh at the left, Reels
   and Settings at the right), the search box with Sort, the Videos | Songs switch with the shuffle, the chips (All,
   See Tags, then the platforms), the cards, Select and Add Link floating over them, and the tabs. No heading. */
.demo-library {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: 38px 10px 0;
  background: var(--surface);
  color: var(--text);
  animation: demo-library var(--demo-time) ease-in-out var(--demo-loops) forwards;
}

.lib-tools,
.lib-tools-end,
.lib-find,
.lib-kind {
  display: flex;
  align-items: center;
}

.lib-tools {
  justify-content: space-between;
  height: 26px;
}

.lib-tools-end {
  gap: 4px;
}

.lib-tool {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--muted);
}

.lib-tool svg {
  width: 15px;
  height: 15px;
}

.lib-find,
.lib-kind {
  gap: 6px;
  margin-top: 5px;
}

.lib-search {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 11.5px;
}

.lib-search svg {
  width: 12px;
  height: 12px;
  flex: none;
}

.lib-round {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-alt);
}

.lib-round svg {
  width: 13px;
  height: 13px;
}

/* Sort is for Premium Plus: on the other plans (this is a Standard library) it carries a small lock, as in the app. */
.lib-sort {
  position: relative;
}

.lib-lock {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--muted);
}

.lib-lock svg {
  width: 7px;
  height: 7px;
}

.lib-segment {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-alt);
  font-size: 11px;
  font-weight: 600;
}

.lib-segment svg {
  width: 13px;
  height: 13px;
  color: var(--muted);
}

.lib-segment.is-on {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: var(--on-accent-strong);
}

.lib-segment.is-on svg {
  color: inherit;
}

/* The chips slide off the right edge, as in the app. */
.lib-chips {
  display: flex;
  gap: 5px;
  margin: 7px -10px 0 0;
  overflow: hidden;
}

.lib-chip {
  display: flex;
  flex: none;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-alt);
  font-size: 10.5px;
  font-weight: 500;
}

.lib-chip.is-selected {
  border-color: var(--highlight-strong);
  background: var(--highlight-strong);
  color: var(--on-highlight-strong);
  font-weight: 600;
}

.lib-chip-tags {
  border-color: var(--highlight);
  background: var(--highlight-tint);
  color: var(--highlight);
  font-weight: 600;
}

.lib-chip svg {
  width: 10px;
  height: 10px;
}

.dot {
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

/* Illustration colours of the platforms' dots, as the app draws them beside a platform's name: not brand colours. */
.dot-tiktok { background: #25F4EE; }
.dot-youtube { background: #FF3D4D; }
.dot-rumble { background: #85C742; }
.dot-facebook { background: #4B8DF8; }

.lib-list {
  flex: 1;
  min-height: 0;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
}

.lib-item {
  max-height: 72px;
  overflow: hidden;
}

.lib-item-new {
  animation: demo-new-item var(--demo-time) cubic-bezier(0.16, 1, 0.3, 1) var(--demo-loops) forwards;
}

/* One card: the thumbnail, the title, the platform's dot and name, the Play pill with the tags beside it, and the round "more". */
.lib-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-raised);
}

.lib-thumb {
  flex: none;
  width: 56px;
  height: 42px;
  border-radius: 9px;
}

.lib-text {
  flex: 1;
  min-width: 0;
}

.lib-text b {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11.5px;
}

.lib-text small {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
}

.lib-play {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  overflow: hidden;
}

.play-pill {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  padding: 1px 8px 1px 7px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: var(--on-accent-strong);
  font-size: 9.5px;
  font-weight: 600;
}

.play-pill::before {
  content: "";
  border-left: 5px solid currentColor;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
}

.lib-tags {
  display: flex;
  flex: none;
  gap: 4px;
}

.lib-tags i {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--highlight-tint);
  color: var(--highlight);
  font-size: 9.5px;
  font-style: normal;
  font-weight: 600;
  white-space: nowrap;
}

.lib-more {
  display: grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-alt);
}

.lib-more::before {
  content: "";
  width: 2.4px;
  height: 2.4px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: -5px 0 var(--muted), 5px 0 var(--muted);
}

/* Illustration colours of the demo thumbnails (food, a dog, a gym, a sky over Lisbon): not brand colours. */
.thumb-pasta { background: radial-gradient(circle at 50% 45%, #F6CF7A 0 30%, #E9A940 31% 40%, #FFFFFF 41% 50%, #4A3323 51%); }
.thumb-dog { background: linear-gradient(150deg, #E3B672, #8A5A2B); }
.thumb-lift { background: linear-gradient(150deg, #9AA7B8, #2F3A4A); }
.thumb-lisbon { background: linear-gradient(170deg, #F2B84B 0 45%, #3A7BD5 46%); }
/* Facebook and Instagram links have no fetched thumbnail: a placeholder (Facebook still gets a fetched title). It
   shows the platform's two letters, as the app's does. The app draws them in the platform's colour; here they are the
   muted text colour, since Facebook's blue is under 4.5:1 on this background. */
.thumb-placeholder {
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

/* Select at the bottom left and Add Link at the bottom right, floating over the cards, just above the tabs. */
.lib-pills {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 56px;
  display: flex;
  justify-content: space-between;
}

.lib-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 13px 0 11px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: var(--on-accent-strong);
  box-shadow: 0 4px 12px var(--highlight-glow);
  font-size: 11.5px;
  font-weight: 600;
}

.lib-pill svg {
  width: 12px;
  height: 12px;
}

/* The tabs: Removed, Home and Account. */
.lib-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 -10px;
  padding: 5px 4px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
}

.lib-tabs span {
  display: grid;
  gap: 1px;
  justify-items: center;
}

.lib-tabs svg {
  width: 16px;
  height: 16px;
}

.lib-tabs span::after {
  content: "";
  width: 16px;
  height: 2px;
  border-radius: 1px;
}

/* The open tab: red words over a short red line, as in the app. */
.lib-tabs .is-active {
  color: var(--accent);
  font-weight: 600;
}

.lib-tabs .is-active::after {
  background: var(--highlight);
}

.sources-marquee {
  margin-top: 56px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee-track {
  --marquee-gap: 48px;
  display: flex;
  gap: var(--marquee-gap);
  width: max-content;
  /* Six copies of the list, so even a very wide screen stays full at the end of a
     pass. Two passes, then it stops where it started. */
  animation: marquee 32s linear 2 forwards;
}

.marquee-track span {
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ---------- Sections ---------- */

.section {
  padding: 88px 0;
}

@media (min-width: 900px) {
  .section {
    padding: 120px 0;
  }
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-kicker {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-title {
  max-width: 18em;
  font-size: clamp(1.9rem, 5vw, 3rem);
  letter-spacing: -0.03em;
}

/* The Privacy Policy and Terms pages: a readable line length, room above each heading, and
   the version and draft lines muted under the title. */
.legal {
  max-width: 46em;
}

.legal h2 {
  margin: 2em 0 0.5em;
  font-size: 1.25rem;
}

.legal-version,
.legal-draft {
  color: var(--muted);
  font-size: 0.9rem;
}

.legal-version {
  margin-top: 0.75em;
}

.prerelease-note {
  max-width: 44em;
  margin-top: 18px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--muted);
}

.prerelease-note strong {
  color: var(--text);
}

.section-lede {
  max-width: 40em;
  margin-top: 18px;
  color: var(--muted);
  font-size: 1.1rem;
}

/* ---------- About ---------- */

.about-grid {
  display: grid;
  gap: 40px;
  margin-top: 40px;
}

@media (min-width: 900px) {
  .about-grid {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 64px;
  }
}

.about-copy {
  color: var(--muted);
  font-size: 1.1rem;
}

.principles {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.principle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s ease, border-color 0.2s ease;
}

.principle:hover {
  transform: translateX(6px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.principle-icon {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-tint);
  color: var(--accent);
}

.principle h3 {
  font-size: 1.1rem;
  align-self: end;
}

.principle p {
  color: var(--muted);
  font-size: 0.98rem;
}

/* ---------- Features ---------- */

.feature-grid {
  display: grid;
  gap: 20px;
  margin-top: 48px;
}

@media (min-width: 760px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

.feature {
  position: relative;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s ease, border-color 0.2s ease;
}

@media (max-width: 420px) {
  .feature {
    padding: 20px;
  }
}

.feature::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-bright), var(--brand), var(--brand-deep));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease-out);
}

.feature:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lift);
}

.feature:hover::before {
  transform: scaleX(1);
}

.feature h3 {
  margin-top: 22px;
  margin-bottom: 10px;
  font-size: 1.3rem;
}

.feature p {
  color: var(--muted);
}

.feature-art {
  position: relative;
  height: 120px;
  border-radius: 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* Save: links stacking into the library. The bars keep to the left of the Add Link pill at every card width: the
   art's right padding is the pill's room (its 14px inset, its width, its 12% pop and a gap), so they never touch. */
.art-save {
  align-content: center;
  gap: 8px;
  grid-template-columns: minmax(0, 220px);
  justify-content: start;
  justify-items: start;
  padding: 0 148px 0 18px;
}

.save-link {
  display: block;
  width: 100%;
  height: 16px;
  border-radius: 8px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  /* An odd count of alternating runs: it settles in place, on its resting style. */
  animation: stack-in 2.4s var(--ease-out) 5 alternate forwards;
}

.save-link:nth-child(2) { animation-delay: 0.4s; width: 84%; }
.save-link:nth-child(3) { animation-delay: 0.8s; width: 70%; }

/* The app's floating Add Link pill. */
.save-plus {
  position: absolute;
  right: 14px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px 0 11px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: var(--on-accent-strong);
  box-shadow: 0 4px 12px var(--highlight-glow);
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
  animation: pop 2.4s ease-in-out 4 forwards;
}

.save-plus svg {
  width: 12px;
  height: 12px;
}

/* Play: r3kal's own frame around the platform's player. Its top bar has Close (a down arrow), the title and the
   platform; under the player, Previous, "Open in" and Next. */
.art-play {
  align-content: center;
}

.play-frame {
  display: grid;
  gap: 5px;
  width: 176px;
  padding: 6px 8px 7px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.play-top,
.play-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.play-top svg,
.play-bottom svg {
  flex: none;
  width: 12px;
  height: 12px;
}

.play-title,
.play-platform {
  height: 5px;
  border-radius: 3px;
  background: var(--border);
}

.play-title {
  width: 74px;
}

.play-platform {
  width: 28px;
}

.play-bottom {
  justify-content: space-between;
}

.play-open {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: var(--on-accent-strong);
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.play-screen {
  display: grid;
  place-items: center;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-bright), var(--brand), var(--brand-deep));
}

.play-button {
  width: 0;
  height: 0;
  border-left: 14px solid #FFFFFF;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  margin-left: 4px;
  animation: pop 2.4s ease-in-out 4 forwards;
}

.play-bar {
  display: block;
  height: 4px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.play-progress {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 3px;
  background: var(--accent);
  transform-origin: left;
  /* A full bar, where each run ends. */
  transform: none;
  animation: progress 6s linear 3 forwards;
}

/* Sync: an encrypted packet travelling between devices. */
.art-sync svg {
  width: 220px;
  height: 90px;
  overflow: visible;
}

.sync-device {
  fill: var(--surface-raised);
  stroke: var(--border);
  stroke-width: 1.5;
}

.sync-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 5 6;
  opacity: 0.6;
  animation: dash 1.2s linear 8 forwards;
}

.sync-packet {
  /* Arrived at the second device: where the alternating runs end. */
  transform: translate(148px, 42px);
  animation: packet 2.8s var(--ease-out) 5 alternate forwards;
}

.sync-packet rect {
  fill: var(--accent);
}

.sync-packet path {
  fill: none;
  stroke: var(--on-accent);
  stroke-width: 2;
  stroke-linecap: round;
}

/* Extension: a browser bar with the save button. */
.ext-window {
  display: block;
  width: 78%;
  height: 74px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.ext-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.ext-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
}

.ext-button {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  animation: pop 3s ease-in-out 4 forwards;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ---------- Plans ---------- */

/* Three cards: the free trial, Standard and Premium Plus. They stack on phones, trial
   first, and sit side by side from 960px, all the same height, with their buttons aligned. */
.plan-cards {
  display: grid;
  gap: 28px;
  max-width: 560px;
  margin: 52px auto 0;
}

@media (min-width: 960px) {
  .plan-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    max-width: 1120px;
    align-items: stretch;
  }
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px 26px 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s ease;
}

.plan:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

@property --angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 120deg;
}

.plan-family {
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(var(--angle, 120deg), var(--brand-bright), var(--brand), var(--brand-deep), var(--brand-bright)) border-box;
  box-shadow: 0 10px 34px var(--accent-glow);
  animation: border-turn 8s linear 2 forwards;
}

/* The free trial: a soft accent wash from the top, and an outlined "Start here" badge, so
   it reads as the way in without competing with Premium Plus's Best Value. */
.plan-trial {
  border-color: var(--accent-tint);
  background: linear-gradient(180deg, var(--accent-tint), var(--surface) 60%);
}

/* Standard: a thin accent ring, as the plan the trial leads to. */
.plan-standard {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}

.plan-standard:hover {
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-lift);
}

.plan-after {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

/* The badge comes after the heading in the page, so a screen reader names the card
   first; it's also part of the card's accessible name. On screen it sits on the top edge. */
.plan-badge {
  position: absolute;
  top: 0;
  left: 50%;
  margin: 0;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--highlight-strong);
  color: var(--on-highlight-strong);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

/* The free trial's "Start here": an outlined badge, a red ring and red words (the accent text colour, AA on the
   card in both themes) with no colour of its own; its background is the card's, only to cover the card's edge it
   sits on. After .plan-badge and more specific than it, so the filled red never shows through. */
.plan-badge.plan-badge-start {
  border: 1.5px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
}

/* Premium Plus's Best Value: a small gold crown-style badge. */
.plan-family .plan-badge {
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  color: var(--on-gold);
  box-shadow: 0 4px 14px rgba(245, 184, 61, 0.35);
}

.plan-head {
  margin-bottom: 4px;
}

.plan-name {
  font-size: 1.25rem;
}

.plan-tagline {
  margin: 6px 0 0;
  color: var(--muted);
}

.plan-price {
  margin: 16px 0 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.price {
  font-size: 2.8rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.per {
  color: var(--muted);
  font-weight: 500;
}

.plan-price-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.plan-features {
  display: grid;
  gap: 10px;
  margin: 22px 0 24px;
  padding: 0;
  list-style: none;
}

.plan-features li {
  position: relative;
  padding-left: 28px;
}

/* A drawn check mark: two borders of a rotated box, so there's no image to load. */
.plan-features li::before {
  content: "";
  position: absolute;
  top: 0.3em;
  left: 4px;
  width: 6px;
  height: 11px;
  border: solid var(--accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.plan-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin: auto 0 0;
  padding: 12px 22px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}

.plan-note {
  max-width: 1120px;
  margin: 22px auto 0;
  color: var(--muted);
  text-align: center;
}

/* ---------- Q&A ---------- */

.faq-list {
  display: grid;
  gap: 12px;
  margin-top: 40px;
}

.faq {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.3s ease;
}

.faq[open] {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.faq summary {
  position: relative;
  display: block;
  padding: 18px 56px 18px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  list-style: none;
}

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

.faq summary::after {
  content: "";
  position: absolute;
  right: 22px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -9px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  transition: transform 0.35s var(--ease-out), margin-top 0.35s var(--ease-out);
}

.faq[open] summary::after {
  margin-top: -3px;
  transform: rotate(225deg);
}

.faq-body {
  padding: 0 22px 20px;
  color: var(--muted);
}

.faq[open] .faq-body {
  animation: faq-open 0.45s var(--ease-out);
}

/* ---------- Downloads ---------- */

.downloads {
  margin-top: 40px;
}

.downloads-status {
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  color: var(--muted);
}

.downloads-status strong {
  color: var(--text);
}

.downloads-status.is-ready {
  border-style: solid;
  background: var(--surface);
}

/* A release: one big button for the visitor's system, with the rest as small links. */
.download-main {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 28px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  animation: rise 0.6s var(--ease-out) both;
}

.download-button {
  min-height: 56px;
  padding: 14px 32px;
  font-size: 1.1rem;
}

@media (max-width: 420px) {
  .download-button {
    width: 100%;
  }
}

.download-detail,
.download-note,
.download-also,
.download-others {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.download-note {
  color: var(--text);
}

.download-links-label {
  font-weight: 600;
}

.download-notice {
  max-width: 44em;
  margin: 28px auto 0;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--muted);
}

.download-notice strong {
  color: var(--text);
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 48px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-inner {
  display: grid;
  gap: 12px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-brand strong {
  color: var(--text);
}

.footer-icon {
  width: 32px;
  height: 32px;
  flex: none;
}

/* ---------- 404 page ---------- */

.not-found {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 70vh;
  display: grid;
  align-items: center;
  padding: 72px 0;
}

.not-found-inner {
  display: grid;
  justify-items: start;
  gap: 18px;
}

.not-found-code {
  margin: 0;
  font-size: clamp(4rem, 18vw, 9rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.05em;
  background: linear-gradient(120deg, var(--title-grad-1), var(--title-grad-2) 55%, var(--title-grad-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: mark-in 1.2s var(--ease-out) both;
}

.not-found h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
}

/* ---------- How to save a video: the phone app's own tutorial, as a block under the features ---------- */

.howto {
  margin-top: 64px;
}

.howto-title {
  font-size: clamp(1.5rem, 3.6vw, 2rem);
}

.howto-note {
  max-width: 40em;
  margin: 12px 0 0;
  color: var(--muted);
}

.howto-steps {
  display: grid;
  gap: 20px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 900px) {
  .howto-steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: start;
  }
}

.howto-step {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.howto-step p {
  color: var(--muted);
}

.howto-step .howto-progress {
  margin: 0;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.howto-step h4 {
  margin: 6px 0 10px;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.howto-moves {
  display: grid;
  gap: 6px;
  margin: 0 0 1em;
  padding-left: 1.5em;
}

.howto-moves li::marker {
  color: var(--accent);
  font-weight: 600;
}

.howto-step .howto-caption {
  font-size: 0.92rem;
}

.not-found p {
  color: var(--muted);
  max-width: 34em;
}

/* ---------- Play on view (only once site.js has set it up) ---------- */

.anim-gate .feature-art:not(.in-view) *,
.anim-gate .feature-art:not(.in-view) *::before,
.anim-gate .feature-art:not(.in-view) *::after,
.anim-gate .plan-family:not(.in-view) {
  animation-play-state: paused;
}

/* ---------- Replay (replay.js sets this for a moment to restart what has finished) ---------- */

.anim-replay,
.anim-replay::before,
.anim-replay::after,
.anim-replay *,
.anim-replay *::before,
.anim-replay *::after {
  animation: none !important;
}

/* ---------- Scroll reveal (only once site.js has set it up) ---------- */

.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.reveal-ready .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Keyframes ---------- */

@keyframes horizon-glide {
  from { background-position: 0 0; }
  to { background-position: 0 56px; }
}

@keyframes aurora-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-6%, 4%, 0) scale(1.08); }
}

@keyframes aurora-turn {
  to { transform: rotate(360deg); }
}

@keyframes word-cycle {
  0%, 16% { transform: translateY(0); }
  20%, 36% { transform: translateY(-1.12em); }
  40%, 56% { transform: translateY(-2.24em); }
  60%, 76% { transform: translateY(-3.36em); }
  80%, 100% { transform: translateY(-4.48em); }
}

@keyframes mark-in {
  from { opacity: 0; transform: rotate(-200deg) scale(0.4); }
  to { opacity: 1; transform: rotate(0) scale(1); }
}

/* One copy of the six: a sixth of the track and of the gap the track has one too few of. */
@keyframes marquee {
  to { transform: translateX(calc((-100% - var(--marquee-gap)) / 6)); }
}

@keyframes stack-in {
  0% { opacity: 0; transform: translateY(-24px) scale(0.92); }
  40%, 100% { opacity: 1; transform: none; }
}

@keyframes pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes progress {
  from { transform: scaleX(0); }
  to { transform: none; }
}

@keyframes dash {
  to { stroke-dashoffset: -22; }
}

@keyframes packet {
  0% { transform: translate(62px, 42px) scale(0.6); opacity: 0; }
  15% { opacity: 1; transform: translate(72px, 42px) scale(1); }
  100% { opacity: 1; transform: translate(148px, 42px); }
}

@keyframes border-turn {
  to { --angle: 480deg; }
}

@keyframes faq-open {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* The hero demo's timeline (one 20 s loop, so 1% is 0.2 s; 100% is the resting library frame). */

@keyframes demo-status {
  0%, 77% { color: #FFFFFF; }
  81%, 100% { color: var(--text); }
}

@keyframes demo-video {
  0%, 77% { opacity: 1; visibility: visible; }
  81%, 100% { opacity: 0; visibility: hidden; }
}

@keyframes demo-progress {
  0% { transform: scaleX(0); }
  77%, 100% { transform: scaleX(1); }
}

/* 2.2 s: a tap on Share. */
@keyframes demo-tap-share {
  0%, 11% { opacity: 0; transform: scale(0.3); }
  13% { opacity: 0.9; transform: scale(0.6); }
  17%, 100% { opacity: 0; transform: scale(1.6); }
}

/* The video dims under the share menu and r3kal's share screen. */
@keyframes demo-scrim {
  0%, 16% { opacity: 0; }
  20%, 76% { opacity: 1; }
  80%, 100% { opacity: 0; }
}

/* 3.2 s: the share menu slides up; 5.8 s: it goes. */
@keyframes demo-sheet {
  0%, 16% { transform: translateY(105%); }
  21%, 29% { transform: translateY(0); }
  33%, 100% { transform: translateY(105%); }
}

@keyframes demo-pick {
  0%, 23% { background-color: rgba(0, 0, 0, 0); }
  25%, 30% { background-color: var(--accent-tint); }
  33%, 100% { background-color: rgba(0, 0, 0, 0); }
}

/* 4.8 s: a tap on r3kal. */
@keyframes demo-tap-r3kal {
  0%, 24% { opacity: 0; transform: scale(0.3); }
  26% { opacity: 0.6; transform: scale(0.6); }
  30%, 100% { opacity: 0; transform: scale(1.6); }
}

/* 6.2 s: r3kal's share screen slides up, the link already saved; 15 s: saved and tagged, it goes. */
@keyframes demo-form {
  0%, 31% { transform: translateY(105%); }
  36%, 75% { transform: translateY(0); }
  80%, 100% { transform: translateY(105%); }
}

@keyframes demo-check {
  0%, 35% { transform: scale(0); }
  38% { transform: scale(1.25); }
  40%, 100% { transform: none; }
}

/* 8.2 s: a tap on Tags; the tiles open in place. They close again unseen, once the screen has gone. */
@keyframes demo-tap-tags {
  0%, 41% { opacity: 0; transform: scale(0.3); }
  43% { opacity: 0.6; transform: scale(0.6); }
  47%, 100% { opacity: 0; transform: scale(1.6); }
}

@keyframes demo-tiles {
  0%, 44% { max-height: 0; }
  48%, 82% { max-height: 130px; }
  83%, 100% { max-height: 0; }
}

@keyframes demo-chevron {
  0%, 44% { transform: none; }
  48%, 82% { transform: rotate(180deg); }
  83%, 100% { transform: none; }
}

/* 10.4 s: a tap on Recipes. It's ticked, the Tags row says so and the preview card gets its tag. */
@keyframes demo-tap-tile {
  0%, 52% { opacity: 0; transform: scale(0.3); }
  54% { opacity: 0.6; transform: scale(0.6); }
  58%, 100% { opacity: 0; transform: scale(1.6); }
}

@keyframes demo-tile-pick {
  0%, 54% { border-color: var(--border); box-shadow: 0 0 0 0 var(--highlight); }
  55%, 82% { border-color: var(--highlight); box-shadow: 0 0 0 1px var(--highlight); }
  83%, 100% { border-color: var(--border); box-shadow: 0 0 0 0 var(--highlight); }
}

@keyframes demo-picked {
  0%, 54% { opacity: 0; }
  55%, 82% { opacity: 1; }
  83%, 100% { opacity: 0; }
}

@keyframes demo-unpicked {
  0%, 54% { opacity: 1; }
  55%, 82% { opacity: 0; }
  83%, 100% { opacity: 1; }
}

/* 12.4 s: a tap on Save. The form gives way to what it saved, held as in the app's tutorial (the real screen closes at once). */
@keyframes demo-tap-save {
  0%, 62% { opacity: 0; transform: scale(0.3); }
  64% { opacity: 0.7; transform: scale(0.6); }
  68%, 100% { opacity: 0; transform: scale(1.6); }
}

@keyframes demo-ask {
  0%, 66% { opacity: 1; }
  68%, 82% { opacity: 0; }
  83%, 100% { opacity: 1; }
}

@keyframes demo-done {
  0%, 66% { opacity: 0; }
  68%, 82% { opacity: 1; }
  83%, 100% { opacity: 0; }
}

/* 15.4 s: the library; 16.8 s: the new card slides in at the top. */
@keyframes demo-library {
  0%, 77% { opacity: 0; }
  81%, 100% { opacity: 1; }
}

@keyframes demo-new-item {
  0%, 84% { max-height: 0; opacity: 0; transform: translateX(-30px); }
  90%, 100% { max-height: 72px; opacity: 1; transform: none; }
}

/* ---------- Forced colors (Windows high contrast): no gradient text, plain background ---------- */

@media (forced-colors: active) {
  .word-track span,
  .hero-title-punch,
  .not-found-code {
    background: none;
    color: CanvasText;
    -webkit-text-fill-color: CanvasText;
  }

  .button,
  .plan-badge,
  .plan-cta {
    border: 1px solid ButtonText;
  }

  .plan-family .plan-badge {
    background: Canvas;
  }

  .hero-backdrop,
  .aurora {
    display: none;
  }

  .switch {
    border-color: ButtonText;
  }

  .switch::after {
    background: ButtonText;
  }

  .switch[aria-checked="true"] {
    background: Highlight;
  }
}

/* ---------- Reduced motion: no movement at all ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .reveal-ready .reveal {
    opacity: 1;
    transform: none;
  }

  .principle:hover,
  .feature:hover,
  .plan:hover,
  .button-primary:hover,
  .button-ghost:hover,
  .theme-toggle:hover {
    transform: none;
  }

}
