/* SLCC Math Placement Prep — shared stylesheet.
   Calm, one column, large type, soft colors, no animation. */
:root {
  --bg: #fbfaf6;
  --paper: #ffffff;
  --ink: #2a2a28;
  --ink-soft: #5d5c57;
  --line: #e4e1d8;
  --accent: #2f6a6e;          /* soft teal */
  --accent-bg: #e9f2f1;
  --ok: #2d6e47;
  --ok-bg: #e8f3ec;
  --no: #9a4a3f;
  --no-bg: #f8ece9;
  --tip-bg: #fbf4e2;          /* "stuck?" box */
  --tip-line: #e8d9ad;
  --break-bg: #eef0f8;
  --break-line: #cfd5ea;
  --c1: #2f6a6e; --c2: #9a5b2f; --c3: #5a5a9e; --c4: #7a4e7a;
  --radius: 10px;
  --measure: 40rem;
  --serif: "Charter", "Bitstream Charter", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1d1f; --paper: #242528; --ink: #e8e6e1; --ink-soft: #b3b0a8; --line: #3a3b3f;
    --accent: #8cc3c2; --accent-bg: #23383a; --ok: #8fd0a6; --ok-bg: #1f3428; --no: #e7a59a; --no-bg: #3a2522;
    --tip-bg: #35301f; --tip-line: #5a4f2e; --break-bg: #262a38; --break-line: #3d4460;
    --c1: #8cc3c2; --c2: #e0a77a; --c3: #a9a9f0; --c4: #d6a3d6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1d1f; --paper: #242528; --ink: #e8e6e1; --ink-soft: #b3b0a8; --line: #3a3b3f;
  --accent: #8cc3c2; --accent-bg: #23383a; --ok: #8fd0a6; --ok-bg: #1f3428; --no: #e7a59a; --no-bg: #3a2522;
  --tip-bg: #35301f; --tip-line: #5a4f2e; --break-bg: #262a38; --break-line: #3d4460;
  --c1: #8cc3c2; --c2: #e0a77a; --c3: #a9a9f0; --c4: #d6a3d6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 19px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--serif); line-height: 1.65;
}
main, .page { max-width: var(--measure); margin: 0 auto; padding: 1.5rem 16px 4rem; }
h1, h2, h3, h4 { font-family: var(--sans); line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; margin: 0.4rem 0 0.6rem; }
h2 { font-size: 1.3rem; margin: 2.6rem 0 0.8rem; }
h3 { font-size: 1.08rem; margin: 1.8rem 0 0.5rem; }
p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 650; }
.muted, .meta { color: var(--ink-soft); }
.small { font-size: 0.88rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--paper); padding: 0.4rem 0.8rem; z-index: 5; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
* { animation: none !important; transition: none !important; scroll-behavior: auto; }

/* ---------- top crumbs + header ---------- */
.crumbs { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-soft); padding-top: 0.6rem; }
.crumbs a { color: var(--ink-soft); }
.kicker { font-family: var(--sans); font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin: 1.6rem 0 0; }
.goal { background: var(--accent-bg); border-radius: var(--radius); padding: 0.9rem 1.1rem; }

/* step markers */
.steps-bar { list-style: none; padding: 0; margin: 1.4rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem; font-family: var(--sans); font-size: 0.82rem; }
.steps-bar li { margin: 0; }
.steps-bar a { display: inline-block; padding: 0.2rem 0.65rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); text-decoration: none; background: var(--paper); }
.step-num { display: block; font-size: 0.8rem; font-weight: 500; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.15rem; }
section.step { scroll-margin-top: 1rem; }

/* ---------- boxes ---------- */
.why-test { border-left: 3px solid var(--accent); padding: 0.2rem 0 0.2rem 0.9rem; color: var(--ink-soft); }
.why-test strong { color: var(--ink); }
.stuck { background: var(--tip-bg); border: 1px solid var(--tip-line); border-radius: var(--radius); padding: 0.9rem 1.1rem; margin: 1.4rem 0; }
.stuck > :last-child, .break > :last-child, .goal > :last-child, .callout > :last-child { margin-bottom: 0; }
.stuck-title, .break-title { font-family: var(--sans); font-weight: 650; font-size: 0.92rem; margin-bottom: 0.3rem; }
.break { background: var(--break-bg); border: 1px solid var(--break-line); border-radius: var(--radius); padding: 0.9rem 1.1rem; margin: 2rem 0; }
.callout { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1.1rem; margin: 1.2rem 0; }
.key { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 0.9rem 1.1rem; margin: 1.2rem 0; }
.key > :last-child { margin-bottom: 0; }

/* ---------- worked examples ---------- */
.example { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1.2rem 0; }
.example h3 { margin-top: 0.2rem; }
ol.work { padding-left: 1.3rem; }
ol.work li { margin-bottom: 0.7rem; }
.why { display: block; color: var(--ink-soft); font-size: 0.9rem; }

