/*
 * Happigrow landing. Colours come only from the app palette: the build writes --<token> (light and dark) into
 * index.html from src/ui/theme.ts. No colour literal lives in this file.
 *
 * Light or dark is decided in one place: data-theme on <html> ("light" or "dark", the visitor's choice in the
 * menu at the top) or, without it, the system. Everything that differs between the two is a variable set below.
 *
 * Layout: one column on a phone, two on a computer (text | screen). A thin growth ruler runs down the left edge of
 * the stops, and each stop's title carries one longer mark on it, like the pencil marks on a door frame.
 */

@font-face { font-family: "Nunito"; src: url("fonts/nunito-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("fonts/figtree-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("fonts/figtree-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  color-scheme: light dark;
  --font-title: "Nunito", ui-rounded, "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-text: "Figtree", "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --gutter: 1rem;
  --inset: 1.5rem;
  --radius: 1.5rem;
  --radius-small: 1.25rem;
  --shot: min(16.5rem, 64vw);
  --device: var(--ink);
  --shadow-soft: 0 1.25rem 2.5rem -1.75rem color-mix(in srgb, var(--ink) 28%, transparent);
  --shadow-device: 0 2.5rem 3.5rem -2rem color-mix(in srgb, var(--ink) 38%, transparent);
  /* A small light shape lifts off the page by its shadow; on the dark page, by a thin line (as in the app). */
  --shadow-chip: 0 0.375rem 1rem -0.5rem color-mix(in srgb, var(--ink) 34%, transparent);
  --chip-line: transparent;
  /* The animated phone: the glare on its screen, its shadow, and the light its thickness catches (on the dark
     device of the light page it is a touch of stone). */
  --glare: var(--on-forest);
  --phone-shade: var(--ink);
  --phone-edge: var(--stone);
  /* A thing with a light and a dark version (the logo, the icon of the appearance menu) shows the one in use. */
  --on-light: block;
  --on-dark: none;
}

/* Dark. Twice, with the same declarations (a test compares them): when the system asks for it and the visitor has
   not chosen light, and when the visitor chose dark. No other rule in this file asks the system. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --device: var(--stone);
    --shadow-soft: none;
    --shadow-device: 0 2.5rem 3.5rem -2rem color-mix(in srgb, var(--on-forest) 90%, transparent);
    --shadow-chip: none;
    --chip-line: var(--line);
    --glare: var(--ink);
    --phone-shade: var(--on-forest);
    --phone-edge: var(--on-forest);
    --on-light: none;
    --on-dark: block;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --device: var(--stone);
  --shadow-soft: none;
  --shadow-device: 0 2.5rem 3.5rem -2rem color-mix(in srgb, var(--on-forest) 90%, transparent);
  --shadow-chip: none;
  --chip-line: var(--line);
  --glare: var(--ink);
  --phone-shade: var(--on-forest);
  --phone-edge: var(--on-forest);
  --on-light: none;
  --on-dark: block;
}
:root[data-theme="light"] { color-scheme: light; }

.on-light { display: var(--on-light); }
.on-dark { display: var(--on-dark); }

*, *::before, *::after { box-sizing: border-box; }

/* The plain page colour first: a browser without color-mix() drops the whole body background below. */
html { background: var(--cream); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* The soft round shape in the top corner of the app's screens, at page size. A background never widens the page. */
body {
  margin: 0;
  background:
    radial-gradient(circle 17rem at calc(100% + 3rem) -2rem, color-mix(in srgb, var(--sage-tint) 70%, transparent) 99.5%, transparent 100%) no-repeat,
    var(--cream);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font-text);
}

img, svg { display: block; max-width: 100%; }

a { color: var(--forest); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--forest); outline-offset: 3px; border-radius: 0.375rem; }

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
}
.skip:focus { top: var(--gutter); }
/* The skip link's target is a whole stop: it takes the focus (tabindex -1) without drawing a ring around it. */
.stop[tabindex="-1"]:focus { outline: none; }

.page { position: relative; max-width: 72rem; margin: 0 auto; padding: 0 var(--gutter); }

/* Said to a screen reader, not shown. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- The page's own choices ----------
 * Small menus in the top corner, over the round shape, like the round button of the app's screens. Each one is a
 * <details>: it opens without JavaScript, and its options are one per line.
 */

.prefs {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.75rem;
}

.menu { position: relative; }

.menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  padding: 0 0.875rem;
  border: 1px solid var(--chip-line);
  border-radius: 1.375rem;
  background: var(--card);
  box-shadow: var(--shadow-chip);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  list-style: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:focus-visible { border-radius: 1.375rem; }

