/*
  The SAT pages' shared styles: the website's header, prompt line, links, focus and type rule, on the website's
  tokens (tokens.css, generated, never edited) and the extended palette (palette.css, generated by tools/palette.py).
  Load order: tokens.css, tool-tokens.css (the French tool's, copied), palette.css, site.css, then the page's CSS.

  Type rule (the French tool's, DESIGN.md 1): the monospace (--font-primary) at body size is the default for
  everything the site says; the serif reading face applies only through .content, on material read at length
  (passages, questions, choices, rationales, cheat-sheet card prose).
*/
@font-face {
  font-family: "SF Mono Terminal";
  font-style: normal;
  font-weight: 400 700;
  src: local("SF Mono Terminal"), local("SFMono-Regular"), local("SF Mono");
}

:root {
  /* The SAT pages' own tokens, on top of the website's and the French tool's (each a recorded exception, README
     "Design"). */
  /* Two display sizes the cheat-sheet cards need above the website's three (sm, base, lg). */
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  /* Figures are scans on white. Light mode: multiplied onto the page, so their white is the page's. Dark mode: on a
     panel of the text colour, the lightest grey of the palette, multiplied onto it the same way. */
  --figure-panel: var(--color-text);
}
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --figure-panel: transparent; } }
:root[data-theme="light"] { --figure-panel: transparent; }

* { box-sizing: border-box; }
html {
  min-width: 320px;
  background: var(--color-bg);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font: var(--weight-regular) var(--text-base) / var(--leading) var(--font-primary);
  letter-spacing: var(--letter-spacing);
  overflow-wrap: break-word;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
a { color: var(--color-link); text-decoration: none; transition: color var(--motion-duration) var(--motion-easing); }
a:hover { color: var(--color-link-hover); }
:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
::selection { background: var(--color-selection); color: var(--color-text); }
[hidden] { display: none !important; }
img { max-width: 100%; }
b, strong { font-weight: var(--weight-strong); }
.content { font-family: var(--font-serif); letter-spacing: 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* One centred column, the website's (--frame, --gutter), on every page: the header and the page share its left edge,
   and nothing moves between pages. Since 2026-11-24 (owner): the drills (61.25rem) and the cheat sheets (70rem) were
   wider, so the page jumped wider on opening them. */
.frame { width: min(100% - 2 * var(--gutter), var(--frame)); margin-inline: auto; }

/* ---- the website's header, as its src/styles/global.css draws it: the @esaba mark, the address (~/lab/sat/...), one
   link per segment, on the left; inside a section, its menu (cheat sheet, drill) and the subject toggle (english /
   math) on the right (the French tool's DESIGN.md 4) ---- */
.site-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 1ch;
  min-height: var(--control-height);
  padding-top: var(--header-top-gap);
  font-weight: var(--weight-strong);
  line-height: var(--leading-tight);
}
.site-mark, .address-path { font-weight: var(--weight-regular); line-height: var(--leading); }
.site-mark, .site-mark:hover { display: inline-flex; min-height: var(--control-height); align-items: center; color: var(--color-identity); white-space: nowrap; }
/* A path too long for the screen is never cut off: js/header-path.js (the website's header script) moves the menu to
   its own row, then shortens @esaba to @ and the folder names from their middle until the line fits. overflow stays
   hidden so the script can measure the line; the path starts at its left edge, where that measure can see it. */
.address-path { display: inline-flex; min-width: 0; align-items: center; overflow: hidden; color: var(--color-muted); white-space: nowrap; }
.address-crumb, .address-separator { color: var(--color-muted); }
.address-crumb { display: inline-flex; min-height: 32px; align-items: center; }
.address-crumb:hover, .address-crumb:focus-visible { color: var(--color-hover); }
.site-nav { display: flex; align-items: center; justify-content: flex-end; gap: var(--choice-gap); }
.site-nav a { display: inline-flex; min-height: var(--choice-height); align-items: center; color: var(--color-choice); white-space: nowrap; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--color-hover); }
.site-nav a[aria-current="page"] { color: var(--color-choice-chosen); }
/* The subject toggle, like the French tool's language switch: the header's own item after the menu, never inside it,
   --choice-gap from the menu's last item (the design system's header toggle rule, 2026-11-25); the current subject,
   drawn as the menu's choices, not marked. When the menu takes its own row, the toggle stays on row 1 at the right. */
