/*
  Wormy homepage — navigation + hero.
  Ported from the approved visual prototype (design-preview/, M1.6.1, design-locked).
  Loaded only by index.html: styles.css stays shared with /android/.
  Classes are namespaced (wormy-*) so legacy .hero/.site-header/.button rules cannot leak in.
*/

.home-page {
  --hero-width: min(calc(100% - 2 * var(--container-gutter)), var(--container-xl));
  --nav-h: 5rem;
}

@media (min-width: 105rem) {
  .home-page { --hero-width: min(calc(100% - 2 * var(--container-gutter)), 88rem); }
}

@media (min-width: 115rem) {
  .home-page { --hero-width: min(calc(100% - 2 * var(--container-gutter)), 96rem); }
}

@media (max-width: 36rem) {
  .home-page { --nav-h: 4.5rem; }
}

/* overflow: hidden made .page-shell a scroll container and broke position: sticky */
.home-page .page-shell {
  overflow: clip;
}

/* Grain: present across the page, invisible on its own */
.home-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
}

.home-page :is(#pricing-plans, #checkout-status) {
  scroll-margin-top: calc(var(--nav-h) + 1.5rem);
}

/* Navigation and hero are dark by design, even under ?theme=light */
.wormy-skip,
.wormy-nav,
.wormy-hero,
.story-section,
.wormy-footer {
  color-scheme: dark;
  --background: #0b0c0d;
  --text-primary: #fafaf7;
  --text-secondary: #efefec;
  --text-muted: rgba(239, 239, 236, 0.62);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.2);
  --accent: #f184ab;
  --accent-hover: #ff9fc1;
  --shadow-focus: 0 0 0 3px rgba(241, 132, 171, 0.3);
}

.wormy-hero *,
.wormy-hero *::before,
.wormy-hero *::after,
.wormy-nav *,
.wormy-nav *::before,
.wormy-nav *::after {
  box-sizing: border-box;
}

.wormy-skip {
  position: fixed;
  z-index: var(--z-toast);
  top: var(--space-3);
  left: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  color: #170e12;
  background: var(--accent);
  font-size: var(--type-small);
  font-weight: 700;
  transform: translateY(-160%);
}

.wormy-skip:focus {
  transform: none;
}

/* ---------------------------------------------------------------- Nav */

.wormy-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--nav-h);
}

/* Surface appears once the page scrolls under the bar */
.wormy-nav::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(11, 12, 13, 0.8);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  opacity: 0;
  transition: opacity 240ms var(--ease-standard);
  pointer-events: none;
}

.wormy-nav.is-scrolled::before,
.wormy-nav.is-open::before {
  opacity: 1;
}

.wormy-nav__inner {
  position: relative;
  width: var(--hero-width);
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 240ms var(--ease-standard);
}

.wormy-nav.is-scrolled .wormy-nav__inner,
.wormy-nav.is-open .wormy-nav__inner {
  border-bottom-color: transparent;
}

.wormy-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  width: fit-content;
  border-radius: 0.6rem;
  color: var(--text-primary);
  font-weight: 720;
  text-decoration: none;
}

.wormy-brand img {
  display: block;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  object-fit: cover;
}

.wormy-brand small {
  margin-left: 0.18rem;
  color: var(--text-muted);
  font-size: 0.65em;
  letter-spacing: 0.11em;
}

.wormy-nav__menu {
  display: flex;
  align-items: center;
}

.wormy-nav__links {
  display: flex;
  gap: var(--space-8);
}

.wormy-nav__links a,
.wormy-nav__login {
  border-radius: 0.4rem;
  color: rgba(239, 239, 236, 0.86);
  font-size: var(--type-small);
  font-weight: 540;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}

.wormy-nav__links a:hover,
.wormy-nav__login:hover {
  color: var(--text-primary);
}

/* On desktop "Войти" lives next to the CTA; the menu copy is for the mobile sheet */
.wormy-nav__menu .wormy-nav__login {
  display: none;
}

.wormy-nav__actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.wormy-nav__cta {
  padding: 0.72rem 1rem;
  border-radius: var(--radius-sm);
  color: #170e12 !important;
  background: var(--accent);
  font-size: var(--type-small);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--duration-fast) var(--ease-standard);
}

.wormy-nav__cta:hover {
  background-color: #f596b8;
}

.wormy-nav__toggle {
  display: none;
}

.wormy-skip:focus-visible,
.wormy-nav a:focus-visible,
.wormy-nav button:focus-visible,
.wormy-button:focus-visible,
.burrow:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 4px;
  box-shadow: var(--shadow-focus);
}

@media (max-width: 56rem) {
  .wormy-nav__inner {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: var(--space-2);
  }

  /* DOM order is brand → toggle → menu → actions (keyboard flows into the open sheet);
     the bar still reads brand · CTA · toggle */
  .wormy-brand { grid-column: 1; grid-row: 1; }
  .wormy-nav__actions { grid-column: 2; grid-row: 1; }
  .wormy-nav__toggle { grid-column: 3; grid-row: 1; }

  .wormy-nav__actions .wormy-nav__login { display: none; }

  .wormy-nav__toggle {
    display: inline-grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-right: -0.6rem;
    padding: 0;
    border: 0;
    border-radius: 0.75rem;
    color: var(--text-primary);
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .wormy-nav__toggle-icon {
    position: relative;
    width: 1.25rem;
    height: 0.625rem;
  }

  .wormy-nav__toggle-icon::before,
  .wormy-nav__toggle-icon::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 1.5px;
    border-radius: 1px;
    background: currentColor;
    transition: transform 220ms var(--ease-standard);
  }

  .wormy-nav__toggle-icon::before { top: 0; }
  .wormy-nav__toggle-icon::after { bottom: 0; }
  .wormy-nav.is-open .wormy-nav__toggle-icon::before { transform: translateY(0.25rem) rotate(45deg); }
  .wormy-nav.is-open .wormy-nav__toggle-icon::after { transform: translateY(-0.25rem) rotate(-45deg); }

  /* Mobile sheet: hidden from sight, tab order and assistive tech until opened */
  .wormy-nav__menu {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 100vw;
    display: block;
    padding: var(--space-2) var(--container-gutter) var(--space-5);
    background: #0b0c0d;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 28px 48px -16px rgba(0, 0, 0, 0.8);
    transform: translateX(-50%);
    translate: 0 -0.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms var(--ease-standard), translate 200ms var(--ease-standard), visibility 0s linear 200ms;
  }

  .wormy-nav.is-open .wormy-nav__menu {
    translate: 0 0;
    opacity: 1;
    visibility: visible;
    transition: opacity 200ms var(--ease-standard), translate 200ms var(--ease-standard), visibility 0s;
  }

  .wormy-nav__links {
    flex-direction: column;
    gap: 0;
  }

  .wormy-nav__links a,
  .wormy-nav__menu .wormy-nav__login {
    display: flex;
    align-items: center;
    min-height: 3.5rem;
    padding-inline: 0.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 600;
  }

  .wormy-nav__menu a:focus-visible {
    outline-offset: -2px;
    box-shadow: none;
  }

  .wormy-nav__menu .wormy-nav__login {
    border-bottom: 0;
    color: rgba(239, 239, 236, 0.72);
  }

  /* Without JavaScript the sheet can't open: links stay reachable in hero and footer */
  html:not(.js) .wormy-nav__toggle { display: none; }
}

@media (max-width: 36rem) {
  .wormy-brand small { display: none; }
  .wormy-nav__cta { padding: 0.65rem 0.8rem; }
}

@media (max-width: 24rem) {
  .wormy-nav__cta-extra { display: none; }
}

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

.wormy-button {
  min-height: 3.4rem;
  padding: 0.95rem 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 680;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition:
    transform 160ms var(--ease-standard),
    color var(--duration-base) var(--ease-standard),
    background-color var(--duration-base) var(--ease-standard),
    border-color var(--duration-base) var(--ease-standard),
    box-shadow var(--duration-base) var(--ease-standard);
}

.wormy-button > span[aria-hidden] {
  display: inline-block;
  transition: transform 280ms var(--ease-enter);
}

.wormy-button:active {
  transform: translateY(1px) scale(0.985);
  transition-duration: 60ms;
}

.wormy-button--primary {
  border-color: transparent;
  color: #1a0e13 !important;
  background-color: var(--accent);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 62%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -1px 0 rgba(110, 25, 55, 0.18),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 12px 28px -14px rgba(241, 132, 171, 0.5);
}

.wormy-button--primary:hover {
  background-color: #f596b8;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 70%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -1px 0 rgba(110, 25, 55, 0.18),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 16px 32px -14px rgba(241, 132, 171, 0.6);
}

.wormy-button--primary:hover > span[aria-hidden] {
  transform: translate(3px, -3px);
}

.wormy-button--primary:active {
  background-image: linear-gradient(180deg, rgba(70, 10, 35, 0.08), rgba(70, 10, 35, 0));
  box-shadow:
    inset 0 1px 3px rgba(90, 20, 45, 0.28),
    0 1px 1px rgba(0, 0, 0, 0.3);
}

.wormy-button--quiet {
  background: transparent;
  color: var(--text-secondary);
}

.wormy-button--quiet:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.035);
}

.wormy-button--text {
  padding-inline: 1rem;
  border-color: transparent;
  color: rgba(239, 239, 236, 0.72);
  background: transparent;
}

.wormy-button--text:hover {
  color: var(--text-primary);
}

.wormy-button--text:hover > span[aria-hidden] {
  transform: translateX(4px);
}

/* --------------------------------------------------------------- Hero */
/* DESIGN-LOCKED since M1.6.1. Later milestones must not restyle the hero;
   any change needs an explicit design review. See docs/WORMY_VISUAL_DIRECTION.md. */

.wormy-hero {
  --focus-x: 72%;
  --focus-y: 50%;
  position: relative;
  isolation: isolate;
  width: var(--hero-width);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  min-height: min(calc(100svh - 5rem), 46rem);
  margin: 0 auto;
  padding-block: clamp(1.5rem, 4.5vh, 3.5rem) clamp(4rem, 10vh, 7rem);
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.84fr);
  align-items: start;
  gap: 0 clamp(2.5rem, 4vw, 5.5rem);
}

.wormy-hero .wormy-kicker {
  margin-bottom: clamp(1.25rem, 2.4vh, 1.75rem);
}

.wormy-kicker {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-6);
  color: var(--text-muted);
  font-size: var(--type-label);
  font-weight: 720;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.wormy-kicker span {
  width: 1.8rem;
  height: 1px;
  background: var(--accent);
}

.wormy-hero h1 {
  max-width: none;
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(3.4rem, 6.95vw, 7.9rem);
  font-weight: 680;
  letter-spacing: -0.068em;
  line-height: 0.9;
}

.wormy-hero h1 .wormy-hero__line {
  display: block;
  width: fit-content;
  color: inherit;
  white-space: nowrap;
}

.wormy-hero h1 em.wormy-hero__line {
  color: var(--accent);
  font-style: normal;
}

.wormy-hero__lead {
  max-width: 25em;
  margin: clamp(1.5rem, 3.4vh, 2.25rem) 0 0;
  color: rgba(239, 239, 236, 0.74);
  font-size: clamp(1.05rem, 1.35vw, 1.25rem);
  line-height: 1.55;
  text-wrap: pretty;
}

.wormy-hero__lead span {
  display: block;
}

.wormy-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: clamp(1.75rem, 3.6vh, 2.5rem);
}

.wormy-hero__note {
  margin: var(--space-5) 0 0;
  color: var(--text-muted);
  font-size: var(--type-small);
}

/* Ambient environment: invisible layer by layer, depth all together */

.wormy-hero__env {
  position: absolute;
  z-index: -1;
  top: -5rem;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  overflow: hidden;
  pointer-events: none;
}

.wormy-hero__light,
.wormy-hero__grid {
  position: absolute;
  inset: 0;
}

.wormy-hero__light {
  background:
    radial-gradient(36rem 30rem at var(--focus-x) var(--focus-y), rgba(255, 244, 238, 0.055), transparent 70%),
    radial-gradient(80rem 60rem at 58% 0%, rgba(255, 255, 255, 0.022), transparent 65%);
}

.wormy-hero__light::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(30rem 24rem at var(--focus-x) calc(var(--focus-y) + 4%), rgba(241, 132, 171, 0.085), transparent 72%);
  opacity: 0;
  transition: opacity 900ms var(--ease-standard);
}

.wormy-hero[data-state="connecting"] .wormy-hero__light::after { opacity: 0.4; }
.wormy-hero[data-state="on"] .wormy-hero__light::after { opacity: 1; }

.wormy-hero__grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 4.5rem 4.5rem;
  background-position: var(--focus-x) var(--focus-y);
  -webkit-mask-image: radial-gradient(40rem 30rem at var(--focus-x) var(--focus-y), #000 0%, rgba(0, 0, 0, 0.3) 45%, transparent 72%);
  mask-image: radial-gradient(40rem 30rem at var(--focus-x) var(--focus-y), #000 0%, rgba(0, 0, 0, 0.3) 45%, transparent 72%);
  opacity: 0.55;
}

.wormy-hero__orbits {
  position: absolute;
  top: var(--focus-y);
  left: var(--focus-x);
}

.wormy-hero__orbits i {
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.wormy-hero__orbits i:nth-child(1) { width: 46rem; height: 46rem; }
.wormy-hero__orbits i:nth-child(2) { width: 68rem; height: 68rem; border-color: rgba(255, 255, 255, 0.034); }
.wormy-hero__orbits i:nth-child(3) { width: 94rem; height: 94rem; border-color: rgba(255, 255, 255, 0.022); }

.wormy-hero[data-state="on"] .wormy-hero__orbits i:nth-child(1) {
  border-color: rgba(241, 132, 171, 0.08);
  transition: border-color 900ms var(--ease-standard);
}

/* ------------------------------------------------------ Product object */

.wormy-hero__product {
  position: relative;
  display: grid;
  justify-items: center;
  gap: var(--space-5);
  min-width: 0;
}

.wormy-hero__stage {
  position: relative;
  width: min(100%, 34rem);
  perspective: 2400px;
}

/* Contact shadow grounding the object */
.wormy-hero__stage::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 12%;
  right: 12%;
  bottom: -2.2rem;
  height: 3.5rem;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.75), transparent);
  filter: blur(10px);
  pointer-events: none;
}

