/* ============================================================
   HGS Maths — global stylesheet
   Shared by every page. Component sections are labelled.
   ============================================================ */

/* ── Self-hosted fonts (variable woff2) ───────────────────
   Replaces the Google Fonts request: faster, no third-party
   call, no data sent to Google. */
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/source-sans-3-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('../fonts/oswald-latin.woff2') format('woff2');
}

:root {
  --yellow: #F8D60A;   /* exact yellow sampled from the HGS Maths logo */
  --dark:   #1a1d21;
  --mid:    #343A40;
  --red:    #E8645A;
  --white:  #FFFFFF;
  --grey:   #f2f2f0;
  --blue:   #2A66B9;
  --green:  #2e9e60;
  --l2fm:   #7b5ea7;
  --card-r: 8px;
  --nav-h:  50px;
  --max-w:  1200px;
  --pad-x:  24px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--white);
  color: var(--mid);
  font-family: 'Source Sans 3', Verdana, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a       { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img     { display: block; max-width: 100%; height: auto; }

/* Accessibility: skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--dark); color: var(--yellow);
  padding: 10px 16px; font-weight: 600;
}
.skip-link:focus { left: 8px; top: 8px; text-decoration: none; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ── HEADER ───────────────────────────────────────────── */
.site-header { background: var(--dark); }
.header-inner { max-width: var(--max-w); margin: 0 auto; padding: 30px var(--pad-x) 32px; }
.site-logo img { height: 62px; width: auto; }

/* ── NAV ──────────────────────────────────────────────── */
.site-nav {
  background: var(--yellow); position: sticky; top: 0;
  z-index: 200; box-shadow: 0 2px 10px rgba(0,0,0,0.2); line-height: 0;
}
.nav-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 var(--pad-x);
  display: flex; align-items: stretch; height: var(--nav-h);
}
.nav-link {
  display: inline-flex; align-items: center; padding: 0 15px; height: 100%;
  font-family: 'Source Sans 3', Verdana, sans-serif; font-size: 14px; line-height: normal;
  font-weight: 600; color: var(--dark); letter-spacing: 0; text-transform: uppercase;
  white-space: nowrap; border: none; margin: 0; flex-shrink: 0;
  cursor: pointer; background: transparent; transition: background .15s, color .15s;
}
.nav-link:hover {
  background: var(--dark); color: var(--yellow); text-decoration: none;
}
.nav-drfrost { margin-left: auto; border-left: 1px solid rgba(0,0,0,0.15); }

.nav-hamburger {
  display: none; margin-left: auto; background: none; border: none;
  cursor: pointer; padding: 0 16px; height: var(--nav-h);
  align-items: center; flex-direction: column; justify-content: center; gap: 5px;
}
.nav-hamburger .bar {
  display: block; width: 22px; height: 2px; background: var(--dark);
  border-radius: 2px; transition: transform .25s, opacity .2s; transform-origin: center;
}
.nav-hamburger.is-open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.is-open .bar:nth-child(2) { opacity: 0; }
.nav-hamburger.is-open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile { display: none; background: var(--dark); border-top: 3px solid var(--yellow); }
.nav-mobile.is-open {
  display: block;
  max-height: calc(100vh - var(--nav-h));
  max-height: calc(100dvh - var(--nav-h));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.nav-mobile a {
  display: block; padding: 17px 24px;
  font-family: 'Source Sans 3', Verdana, sans-serif; font-size: 16px; font-weight: 600;
  color: rgba(255,255,255,0.85); letter-spacing: 0; text-transform: none;
  border-bottom: 1px solid rgba(255,255,255,0.07); transition: background .14s, color .14s;
}
.nav-mobile a:hover { background: var(--yellow); color: var(--dark); text-decoration: none; }

/* Mobile accordion groups (Year 11/12/13) */
.m-group { border-bottom: 1px solid rgba(255,255,255,0.07); }
.m-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 17px 24px; background: none; border: none; cursor: pointer; text-align: left;
  font-family: 'Source Sans 3', Verdana, sans-serif; font-size: 16px; font-weight: 600;
  color: rgba(255,255,255,0.85); transition: background .14s, color .14s;
}
.m-toggle:hover { background: var(--yellow); color: var(--dark); }
.m-caret { font-size: 12px; transition: transform .2s; }
.m-group.open .m-caret { transform: rotate(180deg); }
.m-sub { display: none; background: rgba(0,0,0,0.25); }
.m-group.open .m-sub { display: block; }
.m-sub a { padding-left: 40px; font-size: 15px; color: rgba(255,255,255,0.75); }
.m-sub a.ind { padding-left: 56px; font-size: 14px; color: rgba(255,255,255,0.55); }

