/* btl.education: the visual system (audit round 3, Parts D, E and F, 29 October 2026).
   Loaded last, after site.css, live.css, features.css and kh.css, so these are the rules that win. It brings the
   components onto one set of sizes, radii, gutters and states, and fixes the page-level alignment. Colours still come
   only from the tokens in features.css, so every rule works in each theme and page colour. */

/* --- tokens ------------------------------------------------------------------------------------------------------- */
:root {
  --radius: 4px;        /* cards and inputs */
  --radius-sm: 4px;
  --radius-btn: 6px;    /* buttons and chips */
  --gutter-grid: 24px;  /* card grids */
  --gutter-split: 48px; /* two-column splits */
  --pad-card: 24px;
  --pad-card-sm: 20px;
  --outline: var(--btn-line);  /* every outlined button and chip */
}
.aud-students { --s-radius: 12px; }  /* the students page keeps one documented variant: 12px corners, one sticker shadow */

/* --- type: one scale -------------------------------------------------------------------------------------------- */
main h1 { font-size: clamp(34px, 4.6vw, 62px); }
.hero-home h1 { font-size: clamp(34px, 4vw, 54px); }  /* the home exception: a long line, at 54 */
main .section-head h2, main .section > .wrap > h2, main .up-head h2 { font-size: clamp(28px, 3vw, 42px); }
main :is(.card, .who-card, .vid figcaption, .s-text, .services-card, .live-card, .plan) h3 { font-size: 24px; }
.vid :is(h2, h3) { font-size: 24px; }
@media (max-width: 760px) {
  main h2 { font-size: 28px; line-height: 32px; }
  main h3 { font-size: 22px; line-height: 28px; }
  main :is(.card, .who-card, .vid figcaption, .s-text, .services-card, .live-card, .plan) h3, .vid :is(h2, h3) { font-size: 20px; line-height: 26px; }
}
/* no 600 font file is loaded */
.kh-top-az, .cpd-tag, .contact-social a { font-weight: 700; }
/* all-caps labels */
:is(.who-role, .up-badge, .cpd-tag-k, .eyebrow, .kh-eyebrow, .s-tag) { letter-spacing: .06em; }
/* The Caladea figures stay sitewide: James asked for no slashed zero anywhere (28 October), so audit item D "figures only
   in prices" is not applied; see the live-update note. */
/* orphans */
:is(h3, h4, .lede, .tagline, .btn, .kh-card h3, .card h3, .vcard b, .s-body b) { text-wrap: balance; }
main p { text-wrap: pretty; }

/* --- headings that wrap a link look like headings (R4) ----------------------------------------------------------- */
:is(h1, h2, h3, h4) > a, :is(h1, h2, h3, h4) > a:visited { font-weight: inherit; color: inherit; text-decoration: none; }
:is(h1, h2, h3, h4) > a:hover, :is(h1, h2, h3, h4) > a:focus-visible { color: var(--violet); text-decoration: underline; text-decoration-thickness: 2px; }

/* --- spacing ---------------------------------------------------------------------------------------------------- */
main :is(h2) + :is(p, ul, ol, dl) { margin-top: 16px; }
main :is(h3) + :is(p, ul, ol, dl) { margin-top: 8px; }
main .grid { gap: var(--gutter-grid); }
main .split-media, .who { gap: var(--gutter-split); }
main .card > .body, main .card.services-card .body, .live-card .body { padding: var(--pad-card); }
.door-picks { gap: var(--gutter-grid); }
.levels { gap: var(--gutter-grid); }
/* prose measure */
main :is(.section, .page-head, .kh-body, .policy-body) p { max-width: 68ch; }
main :is(.card, .who-card, .s-text, .vcard, .pack-pick, .exam, .door-pick, .live-row, .s-card, .kh-card) p { max-width: none; }

/* --- one left edge (R2): page heads line up with the sections, and narrow sections start at the same edge --------- */
.page-head > .wrap, .hero > .wrap { padding-left: 38px; }  /* 2px rule + 38 = text at the sections' 40px gutter */
@media (max-width: 760px) { .page-head > .wrap, .hero > .wrap { padding-left: 18px; } }
main .wrap.narrow { max-width: var(--max); }
main .wrap.narrow > :not(.grid):not(.table-wrap):not(.who-cards):not(.vid) { max-width: 760px; }
main .wrap.narrow > .table-wrap { max-width: 860px; }

