/* Mr Wells Maths — shared site styles. Used by the home page and new pages built from templates/. */

:root {
  --navy: #002060;
  --navy-2: #0a2f7a;
  --red: #C8102E;
  --light: #EFF3F9;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #5a6478;
  --line: #d8e0ee;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0, 32, 96, .08);
  --shadow-hover: 0 8px 22px rgba(0, 32, 96, .16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Aptos, Calibri, Arial, sans-serif;
  background: var(--light);
  color: var(--ink);
  line-height: 1.45;
}

a { color: var(--navy); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 560px) { .wrap { padding: 0 16px; } }

/* ── Header ──────────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 18px 0 64px;
}
.site-header .bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.brand { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; }
.brand img { height: 64px; width: 64px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 4px 12px rgba(0,0,0,.25); }
.brand strong { display: block; white-space: nowrap; font-size: 1.35rem; letter-spacing: .3px; }
.brand span { display: block; font-size: .82rem; color: #c7d3ea; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  color: #dbe4f5; text-decoration: none; font-size: .9rem; font-weight: 600;
  padding: 7px 12px; border-radius: 8px;
}
.site-nav a:hover, .site-nav a.active { background: rgba(255, 255, 255, .12); color: #fff; }

.hero { margin-top: 34px; max-width: 720px; }
.hero h1 { margin: 0; font-size: 2rem; line-height: 1.2; }
.hero p { margin: 10px 0 0; color: #c7d3ea; font-size: 1rem; }
.crumbs { font-size: .85rem; color: #c7d3ea; margin-bottom: 6px; }
.crumbs a { color: #fff; }

@media (max-width: 560px) {
  .brand img { height: 48px; width: 48px; }
  .brand span { display: none; }
  .site-nav { width: 100%; margin-left: -12px; }
  .site-nav a { padding: 6px 12px; font-size: .85rem; }
  .hero h1 { font-size: 1.55rem; }
  .site-header { padding-bottom: 56px; }
}

/* ── Panels & sections ───────────────────────────────── */
.panel {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-top: -36px; position: relative;
}
.section { margin-top: 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 1.15rem; color: var(--navy); }
.section-head .count { font-size: .85rem; color: var(--muted); }
.group-title {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .6px; font-weight: 700;
  color: var(--muted); margin: 22px 0 10px;
}

/* ── Controls ────────────────────────────────────────── */
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 6px; }
.search {
  flex: 1 1 240px; min-width: 0; font: inherit; font-size: .95rem; padding: 9px 12px;
  border: 1.5px solid #cfd8e8; border-radius: 8px; outline: none; background: #fff;
}
.search:focus { border-color: var(--navy); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* a collection page's "Go straight to" drop-down (Connections, Blockbusters) */
.collection-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 18px; font-size: .78rem; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .5px; }
.collection-menu select { font: inherit; font-size: .95rem; font-weight: 600; text-transform: none; letter-spacing: 0; height: 42px; padding: 0 10px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--navy); min-width: min(420px, 100%); max-width: 100%; }
.chip {
  font: inherit; font-size: .8rem; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: #fff; color: var(--navy); cursor: pointer;
}
.chip:hover { border-color: var(--navy); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ── Cards ───────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border-left: 5px solid var(--accent, var(--navy));
  padding: 16px 18px; text-decoration: none; color: inherit;
  transition: transform .12s, box-shadow .12s;
}
a.card:hover, a.card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-hover); outline: none; }
.card .kicker { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--accent, var(--navy)); }
.card h3 { margin: 0; font-size: 1.05rem; color: var(--navy); }
.card p { margin: 0; font-size: .88rem; color: var(--muted); }
.card .meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 8px; }
.tag { font-size: .7rem; font-weight: 700; background: var(--light); color: var(--navy); padding: 3px 8px; border-radius: 999px; }
.tag.new { background: var(--red); color: #fff; }
.tag.covers { background: var(--navy); color: #fff; }

.card.scheme { --accent: var(--navy); }
/* Resource kinds at a glance by the coloured left edge: generators purple (white card),
   games and quizzes red (pale pink card), unit reviews yellow (yellow card, yellow text). */
.card.type-generator { --accent: #5E35A0 !important; }
.card.type-worksheet { --accent: #002060 !important; }   /* dark blue, whatever the topic */
.card.type-game, .card.type-quiz { background: #FEF6F7; --accent: #B0122C !important; }
.card.type-review { background: #FFF6D9; --accent: #8A6400 !important; }
.card.type-review h3 { color: var(--accent); }
.card.type-generator h3, .card.type-worksheet h3, .card.type-game h3, .card.type-quiz h3,
.card.type-generator .kicker, .card.type-worksheet .kicker, .card.type-game .kicker, .card.type-quiz .kicker { color: var(--navy); }
.card.type-game .tag:not(.new),
.card.type-quiz .tag:not(.new), .card.type-review .tag:not(.new) { background: rgba(255, 255, 255, .8); }
.card.scheme .units { font-size: .82rem; color: var(--muted); }

.empty { color: var(--muted); padding: 10px 0; }

/* ── Games: collection subsections ──────────────────── */
.subsection + .subsection { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.subsection .section-head { margin-bottom: 4px; }
.sub-intro { margin: 0 0 4px; color: var(--muted); font-size: .9rem; }

/* ── Home: jump bar ──────────────────────────────────── */
.jump { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.jump-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
a.chip { text-decoration: none; }

/* ── Scheme & folder pages: main + overview sidebar ─── */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; margin-top: -36px; position: relative; }
.layout-main.panel { margin-top: 0; min-height: 200px; }
.layout-main > .group-title:first-child { margin-top: 4px; }
.group-title span { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--red); margin-left: 6px; }

/* ── Unit pages: topics as expandable rows ──────────── */
.topics-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 10px; }
.topics-head .group-title { margin: 0; }
.topics { display: flex; flex-direction: column; gap: 8px; }
.topic { border: 1px solid var(--line); border-radius: 10px; background: #fff; scroll-margin-top: 16px; }
.topic.focus { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(0, 32, 96, .15); }
.topic-head {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer;
  list-style: none; border-radius: 10px;
}
.topic-head::-webkit-details-marker { display: none; }
details.topic > .topic-head::before {
  content: ''; flex: 0 0 auto; width: 8px; height: 8px; margin: 0 2px 0 3px;
  border-right: 2.5px solid var(--navy); border-bottom: 2.5px solid var(--navy);
  transform: rotate(-45deg); transition: transform .15s;
}
details.topic[open] > .topic-head::before { transform: rotate(45deg); }
details.topic > .topic-head:hover { background: var(--light); }
details.topic[open] > .topic-head { border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; }
.topic.is-empty .topic-head { cursor: default; padding-left: 33px; }
.topic.is-empty .topic-title, .topic.is-empty .topic-code { color: var(--muted); }
.topic-code { font-size: .78rem; font-weight: 700; color: var(--red); white-space: nowrap; }
.topic-title { flex: 1 1 auto; min-width: 0; font-weight: 600; color: var(--navy); }
.topic-count { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.topic.is-empty .topic-count { font-style: italic; }
.topic-body { padding: 14px; }
.topic-body .topics { margin-top: 12px; }
.topic.no-res .topic-count { font-style: italic; }

/* What I need to be able to do / Practise online (data/topic-info.js) */
.topic-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 18px; margin-bottom: 14px; }
.topic-info h4 { margin: 0 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; color: var(--navy); }
.topic-info .can { background: #F1EAFB; border-left: 5px solid #5E35A0; border-radius: 10px; padding: 12px 14px; }
.topic-info .can h4 { color: #5E35A0; }
.topic-info ul { margin: 0; padding-left: 20px; }
.topic-info li { margin: 3px 0; line-height: 1.4; }
.topic-info .practice { min-width: 0; overflow-x: auto; }
.topic-info table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.topic-info th { text-align: left; font-size: .72rem; color: var(--muted); font-weight: 700; padding: 0 8px 4px 0; border-bottom: 1px solid var(--line); }
.topic-info td { padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.topic-info td:not(:first-child), .topic-info th:not(:first-child) { white-space: nowrap; }
.topic-info code { font-size: .82rem; font-weight: 700; color: var(--navy); background: var(--light); padding: 1px 6px; border-radius: 5px; }
.topic-info .none { color: var(--muted); }
@media (max-width: 560px) {
  .topic-head { flex-wrap: wrap; gap: 4px 10px; }
  .topic-count { flex-basis: 100%; padding-left: 21px; }
  .topic.is-empty .topic-count { padding-left: 0; }
}

.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.folder {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; text-decoration: none; color: inherit;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.folder:hover, .folder:focus-visible { border-color: var(--navy); box-shadow: var(--shadow-hover); transform: translateY(-1px); outline: none; }
.folder-icon {
  flex: 0 0 34px; height: 26px; margin-top: 2px; border-radius: 3px 6px 6px 6px; background: #f2c14e; position: relative;
}
.folder-icon::before { content: ""; position: absolute; left: 0; top: -5px; width: 14px; height: 7px; border-radius: 3px 3px 0 0; background: #e0a82e; }
.folder-body { display: flex; flex-direction: column; min-width: 0; }
.folder-code { font-size: .72rem; font-weight: 700; color: var(--red); letter-spacing: .3px; }
.folder-title { font-weight: 700; color: var(--navy); line-height: 1.25; }
.folder-meta { font-size: .78rem; color: var(--muted); margin-top: 3px; }
.tag.fm { background: #e3f4ea; color: #1E7A3C; }

.continues {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; align-items: center;
  margin-top: 22px; padding: 14px 16px; border-radius: 10px; background: var(--light); text-decoration: none; color: var(--ink);
}
.continues + .continues { margin-top: 8px; }
.continues b { color: var(--navy); }
.note { margin: 0 0 6px; color: var(--muted); font-style: italic; }
.folder-path { margin: 26px 0 0; font-size: .75rem; color: var(--muted); }
.folder-path code { background: var(--light); padding: 2px 6px; border-radius: 4px; }

.overview { position: sticky; top: 12px; }
.overview details { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.overview summary {
  cursor: pointer; list-style: none; padding: 13px 16px; font-weight: 700; color: #fff; background: var(--navy);
  display: flex; justify-content: space-between; align-items: center;
}
.overview summary::-webkit-details-marker { display: none; }
.overview summary::after { content: "▾"; font-size: .8rem; transition: transform .15s; }
.overview details:not([open]) summary::after { transform: rotate(-90deg); }
.ov-body { max-height: calc(100vh - 110px); overflow-y: auto; padding: 4px 0 8px; }
.ov-term {
  position: sticky; top: 0; z-index: 1; background: #f6f8fc; border-bottom: 1px solid var(--line);
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--navy); padding: 8px 16px;
}
.ov-term i { font-style: normal; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); margin-left: 4px; }
.ov-row { display: flex; gap: 10px; padding: 7px 16px; font-size: .82rem; text-decoration: none; color: var(--ink); border-left: 3px solid transparent; }
a.ov-row:hover { background: var(--light); }
.ov-row.other { color: var(--muted); font-style: italic; }
.ov-row.active { background: #e8eefb; border-left-color: var(--navy); }
.ov-row.now .ov-date::after { content: "Now"; margin-left: 4px; font-style: normal; font-size: .62rem; font-weight: 700; background: var(--red); color: #fff; padding: 1px 5px; border-radius: 999px; }
.ov-date { flex: 0 0 92px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ov-text { flex: 1; min-width: 0; }
.ov-text b { color: var(--navy); }
.ov-text i { color: var(--muted); font-style: normal; font-size: .75rem; white-space: nowrap; }
.ov-note { display: block; margin-top: 3px; font-size: .74rem; font-style: normal; color: var(--red); font-weight: 600; }
.ov-note::before { content: "● "; }
.ov-item { display: block; color: inherit; text-decoration: none; padding: 1px 0; }
a.ov-item:hover { text-decoration: underline; }
.ov-item.other { color: var(--muted); font-style: italic; }
.ov-item.active { font-weight: 600; }
.ov-item + .ov-item { margin-top: 3px; padding-top: 4px; border-top: 1px dashed var(--line); }
.ov-weeks { display: block; margin-top: 2px; }
.ov-tabs { display: flex; gap: 4px; padding: 8px 12px 0; background: var(--navy); }
.ov-tab {
  font: inherit; font-size: .8rem; font-weight: 700; padding: 6px 14px; border: 0; border-radius: 8px 8px 0 0;
  background: rgba(255, 255, 255, .14); color: #dbe4f5; cursor: pointer;
}
.ov-tab.active { background: #f6f8fc; color: var(--navy); }
.ov-empty, .ov-foot { margin: 0; padding: 12px 16px; font-size: .8rem; color: var(--muted); }
.ov-foot { border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .overview { position: static; order: -1; }
  .ov-body { max-height: 60vh; }
}

/* ── Footer ──────────────────────────────────────────── */
.site-footer { margin-top: 48px; padding-top: 22px; padding-bottom: 22px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }
.site-footer a { color: var(--navy); font-weight: 600; }

/* ── Contact / request (the pop-up styles itself: assets/js/contact.js) ── */
.site-nav .nav-contact { font-size: .8rem; font-weight: 600; opacity: .85; border: 1px solid rgba(255, 255, 255, .35); padding: 5px 10px; }
.site-nav .nav-contact:hover { opacity: 1; }

@media print { .site-nav { display: none !important; } }

/* What a scheme follows (MWM.addCourse): on its card and in its page header */
.card .course { font-size: .82rem; font-weight: 600; color: var(--navy); }
.hero .hero-course { display: inline-block; margin: 12px 0 0; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff; font-size: .88rem; font-weight: 600; }
.hero .hero-course + p { margin-top: 8px; }

/* External resources (#/external, data/external-links.js) */
.ext-intro { margin-top: -4px; margin-bottom: 12px; }
.ext-card h3 a { color: inherit; text-decoration: none; }
.ext-card h3 a::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); }   /* whole card clicks through */
.ext-card:hover, .ext-card:has(a:focus-visible) { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.ext-card h3 a:focus-visible { outline: none; }
.ext-card:has(a:focus-visible) { outline: 2px solid var(--navy); outline-offset: 2px; }
.ext-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: auto; padding-top: 8px; font-size: .82rem; }
.ext-host { color: var(--muted); overflow-wrap: anywhere; }
.ext-extra { position: relative; z-index: 1; font-weight: 700; color: var(--navy); }
.ext-logo { display: block; margin-bottom: 4px; }
.ext-logo img { display: block; height: 52px; width: auto; max-width: 160px; object-fit: contain; }
.ext-logo .fp-badge { display: none; width: max-content; padding: 7px 10px; border-radius: 8px; background: linear-gradient(135deg, #7B5CC4, #3FB39B); color: #fff; font-weight: 800; font-size: .76rem; line-height: 1.15; text-align: center; }
.ext-logo.no-logo img { display: none; }
.ext-logo.no-logo .fp-badge { display: block; }

/* Unit link to Mr Gale's site (data/further-practice.js) */
.further-practice { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 12px 16px; background: #fff; border: 2px solid #002060; border-radius: 12px; text-decoration: none; color: #002060; box-shadow: 0 2px 8px rgba(0,32,96,.07); transition: transform .12s, box-shadow .12s; }
.further-practice:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,32,96,.14); }
.further-practice img { height: 64px; width: auto; max-width: 160px; object-fit: contain; flex-shrink: 0; }
.further-practice .fp-badge { display: none; flex-shrink: 0; padding: 8px 10px; border-radius: 8px; background: linear-gradient(135deg, #7B5CC4, #3FB39B); color: #fff; font-weight: 800; font-size: .78rem; line-height: 1.15; text-align: center; }
.further-practice.no-logo img { display: none; }
.further-practice.no-logo .fp-badge { display: block; }
.further-practice .fp-text b { display: block; font-size: 1.02rem; }
.further-practice .fp-text span { display: block; font-size: .85rem; color: #5a6b8c; margin-top: 2px; }
.further-practice.small { margin: 0 0 12px; padding: 8px 12px; gap: 10px; border-width: 1.5px; }
.further-practice.small img { height: 44px; }
.further-practice.small .fp-badge { font-size: .68rem; padding: 6px 8px; }
.further-practice.small .fp-text b { font-size: .9rem; }

/* Sparx & Dr Frost codes (#/codes) */
#codeCourses { margin: 10px 0 6px; }
.codes-count { margin: 8px 0; color: var(--muted); font-size: .88rem; }
.codes-wrap { overflow-x: auto; }
.codes { width: 100%; border-collapse: collapse; font-size: .9rem; }
.codes th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 6px 10px 6px 0; border-bottom: 2px solid var(--line); position: sticky; top: 0; background: #fff; }
.codes td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.codes td:nth-last-child(-n+2) { white-space: nowrap; }
.codes .codes-unit td { padding-top: 14px; font-weight: 800; color: var(--navy); border-bottom: 2px solid var(--line); white-space: normal; }
.codes .codes-unit a { color: var(--navy); }
.codes .codes-course { color: var(--muted); font-weight: 700; }
@media (max-width: 600px) { .codes td:first-child { min-width: 110px; } .codes td:nth-child(2) { min-width: 150px; } }
.codes code { font-size: .82rem; font-weight: 700; color: var(--navy); background: var(--light); padding: 1px 6px; border-radius: 5px; }
.codes .none { color: var(--muted); }
