/* IAL Prep — the subject pages (/physics/) and unit pages (/physics/unit-1) written by
   tools/build-unit-pages.py, and the home page's "Browse by unit" list, in the look of the game
   Control's menus. Tokens and shared parts (.ctl-btn, .ctl-label, .ctl-panel, .ctl-frame) are in
   css/control.css; the subject's accent comes from data-subject on the body or the column. */

.up {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 28px 80px;
}
.up-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- The bar under the site's navigation: back, then the trail ---------- */
.up-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  border-bottom: 1px solid var(--line);
}
.up-back {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-2);
  color: var(--ink);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.up-back:hover { border-color: var(--ink); background: var(--field); }
.up-back svg,
.up-notes svg,
.up-actions svg,
.up-unit-links svg,
.up-pt-n svg,
.up-more svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: square;
  stroke-linejoin: miter;
}
.up-back svg { width: 18px; height: 18px; }
.up-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 9px;
  min-width: 0;
  color: var(--ink-2);
  font: 700 15px/1.2 var(--f-display);
}
.up-crumbs a { text-decoration: none; }
.up-crumbs a:first-child { color: var(--ink); }
.up-crumbs a:hover { color: var(--ink); text-decoration: underline; }
.up-crumbs [aria-current] { color: var(--ink); }
.up-sep { color: var(--ink-3); font-weight: 400; }

/* ---------- Title, what it is, the way in, and its figures ---------- */
.up-hero { padding: 38px 0 0; }
.up-hero h1 {
  max-width: 28ch;
  margin: 0;
  font-size: clamp(34px, 4.1vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.016em;
}
.up-h1-key { color: var(--accent); }
.up-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin: 16px 0 0;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
}
.up-code { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.up-lede {
  max-width: 72ch;
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1.55;
}
/* How much of the unit is done (js/units.js), when anything is. */
.up-mine { max-width: 520px; margin: 18px 0 0; }
.up-mine[hidden],
.up-unit-prog[hidden] { display: none; }
.up-prog-line { margin: 0 0 9px; color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.up-prog-line b { color: var(--ink); font: 700 16px/1 var(--f-display); }
.up-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; }
.up-actions .ctl-btn { min-height: 44px; padding: 10px 18px 9px; font-size: 15px; }
.up-actions svg,
.up-unit-links svg { transition: transform 0.2s var(--ease); }
.up-actions .ctl-btn:hover svg,
.up-unit-links .ctl-btn:hover svg { transform: translateX(3px); }

/* The figures: plain numbers on a hairline row, split by hairlines, the label under each. */
.up-stats {
  display: flex;
  flex-wrap: wrap;
  margin: 34px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.up-stat { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 6px; margin: 0; }
.up-stat dd {
  margin: 0;
  color: var(--ink);
  font: 700 clamp(30px, 3vw, 44px)/1 var(--f-display);
  font-variant-numeric: tabular-nums;
}
.up-stat dt { color: var(--ink-2); font-size: 13.5px; line-height: 1.3; }
.up-stats .up-stat { padding: 18px 44px 16px 0; }
.up-stats .up-stat + .up-stat { padding-left: 28px; border-left: 1px solid var(--line); }

/* ---------- Two columns: the topics, and beside them the notes, papers and other units ---------- */
.up-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  gap: 0 64px;
  align-items: start;
}
.up-col { min-width: 0; }
.up-section { margin-top: 46px; }
.up-section > .ctl-label { margin: 0 0 10px; }
.up-note {
  max-width: 72ch;
  margin: 0 0 20px;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.55;
}
.up-note a { color: var(--ink); font-weight: 600; text-decoration: underline; }
.up-note a:hover { color: var(--accent); }

/* Topics: a heading with its count, then its spec points as hairline rows. */
.up-topic { margin: 0 0 38px; }
.up-topic h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line-2);
  font-size: 24px;
  line-height: 1.15;
}
.up-topic h3 a { color: var(--ink); text-decoration: none; }
.up-topic h3 a:hover { color: var(--accent); }
.up-count { color: var(--ink-3); font: 600 13.5px/1.2 var(--f-text); font-variant-numeric: tabular-nums; }
.up-count.is-started { color: var(--ink-2); }

/* Each row: the code (in the subject's colour), the spec point, Notes, and how many questions.
   The rows share one set of columns, so the codes and counts line up down the list. The count is
   the way in: a hairline tag in the subject's colour with an arrow, "25", or "12 / 25" once some
   are done (js/units.js). */
