/*!
 * mentor-lab.css — Unit 0 · Choose Your Math Mentor.
 *
 * Grade 6 classroom surface: large readable type, generous tap targets, one
 * decision per screen, visible focus everywhere. Deliberately calm — this page
 * is asking a student to read about real people, not to play something.
 *
 * --ml-color is set inline per element from the lab colour.
 */

:root {
  --ml-ink: #0f172a;
  --ml-ink-soft: #475569;
  --ml-ink-faint: #64748b;
  --ml-bg: #f8fafc;
  --ml-card: #ffffff;
  --ml-line: rgba(15, 23, 42, 0.12);
  --ml-radius: 18px;
  --ml-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ml-bg);
  color: var(--ml-ink);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

.ml-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ml-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 18px;
  background: #0f172a;
  color: #fff;
  border-radius: 0 0 10px 0;
}

.ml-skip:focus {
  left: 0;
}

/* ── chrome ───────────────────────────────────────────────────────────── */

.ml-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(16px, 4vw, 32px);
  background: #fff;
  border-bottom: 1px solid var(--ml-line);
}

.ml-brand {
  font-weight: 700;
  color: var(--ml-ink);
  text-decoration: none;
  font-size: 0.98rem;
}

.ml-unit {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ml-ink-faint);
}

.ml-rail {
  padding: 14px clamp(16px, 4vw, 32px) 0;
}

.ml-rail ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  max-width: 900px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  color: var(--ml-ink-faint);
}

.ml-rail li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ml-rail li span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font-size: 0.68rem;
  font-weight: 700;
}

.ml-rail li.is-current {
  color: var(--ml-ink);
  font-weight: 650;
}

.ml-rail li.is-current span {
  background: var(--ml-ink);
  color: #fff;
  border-color: var(--ml-ink);
}

.ml-rail li.is-done {
  color: #0f766e;
}

.ml-rail li.is-done span {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 32px) 64px;
}

main:focus {
  outline: none;
}

.ml-eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ml-color, var(--ml-ink-faint));
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 4.4vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.ml-sub {
  margin: 0 0 26px;
  font-size: 1.02rem;
  color: var(--ml-ink-soft);
  max-width: 62ch;
}

/* ── step 1 ───────────────────────────────────────────────────────────── */

.ml-lede {
  max-width: 60ch;
  margin: 18px 0 30px;
  font-size: 1.08rem;
}

.ml-lede p {
  margin: 0 0 14px;
}

.ml-lede strong {
  font-weight: 700;
}

.ml-current-card {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 460px;
  margin: 4px 0 24px;
  padding: 18px;
  border-radius: var(--ml-radius);
  border-left: 5px solid var(--ml-color, #334155);
  background: var(--ml-card);
  box-shadow: var(--ml-shadow);
}

.ml-current-card h2 {
  margin: 0 0 2px;
  font-size: 1.24rem;
}

.ml-current-lab {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ml-ink-soft);
}

/* ── buttons ──────────────────────────────────────────────────────────── */

.ml-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.ml-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 24px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease;
}

.ml-btn:hover {
  transform: translateY(-1px);
}