/* Dropdowns (Year 11/12/13) */
.nav-dropdown { position: relative; display: inline-flex; align-items: stretch; align-self: stretch; }
.nav-dropdown-panel {
  display: none; position: absolute; top: var(--nav-h); left: 0;
  background: var(--dark); min-width: 240px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3); z-index: 300;
}
.nav-dropdown:hover .nav-dropdown-panel,
.nav-dropdown.open  .nav-dropdown-panel { display: block; }
.nav-dropdown-panel .dd-item { position: relative; border-bottom: 1px solid rgba(255,255,255,0.07); }
.nav-dropdown-panel .dd-item:last-child { border-bottom: none; }
.nav-dropdown-panel .dd-link {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 18px;
  font-family: 'Source Sans 3', Verdana, sans-serif; font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,0.85); letter-spacing: 0; text-transform: none;
  transition: background .14s, color .14s; line-height: normal;
  text-decoration: none; cursor: pointer; background: transparent; border: none; width: 100%; text-align: left;
}
.nav-dropdown-panel .dd-link:hover,
.nav-dropdown-panel .dd-item:hover > .dd-link,
.nav-dropdown-panel .dd-item.open > .dd-link {
  background: var(--yellow); color: var(--dark); text-decoration: none;
}
.nav-dropdown-panel .dd-link .dd-arrow { font-size: 10px; opacity: .7; }
.dd-sub {
  display: none; position: absolute; top: 0; left: 100%;
  background: var(--dark); min-width: 200px;
  box-shadow: 4px 4px 20px rgba(0,0,0,0.3); z-index: 400;
}
.dd-item:hover .dd-sub, .dd-item.open .dd-sub { display: block; }
.dd-sub a {
  display: block; padding: 11px 18px;
  font-family: 'Source Sans 3', Verdana, sans-serif; font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,0.85); letter-spacing: 0; text-transform: none;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  transition: background .14s, color .14s; line-height: normal; text-decoration: none;
}
.dd-sub a:last-child { border-bottom: none; }
.dd-sub a:hover { background: var(--yellow); color: var(--dark); text-decoration: none; }
.nav-dropdown-toggle::after { content: ' ▾'; font-size: 10px; }

@media (max-width: 880px) {
  .nav-year-link, .nav-home-link, .nav-drfrost { display: none !important; }
  .nav-hamburger { display: flex; }
  .header-inner { text-align: center; }
  .site-logo { display: block; }
  .site-logo img { margin: 0 auto; }
}

/* ── ANNOUNCEMENTS GRID (home) ────────────────────────── */
#announcements { background: var(--grey); padding: 44px 0 52px; flex-shrink: 0; }
.section-heading {
  font-family: 'Oswald', sans-serif; font-size: 26px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--dark);
  text-align: center; margin-bottom: 32px;
}
.section-heading span { border-bottom: 3px solid var(--yellow); padding-bottom: 3px; }
.section-heading a { color: inherit; }
.section-heading a:hover { text-decoration: none; opacity: .7; }
.ann-grid {
  max-width: var(--max-w); margin: 0 auto; padding: 0 var(--pad-x);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
.ann-card {
  background: var(--white); border-radius: var(--card-r);
  border-top: 4px solid var(--yellow); box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  padding: 24px 20px 20px;
}
.ann-card-icon {
  width: 38px; height: 38px; background: var(--yellow); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
}
.ann-card-icon svg { width: 18px; height: 18px; }
.ann-card h3 {
  font-family: 'Oswald', sans-serif; font-size: 16px; font-weight: 700;
  text-align: center; color: var(--dark); margin-bottom: 16px;
}
.ann-link { display: block; text-align: center; font-size: 15px; color: var(--blue); margin-bottom: 8px; }
.ann-link:last-child { margin-bottom: 0; }
.ann-link:hover { text-decoration: underline; color: var(--dark); }
.lb-trigger {
  display: block; cursor: zoom-in; border-radius: 4px; overflow: hidden;
  border: 2px solid transparent; transition: border-color .18s; margin-bottom: 6px;
}
.lb-trigger:hover { border-color: var(--yellow); }
.lb-trigger img { width: 100%; height: auto; display: block; }
.lb-hint { font-size: 11px; color: rgba(0,0,0,0.38); text-align: center; letter-spacing: .3px; }
@media (max-width: 700px) { .ann-grid { grid-template-columns: 1fr; } }
@media (min-width: 701px) and (max-width: 900px) { .ann-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── LIGHTBOX ─────────────────────────────────────────── */
#lb-overlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.9); align-items: center; justify-content: center;
  padding: 20px; cursor: zoom-out;
}
#lb-overlay.open { display: flex; }
#lb-overlay img {
  max-width: 92vw; max-height: 92vh; border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6); cursor: default; animation: lbIn .2s ease;
}
@keyframes lbIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
#lb-close {
  position: fixed; top: 16px; right: 20px;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%; width: 38px; height: 38px;
  color: white; font-size: 20px; line-height: 38px; text-align: center;
  cursor: pointer; transition: background .15s;
}
#lb-close:hover { background: var(--yellow); color: var(--dark); }

