/* ============================================================
   LESSON V2: the redesigned lesson reader (owner, 8 Nov 2026)
   Preview only: every rule sits under html.app-v2, the preview class.
   Desktop: contents rail | the lesson at ~68ch | notes + tutor.
   Phone: the lesson, with contents, notes and the tutor as bottom sheets.
   Built by lv2Layout() in app.js. Uses the role tokens from styles.css.
   ============================================================ */

html.app-v2 .view[data-view="lesson"],
html.app-v2 .view[data-view="review"]:has(.lv2) { max-width: 1408px; padding: 0 24px 80px; }
html.app-v2 .view[data-view="lesson"] > #lessonBack { display: none; }
html.app-v2 .lv2 [hidden] { display: none !important; }

/* ---- the bar: back, where you are in the course, tools ---- */
/* The site nav scrolls away (html, body are 100% tall), so the bar sticks at 0.
   The shadows paint it edge to edge without widening the page. */
html.app-v2 .lv2-bar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin: 0 -24px; padding: 10px 24px; background: #fff; box-shadow: 0 0 0 100vmax #fff, 0 1px 0 100vmax var(--slate-200); clip-path: inset(0 -100vmax -1px); }
html.app-v2 .lv2-back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; border: 0; background: none; cursor: pointer; font: 600 14px Inter, sans-serif; color: var(--ink-navy); max-width: 260px; }
html.app-v2 .lv2-back-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.app-v2 .lv2-where { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
html.app-v2 .lv2-where-t { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: #475569; }
html.app-v2 .lv2-where-t > span:first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.app-v2 .lv2-where-t b { color: var(--ink-navy); }
html.app-v2 .lv2-left { flex: none; }
html.app-v2 .lv2-strip { display: flex; gap: 3px; }
html.app-v2 .lv2-seg { flex: 1 1 0; height: 6px; border-radius: 4px; background: var(--slate-200); }
html.app-v2 .lv2-seg.done { background: var(--action-green); }
html.app-v2 .lv2-seg.cur { background: var(--soft-mint); }
html.app-v2 .lv2-tools { display: flex; gap: 10px; flex-wrap: wrap; }
html.app-v2 .lv2-btn { min-height: 44px; padding: 0 16px; border: 1px solid var(--slate-200); background: #fff; border-radius: 12px; cursor: pointer; font: 600 14px Inter, sans-serif; color: var(--ink-navy); white-space: pre; }
html.app-v2 .lv2-btn:hover { border-color: var(--action-green); }
html.app-v2 .lv2-btn[aria-pressed="true"] { background: var(--mint-50); border-color: var(--soft-mint); color: var(--naija-deep-green); }
html.app-v2 .lv2-tutor-btn, html.app-v2 .lv2-tutor-btn[aria-pressed="true"] { background: var(--naija-deep-green); border-color: var(--naija-deep-green); color: #fff; }
html.app-v2 .lv2-tutor-btn[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--soft-mint); }
html.app-v2 .lv2-toc-btn, html.app-v2 .lv2-dock, html.app-v2 .lv2-scrim, html.app-v2 .lv2-sheet-head .lv2-x, html.app-v2 .lv2-toc > .lv2-sheet-head { display: none; }

/* ---- three columns ---- */
html.app-v2 .lv2-cols { display: grid; grid-template-columns: 230px minmax(0, 720px) 300px; gap: 40px; justify-content: center; align-items: start; padding-top: 32px; }
html.app-v2 .lv2-review .lv2-cols { grid-template-columns: 230px minmax(0, 760px); }
html.app-v2 .lv2-main { min-width: 0; }
html.app-v2 .lv2-toc, html.app-v2 .lv2-side { position: sticky; top: 96px; max-height: calc(100vh - 112px); overflow: auto; min-width: 0; }
html.app-v2 .lv2-toc { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
html.app-v2 .lv2-toc-title { font-size: 12px; letter-spacing: .12em; color: #475569; margin: 0 0 8px 12px; }
html.app-v2 .lv2-toc-list { display: flex; flex-direction: column; gap: 2px; }
html.app-v2 .lv2-toc-a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px; border-radius: 12px; text-decoration: none; color: var(--slate-700); font-weight: 500; line-height: 1.35; }
html.app-v2 .lv2-toc-a:hover { background: var(--slate-100); color: var(--ink-navy); }
html.app-v2 .lv2-toc-a.cur { background: var(--mint-50); color: var(--naija-deep-green); font-weight: 700; }
html.app-v2 .lv2-toc-n { flex: none; width: 24px; height: 24px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font: 700 12px Poppins, sans-serif; background: var(--slate-100); color: var(--slate-700); }
html.app-v2 .lv2-toc-a.seen .lv2-toc-n { background: var(--action-green); color: #fff; }
html.app-v2 .lv2-toc-a.cur .lv2-toc-n { background: var(--naija-deep-green); color: #fff; }
html.app-v2 .lv2-toc-meta, html.app-v2 .lv2-toc-none { margin: 18px 0 0 12px; font-size: 13px; color: #475569; line-height: 1.5; }
html.app-v2 .lv2-side { display: flex; flex-direction: column; gap: 16px; }
html.app-v2 .lv2-card { background: #fff; border: 1px solid var(--slate-200); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
html.app-v2 .lv2-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
html.app-v2 .lv2-notes-ta { width: 100%; box-sizing: border-box; border: 1px solid var(--slate-300); border-radius: 12px; padding: 12px; font: 15px/1.55 Inter, sans-serif; color: var(--ink-navy); resize: vertical; min-height: 140px; }
html.app-v2 .lv2-notes-ta:focus { outline: 3px solid var(--proof-gold); outline-offset: 1px; border-color: transparent; }
html.app-v2 .lv2-notes-status { font-size: 13px; color: #475569; }
html.app-v2 .lv2-tutor .classroom-panel { margin: 0; border: 0; border-radius: 0; box-shadow: none; min-height: 0; }
html.app-v2 .lv2-tutor .classroom-header { padding: 0 0 12px; background: none; flex-wrap: wrap; }
html.app-v2 .lv2-tutor .classroom-header h3 { display: none; }
html.app-v2 .lv2-tutor .chat-messages { max-height: 46vh; min-height: 120px; padding: 12px 0; }
html.app-v2 .lv2-tutor .chat-input-bar { padding: 10px 0 0; }

/* ---- the lesson ---- */
html.app-v2 .lesson-stage.lv2-stage { border-radius: 24px; padding: 48px 56px 56px; box-shadow: none; }
html.app-v2 .lv2-stage > .muted:first-child { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--action-green); }
html.app-v2 .lv2-stage h1 { font: 800 40px/1.1 Poppins, sans-serif; letter-spacing: -.02em; margin: 10px 0 10px; }
html.app-v2 .lv2-stage .lesson-toolbar { border-bottom: 0; padding: 4px 0 8px; margin-bottom: 18px; }
html.app-v2 .lv2-stage .comfort-control, html.app-v2 .lv2-stage .lesson-body > .l-toc { display: none; }
html.app-v2 .lv2-stage .lesson-body { font-size: calc(18px * var(--reader-scale)); line-height: 1.75; color: #1E293B; }
html.app-v2 .lv2-stage .lesson-body p, html.app-v2 .lv2-stage .lesson-body .l-p { margin: 0 0 18px; max-width: 68ch; }
html.app-v2 .lv2-stage .lesson-body .l-list { max-width: 68ch; padding-left: 1.4em; }
html.app-v2 .lv2-stage .lesson-body .l-list li { margin: 0 0 8px; }
html.app-v2 .lv2-stage .l-lead { font-size: calc(21px * var(--reader-scale)); line-height: 1.65; color: var(--ink-navy); font-weight: 400; margin: 0 0 22px; }
html.app-v2 .lv2-stage .lesson-body h2.l-h { font: 700 calc(26px * var(--reader-scale))/1.25 Poppins, sans-serif; margin: 44px 0 14px; scroll-margin-top: 96px; }
html.app-v2 .lv2-stage .lesson-body h3.l-h { font-size: calc(20px * var(--reader-scale)); margin: 28px 0 10px; scroll-margin-top: 96px; }
html.app-v2 .lv2-stage .lv2-part-k { margin: 44px 0 6px; padding-top: 26px; border-top: 1px solid var(--slate-200); font: 700 12px Inter, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #475569; }
html.app-v2 .lv2-stage .lesson-body .lv2-part-k + h2.l-h { margin-top: 0; }
html.app-v2 .lv2-stage .lesson-body .l-quiz, html.app-v2 .lv2-stage .lesson-body .key-takeaways { scroll-margin-top: 96px; }

/* callouts: the house colours from the mock-up; worked examples keep pre-wrap */
html.app-v2 .lv2-stage .callout { border-radius: 16px; padding: 18px 20px; margin: 22px 0; font-size: .92em; }
html.app-v2 .lv2-stage .callout .l-p { margin: 0; max-width: none; }
html.app-v2 .lv2-stage .callout-title { font-size: 12px; letter-spacing: .12em; margin-bottom: 8px; }
html.app-v2 .lv2-stage .callout-example { background: #F0FDF4; border-color: #BBF7D0; color: #14532D; }
html.app-v2 .lv2-stage .callout-example .callout-title { color: var(--action-green); }
html.app-v2 .lv2-stage .callout-warning { background: #FFF7ED; border-color: #FDBA74; color: #431407; }
html.app-v2 .lv2-stage .callout-warning .callout-title { color: #9A3412; }

/* key takeaways: the dark green close */
html.app-v2 .lv2-stage .key-takeaways { background: var(--naija-deep-green); border: 0; border-radius: 20px; padding: 26px 28px; margin: 32px 0 8px; color: #F2F7F2; }
html.app-v2 .lv2-stage .key-takeaways .kt-title { font: 700 20px Poppins, sans-serif; color: #fff; margin: 0 0 14px; text-transform: none; letter-spacing: 0; }
html.app-v2 .lv2-stage .key-takeaways ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
html.app-v2 .lv2-stage .key-takeaways li { position: relative; padding-left: 26px; margin: 0; color: #F2F7F2; line-height: 1.6; }
html.app-v2 .lv2-stage .key-takeaways li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--soft-mint); font-weight: 800; }
html.app-v2 .lv2-stage .key-takeaways .l-term, html.app-v2 .lv2-stage .key-takeaways a { color: var(--soft-mint); }
html.app-v2 .lv2-stage .key-takeaways code { color: var(--ink-navy); }

html.app-v2 .lv2-stage .l-quiz { border-radius: 20px; }

/* previous / next */
html.app-v2 .lv2-stage .lesson-foot { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--slate-200); gap: 14px; }
html.app-v2 .lv2-stage .lv2-prev { display: inline-flex; flex-direction: column; align-items: flex-start; min-height: 44px; border: 0; background: none; padding: 4px 0; text-align: left; font-size: 14px; color: var(--ink-navy); max-width: 46%; }
html.app-v2 .lv2-stage .lv2-pn { color: #475569; font-weight: 500; }
html.app-v2 .lv2-stage .lv2-next { min-height: 54px; padding: 0 24px; border-radius: 14px; font-size: 16px; font-weight: 700; margin-left: auto; text-align: left; }

/* ---- narrower desktops ---- */
@media (max-width: 1240px) {
  html.app-v2 .lv2-cols { grid-template-columns: 200px minmax(0, 1fr) 260px; gap: 24px; }
  html.app-v2 .lv2-review .lv2-cols { grid-template-columns: 200px minmax(0, 1fr); }
  html.app-v2 .lesson-stage.lv2-stage { padding: 40px 36px 44px; }
}

/* ---- phones and small tablets: one column, sheets, a dock ---- */
@media (max-width: 900px) {
  html.app-v2 .view[data-view="lesson"],
  html.app-v2 .view[data-view="review"]:has(.lv2) { padding: 0 16px 96px; }
  html.app-v2 .lv2-bar { margin: 0 -16px; padding: 6px 8px 10px; gap: 4px 6px; flex-wrap: nowrap; align-items: flex-start; }
  html.app-v2 .lv2-back { width: 44px; justify-content: center; flex: none; font-size: 20px; }
  html.app-v2 .lv2-back-t, html.app-v2 .lv2-where-l, html.app-v2 .lv2-size, html.app-v2 .lv2-notes-btn, html.app-v2 .lv2-tutor-btn { display: none; }
  html.app-v2 .lv2-where { flex: 1 1 auto; padding-top: 4px; }
  html.app-v2 .lv2-where-t { font-size: 12px; }
  html.app-v2 .lv2-where-t b { font-size: 14px; }
  html.app-v2 .lv2-strip { gap: 2px; }
  html.app-v2 .lv2-seg { height: 4px; }
  html.app-v2 .lv2-toc-btn { display: block; flex: none; padding: 0 12px; font-size: 13px; }
  html.app-v2 .lv2-cols { display: block; padding-top: 0; }
  html.app-v2 .lv2-toc, html.app-v2 .lv2-side { display: none; position: static; max-height: none; }
  html.app-v2 .lesson-stage.lv2-stage { margin: 0 -16px; border: 0; border-radius: 0; padding: 22px 20px 28px; }
  html.app-v2 .lv2-stage h1 { font-size: 27px; line-height: 1.15; }
  html.app-v2 .lv2-stage .lesson-body { font-size: calc(17px * var(--reader-scale)); line-height: 1.7; }
  /* a long formula at the larger size must wrap, never widen the page */
  html.app-v2 .lv2-stage .lesson-body p, html.app-v2 .lv2-stage .lesson-body .l-p, html.app-v2 .lv2-stage .lesson-body li, html.app-v2 .lv2-stage .lesson-body .l-h { overflow-wrap: anywhere; }
  html.app-v2 .lv2-stage > .muted:first-child { font-size: 12px; }
  html.app-v2 .lv2-stage .l-lead { font-size: calc(18px * var(--reader-scale)); }
  html.app-v2 .lv2-stage .lesson-body h2.l-h { font-size: calc(21px * var(--reader-scale)); line-height: 1.3; scroll-margin-top: 90px; }
  html.app-v2 .lv2-stage .lv2-part-k { margin-top: 34px; padding-top: 20px; }
  html.app-v2 .lv2-stage .callout { padding: 16px; border-radius: 14px; }
  html.app-v2 .lv2-stage .key-takeaways { padding: 22px 20px; }
  html.app-v2 .lv2-stage .lv2-prev { max-width: none; }
  html.app-v2 .lv2-stage .lv2-next { width: 100%; margin-left: 0; }

  html.app-v2 body:has(.view.active .lv2-dock) { padding-bottom: 76px; }
  html.app-v2 .lv2-dock { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 1.4fr; gap: 6px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 8px 10px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--slate-200); }
  html.app-v2 .lv2-review .lv2-dock { grid-template-columns: minmax(0, 1fr) 2fr; }
  html.app-v2 .lv2-dock-btn { min-height: 48px; border: 0; background: var(--slate-100); border-radius: 12px; font: 600 13px Inter, sans-serif; color: var(--ink-navy); cursor: pointer; }
  html.app-v2 .lv2-dock-tutor { background: var(--naija-deep-green); color: #fff; }
  html.app-v2 .lv2-dock-next { min-height: 48px; border: 0; background: var(--action-green); border-radius: 12px; font: 700 14px Inter, sans-serif; color: #fff; cursor: pointer; }

  html.app-v2 .lv2-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, .45); }
  html.app-v2 .lv2-toc.lv2-open, html.app-v2 .lv2-side.lv2-open { display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 1001; max-height: 85vh; overflow: auto; background: #fff; border-radius: 22px 22px 0 0; padding: 18px 16px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -20px 50px -20px rgba(15, 23, 42, .35); }
  html.app-v2 .lv2-toc > .lv2-sheet-head, html.app-v2 .lv2-sheet-head .lv2-x { display: flex; }
  html.app-v2 .lv2-sheet-head { justify-content: space-between; align-items: center; margin-bottom: 6px; font: 700 18px Poppins, sans-serif; }
  html.app-v2 .lv2-sheet-head label { font: 700 18px Poppins, sans-serif; }
  html.app-v2 .lv2-x { width: 44px; height: 44px; border: 0; background: var(--slate-100); border-radius: 12px; font-size: 20px; cursor: pointer; align-items: center; justify-content: center; color: var(--ink-navy); }
  html.app-v2 .lv2-toc-title { display: none; }
  html.app-v2 .lv2-toc-a { min-height: 48px; font-size: 15px; padding: 6px 10px; }
  html.app-v2 .lv2-toc-meta { margin-top: 10px; }
  html.app-v2 .lv2-side.lv2-open .lv2-card { border: 0; padding: 0; border-radius: 0; }
  html.app-v2 .lv2-notes-ta { font-size: 16px; }
  html.app-v2 .lv2-tutor .chat-messages { max-height: 44vh; }
}

@media (prefers-reduced-motion: no-preference) {
  html.app-v2 .lv2-seg, html.app-v2 .lv2-toc-a { transition: background .2s ease, color .2s ease; }
}