.wormy-device {
  --device-pad: clamp(1.25rem, 1.9vw, 1.75rem);
  position: relative;
  z-index: 1;
  padding: var(--device-pad);
  border-radius: 2.25rem;
  background:
    radial-gradient(120% 55% at 50% 0%, rgba(255, 255, 255, 0.05), transparent 62%),
    linear-gradient(180deg, #17181b 0%, #101114 52%, #0c0d0f 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 28px 56px -18px rgba(0, 0, 0, 0.7),
    0 80px 120px -40px rgba(0, 0, 0, 0.8);
  transform: rotateY(-5deg) rotateX(2deg);
  transform-origin: 40% 50%;
}

/* Edge highlight: a hairline that catches light at the top-left corner only */
.wormy-device::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.05) 28%, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, 0.05) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Internal light that only exists while connected */
.wormy-device::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(75% 50% at 50% 62%, rgba(241, 132, 171, 0.1), transparent 72%);
  opacity: 0;
  transition: opacity 700ms var(--ease-standard);
  pointer-events: none;
}

.wormy-hero[data-state="on"] .wormy-device::after { opacity: 1; }

.wormy-device__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0.15rem 0.25rem 0;
}

.wormy-device__brand {
  color: rgba(239, 239, 236, 0.46);
  font: 700 0.68rem / 1 var(--mono);
  letter-spacing: 0.22em;
}

.wormy-device__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 1.9rem;
  padding: 0 0.8rem 0 0.7rem;
  border-radius: var(--radius-full);
  color: rgba(239, 239, 236, 0.56);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  font: 700 0.64rem / 1 var(--mono);
  letter-spacing: 0.14em;
  transition: color var(--duration-slow) var(--ease-standard), background-color var(--duration-slow) var(--ease-standard), box-shadow var(--duration-slow) var(--ease-standard);
}

.wormy-device__chip i {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: background-color var(--duration-slow) var(--ease-standard), box-shadow var(--duration-slow) var(--ease-standard);
}

.wormy-hero[data-state="connecting"] .wormy-device__chip { color: var(--text-secondary); }
.wormy-hero[data-state="connecting"] .wormy-device__chip i { background: var(--accent); animation: chip-wait 900ms ease-in-out infinite; }

.wormy-hero[data-state="on"] .wormy-device__chip {
  color: var(--accent);
  background: rgba(241, 132, 171, 0.09);
  box-shadow: inset 0 0 0 1px rgba(241, 132, 171, 0.22);
}

.wormy-hero[data-state="on"] .wormy-device__chip i {
  background: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(241, 132, 171, 0.16);
}

@keyframes chip-wait {
  50% { opacity: 0.25; }
}

.wormy-device__status {
  margin: clamp(1.25rem, 2.6vh, 1.75rem) 0.25rem 0;
  display: grid;
  gap: 0.55rem;
}

.wormy-device__status strong {
  color: var(--text-primary);
  font-size: clamp(1.75rem, 2.3vw, 2.35rem);
  font-weight: 660;
  letter-spacing: -0.045em;
  line-height: 1;
}

