/* ============================================================================
 * landing.css - the static landing pages (one per topic, one per section).
 *
 * These pages are the SEARCH surface: they are plain HTML, they hold the
 * teaching content in the markup, and they can be read without JavaScript.
 * The SPA behind /gcse-<subject>/ is the PRACTISE surface - it is where the
 * daily quiz, the AI marking and the mistake book live. The two link to each
 * other; neither duplicates the other's job.
 *
 * Every rule here is deliberately plain CSS - no build step, no framework.
 * A landing page has to load fast on a school laptop over 3G.
 * ==========================================================================*/

:root {
  --ink: #16202e;
  --ink-2: #3d4a5c;
  --ink-3: #5f6e82;
  --line: #dfe4ea;
  --line-2: #eef1f4;
  --paper: #ffffff;
  --wash: #f7f9fb;
  /* The subject accent is INJECTED per page: the prerenderer writes the
     subject's own colour into the <html> style attribute, so the static
     page and the interactive site behind it are the same colour. The
     values below are the fallback for a page built without that step -
     they are physics' blue and are never the right answer for any other
     subject. Do not "fix" a colour here; change data/subjects.json. */
  --accent: #1b4b8f;
  --accent-soft: #eef3fa;
  --accent-line: #d3e0f1;
  --warn: #a4441a;
  --warn-soft: #fdf1ea;
  --mark: #0b6b5b;
  --mark-soft: #eaf6f2;
  --measure: 68ch;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* Georgia covers Latin and nothing else. Every script the other
     subjects teach arrives as a fallback face, and a fallback face looks
     different on every device. Naming the scripts explicitly means the
     same glyphs are asked for everywhere; the last-resort serif still
     catches whatever is left. */
  font-family: "Georgia", "Iowan Old Style", "Times New Roman",
               "Noto Serif", "Noto Naskh Arabic", "Noto Serif Hebrew",
               "Noto Serif Bengali", "Noto Serif Devanagari",
               "Noto Serif CJK SC", "Songti SC", "SimSun", serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
}

/* --------------------------------------------- target-language runs */

/* The teaching is in English; the words being taught are in the language
   the student is revising. The prerenderer marks those runs with lang=
   and dir=, so a screen reader uses the right voice and the browser puts
   the punctuation on the correct side of a right-to-left sentence.

   unicode-bidi: plaintext lets each run decide its own base direction
   from its first strong character, so an English-led sentence stays left
   to right even when a Hebrew or Urdu word ends it. */
[lang]:not([lang="en-GB"]) { unicode-bidi: plaintext; }

/* Devanagari and Arabic carry ascenders and descenders that a 1.65 line
   height crowds. */
:lang(bn), :lang(pa), :lang(ur), :lang(ar), :lang(fa) { line-height: 1.8; }
:lang(zh-Hans), :lang(zh) { line-height: 1.75; }

/* ------------------------------------------------------------- structure */

.wrap { max-width: 860px; margin: 0 auto; padding: 0 22px; }

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--wash);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.topbar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-top: 13px; padding-bottom: 13px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 15px; letter-spacing: .01em;
  color: var(--ink); text-decoration: none;
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  color: #fff; display: grid; place-items: center;
  font-family: Georgia, serif; font-size: 14px; font-weight: 700;
}
.topnav { font-size: 13.5px; display: flex; gap: 14px; align-items: center; }
.topnav a {
  color: var(--ink-2); text-decoration: none;
  /* WCAG 2.2 SC 2.5.8: a target must be at least 24x24 CSS pixels. */
  display: inline-flex; align-items: center; min-height: 24px;
}
.topnav a:hover { color: var(--accent); text-decoration: underline; }

main { padding: 30px 0 60px; }

/* ------------------------------------------------------------- breadcrumbs */

