/* THALYRON motion system (Phase 17.1). Tokens live in tokens.css (--m-*), behaviour in assets/js/motion.js.
   Three kinds of movement, the same on every page:
   1. Page load (CSS only, starts with the first frame, never waits for a script): label, headline lines, text, buttons.
   2. Scroll reveals ([data-m] inside a [data-m-seq] head, plus [data-r] items and .rv media): once, when in view.
   3. Statements ([data-words]): words go from grey to ink with the scroll position.
   Without JavaScript, with reduced motion, in print and when the safety switch html.m-off is set, everything is
   simply visible. Only transform, opacity and clip-path move; nothing changes the layout. */

/* A headline line: a mask a little taller than the line box (room for umlauts and descenders) that adds no height.
   The headline holding the lines is a flex column, so the negative margins never collapse and every line sits
   exactly where plain text would (motion.js adds .m-split while a scroll headline is split). */
.ml-lines,.m-split{display:flex;flex-direction:column}
.ln{display:block;overflow:hidden;padding:.12em .06em .16em;margin:-.12em -.06em -.16em}
.ln__i{display:block}

@media screen and (prefers-reduced-motion:no-preference){
  /* ---------- 1. Page load ---------- */
  .js .ml{animation:m-fade var(--m-fade) var(--m-ease-soft) both;animation-delay:calc(var(--m-load) + var(--m-i,0) * var(--m-stagger))}
  .js .ml--r{animation-name:m-rise;animation-duration:var(--m-text);animation-timing-function:var(--m-ease)}
  .js .ml-lines .ln__i{animation:m-line var(--m-line) var(--m-ease) both;animation-delay:calc(var(--m-load) + (var(--m-i,0) + var(--li,0)) * var(--m-stagger))}

  /* ---------- 2. Scroll reveals ---------- */
  .js [data-m]:not(.m-on){opacity:0}
  .js [data-m="fade"].m-on:not(.m-done){animation:m-fade var(--m-fade) var(--m-ease-soft) both;animation-delay:calc(var(--m-i,0) * var(--m-stagger))}
  .js [data-m="text"].m-on:not(.m-done){animation:m-rise var(--m-text) var(--m-ease) both;animation-delay:calc(var(--m-i,0) * var(--m-stagger))}
  .js [data-m="lines"].m-on:not(.m-done) .ln__i{animation:m-line var(--m-line) var(--m-ease) both;animation-delay:calc((var(--m-i,0) + var(--li,0)) * var(--m-stagger))}
  /* A headline that could not be split (nested markup) rises as one block. */
  .js [data-m="lines"].m-on.m-block:not(.m-done){animation:m-rise var(--m-text) var(--m-ease) both;animation-delay:calc(var(--m-i,0) * var(--m-stagger))}

  /* Items, cards and rows: a short rise, stepped inside [data-stagger] lists (--d in ms, set by motion.js). */
  .js [data-r]{opacity:0;transform:translate3d(0,var(--m-rise-text),0);transition:opacity var(--m-text) var(--m-ease-soft),transform var(--m-text) var(--m-ease);transition-delay:calc(var(--d,0) * 1ms)}
  .js [data-r].r-in{opacity:1;transform:none}

  /* Media: a blind opens upwards while the image or film settles from a slight zoom. */
  .js .rv[data-r],.js [data-r] .rv{opacity:1;transform:none;clip-path:inset(16% 0 0 0);transition:clip-path var(--m-media) var(--m-ease)}
  .js .rv[data-r].r-in,.js .r-in .rv{clip-path:inset(0)}
  .js .rv .slot:not([data-par]){scale:1.08;transition:scale calc(var(--m-media) * 1.35) var(--m-ease)}
  .js .rv.r-in .slot,.js .r-in .rv .slot{scale:1}
  /* Configured media fades in over the placeholder once loaded (assets/js/media.js sets .is-loaded). */
  .js .slot.is-loaded .slot__m{animation:m-media calc(var(--m-media) * .9) var(--m-ease) both}

  /* Home hero: the media fades in behind the text; the scroll cue runs three times, the PULSE status dot four. */
  .hx__media .slot{animation:heroIn 1.6s var(--ease) both}
  .hx__line::after{animation:down 2.2s var(--ease-io) .9s 3 both}
  .stat__dot{animation:beat 2.6s ease-in-out 4}
}

/* ---------- 3. Statements: grey to ink with the scroll position ---------- */
[data-words] .wd{transition:color var(--m-fade) var(--m-ease-soft)}
.js [data-words]:not(.is-static) .wd{color:var(--m-grey)}
.js [data-words] .wd.on{color:var(--c-tx)}

/* Safety switch: if motion.js has not started 2.5 s after the first byte (blocked, failed or very slow), the inline
   script in <head> sets html.m-off and everything shows without movement. */
.m-off [data-m],.m-off [data-r],.m-off .rv,.m-off .rv .slot{opacity:1!important;transform:none!important;clip-path:none!important;scale:none!important;animation:none!important}

@media print{[data-m],[data-r],.rv,.ln__i,.ml{opacity:1!important;transform:none!important;clip-path:none!important;animation:none!important}}

@keyframes m-line{from{opacity:0;transform:translate3d(0,var(--m-rise),0)}45%{opacity:1}to{opacity:1;transform:none}}
@keyframes m-rise{from{opacity:0;transform:translate3d(0,var(--m-rise-text),0)}to{opacity:1;transform:none}}
@keyframes m-fade{from{opacity:0}to{opacity:1}}
@keyframes m-media{from{opacity:0;transform:scale(1.03)}to{opacity:1;transform:none}}
@keyframes heroIn{from{opacity:0;transform:scale(1.04)}to{opacity:1;transform:none}}
@keyframes down{0%{transform:translateY(-100%)}100%{transform:translateY(100%)}}
@keyframes beat{0%,100%{box-shadow:0 0 0 0 rgba(201,135,63,.35)}50%{box-shadow:0 0 0 8px rgba(201,135,63,0)}}
