/* =====================================================================
   Revise Science — rs-core.css
   One source of truth for colour, type, spacing and shape.
   Load on EVERY page, straight after bootstrap.min.css.

   Values are the ones the site already uses most (from the Oct 2026
   audit of the Bootstrap Studio export), so adopting this file should
   change very little visually — it just gives everything one name.
   ===================================================================== */

:root {
  --rs-ink: #25242f;
  --rs-navy: #394362;
  --rs-muted: #696e7f;
  --rs-line: #e0e3e8;
  --rs-line-strong: #d0d4e0;
  --rs-soft: #f5f6fb;
  --rs-surface: #ffffff;
  --rs-chem: #d33c16;
  --rs-chem-accent: #d86712;
  --rs-chem-deep: #a42d12;
  --rs-chem-tint: #ffd6c8;
  --rs-chem-soft: #fff0ec;
  --rs-chem-line: #f2bcb0;
  --rs-bio: #2aa537;
  --rs-bio-deep: #207c29;
  --rs-bio-tint: #d4edd7;
  --rs-bio-soft: #f0f9f1;
  --rs-bio-line: #bbe2bf;
  --rs-bio-accent: #88bf13;
  --rs-phys: #4a2683;
  --rs-phys-deep: #3f206f;
  --rs-phys-tint: #dbd4e6;
  --rs-phys-soft: #f2f0f6;
  --rs-phys-line: #c5bad7;
  --rs-phys-accent: #7a5d9b;
  --rs-subject: var(--rs-chem);
  --rs-subject-deep: var(--rs-chem-deep);
  --rs-subject-soft: var(--rs-chem-soft);
  --rs-subject-line: var(--rs-chem-line);
  --rs-subject-tint: var(--rs-chem-tint);
  --rs-subject-accent: var(--rs-chem-accent);
  --rs-blue: #5ba4cf;
  --rs-blue-soft: #f2f9fd;
  --rs-sky: #52a8ff;
  --rs-amber: #e3a713;
  --rs-yellow-soft: #fffcbd;
  --rs-focus: #185abc;
  --rs-correct: #1b7a3d;
  --rs-correct-soft: #e8f5ec;
  --rs-wrong: #b52b27;
  --rs-wrong-soft: #fdf3f3;
  --rs-font-body: "ABeeZee", system-ui, sans-serif;
  --rs-font-hand: "Kalam", "ABeeZee", sans-serif;
  --rs-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --rs-text-xs: 0.75rem;
  --rs-text-sm: 0.875rem;
  --rs-text-base: 1rem;
  --rs-text-lg: 1.125rem;
  --rs-text-xl: 1.375rem;
  --rs-text-2xl: 1.75rem;
  --rs-text-3xl: 2.25rem;
  --rs-radius-sm: 8px;
  --rs-radius: 12px;
  --rs-radius-pill: 999px;
  --rs-shadow-sm: 0 1px 3px rgb(0 0 0 / 10%);
  --rs-shadow: 0 8px 18px rgb(57 67 98 / 13%);
  --rs-offset: 3px 3px 0 0;
  --rs-space-1: 4px;
  --rs-space-2: 8px;
  --rs-space-3: 12px;
  --rs-space-4: 16px;
  --rs-space-5: 24px;
  --rs-space-6: 32px;
  --bs-body-font-family: var(--rs-font-body);
  --bs-body-color: var(--rs-ink);
  --bs-body-color-rgb: 37, 36, 47;
  --bs-primary: var(--rs-navy);
  --bs-primary-rgb: 57, 67, 98;
  --bs-link-color: var(--rs-ink);
  --bs-link-color-rgb: 37, 36, 47;
  --bs-link-hover-color: var(--rs-chem);
  --bs-link-hover-color-rgb: 211, 62, 22;
  --bs-secondary-color: var(--rs-muted);
  --bs-border-color: var(--rs-line);
  --bs-border-radius: var(--rs-radius-sm);
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: var(--rs-radius);
  --rs-correct-line: #9fd3b3;
  --rs-wrong-line: #d9534f;
  --rs-wrong-fill: #f8d7d6;
  --rs-slate: #64748b;
  --rs-slate-ink: #334155;
  --rs-slate-soft: #e8ecf1;
  --rs-slate-line: #cbd5e1;
  --rs-choice: #0f766e;
  --rs-choice-soft: #e3f4f1;
  --ct-teal: var(--rs-choice);
  --ct-teal-fill: var(--rs-choice-soft);
  --ct-quiet: #5a5e6e;
  --rs-chem-accent-soft: #fdf3ea;
  --rs-bio-accent-soft: #f2f8e4;
  --rs-phys-accent-soft: #f6f4f8;
  --rs-subject-accent-soft: var(--rs-chem-accent-soft);
  --rs-logo-orange: var(--rs-chem-accent);
  --rs-ok: var(--rs-correct);
  --rs-ok-soft: var(--rs-correct-soft);
  --rs-ok-line: var(--rs-correct-line);
  --rs-bad: var(--rs-wrong);
  --rs-bad-soft: var(--rs-wrong-soft);
  --rs-bad-line: var(--rs-wrong-line);
  --rs-bad-fill: var(--rs-wrong-fill);
}