.menu-icon, .menu-caret, .menu-check {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.menu-icon { width: 1.25rem; height: 1.25rem; color: var(--forest); }
.menu-caret { width: 1rem; height: 1rem; color: var(--ink-soft); transition: transform 0.2s ease; }
.menu[open] .menu-caret { transform: rotate(180deg); }

.menu-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 12.5rem;
  margin: 0;
  padding: 0.375rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--card);
  box-shadow: var(--shadow-soft);
}
.menu[open] .menu-panel { animation: menu-in 0.16s ease-out; }
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-0.25rem); }
}
.menu-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.125rem; }

/* One option per line, the whole line is the target; the one in use is heavier and carries the check. */
.menu-row, .menu-panel a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.75rem;
  padding: 0 0.875rem;
  border-radius: 0.875rem;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.menu-row:hover, .menu-panel a:hover { background: var(--sage-tint); }
.menu-panel a:focus-visible { outline-offset: -3px; border-radius: 0.875rem; }
.menu-check { width: 1.125rem; height: 1.125rem; color: var(--forest); visibility: hidden; }
.menu-panel [aria-current="page"] { font-weight: 600; }
.menu-panel [aria-current="page"] .menu-check { visibility: visible; }

/* Appearance: Automático, Claro, Escuro, as in the app. Only prefs.js can run it, so it shows only when the page's
   script says JavaScript is there (.has-prefs): never a dead control. Its button is round, with the sun or the moon
   of the theme in use. The choices are three radios: the browser gives them the arrow keys. */
.menu-theme { display: none; }
.has-prefs .menu-theme { display: block; }
.menu-theme > summary { justify-content: center; width: 2.75rem; padding: 0; }
fieldset.menu-panel { display: grid; gap: 0.125rem; min-width: 12.5rem; }
.menu-panel label { display: block; }
.menu-panel input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.menu-panel input:checked + .menu-row { font-weight: 600; }
.menu-panel input:checked + .menu-row .menu-check { visibility: visible; }
.menu-panel input:focus-visible + .menu-row { outline: 3px solid var(--forest); outline-offset: -3px; }

h1, h2, h3 { font-family: var(--font-title); font-weight: 700; color: var(--ink); margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.375rem, 1.6rem + 3.4vw, 4.125rem); line-height: 1.06; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem); line-height: 1.12; letter-spacing: -0.01em; }
h3 { font-size: 1.375rem; line-height: 1.2; }
p { margin: 0; }

/* ---------- The tour and its ruler ---------- */

.tour { position: relative; padding-bottom: 2rem; }

.tour::before {
  content: "";
  position: absolute;
  top: 3rem;
  bottom: 0;
  left: 0;
  width: 0.5rem;
  background:
    linear-gradient(var(--line), var(--line)) left top / 1px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 1.5rem) left top / 0.375rem 100% no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, transparent, var(--cream) 6rem, var(--cream) calc(100% - 6rem), transparent);
  mask-image: linear-gradient(to bottom, transparent, var(--cream) 6rem, var(--cream) calc(100% - 6rem), transparent);
  pointer-events: none;
}

/* The phone's track. Without the phone it has no box at all. */
.phone-rail { display: contents; }
.phone-stage { display: none; }

.stop {
  display: grid;
  gap: 2.5rem;
  padding: 4rem 0 4rem var(--inset);
}

.stop-text { min-width: 0; }
.stop-text > p:not(.stores-soon) { max-width: 32rem; margin-top: 1rem; color: var(--ink-soft); }
.stop-text > h2 + p { margin-top: 1.25rem; }

/* The mark of each stop on the ruler. */
.stop-text h1, .stop-text h2 { position: relative; }
.stop-text h1::before, .stop-text h2::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--inset));
  top: 0.58em;
  width: calc(var(--inset) - 0.5rem);
  height: 2px;
  border-radius: 1px;
  background: var(--sage);
}

/* ---------- Opening ---------- */

.pinned > .stop:first-of-type { padding-top: 2.5rem; }
.logo img { width: clamp(9.5rem, 30vw, 12.5rem); height: auto; }
.logo { display: block; }
.logo + h1 { margin-top: 2.25rem; }
.lead { font-size: 1.1875rem; line-height: 1.55; }

