/* ═══════════════════════════════════════════════════════════════════════
   RMexpertise website · motion
   Pause button states (design doc §7.1) and, from Task 8, the scroll
   effects that run only under html.fx.
   ═══════════════════════════════════════════════════════════════════════ */

/* Static from the start: reduced motion, or paused on an earlier visit.
   animation: none shows every brand mark complete. */
html.motion-still .vstage, html.motion-still .vstage *, html.motion-still .vstage *::before, html.motion-still .vstage *::after { animation: none !important; }

/* Paused during this visit: freeze every loop where it is. */
html.motion-paused .vstage, html.motion-paused .vstage *, html.motion-paused .vstage *::before, html.motion-paused .vstage *::after { animation-play-state: paused !important; }

/* No JavaScript and reduced motion: stay static. */
@media (prefers-reduced-motion: reduce) { html:not(.js) .vstage, html:not(.js) .vstage * { animation: none !important; } }

/* Native in-page jumps (no Lenis) land below the sticky nav. */
section[id] { scroll-margin-top: 68px; }

/* ── Scroll effects (design doc §7). Only under html.fx, which scroll-fx.js adds
      when JavaScript runs and the visitor has not asked for reduced motion. ── */

/* Lenis */
html.lenis, html.lenis body { height: auto; }
html.lenis, .lenis.lenis-smooth { scroll-behavior: auto !important; } /* Lenis does the smoothing; native smooth scrolling would fight it */
.lenis.lenis-stopped { overflow: hidden; }

/* Background layer: fades charcoal → light surface → charcoal */
.bgfx { display: none; }
html.fx { background: var(--charcoal); }
html.fx body { background: transparent; }
.fx .bgfx { display: block; position: fixed; inset: 0; z-index: -1; background: var(--charcoal); pointer-events: none; }
.fx .sec.light { background: transparent; }
.fx .hero-copy, .fx .hero-visual { will-change: transform, opacity; }

/* Nav turns light over the light section */
.nav, .navlinks a, .pause-btn { transition: background .45s, border-color .45s, color .45s; }
.nav .logo img { transition: opacity .45s; }
.nav.on-light { background: rgba(242, 242, 246, .80); border-bottom-color: rgba(26, 29, 24, .08); }
.nav.on-light .logo .logo-rev { opacity: 0; }
.nav.on-light .logo .logo-deep { opacity: 1; }
.nav.on-light .navlinks a, .nav.on-light .pause-btn { color: var(--ink-70); border-color: var(--ink-14); }
.nav.on-light .navlinks a:hover, .nav.on-light .pause-btn:hover { color: var(--ink); border-color: var(--ink-55); }
.nav.on-light :focus-visible { outline-color: var(--deep); } /* Signal Blue is under 3:1 on the light surface */

/* Thread: lines draw across, row parts rise in turn */
.rows, .row { position: relative; }
.fx .rows { border-top-color: transparent; }
.fx .rows::before, .fx .row::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: var(--on-dark-12); transform: scaleX(0); transform-origin: left; transition: transform 1.4s cubic-bezier(.2, .7, .2, 1); }
.fx .rows::before { top: -1px; }
.fx .row::after { bottom: -1px; transition-delay: .12s; }
.fx .rows:has(.row.in)::before, .fx .row.in::after { transform: scaleX(1); }
.fx .row { border-bottom-color: transparent; }
.fx .row.reveal { opacity: 1; transform: none; }
.fx .row > * { opacity: 0; transform: translateY(22px); transition: opacity .8s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
.fx .row > :nth-child(2) { transition-delay: .08s; }
.fx .row > :nth-child(3) { transition-delay: .16s; }
.fx .row.in > * { opacity: 1; transform: none; }

/* Portfolio: pinned while scrolling steps through the five (30 vh each).
   Keyed on html.motion, which the inline head script sets before first paint (unless the
   visitor asks for reduced motion), so the pin space is there from the start and links to
   #track or #story land in the right place. Screens under 740 px tall get the static index
   instead: the heading and five rows cannot fit under the nav there. */
@media (min-width: 901px) and (min-height: 740px) {
  .motion .vpin { height: calc(100vh - 68px + 150vh); }
  .motion .vstick { position: sticky; top: 68px; height: calc(100vh - 68px); display: flex; flex-direction: column; justify-content: safe center; padding: 20px 0; }
  .motion .vstick .sec-head { margin-bottom: 36px; }
  /* As tall as the mockup when there is room; never shorter than the rows need. */
  .motion .ventures { height: auto; min-height: max(400px, min(560px, calc(100vh - 308px))); }
  .motion .vlist .vrow { padding: 14px 0; }
  .motion .vitem.on .vbar { transform: scaleX(var(--s, 0)); transition: transform .12s linear; }
}
/* Shorter laptop screens: tighten so the pinned heading and all five rows fit under the nav. */
@media (min-width: 901px) and (min-height: 740px) and (max-height: 860px) {
  .motion .vstick { padding: 12px 0; }
  .motion .vstick .sec-head { margin-bottom: 20px; }
  .motion .vstick .eyebrow { margin-bottom: 12px; }
  .motion .vstick h2.h1 { font-size: clamp(28px, 3vw, 38px); }
  .motion .vlist .vrow { padding: 10px 0; }
  .motion .vlist .vname { font-size: 24px; }
}

/* Track record: shown once the background is dark; letters rise; the line draws; the mark drifts */
.fx .big { overflow: hidden; padding-bottom: .14em; margin-bottom: -.14em; }
.fx .big .ch { display: inline-block; transform: translateY(110%); transition: transform 1.1s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i) * 45ms + .15s); }
.fx .track .reveal { opacity: 0; transform: translateY(18px); }
.fx .track .reveal.shown { opacity: 1; transform: none; }
.fx .track-left.shown .big .ch { transform: none; }
.fx .path .line { transform: scaleX(var(--p, 0)); transform-origin: left; }

/* Story: the timeline draws left to right and lights each year */
@media (min-width: 1025px) {
  .fx .timeline { position: relative; }
  .fx .timeline::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--signal); transform: scaleX(var(--p, 0)); transform-origin: left; }
  .fx .timeline .tl { opacity: .28; transition: opacity .6s ease; }
  .fx .timeline .tl.lit { opacity: 1; }
  .fx .timeline .tl::before { transform: scale(.3); transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
  .fx .timeline .tl.lit::before { transform: none; }
}
