/* Phones only: loaded with media="(max-width: 767px)", so tablets and desktops never read it.

   css/story.css gives phones the plain page: every chapter a finished section, picture card on
   top. This file makes that page feel alive without changing what it says:
   - the picture cards are sized properly in Safari and get a soft frame,
   - js/story-mobile.js adds html.st-mfx and reveals pieces as they scroll in (data-mr="…"),
     and drives a gentle parallax through --py (cards) and --hy (hero).
   With no JavaScript or with reduced motion, html.st-mfx is never set and nothing here hides
   anything: the page is the finished page. */

/* ── Picture cards ─────────────────────────────────────────────────────── */
/* Safari does not resolve height: 100% inside a box sized only by aspect-ratio, so the picture
   stopped short and left a blank band under it. Pinning it to the card's edges fixes that. */
html:not(.st-pinned) :is(.st-ch:not(.st-ch--hero), .st-origin) > .st-still {
  aspect-ratio: 4 / 3; margin: 0 16px 28px; border-radius: 26px;
  box-shadow: 0 1px 2px rgba(25, 20, 12, .06), 0 24px 48px -20px rgba(60, 36, 14, .38);
  transform: translateZ(0);   /* keeps the rounded clip on the moving picture in iOS Safari */
}
[data-theme="dark"] :is(.st-ch:not(.st-ch--hero), .st-origin) > .st-still { box-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 24px 48px -20px rgba(0, 0, 0, .8); }
html:not(.st-pinned) :is(.st-ch:not(.st-ch--hero), .st-origin) > .st-still img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 55%;
}
/* A hairline and a little warmth at the foot, so the card reads as a print, not a cut-out. */
html:not(.st-pinned) :is(.st-ch:not(.st-ch--hero), .st-origin) > .st-still::after {
  display: block; z-index: 1; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
  background: linear-gradient(180deg, transparent 62%, rgba(20, 12, 6, .16));
}
[data-theme="dark"]:not(.st-pinned) :is(.st-ch:not(.st-ch--hero), .st-origin) > .st-still::after {
  inset: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .3));
}

/* Chapters breathe a little more, and the headings sit tighter to their copy. */
html:not(.st-pinned) .st-ch:not(.st-ch--hero):not(.rx-match) { padding: 36px 0 52px; }
html:not(.st-pinned) .st-ch:not(.st-ch--hero):not(.rx-match) .st-pin { gap: 28px; }
html:not(.st-pinned) .st-ch:not(.st-ch--hero) .st-num { margin-bottom: 14px; }
html:not(.st-pinned) .st-ch:not(.st-ch--hero) h2 { font-size: clamp(1.875rem, 8.4vw, 2.375rem); line-height: 1.06; }
/* On a plain page the words sit on the page colour, not over a picture: no halo needed. */
html:not(.st-pinned) .st-ch:not(.st-ch--hero) :is(.st-copy, .st-end) :is(h2, .st-num, .st-text, .st-lead, .st-small, .st-pains, .st-ticks) { text-shadow: none; }

/* "Why choose Roomrr": four short reasons read best one per row on a phone. */
body.st-home .st-after .hm-why__list,
[data-theme="dark"] body.st-home .st-after .hm-why__list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
[data-theme="dark"] body.st-home .st-after .hm-why__list li,
[data-theme="dark"] body.st-home .st-after .hm-why__list li:first-child { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
[data-theme="dark"] body.st-home .st-after .hm-why__list li + li { border-left: 0; border-top: 1px solid var(--st-line); }

/* Back to top: smaller, clear of the home indicator, and out of the way while reading down. */
.back-to-top { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); width: 46px; height: 46px; }
.back-to-top.st-btt-away { opacity: 0; visibility: hidden; transform: translateY(14px) scale(.85); }

/* ── Motion (only with html.st-mfx) ────────────────────────────────────── */
/* Pieces that slide in from the side must never widen the page: iOS lets you pan to them even
   though <body> clips. clip, unlike hidden, keeps the chapters from becoming scroll containers. */
