/*
 * Drop motion layer.
 *
 * Deliberately a separate file from sheet.css, which is generated by
 * tools/extract-sheet.py and would be overwritten on the next extraction.
 * Loaded after it, so these rules win without editing generated output.
 *
 * Techniques, by the codes on akanoodles.com/motion:
 *   SCR-01  build-in            section blocks arrive on first scroll into view
 *   SEQ-01  stagger             children offset so a row reads as a group
 *   UI-03   blur materialisation  the house enter: opacity + translateY + blur
 *   SPC-06  wipe reveal         hero headline, via SCR-03 clip-path
 *   TYP-02  metric-compensated emphasis  hero accent gains weight, no reflow
 *   TYP-03  hierarchy reflow    pricing figures lead on arrival
 *   CRF-01  light sweep         primary CTA, one shot on hover
 *   CRF-02  background movement slow aurora drift
 *   UI-05/07 feedback           press scale on anything clickable
 *   EAS-01/03 easing + duration one curve set, duration by element size
 *   ACC-01  prefers-reduced-motion  at the bottom, covers everything above
 *
 * Weighting: Jakub primary (production polish), Emil secondary (restraint).
 * Drop sells governed, audited tooling to regulated enterprises, so nothing
 * bounces and nothing loops. Only transform, opacity, filter and clip-path
 * animate, so this stays off the layout path (UI-10).
 */

.drop-sheet {
  /* EAS-01. No bare `ease` anywhere: it has no strength at these durations. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* EAS-03. Duration by element size, not one value for everything. */
  --dur-sm: 240ms;
  --dur-md: 420ms;
  --dur-lg: 620ms;

  /* SEQ-01. Base step; children multiply it by their index. */
  --stagger: 70ms;
}

/* ------------------------------------------------------------------ SCR-01
 * Build-in. The observer adds .is-in once, so a section never replays and
 * never animates out.
 *
 * Keyframes rather than a transition, despite transitions normally being the
 * better default for interruptibility. The cards below also want a transform
 * transition for their hover lift, and a second `transition` declaration on
 * the same element silently resets transition-delay to 0, which killed the
 * stagger on the feature and pricing grids. An animation cannot be clobbered
 * that way, and interruptibility is moot here: a build-in fires once and is
 * never user-retriggerable.
 *
 * `both` fill mode holds the start frame during the stagger delay, so nothing
 * flashes at full opacity before its turn.
 */
@keyframes drop-build-in {
  from {
    opacity: 0;
    transform: translateY(var(--build-shift, 14px));
    filter: blur(var(--build-blur, 4px));
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

.drop-sheet [data-build],
.drop-sheet [data-build-child] {
  opacity: 0;
}

.drop-sheet [data-build].is-in {
  animation: drop-build-in var(--dur-md) var(--ease-out) both;
}

/* SEQ-01. --i is set per group by the observer, so each grid restarts at 0. */
.drop-sheet [data-build-child] {
  --build-shift: 18px;
  --build-blur: 5px;
}

.drop-sheet [data-build-child].is-in {
  animation: drop-build-in var(--dur-md) var(--ease-out)
    calc(var(--i, 0) * var(--stagger)) both;
}

/* ------------------------------------------------- SPC-06 via SCR-03
 * Hero headline wipe. clip-path is GPU-composited and causes no layout
 * shift, which matters on a 96px display face where a reflow would be
 * obvious. Each line is its own mask so they uncover in sequence.
 */
.drop-sheet .hero-title [data-line] {
  display: block;
  clip-path: inset(0 0 100% 0);
  transform: translateY(0.14em);
  transition:
    clip-path var(--dur-lg) var(--ease-out),
    transform var(--dur-lg) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 110ms);
}

.drop-sheet .hero-title.is-in [data-line] {
  clip-path: inset(0 0 -0.12em 0);
  transform: none;
}

/* ------------------------------------------------------------------ TYP-02
 * Metric-compensated emphasis. The accent settles into its final weight
 * after the wipe. Animating font-variation-settings alone would reflow and
 * nudge the line, so the optical weight comes from a hairline text-shadow
 * and the metrics never change. Nothing moves; it just firms up.
 */
.drop-sheet .hero-title-accent {
  --accent-weight: 0;
  text-shadow:
    calc(var(--accent-weight) * 0.012em) 0 0 currentColor,
    calc(var(--accent-weight) * -0.012em) 0 0 currentColor;
  transition: text-shadow var(--dur-lg) var(--ease-in-out) 420ms;
}

.drop-sheet .hero-title.is-in .hero-title-accent {
  --accent-weight: 1;
}

/* ------------------------------------------------------------------ TYP-03
 * Hierarchy reflow. On arrival the figure leads and its label follows, so
 * the eye lands on the number rather than reading left to right.
 */
.drop-sheet [data-figure] {
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  transition:
    opacity var(--dur-md) var(--ease-out),
    transform var(--dur-md) var(--ease-out);
}

.drop-sheet [data-figure].is-in {
  opacity: 1;
  transform: none;
}

.drop-sheet [data-figure-label] {
  opacity: 0;
  transition: opacity var(--dur-md) var(--ease-out) 160ms;
}

.drop-sheet [data-figure-label].is-in {
  opacity: 1;
}

/* ------------------------------------------------------------------ CRF-01
 * Light sweep. One shot on hover, not a loop. Runs on a ::after so the
 * button's own background is untouched, and only transform moves.
 */
.drop-sheet .btn-primary,
.drop-sheet .pricing-card-cta-primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.drop-sheet .btn-primary::after,
.drop-sheet .pricing-card-cta-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.42) 50%,
    transparent 80%
  );
  transform: translateX(-120%);
  transition: transform 620ms var(--ease-out);
}

