/* quiz.css — the takeable AI Fluency Snapshot (demo Task 4).
   Styles the interactive quiz screens (intro, one-at-a-time questions, result)
   plus the hub "Take it yourself" lead card. Reuses the skin CSS variables
   (--accent, --fg, --bg, --bg-elev, --border, --radius, --font-base) so the
   quiz matches whatever chat skin is active. ASCII dashes only. */

/* The takeable quiz has no chat turns to type, so the read-only composer is
   meaningless. Hide it (and the right preview pane) when the quiz owns the view.
   Class-on-html selector beats the plain `.composer { display:flex }` rule. */
html[data-quiz="1"] .composer { display: none; }
html[data-quiz="1"] .right-panel { display: none; }

/* ── Quiz screen host ──
   Each step renders as a single .message.quiz-screen <li>. Reset the chat-bubble
   chrome it would otherwise inherit from .message (max-width 78%, bubble padding,
   pre-wrap) so the quiz card owns its own layout - same approach the card-hosting
   bubbles use. */
.message.quiz-screen {
  align-self: center;
  max-width: 640px;
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  white-space: normal;
  line-height: normal;
  font-family: var(--font-base);
}

/* ── Intro card ── */
.card-quiz-intro {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  text-align: center;
}
.card-quiz-intro__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
}
.card-quiz-intro__lede {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--fg);
  opacity: 0.85;
}

/* ── Question card ── */
.card-quiz-question {
  --card-px: 22px; /* horizontal padding; the pinned feedback bar bleeds to match it */
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px var(--card-px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.card-quiz-question__progress {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
.card-quiz-question__stem {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--fg);
}
.card-quiz-question__options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card-quiz-question__option {
  margin: 0;
  padding: 0;
}

/* Each option is a real, full-width clickable button. Mirrors the scripted
   .card-mc-question option look (bullet + text), but is interactive and starts
   with no option pre-chosen. */
.quiz-option-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-base);
  font-size: 0.9375rem;
  line-height: 1.5;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease, transform 0.06s ease;
}
.quiz-option-btn:hover {
  border-color: var(--accent);
  background: var(--bg-elev);
}
.quiz-option-btn:active {
  transform: translateY(1px);
}
.quiz-option-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.card-quiz-question__bullet {
  flex-shrink: 0;
  font-size: 0.75rem;
  line-height: 1.6;
  opacity: 0.55;
}

/* ── Shared quiz buttons (Start / Take it again) ── */
.quiz-btn {
  align-self: center;
  min-height: 44px;
  padding: 0 22px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg-elev);
  font-family: var(--font-base);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}
