/* GCSE Revision Hub - landing page styles
   Design tokens are borrowed from the subject sites (gcse-physics/assets/style.css)
   so there is no "different website" feeling when you click through. */

:root {
  --ink: #16202e;
  --ink-2: #47566b;
  --ink-3: #5f6e82;
  --line: #e2e8f0;
  --line-2: #f1f4f8;
  --bg: #f6f8fa;
  --card: #ffffff;
  --brand: #16202e;
  --brand-2: #1b4b8f;
  --brand-soft: #e8eef8;
  --hot: #a8124a;
  --hot-soft: #fbe9f0;
  --amber: #8a5a00;
  --amber-soft: #fbeac6;
  --green: #16794c;
  --green-soft: #e6f4ec;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(22, 32, 46, .05), 0 4px 14px rgba(22, 32, 46, .05);
  --shadow-lift: 0 2px 4px rgba(22, 32, 46, .07), 0 12px 30px rgba(22, 32, 46, .10);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
a { color: var(--brand-2); }

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 18px; }
.muted { color: var(--ink-3); }
.small { font-size: .84rem; }
.lede { font-size: 1.02rem; color: var(--ink-2); max-width: 68ch; }
.lede strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------ topbar */

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 1.02rem;
  text-decoration: none;
  color: var(--ink);
  margin-right: auto;
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
}
.brand-text { letter-spacing: -.01em; }
.topnav a { font-size: .9rem; color: var(--ink-2); text-decoration: none; }
.topnav a:hover { color: var(--brand-2); }
/* The separator lives on the same line as the tutor link, so the deploy's
   line filter (which drops any line containing /gcse-tutor/) takes the
   separator with it and the public nav is left with a single link. */
.nav-sep { color: var(--ink-3); margin: 0 .5rem; }

/* -------------------------------------------------------------------- hero */

/* Two columns on a wide screen: what this is on the left, what you do
   here on the right. The right-hand column was empty space before, and a
   directory page that shows only a list does not tell a first-time
   visitor what they would actually be doing. */
