/* ============================================================================
   MediByte — Interactive layer
   Live "try a question" demo · synaptic hero canvas · cursor glow · flip card
   ========================================================================== */

/* ---- Synaptic hero canvas ---- */
.synapse {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .45;
}
@media (prefers-reduced-motion: reduce) { .synapse { display: none; } }
html.shot .synapse, html.shot .cursorglow { display: none; }

/* ---- Cursor glow (additive; native cursor stays visible) ---- */
.cursorglow {
  position: fixed;
  top: 0; left: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid rgba(26,91,255,.55);
  background: radial-gradient(closest-side, rgba(26,91,255,.16), transparent);
  transform: translate(-100px, -100px) translate(-50%, -50%);
  z-index: 9500;
  pointer-events: none;
  transition: width .25s var(--ease-out), height .25s var(--ease-out), border-color .25s, background .25s, opacity .3s;
  mix-blend-mode: multiply;
  opacity: 0;
}
.cursorglow.on { opacity: 1; }
.cursorglow.hot { width: 56px; height: 56px; border-color: rgba(54,211,232,.6); background: radial-gradient(closest-side, rgba(54,211,232,.2), transparent); }
@media (hover: none), (pointer: coarse) { .cursorglow { display: none; } }
@media (prefers-reduced-motion: reduce) { .cursorglow { display: none; } }

/* ============================================================================
   TRY-IT QUESTION DEMO
   ========================================================================== */
.tryit { position: relative; }
.tryit__bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.tryit__bg .blob { width: 520px; height: 520px; }

.qz {
  position: relative;
  z-index: 2;
  max-width: 820px;
  margin: clamp(34px, 5vw, 52px) auto 0;
}
.qz__card {
  position: relative;
  background: linear-gradient(180deg, #ffffff, #fbfaf7);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  padding: clamp(22px, 3.4vw, 40px);
  overflow: hidden;
}
.qz__card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transform: scaleX(var(--prog, 0));
  transform-origin: left;
  transition: transform .7s var(--ease-out);
}

.qz__top { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: clamp(18px, 2.6vw, 26px); }
.qz__meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qz__counter { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .04em; color: var(--ink-3); }
.qz__ringwrap { display: flex; align-items: center; gap: 12px; }
.qz__ringwrap small { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); line-height: 1.2; max-width: 64px; }

.qz__stem { font-size: clamp(1rem, 1.3vw, 1.12rem); line-height: 1.62; color: var(--ink-2); letter-spacing: -.01em; }
.qz__stem .hl { background: linear-gradient(transparent 62%, rgba(255,106,89,.26) 0); padding: 0 1px; font-weight: 500; color: var(--ink); }
.qz__lead { margin-top: 1.1rem; font-family: var(--font-display); font-weight: 600; font-size: clamp(1.12rem, 1.7vw, 1.38rem); letter-spacing: -.025em; line-height: 1.25; }

.qz__opts { margin-top: 1.5rem; display: grid; gap: 10px; }
.qz__opt {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: inset 0 0 0 1.4px var(--line);
  cursor: pointer;
  text-align: left;
  font-size: .98rem;
  color: var(--ink);
  width: 100%;
  transition: box-shadow .2s var(--ease), background .2s var(--ease), transform .2s var(--ease-out);
}
.qz__opt:hover:not([disabled]) { box-shadow: inset 0 0 0 1.6px rgba(26,91,255,.5); transform: translateX(3px); }
.qz__opt[disabled] { cursor: default; }
.qz__key {
  width: 28px; height: 28px; flex: none;
  border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 500; font-size: .86rem;
  background: var(--blue-tint); color: var(--blue-deep);
  transition: background .2s, color .2s;
}
.qz__opt span:nth-child(2) { flex: 1; line-height: 1.4; }
.qz__mark { width: 22px; height: 22px; flex: none; display: grid; place-items: center; opacity: 0; transition: opacity .25s; }
.qz__mark svg { width: 22px; height: 22px; }

