/* RS Trader Academy — the reading surface.
 *
 * Palette, type scale, spacing and the masthead all come from shared/tokens.css, which the
 * Arena reads too. Nothing here redefines a colour; this file only says how the Schools use
 * the shared vocabulary. Anything that would be true of both surfaces belongs in tokens.
 *
 * Constraints that shaped it: no external requests (no font CDN, no analytics, no tracking),
 * readable with scripting off, and every measurement on the shared 4px rhythm so a lesson and
 * a desk line up when you flip between them.
 */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--read) / 1.65 var(--font);
  -webkit-text-size-adjust: 100%;
}

main { max-width: var(--measure); margin: 0 auto; padding: var(--s6) var(--s5) var(--s7); }

h1 { font-size: var(--step-4); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 var(--s5); text-wrap: balance; }
h2 { font-size: var(--step-2); line-height: 1.25; margin: var(--s7) 0 var(--s3); text-wrap: balance; }
h3 { font-size: var(--step-1); margin: var(--s6) 0 var(--s2); }
p, li { max-width: var(--measure); }
a { color: var(--accent); }

.lede { font-size: var(--step-1); color: var(--muted); }
.crumb { font-size: var(--step--1); color: var(--muted); margin: 0 0 var(--s5); }
.crumb a { color: var(--muted); }

/* the index */
.school { border-top: 1px solid var(--edge); padding-top: var(--s5); margin-top: var(--s6); }
.school h2 { margin-top: 0; }
.blurb { color: var(--muted); margin-top: 0; }
.school ol { padding-left: 1.4em; }
.school li { margin: var(--s1) 0; }
.school li a { text-decoration: none; }
.school li a:hover { text-decoration: underline; }

/* lesson body */
article blockquote {
  margin: var(--s5) 0; padding: var(--s3) var(--s4);
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
article blockquote p { margin: 0; }
article hr { border: none; border-top: 1px solid var(--edge); margin: var(--s6) 0; }
article code {
  background: var(--sunken); border: 1px solid var(--edge); border-radius: 3px;
  padding: 1px 5px; font-size: 0.9em; font-family: var(--font-mono);
}

/* tables carry the arithmetic in School II; they must scroll rather than break the page */
.table-wrap, article table { display: block; overflow-x: auto; }
article table {
  width: 100%; border-collapse: collapse; margin: var(--s5) 0;
  font-variant-numeric: tabular-nums;
}
article th, article td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--edge); }
article th { color: var(--muted); font-weight: 600; font-size: 0.9em; }

/* ---- the handoff into the Arena ----
 * A lesson that ends by asking you to go and do the thing is the whole point of having both
 * halves. It is styled as an invitation, not an advert: no gradient, no button, no urgency —
 * the same amber rule as a pull-quote, because it is the same kind of interruption. */
.practice {
  margin: var(--s6) 0 0;
  padding: var(--s4) var(--s5);
  background: var(--accent-soft);
  border: 1px solid var(--accent-edge);
  border-radius: var(--radius);
}
.practice h2, .practice h3 { margin: 0 0 var(--s2); font-size: var(--step-0); letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--accent-ink); }
.practice p { margin: 0 0 var(--s3); color: var(--ink-soft); }
.practice p:last-child { margin-bottom: 0; }
.practice a.do {
  display: inline-block; padding: var(--s2) var(--s4);
  background: var(--panel); border: 1px solid var(--accent-edge); border-radius: var(--radius-sm);
  color: var(--accent-ink); text-decoration: none; font-weight: 600;
  transition: border-color var(--speed), background var(--speed);
}
.practice a.do:hover { border-color: var(--accent); background: var(--sunken); }
.practice .caveat { font-size: var(--step--1); color: var(--muted); margin-top: var(--s3); }

.pager {
  display: flex; justify-content: space-between; gap: var(--s4);
  margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid var(--edge);
  font-size: var(--step--1);
}
.pager a { text-decoration: none; }
.pager a:hover { text-decoration: underline; }

footer {
  border-top: 1px solid var(--edge); background: var(--panel);
  padding: var(--s5); color: var(--muted); font-size: var(--step--1);
}
footer p { max-width: var(--measure); margin: 0 auto var(--s2); }
footer a { color: var(--muted); }

img { max-width: 100%; height: auto; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  h1 { font-size: var(--step-3); }
  main { padding: var(--s5) var(--s4) var(--s7); }
}

/* The drill embedded inside a lesson (practice_block). Height is the one thing an iframe
   cannot size itself, and 620px fits the chart + question card of every authored drill
   without an inner scrollbar on a laptop screen. */
.practice iframe.drill {
  width: 100%; height: 620px; border: 1px solid var(--edge); border-radius: 6px;
  background: var(--panel); margin: var(--s3) 0;
}
