/* Reading layout. The words are unchanged; this file only decides how they sit on the page:
   one sentence to a line, equations lifted out, labels in a column, points as cards. Loaded last. */
.tidy { max-width: 72ch; font-size: 17px; line-height: 1.65; }
.tidy > * + * { margin-top: 14px; }
.tidy p { margin: 0; }
.sl { display: block; }
.sl + .sl { margin-top: 5px; }
.sl.sh { font-weight: 700; }
.sl.eq, .solp .sl.eq { display: block; width: fit-content; max-width: 100%; overflow-x: auto; margin: 7px 0; padding: 6px 14px; border-radius: 9px; background: var(--pen-soft); border-left: 3px solid var(--pen); font-weight: 600; font-variant-numeric: tabular-nums; }
.tidy .lead1 { font-size: 1.06em; font-weight: 700; }
.tidy .pts2 { display: grid; gap: 7px; padding-left: 2px; }
.tidy .pts2 > .sl { position: relative; padding-left: 22px; margin: 0; }
.tidy .pts2 > .sl::before { content: ""; position: absolute; left: 4px; top: .62em; width: 8px; height: 8px; border-radius: 2px; background: var(--pen); transform: rotate(45deg); }
.tidy .pts2 > .sl.eq { padding-left: 14px; } .tidy .pts2 > .sl.eq::before { display: none; }

/* "Level: ..." style lines: the label sits in its own column */
.kv { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 4px 16px; padding: 12px 14px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.kv .k { font: 800 14.5px var(--f-head); color: var(--pen); padding-top: 3px; }

/* points: a bold name, then what it means, one sentence to a line */
.items { display: grid; gap: 9px; }
.item { padding: 11px 15px; border: 1px solid var(--line); border-left: 4px solid var(--pen); border-radius: 11px; background: var(--card); }
.it { display: block; font-weight: 700; font-size: 1.02em; margin-bottom: 3px; }
.item .sl { color: var(--ink); }
.yc { display: inline-block; padding: 0 8px; margin: 1px 0; border-radius: 99px; background: var(--pen-soft); font-size: .84em; font-weight: 700; white-space: nowrap; }
.yc b { color: var(--pen); font-weight: 700; margin-left: 2px; }

/* numbered routines: a timeline */
ol.steps.tl { max-width: 72ch; }
ol.steps.tl > li.step { padding-bottom: 12px; }
.tli .it { margin-bottom: 2px; }

/* two-column "result / when to use" tables become formula cards */
.fgh { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.fgh span:first-child { padding: 1px 9px; border-radius: 99px; background: var(--pen-soft); color: var(--pen); font-weight: 700; }
.fgh span:last-child::before { content: "↓ "; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; max-width: none; }
.tidy:has(.fgrid) { max-width: none; }
.fcard { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--card); }
.ff { flex: 1; display: grid; place-items: center; padding: 16px 14px; text-align: center; font-size: 1.08em; font-weight: 700; background: var(--pen-soft); line-height: 1.5; }
.fw { padding: 9px 14px; font-size: .88em; color: var(--muted); border-top: 1px solid var(--line); }

/* revision card: a wall of small cards instead of a list */
.rcgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 9px; }
.tidy:has(.rcgrid) { max-width: none; }
.rc { padding: 11px 14px; border-radius: 11px; background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--hl); font-size: 16px; }
.rc .it { font-size: 1em; }

/* worked steps */
.solp { margin: 0; }
ol.steps > li.step .tidy { padding-top: 3px; max-width: 70ch; }
.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; margin-top: 16px; align-items: start; }
.duo > .trap, .duo > .remember { margin: 0; }
.duo .tidy { font-size: 16px; }
.point .in .sl + .sl { margin-top: 6px; }

@media (max-width: 700px) { .kv { grid-template-columns: minmax(0, 1fr); } .tidy { font-size: 16.5px; } }
.ff > span { text-wrap: balance; }
.fgrid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

/* ---------------------------------------------------------------- "In pictures": the story player */
.pillb.pic { border-color: var(--hl); }
.pillb.pic.on { background: var(--hl); color: #3b2f00; border-color: var(--hl); }
.pillb.pic.on .ic, .pillb.pic.on span { color: #3b2f00; }
.story { max-width: 880px; }
.story .stage { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m); padding: 8px 10px; }
.story svg.dg { max-width: 760px; }
.story .ly { display: none; }
.story .ly.in { display: inline; }
.sttap { position: absolute; inset: 0; width: 100%; background: none; border: 0; border-radius: var(--r-m); cursor: pointer; }
.sttap:focus-visible { outline: 3px solid var(--hl); outline-offset: -3px; }
.story .cap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 12px; padding: 12px 16px; border-radius: 12px; background: var(--pen-soft); min-height: 92px; }
.stn { font: 800 13px var(--f-head); color: var(--pen); white-space: nowrap; padding: 3px 9px; border-radius: 99px; background: var(--card); margin-top: 2px; }
.sth { display: block; font: 800 19px/1.25 var(--f-head); }
.sts { margin: 4px 0 0; font-size: 16.5px; line-height: 1.55; max-width: 68ch; }
.stbar { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.stdots { display: flex; gap: 7px; flex: 1; justify-content: center; }
.stdots button { width: 30px; height: 12px; padding: 0; border: 0; border-radius: 99px; background: var(--line); cursor: pointer; transition: background .15s, width .15s; }
.stdots button.seen { background: var(--pen); opacity: .45; }
.stdots button.on { background: var(--pen); width: 44px; }
.stdots button:focus-visible { outline: 3px solid var(--hl); outline-offset: 2px; }
.stidea { display: none; margin: 14px 0 0; font-size: 17px; line-height: 1.7; }
.stidea b { font: 800 13px var(--f-head); color: var(--pen); margin-right: 10px; }
.story.end .stidea { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .story .ly.cur > *, .story .ly.cur > g > * { animation: stin .5s ease-out both; animation-delay: calc(var(--i, 0) * 70ms); }
  @keyframes stin { from { opacity: 0; } }
  .story.end .stidea { animation: stin .5s ease-out both; }
}
@media (max-width: 700px) { .story .cap { grid-template-columns: minmax(0, 1fr); gap: 6px; } .stdots button { width: 18px; } .stdots button.on { width: 28px; } .stbar .btn { flex: 1; } .stdots { order: -1; flex-basis: 100%; } }

/* maths that must not break across lines (see glue() in app.js), and one formula per line on a formula card */
.nb { white-space: nowrap; }
.ff .fl { display: block; }
.ff .fl + .fl { margin-top: 6px; }
/* 11-14 rewritten steps: "**Label:** maths" — label in bold, maths in steady figures, no box */
.sl.lr { display: block; }
.sl.lr .slab { font-weight: 700; margin-right: 2px; }
.sl.lr .mx { font-variant-numeric: tabular-nums; }