.wormy-device__status small {
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.wormy-hero[data-state="on"] .wormy-device__status small { color: rgba(239, 239, 236, 0.78); }

.wormy-device__bay {
  position: relative;
  margin-top: clamp(1.1rem, 2.2vh, 1.5rem);
  padding: 3.4rem 1.25rem 1.1rem;
  border-radius: 1.6rem;
  background: linear-gradient(180deg, #08090a, #0c0d0f);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 1px 0 rgba(255, 255, 255, 0.045);
}

/* ------------------------------------------ Burrow switch (Wormy moment) */

.burrow {
  --track-h: 7.4rem;
  --hole-y: 60%;
  --hole-w: 6.2rem;
  --hole-h: 1.9rem;
  --inset: 3.9rem;
  --worm-w: 6.4rem;
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 3.7rem;
  color: inherit;
  background: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.burrow__track {
  position: relative;
  display: block;
  height: var(--track-h);
  border-radius: var(--radius-full);
  background: linear-gradient(180deg, #040405 0%, #0b0c0e 100%);
  box-shadow:
    inset 0 10px 20px rgba(0, 0, 0, 0.85),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 1px 0 rgba(255, 255, 255, 0.05);
  transition: box-shadow 600ms var(--ease-standard);
}

.burrow__track::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(40% 90% at calc(100% - var(--inset)) var(--hole-y), rgba(241, 132, 171, 0.22), transparent 70%),
    linear-gradient(90deg, rgba(241, 132, 171, 0.02), rgba(241, 132, 171, 0.1));
  opacity: 0;
  transition: opacity 600ms var(--ease-standard);
}

.wormy-hero[data-state="on"] .burrow__track {
  box-shadow:
    inset 0 10px 20px rgba(0, 0, 0, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(241, 132, 171, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.05);
}

.wormy-hero[data-state="on"] .burrow__track::before { opacity: 1; }

.burrow__tunnel {
  position: absolute;
  top: var(--hole-y);
  left: var(--inset);
  right: var(--inset);
  height: 0.38rem;
  border-radius: var(--radius-full);
  background: #020203;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.05);
  transform: translateY(-50%);
  overflow: hidden;
}

.burrow__trail {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(241, 132, 171, 0.2), var(--accent));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 360ms var(--ease-standard);
}

.wormy-hero[data-state="connecting"] .burrow__trail {
  transform: scaleX(1);
  transition: transform 700ms cubic-bezier(0.45, 0, 0.25, 1) 280ms;
}

.wormy-hero[data-state="on"] .burrow__trail { transform: scaleX(1); }

/* Wormy underground: a short body of light moving through the tunnel */
.burrow__runner {
  position: absolute;
  top: var(--hole-y);
  left: var(--inset);
  width: 3.4rem;
  height: 0.9rem;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, rgba(238, 127, 167, 0), #ee7fa7 55%, #f9a9c6);
  box-shadow: 0 0 14px rgba(241, 132, 171, 0.35);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
}

.wormy-hero[data-state="connecting"] .burrow__runner {
  animation: burrow-run 700ms cubic-bezier(0.45, 0, 0.25, 1) 280ms both;
}

@keyframes burrow-run {
  0% { left: var(--inset); opacity: 0; }
  18% { opacity: 1; }
  82% { opacity: 1; }
  100% { left: calc(100% - var(--inset)); opacity: 0; }
}

.burrow__hole {
  position: absolute;
  top: var(--hole-y);
  width: var(--hole-w);
  height: var(--hole-h);
  border-radius: 50%;
  background: radial-gradient(50% 65% at 50% 38%, #000 58%, #130e17 100%);
  box-shadow:
    inset 0 3px 5px rgba(0, 0, 0, 0.95),
    0 1px 0 rgba(255, 255, 255, 0.08),
    0 -1px 0 rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
  transition: box-shadow 600ms var(--ease-standard);
}

.burrow__hole--from { left: var(--inset); }
.burrow__hole--to { left: calc(100% - var(--inset)); }

.wormy-hero[data-state="on"] .burrow__hole--to {
  box-shadow:
    inset 0 3px 5px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(241, 132, 171, 0.3),
    0 1px 0 rgba(255, 200, 220, 0.2);
}

.burrow__portal {
  position: absolute;
  z-index: 2;
  bottom: calc(100% - var(--hole-y) - var(--hole-h) / 2);
  width: max(calc(var(--worm-w) + 0.6rem), var(--hole-w));
  height: calc(var(--track-h) * 2);
  transform: translateX(-50%);
  overflow: hidden;
  pointer-events: none;
  /* visible above the hole's centre line, and inside the hole's front half below it */
  -webkit-mask-image: linear-gradient(#000, #000), radial-gradient(closest-side, #000 96%, transparent 100%);
  -webkit-mask-size: 100% calc(100% - var(--hole-h) / 2), var(--hole-w) var(--hole-h);
  -webkit-mask-position: top center, bottom center;
  -webkit-mask-repeat: no-repeat;
  mask-image: linear-gradient(#000, #000), radial-gradient(closest-side, #000 96%, transparent 100%);
  mask-size: 100% calc(100% - var(--hole-h) / 2), var(--hole-w) var(--hole-h);
  mask-position: top center, bottom center;
  mask-repeat: no-repeat;
}

.burrow__portal--from { left: var(--inset); }
.burrow__portal--to { left: calc(100% - var(--inset)); }

/* Shade where the body meets the hole */
.burrow__portal::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: calc(var(--worm-w) * 0.8);
  height: calc(var(--hole-h) / 2 + 1.4rem);
  background: linear-gradient(0deg, rgba(40, 4, 20, 0.62), rgba(40, 4, 20, 0.18) 55%, rgba(40, 4, 20, 0));
  transform: translateX(-50%);
  transition: opacity 200ms linear;
}

.wormy {
  position: absolute;
  left: 50%;
  bottom: -0.55rem;
  width: var(--worm-w);
  height: auto;
  overflow: visible;
  transform: translate(-50%, 0);
  transform-origin: 50% 100%;
  translate: 0 0;
}

.wormy__eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: wormy-blink 6.5s ease-in-out infinite;
}

.wormy__pupils {
  transition: transform 320ms var(--ease-standard);
}

@keyframes wormy-blink {
  0%, 94%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.12); }
}

/* OFF: Wormy waits in the left hole */
.burrow__portal--from .wormy {
  transition:
    transform 460ms cubic-bezier(0.16, 1, 0.3, 1) 280ms,
    translate 260ms var(--ease-standard);
}

.burrow__portal--to .wormy {
  transform: translate(-50%, 112%);
  rotate: 6deg;
  transition:
    transform 260ms cubic-bezier(0.55, 0, 0.8, 0.2),
    rotate 260ms cubic-bezier(0.55, 0, 0.8, 0.2);
}

.burrow__portal--to::after { opacity: 0; }

.wormy-hero[data-state="off"] .burrow__portal--from .wormy__pupils {
  transform: translateX(2.5px);
}

.wormy-hero[data-state="off"] .burrow:hover .burrow__portal--from .wormy {
  translate: 0 -5%;
}

.wormy-hero[data-state="off"] .burrow:hover .wormy__pupils {
  transform: translate(3px, -1px);
}

/* CONNECTING: Wormy dives in */
.wormy-hero[data-state="connecting"] .burrow__portal--from .wormy,
.wormy-hero[data-state="on"] .burrow__portal--from .wormy {
  transform: translate(-50%, 112%);
  transition:
    transform 300ms cubic-bezier(0.55, 0, 0.8, 0.2),
    translate 260ms var(--ease-standard);
}

.wormy-hero[data-state="connecting"] .burrow__portal--from::after,
.wormy-hero[data-state="on"] .burrow__portal--from::after {
  opacity: 0;
  transition-delay: 300ms;
}

/* CONNECTED: Wormy surfaces on the other side */
.wormy-hero[data-state="on"] .burrow__portal--to .wormy {
  transform: translate(-50%, 0);
  rotate: 0deg;
  transition:
    transform 540ms cubic-bezier(0.3, 1.22, 0.55, 1),
    rotate 540ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.wormy-hero[data-state="on"] .burrow__portal--to::after { opacity: 1; }

.burrow__legend {
  display: flex;
  justify-content: space-between;
  margin-top: 0.95rem;
  padding-inline: calc(var(--inset) - 1.25rem);
  color: rgba(239, 239, 236, 0.38);
  font: 700 0.64rem / 1 var(--mono);
  letter-spacing: 0.16em;
}

.burrow__legend span {
  width: 2.5rem;
  text-align: center;
  transition: color var(--duration-slow) var(--ease-standard);
}

.wormy-hero[data-state="off"] .burrow__legend span:first-child { color: rgba(239, 239, 236, 0.72); }
.wormy-hero[data-state="on"] .burrow__legend span:last-child { color: var(--accent); }

.wormy-device__readout {
  margin: clamp(1.1rem, 2.2vh, 1.4rem) 0 0;
  padding: 1.1rem 0.25rem 0.1rem;
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.wormy-device__readout div {
  display: grid;
  align-content: start;
  gap: 0.45rem;
  min-width: 0;
}

.wormy-device__readout div:last-child {
  text-align: right;
}

.wormy-device__readout dt {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 560;
}

.wormy-device__readout dd {
  margin: 0;
  overflow: hidden;
  color: rgba(239, 239, 236, 0.62);
  font-size: 0.9rem;
  font-weight: 620;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--duration-slow) var(--ease-standard);
}

.wormy-device__readout [data-session] {
  font-family: var(--mono);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.wormy-hero[data-state="on"] .wormy-device__readout dd { color: var(--text-primary); }

.wormy-hero__hint {
  margin: 0;
  padding-top: var(--space-6);
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
  text-align: center;
}

/* -------------------------------------------------------- Responsive */

@media (min-width: 105rem) {
  /* next section's kicker lands above the fold, its headline just below */
  .wormy-hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); padding-bottom: 3.5rem; }
  .wormy-hero h1 { font-size: min(6.95vw, 7.25rem); }
  .wormy-hero__stage { width: min(100%, 38rem); }
  .wormy-device { --device-pad: 2rem; border-radius: 2.5rem; }
  .wormy-device__status strong { font-size: 2.6rem; }
  .wormy-device__status small { font-size: 0.92rem; }
  .wormy-device__bay { padding: 3.8rem 1.5rem 1.2rem; border-radius: 1.8rem; }
  .burrow { --track-h: 8.2rem; --hole-w: 6.9rem; --hole-h: 2.1rem; --inset: 4.35rem; --worm-w: 7.1rem; border-radius: 4.1rem; }
  .wormy-device__readout dd { font-size: 1rem; }
}

@media (max-width: 75rem) {
  .wormy-hero {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    align-items: center;
  }
  .wormy-device { transform: rotateY(-3deg) rotateX(1.5deg); }
}

/* Stacked composition: headline → copy → actions → Wormy demo */
@media (max-width: 56rem) {
  .wormy-hero {
    --focus-x: 50%;
    --focus-y: 52%;
    min-height: auto;
    padding-block: clamp(1.75rem, 5vw, 3rem) var(--space-16);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "kicker" "title" "lead" "actions" "note" "product";
    align-items: start;
  }

  .wormy-hero__copy { display: contents; }
  .wormy-hero .wormy-kicker { grid-area: kicker; }
  .wormy-hero h1 { grid-area: title; font-size: clamp(3.3rem, 12.4vw, 6.6rem); }
  .wormy-hero__product { grid-area: product; justify-items: stretch; margin-top: clamp(2.5rem, 7vw, 3.5rem); }
  .wormy-hero__lead { grid-area: lead; }
  .wormy-hero__actions { grid-area: actions; }
  .wormy-hero__note { grid-area: note; }

  .wormy-hero__stage { width: 100%; max-width: 36rem; }
  .wormy-device { transform: none; }
  .wormy-hero__hint { padding-top: var(--space-5); }
}

/* Phone: compact instrument, status and switch in one glance */
@media (max-width: 36rem) {

  .wormy-hero { padding-top: var(--space-6); padding-bottom: var(--space-12); }
  .wormy-hero .wormy-kicker { margin-bottom: var(--space-4); font-size: 0.66rem; }
  .wormy-hero h1 { font-size: min(12.8vw, 4.2rem); }
  .wormy-hero__lead span { display: inline; }
  .wormy-hero__product { margin-top: var(--space-10); }
  .wormy-hero__stage::after { bottom: -1.4rem; }

  .wormy-device {
    --device-pad: 0.85rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title chip" "note note" "bay bay" "readout readout";
    align-items: center;
    border-radius: 1.6rem;
  }

  .wormy-device__header { display: contents; }
  .wormy-device__brand { display: none; }
  .wormy-device__chip { grid-area: chip; align-self: start; height: 1.7rem; margin: 0.15rem 0.1rem 0 0; }
  .wormy-device__status { display: contents; }
  .wormy-device__status strong { grid-area: title; margin: 0.3rem 0 0 0.3rem; font-size: 1.25rem; }
  .wormy-device__status small { grid-area: note; margin: 0.35rem 0 0 0.3rem; overflow: hidden; font-size: 0.74rem; text-overflow: ellipsis; white-space: nowrap; }

  .wormy-device__bay {
    grid-area: bay;
    margin-top: 0.7rem;
    padding: 2.25rem 0.7rem 0.7rem;
    border-radius: 1.1rem;
  }

  .burrow {
    --track-h: 4.5rem;
    --hole-w: 3.8rem;
    --hole-h: 1.2rem;
    --inset: 2.45rem;
    --worm-w: 3.9rem;
  }

  .burrow__legend { margin-top: 0.6rem; font-size: 0.6rem; }

  .wormy-device__readout {
    grid-area: readout;
    grid-template-columns: 1fr 1fr;
    margin-top: 0.65rem;
    padding: 0.7rem 0.3rem 0.05rem;
  }

  .wormy-device__readout div:first-child { display: none; }
  .wormy-device__readout dd { font-size: 0.82rem; }

  .wormy-hero__lead { margin-top: var(--space-6); font-size: 1.02rem; }
  .wormy-hero__actions { margin-top: var(--space-6); display: grid; grid-template-columns: 1fr; gap: var(--space-1); }
  .wormy-hero__actions .wormy-button { width: 100%; }
  .wormy-hero__note { margin-top: var(--space-3); text-align: center; text-wrap: balance; }
}

@media (prefers-reduced-motion: reduce) {
  .wormy-hero *, .wormy-hero *::before, .wormy-hero *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
  .wormy__eyes { animation: none; }
}


/* ------------------------------------------------- Production integration */

/* Global p/h1 rules from styles.css must not reach the hero */
.wormy-hero p {
  line-height: 1.5;
}

.wormy-hero .wormy-kicker {
  line-height: 1.2;
}

/* Under ?theme=light the hero keeps its own dark ground */
:root[data-theme="light"] .wormy-hero__env,
:root[data-theme="light"] .story-section {
  background-color: #0b0c0d;
}

@media (prefers-reduced-motion: reduce) {
  .wormy-nav::before,
  .wormy-nav__inner,
  .wormy-nav__menu,
  .wormy-nav__toggle-icon::before,
  .wormy-nav__toggle-icon::after {
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

.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;
}

/* Hero conversion copy (M3): the trial terms lead, the price stays secondary.
   Typographic emphasis only — hero layout and styling are unchanged. */
.wormy-hero__note strong {
  color: rgba(239, 239, 236, 0.86);
  font-weight: 600;
}

.wormy-hero__note span {
  color: rgba(239, 239, 236, 0.46);
}

/* ================================================================ Product story (M3)
   Hero → devices → three steps → trial → bento → trust → pricing → FAQ → final CTA.
   Background stays near-black; pink means brand, interaction, selected state, conversion.
   Every visual is HTML/CSS/SVG (no images to load below the fold) and reads from a still frame. */

.story-section {
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ground: #0b0c0d;
  --surface-1: #0f1012;
  --surface-2: #151619;
  --hairline: rgba(255, 255, 255, 0.08);
  position: relative;
  width: var(--hero-width);
  margin-inline: auto;
  padding-block: clamp(5.5rem, 10vw, 9.5rem);
  color: var(--text-secondary);
}

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

.home-page .story-section[id] {
  scroll-margin-top: var(--nav-h);
}

.story-section .wormy-kicker {
  line-height: 1.2;
}

.story-section h2 {
  margin: 0;
  color: var(--text-primary);
  font: 650 clamp(2.9rem, 5.7vw, 5.9rem) / 0.92 var(--font-display);
  letter-spacing: -0.066em;
  text-wrap: balance;
}

.story-section h2 em {
  color: var(--text-muted);
  font-style: normal;
}

.story-section p {
  line-height: 1.55;
}

.story-section a:focus-visible,
.story-section button:focus-visible {
  border-radius: 0.3rem;
  outline: 2px solid var(--accent-hover);
  outline-offset: 4px;
}

.story-section .wormy-button:focus-visible {
  border-radius: var(--radius-sm);
}

.story-lead {
  max-width: 34rem;
  margin: var(--space-6) 0 0;
  color: rgba(239, 239, 236, 0.72);
  font-size: clamp(1.05rem, 1.3vw, 1.2rem);
}

/* Fixed headline lines on desktop; below 64rem lines wrap (balanced) — a nowrap line at
   vw-based sizes ran past the screen on tablets and phone landscape (M10). */
.story-line {
  display: block;
}

@media (min-width: 64.0625rem) {
  .story-line { white-space: nowrap; }
}

.story-tag {
  margin-left: 0.3rem;
  padding: 0.12rem 0.36rem;
  border-radius: 0.3rem;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(241, 132, 171, 0.3);
  font: 700 0.58rem / 1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  vertical-align: 0.12em;
}

/* ------------------------------------------- Shared Wormy UI fragments */
/* Screens are sized by their own width (container units), so one set of rules
   renders the TV, the phone and the bento at any viewport. */

.story-screen {
  position: relative;
  overflow: hidden;
  container-type: inline-size;
  background: radial-gradient(90% 70% at 50% 40%, #16171a, #08090a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.045);
}

.ui-brand {
  color: rgba(239, 239, 236, 0.5);
  font: 700 0.62rem / 1 var(--mono);
  letter-spacing: 0.22em;
}

.ui-chip {
  display: inline-flex;
  align-items: center;
  height: 1.5em;
  padding: 0 0.6em;
  border-radius: var(--radius-full);
  color: rgba(239, 239, 236, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font: 700 0.6rem / 1 var(--mono);
  letter-spacing: 0.08em;
}

.ui-chip--accent {
  color: #1a0e13;
  background: var(--accent);
  box-shadow: none;
}

/* The burrow: Wormy's hole. Pink rim light = connected. */
.ui-burrow {
  position: relative;
  display: block;
  aspect-ratio: 3;
  border-radius: 50%;
  background:
    radial-gradient(60% 50% at 50% 100%, rgba(241, 132, 171, 0.22), transparent 70%),
    radial-gradient(closest-side, #000 70%, #0a0a0c);
  box-shadow:
    inset 0 0.35rem 0.8rem rgba(0, 0, 0, 0.95),
    inset 0 -1px 0 rgba(241, 132, 171, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0.6rem 2rem -0.4rem rgba(241, 132, 171, 0.28);
}

.ui-burrow::before,
.ui-burrow::after {
  content: "";
  position: absolute;
  inset: -34% -18%;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.ui-burrow::after {
  inset: -78% -40%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.phone-ui__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.phone-ui__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.6em;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(239, 239, 236, 0.5);
  font-size: 0.72rem;
}

.phone-ui__row b {
  color: var(--text-primary);
  font: 650 0.72rem / 1 var(--mono);
  letter-spacing: 0.04em;
}

/* ----------------------------------------------------- 01 · Devices */

.story-devices {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto 1fr;
  column-gap: var(--space-4);
  padding-top: clamp(0.5rem, 2vw, 2rem);
}

/* Continuation of the hero geometry: one faint orbit and a low light behind the devices */
.story-devices::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 2%;
  left: 58%;
  width: min(62rem, 90vw);
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transform: translateX(-30%);
  -webkit-mask-image: radial-gradient(closest-side, #000 60%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 60%, transparent 100%);
  pointer-events: none;
}

.story-devices__intro {
  position: relative;
  z-index: 1;
  grid-column: 1 / span 8;
  grid-row: 1;
}

.story-devices__copy {
  grid-column: 1 / span 4;
  grid-row: 2;
  align-self: end;
  padding-top: clamp(2rem, 4vw, 3.5rem);
}

.story-platforms {
  margin: var(--space-10) 0 0;
  border-top: 1px solid var(--hairline);
}

.story-platforms > div {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: var(--space-4);
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--hairline);
}

.story-platforms dt {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 640;
}

.story-platforms dd {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.story-platforms dd a {
  color: rgba(239, 239, 236, 0.86);
  text-decoration: underline;
  text-decoration-color: rgba(241, 132, 171, 0.6);
  text-underline-offset: 0.2em;
}

.story-platforms dd a:hover {
  color: var(--accent);
}

.story-platforms__soon dt,
.story-platforms__soon dd {
  color: rgba(239, 239, 236, 0.56); /* ≥4.5:1 on the ground (M8 a11y pass) */
}

.story-link {
  margin: var(--space-5) 0 0 -1rem;
}

.story-devices__stage {
  position: relative;
  grid-column: 6 / -1;
  grid-row: 1 / span 2;
  align-self: end;
  margin-top: clamp(8rem, 13vw, 12rem);
  aspect-ratio: 16 / 11;
}

/* Soft floor light and contact shadow */
.story-devices__stage::before {
  content: "";
  position: absolute;
  inset: auto 6% 3% 10%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.8), transparent);
  filter: blur(18px);
}

.story-devices__stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 8%;
  left: 20%;
  width: 70%;
  height: 70%;
  background: radial-gradient(closest-side, rgba(255, 244, 238, 0.05), transparent);
}

.story-tv {
  position: absolute;
  top: 0;
  right: 0;
  width: 88%;
}

.story-tv__frame {
  position: relative;
  padding: 0.6rem;
  border-radius: 1.2rem;
  background: linear-gradient(180deg, #1c1d20, #0d0e10);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 40px 80px -30px rgba(0, 0, 0, 0.9);
  transform: perspective(90rem) rotateY(-4deg);
  transform-origin: 100% 50%;
}

.story-tv__frame::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 42%;
  right: 42%;
  height: 1rem;
  background: linear-gradient(#17181b, #0b0c0d);
  clip-path: polygon(24% 0, 76% 0, 100% 100%, 0 100%);
}

.story-tv__screen {
  aspect-ratio: 16 / 9;
  border-radius: 0.65rem;
}

.tv-ui {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 4cqi;
  padding: 7cqi 7cqi 7cqi 17cqi;
}

.tv-ui__copy {
  display: grid;
  justify-items: start;
}

.tv-ui .ui-brand { font-size: 1.6cqi; }

.tv-ui__status {
  margin-top: 3cqi;
  color: var(--text-primary);
  font: 650 6.2cqi / 1 var(--font-display);
  letter-spacing: -0.05em;
}

.tv-ui__meta {
  margin-top: 1.6cqi;
  color: rgba(239, 239, 236, 0.5);
  font: 600 1.8cqi / 1 var(--mono);
  letter-spacing: 0.06em;
}

/* D-pad focus: the Android TV interface is driven by a remote */
.tv-ui__focus {
  margin-top: 5cqi;
  padding: 1.3cqi 2.8cqi;
  border-radius: var(--radius-full);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 0.35cqi var(--accent), 0 0 3cqi rgba(241, 132, 171, 0.3);
  font: 620 1.9cqi / 1 var(--font-display);
}

.tv-ui .ui-burrow {
  width: 66%;
  justify-self: center;
  margin-top: 4cqi;
}

.story-phone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 23%;
}

.story-phone__frame {
  padding: 0.4rem;
  border-radius: 2rem;
  background: linear-gradient(180deg, #202124, #0d0e10);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    -20px 40px 70px -24px rgba(0, 0, 0, 0.95);
}

.story-phone__screen {
  aspect-ratio: 9 / 19;
  border-radius: 1.6rem;
}

.phone-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 16cqi 9cqi 10cqi;
}

.phone-ui .ui-brand { font-size: 5cqi; }
.phone-ui .ui-chip { font-size: 5cqi; }

.phone-ui__status {
  margin-top: 12cqi;
  color: var(--text-primary);
  font: 650 11cqi / 1 var(--font-display);
  letter-spacing: -0.045em;
}

.phone-ui__hint {
  margin-top: 4cqi;
  color: rgba(239, 239, 236, 0.5);
  font-size: 5.4cqi;
  line-height: 1.35;
}

.phone-ui .ui-burrow {
  width: 62%;
  margin: auto auto;
}

.phone-ui .phone-ui__row { font-size: 5.6cqi; }
.phone-ui .phone-ui__row b { font-size: 5.6cqi; }

.story-caption {
  display: block;
  margin-top: 1.9rem;
  color: var(--text-muted);
  font: 700 0.64rem / 1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.story-phone .story-caption {
  margin-top: 0.9rem;
  text-align: center;
}

/* The phone overlaps the TV's lower-left corner; its caption starts past the phone */
.story-tv .story-caption { padding-left: 16%; }

/* Quick Settings tile: selected state, so it carries the accent */
.story-tile {
  position: absolute;
  right: 4%;
  bottom: 7%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.3rem 0.7rem 0.7rem;
  border-radius: var(--radius-full);
  color: #1a0e13;
  background: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 24px 48px -18px rgba(0, 0, 0, 0.9),
    0 12px 30px -16px rgba(241, 132, 171, 0.45);
  transform: rotate(-2deg);
}

.story-tile__icon {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background: #1a0e13;
  box-shadow: inset 0 0 0 0.55rem #1a0e13, inset 0 0 0 0.68rem var(--accent);
}

.story-tile__text {
  display: grid;
  gap: 0.2rem;
  font-size: 0.78rem;
  line-height: 1.1;
}

.story-tile__text b { font-size: 0.92rem; font-weight: 700; }

/* ------------------------------------------------------ 02 · Flow */

.story-flow {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--space-4);
  row-gap: clamp(3.5rem, 6vw, 5.5rem);
  align-items: center;
}

/* A slightly lifted band behind the explanation; fades in and out, no hard edge */
.story-flow::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 50%;
  width: 100vw;
  margin-left: -50vw;
  background: linear-gradient(180deg, transparent, #0e0f11 22%, #0e0f11 78%, transparent);
  pointer-events: none;
}

.story-flow__heading {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 22rem);
  align-items: end;
  gap: var(--space-6) var(--space-12);
}

.story-flow__heading .wormy-kicker { grid-column: 1 / -1; }
.story-flow__heading .story-lead { margin: 0 0 0.5rem; }

.story-flow__visual {
  grid-column: 1 / span 5;
  display: grid;
  justify-items: center;
}

.flow-phone {
  position: relative;
  width: min(100%, 19.5rem);
}

/* Light behind the phone: neutral while setting up, pink once connected */
.flow-phone::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 10% -40%;
  background: radial-gradient(closest-side, rgba(255, 244, 238, 0.05), transparent);
  transition: background var(--duration-slow) var(--ease-standard);
}

.story-flow[data-step="3"] .flow-phone::before {
  background: radial-gradient(closest-side, rgba(241, 132, 171, 0.12), transparent);
}

.flow-phone__frame {
  padding: 0.5rem;
  border-radius: 2.6rem;
  background: linear-gradient(180deg, #212225, #0d0e10);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 50px 90px -40px rgba(0, 0, 0, 0.95);
}

.flow-phone__screen {
  aspect-ratio: 9 / 18.5;
  border-radius: 2.1rem;
}

.flow-phone__screen::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 3.4%;
  left: 50%;
  width: 5%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #000;
  transform: translateX(-50%);
}

.flow-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 18cqi 9cqi 10cqi;
  opacity: 0;
  visibility: hidden;
  transform: translateY(3%);
  transition:
    opacity 420ms var(--ease-standard),
    transform 520ms var(--ease-enter),
    visibility 0s linear 420ms;
}

.story-flow[data-step="1"] .flow-screen--1,
.story-flow[data-step="2"] .flow-screen--2,
.story-flow[data-step="3"] .flow-screen--3 {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.flow-screen--1,
.flow-screen--2 {
  align-items: center;
  text-align: center;
}

.flow-screen__icon {
  width: 30cqi;
  height: 30cqi;
  margin-top: 22cqi;
  border-radius: 8cqi;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 16px 34px -14px rgba(241, 132, 171, 0.45);
}

.flow-screen__app {
  margin-top: 7cqi;
  color: var(--text-primary);
  font: 650 8cqi / 1 var(--font-display);
  letter-spacing: -0.03em;
}

.flow-screen__title {
  color: var(--text-primary);
  font: 650 9cqi / 1.05 var(--font-display);
  letter-spacing: -0.04em;
}

.flow-screen--2 .flow-screen__title { margin-top: 14cqi; }
.flow-screen--3 .flow-screen__title { margin-top: 12cqi; font-size: 11cqi; }

.flow-screen__sub {
  margin-top: 3cqi;
  color: rgba(239, 239, 236, 0.5);
  font-size: 4.4cqi;
  line-height: 1.4;
}

.flow-screen__progress {
  width: 62%;
  height: 1.4cqi;
  margin-top: 12cqi;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
}

.flow-screen__progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0.2);
  transition: transform 1.2s var(--ease-enter) 0.15s;
}

.story-flow[data-step="1"] .flow-screen__progress i { transform: scaleX(1); }

.flow-screen__button {
  width: 100%;
  margin-top: auto;
  padding: 4.2cqi 0;
  border-radius: var(--radius-full);
  color: #1a0e13;
  background: var(--accent);
  font: 680 4.8cqi / 1 var(--font-display);
}

.flow-code {
  display: flex;
  gap: 2.6cqi;
  margin: 12cqi 0 7cqi;
}

.flow-code > span {
  display: flex;
  gap: 1cqi;
}

.flow-code i {
  position: relative;
  width: 5.6cqi;
  aspect-ratio: 3 / 4;
  border-radius: 1.2cqi;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.flow-code i::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.4cqi;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--text-primary);
  transform: translate(-50%, -50%);
}