/* Subject flares: put the class on a page's main section (or <body>) */

.rs-subject-chem {
  --rs-subject: var(--rs-chem);
  --rs-subject-deep: var(--rs-chem-deep);
  --rs-subject-tint: var(--rs-chem-tint);
  --rs-subject-soft: var(--rs-chem-soft);
  --rs-subject-line: var(--rs-chem-line);
  --rs-subject-accent: var(--rs-chem-accent);
  --rs-subject-accent-soft: var(--rs-chem-accent-soft);
}

.rs-subject-bio {
  --rs-subject: var(--rs-bio);
  --rs-subject-deep: var(--rs-bio-deep);
  --rs-subject-tint: var(--rs-bio-tint);
  --rs-subject-soft: var(--rs-bio-soft);
  --rs-subject-line: var(--rs-bio-line);
  --rs-subject-accent: var(--rs-bio-accent);
  --rs-subject-accent-soft: var(--rs-bio-accent-soft);
}

.rs-subject-phys {
  --rs-subject: var(--rs-phys);
  --rs-subject-deep: var(--rs-phys-deep);
  --rs-subject-tint: var(--rs-phys-tint);
  --rs-subject-soft: var(--rs-phys-soft);
  --rs-subject-line: var(--rs-phys-line);
  --rs-subject-accent: var(--rs-phys-accent);
  --rs-subject-accent-soft: var(--rs-phys-accent-soft);
}

/* The theme hard-codes square buttons; follow the shared radius instead */

.btn {
  --bs-btn-border-radius: var(--bs-border-radius);
}

.btn-sm {
  --bs-btn-border-radius: var(--bs-border-radius-sm);
}

.btn-lg {
  --bs-btn-border-radius: var(--bs-border-radius-lg);
}

/* Bootstrap bakes colours into .btn-primary, so map them explicitly */

.btn-primary {
  --bs-btn-bg: var(--rs-navy);
  --bs-btn-border-color: var(--rs-navy);
  --bs-btn-hover-bg: var(--rs-ink);
  --bs-btn-hover-border-color: var(--rs-ink);
  --bs-btn-active-bg: var(--rs-ink);
  --bs-btn-active-border-color: var(--rs-ink);
}

.btn-outline-primary {
  --bs-btn-color: var(--rs-navy);
  --bs-btn-border-color: var(--rs-navy);
  --bs-btn-hover-bg: var(--rs-navy);
  --bs-btn-hover-border-color: var(--rs-navy);
  --bs-btn-active-bg: var(--rs-navy);
}

/* ---------- Base ---------- */

body {
  font-family: var(--rs-font-body);
  color: var(--rs-ink);
}

a {
  color: var(--rs-ink);
}

/* was #333 in hyperlinks.css */

a:hover {
  color: var(--rs-chem);
}

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

/* ---------- Callout cards (replaces Pages/cards.css) ---------- */

.card.chem.did-you-know {
  background: #fff;
  box-shadow: var(--rs-offset) var(--rs-sky) !important;
  border: 1.5px solid #a9d0fb !important;
  overflow: hidden;
  --rs-callout-tint: #cee6ff;
  --rs-callout-emoji: "💡";
}

.card.chem.why-do-we-care {
  background: #fff;
  box-shadow: var(--rs-offset) var(--rs-amber) !important;
  border: 1.5px solid #efcf7c !important;
  overflow: hidden;
  --rs-callout-tint: #ffeec4;
  --rs-callout-emoji: "🌍";
}

.card.chem.key-info {
  background: #fff;
  box-shadow: var(--rs-offset) var(--rs-chem) !important;
  border: 1.5px solid #f0a98f !important;
  overflow: hidden;
  --rs-callout-tint: #ffeadd;
  --rs-callout-emoji: "🔑";
}

.card.thank-you-support {
  background: var(--rs-yellow-soft);
  box-shadow: var(--rs-offset) #070707 !important;
  border: none;
}

/* Signature cards stay square, whatever the site radius */