.crumbs {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px; color: var(--ink-3); margin: 0 0 18px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.crumbs a {
  color: var(--ink-3); text-decoration: none;
  display: inline-flex; align-items: center; min-height: 24px;
}
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs .sep { color: #c3cad2; }

/* ------------------------------------------------------------------ titles */

h1 {
  font-size: 32px; line-height: 1.22; margin: 0 0 12px; letter-spacing: -.012em;
}
h2 {
  font-size: 22px; line-height: 1.3; margin: 42px 0 6px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line); letter-spacing: -.008em;
}
h3 { font-size: 17px; margin: 26px 0 6px; line-height: 1.4; }
.lede { font-size: 18px; color: var(--ink-2); margin: 0 0 20px; max-width: var(--measure); }

/* ------------------------------------------------------------------ meta */

.specbar {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12.8px; font-weight: 600; letter-spacing: .01em;
}
.chip.plain { background: var(--wash); color: var(--ink-2); border: 1px solid var(--line); }

/* ------------------------------------------------------------- teaching */

.point { padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.point:last-child { border-bottom: 0; }
.point-t {
  font-weight: 700; font-size: 16px; margin: 0 0 5px; color: var(--ink);
}
.point-d { margin: 0 0 8px; max-width: var(--measure); }
.point-d p { margin: 0 0 8px; }
.point-key {
  font-size: 14.5px; margin: 0 0 6px; padding: 8px 12px;
  background: var(--mark-soft); border-left: 3px solid var(--mark);
  border-radius: 0 5px 5px 0; max-width: var(--measure);
}
.point-key b { color: var(--mark); }
.point-warn {
  font-size: 14.5px; margin: 0 0 6px; padding: 8px 12px;
  background: var(--warn-soft); border-left: 3px solid var(--warn);
  border-radius: 0 5px 5px 0; max-width: var(--measure);
}
.point-warn b { color: var(--warn); }
.point-eq {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 15px; background: var(--wash); border: 1px solid var(--line);
  border-radius: 6px; padding: 7px 12px; display: inline-block; margin: 4px 0 2px;
}

/* ----------------------------------------------------------------- cards */

.cards { display: grid; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; }
.card {
  border: 1px solid var(--line); border-radius: 9px; padding: 13px 15px;
  background: var(--wash);
}
.card-q { font-weight: 600; margin: 0 0 5px; max-width: var(--measure); }
.card-a { margin: 0; color: var(--ink-2); font-size: 15.5px; max-width: var(--measure); }

/* -------------------------------------------------------------- questions */

.q {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 15px 17px; margin: 14px 0; background: var(--paper);
}
.q-head {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 12.8px; margin-bottom: 8px;
}
.q-tag {
  padding: 2px 8px; border-radius: 5px; background: var(--wash);
  border: 1px solid var(--line); color: var(--ink-2); font-weight: 600;
}
.q-tag.marks { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.q-tag.ht { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.q-text { margin: 0 0 10px; font-weight: 600; max-width: var(--measure); }
.q-opts { margin: 0 0 12px; padding: 0; list-style: none; }
.q-opts li { padding: 5px 0 5px 22px; position: relative; color: var(--ink-2); }
.q-opts li::before {
  content: attr(data-l); position: absolute; left: 0; color: var(--ink-3);
  font-weight: 700; font-size: 13px;
}
.q-ms {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; background: var(--mark-soft); border-radius: 8px;
  padding: 10px 13px; margin: 0; color: #1e4a41;
  /* The mark scheme is the one thing a student has to read line by line
     against their own answer. At full width it ran to 107 characters a
     line, and finding the second mark is exactly the job that gets lost. */
  max-width: var(--measure);
}
.q-ms b { color: var(--mark); }
.q-scaffold { margin: 8px 0 0; padding-left: 20px; font-size: 15px; color: var(--ink-2); }

/* --------------------------------------------------------------- sections */

.seclist { list-style: none; padding: 0; margin: 16px 0 0; }
.seclist li {
  border-bottom: 1px solid var(--line-2); padding: 13px 0;
  display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap;
}
.seclist a {
  color: var(--ink); text-decoration: none; font-weight: 600; flex: 1 1 260px;
  display: inline-flex; align-items: center; min-height: 24px;
}
.seclist a:hover { color: var(--accent); text-decoration: underline; }
.seclist .count {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 12.8px; color: var(--ink-3); white-space: nowrap;
}
.seclist .code {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12.8px; color: var(--accent); min-width: 74px;
}

/* ------------------------------------------------------------------- cta */

.cta {
  margin: 34px 0 0; padding: 18px 20px; border-radius: 11px;
  background: var(--accent-soft); border: 1px solid #d3e0f1;
}
.cta h3 { margin: 0 0 5px; font-size: 17px; color: var(--accent); }
.cta p { margin: 0 0 11px; font-size: 15px; color: var(--ink-2); max-width: var(--measure); }
.btn {
  display: inline-block; background: var(--accent); color: #fff; text-decoration: none;
  padding: 9px 17px; border-radius: 8px; font-weight: 600; font-size: 14.5px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.btn:hover { background: #163c73; }

/* --------------------------------------------------------------- sitemap */

.map { list-style: none; padding: 0; margin: 14px 0 0; }
.map li { border-bottom: 1px solid var(--line-2); }
.map a {
  display: block; padding: 11px 0; color: var(--ink); text-decoration: none;
  font-weight: 600;
}
.map a:hover { color: var(--accent); }
.map .sub { font-size: 14px; color: var(--ink-3); font-weight: 400; }

/* ------------------------------------------------------------------ foot */

.foot {
  border-top: 1px solid var(--line); margin-top: 46px; padding: 20px 0 40px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px; color: var(--ink-3);
}
.foot a {
  color: var(--ink-3);
  display: inline-flex; align-items: center; min-height: 24px;
}

/* ----------------------------------------------------------------- print */

@media print {
  .topbar, .cta, .foot, .crumbs { display: none; }
  body { font-size: 11.5pt; line-height: 1.45; }
  main { padding: 0; }
  h2 { page-break-after: avoid; }
  .point, .q, .card { page-break-inside: avoid; }
  .q-ms { background: none; border: 1px solid #ccc; }
  a { color: inherit; text-decoration: none; }
}
