/* Skill pages, in the look of Which & Why: AP Calculus. Loaded after /style.css, which supplies the paper,
   the ink, the slate and the gold edge. This adds the app's marks and the lesson components.
   On paper the marks take the app's paper values; on the slate, its slate values. */
:root {
  --good: #2C7E50;
  --bad: #A03030;
  --mark: #C58A2E;
  --on-accent: #FFFFFF;
  --shadow: rgba(0, 42, 40, 0.14);

  /* The slate and the marks drawn on it are the same in both appearances, as in the app. */
  --slate-figure: #053D30;
  --chalk-solid: #F2EFE6;
  --s-area: #62C6BE;
  --s-measure: #E8AC54;
  --s-gain: #6FCF97;
  --s-loss: #EF8A8A;

  --t-move: 900ms;
  --t-pause: 450ms;
}
@media (prefers-color-scheme: dark) {
  :root {
    --good: #6FCF97;
    --bad: #EF8A8A;
    --mark: #E8AC54;
    --on-accent: #0A1615;
    --shadow: rgba(0, 0, 0, 0.35);
  }
}

.lesson-page .nav-inner, .lesson-page .footer, .wide { max-width: 1100px; }
.wide { margin: 0 auto; padding-inline: 22px; }

/* LessonLayout */
.lesson-head { padding-block: 48px 40px; max-width: 800px; }
.lesson-head .eyebrow a { color: inherit; font-weight: 600; }
.lesson-head h1 { font-size: clamp(34px, 5vw, 50px); line-height: 1.08; letter-spacing: -1px; margin: 14px 0 18px; }
.lesson-meta { margin: 0; color: var(--muted); font-size: 17px; max-width: 36em; }
.beat { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); column-gap: 44px; row-gap: 22px; align-items: start; padding-block: 52px; border-top: 1px solid var(--line); }
.beat > h2 { grid-column: 1 / -1; margin: 0; font-size: 32px; line-height: 1.15; letter-spacing: -0.6px; }
.beat-figure { position: sticky; top: 16px; display: grid; gap: 16px; min-width: 0; }
.beat-text { display: grid; gap: 20px; align-content: start; min-width: 0; }
@media (max-width: 900px) {
  .beat { grid-template-columns: minmax(0, 1fr); padding-block: 40px; }
  .beat-figure { position: static; }
  .beat > h2 { font-size: 27px; }
}

/* MathFigure, on a slate card */
.figure-card { border-radius: 22px; padding: 14px 12px 8px; box-shadow: 0 14px 32px var(--shadow); }
.figure { position: relative; }
.figure > svg { display: block; width: 100%; height: auto; overflow: visible; -webkit-user-select: none; user-select: none; }
.figure-labels { position: absolute; inset: 0; pointer-events: none; }
.flabel { position: absolute; width: max-content; white-space: nowrap; font-size: clamp(13px, 2.1vw, 17px); line-height: 1; color: var(--chalk); }
.flabel svg { max-width: none !important; }
.flabel.tick { font-size: 12px; color: var(--chalk-dim); font-variant-numeric: tabular-nums; }
.flabel.grey { color: var(--chalk-dim); }
@media (max-width: 560px) { .figure-card { border-radius: 18px; padding: 10px 6px 4px; } }

/* Math colours. \cb area, \cy measured, \cg gain, \cr loss or error, \cq scaffolding. */
.m-blue { color: var(--accent); }
.m-yellow { color: var(--mark); }
.m-green { color: var(--good); }
.m-red { color: var(--bad); }
.m-grey { color: var(--muted); }
.slate .m-blue { color: var(--s-area); }
.slate .m-yellow { color: var(--s-measure); }
.slate .m-green { color: var(--s-gain); }
.slate .m-red { color: var(--s-loss); }
.slate .m-grey { color: var(--chalk-dim); }
mjx-container { outline: none; }
mjx-container[display="true"] { margin: 4px 0 !important; }
.lesson mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
/* An inline formula wider than the text column scrolls inside itself rather than widening the page. */
.beat-text mjx-container:not([display="true"]) { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; padding-right: 6px; margin-right: -6px; }
.nobr { white-space: nowrap; }

/* Controls, in the app's button styles */
.controls { display: grid; gap: 6px; padding-inline: 4px; }
.controls-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: 14px; padding: 11px 18px; cursor: pointer; transition: transform 0.12s ease, opacity 0.12s ease; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: scale(0.975); opacity: 0.92; }
.btn:disabled { color: var(--muted); background: var(--line); border-color: var(--line); box-shadow: none; cursor: default; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); box-shadow: 0 6px 12px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn.primary:disabled { background: var(--line); color: var(--muted); border-color: var(--line); box-shadow: none; }
.btn[aria-pressed="true"] { border-color: var(--bad); color: var(--bad); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .lesson-step { transition: none !important; } }

