/* Unritten CSS animations. Load after tokens.css.
   Motion rules: rings grow outward at a steady pace, fade as they travel, settle within 600ms.
   The state dot breathes on a 2.4s cycle. Screen changes fade over 200ms. No bounces. */

:root {
  --motion-fade: 200ms;
  --motion-settle: 600ms;
  --motion-breathe: 2400ms;
  --motion-ripple: 2400ms;
  --ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

/* 1. Breathing dot: the "listening" / "thinking" indicator */
.un-breathe { animation: un-breathe var(--motion-breathe) ease-in-out infinite; }
@keyframes un-breathe { 50% { opacity: .35; transform: scale(.7); } }

/* 2. CSS-only ripple: three rings spreading from a dot.
   Markup: <span class="un-ripple un-ripple-applicant" aria-hidden="true"><i></i><i></i><i></i></span> */
.un-ripple { position: relative; display: inline-block; width: 48px; height: 48px; }
.un-ripple::before { content: ""; position: absolute; inset: 40%; border-radius: 50%; background: currentColor; }
.un-ripple i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid currentColor; opacity: 0; transform: scale(.25);
  animation: un-ring var(--motion-ripple) var(--ease-out-soft) infinite; }
.un-ripple i:nth-child(2) { animation-delay: calc(var(--motion-ripple) / 3); }
.un-ripple i:nth-child(3) { animation-delay: calc(var(--motion-ripple) / 3 * 2); }
.un-ripple-applicant { color: var(--voice-applicant); }
.un-ripple-interviewer { color: var(--voice-interviewer); }
@keyframes un-ring { 0% { opacity: .9; transform: scale(.25); } 100% { opacity: 0; transform: scale(1); } }

/* 3. Loading: the mark's rings light up in turn (use on the "thinking" state or page loads).
   Inline the mark SVG, wrap it in .un-mark-loading and give each ring group class="un-arc" (copy the ready markup from preview.html). */
.un-mark-loading .un-arc { animation: un-arc 1.2s ease-in-out infinite; }
.un-mark-loading .un-arc:nth-of-type(2) { animation-delay: .15s; }
.un-mark-loading .un-arc:nth-of-type(3) { animation-delay: .3s; }
@keyframes un-arc { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* 4. Turn handover: a dot passes from the interviewer's side to the applicant's */
.un-handover { position: relative; width: 120px; height: 12px; }
.un-handover::after { content: ""; position: absolute; top: 2px; left: 0; width: 8px; height: 8px; border-radius: 50%;
  background: var(--voice-interviewer); animation: un-handover 900ms var(--ease-out-soft) forwards; }
@keyframes un-handover { to { left: calc(100% - 8px); background: var(--voice-applicant); } }

/* 5. Screen change */
.un-fade-in { animation: un-fade var(--motion-fade) ease-out both; }
@keyframes un-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .un-breathe, .un-ripple i, .un-mark-loading .un-arc, .un-handover::after, .un-fade-in { animation: none; }
  .un-ripple i { opacity: .4; transform: scale(.7); }
  .un-handover::after { left: calc(100% - 8px); background: var(--voice-applicant); }
}
