/* Scroll reveal + page-header rise + smooth anchors: the exact values from the mosque site (2026).
   Base styles are the finished state. Blocks are hidden only when ALL of these hold: the visitor allows motion,
   html has .reveal-on (set by reveal-head.js before paint) and the block has not been revealed yet. */
:root { --ease-out: cubic-bezier(.16, 1, .3, 1); --t-hover: 150ms; }
@keyframes rise-in { from { opacity: 0; translate: 0 12px; } }

@media (prefers-reduced-motion: no-preference) {
  /* Smooth jumps for in-page links (table-of-contents chips). Add scroll-margin-top on targets under a sticky header. */
  html { scroll-behavior: smooth; }

  /* Page header: title, lede and buttons rise in one after another on arrival (no observer needed: it is on screen). */
  .pagehead > * { animation: rise-in .55s var(--ease-out) backwards; }
  .pagehead > :nth-child(2) { animation-delay: 70ms; }
  .pagehead > :nth-child(3) { animation-delay: 140ms; }
  .pagehead > :nth-child(n+4) { animation-delay: 210ms; }

  /* Scroll reveal. The transition lists `transform` separately so a card's own hover lift (transform) keeps its
     quick 150 ms timing and is never delayed by --rd. Animate translate/scale, not transform. */
  html.reveal-on :is([data-reveal-group] > *, [data-reveal]) {
    transition: opacity .6s var(--ease-out) var(--rd, 0ms), translate .7s var(--ease-out) var(--rd, 0ms),
      scale .7s var(--ease-out) var(--rd, 0ms), transform var(--t-hover) var(--ease-out);
  }
  html.reveal-on :is([data-reveal-group] > *, [data-reveal]):not(.revealed) { opacity: 0; translate: 0 26px; scale: .975; }
  /* Phones: shorter travel, so it reads as a settle rather than a jump on a small screen. */
  @media (max-width: 640px) {
    html.reveal-on :is([data-reveal-group] > *, [data-reveal]):not(.revealed) { translate: 0 18px; scale: .985; }
  }
}

/* Printing never shows hidden blocks. */
@media print {
  html.reveal-on :is([data-reveal-group] > *, [data-reveal]) { opacity: 1 !important; translate: none !important; scale: none !important; }
}