.flow-screen--2 .ui-chip { font-size: 3.8cqi; }

.flow-screen--3 .ui-brand,
.flow-screen--3 .ui-chip { font-size: 4.6cqi; }

.flow-screen--3 .phone-ui__row,
.flow-screen--3 .phone-ui__row b { font-size: 5cqi; }

.flow-screen--3 .phone-ui__row + .phone-ui__row { margin-top: 3.4cqi; }

/* M3's one extra Wormy appearance: it surfaces from the burrow once connected */
.flow-worm {
  width: 100%;
  height: auto;
  margin: auto 0 6cqi;
  overflow: visible;
}

.flow-worm__glow {
  fill: rgba(241, 132, 171, 0.14);
  filter: blur(6px);
}

.flow-worm__body {
  transform: translateY(72px);
  transition: transform 700ms var(--ease-spring) 180ms;
}

.story-flow[data-step="3"] .flow-worm__body {
  transform: none;
}

/* Steps: one rail that fills up to the active step */
.story-flow__steps {
  --rail-fill: 100%;
  position: relative;
  grid-column: 7 / -1;
  margin: 0;
  padding: 0 0 0 2.6rem;
  display: grid;
  gap: clamp(2rem, 3.4vw, 3rem);
  list-style: none;
}

.story-flow__steps::before,
.story-flow__steps::after {
  content: "";
  position: absolute;
  top: 0.9rem;
  bottom: 0.9rem;
  left: 0.42rem;
  width: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.story-flow__steps::after {
  bottom: auto;
  height: calc((100% - 1.8rem) * var(--rail-fill));
  background: var(--accent);
  transition: height 700ms var(--ease-enter);
}

.story-flow[data-step="1"] .story-flow__steps { --rail-fill: 0; }
.story-flow[data-step="2"] .story-flow__steps { --rail-fill: 0.5; }

.story-flow__steps li {
  position: relative;
}

.story-flow__steps li::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0.62rem;
  left: -2.6rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: #0e0f11;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  transition: background var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard);
}

.story-flow[data-step="1"] li:nth-child(-n + 1)::before,
.story-flow[data-step="2"] li:nth-child(-n + 2)::before,
.story-flow[data-step="3"] li::before {
  background: var(--accent);
  box-shadow: 0 0 0 0.35rem rgba(241, 132, 171, 0.14);
}

.story-flow__steps h3 {
  margin: 0;
}

.story-flow__trigger {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  min-height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 0;
  color: rgba(239, 239, 236, 0.4);
  background: none;
  font: 650 clamp(1.9rem, 3vw, 3rem) / 1.05 var(--font-display);
  letter-spacing: -0.05em;
  text-align: left;
  cursor: pointer;
  transition: color var(--duration-base) var(--ease-standard);
}

.story-flow__trigger:hover,
.story-flow[data-step="1"] li:nth-child(1) .story-flow__trigger,
.story-flow[data-step="2"] li:nth-child(-n + 2) .story-flow__trigger,
.story-flow[data-step="3"] .story-flow__trigger {
  color: var(--text-primary);
}

.story-flow__index {
  flex: none;
  color: var(--accent);
  font: 700 var(--type-label) / 1 var(--mono);
  letter-spacing: 0.1em;
  transform: translateY(-0.5em);
}

.story-flow__steps p {
  max-width: 28rem;
  margin: var(--space-3) 0 0;
  color: var(--text-muted);
  font-size: 1rem;
}

.story-flow__steps a {
  display: inline-block;
  margin-top: 0.1rem;
  padding-block: 0.65rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 620;
  text-decoration: underline;
  text-decoration-color: rgba(239, 239, 236, 0.3);
  text-underline-offset: 0.24em;
  transition: color var(--duration-fast) var(--ease-standard), text-decoration-color var(--duration-fast) var(--ease-standard);
}

.story-flow__steps a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.story-flow__steps a[data-trial-cta] {
  color: var(--accent);
  text-decoration-color: rgba(241, 132, 171, 0.4);
}

/* ------------------------------------------------ 03 · Trial moment */

.story-trial {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: var(--space-12) clamp(3rem, 6vw, 7rem);
  padding-block: clamp(3rem, 6vw, 5rem) clamp(5rem, 9vw, 8rem);
}

.story-trial h2 {
  font-size: clamp(2.6rem, 5vw, 5.2rem);
}

.story-trial__offer {
  display: grid;
  justify-items: start;
  padding-left: clamp(0rem, 3vw, 3rem);
  border-left: 1px solid var(--hairline);
}

.story-trial__days {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 var(--space-6);
  color: var(--text-muted);
  font: 700 0.72rem / 1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.story-trial__days strong {
  color: var(--accent);
  font: 650 4.4rem / 0.8 var(--font-display);
  letter-spacing: -0.06em;
}

.story-trial__lead {
  margin: 0;
  color: rgba(239, 239, 236, 0.76);
  font-size: 1.1rem;
}

.story-trial__terms {
  margin: var(--space-2) 0 var(--space-8);
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 640;
}

.story-trial__alt {
  margin: var(--space-4) 0 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.story-trial__alt a,
.story-final__alt a {
  color: rgba(239, 239, 236, 0.86);
  text-decoration: underline;
  text-decoration-color: rgba(239, 239, 236, 0.28);
  text-underline-offset: 0.22em;
}

.story-trial__alt a:hover,
.story-final__alt a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* ------------------------------------------------------- 04 · Bento */

.story-bento {
  padding-top: clamp(4rem, 8vw, 7rem);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.story-bento h2 {
  font-size: clamp(2.5rem, 4.4vw, 4.6rem);
}

.story-bento__grid {
  margin-top: clamp(3rem, 6vw, 5rem);
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-4);
}

.story-feature {
  position: relative;
  min-width: 0;
  padding: clamp(1.75rem, 3vw, 2.75rem);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.story-feature h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(2rem, 3.1vw, 3.3rem);
  font-weight: 650;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.story-feature p {
  max-width: 28rem;
  margin: var(--space-4) 0 0;
  color: var(--text-muted);
  font-size: 1rem;
}

/* Простой — raised surface holding a minimal Wormy screen */
.story-feature--simple {
  grid-column: 1 / span 5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-10);
  min-height: 32rem;
  background: linear-gradient(180deg, #17181b, #111214);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.simple-ui {
  display: grid;
  gap: 0.9rem;
  width: min(100%, 19rem);
  margin-inline: auto;
  padding: 1.1rem;
  border-radius: 1.5rem;
  background: #0b0c0d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 30px 60px -30px rgba(0, 0, 0, 0.9);
}

.simple-ui__action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin: 1.4rem 0 0.8rem;
  padding: 1.1rem;
  border-radius: var(--radius-full);
  color: #1a0e13;
  background: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 16px 34px -18px rgba(241, 132, 171, 0.6);
  font-size: 1rem;
  font-weight: 700;
}

.simple-ui__action i {
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid #1a0e13;
  border-radius: 50%;
}

.simple-ui__muted,
.simple-ui__muted b {
  opacity: 0.55;
}

/* Быстрый — open instrument: no card, only the route and a hairline frame */
.story-feature--fast {
  grid-column: 6 / -1;
  display: flex;
  isolation: isolate;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-8);
  padding-inline: clamp(0rem, 2vw, 2rem) 0;
  border-radius: 0;
}

.story-feature--fast::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 3rem 3rem;
  background-position: center;
  -webkit-mask-image: radial-gradient(60% 55% at 55% 40%, #000, transparent 75%);
  mask-image: radial-gradient(60% 55% at 55% 40%, #000, transparent 75%);
}

.story-route {
  width: 100%;
  max-width: 38rem;
  height: auto;
  align-self: center;
  margin-top: var(--space-6);
}

.story-route__path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1.5;
  stroke-dasharray: 3 7;
}

.story-route__path--auto {
  stroke: rgba(241, 132, 171, 0.55);
  stroke-width: 2;
  stroke-dasharray: none;
}

.story-route__pulse {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 36 324;
  animation: story-route-pulse 2.8s var(--ease-standard) infinite;
}

@keyframes story-route-pulse {
  from { stroke-dashoffset: 36; }
  to { stroke-dashoffset: -324; }
}

.story-route__ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
}

.story-route__node {
  fill: var(--ground);
  stroke: rgba(255, 255, 255, 0.26);
  stroke-width: 1.5;
}

.story-route__node--you { stroke: var(--text-primary); }
.story-route__node--auto { fill: var(--accent); stroke: var(--accent); }

.story-route text {
  fill: var(--text-primary);
  font: 600 13px var(--mono);
}

.story-route .story-route__tag {
  fill: var(--accent);
  letter-spacing: 0.12em;
}

/* На твоих устройствах — text card; the surface strip left the page in M13 («Один Wormy.
   Все устройства.» already answers «works on my device?») */