.quiz-btn:hover {
  filter: brightness(1.05);
}
.quiz-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* "Take it again" sits below the result card as a quiet, centred link-ish row. */
.quiz-redo-row {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}
.quiz-btn--redo {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

/* ── Hub "Take it yourself" lead card ── */
.hub-takeit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding: 20px 24px;
  border: 1px solid var(--accent, #2563eb);
  border-radius: 14px;
  background: var(--bg-elev, #fff);
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s, box-shadow 0.12s;
}
.hub-takeit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
.hub-takeit__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hub-takeit__title {
  font-weight: 800;
  font-size: 1.15rem;
}
.hub-takeit__sub {
  opacity: 0.75;
  font-size: 0.9rem;
}
.hub-takeit__cta {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--accent, #2563eb);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .hub-takeit { flex-direction: column; align-items: flex-start; }
}

/* --- Per-answer feedback (Task 4) --- */
.quiz-option-btn:disabled { cursor: default; opacity: 1; }
.quiz-option-btn.is-chosen { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.quiz-option-btn.is-best { border-color: var(--accent); }
.quiz-option-btn.is-best .card-quiz-question__bullet::after { content: " ✓"; color: var(--accent); }

/* The feedback row (badge + insight + Next) is PINNED to the bottom of the scroll
   viewport so the advance action is always reachable. On mobile a long scenario card
   ran ~900px tall and the appended Next button landed ~300px below the fold; the old
   smooth scrollIntoView was unreliable on mobile Safari, so people tapped an answer,
   saw nothing move, and could not advance. Sticky is a no-op when the card already
   fits the viewport (desktop), so it only engages on overflow. The negative inline
   margins (matched to --card-px) let the bar's background span the card edges; the
   top shadow separates it from content scrolling underneath. */
.quiz-feedback {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0.9rem calc(-1 * var(--card-px)) 0;
  padding: 0.8rem var(--card-px) max(0.8rem, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--bg-elev);
  box-shadow: 0 -10px 18px -12px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.quiz-badge { align-self: flex-start; font-size: 0.78rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 999px; border: 1px solid var(--border); color: var(--fg); }
.quiz-badge[data-tier="best"] { border-color: var(--accent); color: var(--accent); }
.quiz-insight { margin: 0; font-size: 0.92rem; line-height: 1.5; color: var(--fg); opacity: 0.88; }
.quiz-btn--next { align-self: flex-end; }

/* Mobile: tighten the question card so long scenarios need less scrolling, and make
   the pinned Next a full-width tap target. --card-px drives the feedback bleed too,
   so they stay aligned. */
@media (max-width: 480px) {
  .card-quiz-question { --card-px: 16px; padding: 16px var(--card-px); gap: 10px; }
  .card-quiz-question__stem { font-size: 0.95rem; }
  .quiz-option-btn { padding: 11px 13px; }
  .quiz-btn--next { align-self: stretch; }
}

/* --- "Your read" result block (Task 6: 6-dim readout + framework + recap + bridge) --- */
.quiz-read { margin-top: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elev); display: flex; flex-direction: column; gap: 0.7rem; }
.quiz-read__title { margin: 0 0 0.2rem; font-size: 1rem; font-weight: 700; }
.quiz-read__hedge { margin: 0; font-size: 0.83rem; line-height: 1.45; opacity: 0.7; }

/* 6-dimension readout rows */
.quiz-read__dims { display: flex; flex-direction: column; gap: 0.5rem; }
.quiz-read__dim-row {
  display: grid;
  grid-template-columns: 6rem 5.5rem 1fr;
  gap: 0.4rem 0.6rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.quiz-read__dim-row:last-child { border-bottom: none; }
.quiz-read__dim-name { font-weight: 600; font-size: 0.88rem; }
.quiz-read__dim-band { font-size: 0.78rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.quiz-read__dim-band--strong { border-color: var(--accent); color: var(--accent); }
.quiz-read__dim-band--solid { border-color: var(--accent); color: var(--accent); opacity: 0.9; }
/* building/developing/early: differentiated by border style, NOT by fading the text.
   Opacity on small bold pill text drops below WCAG AA 4.5:1 on developing/early.
   Instead, use a muted border and keep the text color fully legible. */
.quiz-read__dim-band--building { border-style: dashed; }
.quiz-read__dim-band--developing { border-style: dashed; opacity: 0.85; }
.quiz-read__dim-band--early { border-style: dotted; opacity: 0.85; }
.quiz-read__dim-flavor { font-size: 0.85rem; line-height: 1.4; opacity: 0.85; }

@media (max-width: 480px) {
  .quiz-read__dim-row { grid-template-columns: 1fr 1fr; }
  .quiz-read__dim-flavor { grid-column: 1 / -1; }
}

/* "What is SPARKS-SIX" explainer - 2-col list on small screens */
.quiz-whatis { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.quiz-whatis__title { margin: 0 0 0.5rem; font-size: 0.95rem; font-weight: 700; }
.quiz-whatis__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 1rem; }
.quiz-whatis__item { font-size: 0.84rem; line-height: 1.4; }
.quiz-whatis__item strong { font-weight: 600; }

@media (max-width: 480px) {
  .quiz-whatis__list { grid-template-columns: 1fr; }
}

/* Per-question recap - collapsible <details>, default closed */
.quiz-recap { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.quiz-recap__summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  opacity: 0.75;
  user-select: none;
  list-style: none;
  padding: 0.2rem 0;
}
.quiz-recap__summary::-webkit-details-marker { display: none; }
.quiz-recap__summary::before { content: "▸ "; }
details[open] > .quiz-recap__summary::before { content: "▾ "; }
.quiz-recap__list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.quiz-recap__item { display: flex; flex-wrap: wrap; gap: 0.3rem 0.5rem; font-size: 0.83rem; align-items: baseline; }
.quiz-recap__dim { font-weight: 600; font-size: 0.8rem; }
.quiz-recap__pick { font-size: 0.78rem; opacity: 0.7; font-style: italic; }
.quiz-recap__insight { line-height: 1.4; opacity: 0.85; flex-basis: 100%; }

/* Specialization + training bridge */
.quiz-bridge {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--accent, #2563eb);
  border-radius: 10px;
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.quiz-bridge__lead { margin: 0; font-size: 0.9rem; line-height: 1.5; }
.quiz-bridge__soon { margin: 0; font-size: 0.82rem; font-weight: 600; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.05em; }

/* B2B Team AI-Readiness Read fake-door CTA */
.team-read {
  margin-top: 1.5rem;
  padding: 1.2rem 1.4rem 1.1rem;
  border: 2px solid var(--brand-accent, #0E7C72);
  border-radius: 14px;
  background: var(--brand-raised, #F0F5F4);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.team-read__eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-accent, #0E7C72);
  font-weight: 700;
}
.team-read__title {
  font-family: var(--brand-display, inherit);
  font-size: 1.15rem;
  line-height: 1.25;
  color: var(--brand-ink, #1B1A17);
  margin: 0;
}
.team-read__sub {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--brand-ink-60, #6E6A60);
  margin: 0;
}
.team-read__price {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand-accent, #0E7C72);
  margin: 0;
}
.team-read__btn {
  display: inline-block;
  margin-top: 0.3rem;
  padding: 0.65rem 1.3rem;
  background: var(--brand-accent, #0E7C72);
  color: #fff;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  align-self: flex-start;
  transition: opacity 0.15s;
}
.team-read__btn:hover { opacity: 0.88; }