html.st-mfx:not(.st-pinned) .st-ch:not(.st-ch--hero):not(.rx-match) .st-pin,
html.st-mfx:not(.st-pinned) .st-origin { overflow-x: clip; }
html.st-mfx [data-mr] {
  transition:
    opacity .7s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms),
    translate .95s cubic-bezier(.16, 1, .3, 1) var(--d, 0ms),
    scale .95s cubic-bezier(.16, 1, .3, 1) var(--d, 0ms),
    filter .8s ease var(--d, 0ms),
    clip-path 1.1s cubic-bezier(.16, 1, .3, 1) var(--d, 0ms);
}
html.st-mfx [data-mr]:not(.is-in) { opacity: 0; }
html.st-mfx [data-mr="up"]:not(.is-in) { translate: 0 34px; }
html.st-mfx [data-mr="left"]:not(.is-in) { translate: -32px 0; }
html.st-mfx [data-mr="right"]:not(.is-in) { translate: 32px 0; }
html.st-mfx [data-mr="pop"]:not(.is-in) { translate: 0 22px; scale: .9; }
html.st-mfx [data-mr="blur"]:not(.is-in) { translate: 0 24px; filter: blur(8px); }
/* The picture card opens from a smaller window as it arrives. */
html.st-mfx [data-mr="card"] { opacity: 1; }
html.st-mfx [data-mr="card"]:not(.is-in) { opacity: 1; clip-path: inset(9% 7% 9% 7% round 26px); translate: 0 28px; }
html.st-mfx [data-mr="card"].is-in { clip-path: inset(0 0 0 0 round 26px); }

/* Parallax: the picture drifts inside its card as the card crosses the screen. */
html.st-mfx :is(.st-ch:not(.st-ch--hero), .st-origin) > .st-still img {
  scale: 1.16; translate: 0 calc(var(--py, 0) * 7%);
  transition: scale 1.4s cubic-bezier(.16, 1, .3, 1);
  will-change: translate;
}
html.st-mfx :is(.st-ch:not(.st-ch--hero), .st-origin) > .st-still:not(.is-in) img { scale: 1.3; }

/* ── Hero: arrives in steps, then the picture sinks slower than the page ── */
@keyframes st-m-rise { from { opacity: 0; translate: 0 26px; filter: blur(6px); } to { opacity: 1; translate: 0 0; filter: blur(0); } }
@keyframes st-m-zoom { from { scale: 1.14; } to { scale: 1.04; } }
html.st-mfx .st-ch--hero :is(.st-kicker, .rx-kicker, .st-display, .rx-line, .st-lead, .hm-search, .rx-visual, .st-cta) { animation: st-m-rise .9s cubic-bezier(.16, 1, .3, 1) both; }
html.st-mfx .st-ch--hero :is(.st-kicker, .rx-kicker) { animation-delay: .05s; }
html.st-mfx .st-ch--hero :is(.st-display, .rx-kicker + .rx-line) { animation-delay: .15s; }
html.st-mfx .st-ch--hero .rx-line + .rx-line { animation-delay: .27s; }
html.st-mfx .st-ch--hero .st-lead { animation-delay: .34s; }
html.st-mfx .st-ch--hero :is(.hm-search, .rx-visual, .st-cta) { animation-delay: .48s; }
html.st-mfx .st-ch--hero > .st-still { overflow: hidden; }
html.st-mfx .st-ch--hero > .st-still img {
  animation: st-m-zoom 2.4s cubic-bezier(.16, 1, .3, 1) both;
  translate: 0 calc(var(--hy, 0) * 26%);
  will-change: translate;
}
/* The words lift away a little faster than the page as you leave the hero. */
html.st-mfx .st-ch--hero .st-hero__copy { translate: 0 calc(var(--hy, 0) * -48px); opacity: calc(1 - var(--hy, 0) * 1.1); }

/* A gentle breathing glow on the main buttons once they are in. */
@keyframes st-m-glow { 0%, 100% { box-shadow: 0 10px 24px -12px rgba(232, 75, 25, .55); } 50% { box-shadow: 0 14px 34px -10px rgba(252, 155, 4, .75); } }
html.st-mfx .is-in :is(.st-btn:not(.st-btn--line), .hm-go),
html.st-mfx .st-ch--hero .hm-go { animation: st-m-glow 3.2s ease-in-out 1.2s infinite; }
/* Press feedback, since phones have no hover. */
html.st-mfx :is(.st-btn, .hm-btn, .hm-go, .hm-tab, .place__link, .rr-store, .social-link):active { scale: .97; transition: scale .12s ease; }
