/* Site-wide text animations: line-by-line fade-up, fade-up blocks and count-up numbers.
   Line style mirrors the "Life Reimagined" reference: each line fades up, 0.8s ease-in-out, 0.1s apart.
   Behaviour lives in animations.js; layout, fonts and colours are left untouched. */

:root {
  --anim-ease: ease-in-out;
  --anim-duration: .8s;
}

/* 1. Line-by-line reveal */
.anim-js .split-reveal:not(.is-split) {
  visibility: hidden;
}

/* Headings that already use the site's own .reveal fade: let the line reveal do the work */
.anim-js .split-reveal.reveal {
  opacity: 1 !important;
  transform: none !important;
}

.split-reveal .sr-line {
  display: block;
}

.split-reveal .sr-line-inner {
  display: block;
  opacity: 0;
  transform: translate3d(0, min(100px, 1.6em), 0);
  transition: opacity var(--anim-duration) var(--anim-ease), transform var(--anim-duration) var(--anim-ease);
  will-change: opacity, transform;
}

.split-reveal.is-in .sr-line-inner {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Rich headings / paragraphs (markup kept): every word on a line shares that line's delay */
.split-reveal .sr-word {
  display: inline-block;
  opacity: 0;
  transform: translate3d(0, min(100px, 1.6em), 0);
  transition: opacity var(--anim-duration) var(--anim-ease), transform var(--anim-duration) var(--anim-ease);
}

.split-reveal.is-in .sr-word {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* 2. Fade-up blocks */
.anim-js .fade-up {
  opacity: 0;
  transform: translate3d(0, 50px, 0);
  transition: opacity var(--anim-duration) var(--anim-ease), transform var(--anim-duration) var(--anim-ease);
}

.anim-js .fade-up.is-in {
  opacity: 1;
  transform: none;
}

/* Footer bottom bar sits on the clipped bottom edge of the page: fade in place instead of rising */
.anim-js .site-footer .footer-meta > .fade-up {
  transform: none;
}

/* 3. Count-up numbers: always look exactly like the figure around them
   (existing "card span" label styles must not shrink them), with a steady width while counting */
:root:not(#anim-a):not(#anim-b) .count-up {
  display: inline !important;
  position: static !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  opacity: 1 !important;
  transform: none !important;
  font: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
  letter-spacing: inherit !important;
  text-transform: inherit !important;
  white-space: inherit !important;
  color: inherit !important;
  font-variant-numeric: tabular-nums !important;
}

/* Reduced motion: show everything immediately */
@media (prefers-reduced-motion: reduce) {
  .anim-js .split-reveal:not(.is-split) {
    visibility: visible;
  }
  .split-reveal .sr-line-inner,
  .split-reveal .sr-word,
  .anim-js .fade-up {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Line / word wrappers always render exactly like the text they wrap */
:root:not(#anim-a):not(#anim-b) :is(sr-line, sr-inner, sr-word) {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  max-width: none !important;
  font: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
  letter-spacing: inherit !important;
  text-transform: inherit !important;
  color: inherit !important;
}
:root:not(#anim-a):not(#anim-b) sr-line,
:root:not(#anim-a):not(#anim-b) sr-inner {
  display: block !important;
}
:root:not(#anim-a):not(#anim-b) sr-word {
  display: inline-block !important;
}
/* Safeguard mode (set by animations.js when inline-block words would change the wrapping):
   words stay inline so wrapping is identical; each line still fades in on its own delay */
:root:not(#anim-a):not(#anim-b) .sr-inline sr-word {
  display: inline !important;
}
.split-reveal.sr-inline .sr-word {
  transform: none;
}

/* Slide-in cards: from the left / right. Uses the separate `translate` property so it
   combines with any hover lift (transform) the card already has. */
.anim-js .slide-left:not(.is-in),
.anim-js .slide-right:not(.is-in) {
  opacity: 0 !important;
}
.anim-js .slide-left:not(.is-in) { translate: -90px 0; }
.anim-js .slide-right:not(.is-in) { translate: 90px 0; }
body .anim-js .slide-left,
body .anim-js .slide-right,
html.anim-js body .slide-left,
html.anim-js body .slide-right {
  transition: opacity .9s ease-in-out, translate .9s ease-in-out, transform .45s cubic-bezier(.2, .7, .2, 1), box-shadow .45s ease, border-color .45s ease !important;
  transition-delay: 0s !important;
}
html.anim-js body .slide-right {
  transition-delay: .1s, .1s, 0s, 0s, 0s !important;
}
@media (prefers-reduced-motion: reduce) {
  .slide-left, .slide-right { translate: none !important; opacity: 1 !important; }
}
html.anim-js body .engine-grid article.slide-left,
html.anim-js body .engine-grid article.slide-right,
html.anim-js body .slide-left.visible,
html.anim-js body .slide-right.visible {
  transition-property: opacity, translate, transform, box-shadow, border-color !important;
  transition-duration: .9s, .9s, .45s, .45s, .45s !important;
  transition-timing-function: ease-in-out, ease-in-out, cubic-bezier(.2, .7, .2, 1), ease, ease !important;
  transition-delay: 0s !important;
}
html.anim-js body .engine-grid article.slide-right,
html.anim-js body .slide-right.visible {
  transition-delay: .12s, .12s, 0s, 0s, 0s !important;
}

/* A measured line never wraps a second time (sub-pixel differences); if it stops fitting,
   animations.js re-splits it. */
.split-reveal:not(.is-rich) sr-inner {
  white-space: nowrap !important;
}
