/* ============================================================
   lilharper.dev — animations
   ============================================================ */

@keyframes spin-ring {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(0.9); }
}

@keyframes aurora-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(-2%, 1%, 0) scale(1.06); }
}

@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page > * { animation: fade-up 0.45s ease both; }
.page > *:nth-child(2) { animation-delay: 0.05s; }
.page > *:nth-child(3) { animation-delay: 0.1s; }
.page > *:nth-child(4) { animation-delay: 0.15s; }
.page > *:nth-child(5) { animation-delay: 0.2s; }

.rail-card { animation: float-y 6s ease-in-out infinite; }
.rail-card:nth-child(2) { animation-delay: 1.2s; }
.rail-card:nth-child(3) { animation-delay: 2.4s; }

/* ------------------------------------------------------------
   Scroll reveal (js/reveal.js)

   Both classes are applied by JS and never appear in the HTML, so a
   failed/blocked script leaves every element visible and un-animated
   rather than permanently hidden. That's the whole safety argument for
   doing it this way; see the header comment in js/reveal.js.

   `will-change` is set only while an element is waiting to arrive and
   dropped once it has, so the compositor isn't holding a layer for
   every card on a long page forever.
   ------------------------------------------------------------ */
.lh-reveal {
  opacity: 0;
  transform: translateY(18px);
  will-change: opacity, transform;
}
.lh-reveal-in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: auto;
}

/* Grid children stagger against each other so a row of cards arrives as
   a sweep rather than a single block. Capped at six: past that the last
   card waits long enough to read as broken rather than choreographed. */
.value-grid > .lh-reveal-in:nth-child(2),
.resource-grid > .lh-reveal-in:nth-child(2) { transition-delay: 0.06s; }
.value-grid > .lh-reveal-in:nth-child(3),
.resource-grid > .lh-reveal-in:nth-child(3) { transition-delay: 0.12s; }
.value-grid > .lh-reveal-in:nth-child(4),
.resource-grid > .lh-reveal-in:nth-child(4) { transition-delay: 0.18s; }
.value-grid > .lh-reveal-in:nth-child(5),
.resource-grid > .lh-reveal-in:nth-child(5) { transition-delay: 0.24s; }
.value-grid > .lh-reveal-in:nth-child(n+6),
.resource-grid > .lh-reveal-in:nth-child(n+6) { transition-delay: 0.3s; }

/* ------------------------------------------------------------
   Card lift. Cheap, compositor-only (transform + shadow), and applied
   to the card types that are already interactive or self-contained.
   Deliberately not on .callout or .pull-quote: those are prose, and
   prose that moves when the cursor crosses it is distracting.
   ------------------------------------------------------------ */
.value, .resource-card {
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.value:hover, .resource-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35), 0 0 18px rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.45);
}

/* Printing never scrolls, so anything still waiting to be revealed would
   print as blank space. Force everything visible on paper. */
@media print {
  .lh-reveal, .lh-reveal-in { opacity: 1 !important; transform: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  /* reveal.js already skips its observer entirely under reduced motion,
     but if either class somehow lands, neutralise both rather than
     leaving an element stuck at opacity 0. */
  .lh-reveal, .lh-reveal-in { opacity: 1; transform: none; transition: none; }
  .value:hover, .resource-card:hover { transform: none; }
}
