/* Shared motion and feedback for the quiz (.qz) and the Contractor Risk Check (.fmc).
   Loaded after each tool's own stylesheet. Everything here switches off under
   prefers-reduced-motion. */
.qz  { --fx: var(--qz-primary); --fx-soft: var(--qz-primary-soft); --fx-ink: #fff; }
.fmc { --fx: var(--orange); --fx-soft: var(--orange-tint); --fx-ink: var(--navy); }

/* progress: one segment per question */
:is(.qz, .fmc) .qtop .bar { position: relative; height: 10px; }
:is(.qz, .fmc) .qtop .bar::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(100% / var(--n) - 3px), var(--fx-gap, #eef1fb) calc(100% / var(--n) - 3px) calc(100% / var(--n))); }
.fmc { --fx-gap: var(--paper); }
:is(.qz, .fmc) .qtop .bar i { transition: width .45s cubic-bezier(.3, 1.3, .5, 1); }

/* kicker above the question */
:is(.qz, .fmc) .kicker { margin-top: 26px; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--fx); }
.fmc .kicker { color: var(--orange-deep); }
:is(.qz, .fmc) .kicker + .qtext { margin-top: 8px; }

/* options: lettered, staggered in, with a tick when picked */
:is(.qz, .fmc) .opts { counter-reset: opt; }
:is(.qz, .fmc) .opt { counter-increment: opt; animation: fx-opt .32s cubic-bezier(.2, .8, .3, 1) both; }
:is(.qz, .fmc) .opt:nth-child(2) { animation-delay: .05s; }
:is(.qz, .fmc) .opt:nth-child(3) { animation-delay: .1s; }
:is(.qz, .fmc) .opt:nth-child(4) { animation-delay: .15s; }
:is(.qz, .fmc) .opt:nth-child(n+5) { animation-delay: .2s; }
@keyframes fx-opt { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
:is(.qz, .fmc) .opt::before { content: counter(opt, upper-alpha); width: 30px; height: 30px; border-radius: 9px; border: 0; background: var(--fx-soft); color: inherit; display: grid; place-items: center; font-size: 13px; font-weight: 800; box-shadow: none; transition: background .15s, color .15s, transform .15s; }
@media (hover: hover) { :is(.qz, .fmc) .opt:hover { transform: translateY(-1px); } :is(.qz, .fmc) .opt:hover::before { background: var(--fx); color: var(--fx-ink); } }
:is(.qz, .fmc) .opt[aria-pressed="true"]::before { content: "✓"; background: var(--fx); color: var(--fx-ink); border: 0; box-shadow: none; animation: fx-pop .28s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes fx-pop { from { transform: scale(.5); } to { transform: scale(1); } }
:is(.qz, .fmc) .keys { display: none; }
@media (hover: hover) and (pointer: fine) { :is(.qz, .fmc) .keys { display: inline; } }

/* the wait before the plan */
:is(.qz, .fmc) .beat .ticks { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; text-align: left; font-size: 16px; font-weight: 700; }
:is(.qz, .fmc) .beat .ticks li { display: flex; align-items: center; gap: 12px; opacity: .35; animation: fx-tick .01s linear forwards; }
:is(.qz, .fmc) .beat .ticks li::before { content: ""; width: 22px; height: 22px; border-radius: 50%; border: 2px solid currentColor; flex-shrink: 0; animation: fx-tickdot .01s linear forwards; }
:is(.qz, .fmc) .beat .ticks li:nth-child(1), :is(.qz, .fmc) .beat .ticks li:nth-child(1)::before { animation-delay: .35s; }
:is(.qz, .fmc) .beat .ticks li:nth-child(2), :is(.qz, .fmc) .beat .ticks li:nth-child(2)::before { animation-delay: .85s; }
:is(.qz, .fmc) .beat .ticks li:nth-child(3), :is(.qz, .fmc) .beat .ticks li:nth-child(3)::before { animation-delay: 1.35s; }
@keyframes fx-tick { to { opacity: 1; } }
@keyframes fx-tickdot { to { border-color: var(--fx); background: var(--fx) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat; } }

/* result sections rise in as they scroll into view (fx.js adds .fx-on, then .fx-in) */
.fx-on [data-rise] { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s cubic-bezier(.2, .8, .3, 1); }
.fx-on [data-rise].fx-in { opacity: 1; transform: none; }

/* a short burst of colour when the result lands */
.fx-burst { position: absolute; left: 50%; top: 64px; width: 0; height: 0; pointer-events: none; z-index: 2; }
.fx-burst i { position: absolute; width: 9px; height: 14px; border-radius: 2px; background: var(--c); opacity: 0; animation: fx-burst 1.3s cubic-bezier(.15, .7, .3, 1) var(--d) forwards; }
@keyframes fx-burst { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)); } }

@media (prefers-reduced-motion: reduce) {
  :is(.qz, .fmc) *, :is(.qz, .fmc) *::before, :is(.qz, .fmc) *::after { animation: none !important; transition: none !important; }
  :is(.qz, .fmc) .beat .ticks li { opacity: 1; }
  .fx-on [data-rise] { opacity: 1; transform: none; }
  .fx-burst { display: none; }
}
