/* Martin Consulting interactive lessons: one theme, colors sampled from the website. */
:root {
  --primary: #462366;      /* header, active items */
  --primary-2: #4a2868;
  --heading: #1c1d46;      /* headings, number lines */
  --accent: #530f97;       /* buttons, markers */
  --accent-soft: #eee4f8;
  --body: #292137;
  --paper: #f2eef6;
  --line: #ded4e8;
  --muted: #6b5a80;
  --half: #e8505b;         /* "coral": exactly on a halfway point */
  --ok: #187b50;
  --bad: #b42b38;
  --font: "Avenir Next", Avenir, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--body); font: 18px/1.4 var(--font); }
h1, h2, h3, .tile strong, .big { color: var(--heading); }
h1 { font-size: clamp(30px, 4vw, 58px); line-height: 1.12; margin: 12px 0 24px; font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: clamp(22px, 3vw, 38px); font-weight: 800; }
p, li { line-height: 1.5; }

/* Header */
header { background: linear-gradient(110deg, #42225f, var(--primary-2)); color: #fff; padding: 14px 28px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
header .brand-logo { width: 142px; height: 86px; object-fit: contain; }
header small { flex: 1; color: var(--paper); font-size: 14px; font-weight: 600; letter-spacing: 0.025em; }

/* Buttons */
button, select, input { font: inherit; }
button { border: 1px solid #cbbbd9; background: #fff; color: var(--heading); border-radius: 4px; padding: 10px 15px; cursor: pointer; font-weight: 650; }
button:hover { background: var(--accent-soft); }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
header button:focus-visible { outline-color: #fff; }
button:disabled { opacity: 0.45; cursor: default; }
.gold { background: var(--accent); border-color: var(--accent); color: #fff; }
.gold:hover { background: var(--primary); color: #fff; }

/* Layout */
.layout { display: flex; gap: 18px; padding: 18px; max-width: 1800px; margin: auto; }
nav { width: 245px; flex-shrink: 0; max-height: 80vh; overflow: auto; position: sticky; top: 10px; align-self: flex-start; }
nav button { display: block; text-align: left; width: 100%; margin-bottom: 8px; font-size: 15px; border-radius: 3px; }
nav button.active { background: var(--primary); color: #fff; border-left: 6px solid #a88aca; }
main { min-width: 0; flex: 1; }
article { background: #fff; border-radius: 5px; min-height: min(56vw, 650px); padding: clamp(20px, 3vw, 48px); border-top: 5px solid var(--primary); box-shadow: 0 2px 14px #1c1d4612; }
.eyebrow { font-size: 14px; font-weight: 800; letter-spacing: 2px; color: #532680; }
.hero { background: linear-gradient(120deg, #42225f, var(--primary-2)); color: #fff; }
.hero h1, .hero h2 { color: #fff; }
.hero .eyebrow { color: var(--paper); }
.hero .tile { background: #fff; color: var(--heading); }
.lead { font-size: clamp(20px, 2vw, 26px); }

/* Content blocks */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.tile { background: var(--paper); border-radius: 5px; padding: 18px; border: 1px solid var(--line); }
.tile strong { font-size: 24px; }
.big { font-size: clamp(35px, 6vw, 76px); font-weight: 800; }
.muted { color: var(--muted); }
.answer { font-weight: 700; color: var(--accent); }
.caption { color: var(--muted); font-size: 15px; margin: 6px 0 0; }
svg { width: 100%; max-height: 220px; display: block; touch-action: none; }
.slider { display: block; margin: 8px 0; }
input[type=range] { width: 100%; accent-color: var(--heading); }
.toolbar, .audio, .controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.toolbar #progress { flex: 1; text-align: center; color: var(--muted); font-size: 16px; }
.audio { background: #fff; padding: 12px; border-radius: 12px; font-size: 15px; }
.audio details { width: 100%; }

/* Rounding steps */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.step { background: var(--paper); border-radius: 5px; padding: 14px; min-height: 100px; }
.step b { display: block; color: #532680; font-size: 14px; }
.step span { font-size: 22px; font-weight: 750; color: var(--heading); }

/* Vocabulary */
.words { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.words .example { color: var(--accent); font-weight: 700; }
.words.rows { grid-template-columns: 1fr; }
.words.rows .tile { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 8px 28px; align-items: center; }
.words.rows .term-text p { margin: 6px 0; }
.words.rows .term-visual svg { max-height: 160px; }
.words.dense .tile { padding: 12px; }
.words.dense p { margin: 5px 0; font-size: 17px; }
.words.dense strong { font-size: 20px; }
.digits { display: flex; gap: 8px; margin-top: 8px; }
.digit { display: inline-flex; align-items: center; justify-content: center; width: 58px; height: 66px; border: 2px solid var(--heading); border-radius: 6px; background: #fff; font-size: 36px; font-weight: 800; color: var(--heading); }
.digit.hl { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Sorts */
.bank, .bin { min-height: 95px; border: 2px dashed #b6a3c8; padding: 12px; border-radius: 12px; }
.bins { margin-top: 14px; }
.bin h3 { margin: 0 0 12px; }
.number { font-size: 25px; margin: 4px; min-width: 65px; }
.selected { outline: 3px solid var(--accent); background: var(--accent-soft); }
.ok { border: 3px solid var(--ok); }
.bad { border: 3px solid var(--bad); }
.number.half { background: var(--half); border-color: var(--half); color: #fff; }
.number.half.ok { border-color: var(--ok); }
.legend { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.swatch { width: 22px; height: 16px; border-radius: 3px; background: var(--half); display: inline-block; }
.status { min-height: 30px; font-weight: 650; }

/* Work backward and question lists */
.review { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.boundlist { display: grid; gap: 12px; }
.boundlist .tile { padding: 14px; }
.boundlist .tile strong { font-size: clamp(18px, 2vw, 25px); }

.hidden { display: none !important; }
.present-only { display: none; }

/* Presenting mode: the lesson fills the screen */
body.presenting header, body.presenting nav, body.presenting .audio { display: none; }
body.presenting .present-only { display: inline-block; }
body.presenting .layout { max-width: none; padding: 12px 18px; }
body.presenting article { min-height: calc(100vh - 100px); }
:fullscreen { overflow: auto; background: var(--paper); }

@media (max-width: 850px) {
  .layout { display: block; }
  nav { width: 100%; display: flex; overflow: auto; gap: 6px; position: static; max-height: none; }
  nav button { min-width: 150px; }
  header { padding: 10px 16px; }
  header .brand-logo { width: 96px; height: 56px; }
  header small { flex-basis: 100%; order: 3; }
  article { min-height: 0; }
  .audio audio { max-width: 100%; }
  .words { grid-template-columns: 1fr; }
  .words.rows .tile { grid-template-columns: 1fr; }
}

/* Link back to the lesson catalog */
.back-link { color: #fff; font-size: 14px; font-weight: 700; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
body.presenting .back-link { display: none; }
