/* ============================================================
   Event icons: quiet, per-icon motion.
   Load after styles.css. Replaces the shared ev-bob / ev-halo / ev-glow.
   Each icon rests most of the time and plays one small accent per cycle.
   Only transform and opacity animate.
   ============================================================ */

/* 1. Retire the generic motion from styles.css (bob, halo ring, glow) */
.ev .ev-icon { animation: none !important; transform: none; }
.ev .ev-node::after { content: none; animation: none; }

/* Sheen and glint overlays sit invisible at rest */
.ia-hal-sheen, .ia-ring-flash, .ia-ring-glint { opacity: 0; }

/* SVG parts that scale or rotate do it around their own box */
.ia-ring-glint, .ia-ring-spark, .ia-dho-body, .ia-gar, .ia-ban-spark {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}
.ia-gar { transform-origin: 50% 0; } /* garland hangs from its top */

@media (prefers-reduced-motion: no-preference) {
  /* 2. Entrance, once, when the card scrolls in: a soft settle, no spin or overshoot */
  .js .ev .ev-node {
    opacity: 0;
    transform: scale(.94);
    transition: opacity .5s var(--ease), transform .7s var(--ease);
  }
  .js .ev .ev-icon {
    opacity: 0;
    transform: translateY(3px);
    transition: opacity .6s var(--ease) .12s, transform .8s var(--ease) .12s;
  }
  .js .ev.in .ev-node, .js .ev.in .ev-icon { opacity: 1; transform: none; }

  /* Idle accents wait for the entrance, so each icon's first accent greets the guest */
  .js .ev:not(.in) .ia-a { animation-play-state: paused; }

  /* 3. Haldi: a broad turmeric sheen sweeps the heap every 9s */
  .ia-hal-sheen { animation: ia-hal-sheen 9s cubic-bezier(.37, 0, .63, 1) 1.1s infinite; }
  @keyframes ia-hal-sheen {
    0%   { opacity: 0; transform: translateX(0); }
    4%   { opacity: 1; }
    20%  { opacity: 1; }
    24%  { opacity: 0; transform: translateX(150px); }
    100% { opacity: 0; transform: translateX(150px); }
  }

  /* 4. Ring: the gem catches the light once every 6.5s, the gold sparkle answers */
  .ia-ring-flash { animation: ia-ring-flash 6.5s var(--ease) .9s infinite; }
  .ia-ring-glint { animation: ia-ring-glint 6.5s var(--ease) .9s infinite; }
  .ia-ring-spark { animation: ia-ring-spark 6.5s cubic-bezier(.37, 0, .63, 1) .9s infinite; }
  @keyframes ia-ring-flash {
    0%   { opacity: 0; }
    3%   { opacity: .4; }
    12%  { opacity: 0; }
    100% { opacity: 0; }
  }
  @keyframes ia-ring-glint {
    0%   { opacity: 0; transform: scale(.4) rotate(0deg); }
    4%   { opacity: 1; transform: scale(1) rotate(30deg); }
    14%  { opacity: 0; transform: scale(.6) rotate(60deg); }
    100% { opacity: 0; transform: scale(.4) rotate(60deg); }
  }
  @keyframes ia-ring-spark {
    0%, 6% { opacity: 1; transform: scale(1) rotate(0deg); }
    11%    { opacity: .55; transform: scale(.82) rotate(20deg); }
    20%    { opacity: 1; transform: scale(1) rotate(90deg); }
    100%   { opacity: 1; transform: scale(1) rotate(90deg); }
  }

  /* 5. Dholak: two soft beats (ta, dhin) every 5.2s; the sound lines carry outward */
  .ia-dho-body { animation: ia-dho-beat 5.2s cubic-bezier(.37, 0, .63, 1) .8s infinite; }
  .ia-dho-r1 { animation: ia-dho-r 5.2s var(--ease) .8s infinite; }
  .ia-dho-l1 { animation: ia-dho-l 5.2s var(--ease) .8s infinite; }
  .ia-dho-r2 { animation: ia-dho-r 5.2s var(--ease) .9s infinite; }
  .ia-dho-l2 { animation: ia-dho-l 5.2s var(--ease) .9s infinite; }
  .ia-dho-r1, .ia-dho-l1, .ia-dho-r2, .ia-dho-l2 { opacity: .45; }
  @keyframes ia-dho-beat {
    0%   { transform: scale(1); }
    2.5% { transform: scale(1.035); }
    7%   { transform: scale(1); }
    9.5% { transform: scale(1.022); }
    15%  { transform: scale(1); }
    100% { transform: scale(1); }
  }
  @keyframes ia-dho-r {
    0%   { opacity: .45; transform: translateX(0); }
    3%   { opacity: .95; transform: translateX(3px); }
    8%   { opacity: .45; transform: translateX(1px); }
    10%  { opacity: .8;  transform: translateX(2.5px); }
    20%  { opacity: .45; transform: translateX(0); }
    100% { opacity: .45; transform: translateX(0); }
  }
  @keyframes ia-dho-l {
    0%   { opacity: .45; transform: translateX(0); }
    3%   { opacity: .95; transform: translateX(-3px); }
    8%   { opacity: .45; transform: translateX(-1px); }
    10%  { opacity: .8;  transform: translateX(-2.5px); }
    20%  { opacity: .45; transform: translateX(0); }
    100% { opacity: .45; transform: translateX(0); }
  }

  /* 6. Garland: hangs still; every 11s a breeze swings it from the top and it settles */
  .ia-gar { animation: ia-gar 11s cubic-bezier(.37, 0, .63, 1) .6s infinite; }
  @keyframes ia-gar {
    0%   { transform: rotate(0deg); }
    9%   { transform: rotate(3deg); }
    20%  { transform: rotate(-1.8deg); }
    30%  { transform: rotate(.8deg); }
    39%  { transform: rotate(-.3deg); }
    46%  { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
  }

  /* 7. Bangles: the gold bangle lifts and clinks down every 7.5s; the sparkle answers the clink */
  .ia-ban-top { animation: ia-ban-top 7.5s cubic-bezier(.37, 0, .63, 1) 1s infinite; /* lift, then a quick drop with no rebound */ }
  .ia-ban-spark { animation: ia-ban-spark 7.5s var(--ease) 1s infinite; }
  .ia-ban-spark { opacity: .6; }
  @keyframes ia-ban-top {
    0%   { transform: translateY(0); }
    5%   { transform: translateY(-7px); }
    8%   { transform: translateY(0); }
    100% { transform: translateY(0); }
  }
  @keyframes ia-ban-spark {
    0%, 8% { opacity: .6; transform: scale(.85) rotate(0deg); }
    11%    { opacity: 1;  transform: scale(1.05) rotate(30deg); }
    24%    { opacity: .6; transform: scale(.85) rotate(90deg); }
    100%   { opacity: .6; transform: scale(.85) rotate(90deg); }
  }
}

/* 8. Reduced motion: icons stay still; the node only fades in once */
@media (prefers-reduced-motion: reduce) {
  .js .ev .ev-node { opacity: 0; transform: none; transition: opacity .5s ease-out; }
  .js .ev.in .ev-node { opacity: 1; }
  .ia-ban-spark { opacity: .6; }
  .ia-dho-r1, .ia-dho-l1, .ia-dho-r2, .ia-dho-l2 { opacity: .6; }
}
