/* Acerbo.AI landing — kinetic typography + section transitions (see landing-kinetic.js).
   Everything is gated on html.kx-ready, which JS sets only when motion is allowed:
   with reduced motion or no JS this file is inert. */

/* 0. Until the hero title is split, keep it hidden (bootstrap removes this after 3 s anyway) */
.kx-pending #hero-h1 {
  opacity: 0;
}

/* 1. Word masks: words rise from below their mask, staggered */
.kx-ready .kx-split .kx-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  /* room for descenders and the gradient accent, without shifting layout */
  padding: 0.06em 0.03em 0.14em;
  margin: -0.06em -0.03em -0.14em;
}
.kx-ready .kx-split .kx-word {
  display: inline-block;
  transform: translate3d(0, 112%, 0) rotate(3deg);
  transform-origin: 0 100%;
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--kx-i, 0) * 42ms);
}
.kx-ready .kx-split.kx-in .kx-word {
  transform: none;
}

/* Split headings replace the older blur/fade reveal: the heading itself stays visible,
   it only leans with scroll velocity (Les Animals). */
html.kx-ready .section .section-title.kx-split,
html.kx-ready .section .section-title.kx-split.fx-reveal-when-visible,
html.kx-ready .kx-split {
  opacity: 1;
  filter: none;
  transform: skewY(var(--kx-skew, 0deg));
  transform-origin: 0 50%;
  transition: none;
}

/* 2. Button text roll: the label slides up, its aria-hidden twin slides in */
.kx-ready .kx-roll {
  display: inline-grid;
  overflow: hidden;
  line-height: 1.3;
}
.kx-ready .kx-roll > span {
  grid-area: 1 / 1;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.kx-ready .kx-roll-b {
  transform: translateY(110%);
}
@media (hover: hover) {
  .kx-ready .btn:hover .kx-roll-a { transform: translateY(-110%); }
  .kx-ready .btn:hover .kx-roll-b { transform: none; }
}
.kx-ready .btn:focus-visible .kx-roll-a { transform: translateY(-110%); }
.kx-ready .btn:focus-visible .kx-roll-b { transform: none; }

/* 3. Section passage: an accent rule draws across the top edge on entry */
.kx-ready .kx-section {
  position: relative;
}
.kx-ready .kx-rule {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, #7de0e6 22%, #a8f5b5 50%, #e8a55c 78%, transparent 100%);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 1.4s cubic-bezier(0.65, 0, 0.35, 1);
}
.kx-ready .kx-section-in > .kx-rule {
  transform: scaleX(1);
}

/* 4. Hero recedes as you scroll away (driven by --kx-hero, 0 → 1) */
.kx-ready .hero .hero-overlay > .container {
  transform: translate3d(0, calc(var(--kx-hero, 0) * 90px), 0) scale(calc(1 - var(--kx-hero, 0) * 0.06));
  opacity: calc(1 - var(--kx-hero, 0) * 0.75);
  transform-origin: 50% 0;
  will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  .kx-split .kx-word,
  .kx-roll > span,
  .kx-rule,
  .hero .hero-overlay > .container {
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }
}