.up-points {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) auto auto;
  margin: 0;
  padding: 0;
  list-style: none;
}
.up-points li {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
  padding: 7px 0 6px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.15s ease;
}
.up-points li:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.up-pt {
  grid-column: 1 / 3;
  display: grid;
  grid-template-columns: subgrid;
  align-items: baseline;
  color: var(--ink);
  text-decoration: none;
}
.up-pt-code {
  grid-column: 1;
  padding: 0 18px 0 2px;
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.up-pt-text { grid-column: 2; padding-right: 16px; font-size: 15px; line-height: 1.4; }
.up-pt:hover .up-pt-text { text-decoration: underline; }
/* Notes: a plain link to the spec point's section of the notes. */
.up-pt-notes {
  position: relative;
  grid-column: 3;
  margin-right: 16px;
  padding: 4px 2px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 3px;
}
.up-pt-notes:hover { color: var(--ink); text-decoration-color: currentColor; }
.up-pt-n {
  grid-column: 4;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  margin-right: 2px;
  padding: 4px 8px 3px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  border-radius: 4px;
  color: var(--ink);
  font: 700 15px/1 var(--f-display);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.up-pt-n svg { width: 14px; height: 14px; color: var(--accent); transition: transform 0.2s var(--ease); }
.up-pt-n:hover,
.up-points li:hover .up-pt-n { border-color: var(--accent); background: var(--accent-tint); }
.up-pt-n:hover svg,
.up-points li:hover .up-pt-n svg { transform: translateX(2px); }
.up-pt-done { color: var(--accent); }
.up-points li.is-full .up-pt-n { border-color: var(--accent); background: var(--accent-tint); }
@supports not (grid-template-columns: subgrid) {
  .up-points { display: block; }
  .up-points li { display: flex; align-items: center; gap: 12px; }
  .up-pt { display: flex; flex: 1; gap: 14px; }
  .up-pt-code { flex: none; min-width: 3.4em; padding: 0; }
  .up-pt-notes { flex: none; margin: 0; }
  .up-pt-n { flex: none; }
}

/* Notes pages for the unit: one row each, the whole row a link. */
.up-notes,
.up-units { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.up-notes li,
.up-units li { border-bottom: 1px solid var(--line); }
.up-notes a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 14px;
  padding: 12px 4px 11px 2px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.up-notes a:hover,
.up-units a:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.up-notes-t { color: var(--ink); font: 700 16px/1.25 var(--f-display); }
.up-notes-b { grid-row: 2; color: var(--ink-3); font-size: 13.5px; line-height: 1.4; }
.up-notes svg {
  grid-row: 1 / span 2;
  grid-column: 2;
  width: 17px;
  height: 17px;
  color: var(--ink-3);
  transition: transform 0.2s var(--ease), color 0.15s ease;
}
.up-notes a:hover svg { color: var(--accent); transform: translateX(3px); }

/* Past papers: hairline rows, the two PDFs as small buttons. */
.up-papers {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.up-papers th,
.up-papers td {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.up-papers thead th {
  padding: 0 0 8px;
  border-bottom-color: var(--line-2);
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 600;
}
.up-papers thead th + th,
.up-papers td { padding-left: 10px; }
.up-papers tbody th { padding-right: 8px; color: var(--ink); font-weight: 600; line-height: 1.35; }
.up-papers td { width: 1%; white-space: nowrap; }
.up-pdf { min-height: 32px; padding: 5px 10px 4px; gap: 7px; font-size: 13px; }
.up-size { color: var(--ink-3); font-size: 12px; font-weight: 600; }
.up-pdf:hover .up-size { color: var(--ink-2); }
.up-none { color: var(--ink-3); }
/* Under the latest sessions: every paper of the unit on the past papers page. */
.up-more { margin: 14px 0 0; }
.up-more a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font: 700 15px/1.2 var(--f-display);
  text-decoration: none;
}
.up-more a:hover { text-decoration: underline; }
.up-more svg { width: 16px; height: 16px; transition: transform 0.2s var(--ease); }
.up-more a:hover svg { transform: translateX(3px); }

/* The subject's other units */
.up-units { margin-bottom: 16px; }
.up-units a {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 11px 4px 10px 2px;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.up-units .up-code { flex: none; min-width: 5.6ch; }
.up-units a:hover .up-units-t { text-decoration: underline; }

/* ---------- Subject page: one panel per unit ---------- */
.up-unit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.up-unit {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px 20px 20px;
  border-top-color: var(--accent);
  transition: border-color 0.2s ease;
}
.up-unit:hover,
.up-unit:focus-within { border-color: var(--line-2); border-top-color: var(--accent); }
.up-unit .ctl-frame { inset: -13px; }
.up-unit:hover .ctl-frame,
.up-unit:focus-within .ctl-frame { opacity: 1; inset: -6px; }
.up-unit h3 { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 30px; line-height: 1; }
.up-unit-name { margin: 10px 0 0; color: var(--ink-2); font-size: 15px; font-weight: 600; line-height: 1.4; }
.up-unit-prog { margin: 16px 0 0; }
.up-unit h3 a { color: var(--ink); text-decoration: none; }
.up-unit h3 a:hover { color: var(--accent); }
/* AS or A2: a plain squared tag. */
.up-level {
  padding: 3px 7px 2px;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  font: 600 12.5px/1.2 var(--f-text);
}
.up-unit-facts {
  display: flex;
  margin: 16px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.up-unit-facts .up-stat { padding: 13px 20px 12px 0; }
.up-unit-facts .up-stat + .up-stat { padding-left: 18px; border-left: 1px solid var(--line); }
.up-unit-facts dd { font-size: 26px; }
.up-unit-links { display: grid; gap: 6px; margin-top: auto; padding-top: 20px; }
.up-unit-links .ctl-btn { justify-content: space-between; width: 100%; min-height: 42px; padding: 9px 12px 8px 14px; }

/* ---------- Home page: Browse by unit, one column per subject ---------- */
.landing-units { margin-top: 52px; }
.landing-units > .ctl-label { margin: 0 0 14px; }
.lu-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.lu-col { min-width: 0; }
.lu-col h3 {
  margin: 0;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line-2);
  font-size: 18px;
  line-height: 1.1;
}
.lu-col h3 a { color: var(--ink); text-decoration: none; }
.lu-col h3 a:hover { color: var(--accent); }
.lu-col ul { margin: 0; padding: 0; list-style: none; }
.lu-col li { border-bottom: 1px solid var(--line); }
.lu-col li a {
  display: grid;
  grid-template-columns: 5.6ch minmax(0, 1fr);
  gap: 10px;
  padding: 5px 2px 4px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.35;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.lu-col li a:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
.lu-col li a:hover .lu-name { text-decoration: underline; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1180px) {
  .up-layout { grid-template-columns: minmax(0, 1fr); }
  .up-unit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .lu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .up { padding: 0 16px 64px; }
  .up-bar { min-height: 54px; gap: 12px; }
  .up-crumbs { font-size: 14px; }
  .up-hero { padding-top: 28px; }
  .up-lede { font-size: 16px; }
  .up-stats .up-stat { padding: 14px 18px 13px 0; }
  .up-stats .up-stat + .up-stat { padding-left: 16px; }
  .up-section { margin-top: 40px; }
  .up-topic h3 { font-size: 21px; }
  .up-pt-text { font-size: 14.5px; }
}
@media (max-width: 600px) {
  .up-actions .ctl-btn { flex: 1 1 100%; justify-content: space-between; }
  .up-unit-grid,
  .lu-grid { grid-template-columns: minmax(0, 1fr); }
  .up-unit { padding: 18px 16px 16px; }
  .up-unit .ctl-frame { display: none; }
  .up-unit-facts .up-stat { padding-right: 14px; }
  .up-unit-facts .up-stat + .up-stat { padding-left: 14px; }
  .up-unit-facts dd { font-size: 23px; }
  .up-pt-notes { margin-right: 10px; }
  .up-pt-code { padding-right: 12px; }
  .up-papers thead th + th,
  .up-papers td { padding-left: 6px; }
  .up-pdf { padding: 5px 8px 4px; }
}
@media (pointer: coarse) {
  .up-pdf { min-height: 44px; }
  .up-unit-links .ctl-btn { min-height: 46px; }
  .up-back { width: 44px; height: 44px; }
  .up-crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
  .up-topic h3 a { display: inline-flex; align-items: center; min-height: 44px; }
  .up-points li { padding: 2px 0; }
  .up-pt { min-height: 44px; padding: 11px 0 10px; }
  .up-pt-notes { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; }
  .up-pt-n { min-height: 44px; padding: 0 10px 0 12px; }
  .up-units a,
  .up-notes a { min-height: 48px; }
  .up-units a { align-items: center; }
  .up-more a { min-height: 44px; }
  .lu-col li a { min-height: 44px; align-items: center; padding: 4px 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .up-actions svg,
  .up-unit-links svg,
  .up-pt-n svg,
  .up-more svg,
  .up-notes svg { transition: none; }
  .up-unit .ctl-frame { transition: opacity 0.12s ease; }
}

/* ---------- Larger text (Settings, html[data-textsize="large"], js/theme.js) ---------- */
html[data-textsize="large"] .up-lede { font-size: 19px; }
html[data-textsize="large"] .up-facts { font-size: 16.5px; }
html[data-textsize="large"] .up-note,
html[data-textsize="large"] .up-prog-line { font-size: 16.5px; }
html[data-textsize="large"] .up-crumbs { font-size: 17px; }
html[data-textsize="large"] .up-pt-text,
html[data-textsize="large"] .up-pt-code { font-size: 17px; }
html[data-textsize="large"] .up-pt-notes { font-size: 15.5px; }
html[data-textsize="large"] .up-pt-n { font-size: 17px; }
html[data-textsize="large"] .up-count { font-size: 15.5px; }
html[data-textsize="large"] .up-stat dt { font-size: 15.5px; }
html[data-textsize="large"] .up-notes-t { font-size: 18px; }
html[data-textsize="large"] .up-notes-b { font-size: 15.5px; }
html[data-textsize="large"] .up-papers { font-size: 16px; }
html[data-textsize="large"] .up-pdf { font-size: 15px; }
html[data-textsize="large"] .up-units a { font-size: 16.5px; }
html[data-textsize="large"] .up-unit-name { font-size: 17px; }
html[data-textsize="large"] .lu-col li a { font-size: 15.5px; }
html[data-textsize="large"] .up-more a { font-size: 17px; }