.card.did-you-know, .card.why-do-we-care, .card.key-info, .card.thank-you-support {
  --bs-card-border-radius: 10px;
  --bs-card-inner-border-radius: 9px;
  border-radius: 10px;
}

/* 28 Nov (C4): the heading sits in a tinted strip with its emoji; the body is white */

.card.chem.did-you-know > .card-body, .card.chem.why-do-we-care > .card-body, .card.chem.key-info > .card-body {
  padding: 0 0 4px !important;
}

.card.chem.did-you-know .card-title, .card.chem.why-do-we-care .card-title, .card.chem.key-info .card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px !important;
  padding: 12px 16px;
  background: var(--rs-callout-tint);
}

.card.chem.did-you-know .card-title::before, .card.chem.why-do-we-care .card-title::before, .card.chem.key-info .card-title::before {
  content: var(--rs-callout-emoji);
  font-size: 0.95em;
  line-height: 1;
}

.card.chem.did-you-know .card-body > :not(.card-title), .card.chem.why-do-we-care .card-body > :not(.card-title), .card.chem.key-info .card-body > :not(.card-title) {
  margin-left: 16px;
  margin-right: 16px;
}

.card.chem.did-you-know .card-body > ul, .card.chem.why-do-we-care .card-body > ul, .card.chem.key-info .card-body > ul {
  padding-left: 20px;
}

/* ---------- Underline pill (replaces Pages/underline.css) ---------- */

.underline {
  position: relative;
  display: inline-block;
  padding-bottom: 6px;
  line-height: 1.1;
  isolation: isolate;
}

.underline::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 6px;
  background: var(--rs-sky);
  border-radius: 6px;
}

/* ---------- Key-word tooltips ----------
   Replaces the 60-page inline block. The old one targeted Bootstrap 4
   selectors (.arrow, x-placement) that do nothing in Bootstrap 5. */

.tooltip-word {
  cursor: pointer;
  font-weight: bold;
  display: inline-block;
  white-space: nowrap;
  color: inherit;
  font-family: inherit;
}

.tooltip {
  --bs-tooltip-bg: var(--rs-ink);
  --bs-tooltip-color: #fff;
  --bs-tooltip-opacity: 1;
  --bs-tooltip-max-width: 300px;
  font-family: var(--rs-font-body);
}

.tooltip-inner {
  white-space: normal;
  overflow-wrap: break-word;
}

.rs-hidden {
  display: none !important;
}

/* ---------- Legacy pages: room for the fixed modern navbar ----------
   Add the class rs-nav-spacer to the legacy navbar's outer <nav>. */

.rs-nav-spacer {
  min-height: 76px;
}

@media (max-width: 1199.98px) {
  .rs-nav-spacer {
    min-height: 68px;
  }
}

span.tooltip-word {
  display: inline;
}

/* =====================================================================
   Beyond notes open on demand (30 Nov 2026; the owner's choice B. Replaces the 12 Nov / 21 Nov
   "Beyond most courses notes" block.)
   Owner: "all 'beyond most courses' should have a little bit of visible text, but then have a button to
   'open' the card, and have most of it collapsed." Review answer C1: "B is best".
   The look is unchanged: slate-grey 2px dashed outline, white background, grey pill (colour decisions, point 10).
   The script at the end of rs-page.js (v1.7) finds every note by class and adds:
     .rs-bx and data-bx="closed" | "open" | "plain" on a note that folds; data-bx-short on a short note that stays open;
     data-bx-plain where the course filter hides the note's pill (C5: the note is then ordinary text, no outline, no button);
     .rs-bx-lead on the opening text blocks, .rs-bx-x on every other part (hidden while closed);
     while closed, .rs-bx-cut and span.rs-bx-rest round the words after the preview lines, and .rs-bx-fade on the
     block whose last line fades; one button.rs-bx-btn at the end of the note.
   Hiding is for screens only: printed pages show every note in full, with no button and no fade.
   ===================================================================== */

