/* Shared browser surfaces for every page root (.lb main site, .rd readiness, .nv dashboard).
   Uses each page's own tokens so light and dark stay in step. */
.lb ::selection,.rd ::selection,.nv ::selection{background:var(--saffron-100);color:var(--ink)}
.lb,.rd,.nv{caret-color:var(--tea);scrollbar-color:var(--line-strong) transparent;-webkit-tap-highlight-color:transparent}
.lb a,.rd a,.nv a{text-underline-offset:.18em;text-decoration-thickness:1px}
html{scroll-behavior:smooth;scroll-padding-top:84px;color-scheme:light}
html[data-theme="dark"]{color-scheme:dark}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}

/* ---- Motion ---------------------------------------------------------- */

/* Home theme switch fades like the readiness and dashboard pages already do. */
.lb{transition:background-color .5s var(--ease),color .5s var(--ease)}

/* Loops pause while their block is off screen (set by js/dc-runtime.js).
   Scroll-linked reveals keep their own timeline. */
[data-off] *:not(.rv){animation-play-state:paused !important}

/* Moving between the three pages crossfades instead of flashing white;
   the old page leaves faster than the new one arrives. */
@media (prefers-reduced-motion:no-preference){
  @view-transition{navigation:auto}
  ::view-transition-old(root){animation:180ms cubic-bezier(.4,0,1,1) both lb-vt-out}
  ::view-transition-new(root){animation:360ms cubic-bezier(.16,1,.3,1) both lb-vt-in}
}
@keyframes lb-vt-out{to{opacity:0}}
@keyframes lb-vt-in{from{opacity:0}}

/* Reduced motion: no travel, tilt or blur, but keep gentle fades and colour
   feedback so state changes still read. These follow each page's own
   blanket reduced-motion rule and refine it. */
@keyframes lb-fade{from{opacity:0}to{opacity:1}}
@media (prefers-reduced-motion:reduce){
  .lb *,.rd *,.nv *{transition-property:color,background-color,border-color,opacity,box-shadow,fill,stroke !important;transition-duration:.2s !important;transition-timing-function:ease !important}
  .lb,.rd,.nv{transition-duration:.2s}
  /* section reveals: fade with scroll, no rise/tilt/blur */
  .lb .rv{animation-name:lb-fade !important}
  /* hero headline words: fade in place */
  .lb .h1 .w{transform:none;filter:none;animation:lb-fade .5s ease forwards !important}
  .lb .fade{transform:none;animation:lb-fade .5s ease forwards !important}
  /* readiness question swap and result, dashboard view switch: crossfade */
  .rd .qA,.rd .qB,.rd .res,.nv .vA,.nv .vB{animation:lb-fade .25s ease both !important}
}
