/* Quiet Classroom — site-wide whimsy layer (Direction 1 + two calm Mascot borrows)
   Calm, paced, no flashing. prefers-reduced-motion kills loops. */

:root {
  --qc-fast: 180ms;
  --qc-med: 280ms;
  --qc-slow: 600ms;
  --qc-rest: 3.2s;
  --qc-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Extra aurora blobs — very low contrast, slow drift */
.stage .aurora {
  position: absolute;
  inset: -10% -5%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 42% 36% at 18% 28%, rgba(107, 92, 224, 0.09), transparent 70%),
    radial-gradient(ellipse 38% 32% at 82% 62%, rgba(168, 155, 255, 0.06), transparent 72%);
  animation: qc-aurora 26s ease-in-out infinite alternate;
  opacity: 0.9;
}
@keyframes qc-aurora {
  0% { transform: translate3d(0, 0, 0) scale(1); filter: hue-rotate(0deg); }
  100% { transform: translate3d(1.2%, -1.4%, 0) scale(1.03); filter: hue-rotate(8deg); }
}

/* Progress bloom when width changes */
.progress-fill {
  box-shadow: 0 0 0 0 rgba(168, 155, 255, 0);
  transition: width 0.55s var(--qc-ease), box-shadow 0.7s var(--qc-ease);
}
.progress-fill.is-bloom {
  box-shadow: 0 0 14px 2px rgba(168, 155, 255, 0.45);
}
.progress-track {
  position: relative;
}
.progress-track::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 99px;
  box-shadow: 0 0 0 0 rgba(107, 92, 224, 0);
  pointer-events: none;
  transition: box-shadow 0.8s var(--qc-ease);
}
.progress.is-tick .progress-track::after {
  box-shadow: 0 0 18px 1px rgba(107, 92, 224, 0.28);
}

/* Soft breathing on active progress label */
.progress #step-label {
  transition: color var(--qc-med) var(--qc-ease), text-shadow 1.2s var(--qc-ease);
}
.progress.is-tick #step-label {
  color: var(--purple-soft);
  text-shadow: 0 0 12px rgba(168, 155, 255, 0.35);
}

/* Logo tip: glow only (no transform — assert requires ≥16px logo margin) */
.brand img {
  transition: filter 0.55s var(--qc-ease), box-shadow 0.55s var(--qc-ease);
  border-radius: 8px;
}
.brand.is-tip img {
  filter: brightness(1.12) saturate(1.08);
  box-shadow: 0 0 16px rgba(168, 155, 255, 0.45);
}
.brand:hover img {
  filter: brightness(1.08);
  box-shadow: 0 0 12px rgba(168, 155, 255, 0.3);
}

/* Panel enter: quieter drift (override rise slightly when qc) */
body.qc-on .panel {
  animation-name: qc-rise;
  animation-duration: var(--qc-med);
}
@keyframes qc-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Buttons: characterful but tiny */
.btn {
  transition:
    transform var(--qc-fast) var(--qc-ease),
    box-shadow var(--qc-med) var(--qc-ease),
    background 0.2s,
    color 0.2s,
    border-color 0.2s;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}
.btn-ghost:hover:not(:disabled) {
  box-shadow: 0 0 0 1px rgba(168, 155, 255, 0.28);
}

/* Choice cards */
.choice {
  transition:
    transform var(--qc-fast) var(--qc-ease),
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.28s var(--qc-ease);
}
.choice:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(168, 155, 255, 0.22);
}
.choice[aria-pressed="true"] {
  box-shadow: 0 0 0 1px rgba(168, 155, 255, 0.45), 0 0 22px rgba(107, 92, 224, 0.22);
}
.choice.is-correct-bloom {
  animation: qc-correct-bloom 0.7s var(--qc-ease) both;
}
.choice.is-soft-shake {
  animation: qc-soft-shake 120ms var(--qc-ease) both;
}
@keyframes qc-correct-bloom {
  0% { box-shadow: 0 0 0 0 rgba(157, 212, 181, 0); }
  40% { box-shadow: 0 0 0 3px rgba(157, 212, 181, 0.35), 0 0 28px rgba(157, 212, 181, 0.25); }
  100% { box-shadow: 0 0 0 1px rgba(168, 155, 255, 0.45), 0 0 22px rgba(107, 92, 224, 0.22); }
}
@keyframes qc-soft-shake {
  0%, 100% { transform: translateX(0); }
  33% { transform: translateX(-3px); }
  66% { transform: translateX(3px); }
}