.stores-soon {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  margin-top: 2rem;
  padding: 0.625rem 1.125rem;
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}
.stores-soon::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--sage);
}
.store-badge { display: inline-block; margin: 2rem 0.75rem 0 0; vertical-align: top; }
.store-badge img { height: 3rem; width: auto; display: block; }
.store-badge.is-soon { position: relative; }
.store-badge.is-soon img { opacity: 0.7; }
.soon-tag {
  position: absolute;
  top: -0.625rem;
  right: -0.5rem;
  padding: 0.125rem 0.5rem;
  border-radius: 1rem;
  background: var(--sage);
  color: var(--cream);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

/* ---------- Icons ---------- */

.plan li svg, .fact-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Screens without JavaScript ---------- */

.stop-shot { margin: 0; justify-self: center; width: var(--shot); }
.stop-shot picture {
  display: block;
  padding: 0.5rem;
  border-radius: 2.5rem;
  background: var(--device);
  box-shadow: var(--shadow-device);
}
.stop-shot img { width: 100%; height: auto; aspect-ratio: 1080 / 2400; border-radius: 2rem; }

/* The words of each capture, said once. Without JavaScript the capture's alt says them, so this copy stays out of
   the page; with the phone the captures are gone (display: none, so they are never fetched) and this copy, hidden
   only from the eye, says them. */
.shot-desc { display: none; }

/* One column: the stop is indented for the ruler, so the screen gives that indent back to sit in the page's middle. */
@media (max-width: 59.99em) {
  .stop-shot { margin-left: calc(-1 * var(--inset)); }
}

/* Light and dark side by side: the light one in front, the dark one leaning behind it. */
.stop-shot[data-pair] { display: grid; width: min(19rem, 78vw); padding-bottom: 2rem; }
.stop-shot[data-pair] picture { grid-area: 1 / 1; width: 74%; }
.stop-shot[data-pair] picture:first-child { z-index: 1; transform: rotate(-3deg); }
.stop-shot[data-pair] picture:last-child { justify-self: end; margin-top: 2rem; transform: rotate(4deg); }

/* ---------- Recap ----------
 * The recap is a story of up to seven slides, and its stop carries the story's own bar under the title: seven thin
 * segments, as at the top of the recap in the app. At rest (no JavaScript, reduced motion) the first one is full, as
 * on the cover the phone shows. When the stop comes into view (main.js takes .pending away, once) the segments fill
 * one after the other, like the story playing, and stay full.
 */
.story-bar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.3125rem;
  max-width: 15rem;
  margin-top: 1.25rem;
}
.story-bar span {
  height: 0.1875rem;
  border-radius: 0.125rem;
  overflow: hidden;
  background: color-mix(in srgb, var(--sage) 26%, transparent);
}
.story-bar span::after {
  content: "";
  display: block;
  height: 100%;
  background: var(--forest);
  transform: scaleX(0);
  transform-origin: left center;
}
.story-bar span:first-child::after { transform: none; }
.stop-text > .story-bar + p { margin-top: 1.25rem; }
.story-bar span:nth-child(2) { --n: 1; }
.story-bar span:nth-child(3) { --n: 2; }
.story-bar span:nth-child(4) { --n: 3; }
.story-bar span:nth-child(5) { --n: 4; }
.story-bar span:nth-child(6) { --n: 5; }
.story-bar span:nth-child(7) { --n: 6; }
@keyframes story-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.has-phone .stop:not(.pending) .story-bar span::after { animation: story-fill 0.7s linear both; animation-delay: calc(0.5s + var(--n, 0) * 0.7s); }

/* ---------- Plans ---------- */

.plans { display: grid; gap: 1rem; align-items: start; margin-top: 2rem; }
.plan {
  padding: 1.75rem 1.5rem 1.875rem;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line);
}
.plan-basic { background: var(--sage-tint); border-color: transparent; }
.plan h3 { margin: 0; }
.price { margin-top: 0.5rem; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.5rem; }
.price-main { font-family: var(--font-title); font-weight: 700; font-size: 1.375rem; color: var(--ink); }
.price-alt { color: var(--ink-soft); }
.price-sub { margin-top: 0.25rem; color: var(--ink-soft); font-size: 0.9375rem; }
.plan-intro { margin-top: 1.25rem; color: var(--ink); font-weight: 600; }
.plan ul { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.plan-intro + ul { margin-top: 0.75rem; }
.plan li { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr); gap: 0.625rem; color: var(--ink); line-height: 1.45; }
.plan li svg { width: 1.25rem; height: 1.25rem; margin-top: 0.08rem; color: var(--forest); }
.stop-text > .plans-note { margin-top: 1.5rem; font-size: 0.9375rem; }

/* ---------- Data ---------- */