/* graded states */
.qz__opt.correct { box-shadow: inset 0 0 0 2px var(--green); background: rgba(47,191,113,.08); }
.qz__opt.correct .qz__key { background: var(--green); color: #fff; }
.qz__opt.correct .qz__mark { opacity: 1; color: var(--green); }
.qz__opt.wrong { box-shadow: inset 0 0 0 2px var(--coral); background: rgba(255,106,89,.08); }
.qz__opt.wrong .qz__key { background: var(--coral); color: #fff; }
.qz__opt.wrong .qz__mark { opacity: 1; color: var(--coral); }
.qz__opt.dim { opacity: .55; }

/* explanation */
.qz__explain {
  margin-top: 1.4rem;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .5s var(--ease-out);
}
.qz__explain.show { grid-template-rows: 1fr; }
.qz__explain > div { overflow: hidden; }
.qz__exinner {
  padding: 18px 20px;
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, var(--blue-tint), #fff);
  box-shadow: inset 0 0 0 1px rgba(26,91,255,.16);
}
.qz__verdict { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; letter-spacing: -.02em; margin-bottom: .5rem; }
.qz__verdict svg { width: 20px; height: 20px; }
.qz__verdict.ok { color: #1e9e59; }
.qz__verdict.no { color: #d8452f; }
.qz__exinner p { color: var(--ink-2); font-size: .96rem; line-height: 1.6; }
.qz__exinner b { color: var(--ink); font-weight: 600; }

.qz__foot { margin-top: 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.qz__dots { display: flex; gap: 7px; }
.qz__dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: background .3s, transform .3s; }
.qz__dots i.done { background: var(--blue); }
.qz__dots i.active { background: var(--blue); transform: scale(1.4); }
.qz__next { opacity: .4; pointer-events: none; transition: opacity .3s; }
.qz__next.ready { opacity: 1; pointer-events: auto; }

.qz__hint { margin-top: 1.1rem; text-align: center; font-size: .86rem; color: var(--ink-3); }
.qz__hint b { color: var(--ink); font-weight: 600; }

/* completion summary */
.qz__done { text-align: center; padding: clamp(20px,3vw,32px) 8px; }
.qz__done .qz__score { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.6rem,6vw,4rem); letter-spacing: -.04em; line-height: 1; }
.qz__done .qz__score span { color: var(--blue); }
.qz__done p { margin-top: .7rem; color: var(--ink-2); }
.qz__done .qz__actions { margin-top: 1.6rem; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.qz__mascotfloat { position: absolute; right: clamp(-6px, 1vw, 10px); bottom: -8px; width: clamp(96px, 12vw, 150px); z-index: 3; pointer-events: none; }

@media (max-width: 620px) {
  .qz__top { flex-direction: column; align-items: flex-start; gap: 12px; }
  .qz__mascotfloat { display: none; }
  .qz__foot { flex-direction: column; align-items: stretch; }
  .qz__next { width: 100%; justify-content: center; }
}

/* ============================================================================
   FLIP FLASHCARD (Cortex)
   ========================================================================== */
.flip { perspective: 1400px; width: 100%; max-width: 300px; aspect-ratio: 1 / 1.15; cursor: pointer; }
.flip__inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .7s var(--ease-in-out); }
.flip.flipped .flip__inner { transform: rotateY(180deg); }
.flip__face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: var(--sh-lg);
}
.flip__front { background: linear-gradient(165deg, #fff, #f4f7fc); }
.flip__back { background: linear-gradient(165deg, var(--blue), var(--blue-deep)); color: #fff; transform: rotateY(180deg); }
.flip__tag { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--blue-deep); }
.flip__back .flip__tag { color: rgba(255,255,255,.8); }
.flip__q { font-family: var(--font-display); font-weight: 600; font-size: 1.32rem; letter-spacing: -.03em; line-height: 1.18; }
.flip__a { font-size: 1.02rem; line-height: 1.5; }
.flip__a b { font-weight: 600; }
.flip__hint { font-size: .8rem; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.flip__back .flip__hint { color: rgba(255,255,255,.75); }
.flip__hint svg { width: 14px; height: 14px; }
