/* The full lesson.
 *
 * Every column here answers to the width of the lesson panel, not the
 * width of the window: @container, because the lesson sits inside the
 * portal with a rail beside it that can be open or shut, and a layout
 * that reads the window gets the answer wrong whenever the rail moves.
 *
 * Nothing in this file selects an element by its position. A rule like
 * `li > span` or `.choices span` cannot tell a step's label from a piece
 * of maths inside it, and the last time one did it turned every inline
 * variable into a numbered circle. Classes only. */
.lesson-full{container-type:inline-size;container-name:lesson;display:flex;min-height:560px;flex-direction:column;
  border:1px solid var(--color-line);border-radius:12px;background:#fff;overflow:hidden}

.ls-top{display:flex;align-items:center;gap:14px;padding:12px 16px;
  border-bottom:1px solid var(--color-line);background:#fbfcfe}
.ls-iconbtn{display:inline-flex;align-items:center;gap:6px;padding:7px 11px;border:1px solid #d7deea;
  border-radius:8px;color:#4a5878;background:#fff;font:600 13px var(--font-ui);cursor:pointer}
.ls-iconbtn:hover{background:#f3f5fa}
.ls-track{flex:1;min-width:0}
.ls-track-name{display:flex;align-items:baseline;justify-content:space-between;gap:10px;
  color:#16294f;font:700 15px/1.3 var(--font-display)}
.ls-track-name span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ls-track-pos{flex:0 0 auto;color:#7c88a4;font:500 12px var(--font-ui)}
.ls-segs{display:flex;gap:3px;margin-top:7px}
.ls-segs i{display:block;overflow:hidden;height:4px;flex:1;border-radius:999px;background:#e3e8f1}
.ls-segs b{display:block;height:100%;border-radius:999px;background:#2d61d8}

.ls-shell{display:grid;min-height:0;flex:1;grid-template-columns:minmax(0,1fr)}
.ls-nav,.ls-notes{display:none}
.ls-stage{min-width:0;overflow-y:auto;padding:26px 16px 24px}
.ls-feed{max-width:680px;margin:0 auto;display:grid;gap:26px}
.ls-blk.is-past{opacity:.72}
.ls-bottom{display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:10px 14px;border-top:1px solid var(--color-line);background:#fbfcfe}
.ls-count{color:#7c88a4;font:500 12.5px var(--font-ui)}

@container lesson (min-width:760px){
  .ls-shell{grid-template-columns:minmax(0,1fr) 300px}
  .ls-notes{display:block}
  .ls-bottom{display:none}
  .ls-stage{padding-inline:28px}
}
@container lesson (min-width:1080px){
  .ls-shell{grid-template-columns:260px minmax(0,1fr) 320px}
  .ls-nav{display:block}
  .ls-sheet-open{display:none}
}

/* the rail of sections */
.ls-nav{overflow-y:auto;padding:20px 12px;border-right:1px solid var(--color-line);background:#fbfcfe}
.ls-nav-h{margin:0 10px 10px;color:#16294f;font:700 17px var(--font-display)}
.ls-nav-list{display:grid;margin:0;padding:0;gap:2px;list-style:none}
.ls-nav-list button{display:grid;width:100%;min-width:0;padding:8px 10px;border:0;border-radius:8px;
  gap:8px;grid-template-columns:22px minmax(0,1fr);background:transparent;color:#4a5878;
  font:500 14px/1.35 var(--font-ui);text-align:left;cursor:pointer}
.ls-nav-list button:hover:not([disabled]){background:#eef1f8}
.ls-nav-n{color:#8a96ad;font:700 12.5px var(--font-ui)}
.ls-nav-list .is-done .ls-nav-n{color:#1f7a4d}
.ls-nav-list .is-here button{background:#e8eefb;color:#16294f;font-weight:700}
.ls-nav-list button[disabled]{opacity:.5;cursor:default}
.ls-nav-practice{margin-top:16px}

/* The stage is its own container.
 *
 * The pack's cards were written for a page: two and three column grids
 * with a 300px column on the right, stacking under a @media rule at about
 * 700px. Inside the portal the stage is the narrowest part of the widest
 * layout -- at 1440 the panel is 1124 and the stage, between the rail and
 * the notes, is about 540 -- so that @media never fires and the middle
 * column is squeezed to a ribbon one word wide.
 *
 * Measured here against the stage rather than the window, and written
 * with enough weight to beat the pack's own [data-lesson="..."] rules. */
.ls-stage{container-type:inline-size;container-name:stage}
@container stage (max-width:700px){
  .lesson-full.lesson-body[data-lesson] .lp,
  .lesson-full.lesson-body[data-lesson] .ex,
  .lesson-full.lesson-body[data-lesson] .dg,
  .lesson-full.lesson-body[data-lesson] .fr,
  .lesson-full.lesson-body[data-lesson] .step,
  .lesson-full.lesson-body[data-lesson] .sample,
  .lesson-full.lesson-body[data-lesson] .bm-row,
  .lesson-full.lesson-body[data-lesson] .bigfig,
  .lesson-full.lesson-body[data-lesson] .box2,
  .lesson-full.lesson-body[data-lesson] .fig,
  .lesson-full.lesson-body[data-lesson] .think li{
    grid-template-columns:minmax(0,1fr);
  }
  /* A RIGHT/WRONG tag is a label, not a banner: stacked, it keeps its own
     width and the sentence goes under it. */
  .lesson-full.lesson-body[data-lesson] .tag{justify-self:start;width:max-content;
    padding-inline:10px}
  /* The same for the letter and number badges those cards carry. */
  .lesson-full.lesson-body[data-lesson] .letter,
  .lesson-full.lesson-body[data-lesson] .dg-n,
  .lesson-full.lesson-body[data-lesson] .think li > span{justify-self:start}
}
/* A checklist row is a flex box with a tick in front of the sentence, and
 * a sentence with a variable in it puts that variable in a box of its own:
 * "...arc or sector, angle or length," | "r" | "or a distance?" -- three
 * flex items, three columns. Same look, laid out as text: the tick is
 * positioned and the row is an ordinary block, so the sentence stays one
 * sentence. */
.lesson-full.lesson-body[data-lesson] .final li{display:block;position:relative;
  padding-left:46px}
.lesson-full.lesson-body[data-lesson] .final li::before{position:absolute;left:16px;top:16px;
  width:20px;height:20px;margin:0}

/* A rule's heading is a flex row so the "RULE 1" badge can sit beside the
 * title. A title that opens with a variable -- "f(3) means input 3" --
 * then has that variable as a flex item of its own, and the pack's badge
 * rule (h3 span) paints it gold at 13px as well. Laid out as text, with
 * the badge still beside it and the variable still a variable. */
.lesson-full.lesson-body[data-lesson] .rule h3{display:block}
.lesson-full.lesson-body[data-lesson] .rule h3 > span:first-child{display:inline-block;
  margin-right:10px;vertical-align:baseline}
.lesson-full.lesson-body[data-lesson] .rule h3 .m{color:inherit;
  font:inherit;font-style:italic;white-space:nowrap}

/* Whatever the width, nothing in the stage may be wider than the stage.
 * A data table with a min-width wins over max-width, so on a phone the
 * table keeps its own width and the step scrolls sideways rather than the
 * page doing it. */
.lesson-full .ls-feed img,.lesson-full .ls-feed svg{max-width:100%;height:auto}
.lesson-full .ls-feed table{max-width:100%}
.lesson-full .ls-feed > *{min-width:0}
@container stage (max-width:420px){
  .lesson-full.lesson-body[data-lesson] table{min-width:0}
  .lesson-full .ls-feed .ls-lead,.lesson-full .ls-feed .ls-concept,
  .lesson-full .ls-feed .ls-tabbody{overflow-x:auto}
}

/* the two practice choices, in the rail and in the all-sections panel */
.ls-practice{padding:14px 10px 4px;border-top:1px solid var(--color-line)}
.ls-seg{display:grid;grid-template-columns:1fr 1fr;gap:4px;margin:0 0 8px;padding:4px;
  border:1px solid var(--color-line);border-radius:9px;background:#f4f6fa}
.ls-seg button{min-height:38px;border:0;border-radius:6px;background:transparent;color:#4a5878;
  font:600 14px var(--font-ui);cursor:pointer}
.ls-seg button.is-on{color:#fff;background:#16294f}
.ls-practice-note{margin:0 2px 8px;color:#7c88a4;font:12px/1.45 var(--font-ui)}
.ls-practice-go{width:100%;margin-top:4px;padding:11px 18px;border:0;border-radius:9px;
  background:#16294f;color:#fff;font:700 15px var(--font-display);cursor:pointer}
.ls-practice-go:hover{background:#1d3566}

/* all sections, for a panel too narrow to carry the rail */
.ls-sheet{position:fixed;inset:0;z-index:60;display:flex;justify-content:flex-start}
.ls-sheet-scrim{position:absolute;inset:0;border:0;padding:0;background:rgba(8,22,58,.34)}
.ls-sheet-card{position:relative;display:flex;width:min(360px,88vw);flex-direction:column;
  background:#fff;box-shadow:22px 0 55px rgba(9,25,68,.2)}
.ls-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:14px 16px;border-bottom:1px solid var(--color-line);background:#fbfcfe}
.ls-sheet-head b{color:#16294f;font:700 17px var(--font-display)}
.ls-sheet-body{flex:1;overflow-y:auto;padding:16px 12px}

/* my notes */
.ls-notes{overflow-y:auto;padding:20px 18px;border-left:1px solid var(--color-line);background:#fbfcfe}
.ls-notes h3{margin:0 0 4px;color:#16294f;font:700 18px var(--font-display)}
.ls-notes-sub{margin:0 0 14px;color:#7c88a4;font:13px/1.45 var(--font-ui)}
.ls-note-head{display:flex;width:100%;align-items:center;justify-content:space-between;gap:8px;
  padding:7px 8px;border:0;border-radius:7px;background:transparent;color:#4a5878;
  font:700 12.5px var(--font-ui);text-align:left;cursor:pointer}
.ls-note-head:hover{background:#eef1f8}
.ls-note-head b{color:#8a96ad;font-weight:600}
.ls-note-body{display:grid;gap:7px;padding:2px 8px 10px}
.ls-note{margin:0;color:#31405f;font:400 13px/1.5 var(--font-ui)}
.ls-note.is-new{padding:6px 8px;border-radius:7px;background:#fdf6e4}
.ls-note-res{font-weight:700}
.ls-note-res.is-right{color:#1f7a4d}
.ls-note-res.is-wrong{color:#a3351f}

/* the steps themselves */
.ls-kicker{margin:0 0 9px;color:#a47215;font:700 12.5px var(--font-ui);letter-spacing:.06em}
.ls-h{margin:0 0 12px;color:#16294f;font:700 27px/1.15 var(--font-display)}
.ls-lead{margin-bottom:14px;color:#31405f;font:400 16px/1.6 var(--font-display)}
.ls-stem{margin-bottom:16px;color:#16294f;font:400 17px/1.6 var(--font-display)}
/* One border per card. The pack's own .rule, .dg, .step and .trap each
   draw one; the wrapper only exists to scope them, so it draws none. */
.ls-card{background:transparent}
.ls-card > *{margin:0}
/* A lesson that carries no card of its own still needs the box. */
.ls-card:not(:has(.rule,.dg,.step,.trap,.box,.card)){padding:16px 18px;
  border:1px solid var(--color-line);border-radius:10px;background:#fff}
.ls-key{padding:18px 20px;border-radius:10px;background:#16294f;color:#eaf0ff}
.ls-key b,.ls-key strong{color:#fff}
.ls-solution{margin-top:14px;padding:14px 16px;border-radius:10px;background:#f6f8fc}
.ls-answer{margin-top:10px;font-weight:700}
/* The pack's one-line tip, now after the answer rather than before the
   question. */
.ls-solution .lesson-tip{margin:12px 0 0;padding-top:10px;border-top:1px dashed #c9d2e4;
  color:#5b6a8f;font:italic 14.5px/1.55 var(--font-display)}
.ls-reveal{margin-top:12px;padding:9px 14px;border:1px solid #d7deea;border-radius:8px;
  background:#fff;color:#2d61d8;font:600 14px var(--font-ui);cursor:pointer}
.ls-practice-error{margin:10px 0 0;padding:9px 12px;border:1px solid #e3b4b4;border-radius:8px;
  background:#fffafa;color:#8a1f1f;font:14px/1.5 var(--font-ui,system-ui)}
/* The question about an unfinished set, asked inside the lesson: the box
   is the one the skill page uses, with room of its own here. */
.ls-checkpoint .setup-discard,.ls-done .setup-discard,.ls-practice .setup-discard{margin-top:12px}
.ls-practice .setup-discard .setup-ways{grid-template-columns:1fr}

.ls-checkpoint,.ls-done{padding:20px;border:1px solid #e6dcc0;border-radius:12px;background:#fdf9ef}
.ls-checkpoint h3,.ls-done h3{margin:0 0 6px;color:#16294f;font:700 20px var(--font-display)}
.ls-two{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}
.ls-primary{padding:11px 18px;border:0;border-radius:9px;background:#16294f;color:#fff;
  font:600 14.5px var(--font-ui);cursor:pointer}
.ls-primary[disabled]{opacity:.45;cursor:default}
.ls-ghost{padding:11px 18px;border:1px solid #d7deea;border-radius:9px;background:#fff;
  color:#31405f;font:600 14.5px var(--font-ui);cursor:pointer}
.ls-ghost[disabled]{opacity:.45;cursor:default}
.ls-inline-next{display:flex;gap:10px;justify-content:flex-end}

/* the first section, when it is a comparison */
.ls-tabs{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:14px}
.ls-tab{padding:8px 13px;border:1px solid #d7deea;border-radius:999px;background:#fff;
  color:#4a5878;font:600 13px var(--font-ui);cursor:pointer}
.ls-tab.is-on{border-color:#16294f;background:#16294f;color:#fff}
.ls-tabbody{padding:16px 18px;border:1px solid var(--color-line);border-radius:10px;background:#fff}

/* choices.
 *
 * Four across when every choice is short and has no maths in it, two
 * across on a narrow card, and otherwise one per line. Never three and
 * one: the grid is told how many columns to use, so it cannot wrap one
 * choice onto a line of its own. */
.ls-choices{display:grid;gap:10px;grid-template-columns:minmax(0,1fr)}
.ls-choices.is-short{grid-template-columns:repeat(2,minmax(0,1fr))}
@container lesson (min-width:760px){
  .ls-choices.is-short{grid-template-columns:repeat(4,minmax(0,1fr))}
}
.ls-opt{display:flex;min-width:0;min-height:48px;align-items:center;gap:11px;padding:10px 13px;
  border:1.5px solid var(--color-line);border-radius:10px;background:#fff;color:#16294f;
  font:400 15.5px/1.45 var(--font-display);text-align:left;cursor:pointer}
.ls-opt:hover:not([disabled]){border-color:#b9c6de}
.ls-opt-letter{flex:0 0 auto;width:24px;height:24px;border-radius:50%;background:#eef1f8;
  color:#4a5878;font:700 12.5px/24px var(--font-ui);text-align:center}
.ls-opt-text{min-width:0;flex:1 1 auto}
.ls-opt.is-chosen{border-color:#2d61d8;background:#f4f7ff}
.ls-opt.is-right{border-color:#1f7a4d;background:#f1f9f4}
.ls-opt.is-right .ls-opt-letter{background:#1f7a4d;color:#fff}
.ls-opt.is-wrong{border-color:#a3351f;background:#fdf3f1}
.ls-opt.is-wrong .ls-opt-letter{background:#a3351f;color:#fff}
.ls-mark{flex:0 0 auto;font-weight:700}
.ls-verdict{margin-top:14px;padding:14px 16px;border-radius:10px;background:#f6f8fc}
.ls-verdict.is-right{background:#f1f9f4}
.ls-verdict.is-wrong{background:#fdf3f1}
.ls-why{margin-top:6px;color:#31405f;font:400 15px/1.6 var(--font-display)}

@container lesson (max-width:759px){
  /* Everything that can be tapped is at least 44px tall, which is the
     smallest target a thumb reliably hits. */
  .ls-opt,.ls-iconbtn,.ls-primary,.ls-ghost,.ls-practice-go,.ls-reveal,.ls-tab,
  .ls-seg button,.ls-note-head,.ls-nav-list button{min-height:44px}
  .ls-feed{gap:20px}
  .ls-blk.is-past{display:none}
  .ls-inline-next{display:none}
}
@container lesson (max-width:519px){
  .ls-track-pos{display:none}
}
