/* ===========================================================================
 * mc-item.css — canonical visual for McItem.
 * ===========================================================================
 * Single source of truth for .mc-choice / .mc-letter / .mc-elim / .mc-choices
 * / .mc-choice-main / .mc-choice-text / .mc-choice-annotation / .mc-stem
 * / state classes (.is-selected, .is-correct, .is-wrong, .is-eliminated,
 * .is-dimmed, .mc-choice-shake). Replaces the per-surface scoped duplicates
 * that previously lived in subjects/vocab/styles.css (.quiz-screen .mc-*),
 * subjects/math/styles.css (.math-screen .mc-*), and diagnostic-ui.css
 * (.diag-mc-region .mc-*).
 *
 * Surface stylesheets may still override individual properties for
 * surface-specific behavior (e.g. diagnostic uses a different selected-state
 * fill, hides elimination/annotations), but the bulk lives here so all
 * surfaces share the same canonical defaults.
 *
 * Loaded BEFORE surface stylesheets in index.html so per-surface overrides
 * (where they exist) win on specificity.
 * ========================================================================= */

/* --- Stem (prompt) ------------------------------------------------------ */
/* McItem renders item.stem only when the host passes a non-empty one
 * (diagnostic adaptive runner, verbal practice). Surfaces that show the
 * prompt in their own card/header pass stem='' and render no .mc-stem
 * element — so this spacing applies exactly where a prompt IS shown,
 * giving every McItem prompt the same clear separation from its choices
 * by construction. */
.mc-stem {
  margin-bottom: 14px;
  line-height: 1.45;
}

/* --- Quoted stimulus block --------------------------------------------
 * An indented blockquote for a passage snippet the question asks about
 * (vocab-in-context "As used in the text…", evidence prompts, etc.).
 * Emitted by Markdown `>` lines and by the {type:'quote'} stemBlock; the
 * inner prose is rendered as Markdown blocks, so paragraphs come from the
 * .md-p rule below (a blank line in `value` starts a new paragraph). */
.mc-quote {
  margin: 0 0 14px;
  padding: 4px 0 4px 14px;
  border-left: 3px solid var(--line-strong, var(--line));
  color: var(--ink-soft);
  line-height: 1.55;
  text-wrap: pretty;
}

/* Boxed paragraph stimulus (digital-ELA "read the paragraph in the box") — a full border,
 * distinct from the left-rule mc-quote. */
.mc-boxed {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1.5px solid var(--ink-30);
  border-radius: 6px;
  line-height: 1.55;
  text-wrap: pretty;
}

/* --- Markdown block primitives (global) -------------------------------
 * Emitted by the shared renderer (renderMixed, block mode) for any stem /
 * why / quote / hint / passage shown via SharedMathText with as != "span".
 * Inline marks (**bold**, *italic*, <u>underline</u>) use native
 * <strong>/<em>/<u> and need no classes. Defined here (globally loaded);
 * not mc-specific. First/last-child margin resets keep a single-paragraph
 * stem visually identical to the old bare-text render. */
.md-p { margin: 0 0 0.7em; }
.md-p:first-child { margin-top: 0; }
.md-p:last-child  { margin-bottom: 0; }
.md-h { font-weight: 700; line-height: 1.3; margin: 0.8em 0 0.35em; }
.md-h:first-child { margin-top: 0; }
.md-h1 { font-size: 1.1em; }
.md-h2 { font-size: 1em; }
.md-h3 { font-size: 0.95em; }
.md-ul, .md-ol { margin: 0 0 0.7em; padding-left: 1.5em; }
.md-ul:last-child, .md-ol:last-child { margin-bottom: 0; }
.md-ul { list-style: disc; }
.md-ol { list-style: decimal; }
.md-ul > li, .md-ol > li { margin: 0.2em 0; }

/* --- Choice list container --------------------------------------------- */
.mc-choices {
  display: grid;
  gap: 8px;
}

