/* Layout: one reading column; each exam session is a ruled block, each paper a row of component codes. */
:root {
  --bg: #f5f8f8; --surface: #fff; --fg: #14282b; --muted: #536a6e; --line: #d3dfe0; --accent: #0b6470; --on-accent: #fff;
  --o: #0b6470; --i: #8a3b12; --a: #4a3a94;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --code: Consolas, "SF Mono", Menlo, monospace;
}
/* Follows the device until the visitor picks a mode with the header button. Keep both dark blocks the same. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1b1d; --surface: #16262a; --fg: #e4eeee; --muted: #9bb2b5; --line: #2b4045; --accent: #6cc5d0; --on-accent: #08191c;
    --o: #6cc5d0; --i: #eba27a; --a: #b5a8f2; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0f1b1d; --surface: #16262a; --fg: #e4eeee; --muted: #9bb2b5; --line: #2b4045; --accent: #6cc5d0; --on-accent: #08191c;
    --o: #6cc5d0; --i: #eba27a; --a: #b5a8f2; color-scheme: dark;
}
.o-level { --accent: var(--o); } .igcse { --accent: var(--i); } .a-level { --accent: var(--a); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; padding-block: 2rem 4rem; }
.wrap { max-width: 64rem; margin-inline: auto; padding-inline: 1rem; width: 100%; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.15; margin: 0 0 1rem; text-wrap: balance; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
.code { font-family: var(--code); font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 1rem; top: .5rem; background: var(--surface); padding: .5rem; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; flex-wrap: wrap; gap: .25rem 2rem; justify-content: space-between; align-items: center; padding-block: .75rem; }
.brand { color: var(--fg); text-decoration: none; display: inline-flex; align-items: center; gap: .6rem; font-size: 1.1rem; }
.mark { width: 2.25rem; height: 2.25rem; flex: none; }
.tools { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; align-items: center; }
nav { display: flex; gap: 1.25rem; }
nav a { color: var(--fg); text-decoration: none; padding-block: .35rem; border-bottom: 2px solid transparent; }
nav a:hover, nav a[aria-current] { border-color: var(--accent); }

.lede { color: var(--muted); max-width: 60ch; margin: 0 0 2rem; font-size: 1.1rem; }
.search { display: grid; gap: .3rem; max-width: 26rem; margin: 0 0 2rem; }
.search label { color: var(--muted); font-size: .9rem; }
.search input { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: .5rem .7rem; min-height: 2.75rem; width: 100%; }
.levels { align-items: start; display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.level { border-top: 4px solid var(--accent); padding-top: 1rem; }
.level h2 { font-size: 1.6rem; margin-bottom: .75rem; } .level h2 a { color: var(--accent); text-decoration: none; } .level h2 a:hover { text-decoration: underline; }
.subjects { border-top: 1px solid var(--line); }
.subjects a, .subjects .soon { display: flex; flex-wrap: wrap; gap: 0 .75rem; align-items: baseline; padding: .8rem 0; border-bottom: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.subjects a:hover b { text-decoration: underline; color: var(--accent); }
.subjects small { flex-basis: 100%; color: var(--muted); font-size: .9rem; }
.soon { color: var(--muted); } .subjects .soon { color: var(--muted); }

.crumb { margin: 0 0 .25rem; }
select, button { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: .5rem .6rem; min-height: 2.75rem; width: 100%; }
button { width: auto; cursor: pointer; } button:hover { border-color: var(--accent); }

.theme { display: grid; place-items: center; width: 2.75rem; padding: 0; background: none; }
.theme svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; grid-area: 1 / 1; }
.theme .sun, .theme.is-dark .moon { display: none; } .theme.is-dark .sun { display: block; }

.block { background: var(--surface); border: 1px solid var(--line); margin-bottom: 1.5rem; }
.block > h2 { padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.qp, .ms { padding: .3rem .7rem; border: 1px solid var(--accent); border-radius: 4px; text-decoration: none; font-size: .9rem; white-space: nowrap; text-align: center; }
.qp { background: var(--accent); color: var(--on-accent); } .ms:hover { background: var(--bg); } .qp:hover { text-decoration: underline; }
.pad { padding: .25rem 1rem; }
.big { display: inline-block; font-size: 1rem; padding: .7rem 1.1rem; white-space: normal; }
.docs li { padding: .7rem 1rem; overflow-wrap: anywhere; } .docs li + li { border-top: 1px solid var(--line); } .docs span { color: var(--muted); font-size: .9rem; }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
@media (max-width: 40rem) {
  .top .wrap { position: relative; }
  .theme { position: absolute; top: .6rem; right: 1rem; }
}
@media print { .top, footer { display: none; } }