.rs-note.rs-note--extra {
  margin: 16px 0 20px;
  padding: 10px 14px 12px !important;
  border: 2px dashed var(--rs-slate,#64748b) !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: var(--rs-ink, #25242f);
}

.rs-note.rs-note--extra .rs-note-title {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0 0 4px !important;
  color: var(--rs-slate-ink,#334155) !important;
  font-weight: 800;
}

/* a title row filtered out for this course stays hidden (the flex rule above would otherwise win over .rs-hidden) */

.rs-note.rs-note--extra > .rs-note-title.rs-hidden {
  display: none !important;
}

.rs-tag-beyond {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--rs-slate-soft,#e8ecf1);
  color: var(--rs-slate-ink,#334155);
  font-size: 0.78em;
  font-weight: 800;
  line-height: 1.5;
  white-space: nowrap;
  border: 1px solid var(--rs-slate-line,#cbd5e1);
}

/* "Beyond your course" (board-specific): the same look, only while its pill line shows */

.rs-beyond-yours:has( > .rs-beyond-yours-tag:not(.rs-hidden)) {
  margin: 16px 0 20px;
  padding: 10px 14px 12px;
  border: 2px dashed var(--rs-slate,#64748b);
  border-radius: 8px;
  background: #fff;
}

.rs-beyond-yours > .rs-beyond-yours-tag {
  margin: 0 0 6px;
  line-height: 1.2;
}

.rs-beyond-yours-title {
  margin: 12px 0 4px;
  font-weight: 800;
  color: var(--rs-slate-ink,#334155);
}

.rs-beyond-yours > .rs-beyond-yours-tag + .rs-beyond-yours-title {
  margin-top: 0;
}

.rs-beyond-yours > :last-child {
  margin-bottom: 0;
}

/* C5: where the course filter hides a "Beyond most courses" note's pill (the course includes it), the note is ordinary
   text: no outline, no box, ordinary paragraph spacing (the :has() lines cover the moment before the script runs) */

.rs-note.rs-note--extra[data-bx-plain], .rs-note.rs-note--extra:has( > .rs-note-title.rs-hidden), .rs-note.rs-note--extra:has( > .rs-note-title > .rs-tag-beyond.rs-hidden) {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  line-height: inherit;
}

.rs-page .rs-note.rs-note--extra[data-bx-plain] > p {
  margin: 0 0 1rem;
}

/* closed: the title row and pill, the preview lines with the last one faded, then the button (screens only) */

@media screen {
  .rs-bx[data-bx="closed"] > .rs-bx-x, .rs-bx[data-bx="closed"] .rs-bx-cut, .rs-bx[data-bx="closed"] .rs-bx-rest {
    display: none !important;
  }
}

@media screen {
  .rs-bx[data-bx="closed"]:not([data-bx-cut]) > .rs-bx-lead ~ .rs-bx-lead {
    display: none !important;
  }
}

@media screen {
  .rs-bx[data-bx="closed"]:not([data-bx-cut]) > .rs-bx-lead {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
  }
}

@media screen {
  .rs-bx[data-bx="closed"] .rs-bx-fade {
    position: relative;
    margin-bottom: 0 !important;
  }
}

@media screen {
  .rs-bx[data-bx="closed"] .rs-bx-fade::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--rs-bx-lh, 1.6em);
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.35));
    pointer-events: none;
  }
}

/* the button: the site's quiet outline pill (as "Show the numbers" on Equilibrium), navy words, a chevron */

.rs-bx-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  margin: 6px 0 0;
  padding: 4px 14px 4px 12px;
  border: 1px solid #c9ccd6;
  border-radius: 999px;
  background: #fff;
  color: var(--rs-navy,#394362);
  font: inherit;
  font-size: 0.95em;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.rs-bx-btn::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin: -3px 2px 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.rs-bx[data-bx="open"] > .rs-bx-btn::before {
  margin-top: 4px;
  transform: rotate(-135deg);
}

.rs-bx-btn:hover {
  background: #f1f3f9;
}

.rs-bx-btn:focus-visible {
  outline: 3px solid #5ba4cf;
  outline-offset: 2px;
}

.rs-bx-btn[hidden], .rs-bx[data-bx="plain"] > .rs-bx-btn {
  display: none;
}

.rs-bx-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* opening fades the new text in; nothing slides; no motion at all with reduced motion */

.rs-bx.rs-bx-anim > .rs-bx-x {
  animation: rs-bx-in 0.2s ease-out;
}

@keyframes rs-bx-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rs-bx.rs-bx-anim > .rs-bx-x {
    animation: none;
  }
}

@media print {
  .rs-bx-btn {
    display: none !important;
  }
}

/* =====================================================================
   "Where next" link notes (12 Nov 2026)
   <div class="rs-note rs-note--info rs-next">
     <p>Optional sentence linking back to what was just read.</p>
     <p class="rs-next-row"><a class="sol-link-button" href="…">Page →</a><span>What you can do there.</span></p>
   </div>
   One row per link: the button, then a short line saying what the page
   gives you. The lines line up in a second column; on phones each line
   sits under its button.
   ===================================================================== */

.rs-note.rs-next {
  display: grid;
  grid-template-columns: fit-content(46%) minmax(0, 1fr);
  align-items: center;
  gap: 8px 14px;
}

.rs-note.rs-next > p {
  margin: 0 !important;
}

.rs-note.rs-next > p:not(.rs-next-row) {
  grid-column: 1 / -1;
}

.rs-note.rs-next .rs-next-row {
  display: contents;
}

.rs-note.rs-next .rs-next-row > .sol-link-button {
  justify-self: start;
  max-width: 100%;
  margin: 0 !important;
  white-space: normal;
}

.rs-note.rs-next .rs-next-row > span {
  min-width: 0;
  line-height: 1.45;
}

@media (max-width: 575.98px) {
  .rs-note.rs-next {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}

@media (max-width: 575.98px) {
  .rs-note.rs-next .rs-next-row > span {
    margin-bottom: 8px;
  }
}

@media (max-width: 575.98px) {
  .rs-note.rs-next .rs-next-row:last-child > span {
    margin-bottom: 0;
  }
}

/* =====================================================================
   Pages that are not part of the chosen course (12 Nov 2026)
   When the course selector shows "… is not part of …" (#rs-page-unavailable-notice),
   the page's revision content is hidden, so its side cards go too.
   ===================================================================== */

body:has(#rs-page-unavailable-notice:not([hidden])) .card.chem.did-you-know, body:has(#rs-page-unavailable-notice:not([hidden])) .card.chem.why-do-we-care, body:has(#rs-page-unavailable-notice:not([hidden])) .card.chem.key-info {
  display: none !important;
}

@media (min-width: 992px) {
  body:has(#rs-page-unavailable-notice:not([hidden])) .col:has( > .rs-topicbox) {
    display: flex;
    flex-direction: column;
  }
}

@media (min-width: 992px) {
  body:has(#rs-page-unavailable-notice:not([hidden])) .col > .rs-topicbox {
    flex: 1 1 auto;
  }
}

/* Colour system (21 Nov 2026, colour-plan.md): key notes outside a .rs-page section (the rates practical pages) follow the same look */

.rs-note.rs-note--key {
  border-left: 6px solid var(--rs-subject-accent,#d86712) !important;
  background: var(--rs-subject-accent-soft,#fdf3ea) !important;
}

/* Release 22c (21 Nov 2026, notes): the five information-note looks (Matthew: "I thought we standardised the information notes?").
   key note = the subject accent bar on its tint; where-next / link = blue (.rs-note--info); Beyond = slate dashed + grey pill;
   safety = amber, the risk line only (.rs-note--safety); interactive explanation = a navy edge on pale grey (.ct-obs).
   Page-own boxes that drew their own look are mapped here by class; !important because their rules sit under an #id. */

.rs-note.rs-note--safety {
  border-left: 4px solid #ffc107 !important;
  border-radius: 0 8px 8px 0;
  background: #fff3cd !important;
  color: #6b4e00 !important;
}

.rs-note.rs-note--info {
  border-left: 4px solid #3478a4 !important;
  background: #f2f9fd !important;
}

.rs-page :is(.dif-observation, .dis-observation, .cry-observation, .fil-observation, .mix-explorer-explanation, .sol-stage-info, .mb-state-result, .som-instruction, .som-particle-explanation, .som-limit-explanation) {
  border-color: #e0e3e8 !important;
  border-left: 4px solid var(--rs-navy,#394362) !important;
  background: #f5f6fb !important;
}

.rs-page :is(.mm-form, .sf-rule, .sol-aqueous-note, .mix-impure-note, .cf-pair-rule, .sol-extension-intro) {
  border-color: transparent !important;
  border-left: 6px solid var(--rs-subject-accent,#d86712) !important;
  background: var(--rs-subject-accent-soft,#fdf3ea) !important;
}

.rs-skip-lbl {
  display: block;
  text-align: center;
  line-height: 1.25;
}

span.tooltip-word {
  white-space: normal;
}

/* 28mf: topic-page grid columns hidden by the course filter stay hidden (d-flex would show them) */

.rs-tile-filter[hidden], .rs-tile-filter[style*="display: none"], .rs-tile-filter:has( > .btn[hidden]) {
  display: none !important;
}

/* 28sx: Structure explorer form chooser keeps its space when hidden */

.sx-pic > .sx-formslot[hidden] {
  display: flex !important;
  visibility: hidden;
  min-height: 68px;
}

.rs-note.rs-note--recap {
  border-left-color: #2a8a7a!important;
  background: #f2faf8!important;
}

.rs-tag-recap {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 9px;
  border-radius: 999px;
  background: #d6efe9;
  color: #1d6b5f;
  font-size: .78em;
  font-weight: 800;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: 1px;
}