.ml-btn:focus-visible {
  outline: 3px solid var(--ml-color, #1d4ed8);
  outline-offset: 3px;
}

.ml-btn-go {
  background: var(--ml-color, #0f172a);
  color: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
}

.ml-btn-quiet {
  background: transparent;
  border-color: var(--ml-line);
  color: var(--ml-ink-soft);
}

.ml-btn-quiet:hover {
  border-color: var(--ml-ink-faint);
  color: var(--ml-ink);
}

/* ── step 2 · the eight moves ─────────────────────────────────────────── */

.ml-labs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ml-lab {
  display: grid;
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: 20px 18px;
  text-align: left;
  border: 1.5px solid var(--ml-line);
  border-radius: var(--ml-radius);
  background: var(--ml-card);
  font: inherit;
  color: var(--ml-ink);
  cursor: pointer;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    border-color 0.14s ease;
}

.ml-lab:hover {
  transform: translateY(-2px);
  border-color: var(--ml-color, #334155);
  box-shadow: var(--ml-shadow);
}

.ml-lab:focus-visible {
  outline: 3px solid var(--ml-color, #334155);
  outline-offset: 2px;
}

.ml-lab-emblem {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--ml-color, #334155);
  color: #fff;
  font-size: 1.05rem;
}

.ml-lab-sounds {
  font-size: 1.06rem;
  font-weight: 650;
  line-height: 1.3;
}

.ml-lab-move {
  font-size: 0.9rem;
  color: var(--ml-color, var(--ml-ink-soft));
  font-weight: 600;
}

.ml-lab-name {
  font-size: 0.76rem;
  color: var(--ml-ink-faint);
}

/* ── people lists ─────────────────────────────────────────────────────── */

.ml-people {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ml-person {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  width: 100%;
  height: 100%;
  padding: 16px;
  text-align: left;
  border: 1.5px solid var(--ml-line);
  border-radius: var(--ml-radius);
  background: var(--ml-card);
  font: inherit;
  color: var(--ml-ink);
  cursor: pointer;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    border-color 0.14s ease;
}

.ml-person:hover {
  transform: translateY(-2px);
  border-color: var(--ml-color, #334155);
  box-shadow: var(--ml-shadow);
}

.ml-person:focus-visible {
  outline: 3px solid var(--ml-color, #334155);
  outline-offset: 2px;
}

.ml-person-med {
  flex: 0 0 auto;
  line-height: 0;
}

.ml-person-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ml-person-name {
  font-size: 1.04rem;
  font-weight: 700;
  line-height: 1.25;
}

.ml-person-say {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--ml-ink-faint);
}

.ml-person-thought {
  font-size: 0.9rem;
  color: var(--ml-ink-soft);
  line-height: 1.45;
}

.ml-person-lab {
  margin-top: 2px;
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--ml-color, var(--ml-ink-faint));
}

/* ── step 4 · detail ──────────────────────────────────────────────────── */

.ml-back {
  margin-bottom: 18px;
  padding: 8px 16px;
  border: 1.5px solid var(--ml-line);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ml-ink-soft);
  cursor: pointer;
}

.ml-back:hover {
  border-color: var(--ml-ink-faint);
  color: var(--ml-ink);
}

.ml-back:focus-visible {
  outline: 3px solid var(--ml-color, #334155);
  outline-offset: 2px;
}

.ml-detail-head {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.ml-detail-med {
  line-height: 0;
}

.ml-detail-say {
  margin: 0 0 2px;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--ml-ink-soft);
}

.ml-detail-where {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ml-ink-faint);
}

.ml-detail-move {
  margin: 24px 0 0;
  padding: 18px 20px;
  border-radius: var(--ml-radius);
  background: color-mix(in srgb, var(--ml-color, #334155) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--ml-color, #334155) 24%, transparent);
}

.ml-detail-move-line {
  margin: 2px 0 0;
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.25;
}

.ml-detail-sec {
  margin: 26px 0 0;
  max-width: 66ch;
}

.ml-detail-sec h2 {
  margin: 0 0 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ml-ink-faint);
}

.ml-detail-sec p {
  margin: 0 0 12px;
  font-size: 1.02rem;
  line-height: 1.65;
}

.ml-detail-hard {
  padding: 18px 20px;
  border-radius: var(--ml-radius);
  background: rgba(15, 23, 42, 0.04);
  border-left: 4px solid var(--ml-color, #334155);
}

.ml-detail-hard p:last-child {
  margin-bottom: 0;
}

.ml-tryit {
  padding: 18px 20px;
  border-radius: var(--ml-radius);
  border: 1.5px dashed color-mix(in srgb, var(--ml-color, #334155) 45%, transparent);
}

.ml-tryit details {
  margin-top: 6px;
}

.ml-tryit summary {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--ml-color, #334155);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
}

.ml-tryit summary:focus-visible {
  outline: 3px solid var(--ml-color, #334155);
  outline-offset: 3px;
}

.ml-tryit details p {
  margin-top: 12px;
}

.ml-actions-sticky {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--ml-line);
}

/* ── step 5 · done ────────────────────────────────────────────────────── */

.ml-done {
  max-width: 56ch;
  padding: 32px clamp(20px, 4vw, 38px) 30px;
  border-radius: 22px;
  border-top: 6px solid var(--ml-color, #334155);
  background: var(--ml-card);
  box-shadow: var(--ml-shadow);
}

.ml-done-med {
  line-height: 0;
  margin-bottom: 16px;
}

.ml-done-lab {
  margin: 0 0 14px;
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--ml-color, var(--ml-ink-soft));
}

.ml-done-move {
  margin: 0 0 16px;
  padding: 14px 18px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--ml-color, #334155) 10%, #fff);
  font-size: 1.16rem;
  font-weight: 700;
}

.ml-done-note {
  margin: 0;
  font-size: 0.98rem;
  color: var(--ml-ink-soft);
}

/* ── footer ───────────────────────────────────────────────────────────── */

.ml-foot {
  padding: 26px clamp(16px, 4vw, 32px) 40px;
  border-top: 1px solid var(--ml-line);
}

.ml-foot p {
  max-width: 900px;
  margin: 0 auto;
  font-size: 0.84rem;
  color: var(--ml-ink-faint);
}

.ml-error {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  overflow: visible;
  white-space: normal;
  padding: 16px 18px;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-weight: 600;
}

/* ── reduced motion ───────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .ml-btn,
  .ml-lab,
  .ml-person {
    transition: none;
  }

  .ml-btn:hover,
  .ml-lab:hover,
  .ml-person:hover {
    transform: none;
  }
}

/* ── dark mode ────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  :root {
    --ml-ink: #e2e8f0;
    --ml-ink-soft: #cbd5e1;
    --ml-ink-faint: #94a3b8;
    --ml-bg: #0f172a;
    --ml-card: #1e293b;
    --ml-line: rgba(148, 163, 184, 0.22);
  }

  .ml-top {
    background: #1e293b;
  }

  .ml-brand {
    color: #e2e8f0;
  }

  .ml-rail li.is-current span {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #e2e8f0;
  }

  .ml-rail li.is-done {
    color: #2dd4bf;
  }

  .ml-rail li.is-done span {
    background: #2dd4bf;
    border-color: #2dd4bf;
    color: #0f172a;
  }

  .ml-btn-go {
    color: #fff;
  }

  .ml-detail-move,
  .ml-done-move {
    background: color-mix(in srgb, var(--ml-color, #334155) 26%, #1e293b);
  }

  .ml-detail-hard {
    background: rgba(148, 163, 184, 0.1);
  }

  .ml-error {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fecaca;
  }
}

/* ── print ────────────────────────────────────────────────────────────── */

@media print {
  .ml-rail,
  .ml-actions,
  .ml-back,
  .ml-skip {
    display: none !important;
  }

  body {
    background: #fff;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
 * Access controls, portraits, and the richer step surfaces.
 * Appended in the engagement/ESOL pass — see mentor-lab.js header.
 * ═══════════════════════════════════════════════════════════════════════ */

/* ── access bar ───────────────────────────────────────────────────────── */

.ml-access {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ml-lang {
  display: inline-flex;
  border: 1.5px solid var(--ml-line);
  border-radius: 999px;
  overflow: hidden;
}

.ml-lang button {
  padding: 8px 14px;
  min-height: 40px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--ml-ink-soft);
  cursor: pointer;
}

.ml-lang button.is-on {
  background: #0f766e;
  color: #fff;
}

.ml-lang button:focus-visible,
.ml-speak-toggle:focus-visible {
  outline: 3px solid #7c3aed;
  outline-offset: 2px;
}

.ml-speak-toggle {
  min-height: 40px;
  padding: 8px 16px;
  border: 1.5px solid var(--ml-line);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--ml-ink-soft);
  cursor: pointer;
}

.ml-speak-toggle.is-on {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

.ml-speak-hint {
  margin: 0;
  padding: 10px clamp(16px, 4vw, 32px);
  background: #ede9fe;
  color: #4c1d95;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: center;
}

/* In read-aloud mode, readable text advertises that it is tappable. */
body.ml-speaking .ml-lab-sounds,
body.ml-speaking .ml-lab-move,
body.ml-speaking .ml-person-simple,
body.ml-speaking .ml-detail-simple,
body.ml-speaking .ml-detail-sec p,
body.ml-speaking .ml-labhead-move,
body.ml-speaking .ml-done-move {
  cursor: pointer;
  text-decoration: underline dotted rgba(124, 58, 237, 0.6);
  text-underline-offset: 3px;
}

.ml-rail em {
  font-style: normal;
}

/* ── hero ─────────────────────────────────────────────────────────────── */

.ml-hero-strip {
  display: flex;
  gap: 6px;
  margin: 0 0 18px;
  flex-wrap: wrap;
}

.ml-strip-face {
  line-height: 0;
  animation: ml-pop 0.4s ease both;
}

.ml-strip-face:nth-child(2) { animation-delay: 0.05s; }
.ml-strip-face:nth-child(3) { animation-delay: 0.1s; }
.ml-strip-face:nth-child(4) { animation-delay: 0.15s; }
.ml-strip-face:nth-child(5) { animation-delay: 0.2s; }
.ml-strip-face:nth-child(6) { animation-delay: 0.25s; }
.ml-strip-face:nth-child(7) { animation-delay: 0.3s; }

@keyframes ml-pop {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(6px);
  }
}

.ml-big {
  font-size: 1.22rem;
  font-weight: 600;
}

.ml-facts {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.ml-facts li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--ml-card);
  border: 1px solid var(--ml-line);
  font-size: 1rem;
}

.ml-facts li span {
  font-size: 1.2rem;
  line-height: 1.2;
}

.ml-facts li em {
  font-style: normal;
}

/* ── vocabulary chips on the lab cards ────────────────────────────────── */

.ml-lab-words {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.ml-word {
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ml-color, #334155) 16%, transparent);
  color: var(--ml-ink);
  font-size: 0.72rem;
  font-weight: 650;
  cursor: help;
}

/* ── lab header on the matches step ───────────────────────────────────── */

.ml-labhead {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 20px;
  padding: 18px 20px;
  border-radius: var(--ml-radius);
  border-left: 6px solid var(--ml-color, #334155);
  background: color-mix(in srgb, var(--ml-color, #334155) 10%, var(--ml-card));
}

.ml-labhead-emblem {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ml-color, #334155);
  color: #fff;
  font-size: 1.4rem;
}

.ml-labhead-move {
  margin: 2px 0 4px;
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.25;
}

.ml-labhead-blurb {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ml-ink-soft);
}

/* ── portraits ────────────────────────────────────────────────────────── */

.ma-svg {
  display: block;
  border-radius: 50%;
}

.ml-person-med,
.ml-detail-med,
.ml-done-med,
.ml-current-med {
  line-height: 0;
}

.ml-person-simple {
  font-size: 0.94rem;
  font-weight: 550;
  color: var(--ml-ink);
  line-height: 1.45;
}

.ml-person-lab i {
  font-style: normal;
}

/* ── detail ───────────────────────────────────────────────────────────── */

.ml-detail-simple {
  margin: 20px 0 0;
  font-size: 1.24rem;
  font-weight: 600;
  line-height: 1.45;
  max-width: 60ch;
}

.ml-detail-move {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ml-detail-move-emblem {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ml-color, #334155);
  color: #fff;
  font-size: 1.25rem;
}

.ml-more {
  margin: 22px 0 0;
}

.ml-more > summary {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--ml-line);
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--ml-ink-soft);
  cursor: pointer;
}

.ml-more > summary:focus-visible {
  outline: 3px solid var(--ml-color, #334155);
  outline-offset: 3px;
}

/* ── done ─────────────────────────────────────────────────────────────── */

.ml-done {
  position: relative;
  overflow: hidden;
}

.ml-done-burst {
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 220px;
  background: radial-gradient(
    ellipse at 50% 0%,
    color-mix(in srgb, var(--ml-color, #334155) 30%, transparent),
    transparent 70%
  );
  pointer-events: none;
}

.ml-done-med,
.ml-done > * {
  position: relative;
}

.ml-done-lab {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .ml-strip-face {
    animation: none;
  }
}

@media (max-width: 620px) {
  .ml-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .ml-detail-simple {
    font-size: 1.1rem;
  }
}

@media (prefers-color-scheme: dark) {
  .ml-speak-hint {
    background: #2e1065;
    color: #ddd6fe;
  }

  .ml-labhead {
    background: color-mix(in srgb, var(--ml-color, #334155) 22%, var(--ml-card));
  }
}