/* Fuse pieces + workflow rows */
.piece:hover:not(.used) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(107, 92, 224, 0.2);
}
.wf-row {
  transition: transform var(--qc-fast) var(--qc-ease), border-color 0.2s, background 0.2s, box-shadow 0.25s;
}
.wf-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(168, 155, 255, 0.18);
}
.wf-row.is-ink::after {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(168, 155, 255, 0.35);
  pointer-events: none;
  animation: qc-ink 0.55s var(--qc-ease) forwards;
  left: var(--ink-x, 50%);
  top: var(--ink-y, 50%);
  transform: translate(-50%, -50%) scale(0.4);
}
@keyframes qc-ink {
  to { opacity: 0; transform: translate(-50%, -50%) scale(2.4); }
}

/* Build cards + metric count-up */
.build-card {
  transition: transform var(--qc-med) var(--qc-ease), border-color 0.2s, box-shadow 0.3s;
}
.build-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(168, 155, 255, 0.16);
}
.build-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='60' height='60' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  transition: opacity 0.35s var(--qc-ease);
  mix-blend-mode: soft-light;
}
.build-card { position: relative; }
.build-card:hover::after { opacity: 1; }
.metric.is-counting {
  color: var(--purple-soft);
  text-shadow: 0 0 16px rgba(168, 155, 255, 0.3);
}

/* Headshot life: hero + diploma seal */
.hero-shot img,
.portrait img,
.panel[data-step="0"] .portrait img {
  transition: transform 0.7s var(--qc-ease), filter 0.7s var(--qc-ease);
  transform-origin: 50% 30%;
}
.hero-shot.is-idle img,
.portrait.is-idle img {
  transform: translateY(-2px) scale(1.01);
}
.seal-portrait {
  transition: transform 0.6s var(--qc-ease), box-shadow 0.6s var(--qc-ease);
}
.seal-portrait.is-wink img {
  filter: brightness(1.05);
  transform: scale(1.04) rotate(-2deg);
  transition: transform 0.35s var(--qc-ease), filter 0.35s;
}
.seal-portrait.is-wink {
  box-shadow:
    0 0 0 4px rgba(107, 92, 224, 0.28),
    0 0 36px rgba(107, 92, 224, 0.42);
}

/* Chat progress pills bloom with nav */
.chat-progress .dot.is-on,
.chat-progress [data-dot].is-on {
  box-shadow: 0 0 10px rgba(168, 155, 255, 0.45);
  transition: box-shadow 0.5s var(--qc-ease), background 0.3s;
}

/* Dossier: soft page feel */
.dossier-panel {
  transition:
    opacity 220ms var(--qc-ease),
    transform 280ms var(--qc-ease),
    box-shadow 0.4s var(--qc-ease) !important;
}
.dossier-root.is-open .dossier-panel {
  box-shadow:
    -18px 0 40px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(168, 155, 255, 0.08);
}
.dossier-stat {
  transition: transform var(--qc-fast) var(--qc-ease), background 0.2s;
}
.dossier-stat:hover {
  transform: translateY(-1px);
}

/* Footer charm */
footer .brand-mini,
footer a {
  transition: color 0.2s, transform var(--qc-fast) var(--qc-ease);
}
footer .made-with {
  cursor: default;
  border-bottom: 1px dotted transparent;
  transition: border-color 0.3s, color 0.3s;
}
footer .made-with:hover {
  border-color: rgba(168, 155, 255, 0.45);
  color: var(--purple-soft);
}

/* Flash between beats: softer */
#flash.on {
  opacity: 0.18 !important;
}

@media (prefers-reduced-motion: reduce) {
  .stage .aurora { animation: none !important; opacity: 0.55; }
  .brand.is-tip img,
  .brand:hover img { filter: none !important; box-shadow: none !important; }
  .choice.is-correct-bloom,
  .choice.is-soft-shake,
  .wf-row.is-ink::after,
  body.qc-on .panel { animation: none !important; }
  .choice:hover,
  .btn:hover:not(:disabled),
  .build-card:hover,
  .piece:hover:not(.used),
  .wf-row:hover { transform: none !important; }
  .hero-shot.is-idle img,
  .portrait.is-idle img,
  .seal-portrait.is-wink img { transform: none !important; filter: none !important; }
  .progress-fill.is-bloom { box-shadow: none !important; }
}
