/* Physics Decoded — styles for lesson content (notes + MCQ quizzes).
   Content files use ONLY the classes documented in docs/AUTHORING.md. */

/* ---------- Lesson layout ---------- */
.lesson-head { margin-bottom: 28px; }
.lesson-head h1 { margin: 6px 0 8px; font-size: clamp(1.7rem, 3.6vw, 2.4rem); }
.lesson-head .lead { margin: 0; color: var(--muted); font-size: 1.08rem; max-width: var(--measure); }
.lesson-head .tags { display: flex; gap: 8px; flex-wrap: wrap; }
.lesson-head .meta { color: var(--muted); margin: .4em 0 0; font-size: .9rem; }

.lesson { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 36px; align-items: start; }
.lesson.no-toc { grid-template-columns: minmax(0, 1fr); }
.toc { position: sticky; top: 84px; font-size: .92rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; max-height: calc(100vh - 110px); overflow: auto; }
.toc strong { display: block; margin-bottom: 8px; }
.toc ol { margin: 0; padding-left: 18px; }
.toc li { margin: 4px 0; }
.toc a { color: var(--muted); }
.toc a.active { color: var(--brand-ink); font-weight: 600; }

/* ---------- Notes typography ---------- */
.notes-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px clamp(18px, 4vw, 44px); box-shadow: var(--shadow); min-width: 0; }
.notes-body > * { max-width: var(--measure); }
.notes-body h2 { font-size: 1.5rem; margin: 2.2em 0 .6em; padding-bottom: 8px; border-bottom: 2px solid var(--brand-100); scroll-margin-top: 80px; }
.notes-body h2:first-child { margin-top: 0; }
.notes-body h3 { font-size: 1.18rem; margin: 1.6em 0 .5em; color: var(--brand-ink); scroll-margin-top: 80px; }
.notes-body p, .notes-body li { font-size: 1.04rem; }
.notes-body img, .notes-body svg { max-width: 100%; height: auto; }
.notes-body code { font-family: var(--mono); background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: .92em; }
.notes-body hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }

/* Tables */
.notes-body table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: .96rem; display: block; overflow-x: auto; }
.notes-body th, .notes-body td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
.notes-body th { background: var(--surface-2); }

/* Figures */
.notes-body figure { margin: 1.5em 0; text-align: center; }
.notes-body figcaption { color: var(--muted); font-size: .9rem; margin-top: 8px; }

/* Display formula */
.formula { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 18px; margin: 1.2em 0;
  overflow-x: auto; text-align: center; font-size: 1.08rem; }
.formula .where { display: block; text-align: left; font-size: .92rem; color: var(--muted); margin-top: 8px; }

/* Callout boxes: <div class="box definition"> … </div> */
.box { border-left: 5px solid var(--kind, var(--brand-600)); background: var(--kind-bg, var(--brand-100));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 14px 18px; margin: 1.3em 0; }
.box > :first-child { margin-top: 0; }
.box > :last-child { margin-bottom: 0; }
.box::before { display: block; font-weight: 800; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--kind, var(--brand-ink)); margin-bottom: 6px; }
.box[data-title]::before { content: attr(data-title) !important; }
.box.definition { --kind: var(--notes); --kind-bg: var(--notes-bg); } .box.definition::before { content: "Definition"; }
.box.law        { --kind: var(--brand-ink); --kind-bg: var(--brand-100); } .box.law::before { content: "Law / Principle"; }
.box.note       { --kind: var(--muted); --kind-bg: var(--surface-2); } .box.note::before { content: "Note"; }
.box.tip        { --kind: var(--good); --kind-bg: var(--good-bg); } .box.tip::before { content: "Exam tip"; }
.box.warning    { --kind: var(--bad); --kind-bg: var(--bad-bg); } .box.warning::before { content: "Common mistake"; }
.box.example    { --kind: var(--warn); --kind-bg: var(--warn-bg); } .box.example::before { content: "Worked example"; }

/* Hidden solutions: <details class="solution"><summary>Solution</summary> … </details> */
.solution { margin-top: 10px; }
.solution summary { cursor: pointer; font-weight: 700; color: var(--brand-ink); }
.solution[open] summary { margin-bottom: 8px; }

/* Key points list */
.key-points { list-style: none; padding: 0; }
.key-points li { position: relative; padding-left: 28px; margin: 8px 0; }
.key-points li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--good); font-weight: 800; }

/* Two-column layout for comparisons */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; max-width: none !important; }
.cols > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 18px; }
.cols > div > :first-child { margin-top: 0; }

/* Related lessons at the end */
.related { margin-top: 36px; }
.related h2 { font-size: 1.2rem; }

/* ---------- MCQ quiz ---------- */
.quiz-bar { position: sticky; top: 64px; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 18px;
  box-shadow: var(--shadow); margin-bottom: 20px; }
.quiz-bar .score { font-weight: 700; }
.quiz-bar .progress { flex: 1 1 160px; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.quiz-bar .progress span { display: block; height: 100%; width: 0; background: var(--mcq); transition: width .2s; }
.quiz-bar select, .quiz-bar button { font: 600 .88rem var(--font); padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }

.questions { list-style: none; padding: 0; margin: 0; counter-reset: q; display: grid; gap: 14px; }
.question { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.question[hidden] { display: none; }
.question .q-head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.question .q-text { margin: 0 0 12px; font-weight: 600; font-size: 1.04rem; }
.question .q-num { color: var(--muted); font-weight: 700; margin-right: 4px; }
.diff { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; flex: none; }
.diff.easy { background: var(--good-bg); color: var(--good); }
.diff.medium { background: var(--warn-bg); color: var(--warn); }
.diff.hard { background: var(--bad-bg); color: var(--bad); }

.options { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.option { width: 100%; text-align: left; display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px;
  border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font: inherit; cursor: pointer; }
.option:hover:not(:disabled) { border-color: var(--brand-ink); }
.option .letter { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 700; font-size: .85rem; }
.option:disabled { cursor: default; }
.option.correct { border-color: var(--good); background: var(--good-bg); }
.option.correct .letter { background: var(--good); color: var(--surface); }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); }
.option.wrong .letter { background: var(--bad); color: var(--surface); }
.explanation { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.explanation[hidden] { display: none; }
.explanation strong { color: var(--brand-ink); }
.verdict { font-weight: 700; margin-right: 6px; }
.verdict.good { color: var(--good); } .verdict.bad { color: var(--bad); }

.result { text-align: center; padding: 28px; margin-top: 20px; }
.result[hidden] { display: none; }
.result .big { font-size: 2.4rem; font-weight: 800; color: var(--brand-ink); }

@media (max-width: 960px) {
  .lesson { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; max-height: none; order: -1; }
}
@media (max-width: 720px) {
  .notes-body { padding: 20px 16px; border-radius: var(--radius-sm); }
  .quiz-bar { top: 8px; }
}
@media print {
  .site-header, .footer, .toc, .quiz-bar, .nav-search { display: none !important; }
  .notes-body, .question { box-shadow: none; border: 0; }
  .solution { display: block; } .explanation[hidden] { display: block; }
}