.site-header .lang { display: inline-flex; min-height: var(--choice-height); align-items: center; color: var(--color-choice); white-space: nowrap; margin-left: calc(var(--choice-gap) - 1ch); }
.site-header .lang:hover, .site-header .lang:focus-visible { color: var(--color-hover); }
/* The menu takes its own row when the full path would not fit beside it: js/header-path.js measures and sets
   data-layout. Before it has run (or without scripts), 760px decides, as on the website. */
.site-header[data-layout="stacked"] { grid-template-columns: auto minmax(0, 1fr) auto; }
.site-header[data-layout="stacked"] .lang { grid-row: 1; grid-column: 3; margin-left: 0; }
.site-header[data-layout="stacked"] .site-nav { grid-row: 2; grid-column: 1 / -1; justify-content: flex-start; width: 100%; overflow-x: auto; scrollbar-width: none; }
.site-header[data-layout="stacked"] .site-nav a { flex: 0 0 auto; }
@media (max-width: 760px) {
  .site-header:not([data-layout]) { grid-template-columns: auto minmax(0, 1fr) auto; }
  .site-header:not([data-layout]) .lang { grid-row: 1; grid-column: 3; margin-left: 0; }
  .site-header:not([data-layout]) .site-nav { grid-row: 2; grid-column: 1 / -1; justify-content: flex-start; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .site-header:not([data-layout]) .site-nav a { flex: 0 0 auto; }
}

/* ---- the page heading: prompt, title, lead ---- */
main.frame { margin-top: var(--content-top-gap); padding-bottom: var(--gap-section); }
.prompt { margin: 0; font-size: var(--text-base); font-weight: var(--weight-regular); }
.prompt .sym { color: var(--color-prompt); }
.page-title { margin: var(--gap-heading) 0 0; font-size: var(--text-lg); font-weight: var(--weight-strong); line-height: var(--leading-tight); }
.lead { margin: var(--gap-heading) 0 0; color: var(--color-muted); max-width: 64ch; }
.credit { color: var(--color-muted); font-size: var(--text-sm); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---- list pages: tree rows (the website's directoryRow, the French tool's DESIGN.md 5) ----
   Two columns: the branch (real tree output, nested rows indented by it) and the key (a link) on the left, the value
   muted on the right; rows two --row-pad apart. */
h2.sec { margin: var(--gap-section) 0 0; font-size: var(--text-base); font-weight: var(--weight-strong); }
h2.sec::before { content: "## "; color: var(--color-markdown-marker); }
.tree { list-style: none; margin: var(--gap-heading) 0 0; padding: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--col-gap); row-gap: calc(var(--row-pad) * 2); }
.lead + .tree { margin-top: var(--gap-output); }
.tr { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: start; }
.tr .lft { display: grid; grid-template-columns: auto auto; column-gap: 1ch; justify-content: start; align-items: start; }
.tr .br { color: var(--color-muted); font-size: var(--text-sm); white-space: pre; line-height: calc(var(--leading) * var(--text-base)); }
.tr .k { white-space: nowrap; }
.tr .rt { color: var(--color-muted); min-width: 0; }
@media (max-width: 480px) { .tree { grid-template-columns: fit-content(50%) minmax(0, 1fr); column-gap: 2ch; } }

/* A figure: the scan multiplied onto its panel (see --figure-panel). */
.figure-panel { display: block; background: var(--figure-panel); border-radius: var(--radius); padding: 8px; isolation: isolate; }
.figure-panel img { display: block; max-width: 100%; height: auto; mix-blend-mode: multiply; margin: 0 auto; }
