/* The one page shell of the public site, matching the homepage (web/home_b.html).
 *
 * Every public page except the homepage links this file last in its <head> (web/watch.html, site.html, plans.html, self_learn.html, landing.html,
 * help.html, join.html, privacy.html, terms.html, tutor-agreement.html, employer-letter.html; site.html is also the shell of every page that
 * app/services/site.py `render` writes: the CFA and FRM pages, guides, tools, the qualification pages, the Adviser and tutor directories and profiles).
 * It owns the container (1240px, 40px gutters, 24px under 900px: the homepage's .wrap), the heading scale, body size, card treatment and
 * spacing, and the footer width. The `html body` prefix lets it win over a page's own `main { ... }` rule wherever that rule sits.
 * Intro, lede and body copy fill the content width of its column (the owner's rule: text runs to the container's right edge, not to a 760px or 820px
 * measure). Only a paragraph inside a deliberately narrow card, column or band keeps that narrower width. Cards, grids, tables, video and tiles use the full width. Colours are only theme.css tokens, so light and dark follow the device. Screen only: print is untouched.
 */
:root { --pub-max: 1240px; --pub-pad: 40px; --pub-read: none; }
@media screen {
  html body { font-family: var(--font-sans); font-size: 16px; line-height: 1.6; -webkit-text-size-adjust: 100%; }

  /* The container: the homepage's .wrap (max-width 1240, content-box, 40px sides). */
  html body main:not(.pub-bleed) { max-width: var(--pub-max); margin: 0 auto; padding: 56px var(--pub-pad) 96px; box-sizing: content-box; }
  html body .ext-foot-in { max-width: var(--pub-max); margin: 0 auto; padding: 0 var(--pub-pad); box-sizing: content-box; }
  html body .ext-foot-body { max-width: 760px; }
  html body .ext-foot { padding: 40px 0; }

  /* The heading scale, as the homepage's: bold, tight, large. */
  html body main:not(.pub-bleed) h1 { font-size: clamp(32px, 3.8vw, 50px); line-height: 1.08; letter-spacing: -0.03em; font-weight: 700; margin: 0 0 16px; max-width: 980px; text-wrap: balance; }
  html body main:not(.pub-bleed) h2 { font-size: clamp(26px, 2.8vw, 36px); line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; margin: 56px 0 14px; }
  html body main:not(.pub-bleed) h3 { font-size: 20px; line-height: 1.3; letter-spacing: -0.01em; font-weight: 700; margin: 28px 0 8px; }
  html body main:not(.pub-bleed) h1 + h2, html body main:not(.pub-bleed) > h2:first-child { margin-top: 0; }
  html body main:not(.pub-bleed) .lede { font-size: 19px; line-height: 1.5; color: var(--muted); margin: 0 0 20px; }
  html body main:not(.pub-bleed) p, html body main:not(.pub-bleed) li { font-size: 16px; line-height: 1.65; }
  html body main:not(.pub-bleed) .crumbs { font-size: 13.5px; margin: 0 0 20px; }
  html body main:not(.pub-bleed) .meta, html body main:not(.pub-bleed) .fine, html body main:not(.pub-bleed) .updated, html body main:not(.pub-bleed) .byline { font-size: 14px; }

  /* Long-form copy fills the container (--pub-read is none): the same right edge as the cards and the form below it. */
  html body main:not(.pub-bleed) > :is(p, ul, ol, dl, blockquote, details, pre, .note, .lede, .meta, .fine, .updated, .byline, .crumbs, .sign, .free, .verdict, form.tool, h2, h3, h4) { max-width: var(--pub-read); }
  html body main:not(.pub-bleed) > article:not(.lesson) { max-width: var(--pub-read); }
  html body main:not(.pub-bleed) > .wide, html body main:not(.pub-bleed) > .grid, html body main:not(.pub-bleed) > .levels, html body main:not(.pub-bleed) > table, html body main:not(.pub-bleed) > .plans, html body main:not(.pub-bleed) > .clips, html body main:not(.pub-bleed) > .stats { max-width: none; }

  /* Cards and tiles: the homepage's 16px radius, 1px line, generous padding. */
  html body main:not(.pub-bleed) .card { border-radius: 16px; padding: 24px 28px; margin: 20px 0; border: 1px solid var(--line); background: var(--panel); }
  html body main:not(.pub-bleed) .lede { max-width: none; }
  html body main:not(.pub-bleed) > form, html body main:not(.pub-bleed) > fieldset { max-width: 960px; }
  html body main:not(.pub-bleed) .grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin: 24px 0; }
  html body main:not(.pub-bleed) .grid .card { padding: 24px 28px; }
  html body main:not(.pub-bleed) .levels { gap: 20px; margin: 24px 0 8px; }
  html body main:not(.pub-bleed) .level { padding: 28px; }
  html body main:not(.pub-bleed) .plan { border-radius: 16px; padding: 28px; }
  html body main:not(.pub-bleed) .plans { gap: 20px; }
  html body main:not(.pub-bleed) .cta { border-radius: 16px; padding: 28px 32px; margin: 56px 0 12px; }
  html body main:not(.pub-bleed) .cta p { font-size: 17px; }
  html body main:not(.pub-bleed) .note { border-radius: 0 12px 12px 0; }
  html body main:not(.pub-bleed) .start { border-radius: 8px; padding: 0 24px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; line-height: 1.2; }
  html body main:not(.pub-bleed) table { font-size: 15px; }
  html body main:not(.pub-bleed) th, html body main:not(.pub-bleed) td { padding: 12px 14px; }

  /* Watch: each lesson is the video beside its text. */
  html body main:not(.pub-bleed) .clips { gap: 24px; margin: 32px 0 8px; }
  html body main:not(.pub-bleed) .lesson { border-radius: 16px; padding: 24px; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); grid-template-rows: repeat(6, auto) 1fr; column-gap: 36px; align-items: start; }
  html body main:not(.pub-bleed) .lesson video { grid-column: 1; grid-row: 1 / span 7; border-radius: 12px; }
  html body main:not(.pub-bleed) .lesson > :not(video) { grid-column: 2; }
  html body main:not(.pub-bleed) .lesson h2 { font-size: 26px; margin: 4px 0 10px; }
  html body main:not(.pub-bleed) .lesson .topic { margin-top: 4px; }
  html body main:not(.pub-bleed) .lesson > p.fine { grid-row: 1; }
  html body main:not(.pub-bleed) h2.sect { font-size: clamp(26px, 2.8vw, 36px); margin: 64px 0 8px; }
  html body main:not(.pub-bleed) .clips:has(> .clip) { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
  html body main:not(.pub-bleed) .clip { border-radius: 16px; padding: 24px 24px 12px; }
  html body main:not(.pub-bleed) .clip .stage.playing, html body main:not(.pub-bleed) .clip iframe { min-height: 640px; }
}