/* ── MAIN CONTENT ─────────────────────────────────────── */
.site-content { flex: 1; padding: 48px var(--pad-x) 64px; }
.content-inner { max-width: var(--max-w); margin: 0 auto; }

.page-heading, .panel-heading {
  font-family: 'Oswald', sans-serif; font-weight: 700; color: var(--dark);
  border-bottom: 3px solid var(--yellow);
}
.page-heading { font-size: 30px; margin-bottom: 28px; padding-bottom: 10px; }
.panel-heading { font-size: 26px; margin-bottom: 24px; padding-bottom: 10px; }

/* Home: year-group grid */
.yg-section { margin-bottom: 48px; }
.yg-heading { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: rgba(0,0,0,0.35); margin-bottom: 14px; }
.year-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 10px; }
.yg-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--grey); border-radius: var(--card-r); padding: 18px 8px; gap: 5px;
  text-decoration: none; border-top: 3px solid transparent;
  transition: background .18s, border-color .18s, transform .15s;
}
.yg-card:hover { background: var(--dark); border-top-color: var(--yellow); transform: translateY(-3px); text-decoration: none; }
.yg-card:hover .yg-num, .yg-card:hover .yg-label { color: var(--yellow); }
.yg-num { font-family: 'Oswald', sans-serif; font-size: 26px; font-weight: 700; color: var(--dark); line-height: 1; transition: color .18s; }
.yg-label { font-size: 10px; font-weight: 600; color: rgba(0,0,0,0.4); text-transform: uppercase; letter-spacing: .5px; transition: color .18s; }

/* Home: about + stats */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.about-heading {
  font-family: 'Oswald', sans-serif; font-size: 22px; font-weight: 700;
  color: var(--dark); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 3px solid var(--yellow);
}
.about-block p { font-size: 16px; color: #444; line-height: 1.75; margin-bottom: 12px; }
.about-tagline { font-size: 16px !important; font-weight: 600; color: var(--dark) !important; margin-bottom: 16px !important; line-height: 1.5 !important; }
.about-block p:last-child { margin-bottom: 0; }
.about-block a { color: var(--blue); }
.about-stats { background: var(--dark); border-radius: var(--card-r); padding: 28px 28px 24px; }
.about-stats .about-heading { color: var(--yellow); border-bottom-color: rgba(255,255,255,0.15); }
.stats-row { display: flex; gap: 0; align-items: flex-start; }
.stat-block { flex: 1; }
.stat-qual { font-family: 'Oswald', sans-serif; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.4); display: block; margin-bottom: 10px; }
.stat-item { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.stat-pct { font-family: 'Oswald', sans-serif; font-size: 26px; font-weight: 700; color: var(--yellow); line-height: 1; }
.stat-desc { font-size: 13px; color: rgba(255,255,255,0.65); white-space: nowrap; }
.stat-divider { width: 1px; background: rgba(255,255,255,0.1); margin: 0 24px; align-self: stretch; }
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) {
  .stats-row { flex-direction: column; gap: 24px; }
  .stat-divider { width: auto; height: 1px; margin: 0; align-self: auto; }
}
@media (max-width: 700px) { .year-grid { grid-template-columns: repeat(4,1fr); } }
@media (max-width: 400px) { .stat-pct { font-size: 22px; } }

