/* =========================================================
   FX layer – playful motion on top of style.css
   Everything here is switched off under prefers-reduced-motion.
   ========================================================= */
:root {
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --spring-big: cubic-bezier(.5, 2.2, .45, .7);
}

/* ---------- Walking scroll-progress bar ---------- */
.walkbar { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 60; pointer-events: none; }
.walkbar__fill {
  height: 100%; width: calc(var(--p, 0) * 100%);
  background: linear-gradient(90deg, var(--teal), var(--teal-2), var(--sky));
  box-shadow: 0 0 12px rgba(79, 216, 173, .7);
  border-radius: 0 3px 3px 0;
}
.walker {
  position: absolute; top: 2px; left: calc(var(--p, 0) * 100%);
  width: 16px; height: 22px; translate: -60% 0;
  fill: var(--teal-2); stroke: var(--teal-2); stroke-width: 2.4; stroke-linecap: round;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
  opacity: 0; transition: opacity .3s;
}
.walkbar.is-on .walker { opacity: 1; }
.walker path { transform-box: view-box; }
.walker__leg, .walker__arm { transform-origin: 11px 18px; }
.walker__arm { transform-origin: 12.2px 10.5px; }
.walkbar.is-walking .walker__leg--a, .walkbar.is-walking .walker__arm--b { animation: swing .5s ease-in-out infinite alternate; }
.walkbar.is-walking .walker__leg--b, .walkbar.is-walking .walker__arm--a { animation: swing .5s ease-in-out infinite alternate-reverse; }
.walkbar.is-back .walker { scale: -1 1; }
.walkbar.is-walking .walker { animation: bobWalk .25s ease-in-out infinite alternate; }
@keyframes swing { from { rotate: -22deg; } to { rotate: 22deg; } }
@keyframes bobWalk { to { translate: -60% -1.5px; } }

/* ---------- Hero ---------- */
.hero__spot {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(380px circle at var(--mx, 70%) var(--my, 30%), rgba(79, 216, 173, .13), transparent 70%);
  transition: background .1s;
}
.hero__rings { animation: ringSpin 60s linear infinite, ringPulse 6s ease-in-out infinite; }
@keyframes ringSpin { to { rotate: 360deg; } }
@keyframes ringPulse { 50% { opacity: .75; scale: 1.04; } }

/* Words drop in one by one */
.split .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.split .w > span {
  display: inline-block; transform: translateY(110%) rotate(8deg);
  transition: transform .9s var(--spring); transition-delay: calc(var(--wi) * 70ms + 100ms);
}
.split.in .w > span { transform: none; }

/* "move again." – letters wave, then keep a gentle jiggle on hover */
.hero h1 em { display: inline-block; }
.hero h1 em .ch {
  display: inline-block;
  background: linear-gradient(100deg, var(--teal-2), var(--sky));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero h1 em.wave .ch { animation: wave 1.1s var(--spring) both; animation-delay: calc(var(--ci) * 45ms); }
.hero h1 em:hover .ch { animation: jiggle .6s var(--spring) both; animation-delay: calc(var(--ci) * 30ms); }
@keyframes wave { 0% { transform: none; } 30% { transform: translateY(-.28em) rotate(-6deg); } 60% { transform: translateY(.04em); } 100% { transform: none; } }
@keyframes jiggle { 0%, 100% { transform: none; } 40% { transform: translateY(-.18em) scale(1.12, .92); } 70% { transform: translateY(0) scale(.95, 1.06); } }

.hero .eyebrow, .lead, .hero__cta, .hero__stats { animation: riseIn .9s var(--ease) both; }
.hero .eyebrow { animation-delay: .05s; }
.lead { animation-delay: .55s; }
.hero__cta { animation-delay: .7s; }
.hero__stats { animation-delay: .85s; }
@keyframes riseIn { from { opacity: 0; transform: translateY(18px); } }
.pin { animation: ping 2s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(79,216,173,.6); } 80%, 100% { box-shadow: 0 0 0 12px rgba(79,216,173,0); } }

.hero__stats dt { display: inline-block; transition: transform .5s var(--spring); }
.hero__stats div:hover dt { transform: translateY(-4px) rotate(-3deg) scale(1.08); color: var(--teal-2); }