.facts { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; gap: 1.25rem; max-width: 36rem; }
.facts li { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); gap: 1rem; align-items: start; color: var(--ink); }
.facts li > span:last-child { padding-top: 0.5rem; }
.fact-icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--sage-tint);
  color: var(--forest);
}
.fact-icon svg { width: 1.375rem; height: 1.375rem; }

/* ---------- Footer: the app's health signature ----------
 * The thin rule with the sprout in the middle and the sentence under it, as at the foot of the app's screens.
 * Under it, two short lists: the legal pages of this language, and who makes the app. On a narrow screen they are
 * one centred column; from 50em they stand side by side and meet on the sprout's axis, each turned towards it.
 */

.foot {
  padding: 2.5rem 0 3rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  text-align: center;
}
.signature-rule { display: flex; align-items: center; gap: 0.875rem; max-width: 26rem; margin: 0 auto; }
.signature-rule span { flex: 1; height: 1px; background: var(--line); }
.signature-rule svg { width: 1.375rem; height: auto; fill: var(--sage); flex: none; }
.signature p { margin-top: 0.875rem; color: var(--ink); text-wrap: balance; }

.foot-notes { display: grid; gap: 1.25rem; margin-top: 2rem; line-height: 1.75; }
.legal ul { list-style: none; margin: 0; padding: 0; }
.dev { overflow-wrap: anywhere; }

@media (min-width: 50em) {
  .foot-notes {
    position: relative;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 3rem;
    max-width: 46rem;
    margin-left: auto;
    margin-right: auto;
  }
  /* The axis: a short line where the two lists meet, under the sprout. */
  .foot-notes::before {
    content: "";
    position: absolute;
    top: 0.375rem;
    bottom: 0.375rem;
    left: 50%;
    width: 1px;
    background: var(--line);
  }
  .legal { text-align: right; }
  .dev { text-align: left; }
}

/* ---------- Computer: two columns ---------- */

@media (min-width: 40em) {
  :root { --gutter: 2rem; --inset: 2.5rem; }
}

@media (min-width: 60em) {
  :root { --inset: 4rem; --shot: 18.5rem; }
  /* The menus sit in the top corner of the page, above the phone's column, and take no room. */
  .prefs { position: absolute; top: 1.5rem; right: var(--gutter); padding-top: 0; }
  .tour::before { width: 0.75rem; background-size: 1px 100%, 0.5rem 100%; }
  .stop {
    grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
    column-gap: 4rem;
    align-items: center;
    min-height: 80vh;
    padding-top: 5rem;
    padding-bottom: 5rem;
  }
  .stop:not([data-screen]) { min-height: 0; }
  .stop:not([data-screen]) .stop-text { grid-column: 1 / -1; }
  .pinned > .stop:first-of-type { min-height: calc(100vh - 2rem); padding-top: 3rem; }
  /* Without the phone the first static capture is in the right column, under the menus: it starts below them. */
  html:not(.has-phone) .pinned > .stop:first-of-type { padding-top: 5.5rem; }
  .plans { max-width: 32rem; }
  .plan { padding: 2rem 2rem 2.25rem; }
  .stop-shot[data-pair] { width: 21rem; }
}

/* ---------- The animated phone ----------
 * Only when main.js has loaded Motion and built the phone does <html> get .has-phone. Without it the page keeps
 * the static captures above. The phone itself (main.js) is CSS 3D: a front with the screen, a back with the same
 * screen in the other theme, the thickness made of layers in translateZ and two side faces, a glare that slides
 * with the turn and a soft elliptic shadow. main.js writes only transform and opacity, once per frame.
 */