.hero {
  padding: 34px 0 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 48px;
  align-items: start;
}
.hero h1 { margin-bottom: .3em; max-width: 27ch; }
.hero-kicker {
  margin: 0 0 .5em;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.hero-sub {
  font-size: 1rem;
  color: var(--ink-2);
  max-width: 52ch;
  margin: 0 0 18px;
}
.hero-link {
  display: inline-block;
  margin-top: 20px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--brand-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
.hero-link:hover { border-bottom-color: var(--brand-2); }

/* The one thing a visitor came here to do is pick a subject, so the hero
   offers it as a button rather than a line of text. The link beside it
   stays a link: it is the second question, not the first. */
.hero-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.hero-actions .hero-link { margin-top: 0; }
.btn-hero {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-weight: 650;
  font-size: .95rem;
  padding: 11px 20px;
  border-radius: 9px;
}
.btn-hero:hover { background: var(--brand-2); color: #fff; }
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.hstat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 16px;
  min-width: 104px;
  box-shadow: var(--shadow);
}
.hstat-n {
  display: block;
  font-size: 1.42rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.hstat-l {
  display: block;
  font-size: .8rem;
  color: var(--ink-3);
  letter-spacing: .04em;
}

/* --------------------------------------------------------------- the sample */

/* One real question, with the mark scheme that goes with it. This is the
   subject site's own quiz, rebuilt in the hub's tokens: the same option
   list, the same green correct answer with its bar down the side, the
   same feedback box. Nothing about it is decorative - it is the thing a
   student actually does, shown before they are asked to commit to a
   subject. The text is copied out of the question bank by
   tools/build-hero-sample.js, so it cannot say anything the bank does
   not contain. */
.sample {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
}
.sample-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.sample-sub {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.sample-marks {
  flex: 0 0 auto;
  font-size: .8rem;
  font-weight: 650;
  color: #fff;
  background: var(--brand);
  border-radius: 999px;
  padding: 3px 10px;
}
.sample-q {
  font-size: .96rem;
  font-weight: 500;
  line-height: 1.45;
  margin: 0 0 12px;
}
.sample-opts {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 7px;
}
.sample-opt {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-size: .9rem;
}
.sample-opt.is-right {
  border-color: var(--green);
  background: var(--green-soft);
  font-weight: 600;
  /* The redundant cue. Colour alone fails a red-green colour-blind
     reader, so the bar and the word both survive in greyscale. */
  box-shadow: inset 4px 0 0 var(--green);
}
.sample-opt-t { min-width: 0; }
.sample-flag {
  flex: 0 0 auto;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--green);
}
.sample-ms {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--bg);
}
.sample-ms-label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 5px;
}
.sample-ms p {
  margin: 0;
  font-size: .89rem;
  color: var(--ink-2);
  line-height: 1.5;
}

/* ------------------------------------------------------------------- steps */

.steps { margin: 30px 0 34px; }
.steps-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 14px;
}
.step {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.step-n {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}
.step-body { min-width: 0; }
.step-h { font-size: .99rem; margin: 0 0 .3em; }
.step-p { font-size: .89rem; color: var(--ink-2); margin: 0; }
.step-p strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------ resume */

.resume {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--brand-soft);
  border: 1px solid #cfdcf0;
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 26px;
}
.resume[hidden] { display: none; }
.resume-body { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.resume-label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  font-weight: 700;
}
.resume-subject { font-weight: 650; font-size: 1.02rem; }
.btn-resume {
  margin-left: auto;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
}
.btn-resume:hover { background: var(--brand-2); color: #fff; }

/* ----------------------------------------------------------------- toolbar */

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.section-title { margin: 0; font-size: 1.12rem; }
.filters { display: flex; gap: 7px; flex-wrap: wrap; margin-left: auto; }
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  font-size: .84rem;
  font-weight: 550;
  padding: 5px 13px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* ----------------------------------------------------------------- controls */

/* The search box and the sort menu sit between the board chips and the
   grid. Both are ordinary form controls dressed in the page's own tokens -
   no new colour, no new font, nothing that does not already appear
   somewhere else on the site. */
.controls {
  display: flex;
  align-items: flex-end;
  gap: 12px 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.control {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.control-label {
  font-size: .8rem;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.control input[type="search"],
.control select {
  font-family: inherit;
  font-size: .95rem;
  line-height: 1.4;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  /* A fingertip needs about 44px, on a phone and on a desktop. */
  min-height: 44px;
  min-width: 44px;
}
.control input[type="search"] { width: 268px; max-width: 100%; }
.control select { padding-right: 30px; cursor: pointer; }
/* The placeholder is a hint, not the label - the label above says what the
   box is for, so the placeholder can sit back a little. */
.control input[type="search"]::placeholder { color: var(--ink-3); }
/* Keyboard users have to be able to see where they are. */
.control input[type="search"]:focus,
.control select:focus {
  outline: 2px solid var(--brand-2);
  outline-offset: 1px;
  border-color: var(--brand-2);
}

/* How many subjects are on screen after the search and the board filter.
   It is the live region: the grid itself is not one, because a grid that
   re-renders on every keystroke would make a screen reader read the whole
   list out again after every letter. */
.result-count {
  margin: 0 0 12px auto;
  font-size: .86rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------- grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
  /* The top bar is sticky, so a jump to the grid has to clear it. */
  scroll-margin-top: 76px;
}
.loading { color: var(--ink-3); padding: 20px 0; }

/* Nothing matched the search. An empty grid reads like a broken page, so
   the page says what happened and spans the full width of the grid. */
.empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 22px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  color: var(--ink-2);
  font-size: .95rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
/* The subject colour runs down the LEFT edge rather than across the top.
   A horizontal bar pushed the title down and made every card taller for
   no gain; a vertical one costs nothing and still identifies the subject
   before you read the name. */
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}
.card.live:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent);
}
/* A subject that is not live yet still has to be readable. The old rule put
   opacity on the whole card, which pulled every grey line of text inside it
   down to 2.3:1 - 2.9:1 against the 4.5:1 that WCAG asks for - because
   opacity composites the text too, not just the picture of it. The
   de-emphasis is done with a dashed edge and a soft chip instead, so every
   word on the card stays at full strength. */
.card.offline { border-style: dashed; }
.card.offline .chip-code {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.card.offline:hover { transform: none; box-shadow: var(--shadow); }

.card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 18px 0 20px;
}
.chip-code {
  flex: 0 0 auto;
  align-self: center;
  width: auto; height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: -.02em;
}
.card-title { min-width: 0; flex: 1; }
.card-title h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.2;
  color: var(--ink);
}
.card-title .board {
  font-size: .84rem;
  color: var(--ink-3);
  display: block;
  margin-top: 2px;
}

/* Where this student got to. It replaces a paragraph of explanation with
   one line of fact that is actually about THEM. */
.card-progress {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 14px 18px 0;
  padding: 8px 11px;
  background: var(--accent-soft, var(--line-2));
  border-radius: 8px;
  font-size: .84rem;
  font-weight: 600;
  color: var(--accent-ink, var(--ink-2));
}
.card-progress .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}