/* Fan follows the cursor in 3D and covers bob idly */
.hero__fan { transform-style: preserve-3d; transition: transform .6s var(--ease); transform: rotateX(var(--fx, 0deg)) rotateY(var(--fy, 0deg)); }
.fan__item { animation: fanIn .9s var(--spring) backwards, bob 5s ease-in-out infinite; animation-delay: calc(var(--i) * 110ms + 250ms), calc(var(--i) * -1.3s); }
@keyframes bob { 50% { translate: 0 -10px; } }
.fan__item:hover { animation-play-state: running, paused; }

/* ---------- Buttons: squishy + springy ---------- */
.btn, .icon-btn, .tab, .fan__item, .video-tile__play, .book-dots button { transition-timing-function: var(--spring); }
.btn { transition: transform .45s var(--spring), background .25s, box-shadow .25s, border-color .25s, scale .3s var(--spring); }
.btn:active, .icon-btn:active:not(:disabled), .tab:active { scale: .92; transition-duration: .08s; }
.btn .i { transition: transform .45s var(--spring); }
.btn:hover .i { transform: translateX(3px) rotate(-8deg); }
.hero__cta .btn--primary:hover .i { animation: nudge .9s var(--spring) infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }
.btn--primary { position: relative; overflow: hidden; }
.btn--primary::after {
  content: ""; position: absolute; inset: 0; translate: -120% 0; skew: -20deg;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
}
.btn--primary:hover::after { transition: translate .7s var(--ease); translate: 120% 0; }
.btn--play:hover .i, .video-tile:hover .video-tile__play .i { animation: wobble .6s var(--spring); }
@keyframes wobble { 25% { transform: rotate(-14deg) scale(1.2); } 60% { transform: rotate(10deg); } }
.magnetic { transition: transform .35s var(--spring), translate .35s var(--spring), background .25s, box-shadow .25s; translate: var(--tx, 0) var(--ty, 0); }

/* ---------- Section headings & eyebrows ---------- */
.eyebrow::before { transform-origin: left; transition: transform .8s var(--spring) .1s; }
.reveal-line:not(.in)::before { transform: scaleX(0); }