/* Slider */
.slider { display: grid; grid-template-columns: 6.5em minmax(0, 1fr) 3.4em; align-items: center; gap: 12px; }
.slider.no-out { grid-template-columns: 6.5em minmax(0, 1fr); }
.slider label { font-size: 14px; font-weight: 500; color: var(--muted); }
.slider output { font-size: 14px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; color: var(--tone); }
.tone-measure { --tone: var(--mark); }
.tone-gain { --tone: var(--good); }
.tone-area { --tone: var(--accent); }
.tone-loss { --tone: var(--bad); }
.slider input { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; margin: 0; background: transparent; cursor: pointer; }
.slider input::-webkit-slider-runnable-track { height: 4px; background: var(--line); border-radius: 2px; }
.slider input::-moz-range-track { height: 4px; background: var(--line); border-radius: 2px; }
.slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--tone); border: 3px solid var(--paper); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.slider input::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--tone); border: 3px solid var(--paper); }
.slider input:focus-visible { outline: none; }
.slider input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent); }
.slider input:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--accent); }

.readouts { display: flex; flex-wrap: wrap; gap: 6px 26px; margin: 0; padding-inline: 4px; font-size: 14px; }
.readouts div { display: flex; gap: 8px; align-items: baseline; }
.readouts dt { color: var(--muted); }
.readouts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.tone-text-measure { color: var(--mark); }
.tone-text-area { color: var(--accent); }
.tone-text-gain { color: var(--good); }
.tone-text-loss { color: var(--bad); }
.tone-text-ink { color: var(--ink); }

/* NarrationBlock */
.narration p { margin: 0 0 12px; font-size: 18px; text-wrap: pretty; }
.narration p:last-child { margin-bottom: 0; }

/* Problems are written in chalk on the slate, as every problem is in the app. */
.problem { margin: 0; padding: 18px 20px; border-radius: 18px; font-size: 18px; color: var(--chalk); overflow-x: auto; }
.practice { display: grid; gap: 20px; }
.hint { margin: 0; color: var(--muted); }
.step-controls { display: flex; flex-wrap: wrap; gap: 10px; }

/* Steps on a timeline: numbered nodes joined by a rail, the next step's place holding its button. */
.reveal { display: grid; gap: 14px; }
.reveal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-height: 22px; }
.reveal-count { font-size: 11px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }
.text-btn { font: inherit; font-size: 14px; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 2px 0; cursor: pointer; }
.text-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-btn.again::before { content: "\21BA"; margin-right: 6px; font-weight: 400; }
.lesson-steps { list-style: none; margin: 0; padding: 0; display: grid; counter-reset: step; }
.lesson-step, .step-slot { position: relative; min-width: 0; padding: 3px 0 26px 44px; }
.lesson-step { transition: opacity var(--t-pause) ease; }
.lesson-step:not(.wrong) { counter-increment: step; }
.lesson-step::before, .step-slot::before {
  position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; box-sizing: border-box;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.lesson-step::before { content: counter(step); background: color-mix(in srgb, var(--accent) 14%, var(--paper)); color: var(--accent); }
.lesson-step.current::before { background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
/* The rail runs from a node down to the next one, and stops after the last place shown. */
.lesson-step::after, .step-slot::after { content: ""; position: absolute; left: 13px; top: 34px; bottom: 4px; width: 2px; border-radius: 1px; background: var(--line); }
.step-slot::after, .lesson-step:has(+ [hidden])::after, .lesson-step:last-child::after { display: none; }
.step-slot { display: flex; align-items: center; gap: 12px; padding-top: 0; padding-bottom: 0; min-height: 42px; }
.step-slot::before { content: attr(data-n); top: 7px; border: 1.5px dashed var(--line); color: var(--muted); background: var(--paper); }
.step-slot[hidden] { display: none; }
.lesson-step.pending { opacity: 0; }
.lesson-step p { margin: 0; }
.lesson-step .math { margin-top: 6px; font-size: 19px; }
.lesson-step .note { margin-top: 8px; color: var(--muted); font-size: 15px; }
.lesson-step.wrong::before { content: "\00D7"; background: var(--bad); color: var(--paper); font-size: 17px; font-weight: 600; }
.lesson-step.wrong.current::before { box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 18%, transparent); }
.wrong-card { margin-top: -3px; padding: 12px 16px 16px; border-radius: 14px; background: color-mix(in srgb, var(--bad) 9%, transparent); }
.lesson-step.wrong .wrong-tag { font-size: 11px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase; color: var(--bad); margin-bottom: 4px; }
.lesson-step.wrong .claim { color: var(--bad); }
.lesson-step.wrong .why { margin-top: 8px; }
.lesson-step.wrong .undo { margin-top: 12px; border-color: var(--bad); color: var(--bad); }
.lesson-step.wrong.undone::before { background: var(--line); color: var(--muted); box-shadow: none; }
.lesson-step.wrong.undone .wrong-card { background: var(--panel); }
.lesson-step.wrong.undone .claim, .lesson-step.wrong.undone .why { color: var(--muted); }
.lesson-step.wrong.undone .claim { text-decoration: line-through; }
.lesson-step.wrong.undone .wrong-tag { color: var(--muted); }
.lesson-step.wrong.undone .wrong-tag::after { content: " \00B7  undone"; }
.lesson-step.wrong.undone .undo { display: none; }

.fails { display: grid; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.fails h3 { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase; color: var(--bad); }
.fails p { margin: 0; }

/* ConceptCheck: the question on the slate, the choices in the app's choice style */
.checks { display: grid; gap: 6px; }
.checks .lead { margin: 0 0 6px; font-size: 18px; }
fieldset.check { margin: 0; padding: 18px 0 8px; border: 0; min-width: 0; }
.check legend { float: left; width: 100%; padding: 16px 18px; margin-bottom: 12px; font-size: 18px; color: var(--chalk); border-radius: 18px; }
.options { clear: both; display: grid; gap: 8px; }
.option { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--raised); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.option:hover { border-color: var(--accent); }
.option:has(input:checked) { border: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--raised)); }
.option.correct { border: 1.5px solid var(--good) !important; background: color-mix(in srgb, var(--good) 14%, var(--raised)) !important; }
.option.wrong { border: 1.5px solid var(--bad) !important; background: color-mix(in srgb, var(--bad) 12%, var(--raised)) !important; }
.option input { margin: 0; accent-color: var(--accent); }
.option > span { min-width: 0; }
.check-row { margin-top: 12px; }
.feedback { margin: 14px 0 0; padding: 12px 16px; border-radius: 14px; background: var(--panel); }
.feedback:empty { display: none; }
.feedback.right { background: color-mix(in srgb, var(--good) 12%, var(--paper)); }
.feedback.wrong { background: color-mix(in srgb, var(--bad) 10%, var(--paper)); }
.check-figure { margin-top: 14px; }

