/* ============================================================
   kg-motion-surfaces.css — motion companions for the program's
   NEW surfaces (Animations & Effects lane). Additive only: every
   rule here adds animation/transition to elements other lanes
   built; it changes no layout, color, or copy. Owners wire it
   with ONE link after their own sheet (cascade order is what
   lets the valentine-style substitutions and these companions
   apply). All keyframes are kmx- prefixed, transform/opacity
   ONLY, and every assignment lives inside
   @media (prefers-reduced-motion: no-preference) plus a reduce
   kill block — the seasonal module's house pattern.

   AUDIT BASIS (Nov 3, 2026):
   - Herald (kg-announce.css, Profiles lane): the marquee itself
     is genuine (kg-herald-scroll, transform loop, hover-pause,
     prm static mode) — but the bar APPEARS instantly, DISMISS is
     an instant cut, and the reduced-motion static rotation swaps
     items with a hard display toggle (no fade).
   - Trophy Case (kg-trophy-case.css, Profiles lane): ZERO
     animation or transition in the whole sheet. A page of brass
     and honours that renders like a settings form.
   - DLC cast wrapper (dice-cast.css, DLC lane): the result chip
     pop is genuine (spring-bezier transform transition, dual
     prm gates) — but the persistent pip tray NEVER moves when
     pips/die change, and CRIT!/FUMBLE! chips get the identical
     pop as a plain result. (The animated snake border is the
     DLC lane's own build per its design §6 — this module does
     not touch it; see the notes for a perf review + an offered
     transform-based alternative.)
   ============================================================ */

/* ================= HERALD ================= */
@keyframes kmx-herald-in { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: translateY(0); } }
@keyframes kmx-herald-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-100%); } }
@keyframes kmx-fade-in { from { opacity: 0; } to { opacity: 1; } }
/* dismiss: the owner adds .kmx-herald-out and removes/hides the bar
   after 240ms (spec in the batch notes); the class alone animates. */
.kmx-herald-out { animation: kmx-herald-out 240ms cubic-bezier(.4, 0, .2, 1) both; }

/* ================= TROPHY CASE ================= */
@keyframes kmx-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes kmx-plaque-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes kmx-shine-sweep { 0% { transform: translateX(-130%) skewX(-14deg); opacity: 0; } 18% { opacity: 1; } 82% { opacity: 1; } 100% { transform: translateX(240%) skewX(-14deg); opacity: 0; } }
/* earned plaques get a light sweep on hover; chase plaques (dark
   silhouettes) deliberately get NONE — the shine is part of the reward.
   The plaque box clips the sweep (overflow hidden added here; plaques
   are self-contained cards, nothing in them is meant to overflow). */
.ktc-plaque:not(.is-chase) { position: relative; overflow: hidden; }
.ktc-plaque:not(.is-chase)::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 45%; left: 0;
  pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 243, 196, .16), transparent);
  transform: translateX(-130%) skewX(-14deg);
}

/* ================= DLC CAST ================= */
/* pip tray beats — the owner adds the class when the value changes
   (one-shot; remove on animationend or after the timeout in the spec) */