/* ---------- Cards: tilt toward cursor + pop in ---------- */
.cards { perspective: 1200px; }
.card {
  transform-style: preserve-3d;
  transition: transform .5s var(--spring), border-color .4s, box-shadow .4s, opacity .8s var(--ease) var(--d, 0ms);
}
.card.reveal { transform: translateY(40px) rotate(var(--r, -2deg)) scale(.96); }
.card.reveal:nth-child(even) { --r: 2deg; }
.card.reveal.in { transform: translateY(0) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition-delay: var(--d, 0ms), 0s, 0s, var(--d, 0ms); }
.card.reveal.in.settled { transition-delay: 0s; }
.card.reveal.in.settled.tilting { transition-duration: .15s, .4s, .4s, .8s; }
.card.reveal.in:hover { transform: translateY(-8px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.card__glare {
  position: absolute; inset: 0; pointer-events: none; border-radius: inherit; z-index: 3; opacity: 0; transition: opacity .3s;
  background: radial-gradient(300px circle at var(--gx, 50%) var(--gy, 50%), rgba(255,255,255,.12), transparent 60%);
}
.card { position: relative; }
.card:hover .card__glare { opacity: 1; }
.card__focus { transition: letter-spacing .5s var(--spring); }
.card:hover .card__focus { letter-spacing: .16em; }

/* ---------- Marquee ---------- */
.marquee {
  position: relative; overflow: hidden; padding: 22px 0;
  border-block: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(43,181,138,.08), rgba(111,198,240,.06));
  rotate: -1.5deg; scale: 1.04; margin: 10px 0 -10px;
  -webkit-mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track { display: flex; align-items: center; gap: 28px; width: max-content; animation: marquee 38s linear infinite; }
.marquee:hover .marquee__track { animation-duration: 90s; }
.marquee span { font-size: clamp(28px, 4vw, 48px); font-weight: 800; letter-spacing: -.02em; text-transform: uppercase; white-space: nowrap; color: var(--text); }
.marquee span.o { color: transparent; -webkit-text-stroke: 1.5px var(--teal-2); }
.marquee i { width: 14px; height: 14px; border-radius: 50%; background: var(--teal); flex: none; animation: dotSpin 3s var(--spring) infinite; }
.marquee i:nth-of-type(3n) { border-radius: 3px; background: var(--sky); }
.marquee i:nth-of-type(3n+1) { border-radius: 50% 50% 50% 0; }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes dotSpin { 50% { transform: rotate(180deg) scale(1.3); } }

/* ---------- Tabs ---------- */
.tab__cover { transition: transform .45s var(--spring), box-shadow .3s, opacity .3s !important; }
.tab:hover .tab__cover { transform: translateY(-6px) rotate(-3deg); }
.tab[aria-selected="true"] .tab__cover { animation: tabPop .6s var(--spring); }
.tab[aria-selected="true"] .tab__n { animation: chipPop .5s var(--spring-big); }
@keyframes tabPop { 0% { scale: .9; } 60% { scale: 1.06; } 100% { scale: 1; } }
@keyframes tabImg { 0% { transform: rotate(-20deg) scale(.6); } 100% { transform: none; } }

/* ---------- Info panel: staggered entrance ---------- */
.info__in .eyebrow, .info__name, .info__tag, .info__summary, .video-tile, .info__h, .hl li, .chips li {
  opacity: 0; transform: translateY(14px);
}
.info__in.is-in .eyebrow, .info__in.is-in .info__name, .info__in.is-in .info__tag, .info__in.is-in .info__summary,
.info__in.is-in .video-tile, .info__in.is-in .info__h {
  animation: riseIn .6s var(--spring) forwards;
  opacity: 1; transform: none;
}
.info__in.is-in .info__name { animation: nameIn .7s var(--spring) .05s both; }
.info__in.is-in .info__tag { animation-delay: .12s; }
.info__in.is-in .info__summary { animation-delay: .18s; }
.info__in.is-in .video-tile { animation: tileIn .7s var(--spring) .24s backwards; }
.info__in.is-in .info__h { animation-delay: .32s; }
.info__in.is-in .hl li { animation: slideIn .55s var(--spring) both; animation-delay: calc(.36s + var(--n) * 70ms); opacity: 1; transform: none; }
.info__in.is-in .chips li { animation: chipPop .5s var(--spring-big) both; animation-delay: calc(.6s + var(--n) * 70ms); opacity: 1; transform: none; }
@keyframes nameIn { from { opacity: 0; transform: translateY(20px) skewY(4deg); letter-spacing: .04em; } }
@keyframes tileIn { from { opacity: 0; transform: scale(.85) rotate(-2deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-18px); } }
@keyframes chipPop { from { opacity: 0; transform: scale(.3) rotate(-10deg); } }
.chips li { transition: transform .35s var(--spring), background .2s, border-color .2s; cursor: default; }
.chips li:hover { transform: translateY(-3px) rotate(-3deg) scale(1.05); background: rgba(43,181,138,.18); border-color: rgba(79,216,173,.5); }
.hl b { transition: transform .4s var(--spring), background .3s; }
.hl li:hover b { transform: scale(1.2) rotate(-12deg); background: rgba(43,181,138,.3); }

/* ---------- Book ---------- */
/* uses individual translate/rotate/scale so it never fights the
   transform that centres the cover */
.book-stage .book { animation: bookToss 1s var(--spring) both; }
@keyframes bookToss {
  0% { opacity: 0; translate: 0 60px; rotate: -6deg; scale: .85; }
  100% { opacity: 1; translate: 0 0; rotate: 0deg; scale: 1; }
}
.book-dots button.on { animation: dotBoing .5s var(--spring-big); }
@keyframes dotBoing { 0% { transform: scaleY(1); } 40% { transform: scale(1.3, .6); } 100% { transform: none; } }

.spark {
  position: absolute; z-index: 5; pointer-events: none; width: 8px; height: 8px; border-radius: 2px;
  left: var(--sx); top: var(--sy);
  background: var(--c, var(--teal-2));
  animation: spark .9s cubic-bezier(.15, .7, .3, 1) forwards;
}
.spark.round { border-radius: 50%; }
@keyframes spark {
  0% { transform: translate(-50%, -50%) scale(0) rotate(0); opacity: 1; }
  30% { transform: translate(calc(-50% + var(--dx) * .6), calc(-50% + var(--dy) * .6)) scale(1.2) rotate(120deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 40px)) scale(.2) rotate(300deg); opacity: 0; }
}

/* ---------- CTA ---------- */
.cta { transition: transform .6s var(--spring); }
.cta__rings { animation: ringSpin 40s linear infinite reverse; }
.steps li { opacity: 0; transform: translateX(-20px); transition: opacity .6s var(--ease), transform .6s var(--spring); transition-delay: calc(var(--n) * 120ms + .2s); }
.cta.in .steps li { opacity: 1; transform: none; }
.steps b { transition: transform .5s var(--spring), background .3s; }
.cta.in .steps b { animation: stepBounce .8s var(--spring-big) both; animation-delay: calc(var(--n) * 120ms + .35s); }
.steps li:hover b { transform: rotate(360deg); background: var(--teal); color: #03211a; }
@keyframes stepBounce { from { transform: scale(0); } }

/* ---------- Modals: elastic ---------- */
.modal__panel { transform: translateY(40px) scale(.85) rotate(-1.5deg); transition: opacity .3s var(--ease), transform .55s var(--spring); }
.modal.open .modal__panel { transform: none; }

/* ---------- Footer logo wiggle ---------- */
.footer img { transition: transform .5s var(--spring); }
.footer img:hover { transform: rotate(-3deg) scale(1.05); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .walker, .spark, .hero__spot { display: none !important; }
  .split .w > span, .steps li, .card.reveal, .info__in *, .hero .eyebrow, .lead, .hero__cta, .hero__stats { transform: none !important; opacity: 1 !important; animation: none !important; }
  .marquee__track { animation: none !important; }
  .hero__fan, .card { transform: none !important; }
}

/* Filtering: visible cards re-deal like a hand of cards */
.cards.is-filtering .card:not([hidden]) { animation: deal .5s var(--spring) both; animation-delay: calc(min(var(--fi, 0), 12) * 30ms); }
@keyframes deal { from { opacity: 0; scale: .9; translate: 0 16px; } }
.fchip { transition: background .25s, color .25s, border-color .25s, scale .3s var(--spring); }
.fchip:active { scale: .92; }
.fchip[aria-pressed="true"] span { animation: chipPop .45s var(--spring-big); }
.fan__more:hover .fan__more-n { animation: jiggle .6s var(--spring); display: inline-block; }
.card__badge { animation: ping 2.4s ease-out infinite; }
.info__in.is-in .info__nav { animation: riseIn .6s var(--spring) .7s both; }
@media (prefers-reduced-motion: reduce) { .cards.is-filtering .card { animation: none !important; } }

/* video screen beside the book */
.info__in .video-screen, .info__in .video-soon { opacity: 0; transform: translateY(14px); }
.info__in.is-in .video-screen, .info__in.is-in .video-soon { opacity: 1; transform: none; animation: tileIn .7s var(--spring) .24s backwards; }
.video-screen:hover .video-tile__play .i { animation: wobble .6s var(--spring); }
.info__in.is-in .video-screen:hover { transform: translateY(-4px); }

/* nudge the next arrow on the cover so people know the book turns */
.book-stage.is-cover ~ .side-flip--next:not(:disabled) { animation: nudgeRight 2.4s var(--spring) 1.2s 3; }
@keyframes nudgeRight { 0%, 60%, 100% { translate: 0 0; } 75% { translate: 8px 0; } }
@media (max-width: 640px) {
  .book-stage.is-cover ~ .side-flip--next:not(:disabled) { animation-name: nudgeRightM; }
  @keyframes nudgeRightM { 0%, 60%, 100% { translate: 0 -50%; } 75% { translate: 6px -50%; } }
}

/* =========================================================
   Hero fan – stable hover (fix for warping / flicker)
   The button keeps its place (stable hit area); only the inner
   card lifts. Neighbours slide apart to make room.
   ========================================================= */
.hero__fan { transform-style: flat; transform: translate(var(--px, 0px), var(--py, 0px)); transition: transform .8s var(--ease); }
.fan__item {
  width: clamp(150px, 17vw, 240px);
  overflow: visible; border-radius: 0; box-shadow: none; background: none;
  transition: left .5s var(--spring), transform .5s var(--ease);
}
.fan__item::after { display: none; }
.fan__item:hover, .fan__item:focus-visible {
  transform: translate(-50%, -50%) translateX(var(--x)) translateY(calc(abs(var(--o, 0)) * 16px)) rotate(var(--rot));
  box-shadow: none; z-index: 20;
}
.fan__card {
  position: absolute; inset: 0; display: block; border-radius: 8px; overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,.08);
  transition: transform .45s var(--spring), box-shadow .35s;
}
.fan__card img { width: 100%; height: 100%; object-fit: cover; }
.fan__card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(0,0,0,.28), transparent 8%, transparent 92%, rgba(255,255,255,.06)); }
.fan__item:hover .fan__card, .fan__item:focus-visible .fan__card {
  transform: translateY(-18px) rotate(calc(var(--rot) * -.6)) scale(1.06);
  box-shadow: 0 40px 80px -20px rgba(0,0,0,.85), 0 0 0 2px var(--teal-2);
}
/* make room: covers after the hovered one move right, covers before it move left */
.fan__item:hover ~ .fan__item { left: calc(50% + 34px); }
.fan__item:has(~ .fan__item:hover) { left: calc(50% - 34px); }
.fan__more { display: grid; place-content: center; justify-items: center; gap: 4px; }
.fan__more::after { display: none; }
.hero__fan { perspective: none; }
@media (max-width: 900px) {
  .fan__item { width: clamp(130px, 34vw, 210px); }
  .fan__item:hover ~ .fan__item { left: calc(50% + 20px); }
  .fan__item:has(~ .fan__item:hover) { left: calc(50% - 20px); }
}