.app-line { margin: 4px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }

/* Previous and next skill */
.lesson-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-block: 28px 8px; border-top: 1px solid var(--line); }
.lesson-nav a { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); color: var(--ink); }
.lesson-nav a:hover { border-color: var(--accent); text-decoration: none; }
.lesson-nav .next { grid-column: 2; text-align: right; }
.lesson-nav .dir { font-size: 11px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase; color: var(--accent); }
.lesson-nav .name { font-size: 16px; font-weight: 500; }
@media (max-width: 560px) { .lesson-nav { grid-template-columns: 1fr; } .lesson-nav .next { grid-column: 1; } }

/* The units index and each unit's page */
.unit-head { padding-block: 48px 28px; max-width: 760px; }
.unit-head h1 { font-size: clamp(36px, 5vw, 52px); line-height: 1.08; letter-spacing: -1px; margin: 14px 0 14px; }
.unit-head p { margin: 0; color: var(--muted); font-size: 18px; }
.topics { display: grid; gap: 18px; padding-bottom: 24px; }
.topic { background: var(--raised); border: 1px solid var(--line); border-radius: 22px; padding: 22px 24px; scroll-margin-top: 16px; }
/* The topic heading reads as the app's topic sheet does: "Topic 6.2" large, its name quietly under it. */
.topic header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.topic h2 { display: flex; flex-direction: column; gap: 4px; margin: 0; font-weight: normal; }
.topic h2 .num { font-family: Georgia, "Times New Roman", serif; font-size: 32px; line-height: 1.1; letter-spacing: -0.6px; color: var(--ink); font-variant-numeric: tabular-nums; }
.topic h2 .name { font-family: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; line-height: 1.4; color: var(--muted); }
.topic .bc { font-size: 11px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.topic ol { list-style: none; margin: 12px 0 0; padding: 0; display: grid; }
.topic li a { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 11px 0; border-top: 1px solid var(--line); color: var(--ink); }
.topic li:first-child a { border-top: 0; }
.topic li a:hover { color: var(--accent); text-decoration: none; }
.topic li .detail { display: block; color: var(--muted); font-size: 14px; font-weight: normal; }
.topic li .arrow { color: var(--muted); flex: none; }
@media (min-width: 1000px) {
  .topic ol { grid-template-columns: 1fr 1fr; column-gap: 36px; }
  .topic li:nth-child(2) a { border-top: 0; }
}
.unit-card { display: block; border-radius: 24px; padding: 30px 28px; margin-bottom: 18px; }
.unit-card:hover { text-decoration: none; }
.unit-card h2 { font-family: Georgia, "Times New Roman", serif; font-weight: normal; font-size: 30px; margin: 8px 0 6px; color: var(--chalk); }
.unit-card p { margin: 0; color: var(--chalk-dim); }

/* The page's text as plain HTML, for search engines and readers without JavaScript. Hidden as soon as JavaScript
   runs (an inline script in the head adds .js); the route then draws the interactive page in its place. */
.js .static-lesson { display: none; }
.static-lesson > section { padding-block: 28px; border-top: 1px solid var(--line); display: grid; gap: 12px; max-width: 760px; }
.static-lesson h2 { font-size: 28px; line-height: 1.15; }
.static-lesson h3 { font-size: 13px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: var(--bad); }
.static-lesson ol, .static-lesson ul { padding-left: 24px; display: grid; gap: 10px; }
.static-lesson .note, .static-lesson .hint { color: var(--muted); }
.static-lesson details summary { cursor: pointer; color: var(--accent); font-weight: 600; }