.story-feature--devices {
  grid-column: 1 / span 6;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 11rem;
  background: linear-gradient(180deg, #17181b, #111214);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* Если что — мы рядом: the pink plane with a burrow cut into it */
.story-feature--support {
  grid-column: 7 / -1;
  display: flex;
  flex-direction: column;
  min-height: 22rem;
  color: #170e12;
  background: var(--accent);
}

.story-feature--support h3 { color: #170e12; }
.story-feature--support p { color: rgba(23, 14, 18, 0.72); }

.story-feature--support::after {
  content: "";
  position: absolute;
  right: -12%;
  bottom: -7%;
  width: 42%;
  aspect-ratio: 2.7;
  border-radius: 50%;
  background: radial-gradient(closest-side, #0b0c0d 60%, #1a0e13);
  box-shadow: inset 0 0.8rem 1.4rem rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.story-support__handle {
  margin-top: auto;
  padding-top: var(--space-8);
  color: rgba(23, 14, 18, 0.55);
  font: 700 0.8rem / 1 var(--mono);
  letter-spacing: 0.04em;
}

.story-support__link {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  margin-top: var(--space-3);
  color: #170e12;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(23, 14, 18, 0.35);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.25em;
}

.story-support__link span { transition: transform 280ms var(--ease-enter); }
.story-support__link:hover { text-decoration-color: #170e12; }
.story-support__link:hover span { transform: translateX(4px); }

.story-section .story-support__link:focus-visible {
  outline-color: #170e12;
}

/* -------------------------------------------------- 05 · Final trial */
/* Centered bookend: the hero's orbits return and Wormy surfaces once, then the footer. */

.story-final {
  isolation: isolate;
  display: grid;
  justify-items: center;
  padding-block: clamp(6rem, 12vw, 10rem);
  text-align: center;
}

.story-final__env {
  position: absolute;
  z-index: -1;
  inset: 0 50%;
  width: 100vw;
  margin-left: -50vw;
  overflow: hidden;
  pointer-events: none;
}

.story-final__env::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(40rem 22rem at 50% 58%, rgba(241, 132, 171, 0.06), transparent 70%);
}

.story-final__env i {
  position: absolute;
  top: 58%;
  left: 50%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: translate(-50%, -50%);
}

.story-final__env i:nth-child(1) { width: 34rem; box-shadow: inset 0 0 0 1px rgba(241, 132, 171, 0.1); }
.story-final__env i:nth-child(2) { width: 56rem; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035); }
.story-final__env i:nth-child(3) { width: 82rem; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.022); }

.story-final h2 {
  font-size: clamp(2.6rem, 4.6vw, 4.6rem);
}

.story-final__lead {
  margin: var(--space-6) 0 var(--space-8);
  color: rgba(239, 239, 236, 0.8);
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
}

.story-final__alt a {
  display: inline-block;
  padding-block: 0.7rem;
}

.story-final__alt {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.8rem;
  margin: var(--space-3) 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Boundary to the footer */
.story-final::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.09) 20%, rgba(255, 255, 255, 0.09) 80%, transparent);
}

/* ------------------------------------------------ Story responsive */

@media (min-width: 105rem) {
  .story-devices__stage { margin-top: 12rem; }
  .flow-phone { width: 21rem; }
}

@media (max-width: 64rem) {
  .story-devices { grid-template-rows: auto; }
  .story-devices__intro { grid-column: 1 / -1; }
  .story-devices__stage {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    max-width: 48rem;
    margin: var(--space-12) auto 0;
  }
  .story-devices__copy { grid-column: 1 / -1; grid-row: 3; max-width: 40rem; padding-top: var(--space-12); }

  .story-flow__visual { grid-column: 1 / span 5; }
  .story-flow__steps { grid-column: 6 / -1; }
  .story-flow__heading { grid-template-columns: minmax(0, 1fr); }
  .story-flow__heading .story-lead { margin: 0; }

  .story-trial { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .story-trial__offer { padding-left: 0; padding-top: var(--space-10); border-left: 0; border-top: 1px solid var(--hairline); }

  .story-feature--simple { grid-column: 1 / span 6; }
  .story-feature--fast { grid-column: 7 / -1; }
  .story-feature--devices { grid-column: 1 / span 6; }
  .story-feature--support { grid-column: 7 / -1; min-height: 0; }
  .story-feature--support::after { width: 38%; }
}

/* Phones and small tablets: stacked, reordered, fewer decorative layers */
@media (max-width: 48rem) {
  .story-section { padding-block: var(--space-20); }
  .story-section h2 { font-size: min(10.6vw, 4rem); }
  .story-lead { font-size: 1.02rem; }

  .story-devices { padding-top: var(--space-4); }
  .story-devices::before { display: none; }
  .story-devices__stage { aspect-ratio: 16 / 12.5; margin-top: var(--space-10); }
  .story-tv { width: 90%; }
  .story-tv__frame { padding: 0.35rem; border-radius: 0.8rem; transform: none; }
  .tv-ui { padding-left: 25cqi; }
  .story-tv .story-caption { padding-left: 25%; }
  .tv-ui .ui-burrow { width: 80%; }
  .story-tv__frame::after { height: 0.6rem; }
  .story-phone { width: 29%; }
  .story-phone__frame { padding: 0.25rem; border-radius: 1.15rem; }
  .story-phone__screen { border-radius: 0.95rem; }
  .story-caption { margin-top: 1rem; font-size: 0.56rem; }
  .story-phone .story-caption { margin-top: 0.6rem; }
  .story-tile { right: 0; bottom: 14%; gap: 0.5rem; padding: 0.45rem 0.9rem 0.45rem 0.45rem; }
  .story-tile__icon { width: 1.6rem; height: 1.6rem; box-shadow: inset 0 0 0 0.38rem #1a0e13, inset 0 0 0 0.48rem var(--accent); }
  .story-tile__text { font-size: 0.64rem; }
  .story-tile__text b { font-size: 0.74rem; }
  .story-devices__copy { padding-top: var(--space-8); }
  .story-platforms { margin-top: var(--space-8); }

  .story-flow { row-gap: var(--space-10); }
  .story-flow__visual,
  .story-flow__steps { grid-column: 1 / -1; }
  .flow-phone { width: min(72%, 16rem); }
  .story-flow__trigger { font-size: 2rem; }

  .story-trial h2,
  .story-final h2 { font-size: min(10.4vw, 3.6rem); }

  .story-bento__grid { gap: var(--space-3); }
  .story-feature { padding: var(--space-6); border-radius: var(--radius-lg); }
  .story-feature--simple,
  .story-feature--fast { grid-column: 1 / -1; min-height: 0; }
  .story-feature--simple { gap: var(--space-8); }
  .story-feature--devices { grid-column: 1 / -1; order: 1; min-height: 0; }
  .story-feature--support { grid-column: 1 / -1; order: 2; min-height: 19rem; }

  .story-final__env i:nth-child(3) { display: none; }
}

@media (max-width: 36rem) {
  .story-section h2 { font-size: min(11.2vw, 3.2rem); }
  .story-devices__intro .story-line { white-space: nowrap; }
  .story-devices__stage { aspect-ratio: 16 / 13.5; }
  .story-platforms > div { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }

  .story-flow__steps { padding-left: 2.2rem; }
  .story-flow__steps li::before { left: -2.2rem; }
  .story-flow__trigger { gap: 0.75rem; font-size: 1.75rem; }

  .story-trial h2,
  .story-final h2 { font-size: min(9.6vw, 3.2rem); }
  .story-trial__days strong { font-size: 3.6rem; }
  .story-trial .wormy-button,
  .story-final .wormy-button { width: 100%; }
  .story-final { padding-block: var(--space-20); }
  .story-final__lead { text-wrap: balance; }

  .simple-ui { padding: 0.9rem; }
  .story-route { margin-top: 0; }
  .story-feature--support { padding-bottom: 4.5rem; }
  .story-feature--support::after { width: 44%; bottom: -5%; }
}

@media (max-width: 22rem) {
  .story-section h2 { font-size: 2.3rem; }
  .story-flow__trigger { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .story-section *,
  .story-section *::before,
  .story-section *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

/* ================================================================ Trust (compact, M13)
   “Мы продаём VPN. Не ваши данные.” plus the two verified lines a buyer needs here. The
   connection map and the 01–05 ledger left the selling page in M13; docs/TRUST.md keeps
   every verified claim and is the source for a future /privacy page. */

.trust {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Headline first, full width, then the claims underneath. A side-by-side column split put
   the large nowrap headline next to text and it overlapped it from 1100px up (M13 fix). */
.trust__intro {
  max-width: 64rem;
}

.trust__intro h2 {
  margin-bottom: 0;
}

.trust-claims {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6) clamp(2rem, 4vw, 4rem);
  margin: clamp(2.5rem, 4vw, 3.5rem) 0 0;
  padding: 0;
  max-width: 68rem;
  list-style: none;
}

.trust-claims li {
  position: relative;
  padding-left: 2rem;
  color: rgba(239, 239, 236, 0.78);
  font-size: clamp(1.02rem, 1.25vw, 1.15rem);
  line-height: 1.55;
}

/* a hairline check for a fact that is actually verified */
.trust-claims li::before {
  content: "";
  position: absolute;
  top: 0.45em;
  left: 0;
  width: 0.7rem;
  height: 0.38rem;
  border-left: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  rotate: -45deg;
}

@media (max-width: 48rem) {
  .trust-claims {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
    margin-top: var(--space-8);
  }
}

/* ================================================================ Pricing (M7)
   Three terms from subscriptionPlans (script.js); the best monthly price is the one
   lit in pink. Checkout opens in .checkout-sheet: a drawer from md, a bottom sheet
   on phones. Pink = selection and conversion; green only for a promo code the
   backend actually accepted and for a confirmed payment. */

.tariffs {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* The trust ledger already ends on a hairline; a second rule right below reads as a double line */
.trust + .tariffs {
  border-top: 0;
}

.tariffs__intro .story-lead {
  max-width: 36rem;
}

.tariffs__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: var(--space-4);
  margin-top: clamp(3.5rem, 6vw, 5rem);
  scroll-margin-top: calc(var(--nav-h) + 1.5rem);
}

.tariff {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 21rem;
  padding: clamp(1.5rem, 2.4vw, 2.25rem);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  transition:
    border-color var(--duration-base) var(--ease-standard),
    transform var(--duration-slow) var(--ease-enter),
    box-shadow var(--duration-slow) var(--ease-enter);
}

.tariff:focus-within {
  border-color: rgba(255, 255, 255, 0.22);
}

@media (hover: hover) {
  .tariff:hover {
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
  }
}

.tariff.is-featured {
  min-height: 24rem;
  border-color: rgba(241, 132, 171, 0.5);
  background:
    radial-gradient(28rem 16rem at 50% -10%, rgba(241, 132, 171, 0.13), transparent 70%),
    var(--surface-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 214, 229, 0.08),
    0 40px 90px -50px rgba(241, 132, 171, 0.45);
}

@media (hover: hover) {
  .tariff.is-featured:hover {
    border-color: rgba(241, 132, 171, 0.75);
  }
}

.tariff__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 1.75rem;
}

.tariff__period {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.tariff__badge {
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-full);
  color: #1a0e13;
  background: var(--accent);
  font: 750 0.66rem / 1 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tariff__price {
  margin: auto 0 0;
  padding-top: var(--space-10);
  color: var(--text-primary);
  font: 650 clamp(2.6rem, 3.9vw, 3.9rem) / 1 var(--font-display);
  letter-spacing: -0.055em;
  white-space: nowrap;
}

.tariff__meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 3rem;
  margin: var(--space-3) 0 var(--space-8);
  font: 500 0.85rem / 1.3 var(--mono);
}

.tariff__monthly {
  color: rgba(239, 239, 236, 0.66);
}

.tariff__saving {
  color: var(--accent);
}

.is-featured .tariff__monthly {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 650;
}

.tariff__cta {
  width: 100%;
  min-height: 3.25rem;
}

/* The whole card picks the plan; the button stays the one real control */
.tariff__cta::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.tariffs .tariff__cta:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 3px;
}

/* Loading: before script.js renders the cards */
.tariff--skeleton {
  min-height: 21rem;
  background: linear-gradient(100deg, var(--surface-1) 30%, #16171a 50%, var(--surface-1) 70%) 0 0 / 300% 100%;
  animation: tariff-skeleton 1.4s linear infinite;
}

.tariff--skeleton:nth-child(3) {
  min-height: 24rem;
}

html:not(.js) .tariff--skeleton {
  display: none;
}

@keyframes tariff-skeleton {
  to { background-position: -150% 0; }
}

.tariffs__noscript {
  margin: var(--space-6) 0 0;
  color: var(--text-muted);
}

.tariffs__noscript a {
  color: var(--accent);
}

@media (max-width: 56rem) {
  .tariffs__grid { gap: var(--space-3); }
  .tariff { min-height: 19rem; padding: var(--space-6); }
  .tariff.is-featured { min-height: 21rem; }
  .tariff__price { font-size: clamp(2.2rem, 4.6vw, 2.8rem); }
}

/* Phones: short rows for the other terms, the best value keeps its full card */
@media (max-width: 40rem) {
  .tariffs__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
    margin-top: var(--space-10);
  }

  .tariff,
  .tariff--skeleton {
    min-height: 0;
  }

  .tariff--skeleton { height: 6.5rem; }
  .tariff--skeleton:nth-child(3) { order: -1; height: 15rem; }

  .tariff:not(.is-featured) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 1rem;
    grid-template-areas:
      "head price cta"
      "meta meta cta";
    align-items: baseline;
    gap: 0.35rem var(--space-4);
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius-md);
  }

  .tariff:not(.is-featured) .tariff__head { grid-area: head; min-height: 0; }
  .tariff:not(.is-featured) .tariff__price {
    grid-area: price;
    margin: 0;
    padding: 0;
    font-size: 1.6rem;
    letter-spacing: -0.04em;
  }
  .tariff:not(.is-featured) .tariff__meta {
    grid-area: meta;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0 0.9rem;
    min-height: 0;
    margin: 0;
    font-size: 0.8rem;
  }

  /* The quiet button collapses to a chevron; the card stays the tap target */
  .tariff:not(.is-featured) .tariff__cta {
    grid-area: cta;
    align-self: center;
    width: 1rem;
    min-height: 1rem;
    padding: 0;
    border: 0;
    color: transparent;
    background: none;
    font-size: 0;
  }

  .tariff:not(.is-featured) .tariff__cta::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-top: 1.5px solid rgba(239, 239, 236, 0.55);
    border-right: 1.5px solid rgba(239, 239, 236, 0.55);
    transform: rotate(45deg);
  }

  .tariff.is-featured {
    order: -1;
    min-height: 0;
    padding: var(--space-6);
  }

  .tariff.is-featured .tariff__price { padding-top: var(--space-6); font-size: 2.8rem; }
  .tariff.is-featured .tariff__meta { flex-direction: row; flex-wrap: wrap; gap: 0 1rem; min-height: 0; margin-bottom: var(--space-6); }
}

@media (prefers-reduced-motion: reduce) {
  .tariff--skeleton { animation: none; }
  .tariff:hover { transform: none; }
}

/* ============================================================== Checkout sheet */

html.checkout-open {
  overflow: hidden;
}

.checkout-sheet {
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --hairline: rgba(255, 255, 255, 0.08);
  --field: rgba(255, 255, 255, 0.04);
  /* Dark by design like the homepage; pinned so ?theme=light can't flip text to dark */
  --text-primary: #fafaf7;
  --text-secondary: #efefec;
  --text-muted: rgba(239, 239, 236, 0.62);
  --accent: #f184ab;
  --accent-hover: #ff9fc1;
  --success: #76d49a;
  --warning: #efb866;
  --error: #ff8bab;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--text-secondary);
  background: transparent;
  font-family: var(--font-body);
  color-scheme: dark;
}

.checkout-sheet:not([open]) {
  display: none;
}

.checkout-sheet::backdrop {
  background: rgba(2, 2, 3, 0.72);
  backdrop-filter: blur(6px);
}

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

.checkout-sheet__panel {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  width: min(30rem, calc(100% - 1.5rem));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  background: #111214;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  animation: checkout-drawer-in var(--duration-slow) var(--ease-enter) both;
}

@keyframes checkout-drawer-in {
  from { opacity: 0; transform: translateX(2rem); }
}

.checkout-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 1rem 1rem 1rem 1.5rem;
  border-bottom: 1px solid var(--hairline);
}

.checkout-sheet__title {
  margin: 0;
  color: var(--text-primary);
  font: 650 1.2rem / 1.2 var(--font-display);
  letter-spacing: -0.025em;
}

.checkout-sheet__title:focus {
  outline: none;
}

.checkout-sheet__close {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: rgba(239, 239, 236, 0.7);
  background: transparent;
  cursor: pointer;
  transition: color var(--duration-fast), background-color var(--duration-fast), opacity var(--duration-fast);
}

.checkout-sheet__close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.checkout-sheet__close:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.checkout-sheet :is(a, button, input):focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

