/* scroll-motion.css: the page's scroll layer ("rich but calm"), driven by js/scroll-motion.js.
   Everything here hides only under html.sm-js, which the head line adds (not under reduced motion) and takes
   away again after 3 s if the script never arrives: without script, under reduced motion and on a failed load
   the page stands as written. Only transform, translate, scale, opacity and clip-path move. */
:root { --sm-ease: cubic-bezier(.22, 1, .36, 1); }

/* ---- text: each line rises out of its own mask (the words of one line share a delay) */
html.sm-js .sm-lines:not(.sm-in) { opacity: 0; }
.sm-w { display: inline-block; overflow: clip; vertical-align: top; padding-bottom: .14em; margin-bottom: -.14em; }
.sm-w__in { display: inline-block; }

/* ---- blocks (a services row, a link, the form): support, so a shorter rise than the headings' full line */
html.sm-js .sm-rise { transition: opacity 700ms var(--sm-ease) var(--sm-delay, 0ms), translate 700ms var(--sm-ease) var(--sm-delay, 0ms); }
html.sm-js .sm-rise:not(.sm-in) { opacity: 0; translate: 0 16px; }
html.sm-js .sm-rise.sm-done { transition: none; }

/* ---- frames: the photograph opens upward from a mask while it settles from 1.08 to its rest.
   `scale` and `translate` are their own properties, so the hover zoom (transform) still composes on top.
   The settle outlasts the mask (the picture keeps breathing a moment after it is open); the script ends the
   reveal on the settle's own transitionend, so nothing snaps */
.sm-mask > img { scale: var(--sm-base, 1); }
html.sm-js .sm-mask:not(.sm-in) { clip-path: inset(100% 0 0 0); }
html.sm-js .sm-mask:not(.sm-in) > img { scale: calc(var(--sm-base, 1) * 1.08); }
html.sm-js .sm-mask.sm-in:not(.sm-done) { clip-path: inset(0); transition: clip-path 1000ms var(--sm-ease) var(--sm-delay, 0ms); }
html.sm-js .sm-mask.sm-in:not(.sm-done) > img { transition: scale 1400ms var(--sm-ease) var(--sm-delay, 0ms); }

/* ---- parallax: a large photograph drifts +-5% inside its frame; it stands at 1.12 so no edge ever shows */
.sm-par { --sm-base: 1.12; }

/* ---- the ground: a fixed layer in the beige surface fades in while a [data-sm-ground="surface"] section holds
   the middle of the screen. Without the script (or under reduced motion) those sections are simply beige. */
[data-sm-ground="surface"] { background-color: var(--p-surface); }
html.sm-js [data-sm-ground="surface"] { background-color: transparent; }
html.sm-js body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--p-surface); opacity: 0; transition: opacity 900ms cubic-bezier(.4, 0, .2, 1);
}
html.sm-js.sm-ground-surface body::before { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  html.sm-js :is(.sm-lines, .sm-rise, .sm-mask) { opacity: 1 !important; translate: none !important; clip-path: none !important; transition: none !important; }
  html.sm-js .sm-mask > img { scale: 1 !important; transition: none !important; }
  html.sm-js [data-sm-ground="surface"] { background-color: var(--p-surface); }
  html.sm-js body::before { display: none; }
}
@media print {
  html.sm-js :is(.sm-lines, .sm-rise, .sm-mask) { opacity: 1 !important; translate: none !important; clip-path: none !important; }
  html.sm-js .sm-mask > img, .sm-par > img { scale: 1 !important; translate: none !important; }
  /* a fixed layer repeats on every printed sheet: no beige wash on paper, the sections keep their own ground */
  html.sm-js body::before { display: none; }
  html.sm-js [data-sm-ground="surface"] { background-color: var(--p-surface); }
}

/* ---- touch: no grey flash over a tapped link, row or photograph (the kit's buttons press by scale); what has no
   press of its own dims while the finger is down, so a tap still answers at once */
html { -webkit-tap-highlight-color: transparent; }
@media (hover: none) {
  :is(a, [role="button"], li[tabindex]):not(.btn):active { opacity: .72; }
}
