/*
 * Kien IELTS motion tokens. Interaction feedback only — no layout, scale or blur.
 * Exam room (.exam-workspace) is kept stable: colour/border feedback only.
 */
:root {
  --kien-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --kien-dur-press: 140ms;   /* hover / button feedback */
  --kien-dur-enter: 200ms;   /* browse content change */
  --kien-dur-open: 180ms;    /* menu, dialog, panel open */
  --kien-dur-close: 120ms;
  --kien-stagger: 30ms;
  --kien-shift: 6px;
  --kien-dur-scroll-min: 240ms;
  --kien-dur-scroll-max: 380ms;
  --kien-dur-scroll-touch-min: 720ms;
  --kien-dur-scroll-touch-max: 1400ms;
  --kien-scroll-touch-ms-per-pixel: 0.65;
}

/* Only the pane currently owned by the navigation adapter: native smooth
   scrolling and scroll anchoring must not compete with its GPU glide. */
.exam-pane-scroll.kien-question-scrolling {
  scroll-behavior: auto !important;
  overflow-anchor: none;
}
.exam-pane-scroll.kien-question-scrolling > * {
  will-change: transform;
  backface-visibility: hidden;
}

/* Control feedback: only paint properties, never `all`. */
#root button,
#root a,
#root [role="tab"],
#root [role="menuitem"],
#root input,
#root select,
#root textarea {
  transition-property: color, background-color, border-color, opacity, box-shadow, text-decoration-color;
  transition-duration: var(--kien-dur-press);
  transition-timing-function: var(--kien-ease);
}

/* Question strip: buttons keep their original hit areas, never a painted box.
   Keyboard focus uses an underline rather than a rectangular outline. */
.exam-question-nav-button,
.exam-passage-nav-button {
  transition-property: color, background-color, border-color;
  transition-duration: var(--kien-dur-press);
  transition-timing-function: var(--kien-ease);
}
.exam-question-nav-button,
.exam-question-nav-button:is(:hover, :active, :focus, :focus-visible, .is-active) {
  border-color: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}
.exam-question-nav-button:focus-visible {
  text-decoration: underline !important;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.exam-passage-nav-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Never animate typing, the timer or the divider. */
.exam-workspace input,
.exam-workspace textarea,
.exam-workspace [contenteditable] { transition-property: border-color, box-shadow; }

/* Reduced motion: every animation plays once in 1ms (so it lands on its resting
   state). The iteration count matters: a 1ms *infinite* loop strobes. */
@media (prefers-reduced-motion: reduce) {
  #root *,
  #root *::before,
  #root *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  /* Spinners are progress feedback, not decoration: keep a slow, even turn. */
  #root .animate-spin {
    animation-duration: 3s !important;
    animation-iteration-count: infinite !important;
    animation-timing-function: linear !important;
  }
}

/* Sliding underline under the active question number (no box). */
.exam-question-nav-button.is-active { color: var(--exam-blue, #1f5fbf) !important; font-weight: 700 !important; }
.kien-q-underline {
  position: absolute;
  left: 0;
  height: 3px;
  border-radius: 3px;
  background: var(--exam-blue, #1f5fbf);
  pointer-events: none;
  transform-origin: center;
  will-change: transform, filter;
  z-index: 1;
}

/* Lenis owns desktop exam-pane scrolling; native smooth scrolling must not
   compete with it. Nested scrollers keep their own overscroll. */
.exam-pane-scroll.lenis.lenis-smooth { scroll-behavior: auto !important; }
.exam-pane-scroll.lenis [data-lenis-prevent] { overscroll-behavior: contain; }

/* Submit overlay: the "Evaluating your answers..." label stays still; the
   spinner alone shows progress (the built-in pulse read as flicker). */
#root .fixed.inset-0.z-50 > .animate-pulse.bg-\[\#d32f2f\] { animation: none !important; }
/* Submit spinner: the original SVG icon rotates on the main thread, so while the
   test is being marked and the results window renders it skips frames and reads
   as a fast, jerky pinwheel. Replace it with an identical-looking ring drawn by
   an HTML pseudo-element, whose transform animation runs on the compositor and
   stays even no matter how busy the page is. Same 64px box, colour and arc. */
#root .fixed.inset-0.z-50 > svg.animate-spin { display: none !important; }
#root .fixed.inset-0.z-50:has(> svg.animate-spin)::after {
  content: "";
  box-sizing: border-box;
  width: 48px;
  height: 48px;
  margin: 8px;
  border: 5px solid #d32f2f;
  border-top-color: transparent;
  border-radius: 50%;
  will-change: transform;
  animation: kien-submit-spin 1.4s linear infinite !important;
}
@keyframes kien-submit-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  #root .fixed.inset-0.z-50:has(> svg.animate-spin)::after {
    animation-duration: 3s !important;
    animation-iteration-count: infinite !important;
    animation-delay: 0ms !important;
  }
}