/* --- Choice row --------------------------------------------------------- */
.mc-choice {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: start;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--ink-10);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  transition: all 0.15s;
  font-size: 14px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
.mc-choice:hover:not(:disabled) { border-color: var(--ink-30); }
.mc-choice:disabled { cursor: default; }

/* Pre-reveal selected state — used by surfaces with a Submit step
 * (selecting before commit). auto-reveal surfaces skip this and go
 * straight to is-correct/is-wrong on tap. */
.mc-choice.is-selected:not(.is-correct):not(.is-wrong) {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.mc-choice.is-selected:not(.is-correct):not(.is-wrong) .mc-letter {
  background: var(--accent);
  color: #fff;
}

/* Post-reveal correctness states. */
.mc-choice.is-correct {
  background: var(--accent-sage-tint);
  border-color: var(--accent-sage);
  color: var(--accent-sage-ink);
}
.mc-choice.is-correct .mc-letter { background: var(--accent-sage); color: #fff; }
.mc-choice.is-wrong {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}
.mc-choice.is-wrong .mc-letter { background: var(--danger); color: #fff; }

.mc-choice.is-dimmed { opacity: 0.75; }
.mc-choice.mc-choice-shake { animation: mc-shake 0.35s; }

.mc-choice.is-eliminated { opacity: 0.5; cursor: default; }
.mc-choice.is-eliminated .mc-choice-text {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  text-decoration-color: var(--ink-30);
}

/* --- Letter chip -------------------------------------------------------- */
.mc-letter {
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--ink-10);
  color: var(--ink-70);
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* --- Choice text + annotation slot ------------------------------------- */
.mc-choice-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  text-wrap: pretty;
}
.mc-choice-text { display: block; }
.mc-choice-annotation {
  font-size: 12px;
  color: var(--ink-70);
  line-height: 1.4;
}
.mc-choice-annotation .opt-src { color: var(--ink-soft); }
.mc-choice-annotation .opt-src em {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-70);
}

/* --- Eliminate button --------------------------------------------------- */
.mc-elim {
  align-self: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--ink-10);
  color: var(--ink-30);
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  font-weight: 600;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.mc-elim:hover { border-color: var(--ink-30); color: var(--ink-soft); }
.mc-elim.is-on {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

/* --- Figure-as-answer-choice ------------------------------------------- *
 * When item.choiceFigures is present each choice renders a MathFigure
 * (e.g. "which net folds into this solid?", "which is the reflected image?").
 * Lay the four choices out as a 2-col grid of figure cards; flatten the inner
 * FigureCard chrome so the choice button is the only frame. */
.mc-choices.has-figs {
  grid-template-columns: 1fr 1fr;
}
.mc-choices.has-figs .mc-choice {
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  padding: 10px;
}
.mc-choice-figure {
  display: flex;
  justify-content: center;
  width: 100%;
}
/* FigureCard uses inline styles (bg/border/padding/margin) — override so the
 * figure sits flush inside the choice button, no nested card. */
.mc-choice-figure > div {
  background: transparent !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100%;
}
.mc-choice-figure svg {
  max-width: 100%;
  height: auto;
}

/* --- Shake keyframes (mc-choice-shake animation target) ---------------- */
@keyframes mc-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

/* --- Inline why panel after reveal (matches .pi-why / .pei-why) --------- */
.mc-why-block {
  margin-top: 14px;
  padding: 14px;
  /* Read-only explanation → inset surface, near-square, no border. */
  border-radius: var(--radius-inset, 4px);
  border: none;
  background: var(--bg-inset, var(--ink-5));
}
.mc-why-block.is-correct {
  background: var(--accent-sage-tint);
  border-color: var(--accent-sage);
}
.mc-why-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 5px;
  color: var(--ink-soft);
}
.mc-why-block.is-correct .mc-why-label {
  color: var(--accent-sage);
}
.mc-why {
  font-family: var(--font-body, var(--font-display));
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}