/* ---------- problems ---------- */
.problem { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem 0.8rem; margin: 1.1rem 0; scroll-margin-top: 1rem; }
.problem-label { font-family: var(--sans); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin-bottom: 0.4rem; }
.problem .q { margin-bottom: 0.7rem; }
.answer-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.answer-input { flex: 1 1 14rem; min-width: 0; font: inherit; font-family: var(--sans); font-size: 1rem; padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.format-hint { font-family: var(--sans); font-size: 0.8rem; color: var(--ink-soft); margin: 0.3rem 0 0.6rem; }
.actions, .verdict-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.4rem 0 0.4rem; }
.feedback { font-family: var(--sans); font-size: 0.95rem; min-height: 1.4em; margin: 0.4rem 0; }
.feedback.ok { color: var(--ok); }
.feedback.no { color: var(--no); }
.solution, .answer { border-top: 1px dashed var(--line); margin-top: 0.7rem; padding-top: 0.7rem; }
.solution-title { font-family: var(--sans); font-weight: 650; font-size: 0.9rem; margin-bottom: 0.3rem; }
.selfmark { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.6rem; font-family: var(--sans); font-size: 0.9rem; }
.selfmark-q { color: var(--ink-soft); }
.problem[data-status="got"] { border-left: 4px solid var(--ok); }
.problem[data-status="missed"] { border-left: 4px solid var(--no); }