/* --- buttons: primary, secondary, text; sm 40 and md 48 ----------------------------------------------------------- */
.btn { min-height: 48px; }
.btn-sm { min-height: 40px; }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 17px; }
.btn-secondary { border-color: var(--outline); }
.consent-actions .btn { min-height: 40px; padding: 4px 16px; }

/* --- one chip: 40px, radius 6, one selected state ----------------------------------------------------------------- */
:is(.jump a, .su-nav a, .gl-groups button, .kh-quick a, .s-chips a, .kh-filter .seg button) {
  min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: var(--radius-btn);
  border: 1px solid var(--outline); background: var(--paper); color: var(--ink); font-weight: 700; font-size: 15px; box-shadow: none; }
:is(.jump a, .su-nav a, .gl-groups button, .kh-quick a, .s-chips a):hover { border-color: var(--violet); color: var(--violet); }
:is(.jump a[aria-current], .su-nav a[aria-current], .gl-groups button[aria-pressed="true"], .kh-filter .seg button[aria-pressed="true"]) {
  background: var(--violet-soft); border-color: var(--violet); color: var(--violet); box-shadow: none; }
.su-nav a.su-nav-cta { background: var(--violet); border-color: var(--violet); color: var(--on-violet, #fff); }
.su-nav { flex-wrap: wrap; gap: 6px; max-width: 100%; }
@media (min-width: 768px) { .su-nav { overflow: visible; } }

/* --- header tools: search, display and basket alike --------------------------------------------------------------- */
.tool-btn, .site-header .basket-link { border: 1px solid var(--outline); border-radius: var(--radius-btn); min-height: 44px; background: var(--paper); }
.site-header .basket-link:hover, .site-header .basket-link:focus-visible { border-color: var(--violet); }
.aud-students .site-header .basket-slot { border-color: transparent; background: none; }
/* the nav's lilac pill means "you are here" and nothing else; hover changes the colour and underlines */
.nav a:hover { background: none; color: var(--violet); text-decoration: underline; text-underline-offset: 6px; }
.nav a[aria-current]:hover { background: var(--violet-soft); text-decoration: none; }
.mobile-nav nav a { padding-left: 0; padding-right: 0; }

/* --- accordions: two patterns ------------------------------------------------------------------------------------- */
/* 1. a row with the +/− at the right, the glyph in a fixed 16px box so + and − don't move */
:is(.qa, .faq) details > summary, .kh-faq-item > summary, .sequence > summary, .all-packs > summary, .qa-item > summary, .included > summary,
.ra-buy > summary, .s-poems > summary, .kh-transcript > summary, .vid details > summary {
  display: flex; align-items: center; gap: 12px; list-style: none; cursor: pointer; }
:is(.qa, .faq) details > summary::-webkit-details-marker, .kh-faq-item > summary::-webkit-details-marker, .sequence > summary::-webkit-details-marker,
.all-packs > summary::-webkit-details-marker, .qa-item > summary::-webkit-details-marker, .included > summary::-webkit-details-marker,
.ra-buy > summary::-webkit-details-marker, .s-poems > summary::-webkit-details-marker, .kh-transcript > summary::-webkit-details-marker,
.vid details > summary::-webkit-details-marker { display: none; }
:is(.qa, .faq) details > summary::after, .kh-faq-item > summary::after, .sequence > summary::after, .all-packs > summary::after, .qa-item > summary::after,
.included > summary::after, .ra-buy > summary::after, .s-poems > summary::after, .kh-transcript > summary::after, .vid details > summary::after {
  content: "+"; flex: none; width: 16px; height: auto; margin-left: auto; text-align: center; font: 700 22px/1 "Atkinson Hyperlegible", sans-serif;
  color: var(--violet); background: none; border: 0; border-radius: 0; display: block; }
:is(.qa, .faq) details[open] > summary::after, .kh-faq-item[open] > summary::after, .sequence[open] > summary::after, .all-packs[open] > summary::after,
.qa-item[open] > summary::after, .included[open] > summary::after, .ra-buy[open] > summary::after, .s-poems[open] > summary::after,
.kh-transcript[open] > summary::after, .vid details[open] > summary::after { content: "\2212"; }
.sequence > summary h3::after { content: none; }
.sequence > summary h3 { flex: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; }
.sequence > summary h3 span { white-space: nowrap; }
/* 2. the bordered card disclosure: .sequence, .all-packs and .included already are; one radius */
:is(.sequence, .all-packs, .included, .qa-item, .kh-transcript) { border-radius: var(--radius); }

/* --- links: prose regular and underlined, interface bold ------------------------------------------------------------ */
:is(.kh-body, .policy-body, .prose) :is(p, li, dd) > a:not(.btn), :is(.gl-def, .gl-example) a { font-weight: 400; text-decoration: underline; text-underline-offset: 2px; }
.gl-entry h3 a, .gl-see a { font-weight: 700; }

/* --- one card hover ----------------------------------------------------------------------------------------------- */
:is(.door-pick, .kh-card, .s-card, .vcard, .s-text) { border: 1px solid var(--line); transition: border-color .15s ease; }
:is(.door-pick, .kh-card, .s-card, .vcard):hover, :is(.door-pick, .kh-card, .s-card, .vcard):focus-visible { border-color: var(--violet); box-shadow: none; transform: none; }
:is(.door-pick, .kh-card, .s-card, .vcard):hover :is(b, h3) { color: var(--violet); }

/* --- radii -------------------------------------------------------------------------------------------------------- */
:is(.mark-card, .pack-pick, .all-packs, .card, .who-card, .vcard, .vid, .kh-card, .services-card) { border-radius: var(--radius); }
.aud-students :is(.s-card, .s-text, .s-group, .paper-tabs [role=tab], figure.vid) { border-radius: var(--s-radius); }
.aud-students .paper-tabs [role=tab] { box-shadow: none; }
.aud-students .paper-tabs [role=tab]:hover { transform: none; box-shadow: none; border-color: var(--violet); }
.aud-students .paper-tabs [role=tab][aria-selected=true] { box-shadow: 3px 3px 0 var(--highlight); }

/* --- colours: the strays ------------------------------------------------------------------------------------------- */
.cpd-tag { color: var(--mark-fg); }
.cpd-tag .cpd-tag-k { background: var(--mark-fg); color: var(--cream); }
.cpd-card { box-shadow: none; border: 1px solid var(--line-strong); }
.trust-example { background: var(--lilac); }
.free .card .thumb, .grid.free .thumb { background: var(--lilac); }
.kh-video-play { color: var(--violet); }
.kh-video-icon svg rect, .kh-video-icon svg path:first-child { fill: currentColor; }
.who-card-pic img[alt="The Granary Digital website"] { background: var(--paper); }
.site-footer :is(hr, .legal, .policies) { border-color: rgba(255, 255, 255, .14); }

/* --- shadows: shadow-1, shadow-2, page-shadow and the focus ring --------------------------------------------------- */
.kh-frame, .kh-row-pic, .mark-express-pic { box-shadow: none; border: 1px solid var(--line); }
.pick { box-shadow: 4px 4px 0 var(--highlight); }

/* --- home (Part E) ------------------------------------------------------------------------------------------------ */
#levels figure.loop.loop-wide-only { margin-left: 0; margin-right: auto; max-width: 860px; }
@media (min-width: 1024px) {
  .proof { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 12px var(--gutter-grid); }
}
.proof li { align-items: flex-start; }
.proof .ic { margin-top: 2px; flex: none; }

/* --- students ----------------------------------------------------------------------------------------------------- */
.aud-students .paper-panel { max-width: none; }
.aud-students .paper-panel figure.vid { max-width: none; }

/* --- parents: the pack cards line up ------------------------------------------------------------------------------- */
.pack-pick .pack-cover img, .pack-cover img { width: 96px; min-width: 96px; height: auto; }
.pack-pick { align-items: stretch; }
.pack-pick .body { display: flex; flex-direction: column; min-width: 0; height: 100%; }
.pack-pick .actions { margin-top: auto; padding-top: 12px; }
.aud-parents :is(.card, .pack-pick, .all-packs), .marks .mark-card { border-radius: var(--radius); }
.parent-steps .step-n, .pack-questions .step-n { background: var(--aubergine); color: var(--cream); }

/* --- /free/: four across from 1100px, no lone last card ------------------------------------------------------------ */
@media (min-width: 1100px) { .page-free .grid.free, body:has(.free-index) .grid.free { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* --- Lesson 3 and drill pickers ------------------------------------------------------------------------------------ */
.pick-previews { display: grid; gap: 24px; margin-top: 32px; }
.pick-preview + .pick-preview { border-top: 1px solid var(--line); padding-top: 24px; }
.pick-preview[hidden] + .pick-preview { border-top: 0; padding-top: 0; }
.sampler-card { max-width: 760px; }

/* --- Knowledge hub article ----------------------------------------------------------------------------------------- */
.kh-article > .kh-head { position: relative; background: none; }
.kh-article > .kh-head::before, .policy > .policy-head::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: calc(50% - 50vw); width: 100vw; z-index: -1;
  background-image: linear-gradient(to bottom, transparent 24px, var(--rule) 24px, var(--rule) 25px, transparent 25px), linear-gradient(rgba(110, 68, 168, .45), rgba(110, 68, 168, .45));
  background-size: 100% 32px, 2px 100%; background-repeat: repeat, no-repeat; background-position: 0 0, max(4px, calc(50% - 374px)) 0; }
.policy > .policy-head { position: relative; background: none; }
.kh-article, .policy { position: relative; z-index: 0; overflow-x: clip; }
.kh-body ul.kh-stats { margin-left: 0; padding-left: 0; }
.kh-video-len, .kh-meta time { white-space: nowrap; }
@media (max-width: 560px) { .kh-staves, .kh-stave-grid { grid-template-columns: minmax(0, 1fr); } }

/* --- scheme pages ------------------------------------------------------------------------------------------------- */
:is(.chooser, .pricing, .vid-one, .sampler-card) { max-width: 860px; }
.sampler-card select, [data-picker] select { min-width: 14rem; }

/* --- video pages: the player at the page width, the transcript in a reading column beside a sticky chapter list --- */
.watch .vid { max-width: 1120px; }
@media (min-width: 1000px) {
  .watch-body { max-width: 1120px; grid-template-columns: minmax(0, 700px) minmax(0, 1fr); align-items: start; column-gap: 48px; }
  .watch-body > .lede { grid-column: 1 / -1; }
  .watch-body > .chap { grid-column: 2; grid-row: 2 / span 2; position: sticky; top: 96px; }
  .watch-body > .transcript { grid-column: 1; grid-row: 2; }
  .watch-body .chap ol.chapters { columns: 1; }
}

/* --- basket ------------------------------------------------------------------------------------------------------- */
.invoice-order { max-width: none; }
.bline-fields legend { float: left; width: 100%; margin-bottom: 12px; padding: 0; }
.bline-fields legend + * { clear: both; }
.basket-empty + p, .basket-empty .actions + p { margin-top: 24px; }

/* --- legal: tables stack as label and value below 600px ------------------------------------------------------------ */
@media (max-width: 600px) {
  .policy-body table, .policy-body thead, .policy-body tbody, .policy-body tr, .policy-body th, .policy-body td { display: block; width: 100%; }
  .policy-body thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .policy-body tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .policy-body td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; color: var(--aubergine); }
  .policy-body .table-wrap { overflow: visible; }
}
.policy-head h1 { font-size: clamp(34px, 4.6vw, 62px); }

/* --- sitewide details (Part F) ------------------------------------------------------------------------------------ */
.site-footer .footer-logo { padding-top: 4px; }
.search-dialog input[type="search"] { background: var(--paper); }
.search-dialog input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; cursor: pointer;
  background: linear-gradient(45deg, transparent 45%, var(--mid) 45%, var(--mid) 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, var(--mid) 45%, var(--mid) 55%, transparent 55%); }
.search-close { min-height: 48px; }
/* one loop toggle: a round paper button with a border, top right, in every theme */
.loop-toggle { width: 40px; height: 40px; border-radius: 50%; background: var(--paper); color: var(--ink); border: 1px solid var(--outline); opacity: 1; right: 12px; top: 12px; bottom: auto; }
/* one back to top: the round icon button at the bottom right, clear of the text on phones */
@media (max-width: 760px) { main { padding-bottom: 72px; } }
.has-chat .to-top { left: auto; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }

/* --- the ruled head on phones (R1): the rules sit behind the heading only, at the heading's own 40px leading --------- */
@media (max-width: 760px) {
  .page-head, .hero, .kh-head, .policy-head, .kh-article > .kh-head::before, .policy > .policy-head::before {
    background-image: linear-gradient(rgba(110, 68, 168, .45), rgba(110, 68, 168, .45)); background-size: 2px 100%; background-repeat: no-repeat;
    background-position: max(4px, calc(50% - 374px)) 0; }
  .page-head, .hero { background-image: none; }
  :is(.page-head, .hero, .kh-head, .policy-head) h1 { font-size: 34px; line-height: 40px;
    background-image: linear-gradient(to bottom, transparent 31px, var(--rule) 31px, var(--rule) 32px, transparent 32px); background-size: 100% 40px; }
  :is(.page-head, .hero, .kh-head, .policy-head) :is(p, li, .crumbs, .kind, .lede, .facts, dd, dt) { line-height: 1.5; }
  :is(.page-head, .hero, .kh-head, .policy-head) :is(.small, .reform-line, .crumbs) { line-height: 24px; }
  :is(.page-head, .hero, .kh-head, .policy-head) :is(h1, p, li, .crumbs, dt, dd) { top: 0 !important; }
}

/* --- reduced motion ----------------------------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) { .dl-progress::after { animation: none !important; } }

/* --- accessibility details (Part G) ------------------------------------------------------------------------------- */
.h3-size { font-size: 24px; line-height: 1.25; margin: 0; }
@media (max-width: 600px) {
  .buy-select { flex-direction: column; align-items: stretch; width: 100%; }
  .buy-select select, .buy-select .btn { width: 100%; max-width: none; }
}
.gl-see a, .su-links a, .s-chips a { display: inline-block; min-height: 24px; padding: 2px 0; }
main:focus { outline: none; }
/* the basket keeps its space while the Shopify cart loads (it shifted the page by 0.053 on phones) */
#basket.basket { min-height: 360px; }
/* the 404 page on the page-head template, its search field and button alike */
.search-inline input { border-radius: var(--radius-btn); }
.nf-links h2 { font-size: 28px; }
/* /free/: four across from 1100px, so seven resources read 4 + 3, not 3 + 3 + 1 */
@media (min-width: 1100px) { main .grid.grid-3.free:has(> :nth-child(7):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* the viewer keeps its zoom readout on phones */
.vhead #zoom-level { display: inline; min-width: 3.2em; text-align: center; font-size: 14px; }

/* positioning round (30 October 2026): the paper line, the three points, the Oak and cost tables */
.door-paper { margin: 8px 0 0; font-weight: 600; color: var(--ink); }
.door-prices + .door-paper + .door-trusts { margin-top: 8px; }
.why-points .why-point h3 { margin: 0 0 8px; }
.why-points .why-point p { margin: 0; }
.why-sources { margin-top: 24px; max-width: 68ch; }
.compare-table { width: 100%; border-collapse: collapse; }
.compare-table th, .compare-table td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.compare-table thead th { font-weight: 700; }
.compare-table tbody th { font-weight: 600; }
.compare-table td.num { text-align: right; white-space: nowrap; font-weight: 700; }
.cost-block { padding-top: 0; }
.cost-block h2 { margin: 0 0 16px; }
.cost-block p { max-width: 68ch; }
@media (max-width: 600px) {
  .compare-table, .compare-table tbody, .compare-table tr, .compare-table th, .compare-table td { display: block; width: 100%; }
  .compare-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .compare-table tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .compare-table th, .compare-table td { border: 0; padding: 4px 0; }
  .compare-table td.num { text-align: left; }
  .compare-table td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; }
}

/* CPD tag (30 October 2026): the label keeps its own colours in both modes (it sits on the yellow pill), and the row is
   not held to the prose width, so the pill stays on one line wherever there is room */
main .page-head p.cpd-tag-row { max-width: none; }
.cpd-tag .cpd-tag-k { background: #2B1631; color: #FFF6D9; white-space: nowrap; }
.cpd-tag, .cpd-tag:hover, .cpd-tag:focus-visible { color: #2B1631; }
@media (max-width: 520px) { .cpd-tag { padding-bottom: 8px; } .cpd-tag > span:last-child { padding-left: 8px; } }

/* /books/<title>/ (31 October 2026): the page a revision book's QR code opens, in the students' look */
.book-kicker { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; font-weight: 700; color: var(--violet); }
.book-kicker .ic { width: 24px; height: 24px; }
.book-items { display: grid; gap: 8px; max-width: 860px; }
.book-items > .kh-video { margin: 0 0 24px; }
.book-shorts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin-top: 8px; width: min(100%, 1100px); }
.book-items:has(.book-shorts) { max-width: none; }
.book-items > .kh-video, .book-items > .book-site-video { max-width: 860px; }
.book-shorts .kh-video { margin: 0; }
.kh-short .kh-video-frame { aspect-ratio: 9 / 16; max-width: 320px; }
.kh-short .kh-video-icon { width: 60px; height: 42px; }
.book-site-video { margin: 0 0 24px; }
.book-foot .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.book-more ul { margin: 0 0 16px; padding-left: 20px; }
.book-more li { margin: 6px 0; }
.book-parents { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); padding: 24px; }
.book-parents h2 { margin-top: 0; }
.book-parent-videos { display: grid; gap: 16px; margin: 16px 0; }
@media (max-width: 760px) { .book-foot .wrap { grid-template-columns: minmax(0, 1fr); } .book-shorts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