@media screen {
  /* The two pages of full-bleed coloured sections (self_learn.html, landing.html): they keep their bands; only the inner container and the type match. */
  html body main.pub-bleed .wrap { max-width: var(--pub-max); padding: 0 var(--pub-pad); box-sizing: content-box; }
  html body main.pub-bleed h1, html body main.pub-bleed h2 { font-weight: 700; letter-spacing: -0.03em; }
  html body main.pub-bleed section { padding: 56px 0; }
  html body main.pub-bleed .card { border-radius: 16px; }
  html body footer.ext-foot { max-width: none; margin: 0; }
}

@media screen and (max-width: 900px) {
  :root { --pub-pad: 24px; }
  html body main:not(.pub-bleed) { padding-top: 40px; padding-bottom: 72px; }
  html body main:not(.pub-bleed) h2 { margin-top: 44px; }
  html body main:not(.pub-bleed) .card, html body main:not(.pub-bleed) .grid .card { padding: 20px 22px; }
  html body main:not(.pub-bleed) .level { padding: 22px; }
  html body main:not(.pub-bleed) .cta { padding: 22px; margin-top: 40px; }
  html body main:not(.pub-bleed) .lesson { display: block; padding: 16px; }
  html body main:not(.pub-bleed) .lesson h2 { font-size: 22px; }
  html body main:not(.pub-bleed) .clips:has(> .clip) { grid-template-columns: 1fr; }
}
@media screen and (max-width: 560px) {
  html body main:not(.pub-bleed) h1 { font-size: 32px; }
  html body main:not(.pub-bleed) .lede { font-size: 17px; }
  html body main:not(.pub-bleed) table { font-size: 13px; }
  html body main:not(.pub-bleed) th, html body main:not(.pub-bleed) td { padding: 7px 5px; }
  html body main:not(.pub-bleed) table p, html body main:not(.pub-bleed) table li { font-size: inherit; }
}