ol.choices { list-style: none; padding: 0; margin: 0 0 0.6rem; }
ol.choices li { border: 1px solid var(--line); border-radius: 8px; padding: 0.45rem 0.8rem; margin-bottom: 0.45rem; cursor: pointer; background: var(--bg); }
ol.choices li:hover { border-color: var(--accent); }
ol.choices li.picked { border-color: var(--accent); background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.choice-letter { font-family: var(--sans); font-weight: 650; color: var(--ink-soft); margin-right: 0.6rem; }
.locked ol.choices li { cursor: default; }

/* ---------- buttons ---------- */
.btn { font-family: var(--sans); font-size: 0.92rem; padding: 0.45rem 0.95rem; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.4; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-quiet { background: transparent; }
.btn-soft[aria-pressed="true"].got { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.btn-soft[aria-pressed="true"].missed { background: var(--no-bg); border-color: var(--no); color: var(--no); }
.btn-big { font-size: 1rem; padding: 0.65rem 1.3rem; margin-top: 1rem; }
.btn-danger { color: var(--no); }

/* ---------- quizzes ---------- */
.quiz-intro { background: var(--accent-bg); border-radius: var(--radius); padding: 0.9rem 1.1rem; }
.timer { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; font-family: var(--sans); position: sticky; top: 0; background: var(--bg); padding: 0.5rem 0; z-index: 2; }
.timer-show { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.problem.is-right { border-left: 4px solid var(--ok); }
.problem.is-wrong { border-left: 4px solid var(--no); }
.verdict { font-family: var(--sans); font-size: 0.95rem; border-radius: 8px; padding: 0.5rem 0.8rem; margin-top: 0.6rem; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.no { background: var(--no-bg); color: var(--no); }
.verdict .ans { color: var(--ink); }
.revisit { font-family: var(--sans); font-size: 0.9rem; }
.quiz-results { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4rem 1.2rem 1rem; margin: 2rem 0; scroll-margin-top: 1rem; }
.score-big { font-family: var(--sans); font-size: 1.4rem; font-weight: 650; }
table.breakdown { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.9rem; margin-bottom: 1rem; }
table.breakdown th, table.breakdown td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.rec-skim { color: var(--ok); } .rec-review { color: var(--c2); } .rec-study { color: var(--no); }
.all-right { color: var(--ok); }

/* ---------- wrap-up + nav ---------- */
.source { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1.1rem; }
.source > :last-child { margin-bottom: 0; }
.ask { border-left: 3px solid var(--c3); padding-left: 0.9rem; }
.lesson-status { font-family: var(--sans); font-size: 0.92rem; color: var(--ink-soft); }
.lesson-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 3rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-family: var(--sans); font-size: 0.92rem; }
.lesson-nav a { display: block; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; background: var(--paper); }
.lesson-nav a span { display: block; font-size: 0.78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; }
.lesson-nav .next { text-align: right; }
.lesson-nav .wide { grid-column: span 1; text-align: center; }

/* ---------- course home / indexes ---------- */
.unit { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1.1rem 0.6rem; margin: 1rem 0; scroll-margin-top: 1rem; }
.unit h3 { margin: 0.3rem 0 0.4rem; }
.unit ol { padding-left: 0; list-style: none; margin-bottom: 0.4rem; }
.unit li { display: flex; gap: 0.6rem; align-items: baseline; margin-bottom: 0.25rem; }
.check { font-family: var(--sans); width: 1.2rem; flex: none; color: var(--ok); }
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 0.3rem 0 0.6rem; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; }
.badge { font-family: var(--sans); font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.badge.rec-skim { color: var(--ok); } .badge.rec-review { color: var(--c2); } .badge.rec-study { color: var(--no); }
.unit-meta { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-soft); }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }

table.plan { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.plan th, table.plan td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.plan th { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-soft); }
.week { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1.1rem; margin: 1rem 0; }
.week.now { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.week h3 { margin-top: 0.2rem; }

/* ---------- reference sheets ---------- */
.ref-grid { display: grid; grid-template-columns: 1fr; gap: 0.8rem; }
.rule { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 1rem; }
.rule h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.rule > :last-child { margin-bottom: 0; }
dl.glossary dt { font-family: var(--sans); font-weight: 650; margin-top: 1.1rem; scroll-margin-top: 1rem; }
dl.glossary dd { margin: 0.2rem 0 0 0; }
dl.glossary .avoid { color: var(--ink-soft); font-size: 0.88rem; }

/* ---------- graphs ---------- */
figure.graph { margin: 1.2rem auto; max-width: 22rem; }
figure.graph figcaption { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-soft); text-align: center; margin-top: 0.3rem; }
.graph-svg { width: 100%; height: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.graph-svg .grid { stroke: var(--line); stroke-width: 1; }
.graph-svg .axis { stroke: var(--ink-soft); stroke-width: 1.4; }
.graph-svg .ticks text { font: 10px var(--sans); fill: var(--ink-soft); }
.graph-svg .curve { fill: none; stroke-width: 2.4; }
.graph-svg .dashed { stroke-dasharray: 6 5; }
.graph-svg .c1 { stroke: var(--c1); fill: var(--c1); } .graph-svg .c2 { stroke: var(--c2); fill: var(--c2); }
.graph-svg .c3 { stroke: var(--c3); fill: var(--c3); } .graph-svg .c4 { stroke: var(--c4); fill: var(--c4); }
.graph-svg path.curve { fill: none; }
.graph-svg .shade { stroke: none; opacity: 0.14; }
.graph-svg .pt { stroke-width: 2; }
.graph-svg .pt.open { fill: var(--paper); }
.graph-svg .pt-label, .graph-svg .fn-label { font: 11px var(--sans); fill: var(--ink); stroke: none; }

.katex { font-size: 1.08em; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.2rem 0; }

@media (max-width: 520px) {
  html { font-size: 18px; }
  .lesson-nav { grid-template-columns: 1fr; }
  .lesson-nav .next { text-align: left; }
}

@media print {
  html { font-size: 12pt; }
  body { background: #fff; color: #000; }
  .crumbs, .lesson-nav, .actions, .selfmark, .toolbar, .answer-row, .format-hint, .feedback, .complete-btn, .timer, .steps-bar, .btn { display: none !important; }
  .problem, .example, .rule, .unit, .week { break-inside: avoid; border-color: #bbb; }
  a { color: #000; }
  .solution[hidden] { display: none; }
  main, .page { max-width: none; padding: 0; }
  .ref-grid { grid-template-columns: 1fr 1fr; }
}
.feedback:empty { display: none; }

/* ---------- sign-in / sync bar (built by assets/sync.js) ---------- */
.sync-bar { font-family: var(--sans); font-size: 0.8rem; color: var(--ink-soft); background: var(--paper); border-bottom: 1px solid var(--line); padding: 0.35rem 16px; }
.sync-row, .sync-form { max-width: var(--measure); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.8rem; }
.sync-who { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.sync-status { flex: 1 1 auto; }
.sync-btn { font: inherit; font-size: 0.8rem; padding: 0.2rem 0.7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; line-height: 1.5; }
.sync-btn:hover { border-color: var(--accent); }
.sync-primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.sync-form { margin-top: 0.4rem; }
.sync-email { flex: 1 1 12rem; min-width: 0; font: inherit; font-size: 0.9rem; padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.sync-msg { max-width: var(--measure); margin: 0.35rem auto 0.1rem; color: var(--ink); }
@media print { .sync-bar { display: none !important; } }

/* ---------- small screens: nothing may push the page wider than the phone ---------- */
img, svg, video { max-width: 100%; }
@media (max-width: 520px) {
  table.breakdown, table.plan { display: block; overflow-x: auto; }
  .katex-display > .katex { max-width: 100%; }
  .problem, .example, .key, .callout, .stuck, .break, .source, .goal, .quiz-intro, .unit, .week { padding-left: 0.8rem; padding-right: 0.8rem; }
  .answer-input { flex-basis: 100%; }
  .timer { gap: 0.5rem; }
  .ref-grid { grid-template-columns: minmax(0, 1fr); }
  .rule { overflow-x: auto; }
}
