/* ============================================================
   HealthLit Mechanics Library
   Feedback-with-Explanation — styles

   Every colour and face is read from a host variable with a
   fallback, so the mechanic inherits a module's palette when it is
   embedded and still renders on its own. Nothing here imports or
   assumes a particular module.

   Motion is opt-in: transitions are declared only inside
   prefers-reduced-motion: no-preference, so a reader who has asked
   for less motion gets none rather than a reduced amount.
   ============================================================ */

.fwe {
  font-family: var(--sans, system-ui, sans-serif);
  color: var(--ink, #1a1a18);
  font-size: calc(15px * var(--fs, 1));
  line-height: 1.6;
}

.fwe *, .fwe *::before, .fwe *::after { box-sizing: border-box; }

.fwe .fwe-h {
  font-family: var(--serif, Georgia, serif);
  font-size: calc(1.35em * var(--fs, 1));
  line-height: 1.3;
  font-weight: 600;
  margin: 0 0 .6em;
}
.fwe .fwe-h:focus-visible,
.fwe [data-fwe-feedback]:focus-visible,
.fwe :focus-visible {
  outline: 3px solid var(--accent, #c4530a);
  outline-offset: 2px;
  border-radius: 4px;
}

.fwe .fwe-stem {
  font-size: calc(1.1em * var(--fs, 1));
  margin: 0 0 1em;
}
.fwe .fwe-media { margin: 0 0 1em; }
.fwe .fwe-media img, .fwe .fwe-media svg { max-width: 100%; height: auto; }

/* ---------- choices ---------- */
.fwe .fwe-choices {
  border: none;
  padding: 0;
  margin: 0 0 1.2em;
  display: grid;
  gap: .5em;
}
.fwe .fwe-choices legend {
  font-size: .9em;
  color: var(--ink-mid, #4a4a44);
  padding: 0;
  margin-bottom: .5em;
}
.fwe .fwe-choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: .8em .9em;
  border: 2px solid var(--paper-deep, #8a7f6f);
  border-radius: 10px;
  background: var(--paper, #f7f4ee);
}
/* Style Guide, "Answer-option controls": a picked option gets its own
   circular mark, filled with a checkmark, rather than relying on the
   container's border colour alone — the pattern PMOS already had and this
   mechanic didn't. The real <input type="radio"> stays in the accessibility
   tree (never display:none) so keyboard and screen-reader behaviour is
   unchanged; only its own box is visually hidden, and the mark is drawn on
   the label instead, keyed off :checked so it can never disagree with the
   input's real state. */
.fwe .fwe-choice input {
  position: absolute;
  width: 1.1em; height: 1.1em;
  opacity: 0;
  margin: 0;
}
.fwe .fwe-choice label { cursor: pointer; flex: 1 1 auto; display: flex; align-items: center; gap: .7em; }
.fwe .fwe-choice label::before {
  content: '';
  width: 18px; height: 18px; flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--ink-faint, #b5b1a8);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1; color: var(--paper, #f7f4ee);
  box-sizing: border-box;
}
.fwe .fwe-choice input:checked + label::before {
  content: '\2713';
  border-color: var(--accent, #a3440a);
  background: var(--accent, #a3440a);
}
.fwe .fwe-choice input:focus-visible + label::before { outline: 3px solid var(--accent, #a3440a); outline-offset: 2px; }
.fwe .fwe-choice.is-chosen { border-color: var(--accent, #a3440a); background: var(--accent-soft, #fbf3e9); }
.fwe .fwe-choice.is-answer { border-color: var(--teal, #1a6b5a); background: var(--teal-light, #dff0eb); }
.fwe .fwe-choice.is-answer label::before { border-color: var(--teal, #1a6b5a); }
.fwe .fwe-choice.is-answer input:checked + label::before { background: var(--teal, #1a6b5a); }
.fwe .fwe-choice.is-chosen-not-answer { border-color: var(--ink-light, #8a8a80); }
.fwe .fwe-choices[disabled] .fwe-choice label { cursor: default; }

/* ---------- development notice ---------- */
/* Rendered only in development mode, for a module author. A learner never
   sees this. */
.fwe .fwe-dev-notice {
  padding: .8em 1em;
  margin: 0 0 1.2em;
  border: 2px solid var(--rose, #8a1a3a);
  border-radius: 10px;
  background: var(--rose-light, #f3dde4);
  color: var(--ink, #1a1a18);
  font-size: .88em;
}

/* ---------- the chosen answer, shown while rating confidence in it ---------- */
.fwe .fwe-chosen {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5em;
  padding: .8em .9em;
  margin: 0 0 1.2em;
  border: 2px solid var(--accent, #c4530a);
  border-radius: 10px;
  background: var(--paper, #f7f4ee);
}
.fwe .fwe-chosen-label { font-size: .85em; color: var(--ink-mid, #4a4a44); }
.fwe .fwe-chosen-text { font-weight: 500; }

/* ---------- feedback ---------- */
.fwe .fwe-feedback {
  border-left: 4px solid var(--ink-light, #8a8a80);
  padding: .9em 1em;
  border-radius: 0 10px 10px 0;
  background: var(--paper, #f7f4ee);
  margin: 0 0 1.2em;
}
.fwe .fwe-feedback.is-correct { border-left-color: var(--teal, #1a6b5a); background: var(--teal-light, #dff0eb); }
.fwe .fwe-feedback.is-incorrect { border-left-color: var(--amber, #8b5e08); background: var(--amber-light, #f5eddb); }
.fwe .fwe-verdict {
  font-family: var(--serif, Georgia, serif);
  font-size: calc(1.1em * var(--fs, 1));
  font-weight: 600;
  margin: 0 0 .5em;
}
.fwe .fwe-conf-framing { display: block; font-family: var(--sans, system-ui, sans-serif); font-size: .85em; font-weight: 400; color: var(--ink-mid, #4a4a44); }
.fwe .fwe-answer { margin: 0 0 .5em; font-weight: 500; }
.fwe .fwe-explanation { margin: 0 0 .5em; }
.fwe .fwe-take-home {
  margin: .7em 0 0;
  padding-top: .7em;
  border-top: 1px solid var(--paper-deep, #d6cfc2);
}
/* ---- G9, ruled 18 September 2026 — removable in one piece ----
   The restated objective at checkpoint resolution. Subordinate: smaller,
   in the secondary ink, and set apart from the take-home above it, because
   it restates what the learner has just shown rather than telling them
   something new. Contrast is still measured against AA like everything
   else here — --ink-mid is the same secondary ink the confidence framing
   uses. */
.fwe .fwe-objective {
  margin: .7em 0 0;
  font-size: calc(.92em * var(--fs, 1));
  color: var(--ink-mid, #4a4a44);
}
/* ---- end G9 ---- */

/* ---------- scene panels (review and remediation) ---------- */
.fwe .fwe-scene {
  padding: 1em;
  border: 1px solid var(--paper-deep, #d6cfc2);
  border-radius: 10px;
  background: var(--paper, #f7f4ee);
  margin: 0 0 1.2em;
}
.fwe .fwe-review-list { list-style: none; padding: 0; margin: 0 0 1.2em; display: grid; gap: .3em; }

/* ---------- controls ---------- */
.fwe .fwe-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .8em; margin: 0 0 1em; }
.fwe .fwe-btn {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: .65em 1.3em;
  background: none;
  color: inherit;
}
.fwe .fwe-btn-primary { background: var(--accent, #c4530a); color: #fff; font-weight: 500; }
.fwe .fwe-btn-ghost { border: 2px solid var(--accent, #c4530a); color: var(--accent-deep, #a3440a); padding: calc(.65em - 2px) 1.3em; }
.fwe .fwe-btn-text { text-decoration: underline; text-underline-offset: 3px; color: var(--ink-mid, #4a4a44); padding: .5em 0; }
.fwe .fwe-btn:disabled { cursor: not-allowed; opacity: .5; }
.fwe .fwe-hint { font-size: .88em; color: var(--ink-mid, #4a4a44); }

.fwe .fwe-listen {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--paper-deep, #d6cfc2);
  background: var(--paper, #f7f4ee);
  color: var(--ink-mid, #4a4a44);
  border-radius: 999px;
  padding: .35em 1em;
  margin: 0 0 1em;
  font-size: .9em;
}
.fwe .fwe-listen[aria-pressed="true"] { border-color: var(--accent, #c4530a); color: var(--accent-deep, #a3440a); }

/* ---------- persistent navigation ---------- */
/* This region is present in every state. It is never disabled and never
   hidden: the review path out of a question must always be there. */
.fwe .fwe-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1em;
  padding-top: 1em;
  border-top: 1px solid var(--paper-deep, #d6cfc2);
}
.fwe .fwe-bypass { display: flex; flex-wrap: wrap; align-items: center; gap: .6em; margin-left: auto; }

/* ---------- the bypass screen ---------- */
/* Two lines, review first. No heading, and nothing that reads as a verdict
   on the learner. */
.fwe .fwe-exit { display: grid; gap: 1em; justify-items: start; }
.fwe .fwe-exit p { margin: 0; }

/* ---------- tap-to-define connector ---------- */
.fwe [data-fwe-term] {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
  border-bottom: 1px dotted var(--accent, #c4530a);
}

/* ---------- onboarding worked example ---------- */
.fwe .fwe-worked-step { margin: 0 0 1.5em; padding-left: 1em; border-left: 2px solid var(--paper-deep, #d6cfc2); }
.fwe .fwe-worked-label { font-size: .9em; color: var(--ink-mid, #4a4a44); margin: 0 0 .6em; }
.fwe .fwe-worked-intro { margin: 0 0 1.2em; }

@media (prefers-reduced-motion: no-preference) {
  .fwe .fwe-choice { transition: border-color .18s ease, background-color .18s ease; }
  .fwe .fwe-btn { transition: background-color .18s ease, color .18s ease; }
  .fwe .fwe-listen { transition: border-color .18s ease, color .18s ease; }
}