.drop-sheet .btn-primary:hover::after,
.drop-sheet .pricing-card-cta-primary:hover::after {
  transform: translateX(120%);
}

/* ------------------------------------------------------------- UI-05, UI-07
 * Feedback. Press scale on anything clickable. 0.97, never scale(0)-style
 * jumps. Deliberately instant-ish: this is high frequency, so it is the one
 * place Emil's speed rule beats polish.
 */
.drop-sheet .btn,
.drop-sheet .pricing-card-cta,
.drop-sheet button {
  transition:
    transform 120ms var(--ease-out),
    background-color var(--dur-sm) var(--ease-out),
    border-color var(--dur-sm) var(--ease-out),
    color var(--dur-sm) var(--ease-out);
}

.drop-sheet .btn:active,
.drop-sheet .pricing-card-cta:active,
.drop-sheet button:active {
  transform: scale(0.97);
}

/* Card hover lift. Small, and shadow-based so it works over the aurora. */
.drop-sheet .feature-card,
.drop-sheet .step-card,
.drop-sheet .pricing-card {
  transition:
    transform var(--dur-sm) var(--ease-out),
    box-shadow var(--dur-sm) var(--ease-out);
}

.drop-sheet .feature-card:hover,
.drop-sheet .step-card:hover,
.drop-sheet .pricing-card:hover {
  transform: translateY(-2px);
}

/* Repairs a generated rule: sheet.css ships `transition: all 0.2s ease`,
 * which animates layout properties and uses a curve with no strength. */
.drop-sheet .btn-arrow {
  transition: transform var(--dur-sm) var(--ease-out);
}

.drop-sheet .btn:hover .btn-arrow {
  transform: translateX(3px);
}

/* ------------------------------------------------------------------ CRF-02
 * Background movement. The hero already carries an aurora; this drifts it
 * slowly so the section is not completely static. Very low amplitude, and
 * the only looping animation on the page. Paused under reduced motion.
 */
@keyframes drop-aurora-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(1.5%, -1%, 0) scale(1.04); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

.drop-sheet .hero-glow {
  animation: drop-aurora-drift 28s var(--ease-in-out) infinite;
  will-change: transform;
}

/* ------------------------------------------------------------------ ACC-01
 * Everything above collapses to its end state. Nothing is left hidden:
 * every build-in resets to visible rather than simply losing its
 * transition, which is the usual way these fail.
 */
@media (prefers-reduced-motion: reduce) {
  .drop-sheet [data-build],
  .drop-sheet [data-build-child],
  .drop-sheet [data-figure],
  .drop-sheet [data-figure-label],
  .drop-sheet [data-build].is-in,
  .drop-sheet [data-build-child].is-in {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none;
    transition: none;
    transition-delay: 0ms;
  }

  .drop-sheet .hero-title [data-line] {
    clip-path: none;
    transform: none;
    transition: none;
    transition-delay: 0ms;
  }

  .drop-sheet .hero-title-accent {
    --accent-weight: 1;
    transition: none;
  }

  .drop-sheet .hero-glow {
    animation: none;
  }

  .drop-sheet .btn-primary::after,
  .drop-sheet .pricing-card-cta-primary::after {
    display: none;
  }

  .drop-sheet .feature-card:hover,
  .drop-sheet .step-card:hover,
  .drop-sheet .pricing-card:hover,
  .drop-sheet .btn:active,
  .drop-sheet button:active {
    transform: none;
  }
}