/* ── RESOURCE GRID (year pages) ───────────────────────── */
.resource-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-break { grid-column: 1 / -1; }
.res-card {
  background: var(--white); border: 1px solid #e0e0e0; border-top: 4px solid var(--yellow);
  border-radius: var(--card-r); box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 20px 18px 18px; display: flex; gap: 14px; align-items: flex-start;
  align-self: start; /* size to content so short cards don't stretch to match tall ones */
  transition: box-shadow .2s, transform .2s;
}
.res-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.1); transform: translateY(-2px); }
.res-icon { flex-shrink: 0; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.res-icon img { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; }
.res-icon svg { width: 44px; height: 44px; }
.res-body { flex: 1; min-width: 0; }
.res-card h3 { font-family: 'Oswald', sans-serif; font-size: 15px; font-weight: 700; color: var(--dark); margin-bottom: 10px; letter-spacing: .2px; }
.res-card ul { list-style: none; padding: 0; margin: 0; }
.res-card ul li { margin-bottom: 6px; font-size: 15px; }
.res-card ul li:last-child { margin-bottom: 0; }
.res-card ul li a { color: var(--blue); }
.res-card ul li a:hover { text-decoration: underline; color: var(--dark); }
.res-card ul li.l2fm { color: var(--mid); }
.res-card ul li.l2fm a { color: var(--blue); }
/* Separate the L2FM links from the regular booklet/tasks above them. */
.res-card ul li:not(.l2fm) + li.l2fm { margin-top: 12px; }

.section-label {
  grid-column: 1 / -1; font-family: 'Oswald', sans-serif; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--dark); margin-bottom: 0;
  padding-bottom: 8px; padding-top: 16px; border-top: 1px solid #e0e0e0;
}

