/* ============================================================
   Animations — scroll reveals and the page curtain.

   Deliberately restrained: short fades and small translations only.
   Nothing pulses, nothing glows, nothing loops forever. Anything that
   would keep moving after the page settles does not belong here.
   ============================================================ */

/* ---- Scroll reveal ----
   Elements start slightly offset and settle once observed. Without JS
   the noscript rule in the layout shows them immediately. */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Stagger children of a revealed group */
[data-reveal-group] > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}
[data-reveal-group].is-visible > * {
  opacity: 1;
  transform: none;
}

/* ---- Page curtain ---- */
@keyframes curtain-reveal {
  from { transform: translateY(0); }
  to   { transform: translateY(-100%); }
}

@keyframes curtain-cover {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ---- Spinner ----
   The only looping animation in the system, and it only exists while a
   request is genuinely in flight. */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Flash message entry ---- */
.alert[data-flash] {
  animation: flash-in 0.4s var(--ease) both;
}

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-reveal-group] > * {
    opacity: 1 !important;
    transform: none !important;
  }
  .js .page-curtain { display: none; }
  .spinner { animation-duration: 1.6s; }
}