.checkout-sheet__form {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.checkout-sheet__form[hidden] {
  display: none;
}

.checkout-sheet__body {
  display: grid;
  align-content: start;
  gap: var(--space-6);
  flex: 1;
  min-height: 0;
  padding: var(--space-6);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.checkout-sheet__label {
  display: block;
  margin: 0 0 0.6rem;
  padding: 0;
  color: rgba(239, 239, 236, 0.62);
  font: 700 var(--type-label) / 1.2 var(--font-body);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

/* ---- Plan switcher */

.checkout-sheet__plans {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.checkout-sheet__plan-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.checkout-sheet__plan {
  position: relative;
  display: grid;
  gap: 0.2rem;
  min-height: 5rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--field);
  cursor: pointer;
  transition: border-color var(--duration-fast), background-color var(--duration-fast);
}

.checkout-sheet__plan:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.checkout-sheet__plan input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}

.checkout-sheet__plan:has(input:focus-visible) {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

.checkout-sheet__plan:has(input:disabled) {
  cursor: not-allowed;
}

.checkout-sheet__plan.is-selected {
  border-color: var(--accent);
  background: rgba(241, 132, 171, 0.08);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.checkout-sheet__plan-period {
  color: rgba(239, 239, 236, 0.72);
  font-size: 0.82rem;
  font-weight: 600;
}

.checkout-sheet__plan-price {
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.checkout-sheet__plan-meta {
  color: rgba(239, 239, 236, 0.5);
  font: 500 0.68rem / 1.2 var(--mono);
  white-space: nowrap;
}

.checkout-sheet__plan.is-featured .checkout-sheet__plan-meta {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---- Fields */

.checkout-sheet__field {
  min-width: 0;
}

.checkout-sheet__input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: var(--field);
  /* 16px: iOS Safari zooms into smaller inputs */
  font: 500 1rem / 1.2 var(--font-body);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.checkout-sheet__input::placeholder {
  color: rgba(239, 239, 236, 0.3);
}

.checkout-sheet__input:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.checkout-sheet .checkout-sheet__input:focus-visible,
.checkout-sheet__input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(241, 132, 171, 0.22);
}

.checkout-sheet__input[aria-invalid="true"] {
  border-color: var(--error);
}

.checkout-sheet__input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(255, 139, 171, 0.2);
}

.checkout-sheet__input:read-only {
  color: rgba(239, 239, 236, 0.6);
}

.checkout-sheet__hint,
.checkout-sheet__error,
.checkout-sheet__promo-status {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
}

.checkout-sheet__hint {
  color: rgba(239, 239, 236, 0.5);
}

.checkout-sheet__error {
  color: var(--error);
}

.checkout-sheet__error::before,
[data-promo-state="invalid"] .checkout-sheet__promo-status::before {
  content: "! ";
  font-weight: 800;
}

/* The hint gives way to the error rather than stacking under it */
.checkout-sheet__error:not([hidden]) ~ .checkout-sheet__hint,
.checkout-sheet__field:has(.checkout-sheet__error:not([hidden])) .checkout-sheet__hint {
  display: none;
}

/* ---- Promo */

.checkout-sheet__promo-toggle {
  min-height: 2.75rem;
  margin: -0.5rem 0;
  padding: 0;
  border: 0;
  color: var(--accent);
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.checkout-sheet__promo-toggle:hover {
  color: var(--accent-hover);
}

.checkout-sheet__promo-input {
  position: relative;
}

.checkout-sheet__promo-input .checkout-sheet__input {
  padding-right: 6rem;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.checkout-sheet__promo-input .checkout-sheet__input::placeholder {
  font-family: var(--font-body);
  letter-spacing: 0;
  text-transform: none;
}

.checkout-sheet__promo-clear {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  min-height: 2.5rem;
  padding: 0 0.8rem;
  border: 0;
  border-radius: calc(var(--radius-sm) - 0.2rem);
  color: rgba(239, 239, 236, 0.72);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transform: translateY(-50%);
}

.checkout-sheet__promo-clear:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.checkout-sheet__promo-status {
  color: rgba(239, 239, 236, 0.5);
}

.checkout-sheet__promo-status:empty {
  display: none;
}

[data-promo-state="invalid"] .checkout-sheet__promo-status {
  color: var(--error);
}

[data-promo-state="valid"] .checkout-sheet__input {
  border-color: var(--success);
}

[data-promo-state="valid"] .checkout-sheet__promo-status {
  color: var(--success);
}

[data-promo-state="valid"] .checkout-sheet__promo-status::before {
  content: "✓ ";
}

/* ---- Summary */

.checkout-sheet__summary {
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}

.checkout-sheet__summary dl {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.checkout-sheet__summary dl > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: 0.92rem;
}

.checkout-sheet__summary dt {
  min-width: 0;
  color: rgba(239, 239, 236, 0.78);
}

.checkout-sheet__summary dd {
  margin: 0;
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.checkout-sheet__summary .is-muted :is(dt, dd) {
  color: rgba(239, 239, 236, 0.45);
  font-weight: 500;
}

.checkout-sheet__summary .is-saving dd {
  color: var(--accent);
}

.checkout-sheet__summary .is-promo dt {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.checkout-sheet__summary .is-promo dd {
  color: rgba(239, 239, 236, 0.55);
  font-weight: 500;
}

.checkout-sheet__summary .is-promo.is-valid dd { color: var(--success); }
.checkout-sheet__summary .is-promo.is-invalid dd { color: var(--error); }

.checkout-sheet__summary .is-total {
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--hairline);
}

.checkout-sheet__summary .is-total dt {
  color: var(--text-primary);
  font-weight: 650;
}

.checkout-sheet__summary .is-total dd {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.checkout-sheet__summary .is-footnote dd {
  color: rgba(239, 239, 236, 0.5);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
}

/* ---- Alerts: payment error / network error */

.checkout-sheet__alert {
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 139, 171, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(255, 139, 171, 0.07);
}

.checkout-sheet__alert[data-kind="network"] {
  border-color: rgba(239, 184, 102, 0.35);
  background: rgba(239, 184, 102, 0.07);
}

.checkout-sheet__alert strong {
  display: block;
  color: var(--error);
  font-size: 0.95rem;
}

.checkout-sheet__alert[data-kind="network"] strong {
  color: var(--warning);
}

.checkout-sheet__alert p {
  margin: 0.25rem 0 0;
  color: rgba(239, 239, 236, 0.78);
  font-size: 0.88rem;
  line-height: 1.45;
}

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

.checkout-sheet a.wormy-button {
  text-decoration: none;
}

/* ---- Footer + payment CTA */

.checkout-sheet__foot {
  padding: 1rem var(--space-6) calc(1rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hairline);
  background: #111214;
}

.checkout-sheet__submit {
  position: relative;
  width: 100%;
  min-height: 3.5rem;
  font-size: 1.02rem;
}

.checkout-sheet__submit:disabled {
  cursor: progress;
}

.checkout-sheet__spinner {
  display: none;
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: checkout-spin 0.75s linear infinite;
}

.checkout-sheet__submit[aria-busy="true"] .checkout-sheet__spinner,
.checkout-sheet__spinner.is-large {
  display: inline-block;
}

.checkout-sheet__spinner.is-large {
  width: 1.6rem;
  height: 1.6rem;
  color: var(--accent);
}

@keyframes checkout-spin {
  to { transform: rotate(360deg); }
}

.checkout-sheet__note {
  margin: 0.75rem 0 0;
  color: rgba(239, 239, 236, 0.48);
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: center;
}

/* ---- Result after returning from the provider */

.checkout-sheet__result {
  display: grid;
  align-content: center;
  justify-items: center;
  flex: 1;
  gap: var(--space-4);
  padding: var(--space-10) var(--space-8) calc(var(--space-10) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  text-align: center;
}

.checkout-sheet__result[hidden] {
  display: none;
}

.checkout-sheet__result-icon {
  display: grid;
  place-items: center;
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 50%;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.checkout-sheet__result-icon svg {
  width: 1.6rem;
  height: 1.6rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-status="success"] .checkout-sheet__result-icon {
  color: var(--success);
  background: rgba(118, 212, 154, 0.1);
  box-shadow: inset 0 0 0 1px rgba(118, 212, 154, 0.35);
}

[data-status="failed"] .checkout-sheet__result-icon {
  color: var(--error);
  background: rgba(255, 139, 171, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 139, 171, 0.3);
}

:is([data-status="network"], [data-status="pending"]) .checkout-sheet__result-icon {
  color: var(--warning);
  background: rgba(239, 184, 102, 0.08);
  box-shadow: inset 0 0 0 1px rgba(239, 184, 102, 0.3);
}

.checkout-sheet__result-title {
  margin: var(--space-2) 0 0;
  color: var(--text-primary);
  font: 650 1.7rem / 1.1 var(--font-display);
  letter-spacing: -0.035em;
}

.checkout-sheet__result-text {
  max-width: 24rem;
  margin: 0;
  color: rgba(239, 239, 236, 0.72);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.checkout-sheet__result-actions {
  display: grid;
  gap: var(--space-2);
  width: min(100%, 22rem);
  margin-top: var(--space-4);
}

.checkout-sheet__result-actions:empty {
  display: none;
}

/* ---- Phones: bottom sheet */

@media (max-width: 47.99rem) {
  .checkout-sheet__panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 0.75rem);
    border-width: 1px 0 0;
    border-radius: 1.25rem 1.25rem 0 0;
    animation-name: checkout-sheet-in;
  }

  /* Grab handle: signals a sheet; closing is the × button or a tap on the backdrop */
  .checkout-sheet__panel::before {
    content: "";
    position: absolute;
    top: 0.45rem;
    left: 50%;
    width: 2.4rem;
    height: 0.25rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(-50%);
  }

  .checkout-sheet__head { padding: 1rem 0.5rem 0.75rem 1.25rem; }
  .checkout-sheet__body { gap: var(--space-5); padding: var(--space-5) 1.25rem; }
  .checkout-sheet__foot { padding-inline: 1.25rem; }
  .checkout-sheet__plan { min-height: 4.6rem; padding: 0.65rem; }
  .checkout-sheet__result { flex: none; min-height: 60dvh; padding-inline: 1.25rem; }
}

@keyframes checkout-sheet-in {
  from { transform: translateY(100%); }
}

@media (max-width: 22.5rem) {
  .checkout-sheet__plan-price { font-size: 0.95rem; }
  .checkout-sheet__plan-meta { font-size: 0.62rem; }
}

@media (prefers-reduced-motion: reduce) {
  .checkout-sheet__panel { animation: none; }
}

/* ================================================================ FAQ (M8)
   WAI-ARIA accordion: h3 > button[aria-expanded] controls a region. Answers ship open
   (readable without JS); script.js collapses them and animates the height. */

.faq {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-12) clamp(3rem, 8vw, 8rem);
  align-items: start;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.faq__intro .story-lead a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@media (min-width: 64.0625rem) {
  .faq__intro {
    position: sticky;
    top: calc(var(--nav-h) + var(--space-8));
  }
}

.faq__list {
  border-bottom: 1px solid var(--hairline);
}

.faq__item {
  border-top: 1px solid var(--hairline);
}

.faq__question {
  margin: 0;
  font: inherit;
}

.faq__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  width: 100%;
  min-height: 4.75rem;
  padding: var(--space-5) 0;
  border: 0;
  color: var(--text-primary);
  background: none;
  font: 620 clamp(1.05rem, 1.35vw, 1.25rem) / 1.3 var(--font-body);
  letter-spacing: -0.015em;
  text-align: left;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-standard);
}

.faq__trigger:hover {
  color: #fff;
}

.story-section .faq__trigger:focus-visible {
  outline-offset: 2px;
}

/* Plus that turns into a minus: two hairlines, the vertical one folds away */
.faq__icon {
  position: relative;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  transition: border-color var(--duration-base) var(--ease-standard), background-color var(--duration-base) var(--ease-standard);
}

.faq__icon::before,
.faq__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.8rem;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transform: translate(-50%, -50%);
  transition: transform var(--duration-slow) var(--ease-enter);
}

.faq__icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.faq__trigger:hover .faq__icon {
  border-color: rgba(255, 255, 255, 0.28);
}

.faq__trigger[aria-expanded="true"] .faq__icon {
  border-color: rgba(241, 132, 171, 0.55);
  color: var(--accent);
  background: rgba(241, 132, 171, 0.08);
}

.faq__trigger[aria-expanded="true"] .faq__icon::after {
  transform: translate(-50%, -50%) rotate(0deg);
}

.faq__panel {
  max-width: 40rem;
  padding-right: 3.5rem;
  color: rgba(239, 239, 236, 0.72);
}

/* Bottom space lives inside the content: a closed hidden="until-found" panel keeps its own padding */
.faq__panel > :last-child {
  padding-bottom: var(--space-6);
}

.faq__panel p {
  margin: 0;
}

.faq__panel p + p {
  margin-top: var(--space-3);
}

.faq__panel a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: rgba(241, 132, 171, 0.6);
  text-underline-offset: 0.2em;
}

.faq__panel a:hover {
  color: var(--accent);
}

/* Open/close motion once JS drives the accordion */
.faq__panel.is-animating {
  overflow: hidden;
  transition: height var(--duration-slow) var(--ease-enter), opacity var(--duration-base) var(--ease-standard);
}

@media (max-width: 64rem) {
  .faq { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 36rem) {
  .faq { gap: var(--space-8); }
  .faq__trigger { min-height: 4rem; gap: var(--space-4); }
  .faq__icon { width: 2rem; height: 2rem; }
  .faq__panel { padding-right: 0; font-size: 0.97rem; }
}

@media (prefers-reduced-motion: reduce) {
  .faq__panel.is-animating { transition: none; }
  .faq__icon::before,
  .faq__icon::after { transition: none; }
}

/* ============================================================ Final CTA mark
   The flat brand mark (single skin fill, no sheen or shade) in one hole. It surfaces
   once when the section is seen, blinks, and lifts ≤5% toward the CTA on hover. */

.final-mark {
  --hole-w: 7.5rem;
  --hole-h: 1.5rem;
  --worm-w: 4.6rem;
  position: relative;
  width: 9rem;
  height: 6.25rem;
  margin-bottom: var(--space-8);
}

.final-mark__hole {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: var(--hole-w);
  height: var(--hole-h);
  border-radius: 50%;
  background: radial-gradient(50% 65% at 50% 38%, #000 58%, #130e17 100%);
  box-shadow:
    inset 0 3px 5px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(241, 132, 171, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateX(-50%);
}

/* Visible above the hole's centre line, and inside the hole's front half below it */
.final-mark__portal {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(#000, #000), radial-gradient(closest-side, #000 96%, transparent 100%);
  -webkit-mask-size: 100% calc(100% - var(--hole-h) / 2), var(--hole-w) var(--hole-h);
  -webkit-mask-position: top center, bottom center;
  -webkit-mask-repeat: no-repeat;
  mask-image: linear-gradient(#000, #000), radial-gradient(closest-side, #000 96%, transparent 100%);
  mask-size: 100% calc(100% - var(--hole-h) / 2), var(--hole-w) var(--hole-h);
  mask-position: top center, bottom center;
  mask-repeat: no-repeat;
}

.final-mark__wormy {
  position: absolute;
  bottom: -0.9rem;
  left: 50%;
  width: var(--worm-w);
  height: auto;
  overflow: visible;
  transform: translate(-50%, 0);
  transform-origin: 50% 100%;
  transition: transform var(--duration-slow) var(--ease-enter);
}

.final-mark__pupils {
  transition: transform 320ms var(--ease-standard);
}

/* Before the section is seen, Wormy waits inside the hole (JS only; no JS = already out) */
.js .story-final:not(.is-surfaced) .final-mark__wormy {
  transform: translate(-50%, 105%);
}

.story-final.is-surfaced .final-mark__wormy {
  animation: final-surface 720ms var(--ease-enter) both;
}

@keyframes final-surface {
  0% { transform: translate(-50%, 105%) rotate(0deg); }
  62% { transform: translate(-50%, -3%) rotate(-5deg); }
  100% { transform: translate(-50%, 0) rotate(0deg); }
}

/* Hover/focus on the CTA: a small lift and a look down at it */
.story-final.is-surfaced:has(.wormy-button--primary:is(:hover, :focus-visible)) .final-mark__wormy {
  animation: none;
  transform: translate(-50%, -4%);
}

.story-final:has(.wormy-button--primary:is(:hover, :focus-visible)) .final-mark__pupils {
  transform: translateY(2.5px);
}

.story-final__alt a {
  color: rgba(239, 239, 236, 0.86);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@media (max-width: 36rem) {
  .final-mark { transform: scale(0.85); margin-bottom: var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  .js .story-final:not(.is-surfaced) .final-mark__wormy,
  .story-final.is-surfaced .final-mark__wormy {
    animation: none;
    transform: translate(-50%, 0);
    transition: none;
  }
  .final-mark .wormy__eyes { animation: none; }
}

/* ================================================================== Footer */

.wormy-footer {
  --hairline: rgba(255, 255, 255, 0.08);
  position: relative;
  color: var(--text-muted);
  background: #080809;
  font-size: 0.92rem;
}

.wormy-footer__inner {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: var(--space-12) var(--space-8);
  width: var(--hero-width);
  margin-inline: auto;
  padding: clamp(3.5rem, 6vw, 5rem) 0 calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
}

.wormy-footer .wormy-footer__wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  color: var(--text-primary);
  font-size: 1.3rem;
  font-weight: 720;
  letter-spacing: -0.03em;
}

.wormy-footer__wordmark small {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.wormy-footer__brand p {
  margin: var(--space-3) 0 0;
}

.wormy-footer__nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-8) var(--space-6);
}

.wormy-footer__title {
  margin: 0 0 var(--space-4);
  color: rgba(239, 239, 236, 0.58);
  font-size: var(--type-label);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.wormy-footer ul {
  display: grid;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ≥40px tall rows without stretching two-line items */
.wormy-footer li > a,
.wormy-footer__pending {
  display: inline-block;
  padding-block: 0.6rem;
  line-height: 1.35;
}

.wormy-footer a {
  color: rgba(239, 239, 236, 0.78);
  transition: color var(--duration-fast) var(--ease-standard);
}

.wormy-footer a:hover {
  color: var(--text-primary);
}

.wormy-footer a:focus-visible {
  border-radius: 0.3rem;
  outline: 2px solid var(--accent-hover);
  outline-offset: 3px;
}

.wormy-footer__pending {
  color: rgba(239, 239, 236, 0.58);
}

.wormy-footer__pending i {
  display: inline-block;
  margin-left: 0.2rem;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-full);
  color: rgba(239, 239, 236, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  font-size: 0.72rem;
  font-style: normal;
}

.wormy-footer__base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
  grid-column: 1 / -1;
  margin: 0;
  padding-top: var(--space-6);
  border-top: 1px solid var(--hairline);
  color: rgba(239, 239, 236, 0.58);
}

.wormy-footer__base small {
  font-size: 0.8rem;
}

@media (max-width: 64rem) {
  .wormy-footer__inner { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 48rem) {
  .wormy-footer__nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-8) var(--space-4); }
}

/* ======================================================================== Motion (M9)
   One rule: motion communicates state, hierarchy or Wormy's personality — otherwise it
   does not exist. Only transform-family properties (translate/scale/rotate) and opacity
   move, as keyframe animations, so they never replace a component's own transitions.
   Loops pause off screen (.is-motion-paused, script.js). Reduced motion: see the end.

   Timing scale
     press 90ms · feedback 160–240ms · state 320–520ms · entrance 600–800ms, stagger 70ms
   Where Wormy may move (docs/WORMY_VISUAL_DIRECTION.md, "Mascot use")
     peek   — hero demo on first view · final CTA on first view
     crawl  — hero connect (the signature switch left the homepage in M13)
     blink  — ≤ once per 6.5s, only while on screen, phases offset per placement
     react  — looks/lifts toward what the pointer is about to press (hero, final CTA) */

/* ------------------------------------------------------------------ Shared keyframes */

@keyframes motion-rise {
  from { opacity: 0; translate: 0 1.25rem; }
}

@keyframes motion-rise-small {
  from { opacity: 0; translate: 0 0.5rem; }
}

@keyframes motion-fade {
  from { opacity: 0; }
}

@keyframes motion-tick {
  from { opacity: 0.35; translate: 0 0.3rem; }
}

/* ------------------------------------------------------------------------- Navbar */

/* Desktop links: an underline grows from the centre toward the hovered item */
@media (min-width: 56.0625rem) {
  .wormy-nav__links a {
    position: relative;
  }

  .wormy-nav__links a::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -0.35rem;
    left: 0;
    height: 1px;
    background: currentColor;
    opacity: 0.5;
    scale: 0 1;
    transition: scale var(--duration-base) var(--ease-enter);
  }

  .wormy-nav__links a:hover::after {
    scale: 1 1;
  }
}

/* Mobile sheet: items follow the sheet in reading order */
@media (max-width: 56rem) {
  .wormy-nav.is-open .wormy-nav__menu :is(.wormy-nav__links a, .wormy-nav__login) {
    animation: motion-rise-small 320ms var(--ease-enter) backwards;
  }

  .wormy-nav.is-open .wormy-nav__links a:nth-child(2) { animation-delay: 30ms; }
  .wormy-nav.is-open .wormy-nav__links a:nth-child(3) { animation-delay: 60ms; }
  .wormy-nav.is-open .wormy-nav__links a:nth-child(4) { animation-delay: 90ms; }
  .wormy-nav.is-open .wormy-nav__menu .wormy-nav__login { animation-delay: 120ms; }
}

/* ------------------------------------------------------------------ Button press */
/* Every pressable control answers the finger within one frame. `scale` composes with
   the transforms these controls already use. */

.wormy-nav__cta,
.checkout-sheet__plan,
.checkout-sheet__close,
.checkout-sheet__promo-toggle,
.checkout-sheet__promo-clear,
.story-support__link {
  transition-property: color, background-color, border-color, box-shadow, opacity, scale;
  transition-duration: var(--duration-fast);
  transition-timing-function: var(--ease-standard);
}

.story-flow__trigger {
  transition: color var(--duration-base) var(--ease-standard), scale var(--duration-fast) var(--ease-standard);
}

.wormy-nav__cta:active,
.checkout-sheet__plan:active,
.checkout-sheet__close:active:not(:disabled),
.checkout-sheet__promo-toggle:active,
.checkout-sheet__promo-clear:active,
.story-support__link:active {
  scale: 0.97;
  transition-duration: 90ms;
}

.story-flow__trigger:active {
  scale: 0.985;
  transition-duration: 90ms;
}

.faq__trigger:active .faq__icon {
  scale: 0.9;
  transition: scale 90ms var(--ease-standard);
}

.faq__icon {
  transition: border-color var(--duration-base) var(--ease-standard), background-color var(--duration-base) var(--ease-standard), scale var(--duration-base) var(--ease-enter);
}

/* ------------------------------------------------------------------- Hero entrance */
/* Load only, once. Copy arrives in reading order, then the demo, then Wormy peeks out of
   its hole — the first thing the page says is "this is the switch". Ends on the exact
   design-locked frame; the navbar is usable from the first paint and does not animate. */

@media (prefers-reduced-motion: no-preference) {
  .js .wormy-hero__env {
    animation: motion-fade 1200ms var(--ease-standard) backwards;
  }

  .js .wormy-hero .wormy-kicker {
    animation: motion-rise-small 600ms var(--ease-enter) backwards;
  }

  .js .wormy-hero h1 .wormy-hero__line {
    animation: hero-line 720ms var(--ease-enter) backwards;
  }

  .js .wormy-hero h1 .wormy-hero__line:nth-child(1) { animation-delay: 60ms; }
  .js .wormy-hero h1 .wormy-hero__line:nth-child(2) { animation-delay: 130ms; }
  .js .wormy-hero h1 .wormy-hero__line:nth-child(3) { animation-delay: 200ms; }

  .js .wormy-hero__lead { animation: hero-settle 640ms var(--ease-enter) 300ms backwards; }
  .js .wormy-hero__actions { animation: motion-rise-small 640ms var(--ease-enter) 370ms backwards; }
  .js .wormy-hero__note { animation: motion-fade 640ms var(--ease-standard) 440ms backwards; }

  .js .wormy-hero__stage { animation: motion-rise 820ms var(--ease-enter) 220ms backwards; }
  .js .wormy-hero__hint { animation: motion-fade 600ms var(--ease-standard) 700ms backwards; }

  /* peek: rises past the lip, tilts ≤5°, settles once */
  .js .wormy-hero .burrow__portal--from .wormy {
    animation: wormy-peek 640ms var(--ease-enter) 900ms backwards;
  }

  .js .wormy-hero.is-peek-waiting .burrow__portal--from .wormy {
    animation: none;
    translate: 0 115%;
  }

  .js .wormy-hero.is-peek-late .burrow__portal--from .wormy {
    animation-delay: 120ms;
  }
}

/* Headline and lead are the LCP candidates: they are painted from the first frame and only
   settle into place. Fading them in would push LCP back by the whole entrance (~0.9s on a
   slow phone, measured in M9). */
@keyframes hero-line {
  from { translate: 0 0.22em; }
}

@keyframes hero-settle {
  from { translate: 0 0.5rem; }
}

@keyframes wormy-peek {
  0% { translate: 0 115%; rotate: 0deg; }
  62% { translate: 0 -5%; rotate: -5deg; }
  100% { translate: 0 0; rotate: 0deg; }
}

/* ------------------------------------------------------------------- Section reveal */
/* script.js tags groups with data-reveal and adds .motion-ok; nothing is hidden before
   that, and groups already on screen are marked .is-instant. */

.motion-ok :is([data-reveal="intro"], [data-reveal="list"]):not(.is-revealed) > :not(.story-final__env),
.motion-ok [data-reveal="block"]:not(.is-revealed),
.motion-ok [data-reveal="devices"]:not(.is-revealed) > * {
  opacity: 0;
}

.motion-ok :is([data-reveal="intro"], [data-reveal="list"]).is-revealed:not(.is-instant) > :not(.story-final__env) {
  animation: motion-rise 760ms var(--ease-enter) backwards;
  animation-delay: calc(var(--reveal-i, 0) * 70ms);
}

.motion-ok [data-reveal="block"].is-revealed:not(.is-instant) {
  animation: motion-rise 820ms var(--ease-enter) 140ms backwards;
}

/* Final CTA: orbits fade, the hole appears, Wormy surfaces (.is-surfaced), then the words */
.motion-ok .story-final.is-revealed:not(.is-instant) > .story-final__env {
  animation: motion-fade 1200ms var(--ease-standard) backwards;
}

/* --------------------------------------------------------------- Device transitions */
/* "Один Wormy. Все устройства.": the TV settles, the phone slides in beside it, then the
   quick-settings tile lands on top — the order in which the story names them. */

.motion-ok [data-reveal="devices"].is-revealed:not(.is-instant) > .story-tv {
  animation: motion-rise 900ms var(--ease-enter) backwards;
}

.motion-ok [data-reveal="devices"].is-revealed:not(.is-instant) > .story-phone {
  animation: device-slide 900ms var(--ease-enter) 220ms backwards;
}

.motion-ok [data-reveal="devices"].is-revealed:not(.is-instant) > .story-tile {
  animation: tile-land 620ms var(--ease-enter) 620ms backwards;
}

@keyframes device-slide {
  from { opacity: 0; translate: 2.5rem 0.75rem; }
}

@keyframes tile-land {
  from { opacity: 0; scale: 0.86; translate: 0 0.75rem; }
}

/* ------------------------------------------------------------------- Bento interaction */
/* Each card shows its claim once as it arrives, instead of hover lifts on things nobody
   can click (removed in M9). */

/* Простой: the one action gets pressed */
.motion-ok .story-bento__grid.is-revealed:not(.is-instant) .simple-ui__action {
  animation: simple-press 560ms var(--ease-standard) 900ms;
}

@keyframes simple-press {
  35% { scale: 0.95; }
  100% { scale: 1; }
}

/* Быстрый: AUTO is chosen — its node lands after the routes are drawn */
.motion-ok .story-bento__grid.is-revealed:not(.is-instant) .story-route__node--auto,
.motion-ok .story-bento__grid.is-revealed:not(.is-instant) .story-route__tag {
  transform-box: fill-box;
  transform-origin: center;
  animation: auto-pick 520ms var(--ease-enter) 700ms backwards;
}

@keyframes auto-pick {
  from { opacity: 0; scale: 0.4; }
}

/* На твоих устройствах: the four surfaces in reading order */
/* Мы рядом: the card is the link's hit area in spirit — the handle leans toward the arrow */
.story-support__handle {
  transition: translate var(--duration-slow) var(--ease-enter);
}

@media (hover: hover) {
  .story-feature--support:has(.story-support__link:hover) .story-support__handle {
    translate: 0.4rem 0;
  }
}

/* ------------------------------------------------------------------ Wormy: blink + react */

/* Offset blink phases: several Wormies blinking in unison reads as a machine */
.final-mark .wormy__eyes { animation-delay: -4.6s; }

/* Loops rest while their section is off screen */
.is-motion-paused *,
.is-motion-paused *::before,
.is-motion-paused *::after {
  animation-play-state: paused !important;
}

/* ----------------------------------------------------------------- Pricing selection */

/* Best value badge lands after its card: the recommendation is read second, not first */
.motion-ok .tariffs__grid.is-revealed:not(.is-instant) .tariff__badge {
  animation: badge-in 480ms var(--ease-enter) 520ms backwards;
}

@keyframes badge-in {
  from { opacity: 0; scale: 0.7; }
}

/* The chosen term inside checkout: its check fills in */
.checkout-sheet__plan::after {
  content: "";
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  scale: 0.2;
  transition: opacity var(--duration-fast) var(--ease-standard), scale var(--duration-slow) var(--ease-enter);
}

.checkout-sheet__plan.is-selected::after {
  opacity: 1;
  scale: 1;
}

/* Total and pay button re-read when the term changes */
.checkout-sheet .is-ticking {
  display: inline-block;
  animation: motion-tick 260ms var(--ease-enter);
}

/* --------------------------------------------------------------- Checkout open/close */

.checkout-sheet[open]::backdrop {
  animation: motion-fade 260ms var(--ease-standard);
}

.checkout-sheet.is-closing::backdrop {
  opacity: 0;
  transition: opacity 220ms var(--ease-exit);
}

/* Contents follow the panel in reading order */
.checkout-sheet[open] .checkout-sheet__body > :not(.checkout-sheet__alert) {
  animation: motion-rise-small 380ms var(--ease-enter) backwards;
}

.checkout-sheet[open] .checkout-sheet__body > :nth-child(2) { animation-delay: 60ms; }
.checkout-sheet[open] .checkout-sheet__body > :nth-child(3) { animation-delay: 100ms; }
.checkout-sheet[open] .checkout-sheet__body > :nth-child(4) { animation-delay: 140ms; }
.checkout-sheet[open] .checkout-sheet__body > :nth-child(5) { animation-delay: 180ms; }
.checkout-sheet[open] .checkout-sheet__foot { animation: motion-fade 320ms var(--ease-standard) 160ms backwards; }

.checkout-sheet.is-closing .checkout-sheet__panel {
  animation: checkout-drawer-out 220ms var(--ease-exit) forwards;
}

@keyframes checkout-drawer-out {
  to { opacity: 0; translate: 2rem 0; }
}

@media (max-width: 47.99rem) {
  .checkout-sheet.is-closing .checkout-sheet__panel {
    animation-name: checkout-sheet-out;
  }
}

@keyframes checkout-sheet-out {
  to { translate: 0 100%; }
}

/* Form ↔ result */
.checkout-sheet__result:not([hidden]):not(.is-settled) > * {
  animation: motion-rise-small 420ms var(--ease-enter) backwards;
}

.checkout-sheet__result:not(.is-settled) > :nth-child(2) { animation-delay: 80ms; }
.checkout-sheet__result:not(.is-settled) > :nth-child(3) { animation-delay: 130ms; }
.checkout-sheet__result:not(.is-settled) > :nth-child(4) { animation-delay: 180ms; }

/* ------------------------------------------------------------------ Promo + email */

/* The code field opens under its toggle */
.checkout-sheet__promo-row:not([hidden]) {
  animation: motion-rise-small 300ms var(--ease-enter);
}

/* Rejected: a short horizontal shake — "no", not "broken". Replayed per attempt. */
.checkout-sheet__input.is-rejected {
  animation: field-reject 360ms var(--ease-standard);
}

@keyframes field-reject {
  15% { translate: -5px 0; }
  35% { translate: 4px 0; }
  55% { translate: -3px 0; }
  75% { translate: 2px 0; }
  100% { translate: 0 0; }
}

.checkout-sheet__error:not([hidden]),
[data-promo-state="invalid"] .checkout-sheet__promo-status {
  animation: motion-rise-small 240ms var(--ease-enter);
}

/* Accepted: the verdict ticks in */
[data-promo-state="valid"] .checkout-sheet__promo-status {
  animation: promo-accept 420ms var(--ease-enter);
}

@keyframes promo-accept {
  from { opacity: 0; translate: 0.4rem 0; }
}

.checkout-sheet__summary .is-promo.is-valid dd {
  animation: motion-tick 320ms var(--ease-enter);
}

.checkout-sheet__alert:not([hidden]) {
  animation: motion-rise-small 280ms var(--ease-enter);
}

/* ----------------------------------------------------------------- Payment loading */

/* While a payment is created, the order visibly locks; the button carries the progress */
.checkout-sheet__body {
  transition: opacity var(--duration-base) var(--ease-standard);
}

.checkout-sheet__form[aria-busy="true"] .checkout-sheet__body {
  opacity: 0.55;
}

.checkout-sheet__submit[aria-busy="true"] .checkout-sheet__spinner {
  animation:
    spinner-in 220ms var(--ease-enter),
    checkout-spin 0.75s linear infinite;
}

@keyframes spinner-in {
  from { opacity: 0; scale: 0.4; }
}

/* ----------------------------------------------------------------- Purchase result */

.checkout-sheet__result:not(.is-settled) .checkout-sheet__result-icon {
  animation: result-pop 520ms var(--ease-enter) backwards;
}

@keyframes result-pop {
  0% { opacity: 0; scale: 0.5; }
  60% { opacity: 1; scale: 1.06; }
  100% { scale: 1; }
}

/* Paid: the check is drawn after the circle lands */
.checkout-sheet__result:not(.is-settled)[data-status="success"] .checkout-sheet__result-icon path {
  stroke-dasharray: 22;
  animation: check-draw 420ms var(--ease-enter) 260ms backwards;
}

@keyframes check-draw {
  from { stroke-dashoffset: 22; }
}

/* ------------------------------------------------------------------------ Accordion */
/* Height is the one layout animation kept: the list must make room. The answer itself
   moves with opacity/translate. */

.faq__panel.is-open > * {
  animation: motion-rise-small 360ms var(--ease-enter) 60ms backwards;
}

/* ------------------------------------------------------------------- Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .motion-ok [data-reveal],
  .motion-ok [data-reveal] > *,
  .wormy-nav__menu *,
  .checkout-sheet,
  .checkout-sheet *,
  .checkout-sheet::backdrop,
  .tariffs__grid *,
  .faq__panel > * {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  /* loading stays legible as loading: the spinner keeps turning */
  .checkout-sheet__submit[aria-busy="true"] .checkout-sheet__spinner,
  .checkout-sheet__spinner.is-large {
    animation: checkout-spin 1.2s linear infinite !important;
  }

  .wormy-nav__links a::after,
  .story-support__handle {
    transition: none;
  }
}

/* ===================================================================== Mobile pass (M10)
   Checked at 320 / 375 / 390 / 430 / 768 / 1024 and phone landscape (667×375, 844×390,
   932×430). Phones and tablets get their own compositions where the desktop one only
   shrank; touch targets are ≥44px; status labels never drop below 11px. */

/* ------------------------------------------------------------------- Touch targets */

.wormy-brand {
  min-height: 2.75rem;
}

.wormy-skip {
  min-height: 2.75rem;
}

@media (max-width: 56rem), (pointer: coarse) {
  .wormy-nav__cta {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
  }

  /* a flex item drops its leading space: «Попробовать Wormy», not «ПопробоватьWormy» */
  .wormy-nav__cta-extra {
    margin-left: 0.27em;
  }
}

/* Desktop bar links: a 44px tall hit area around 16px of text, layout unchanged */
@media (min-width: 56.0625rem) {
  .wormy-nav__links a,
  .wormy-nav__actions .wormy-nav__login {
    padding-block: 0.875rem;
    margin-block: -0.875rem;
  }

  .wormy-nav__links a::after {
    bottom: 0.525rem;
  }
}

/* Fingers, not cursors: desktop with a mouse keeps its denser rhythm */
@media (max-width: 64rem), (pointer: coarse) {
  .story-flow__steps a {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    min-height: 2.75rem;
  }

  .wormy-footer li > a,
  .wormy-footer__pending {
    padding-block: 0.75rem;
  }

  .wormy-footer .wormy-footer__wordmark {
    padding-block: 0.6rem;
    margin-block: -0.6rem;
  }
}

/* Mobile sheet menu stays reachable when a landscape phone is shorter than the list */
@media (max-width: 56rem) {
  .wormy-nav__menu {
    max-height: calc(100dvh - var(--nav-h));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* ------------------------------------------------------------ Legible status labels */

@media (max-width: 48rem), (pointer: coarse) {
  .story-tag,
  .tariff__badge {
    font-size: 0.6875rem;
  }
}

/* ------------------------------------------------------ Hero · phone landscape */
/* A stacked hero on a 390px-tall screen showed only the headline. Landscape phones get
   the desktop reading order instead — copy beside the demo — with the compact demo. */

@media (max-width: 56rem) and (orientation: landscape) and (max-height: 31.25rem) {
  .wormy-hero {
    --focus-x: 74%;
    --focus-y: 50%;
    min-height: calc(100svh - var(--nav-h));
    padding-block: var(--space-4) var(--space-8);
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    grid-template-areas:
      "kicker product"
      "title product"
      "lead product"
      "actions product"
      "note product";
    grid-template-rows: auto auto auto auto 1fr;
    align-content: center;
    column-gap: clamp(1.25rem, 4vw, 2.5rem);
  }

  .wormy-hero .wormy-kicker { margin-bottom: var(--space-3); font-size: 0.66rem; }
  .wormy-hero h1 { font-size: min(6.6vw, 13svh); }
  .wormy-hero__lead { margin-top: var(--space-3); font-size: 0.92rem; }
  .wormy-hero__lead span { display: inline; }
  .wormy-hero__actions { margin-top: var(--space-4); gap: 0; }
  .wormy-hero__actions .wormy-button { min-height: 2.75rem; padding-block: 0.6rem; }
  .wormy-hero__actions .wormy-button--text { padding-inline: 0.8rem; }
  .wormy-hero__note { margin-top: var(--space-2); font-size: 0.76rem; }
  .wormy-hero__product { align-self: center; margin-top: 0; }
  .wormy-hero__stage { max-width: none; }
  .wormy-hero__stage::after { bottom: -1.4rem; }
  .wormy-hero__hint { padding-top: var(--space-3); font-size: 0.72rem; }

  /* compact instrument, as on portrait phones */
  .wormy-device {
    --device-pad: 0.85rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title chip" "note note" "bay bay" "readout readout";
    align-items: center;
    border-radius: 1.6rem;
  }

  .wormy-device__header { display: contents; }
  .wormy-device__brand { display: none; }
  .wormy-device__chip { grid-area: chip; align-self: start; height: 1.7rem; margin: 0.15rem 0.1rem 0 0; }
  .wormy-device__status { display: contents; }
  .wormy-device__status strong { grid-area: title; margin: 0.3rem 0 0 0.3rem; font-size: 1.2rem; }
  .wormy-device__status small { grid-area: note; margin: 0.35rem 0 0 0.3rem; overflow: hidden; font-size: 0.74rem; text-overflow: ellipsis; white-space: nowrap; }
  .wormy-device__bay { grid-area: bay; margin-top: 0.6rem; padding: 2rem 0.7rem 0.6rem; border-radius: 1.1rem; }
  .burrow { --track-h: 4.2rem; --hole-w: 3.6rem; --hole-h: 1.1rem; --inset: 2.35rem; --worm-w: 3.7rem; }
  .burrow__legend { margin-top: 0.5rem; font-size: 0.6rem; }
  .wormy-device__readout { grid-area: readout; grid-template-columns: 1fr 1fr; margin-top: 0.6rem; padding: 0.6rem 0.3rem 0.05rem; }
  .wormy-device__readout div:first-child { display: none; }
  .wormy-device__readout dd { font-size: 0.82rem; }
}

/* ------------------------------------------------------ How it works · tablet */
/* 768px stacked a phone above three steps into one long column; there is room for the
   desktop pairing, so the phone stays beside the steps down to 40rem. */

@media (min-width: 40.0625rem) and (max-width: 48rem) {
  .story-flow__visual { grid-column: 1 / span 5; }
  .story-flow__steps { grid-column: 6 / -1; }
  .flow-phone { width: 100%; }
  .story-flow__trigger { font-size: 1.75rem; }
}

/* ------------------------------------------------------------------ Bento · phones */
/* On desktop «Быстрый» and «На твоих устройствах» are open instruments beside cards.
   Stacked, that read as a broken rhythm (a card, a floating diagram, a hairline with a
   rounded corner, a card). Phones get four cards. */

@media (max-width: 48rem) {
  .story-feature--fast {
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }

  .story-feature--fast {
    background: linear-gradient(180deg, #17181b, #111214);
  }

  /* the diagram fills the card instead of floating small in open space */
  .story-feature--fast .story-route {
    width: calc(100% + 2rem);
    margin: calc(var(--space-2) * -1) -1rem 0;
  }

  /* the SVG renders at ~half scale here: keep its labels readable */
  .story-route text {
    font-size: 22px;
  }
}

/* --------------------------------------------------------------- Pricing · tablet */
/* Three columns at 641–1023px squeezed «12 месяцев» onto two lines beside its badge.
   Tablets lead with the best value as a wide card, the other terms side by side. */

@media (min-width: 40.0625rem) and (max-width: 63.9375rem) {
  .tariffs__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .tariff,
  .tariff.is-featured {
    min-height: 0;
  }

  .tariff .tariff__price {
    padding-top: var(--space-8);
  }

  .tariff.is-featured {
    order: -1;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "head head"
      "price cta"
      "meta cta";
    column-gap: var(--space-8);
    align-items: end;
  }

  .tariff.is-featured .tariff__head { grid-area: head; }
  .tariff.is-featured .tariff__price { grid-area: price; margin: 0; padding-top: var(--space-6); font-size: clamp(2.6rem, 6vw, 3.4rem); }
  .tariff.is-featured .tariff__meta { grid-area: meta; flex-direction: row; flex-wrap: wrap; gap: 0 var(--space-4); min-height: 0; margin: var(--space-3) 0 0; }
  .tariff.is-featured .tariff__cta { grid-area: cta; width: auto; min-width: 12rem; }
}

/* ---------------------------------------------------- Checkout · short landscape */
/* On a 375–430px-tall screen the sheet's header and footer ate half the height. It
   becomes a full-height side drawer with tighter chrome; the form keeps scrolling. */

@media (orientation: landscape) and (max-height: 31.25rem) {
  .checkout-sheet__panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(28rem, 62%);
    max-height: none;
    border-width: 0 0 0 1px;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    animation-name: checkout-drawer-in;
  }

  .checkout-sheet__panel::before { display: none; }
  .checkout-sheet__head { padding: 0.35rem 0.5rem 0.35rem 1.25rem; }
  .checkout-sheet__title { font-size: 1.05rem; }
  .checkout-sheet__body { gap: var(--space-4); padding: var(--space-4) 1.25rem; }
  .checkout-sheet__plan { min-height: 4rem; padding-block: 0.5rem; }
  .checkout-sheet__foot { padding: 0.6rem 1.25rem calc(0.6rem + env(safe-area-inset-bottom, 0px)); }
  .checkout-sheet__submit { min-height: 3rem; }
  .checkout-sheet__note { margin-top: 0.4rem; font-size: 0.72rem; }
  .checkout-sheet__result { min-height: 0; padding-block: var(--space-6); }
  .checkout-sheet.is-closing .checkout-sheet__panel { animation-name: checkout-drawer-out; }
}
