/* ==========================================================================
   Alkando — entrance motion, shared by the home and feature pages.

   Elements marked data-reveal / data-reveal-group start hidden and play
   their entrance once, when they scroll into view (reveal.js). The hidden
   state only applies under html.reveal-ready, which reveal.js sets — if the
   script never runs, nothing is left invisible.

   Everything here animates opacity and transform (or the individual
   `scale` / `translate` properties) only. Entrances ease out; the two
   "arrival" moves (cards, bubbles) get a small overshoot, kept mild.
   ========================================================================== */

:root {
  --rv-out: cubic-bezier(0.23, 1, 0.32, 1);
  --rv-back: cubic-bezier(0.22, 1.25, 0.36, 1);
  --rv-pop: cubic-bezier(0.34, 1.5, 0.64, 1);
}

.reveal-ready [data-reveal]:not(.is-in),
.reveal-ready [data-reveal-group]:not(.is-in) > * {
  opacity: 0;
}

/* --- single element rising in --- */
[data-reveal="up"].is-in {
  animation: rvUp 760ms var(--rv-out) backwards;
}

/* --- children one after another --- */
[data-reveal-group="rows"].is-in > *,
[data-reveal-group="up"].is-in > * {
  animation: rvUp 680ms var(--rv-out) backwards;
  animation-delay: calc(var(--rv-i, 0) * 70ms);
}

@keyframes rvUp {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: none; }
}

/* --- headings, word by word, out of a blur --- */
.rv-w {
  display: inline-block;
}

[data-reveal="words"].is-in {
  animation: none;
}

.reveal-ready [data-reveal="words"].is-in {
  opacity: 1;
}

[data-reveal="words"].is-in .rv-w {
  animation: rvWord 820ms var(--rv-out) backwards;
  animation-delay: calc(var(--rv-i, 0) * 85ms);
}

@keyframes rvWord {
  from { opacity: 0; transform: translateY(0.5em) rotate(4deg); filter: blur(10px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

/* --- cards dealt onto the table --- */
[data-reveal-group="deal"].is-in > * {
  animation: rvDeal 1000ms var(--rv-back) backwards;
  animation-delay: calc(120ms + var(--rv-i, 0) * 95ms);
}

@keyframes rvDeal {
  from {
    opacity: 0;
    transform: translateY(110px) rotate(var(--rv-rot, -4deg)) scale(0.9);
  }
  to { opacity: 1; transform: none; }
}

/* --- bubbles popping in (uses `scale`, so it never fights the parallax
   transform modes.js writes on the same elements) --- */
[data-reveal-group="pop"].is-in > * {
  animation: rvPop 900ms var(--rv-pop) backwards;
  animation-delay: calc(var(--rv-i, 0) * 60ms);
}

@keyframes rvPop {
  from { opacity: 0; scale: 0.2; }
  to { opacity: 1; scale: 1; }
}

/* --- FAQ answers slide open instead of snapping (where supported) --- */
@supports (interpolate-size: allow-keywords) {
  :root {
    interpolate-size: allow-keywords;
  }

  .hfaq__q::details-content,
  .help__q::details-content {
    height: 0;
    overflow: clip;
    transition:
      height 360ms var(--rv-out),
      content-visibility 360ms allow-discrete;
  }

  .hfaq__q[open]::details-content,
  .help__q[open]::details-content {
    height: auto;
  }
}

.hfaq__q[open] p,
.help__q[open] p {
  animation: rvUp 420ms var(--rv-out) backwards;
}

/* --- feature page hero: plays on load, no script needed --- */
.feat__hero > * {
  animation: rvUp 760ms var(--rv-out) backwards;
}

.feat__hero > :nth-child(2) { animation-delay: 70ms; }
.feat__hero > :nth-child(3) { animation-delay: 140ms; }
.feat__hero > :nth-child(4) { animation-delay: 210ms; }
.feat__hero > :nth-child(5) { animation-delay: 280ms; }

.feat__hero .feat__tile {
  animation: rvPop 900ms var(--rv-pop) backwards;
}

/* Reduced motion: things still appear, they just fade. */
@media (prefers-reduced-motion: reduce) {
  [data-reveal="up"].is-in,
  [data-reveal-group].is-in > *,
  [data-reveal="words"].is-in .rv-w,
  .hfaq__q[open] p,
  .help__q[open] p,
  .feat__hero > *,
  .feat__hero .feat__tile {
    animation: rvFade 400ms ease backwards;
    animation-delay: 0ms;
  }

  .hfaq__q::details-content,
  .help__q::details-content {
    transition: none;
  }
}

@keyframes rvFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