/* ── MAKE 24 GAME (home) ──────────────────────────────── */
.game24 { margin-top: 44px; padding-top: 40px; border-top: 1px solid #e0e0e0; }
.game24-heading {
  font-family: 'Oswald', sans-serif; font-size: 24px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--dark); margin-bottom: 10px;
}
.game24-intro { color: var(--mid); margin-bottom: 22px; line-height: 1.6; }
.game24-intro code {
  background: #e9e9e6; border-radius: 4px; padding: 1px 6px;
  font-family: 'Source Sans 3', Verdana, sans-serif; font-size: 0.95em;
}
.game24-cards { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.g24-card {
  font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 30px;
  width: 64px; height: 80px; display: flex; align-items: center; justify-content: center;
  background: var(--dark); color: var(--yellow); border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.game24-cards.solved .g24-card { background: var(--green); color: #fff; }
.game24-play { background: var(--grey); border-radius: 12px; padding: 20px 22px; }
.game24-row { display: flex; flex-wrap: wrap; gap: 10px; }
.game24-input {
  flex: 1 1 220px; min-width: 0; border: 1px solid #ccc; border-radius: 7px;
  padding: 11px 13px; font-size: 16px; font-family: 'Source Sans 3', Verdana, sans-serif;
}
.game24-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(42,102,185,0.15); }
.game24-btn {
  border: none; border-radius: 7px; padding: 11px 18px; cursor: pointer;
  font-family: 'Oswald', sans-serif; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; font-size: 14px; background: var(--blue); color: #fff; transition: background .15s, color .15s;
}
.game24-btn:hover { background: var(--dark); }
.game24-btn-ghost { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.game24-btn-ghost:hover { background: var(--blue); color: #fff; }
.game24-msg { margin: 14px 0 0; font-weight: 600; min-height: 1.2em; }
.game24-msg.ok { color: var(--green); }
.game24-msg.warn { color: var(--red); }
@media (max-width: 480px) { .game24-btn { flex: 1 1 auto; } }
/* No redundant divider when the label is the first thing under the heading */
.resource-grid > .section-label:first-child { border-top: none; padding-top: 0; }

/* ── YEAR TABS (current + previous years) ─────────────── */
.page-tabs { display: flex; gap: 6px; margin-bottom: 28px; padding-bottom: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--grey); }
.page-tab {
  font-family: 'Source Sans 3', Verdana, sans-serif; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0;
  padding: 9px 20px; background: var(--grey); color: var(--mid); border: none; border-radius: 5px;
  cursor: pointer; outline: none; transition: background .15s, color .15s;
}
.page-tab:hover { background: var(--mid); color: var(--white); }
.page-tab.active { background: var(--dark); color: var(--yellow); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── PAST/PRACTICE PAPERS (sets) ──────────────────────── */
.breadcrumb { font-size: 13px; color: #888; margin-bottom: 20px; }
.breadcrumb a { color: #888; }
.breadcrumb a:hover { color: var(--blue); }
.set-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid #e0e0e0; }
.set-nav a {
  font-family: 'Source Sans 3', Verdana, sans-serif; font-size: 13px; font-weight: 600;
  padding: 7px 14px; background: var(--grey); color: var(--dark); border-radius: 5px;
  transition: background .15s, color .15s;
}
.set-nav a:hover { background: var(--dark); color: var(--yellow); text-decoration: none; }
.set-section { margin-bottom: 40px; scroll-margin-top: 70px; }
.set-section + .set-section { border-top: 1px solid #e0e0e0; padding-top: 32px; }
.set-heading {
  font-family: 'Oswald', sans-serif; margin-bottom: 16px;
}
.set-heading .set-num, .set-heading {
  font-size: 20px; font-weight: 700; color: var(--dark); text-transform: none;
}
.paper-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.paper-card {
  background: var(--white); border: 1px solid #e0e0e0; border-top: 4px solid var(--yellow);
  border-radius: var(--card-r); box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 18px 16px; display: flex; gap: 12px; align-items: flex-start;
  transition: box-shadow .2s, transform .2s;
}
.paper-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.1); transform: translateY(-2px); }
.paper-icon { flex-shrink: 0; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; }
.paper-icon img { width: 38px; height: 38px; object-fit: contain; border-radius: 9px; }
.paper-icon svg { width: 38px; height: 38px; }
.paper-body { flex: 1; min-width: 0; }
.paper-body h3 { font-family: 'Oswald', sans-serif; font-size: 14px; font-weight: 700; color: var(--dark); margin-bottom: 8px; line-height: 1.3; }
.paper-body ul { list-style: none; padding: 0; margin: 0; }
.paper-body ul li { margin-bottom: 5px; font-size: 15px; }
.paper-body ul li:last-child { margin-bottom: 0; }
.paper-body ul li a { color: var(--blue); }
.paper-body ul li a:hover { text-decoration: underline; color: var(--dark); }

/* ── SUBJECT CHOICE (Year 12/13 landing) ──────────────── */
.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; max-width: 760px; }
.choice-card {
  display: flex; flex-direction: column; gap: 6px; padding: 32px 28px;
  background: var(--grey); border-radius: var(--card-r); border-top: 4px solid var(--yellow);
  text-decoration: none; transition: background .18s, transform .15s, border-color .18s;
}
.choice-card:hover { background: var(--dark); transform: translateY(-3px); text-decoration: none; }
.choice-card:hover .choice-title, .choice-card:hover .choice-sub { color: var(--yellow); }
.choice-title { font-family: 'Oswald', sans-serif; font-size: 22px; font-weight: 700; color: var(--dark); }
.choice-sub { font-size: 13px; color: rgba(0,0,0,0.5); }
@media (max-width: 560px) { .choice-grid { grid-template-columns: 1fr; } }

/* ── STAFF ────────────────────────────────────────────── */
#login-screen { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px var(--pad-x); background: var(--grey); }
.login-box {
  background: var(--white); border-radius: var(--card-r); border-top: 4px solid var(--yellow);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1); padding: 36px 32px 32px; width: 100%; max-width: 380px;
}
.login-box h1 { font-family: 'Oswald', sans-serif; font-size: 22px; font-weight: 700; color: var(--dark); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.login-box p { font-size: 14px; color: #888; margin-bottom: 24px; }
.login-box label { display: block; font-size: 13px; font-weight: 600; color: var(--mid); margin-bottom: 6px; }
.login-box input[type="password"] {
  display: block; width: 100%; border: 1px solid #ddd; border-radius: 5px;
  padding: 10px 12px; font-size: 15px; font-family: inherit; color: var(--mid);
  outline: none; transition: border-color .15s; margin-bottom: 18px;
}
.login-box input[type="password"]:focus { border-color: var(--yellow); }
.login-btn {
  width: 100%; padding: 11px; background: var(--dark); color: var(--yellow);
  font-family: 'Oswald', sans-serif; font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  border: none; border-radius: 5px; cursor: pointer; transition: background .18s;
}
.login-btn:hover { background: var(--yellow); color: var(--dark); }
.login-error {
  margin-top: 14px; background: rgba(232,100,90,0.1); border: 1px solid rgba(232,100,90,0.3);
  border-radius: 5px; padding: 10px 12px; color: var(--red); font-size: 13px; text-align: center;
}
.staff-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.logout-btn {
  font-family: 'Oswald', sans-serif; font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: .5px;
  padding: 6px 16px; background: transparent; color: var(--mid); border: 1px solid #ccc;
  border-radius: 4px; cursor: pointer; transition: all .15s; text-decoration: none;
}
.logout-btn:hover { background: var(--red); color: white; border-color: var(--red); text-decoration: none; }
.staff-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 28px; }
.staff-card { background: var(--white); border: 1px solid #e0e0e0; border-top: 4px solid var(--yellow); border-radius: var(--card-r); box-shadow: 0 2px 8px rgba(0,0,0,0.06); padding: 22px 20px; }
.staff-card h2 { font-family: 'Oswald', sans-serif; font-size: 16px; font-weight: 700; color: var(--dark); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .3px; }
.staff-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.staff-card-head h2 { margin-bottom: 0; }
.staff-icon { flex-shrink: 0; width: 36px; height: 36px; }
.staff-icon svg { width: 36px; height: 36px; }
.staff-card ul { list-style: none; padding: 0; }
.staff-card ul li { margin-bottom: 8px; font-size: 14px; }
.staff-card ul li a { color: var(--blue); }
.staff-card code { background: var(--grey); padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.notice { background: #fffbe6; border: 1px solid #f0d000; border-left: 4px solid var(--yellow); border-radius: 5px; padding: 14px 16px; font-size: 14px; color: #7a6000; margin-bottom: 24px; }
.notice strong { color: var(--mid); }
@media (max-width: 860px) { .staff-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .staff-grid { grid-template-columns: 1fr; } .login-box { padding: 28px 20px 24px; } }

/* ── PROSE (legal / text pages) ───────────────────────────
   Shares the element with .content-inner, so it inherits the
   standard 1200px width — matching the year-group pages. */
.prose .updated { font-size: 13px; color: #888; margin: -16px 0 28px; }
.prose h2 {
  font-family: 'Oswald', sans-serif; font-size: 19px; font-weight: 700; color: var(--dark);
  margin: 30px 0 10px; letter-spacing: .2px;
}
.prose h2:first-of-type { margin-top: 0; }
.prose p { margin-bottom: 14px; }
.prose ul { margin: 0 0 14px 22px; }
.prose li { margin-bottom: 7px; }

/* ── 404 ──────────────────────────────────────────────── */
.notfound img { display: block; margin: 0 0 24px; }
.notfound .home-link { display: inline-block; margin-top: 8px; font-weight: 600; }

/* ── FOOTER ───────────────────────────────────────────── */
.site-footer {
  background: var(--dark); border-top: 3px solid var(--yellow);
  color: rgba(255,255,255,0.45); font-size: 12px; text-align: center;
  padding: 20px var(--pad-x); flex-shrink: 0;
}
.site-footer a { color: rgba(255,255,255,0.6); }
.site-footer a:hover { color: var(--yellow); text-decoration: none; }
.site-footer .copy { margin-top: 5px; }

/* ── BACK TO TOP ──────────────────────────────────────── */
#back-to-top {
  position: fixed; bottom: 28px; right: 24px; width: 42px; height: 42px;
  background: var(--dark); border: 2px solid var(--yellow); border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; z-index: 500;
  opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity .25s, transform .25s, background .18s;
}
#back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
#back-to-top:hover { background: var(--yellow); }
#back-to-top:hover svg { fill: var(--dark); }
#back-to-top svg { fill: var(--white); width: 16px; height: 16px; transition: fill .18s; }

/* ── RESPONSIVE GRIDS ─────────────────────────────────── */
@media (max-width: 900px) { .resource-grid { grid-template-columns: repeat(2, 1fr); } .paper-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .resource-grid { grid-template-columns: 1fr; }
  .paper-grid { grid-template-columns: 1fr; }
  .page-heading { font-size: 24px; }
  .page-tab { font-size: 13px; padding: 8px 14px; }
}

/* ── "NEW" BADGE (mark recently added resources) ──────────
   Usage: <h3>Unit 21 <span class="badge-new">New</span></h3> */
.badge-new {
  display: inline-block; vertical-align: middle;
  font-family: 'Oswald', sans-serif; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--dark); background: var(--yellow);
  padding: 2px 6px; border-radius: 3px; margin-left: 6px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ── DARK THEME (auto: follows the device setting) ──────
   The masthead, yellow nav, results panel, footer and back-to-top
   are already dark by design, so they're left untouched. This block
   re-skins the light surfaces (page, cards, inputs) and text. */
@media (prefers-color-scheme: dark) {
  html { color-scheme: dark; }
  body { background: #14171a; color: #c9ced4; }

  /* Light surfaces → dark surfaces */
  #announcements { background: #181b1f; }
  .ann-card, .res-card, .paper-card, .staff-card, .login-box {
    background: #21262d; border-color: #2f353d; box-shadow: none;
  }
  .ann-card { border: 1px solid #2f353d; border-top: 4px solid var(--yellow); }
  .res-card:hover, .paper-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.45); }
  #login-screen { background: #14171a; }
  .yg-card, .choice-card { background: #21262d; }
  .game24-play { background: #1b1f24; }
  .game24-intro code, .staff-card code { background: #2a2f36; }
  .page-tab, .set-nav a { background: #262c33; }
  .page-tabs { border-bottom-color: #2f353d; }
  .set-nav, .set-section + .set-section, .section-label, .game24 { border-color: #2f353d; }

  /* Headings & strong text → light */
  .section-heading, .page-heading, .panel-heading, .ann-card h3,
  .about-heading, .res-card h3, .set-heading, .set-heading .set-num,
  .paper-body h3, .choice-title, .staff-card h2, .prose h2,
  .login-box h1, .game24-heading, .yg-num, .page-tab, .set-nav a,
  .section-label { color: #e7e9ec; }

  /* Body / muted text → light grey */
  .about-block p { color: #c9ced4; }
  .yg-heading, .yg-label, .choice-sub, .lb-hint, .breadcrumb,
  .breadcrumb a, .prose .updated, .login-box p, .game24-intro,
  .res-card ul li.l2fm { color: #9aa3ad; }

  /* Links → lighter blue, and fix hovers that darkened to near-black */
  a, .about-block a, .ann-link, .res-card ul li a, .res-card ul li.l2fm a,
  .paper-body ul li a, .staff-card ul li a, .breadcrumb a:hover,
  .game24-btn-ghost { color: #6fa8ff; }
  .game24-btn-ghost { border-color: #6fa8ff; }
  .ann-link:hover, .res-card ul li a:hover, .paper-body ul li a:hover { color: #cfe0ff; }

  /* Form controls */
  .game24-input, .login-box input[type="password"] {
    background: #14171a; border-color: #3a4048; color: #e7e9ec;
  }
  .game24-input::placeholder { color: #6b727b; }
  .logout-btn { color: #c9ced4; border-color: #3a4048; }

  /* Staff notice block */
  .notice { background: #2b2410; border-color: #5a4a14; border-left-color: var(--yellow); color: #e7c14d; }
  .notice strong { color: #e7e9ec; }
}

/* ── PRINT ────────────────────────────────────────────── */
@media print {
  .site-header, .site-nav, .nav-mobile, #back-to-top, .skip-link,
  .page-tabs, .set-nav, .lb-hint, #lb-overlay { display: none !important; }
  body { color: #000; font-size: 12pt; line-height: 1.5; }
  .site-content { padding: 0; }
  .tab-panel { display: block !important; }   /* show all years when printing */
  .res-card, .paper-card, .ann-card {
    box-shadow: none !important; border: 1px solid #ccc !important;
    break-inside: avoid; transform: none !important;
  }
  a { color: #000; text-decoration: underline; }
  .site-footer { background: none; color: #000; border: none; }
  .site-footer a { color: #000; }
  @page { margin: 1.5cm; }
}