.has-phone body { overflow-x: clip; }
.has-phone .stop-shot { display: none; }
.has-phone .stop-text > .shot-desc {
  display: block;
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.has-phone .phone-stage {
  --phone-w: min(10.5rem, 19svh, 44vw);
  --phone-t: calc(var(--phone-w) * 0.052);
  --phone-r: calc(var(--phone-w) * 0.15);
  --phone-bezel: calc(var(--phone-w) * 0.034);
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  height: 48vh;
  height: 48svh;
  margin: 0 calc(-1 * var(--gutter));
  pointer-events: none;
}

/* On a phone the text slides under the pinned phone: a band of the page colour hides it there. It shows only once
   the page has moved (the round shape of the top corner stays visible at rest) and never while the phone is away. */
.has-phone .phone-stage::before {
  content: "";
  position: absolute;
  inset: 0 0 -2.5rem;
  background: linear-gradient(var(--cream) calc(100% - 2.5rem), transparent);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.has-phone .phone-stage.is-covering:not(.is-away)::before { opacity: 1; }

.phone-scene {
  position: relative;
  perspective: calc(var(--phone-w) * 4.6);
  will-change: opacity;
}

.phone {
  position: relative;
  display: grid;
  width: var(--phone-w);
  transform-style: preserve-3d;
  will-change: transform;
}

.phone > * { grid-area: 1 / 1; }

.phone-face {
  padding: var(--phone-bezel);
  border-radius: var(--phone-r);
  background: var(--device);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.phone-front { transform: translateZ(calc(var(--phone-t) / 2)); }
.phone-back { transform: translateZ(calc(var(--phone-t) / -2)) rotateY(180deg); }

.phone-layer {
  border-radius: var(--phone-r);
  background: color-mix(in srgb, var(--device) 82%, var(--phone-edge));
  transform: translateZ(calc(var(--phone-t) * (var(--k) / 4 - 0.5)));
}

.phone-side {
  align-self: center;
  width: var(--phone-t);
  height: calc(100% - 2 * var(--phone-r));
  background: linear-gradient(
    color-mix(in srgb, var(--device) 86%, var(--phone-edge)),
    color-mix(in srgb, var(--device) 64%, var(--phone-edge)) 45%,
    color-mix(in srgb, var(--device) 80%, var(--phone-edge))
  );
}
.phone-side-l { justify-self: start; transform: translateX(-50%) rotateY(90deg); }
.phone-side-r { justify-self: end; transform: translateX(50%) rotateY(90deg); }

.phone-screen {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1080 / 2400;
  border-radius: calc(var(--phone-r) - var(--phone-bezel));
  background: var(--cream);
  transform: translateZ(0);
}
.phone-screen img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}
.phone-screen img.is-on { opacity: 1; }

.phone-hole {
  position: absolute;
  top: 1.1%;
  left: 50%;
  width: calc(var(--phone-w) * 0.036);
  aspect-ratio: 1;
  border-radius: 50%;
  z-index: 4;
  background: var(--phone-shade);
  transform: translateX(-50%);
}

.phone-glare {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -100%;
  z-index: 3;
  width: 300%;
  background: linear-gradient(105deg, transparent 38%, color-mix(in srgb, var(--glare) 26%, transparent) 50%, transparent 62%);
  will-change: transform, opacity;
}

.phone-shadow {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--phone-w) * -0.16);
  height: calc(var(--phone-w) * 0.2);
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--phone-shade) 34%, transparent), transparent);
  will-change: transform, opacity;
}

/* The text of each stop below the fold comes in once, with a short slide (main.js adds .pending, never with
   reduced motion). */
.stop-text > * { transition: opacity 0.6s ease, transform 0.75s cubic-bezier(0.2, 0.7, 0.2, 1); transition-delay: calc(var(--i, 0) * 70ms); }
.has-phone .stop.pending .stop-text > * { opacity: 0; transform: translateY(0.75rem); transition: none; }

/* On a phone the stage is pinned inside .pinned, the stops before the closing one: a sticky box stops where its
   container ends, so the phone leaves with the last of them and the closing text and the footer are never under it. */
@media (max-width: 59.99em) {
  .has-phone .pinned > .stop[data-screen] { min-height: 60svh; }
  .has-phone .pinned > .stop:first-of-type { padding-top: 1.5rem; }
  /* A jump to a stop (the skip link) lands its title under the pinned phone, not behind it. */
  .has-phone .stop { scroll-margin-top: calc(48svh - 2.5rem); }
}

/* On a computer the rail is the right column, from under the menus to the end of the tour, and takes no room. The
   stage is pinned inside it, in the middle of the window, and stops where the rail ends: the phone leaves with the
   tour and never reaches the footer. The stage is only a little taller than the phone (its shadow fits), so it
   gives way late. */
@media (min-width: 60em) {
  .has-phone .phone-rail {
    display: block;
    position: absolute;
    top: 5.5rem;
    right: 0;
    bottom: 0;
    width: 24rem;
    pointer-events: none;
  }
  .has-phone .phone-stage {
    --phone-w: min(18.5rem, 34vh);
    --stage-h: calc(var(--phone-w) * 2.6);
    top: calc((100vh - var(--stage-h)) / 2);
    z-index: 0;
    height: var(--stage-h);
    margin: 0;
  }
  .has-phone .phone-stage::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stop-text > *, .has-phone .phone-stage::before, .menu-caret { transition: none; }
  .menu[open] .menu-panel { animation: none; }
  .has-phone .stop.pending .stop-text > * { opacity: 1; transform: none; }
  .has-phone .stop:not(.pending) .story-bar span::after { animation: none; }
}
