/* Airfront landing – gentle motion ("paint soaks into paper").
 * One motif, as in the app: a wash appears and spreads a little (opacity 0→1, scale 0.88→1, 420 ms).
 * No loops, no parallax. Everything turns off with prefers-reduced-motion.
 * Elements start hidden only when JS has run (html.af-motion), so the page is fine without JS.
 */

:root {
  --af-ease: cubic-bezier(0.22, 0.61, 0.36, 1); /* soft ease-out */
  --af-soak: 420ms;   /* washes */
  --af-rise: 520ms;   /* phones, cards */
  --af-fade: 300ms;   /* text, calm sections */
  --af-step: 60ms;    /* stagger step for lists */
}

/* 1. Watercolour washes soak in (hero, section art, card art). */
.af-motion .af-soak {
  opacity: 0;
  transform: scale(0.88);
  transition: opacity var(--af-soak) var(--af-ease), transform var(--af-soak) var(--af-ease);
  transition-delay: var(--af-delay, 0ms);
}
.af-motion .af-soak.is-in { opacity: var(--af-opacity, 1); transform: none; }
/* Washes have their own opacity (about 0.3, sky 0.55–0.6): set --af-opacity on the element. */

/* 2. Phones and cards rise a little and fade in. Use --af-delay for the second phone (120 ms). */
.af-motion .af-rise {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--af-rise) var(--af-ease), transform var(--af-rise) var(--af-ease);
  transition-delay: var(--af-delay, 0ms);
}
.af-motion .af-rise.is-in { opacity: 1; transform: none; }

/* 3. Lists: items (watercolour dots + text) appear one after another. Set style="--i: 0, 1, 2…" on items. */
.af-motion .af-stagger > * {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--af-fade) var(--af-ease), transform var(--af-fade) var(--af-ease);
  transition-delay: calc(var(--i, 0) * var(--af-step));
}
.af-motion .af-stagger.is-in > * { opacity: 1; transform: none; }

/* 4. Calm: the asthma section and anything about emergencies only fades, no movement. */
.af-motion .af-calm {
  opacity: 0;
  transition: opacity var(--af-fade) linear;
}
.af-motion .af-calm.is-in { opacity: 1; }

/* 5. Hover on blog cards: the wash behind the plate grows a touch. */
.af-card .af-card-wash { transition: transform 300ms var(--af-ease); }
.af-card:hover .af-card-wash,
.af-card:focus-within .af-card-wash { transform: scale(1.04); }

/* 6. Links: the underline is painted from the left. */
.af-link {
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 250ms var(--af-ease);
}
.af-link:hover,
.af-link:focus-visible { background-size: 100% 1px; }

/* Reduced motion: show everything at once, keep only instant state changes. */
@media (prefers-reduced-motion: reduce) {
  .af-motion .af-soak,
  .af-motion .af-rise,
  .af-motion .af-stagger > *,
  .af-motion .af-calm {
    opacity: var(--af-opacity, 1);
    transform: none;
    transition: none;
  }
  .af-card .af-card-wash,
  .af-link { transition: none; }
}