/* fan spacing comes from JS (--step/--push) so covers never bury each other */
.fan__item:hover ~ .fan__item { left: calc(50% + var(--push, 30px)); }
.fan__item:has(~ .fan__item:hover) { left: calc(50% - var(--push, 30px)); }
.fan__item:hover .fan__card, .fan__item:focus-visible .fan__card { transform: translateY(-16px) rotate(calc(var(--rot) * -.6)) scale(1.04); }
@media (max-width: 900px) {
  .fan__item:hover ~ .fan__item { left: calc(50% + var(--push, 20px)); }
  .fan__item:has(~ .fan__item:hover) { left: calc(50% - var(--push, 20px)); }
}

/* =========================================================
   Hero fan hover v3 – "pull a card from the hand"
   The hovered cover keeps its place in the stack (so it can't
   bury its neighbour) and rises clear of the others instead.
   ========================================================= */
.fan__item:hover, .fan__item:focus-visible { z-index: calc(var(--i, 0) + 1); }
.fan__item:hover ~ .fan__item, .fan__item:has(~ .fan__item:hover) { left: 50%; }
.fan__item:hover .fan__card, .fan__item:focus-visible .fan__card {
  transform: translateY(-64px) rotate(calc(var(--rot) * -.35)) scale(1.03);
  box-shadow: 0 40px 70px -24px rgba(0,0,0,.9), 0 0 0 2px var(--teal-2);
}
/* label sits at the top – the part that is lifted clear of the stack */
.fan__label { top: 10px; bottom: auto; left: 10px; right: auto; max-width: calc(100% - 20px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform: translateY(-6px); }
.fan__item:hover .fan__label, .fan__item:focus-visible .fan__label { opacity: 1; transform: none; }
@media (max-width: 900px) {
  .fan__item:hover ~ .fan__item, .fan__item:has(~ .fan__item:hover) { left: 50%; }
  .fan__item:hover .fan__card { transform: translateY(-40px) rotate(calc(var(--rot) * -.35)) scale(1.03); }
}
