/* ==========================================================================
   ANIMATIONS — CSS-first motion. Everything degrades gracefully:
   - no JS  → content is simply visible (reveals only activate when html.reveal-ready)
   - reduced motion → all movement is disabled at the bottom of this file
   Individual transform properties (translate / scale / rotate) are used so that
   animations never clobber the decorative `transform: rotate()` on stickers & cards.
   ========================================================================== */

@keyframes rise { from { opacity: 0; translate: 0 22px; } to { opacity: 1; translate: 0 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes twinkle { 0%, 100% { scale: 1; opacity: .85; } 50% { scale: 1.22; opacity: 1; } }
@keyframes drift { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@keyframes spin { to { rotate: 360deg; } }
@keyframes pop { from { opacity: 0; translate: 0 14px; scale: .98; } to { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* Page-load entrance + hero stagger (pure CSS) */
body { animation: fade .5s ease both; }
[data-anim] { animation: rise .75s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 90ms + 60ms); }

/* Decorative stars */
.star { animation: twinkle 3.6s ease-in-out infinite; }
.hero__star--b { animation-delay: .9s; }
.hero__star--c { animation-delay: 1.8s; }
.pill__dot { animation: pulse-dot 1.8s ease-in-out infinite; }
.collage .sticker { animation: drift 5s ease-in-out infinite; }
.collage__s2 { animation-delay: .8s !important; }
.collage__s3 { animation-delay: 1.6s !important; }

/* Scroll reveals (activated by js/animations.js adding html.reveal-ready) */
.reveal-ready .reveal {
  opacity: 0; translate: 0 26px;
  transition: opacity .7s ease var(--d, 0ms), translate .7s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms),
              transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.reveal-ready .reveal.is-visible { opacity: 1; translate: 0 0; }

/* Category filtering on the blog */
.is-entering { animation: pop .4s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--n, 0) * 45ms); }

/* Loading states */
.btn.is-loading .btn__label::after {
  content: ""; display: inline-block; width: 1em; height: 1em; margin-left: .6em; vertical-align: -.15em;
  border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
}
.skeleton { background: linear-gradient(100deg, var(--surface) 30%, var(--white) 50%, var(--surface) 70%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.is-searching .post-grid { opacity: .55; transition: opacity .15s; }

/* Success stamp */
.nl-form__status.is-success { animation: pop .45s cubic-bezier(.3, 1.5, .5, 1) both; }
.shake { animation: shake .4s ease; }
@keyframes shake { 20%, 60% { translate: -5px 0; } 40%, 80% { translate: 5px 0; } }

/* Disclosure panels (Vault categories) */
.disclosure { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s cubic-bezier(.3, .7, .2, 1); }
.disclosure > div { overflow: hidden; min-height: 0; }
.disclosure[data-open="true"] { grid-template-rows: 1fr; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: .001ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
  .reveal-ready .reveal { opacity: 1; translate: none; }
}