.badge {
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .8rem;
  font-weight: 650;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge.on { color: var(--green); background: var(--green-soft); }
.badge.off { color: var(--amber); background: var(--amber-soft); }
.badge.wait { color: var(--ink-3); background: var(--line-2); }
.badge.wait::before { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

.card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 18px 0;
}
.tag {
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--line-2);
  border-radius: 6px;
  padding: 2px 8px;
  letter-spacing: .01em;
}
.tag.board { background: var(--brand-soft); color: var(--brand-2); }

.card-stats {
  display: flex;
  gap: 0;
  margin: 14px 18px 0;
  border-top: 1px solid var(--line-2);
  padding-top: 12px;
}
.cstat { flex: 1; }
.cstat-n {
  display: block;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.cstat-n.pending { color: var(--ink-3); font-weight: 500; font-size: .95rem; }
.cstat-l { display: block; font-size: .8rem; color: var(--ink-3); letter-spacing: .03em; }

.card-cta {
  margin-top: auto;
  padding: 16px 18px 16px;
}
.card-cta .cta {
  display: block;
  text-align: center;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 650;
  font-size: .92rem;
  padding: 9px 12px;
  border-radius: 9px;
  transition: filter .12s;
}
.card-cta .cta:hover { filter: brightness(1.08); color: #fff; }
.card-cta .soon {
  display: block;
  text-align: center;
  font-size: .86rem;
  color: var(--ink-3);
  background: var(--line-2);
  border-radius: 9px;
  padding: 9px 12px;
  font-weight: 550;
}

/* -------------------------------------------------------------------- tips */

.tips { margin-bottom: 46px; }
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
}
.tip {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.tip h3 { font-size: .98rem; margin-bottom: .35em; }
.tip p { font-size: .9rem; color: var(--ink-2); margin: 0; }

/* ------------------------------------------------------------------ the doc page
   /gcse/how-it-works.html holds every word of explanation that used to sit
   on the home page. It is a reading page, so it gets a narrower measure and
   a heading the reader can orient by. */

.doc-head {
  padding: 40px 0 6px;
  max-width: 62ch;
}
.doc-head h1 { margin-bottom: .35em; }
.doc-head .lede { margin-bottom: 0; }

.doc-cta {
  margin: 4px 0 46px;
}
.btn-doc {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-weight: 650;
  font-size: .95rem;
  padding: 11px 20px;
  border-radius: 9px;
}
.btn-doc:hover { background: var(--brand-2); color: #fff; }

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

.foot {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 20px 0;
  font-size: .86rem;
  color: var(--ink-3);
}
.foot-inner { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.foot a { color: var(--ink-2); text-decoration: none; }
.foot a:hover { color: var(--brand-2); }
.foot-sep { color: var(--line); }

.nojs { padding: 40px 18px 60px; }
.nojs ul { padding-left: 20px; }
.nojs li { margin-bottom: 6px; }

/* ------------------------------------------------------------------ mobile */

/* The two-column hero needs room. Below this the sample panel drops under
   the text, in the order a reader wants it: what this is, then what you
   do here, then the list. */
@media (max-width: 980px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }
}

@media (max-width: 620px) {
  /* Touch targets. A fingertip needs about 44px. */
  .topnav a { display: inline-block; padding: 12px 0; min-height: 44px; }
  .hero-link { padding: 10px 0; min-height: 44px; }
  .hero-actions { flex-direction: column; align-items: stretch; gap: 2px; }
  .btn-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
  }
  .chip { padding: 11px 14px; min-height: 44px; }
  .card-cta .cta { min-height: 44px; padding: 11px 12px; }
  .btn-resume { min-height: 44px; padding: 11px 16px; }
  .foot a { display: inline-block; padding: 11px 0; }
  h1 { font-size: 1.5rem; }
  .hero { padding: 26px 0 18px; }
  .hero-stats { gap: 8px; }
  .hstat { min-width: 0; flex: 1 1 calc(50% - 8px); padding: 8px 13px; }
  .hstat-n { font-size: 1.25rem; }
  .filters { margin-left: 0; width: 100%; }
  .controls { align-items: stretch; }
  .control { flex: 1 1 100%; }
  .control input[type="search"] { width: 100%; }
  .result-count { margin: 0; }
  .grid { grid-template-columns: 1fr; gap: 13px; }
  .btn-resume { margin-left: 0; width: 100%; text-align: center; }
}
