/* REVRST motion layer.
 *
 * The reference site ships zero @keyframes — every declarative effect is a
 * transition reading from a :root palette of Penner curves, and everything
 * scroll-linked is driven imperatively. This file keeps that structure: the
 * palette below is the reference set verbatim, and rv-motion.js does the rest.
 */

:root {
  --ease-in-sine: cubic-bezier(.47, 0, .745, .715);
  --ease-out-sine: cubic-bezier(.39, .575, .565, 1);
  --ease-in-out-sine: cubic-bezier(.445, .05, .55, .95);
  --ease-in-quad: cubic-bezier(.55, .085, .68, .53);
  --ease-out-quad: cubic-bezier(.25, .46, .45, .94);
  --ease-in-out-quad: cubic-bezier(.455, .03, .515, .955);
  --ease-in-cubic: cubic-bezier(.55, .055, .675, .19);
  --ease-out-cubic: cubic-bezier(.215, .61, .355, 1);
  --ease-in-out-cubic: cubic-bezier(.645, .045, .355, 1);
  --ease-in-quart: cubic-bezier(.895, .03, .685, .22);
  --ease-out-quart: cubic-bezier(.165, .84, .44, 1);
  --ease-in-out-quart: cubic-bezier(.77, 0, .175, 1);
  --ease-in-quint: cubic-bezier(.755, .05, .855, .06);
  --ease-out-quint: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out-quint: cubic-bezier(.86, 0, .07, 1);
  --ease-in-expo: cubic-bezier(.95, .05, .795, .035);
  --ease-out-expo: cubic-bezier(.19, 1, .22, 1);
  --ease-in-out-expo: cubic-bezier(1, 0, 0, 1);
  --ease-in-circ: cubic-bezier(.6, .04, .98, .335);
  --ease-out-circ: cubic-bezier(.075, .82, .165, 1);
  --ease-in-out-circ: cubic-bezier(.785, .135, .15, .86);
  --ease-in-back: cubic-bezier(.6, -.28, .735, .045);
  --ease-out-back: cubic-bezier(.175, .885, .32, 1.275);
  --ease-in-out-back: cubic-bezier(.68, -.55, .265, 1.55);

  /* The reference site's durations, as tokens. */
  --dur-instant: .15s;
  --dur-fast: .2s;
  --dur-chrome: .25s;
  --dur-base: .3s;
  --dur-mech: .5s;   /* every button mechanic */
  --dur-slow: .8s;
  --dur-bloom: 1.2s;
}

/* ------------------------------------------------------------ smooth scroll */

/* Root-mode smoothing writes the real scroll position, so the document keeps its
   natural height and nothing is transformed. The only thing to suppress is the
   browser's own smooth-scroll, which would fight the damping. */
html.rv-smooth {
  scroll-behavior: auto;
}

.rv-pin-spacer {
  pointer-events: none;
}

/* ---------------------------------------------------------------- split text */

.rv-word {
  display: inline-block;
  white-space: pre;
}

.rv-letter {
  display: inline-block;
  will-change: opacity;
}

/* Before the reveal runs the letters are hidden, but only when motion is on and
   scripting reached them — otherwise the headline must simply be readable. */
[data-motion="on"] .rv-split-pending .rv-letter {
  opacity: 0;
}

/* ------------------------------------------------------------------ reveals */

[data-rv-reveal] {
  opacity: 0;
  transform: translate3d(0, 38px, 0);
}

[data-rv-reveal].is-revealed {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur-slow) var(--ease-out-quart) var(--rv-delay, 0ms),
    transform var(--dur-slow) var(--ease-out-quart) var(--rv-delay, 0ms);
}

/* --------------------------------------------------- the button mechanic */

/* The reference site's signature interaction: the label and the icon each roll
   vertically inside their own clipped box, the icon trailing the label by 70ms. */

.rv-roll {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: .6em;
}

.rv-roll > .content,
.rv-roll > .icon {
  display: block;
  overflow: hidden;
}

.rv-roll > .content > *,
.rv-roll > .icon > * {
  display: block;
  transition: transform var(--dur-mech) var(--ease-in-out-circ);
}

.rv-roll > .icon > * {
  transition-delay: .07s;
}

@media (hover: hover) and (pointer: fine) {
  [data-motion="on"] .rv-roll:hover > .content > *,
  [data-motion="on"] .rv-roll:hover > .icon > *,
  [data-motion="on"] :is(a:hover, button:hover) .rv-roll.allow-parent-hover > .content > *,
  [data-motion="on"] :is(a:hover, button:hover) .rv-roll.allow-parent-hover > .icon > * {
    transform: translateY(-100%);
  }
}

/* Underline draw on nav and footer links. */
.rv-underline {
  position: relative;
}

.rv-underline::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-fast) var(--ease-in-out-quad);
}

@media (hover: hover) and (pointer: fine) {
  [data-motion="on"] .rv-underline:hover::after { transform: scaleX(1); }
}

/* Ken Burns on media cards. */
.rv-zoom { overflow: hidden; }

.rv-zoom > img,
.rv-zoom > picture,
.rv-zoom > svg {
  transition: transform var(--dur-slow) var(--ease-out-quad);
}

@media (hover: hover) and (pointer: fine) {
  [data-motion="on"] .rv-zoom:hover > img,
  [data-motion="on"] .rv-zoom:hover > picture,
  [data-motion="on"] .rv-zoom:hover > svg { transform: scale(1.08); }
}

/* ------------------------------------------------------- paused and reduced */

/* Both states must resolve to a complete, readable, fully navigable page. */

[data-motion="paused"] .rv-letter,
[data-motion="reduced"] .rv-letter {
  opacity: 1 !important;
}

[data-motion="paused"] [data-rv-reveal],
[data-motion="reduced"] [data-rv-reveal] {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

[data-motion="paused"] .rv-roll > .content > *,
[data-motion="paused"] .rv-roll > .icon > *,
[data-motion="reduced"] .rv-roll > .content > *,
[data-motion="reduced"] .rv-roll > .icon > * {
  transition: none !important;
  transform: none !important;
}

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

  .rv-letter { opacity: 1 !important; }

  [data-rv-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .rv-roll > .content > *,
  .rv-roll > .icon > *,
  .rv-underline::after,
  .rv-zoom > img,
  .rv-zoom > picture,
  .rv-zoom > svg {
    transition: none !important;
    transform: none !important;
  }
}