@keyframes kmx-pip-pulse { 0% { transform: scale(1); } 35% { transform: scale(1.28); } 100% { transform: scale(1); } }
@keyframes kmx-cast-climb { 0% { transform: translateY(4px) scale(.92); opacity: .4; } 55% { transform: translateY(-3px) scale(1.12); opacity: 1; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes kmx-cast-slip { 0% { transform: translateY(-3px); opacity: 1; } 45% { transform: translateY(4px); opacity: .55; } 100% { transform: translateY(0); opacity: 1; } }
/* crit/fumble chip entrances — keyed off the classes dice-cast.js
   already puts on the chip, so these apply with zero JS changes.
   Transform here composes with the chip's own .show transition
   because the animation wins while it runs (420ms), then the
   settled .show state holds. */
@keyframes kmx-crit-beat { 0% { transform: translateX(-50%) scale(.6); } 45% { transform: translateX(-50%) scale(1.14); } 70% { transform: translateX(-50%) scale(.97); } 100% { transform: translateX(-50%) scale(1); } }
@keyframes kmx-fumble-sink { 0% { transform: translateX(-50%) translateY(-8px) scale(.92); opacity: 0; } 100% { transform: translateX(-50%) translateY(3px) scale(1); opacity: 1; } }

/* ================= RADIO BAR + JUKEBOX CHIP (batch: JS-injected CSS) ====
   Both players inject their styles from JS (radio.js injectCSS,
   bgm-player.js ensureCss), so stylesheet censuses never saw them —
   and both have ZERO motion: no transitions, no keyframes, no prm
   handling in their injected CSS. Their ids/classes are stable, so
   this companion treats them from outside; the owners' JS changes
   are two one-liners specced in the batch notes (track-title fade
   re-trigger, radio .is-playing toggle + .req markup). */
/* generic one-shot fade utility (owners re-trigger it on text swaps:
   remove class, force reflow, re-add — the house pattern) */
@keyframes kmx-bar-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
/* playing indicator: three tiny equalizer bars (owner markup:
   <span class="req" aria-hidden="true"><i></i><i></i><i></i></span>
   inside #radioBar; shown only while .is-playing is on the bar) */
#radioBar .req { display: none; align-items: flex-end; gap: 2px; height: 12px; }
#radioBar.is-playing .req { display: inline-flex; }
#radioBar .req i { display: block; width: 3px; height: 12px; background: #d9b45c; transform-origin: 50% 100%; transform: scaleY(.35); }
@keyframes kmx-eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

/* ================================================================
   ASSIGNMENTS — no-preference only (house pattern)
   ================================================================ */
@media (prefers-reduced-motion: no-preference) {
  .kg-herald { animation: kmx-herald-in 380ms cubic-bezier(.22, 1, .36, 1) backwards; }
  .kg-herald-static .kg-herald-item.is-current { animation: kmx-fade-in 260ms ease-out backwards; }

  .ktc-plate { animation: kmx-rise 380ms cubic-bezier(.22, 1, .36, 1) backwards; }
  .ktc-rec { animation: kmx-rise 380ms cubic-bezier(.22, 1, .36, 1) backwards; }
  .ktc-rec:nth-child(2) { animation-delay: .06s; } .ktc-rec:nth-child(3) { animation-delay: .12s; }
  .ktc-rec:nth-child(4) { animation-delay: .18s; } .ktc-rec:nth-child(5) { animation-delay: .24s; }
  .ktc-plaque { animation: kmx-plaque-in 320ms cubic-bezier(.22, 1, .36, 1) backwards; }
  .ktc-plaques .ktc-plaque:nth-child(2) { animation-delay: .05s; } .ktc-plaques .ktc-plaque:nth-child(3) { animation-delay: .1s; }
  .ktc-plaques .ktc-plaque:nth-child(4) { animation-delay: .15s; } .ktc-plaques .ktc-plaque:nth-child(5) { animation-delay: .2s; }
  .ktc-plaques .ktc-plaque:nth-child(6) { animation-delay: .25s; } .ktc-plaques .ktc-plaque:nth-child(7) { animation-delay: .3s; }
  .ktc-plaques .ktc-plaque:nth-child(n+8) { animation-delay: .35s; }
  .ktc-plaque { transition: transform 220ms cubic-bezier(.22, 1, .36, 1); }
  .ktc-plaque:hover { transform: translateY(-2px); }
  .ktc-plaque:not(.is-chase):hover::after { animation: kmx-shine-sweep 650ms cubic-bezier(.4, 0, .2, 1) 1; }
  .ktc-chip { transition: background-color 220ms ease, color 220ms ease, transform 120ms ease-out; }
  .ktc-chip:active { transform: translateY(1px) scale(.97); }
  .ktc-seat { transition: background-color 220ms ease; }

  .kmx-pip-pulse { animation: kmx-pip-pulse 340ms cubic-bezier(.34, 1.35, .4, 1) 1; display: inline-block; }
  .kmx-cast-climb { animation: kmx-cast-climb 420ms cubic-bezier(.22, 1, .36, 1) 1; display: inline-block; }
  .kmx-cast-slip { animation: kmx-cast-slip 420ms cubic-bezier(.4, 0, .2, 1) 1; display: inline-block; }
  .kmx-fade-in { animation: kmx-fade-in 260ms ease-out backwards; }
  #radioBar { animation: kmx-bar-up 320ms cubic-bezier(.22, 1, .36, 1) backwards; }
  #radioBar button { transition: background-color 180ms ease, transform 120ms ease-out; }
  #radioBar button:active { transform: translateY(1px) scale(.96); }
  #radioBar.is-playing .req i { animation: kmx-eq 900ms ease-in-out infinite; }
  #radioBar.is-playing .req i:nth-child(2) { animation-delay: .18s; animation-duration: 760ms; }
  #radioBar.is-playing .req i:nth-child(3) { animation-delay: .36s; animation-duration: 1040ms; }
  .bgm-chip { animation: kmx-rise 320ms cubic-bezier(.22, 1, .36, 1) backwards; }
  .bgm-chip button { transition: color 160ms ease, opacity 200ms ease, transform 120ms ease-out; }
  .bgm-chip button:active { transform: translateY(1px) scale(.94); }
  .dice-cast-chip.crit { animation: kmx-crit-beat 420ms cubic-bezier(.22, 1, .36, 1) both; }
  .dice-cast-chip.fumble { animation: kmx-fumble-sink 460ms cubic-bezier(.4, 0, .2, 1) both; }
}

/* ---------- reduced-motion kill block ---------- */
@media (prefers-reduced-motion: reduce) {
  .kg-herald, .kmx-herald-out, .kg-herald-static .kg-herald-item.is-current,
  .ktc-plate, .ktc-rec, .ktc-plaque, .ktc-plaque:not(.is-chase)::after,
  .kmx-pip-pulse, .kmx-cast-climb, .kmx-cast-slip,
  .dice-cast-chip.crit, .dice-cast-chip.fumble,
  .kmx-fade-in, #radioBar, #radioBar .req i, .bgm-chip { animation: none !important; }
  .ktc-plaque, .ktc-chip, .ktc-seat, #radioBar button, .bgm-chip button { transition: none !important; }
  .ktc-plaque:hover { transform: none !important; }
}
