/* Fixwise styles.
   All colours are custom properties, so light and dark themes share one set of rules.
   Palette: calm slate and teal for easy reading, amber for brand accents and warnings.
   Variable names are kept from the earlier palette: --accent-cyan is the teal,
   --accent-yellow is the amber. Rename them later if you prefer. */

:root {
  --bg: #0f172a;
  /* Header and footer bars: close to the body colour, with a very subtle green gradient (no blue).
     The gradient runs left to right so the brand row and category row join without a seam. */
  --chrome: linear-gradient(90deg, #0f3b3a 0%, #0f3b3a 78%, #14554a 100%);
  --footer-bg: #0f1b2b; /* solid footer colour (no gradient) */
  --surface: #1e293b;
  --table-head: #334155; /* top row of lesson tables (dark mode: a muted grey that keeps text readable) */
  --help-bg: #15292c; /* "If it did not work" box: muted blue-green, so it stands apart from the steps */
  --help-border: #3b7a78;
  --help-title: #99f6e4;
  --border: #334155;
  --accent-cyan: #5eead4;
  --accent-yellow: #fbbf24;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --pixel-bg: #0b1220;
  --warn-bg: #34202a; /* safety box: muted wine, softer against the slate page; light text stays easy to read */
  --warn-border: #fca5a5;
  --warn-title: #ffffff;
  --warn-text: #ffffff;
  --focus: #5eead4;
  --title: #f1f5f9;
  --sitemap-guide: #7dd3fc;
  --link: #7dd3fc; /* links inside text: sky blue, clearly different from the teal/mint of the help box */
  --page-max: 1280px; /* v273: wider page on desktop; header, footer and the lesson's left card follow it, the right column stays 260px */
  --pad: 16px; /* side padding of the page; 24px from tablet width up (see below) */
  /* Side padding that lines header and footer content up with the page column. */
  --gutter: max(var(--pad), calc((100% - var(--page-max)) / 2 + var(--pad)));
  --brand-h: 68px;
  --nav-h: 52px;
  color-scheme: dark;
  --chrome-text: #f1f5f9;
  --footer-text: #e2e8f0;
  --panel-green-bg: #14291f; --panel-green-border: #4ade80;
  --panel-yellow-bg: #2b2a14; --panel-yellow-border: #fbbf24;
  --panel-red-bg: #34202a; --panel-red-border: #f87171;
  --panel-blue-bg: #13233a; --panel-blue-border: #60a5fa;
  --current-row: #2b3a4f; /* v292: current lesson and current unit rows, and row hover: the card header bar colour (dark mode) */
}

/* Light theme: the colours of the original Compute Lounge site (scripts/styles.css in the old upload).
   Highlight boxes: green = key words, yellow = definitions, red = warnings, blue = notes. */
:root[data-theme="light"] {
  --bg: #eceef1;                 /* page background (old body and .w3-page-back) */
  --chrome: #435d75;             /* header bar (old .w3-main-nav-back) */
  --chrome-text: #f1f1f1;
  --footer-bg: #435d75;
  --footer-text: #f1f1f1;
  --surface: #ffffff;            /* cards and lesson boxes */
  --table-head: #e5e7eb;         /* top row of lesson tables: light grey */
  --border: #d0d1d5;             /* card and image borders (old .w3-card) */
  --text: #3a3a3a;               /* body text */
  --text-muted: #5a6470;
  --title: #4a4a4a;              /* headings (old h1, h2, h3) */
  --link: #1565c0;
  --accent-cyan: #36587f;
  --accent-yellow: #8a5a00;      /* current item and small accents */
  --help-bg: #edfafe;            /* "If it did not work" box: old blue panel */
  --help-border: #2196f3;
  --help-title: #1565c0;
  --warn-bg: #ffecec;            /* warning and safety boxes: old red panel */
  --warn-border: #f44336;
  --warn-title: #b71c1c;
  --warn-text: #3a3a3a;
  --panel-green-bg: #eeffee;     /* old w3-panel-green: key words */
  --panel-green-border: #4caf50;
  --panel-yellow-bg: #fefee4;    /* old w3-panel-yellow: definitions */
  --panel-yellow-border: #ffc107;
  --panel-red-bg: #ffecec;       /* old w3-panel-red: warnings */
  --panel-red-border: #f44336;
  --panel-blue-bg: #edfafe;      /* old w3-panel-blue: notes and examples */
  --panel-blue-border: #2196f3;
  --current-row: #dfe7ef;        /* v292: current lesson and current unit rows, and row hover: the card header bar blue-grey (grey #CCCCCC clashed with the blue links) */
  --pixel-bg: #eef2f6;
  --focus: #36587f;
  --sitemap-guide: #36587f;
  color-scheme: light;
}

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

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  /* Always reserve the scrollbar's width, so short pages (Terms, Licence) line up with long ones. */
  scrollbar-gutter: stable;
}

@supports not (scrollbar-gutter: stable) {
  html {
    overflow-y: scroll;
  }
}

body {
  margin: 0;
  /* Leaves room for the fixed header (brand row + category row). */
  padding-top: calc(var(--brand-h) + var(--nav-h));
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  /* Short pages: main grows to fill the screen, so the footer sits at the bottom. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent-cyan);
}

/* Tablets and larger: more room at the sides. The header, footer and page content all follow. */
@media (min-width: 768px) {
  :root {
    --pad: 24px;
  }
}

/* Links inside paragraphs and lists (breadcrumbs, video link, About/Privacy text) use the blue
   link colour and stay underlined, so they do not rely on colour alone. Cards, chips, buttons
   and the menu keep their own colours. */
main p a,
main li a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Mouse-over colour for text links (body text and breadcrumbs): a deep teal in the light theme (#0f766e, about
   5.5:1 on white) and a light teal in the dark theme (#5eead4, the focus colour). Both pass WCAG AA. */
main p a:hover,
main li a:hover {
  color: #5eead4;
}

:root[data-theme="light"] main p a:hover,
:root[data-theme="light"] main li a:hover {
  color: #0f766e;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  padding: 8px 12px;
  background: var(--accent-yellow);
  color: #000;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* ---------- Header ----------
   On phones (under 768px) the whole header (brand row and category row) slides up out of view
   on scroll down and back on scroll up. From 768px up, the brand row stays fixed and only the
   category row slides, as set in the media query near the end of this file. Only transform
   changes, so it stays smooth. */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  transition: transform 0.25s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25); /* v274: subtle shadow under the header */
}

.site-header.nav-hidden {
  transform: translateY(calc(-1 * (var(--brand-h) + var(--nav-h))));
}

.brand-row {
  position: relative;
  z-index: 2;
  height: var(--brand-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 var(--gutter);
  background: var(--chrome);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand img {
  height: 52px;
  width: auto;
  flex: none;
}

.brand-name {
  font-family: "Courier New", Courier, monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-yellow);
}

.brand-tag {
  display: none;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Phone header: the name in two lines beside the CL icon. Hidden under 360px, where the
   icon and the three header buttons leave no room. Shown from 360px up to the tablet width. */
.brand-words {
  display: none;
  font-family: "Courier New", Courier, monospace;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--chrome-text);
  white-space: nowrap;
}
@media (min-width: 360px) and (max-width: 767.98px) {
  .brand-words { display: block; }
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--accent-yellow);
  font-size: 1.2rem;
  cursor: pointer;
}

/* Light / dark button icons: drawn SVG, centred by the button's flexbox. The button shows the mode
   it will switch to: a sun while the site is dark, a moon while it is light. */
.theme-icon {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Mouse-over for the colour-theme and search buttons (mouse devices only, so a tap on a phone does not
   leave the button stuck in the hover look): the button keeps its fill and only the border changes to the
   same accent colour as the other buttons. The sun turns a little and the magnifying glass grows, unless the visitor prefers
   reduced motion. */
@media (hover: hover) {
  #themeToggle:hover,
  #searchToggle:hover {
    border-color: var(--accent-cyan);
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  #themeToggle .theme-icon,
  #searchToggle svg {
    transition: transform 0.25s ease;
  }

  #themeToggle:hover .theme-icon-sun {
    transform: rotate(45deg);
  }

  #themeToggle:hover .theme-icon-moon {
    transform: rotate(-20deg);
  }

  #searchToggle:hover svg {
    transform: scale(1.2);
  }
}

/* The search button keeps the accent border (no fill) while the search is open. */
/* The search buttons keep the accent border while their search is open (and while pressed). The search
   field border is the same colour when open, so the button and the box match. */
#searchToggle[aria-expanded="true"],
#menuSearchToggle[aria-expanded="true"],
#menuSearchToggle:active {
  border-color: var(--accent-cyan);
}

.search-box.is-open input {
  border-color: var(--accent-cyan);
}

html[data-theme="light"] .theme-icon-sun,
html:not([data-theme="light"]) .theme-icon-moon {
  display: none;
}

.nav-row {
  position: absolute;
  z-index: 1;
  top: 100%;
  left: 0;
  right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--chrome);
  border-bottom: 2px solid var(--border);
}

.nav-row::-webkit-scrollbar {
  display: none;
}

.nav-chip {
  flex: none;
  padding: 8px 14px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
}

.nav-chip:hover,
.nav-chip:focus-visible {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.nav-chip[aria-current="page"] {
  border-color: var(--accent-yellow);
  color: var(--accent-yellow);
}

/* Category groups. Without JavaScript the group buttons are hidden and each group's links sit in the
   row as plain chips (display: contents lets them join the row). With JavaScript, from tablet width up,
   the rules in the 768px block below turn each group into a button with a dropdown. */
.nav-group,
.nav-group-panel {
  display: contents;
}

.nav-group-btn {
  display: none;
}

/* ---------- Layout ---------- */

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 24px var(--pad) 48px;
}

h1 {
  margin: 0.2em 0 0.4em;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: var(--title);
}

.section-title {
  margin: 2.2rem 0 0.6rem;
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.lead {
  max-width: 65ch;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.breadcrumb {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Top breadcrumb only (not the bottom copy): 12px of space below it, before the title (was 8px; 3 Dec 2026). */
.breadcrumb:not(.breadcrumb--bottom) {
  margin-bottom: 12px;
}

/* The copy of the breadcrumb at the end of a guide: space above it, and links easy to tap. */
.breadcrumb--bottom {
  margin-top: 32px;
}

.breadcrumb--bottom a {
  display: inline-block;
  padding: 10px 2px;
}

/* v222: when the bottom breadcrumb is the last thing on the page, use one space above the footer
   (24px, the same as the footer's own top padding) instead of main's full 48px bottom padding. */
main:has(> .breadcrumb--bottom:last-child) {
  padding-bottom: 24px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* v284: unit cards keep their own height, so opening or closing one does not stretch or shrink the others in its row. */
.grid:has(> .card-unit) {
  align-items: start;
}

/* ---------- Page number links under a category ---------- */

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
}

/* Smaller than the header chips, but still at least 32px square to tap. */
.pager {
  gap: 6px;
  margin-top: 24px;
}

/* Space between the pager above the cards and the first row of guides. */
.pager + .grid {
  margin-top: 24px;
}

.pager .nav-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 2px 8px;
  border-width: 1px;
  font-size: 0.85rem;
  text-align: center;
}

.pager-icon {
  display: block;
}

.pager-gap {
  color: var(--text);
  padding: 0 2px;
  font-size: 0.85rem;
}

.pager .is-disabled {
  opacity: 0.35;
}

/* ---------- Home and cards ---------- */

.search {
  width: 100%;
  max-width: 520px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.search:focus {
  border-color: var(--accent-cyan);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

/* The whole square is the link: the square reacts (border, lift, pointer), the text does not. */
.card-link {
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card-link:hover,
.card-link:focus-visible {
  border-color: var(--accent-cyan);
  transform: translateY(-3px);
}

.card-link:focus-visible {
  outline: 3px solid var(--accent-cyan);
  outline-offset: 2px;
}

.card-link:active {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .card-link {
    transition: none;
  }

  .card-link:hover,
  .card-link:focus-visible {
    transform: none;
  }
}

.card--soon {
  border-style: dashed;
  opacity: 0.8;
}

/* Dark mode: coming-soon cards at full opacity so their text stays readable. */
:root[data-theme="dark"] .card--soon {
  opacity: 1;
}

/* Category cards on the home page: the pixel icon sits to the left of the count and the name. */
.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.card-head > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.category-icon {
  flex: none;
}

/* Category page heading: the larger icon beside the title. */
.intro-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0.2em 0 0.4em;
}

.intro-head h1 {
  margin: 0;
}

.card-label {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-title {
  margin: 0;
  font-family: "Courier New", Courier, monospace;
  font-size: 1.1rem;
  color: var(--title);
}

.card-title a {
  color: inherit;
  text-decoration: none;
}

.card-title a:hover {
  text-decoration: underline;
}

.card-text {
  margin: 0;
  color: var(--text-muted);
}

/* ---------- Guide page ---------- */

.hero-figure,
.step-figure {
  margin: 20px 0;
  padding: 8px;
  border: 2px solid var(--border);
  background: #ffffff;
}

/* "Related guide" box under the safety warning. */
.see-also {
  margin: 0 0 20px;
  padding: 4px 18px 12px;
  border: 2px solid var(--border);
  background: var(--surface);
}

.see-also h2 {
  margin: 14px 0 8px;
  font-size: 1.1rem;
}

.see-also ul {
  margin: 0;
  padding-left: 20px;
}

.see-also li {
  margin-bottom: 6px;
}

/* Video link at the bottom of a guide. */
/* Time and difficulty line under the guide summary. */
.guide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.guide-meta strong {
  color: var(--text);
}

/* "Print this guide" button, at the right end of the time and difficulty line.
   Hidden until JavaScript runs, because it needs JavaScript to open the print window. */
.print-btn {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-left: auto;
  padding: 6px 14px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

html.js .print-btn {
  display: inline-flex;
}

.print-btn:hover,
.print-btn:focus-visible {
  border-color: var(--accent-cyan);
}

.print-btn svg {
  flex: none;
  color: var(--accent-cyan);
}

/* "If it did not work" box after the steps. */
.troubleshoot {
  margin-top: 32px;
  padding: 4px 18px 12px;
  border: 2px solid var(--help-border);
  background: var(--help-bg);
}

.troubleshoot ul {
  margin: 0;
  padding-left: 20px;
}

.troubleshoot li {
  margin-bottom: 10px;
}

.troubleshoot strong {
  color: var(--help-title);
}

.video {
  margin-top: 32px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Heading row: the video icon sits directly to the right of "Watch a video". */
.video-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.video-icon {
  flex: none;
  color: var(--accent-cyan);
}

/* Same size as the body text (no smaller font). */
.video-note {
  color: var(--text-muted);
}

/* On wide screens the main diagram stays at its natural size instead of filling the column. */
.hero-figure {
  max-width: 640px;
}

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tools li {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-height: 44px; /* text-only tools stay as tall as tools with an icon */
  padding: 4px 12px 4px 4px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
}

/* Small pixel icon at the start of each tool. */
.tool-icon {
  flex: none;
  width: 32px;
  height: 32px;
}

/* A tool with no icon (such as "None") keeps the same left padding as the others. */
.tools li > span:only-child {
  padding-left: 8px;
}

/* Recipe ingredients: a plain list in a card, two columns when there is room. */
.ingredients {
  display: grid;
  gap: 6px 24px;
  margin: 0;
  padding: 14px 18px 14px 36px;
  border: 2px solid var(--border);
  background: var(--surface);
}

@media (min-width: 768px) {
  .ingredients {
    grid-template-columns: 1fr 1fr;
  }
}

/* Photo credit under a recipe photo. The photo keeps its 3:2 shape at any width. */
.photo-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.photo-figure figcaption {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.warning {
  margin: 24px 0;
  padding: 16px 18px;
  border: 2px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-text);
}

.warning h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn-title);
}

.warning ul {
  margin: 0;
  padding-left: 20px;
}

.steps {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  counter-increment: step;
  padding: 16px 18px 16px 68px;
  border: 2px solid var(--border);
  background: var(--surface);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 16px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid var(--accent-yellow);
  color: var(--accent-yellow);
  font-family: "Courier New", Courier, monospace;
  font-weight: 700;
}

.steps p {
  margin: 0;
}

/* A step with a diagram: the text block is at least two lines tall, so a one-line step leaves the
   same space between the number box and the diagram as a two-line step does. */
.steps li:has(> .step-figure) > p {
  min-height: 3.2em;
}

/* Step diagrams use the full width of the step card, so their labels stay readable on phones. */
.steps .step-figure {
  max-width: 560px;
  margin: 14px 0 0 -50px;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 24px var(--gutter);
  background: var(--footer-bg);
  border-top: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

/* ---------- Header search panel ---------- */

.search-panel {
  position: absolute;
  z-index: 3;
  top: 100%;
  left: 0;
  right: 0;
  padding: 16px var(--gutter);
  background: var(--chrome);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.search-panel-inner {
  display: grid;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}

/* Right of the brand row, left to right: theme button, search button, and on phones the menu button.
   The search field is hidden to the left of the search button (.search-tool is its positioning
   parent) and slides out to the left when opened, over the theme button and the brand. */
.header-tools {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.search-tool {
  position: relative;
  display: flex;
  flex: none;
}

.search-box {
  position: absolute;
  z-index: 5;
  top: 0;
  right: calc(100% + 8px);
  width: 0;
  height: 44px;
  overflow: hidden;
  visibility: hidden;
  /* Closing: hide the field only after it has slid shut. */
  transition: width 0.3s ease, visibility 0s linear 0.3s;
}

.search-box.is-open {
  width: min(260px, 60vw);
  visibility: visible;
  /* Opening: become visible straight away, so the field can take focus on the tap
     and the phone keyboard opens. */
  transition: width 0.3s ease, visibility 0s;
}

.search-box input {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.search-box input:focus {
  border-color: var(--accent-cyan);
}

.search-status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.search-results {
  display: grid;
  gap: 8px;
  max-height: 50vh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.search-results a {
  display: block;
  padding: 10px 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.search-results a:hover,
.search-results a:focus-visible {
  border-color: var(--accent-cyan);
}

.search-results small {
  color: var(--text-muted);
}

/* A short piece of the page text under each result, with the typed words highlighted. */
.search-snippet {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
  /* At most two lines, so each result card stays short. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-results mark {
  background: #fde68a;
  color: #1f2937;
  padding: 0 2px;
  border-radius: 2px;
}

.search-filters-clear {
  align-self: flex-end;
  min-height: 44px;
  padding: 6px 12px;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--link);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.search-filters-clear:hover,
.search-filters-clear:focus-visible {
  border-color: var(--accent-cyan);
}

/* The panel sits on the blue header colour in both themes, so its own text is light there. */
.search-panel .search-status,
.search-panel .search-filters label {
  color: #f1f5f9;
}

.search-panel .search-filters-clear {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.7);
}

/* ---------- Footer links ---------- */

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-bottom: 12px;
}

.footer-link {
  color: var(--text);
}

/* ---------- Static pages and contact form ---------- */

.updated {
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.sitemap {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.sitemap ul {
  margin: 4px 0 8px;
  padding-left: 1.2rem;
}

/* Site map category links use the standard link colour, as the rest of the site does. */
.sitemap a {
  color: var(--link);
  font-weight: 400;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.sitemap a:hover {
  text-decoration: none;
}

/* Guide links in the site map get their own colour, so they differ from the category links above. */
.sitemap ul a {
  color: var(--sitemap-guide);
}

/* Lesson links sit under their unit links, so they use a dash instead of a bullet to read apart from them. */
.sitemap ul ul ul {
  list-style-type: "\2013  ";
}

.form {
  display: grid;
  gap: 14px;
  max-width: 560px;
  margin-top: 20px;
}

.form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.form input,
.form select,
.form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

.form textarea {
  min-height: 140px;
  resize: vertical;
}

.form button {
  justify-self: start;
  padding: 10px 18px;
  border: 2px solid var(--accent-yellow);
  background: var(--surface);
  color: var(--accent-yellow);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.form button:hover {
  background: var(--accent-yellow);
  color: #000;
}

.form-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ---------- Ads (AdSense) ----------
   Ad panels use the surface colour in both themes, so they match the cards. */
.ad-slot {
  padding: 8px;
  border: 2px solid var(--border);
  background: var(--surface);
}

/* Visible "Advertisement" label above each ad. */
.ad-label {
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
}

/* Grey box shown only in preview mode, in place of a real ad. */
.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- Breakpoints ---------- */

/* Menu icons: three bars. The top and bottom bars move to the middle and turn 45 degrees to make an X,
   the middle bar fades out. The header hamburger shows bars and becomes an X when the menu opens; the
   X inside the menu shows an X and becomes bars as the menu closes. Same 0.4s as the menu slide. */
.bars .bar {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.bars-x .bar-top { transform: translateY(6px) rotate(45deg); }
.bars-x .bar-mid { opacity: 0; }
.bars-x .bar-bot { transform: translateY(-6px) rotate(-45deg); }

/* Phone menu: a hamburger in the top bar opens a panel that slides in from the left.
   Only used on phones and only when JavaScript is on (theme.js adds the "js" class to <html>);
   otherwise phones keep the scrolling category row. Tablet and up never show it. */
.brand-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.menu-toggle,
.drawer,
.drawer-overlay {
  display: none;
}

/* "Phone" = narrow screens, plus phones turned sideways (wider than 768px but short, so tablets,
   which are taller, keep the category row). */
@media (max-width: 767.98px), (max-width: 1000px) and (max-height: 500px) {
  /* The category row is gone on phones, so only the top bar is left. With --nav-h at 0 it slides
     away on scroll down and back on scroll up, as before. */
  html.js {
    --nav-h: 0px;
  }

  html.js .nav-row {
    display: none;
  }

  html.js .menu-toggle {
    display: flex;
  }

  /* The search field slides out to the left over the hamburger and brand (they stay where they are
     underneath and show again when it closes). It stops at the left edge of the page column. */
  .search-box.is-open {
    width: calc(100vw - 2 * var(--gutter) - 104px);
  }

  html.js .drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--brand-h); /* starts under the header, which stays on top of it */
    bottom: 0;
    left: 0;
    z-index: 40;
    width: 100%;
    max-width: 420px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
    border-right: 2px solid var(--border);
    /* Off screen to the left. visibility keeps its links out of the tab order until it is open. */
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.4s ease, visibility 0s linear 0.4s;
  }

  html.js.drawer-open .drawer {
    transform: none;
    visibility: visible;
    transition: transform 0.4s ease, visibility 0s;
  }

  html.js .drawer-overlay {
    display: block;
    position: fixed;
    top: var(--brand-h);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0s linear 0.4s;
  }

  html.js.drawer-open .drawer-overlay {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease, visibility 0s;
  }

  html.drawer-open {
    overflow: hidden; /* the page behind the menu does not scroll */
  }

  /* With the menu open the header is always shown, so the menu starts right under it. */
  html.js.drawer-open .site-header.nav-hidden {
    transform: none;
  }

  /* Icon states. Open: the header hamburger becomes an X. Closing: the menu's X becomes bars again.
     main.js adds "drawer-closing" to <html> for the 0.4s the menu slides away. */
  html.js.drawer-open .menu-toggle .bar-top { transform: translateY(6px) rotate(45deg); }
  html.js.drawer-open .menu-toggle .bar-mid { opacity: 0; }
  html.js.drawer-open .menu-toggle .bar-bot { transform: translateY(-6px) rotate(-45deg); }

  html.js.drawer-closing #drawerClose .bar-top,
  html.js.drawer-closing #drawerClose .bar-bot { transform: none; }
  html.js.drawer-closing #drawerClose .bar-mid { opacity: 1; }

  .drawer-top {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--brand-h);
    padding: 0 var(--gutter);
    border-bottom: 2px solid var(--border);
  }

  .drawer-title {
    color: var(--accent-yellow);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  /* Menu search: the magnifier sits left of the X, and its field slides out to the left over the title,
     the same as the header search. */
  .drawer-top .drawer-title {
    flex: 1;
  }

  .drawer-tools {
    display: flex;
    align-items: center;
    flex: none;
    margin-right: 8px;
  }

  /* The menu's search field is positioned from the top bar, not the button: it starts at the page gutter
     and stops 8px left of the magnifier. 104px = the magnifier, the X and the gaps between them. */
  .drawer-top {
    position: relative;
  }

  .drawer-top .search-box {
    top: calc(50% - 22px);
    right: calc(var(--gutter) + 104px);
  }

  .drawer-top .search-box.is-open {
    width: calc(100% - 2 * var(--gutter) - 104px);
  }

  /* While a menu search is open, the category links make room for the results. */
  .drawer-results:not([hidden]) ~ .drawer-nav {
    display: none;
  }

  .drawer-results {
    padding: 8px var(--gutter) 16px;
  }

  .drawer-results .search-results {
    max-height: none; /* the whole menu scrolls, not the list */
    overflow: visible;
  }

  .drawer-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
  }

  .drawer-link {
    display: flex;
    align-items: center;
    min-height: 54px;
    padding: 0 var(--gutter);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 1.05rem;
    letter-spacing: 0.05em;
    text-decoration: none;
    text-transform: uppercase;
  }

  .drawer-link:hover,
  .drawer-link:focus-visible {
    color: var(--accent-cyan);
  }

  .drawer-link[aria-current="page"] {
    color: var(--accent-yellow);
    font-weight: 700;
  }

  /* Groups in the phone menu: a <details> block whose title is a row with a + / minus sign, and
     whose links are indented below it. */
  .drawer-group-summary {
    position: relative; /* the + sign is drawn from two bars placed against the right edge */
    justify-content: space-between;
    cursor: pointer;
    list-style: none;
  }

  .drawer-group-summary::-webkit-details-marker {
    display: none;
  }

  /* The + / minus sign is two bars. The horizontal bar stays still; the upright bar turns a quarter
     turn to the left when the group opens, so it lies flat and the plus becomes a minus. */
  .drawer-group-summary::before,
  .drawer-group-summary::after {
    content: "";
    position: absolute;
    right: var(--gutter);
    top: 50%;
    width: 16px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
  }

  .drawer-group-summary::before {
    transform: translateY(-50%);
  }

  .drawer-group-summary::after {
    transform: translateY(-50%) rotate(90deg);
  }

  .drawer-group[open] > .drawer-group-summary::after {
    transform: translateY(-50%) rotate(0deg);
  }

  /* While a group slides shut, turn the bar back straight away (the open attribute is only
     removed when the slide ends). */
  .drawer-group.is-closing > .drawer-group-summary::after {
    transform: translateY(-50%) rotate(90deg);
  }

  @media (prefers-reduced-motion: no-preference) {
    .drawer-group-summary::after {
      transition: transform 0.25s ease;
    }
  }

  .drawer-sub {
    padding-left: calc(var(--gutter) + 18px);
    background: var(--surface);
    font-size: 0.98rem;
  }

}

@media (max-width: 359.98px) {
  /* Very narrow phones (320px): a smaller logo and name so the hamburger, brand and tools all fit. */
  html.js .menu-toggle {
    width: 40px;
    height: 40px;
  }

  html.js .brand-left {
    gap: 6px;
  }

  html.js .brand {
    gap: 6px;
  }

  html.js .brand img {
    width: auto;
    height: 42px;
  }

  html.js .brand-name {
    font-size: 1rem;
    letter-spacing: 0.08em;
  }

  html.js .brand-row {
    gap: 6px;
  }

  html.js .header-tools {
    gap: 6px;
  }
}

@media (min-width: 768px) {
  /* Tablet and up: one row of chips. Chips that do not fit are moved by main.js into a "More"
     dropdown at the end of the row, so any number of categories works and the row stays one line.
     (Without JavaScript the row simply scrolls sideways.) */
  html.js .nav-row {
    overflow: visible; /* lets the dropdown hang below the row */
  }

  .nav-more {
    position: relative;
    flex: none;
  }

  .nav-more-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    font-size: 0.95rem;
    cursor: pointer;
  }

  .nav-more-btn.is-current {
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
  }

  .nav-more-btn[aria-expanded="true"] svg {
    transform: rotate(180deg);
  }

  /* Group dropdowns: each group is a button; its categories hang below in a panel (shown by main.js
     adding .is-open). Reuses the look of the "More" panel. */
  html.js .nav-group {
    display: block;
    position: relative;
    flex: none;
  }

  html.js .nav-group-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    font-size: 0.95rem;
    cursor: pointer;
  }

  html.js .nav-group-btn.is-current {
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
  }

  html.js .nav-group-btn[aria-expanded="true"] svg {
    transform: rotate(180deg);
  }

  html.js .nav-group-panel {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 10;
    gap: 8px;
    min-width: 220px;
    padding: 12px;
    background: var(--chrome);
    border: 2px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  }

  html.js .nav-group-panel.is-open {
    display: grid;
  }

  html.js .nav-group-panel .nav-chip {
    white-space: normal;
  }

  .nav-more-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
    width: min(560px, calc(100vw - 2 * var(--gutter)));
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    padding: 12px;
    background: var(--chrome);
    border: 2px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  }

  .nav-more-panel .nav-chip {
    white-space: normal;
  }

  .search-box.is-open {
    width: min(340px, 60vw);
  }

  /* From tablet width up, the logo bar stays fixed and only the category row slides away. */
  .site-header.nav-hidden {
    transform: none;
  }

  .nav-row {
    transition: transform 0.25s ease;
  }

  .site-header.nav-hidden .nav-row {
    transform: translateY(-100%);
  }

  .brand-tag {
    display: inline;
  }

  .brand img {
    width: auto;
    height: 44px;
  }

  .brand-name {
    font-size: 1.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .site-header,
  .nav-row,
  .drawer,
  .drawer-overlay {
    transition: none;
  }

  /* The icons change shape at once, with no animation, for visitors who ask for less motion. */
  .bars .bar {
    transition: none;
  }
}

/* ---------- "Report a mistake" line at the end of a guide ---------- */

/* A thin divider above it, so it reads as the end-of-guide feedback line, not part of the video. */
.report-link {
  margin: 32px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

/* ---------- Printing a guide ----------
   Keeps what you need at the bench: title, safety box, tools, ingredients and steps with their diagrams.
   Hides the menu, search, footer, related guides and links to other pages. */
@media print {
  .skip-link,
  .site-header,
  .drawer,
  .drawer-overlay,
  .site-footer,
  .breadcrumb,
  .related,
  .report-link,
  .print-btn,
  .video,
  .pager {
    display: none !important;
  }

  html,
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }

  main,
  .guide {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .warning {
    border: 2px solid #000000 !important;
    background: #ffffff !important;
    color: #000000 !important;
    break-inside: avoid;
  }

  h1,
  h2 {
    break-after: avoid;
  }

  .steps li,
  .step-figure,
  .hero-figure,
  .troubleshoot {
    break-inside: avoid;
  }

  .steps .step-figure {
    max-width: 420px;
    margin: 8px 0 0 0;
    border: 1px solid #999999;
  }

  .hero-figure {
    max-width: 480px;
    border: 1px solid #999999;
  }

  img {
    max-width: 100%;
    height: auto;
  }

  /* Print the address after a link, so the page still makes sense on paper. */
  .guide a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-break: break-all;
  }
}

/* ---------- Previous and Next guide ----------
   A teal-tinted box with a solid block arrow. The tint is mixed from the page's own teal and surface colours,
   so it stays soft in light mode and deep in dark mode. */

.guide-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 8px;
}

.guide-nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 15rem;
  padding: 12px 16px;
  border: 2px solid var(--accent-cyan);
  background: var(--surface);                                   /* fallback for old browsers */
  background: color-mix(in srgb, var(--accent-cyan) 14%, var(--surface));
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* v277: a little stronger than v276; still lighter than the header */
}

.guide-nav-next {
  justify-content: space-between;
  text-align: right;
}

/* The text fills the box and hugs the arrow, so "Next guide" and the title line up on the right. */
.guide-nav-next .guide-nav-text {
  flex: 1 1 auto;
  align-items: flex-end;
  text-align: right;
}

.guide-nav-link:hover,
.guide-nav-link:focus-visible {
  background: color-mix(in srgb, var(--accent-cyan) 26%, var(--surface));
}

/* v276: the shadow disappears on hover and while pressed (mouse or touch), so the button looks pushed down. */
.guide-nav-link:hover,
.guide-nav-link:active {
  box-shadow: none;
}

.guide-nav-arrow {
  flex: none;
  color: var(--accent-cyan);
}

.guide-nav-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.guide-nav-label {
  color: var(--text);   /* full text colour: the muted grey is too faint on the tinted box in dark mode */
  opacity: 0.85;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.guide-nav-title {
  font-weight: 700;
}

/* Desktop and larger: bigger arrows (40px instead of 30px). */
@media (min-width: 1024px) {
  .guide-nav-arrow {
    width: 40px;
    height: 40px;
  }
}

/* Desktop and larger, with a mouse: when the pointer enters the box, the arrow bounces twice and finishes
   pushed a little way in its own direction (left for Previous, right for Next). It stays there while the
   pointer is over the box and slides back when the pointer leaves. Not used for visitors who ask for less motion. */
@keyframes arrow-bounce-left {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-8px); }
  50%  { transform: translateX(-2px); }
  75%  { transform: translateX(-8px); }
  100% { transform: translateX(-8px); }
}

@keyframes arrow-bounce-right {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(8px); }
  50%  { transform: translateX(2px); }
  75%  { transform: translateX(8px); }
  100% { transform: translateX(8px); }
}

@media (min-width: 1024px) and (hover: hover) and (prefers-reduced-motion: no-preference) {
  .guide-nav-arrow {
    transition: transform 0.25s ease;
  }

  /* The resting position on hover is the end of the bounce, so the arrow stays pushed out while hovered
     and the transition above slides it back smoothly when the pointer leaves. */
  .guide-nav-prev:hover .guide-nav-arrow {
    transform: translateX(-8px);
    animation: arrow-bounce-left 0.9s ease-in-out;
  }

  .guide-nav-next:hover .guide-nav-arrow {
    transform: translateX(8px);
    animation: arrow-bounce-right 0.9s ease-in-out;
  }
}

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

/* ---------- Search filters (category and difficulty) ---------- */

.search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 12px;
}

.search-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 8rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-filters select {
  min-height: 44px;
  padding: 6px 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.search-filters select:focus-visible {
  outline: 3px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* ---------- Dim the page behind the search panel ---------- */

.search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;  /* below the header (50), so the header and search panel stay bright */
  background: rgba(2, 6, 23, 0.6);
}

.search-backdrop[hidden] {
  display: none;
}

/* ---------- Filters button (phones only) ----------
   On a phone the three drop-down lists are folded away until you tap Filters, so the results keep the room
   above the on-screen keyboard. On tablets and larger screens the lists are always shown. */

.search-filters-toggle {
  display: none;
  align-items: center;
  min-height: 44px;
  padding: 6px 14px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 767.98px) {
  .search-filters-toggle {
    display: inline-flex;
    justify-self: start;
  }

  .search-filters:not(.is-open) {
    display: none;
  }

  /* Filters button and the "51 guides found" line share one row, to save height above the keyboard. */
  .search-panel-inner {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px 12px;
  }

  .search-filters-toggle { order: 1; }
  .search-panel-inner .search-status { order: 2; margin: 0; }
  .search-filters { order: 3; grid-column: 1 / -1; margin-bottom: 4px; }
  .search-panel-inner .search-results { order: 4; grid-column: 1 / -1; }
}

/* ---------- Search panel height (tablet and larger) ----------
   The whole drop-down (filters, count and results) ends no lower than 3/4 of the way down the screen.
   The filters and count stay in view and the results list scrolls. */

@media (min-width: 768px) {
  .search-panel-inner {
    display: flex;
    flex-direction: column;
    /* The drop-down starts under the logo bar (--brand-h), so its bottom edge stays within 3/4 of the screen.
       34px = the panel's top and bottom padding (32px) and its bottom border (2px). */
    max-height: calc(75vh - var(--brand-h) - 34px);
    max-height: calc(75dvh - var(--brand-h) - 34px);
  }

  .search-panel-inner .search-filters,
  .search-panel-inner .search-status {
    flex: none;
  }

  .search-panel-inner .search-results {
    flex: 0 1 auto;
    min-height: 0;
    max-height: none;
  }
}

/* A step with two diagrams: a small gap between them. */
.step-figure + .step-figure {
  margin-top: 12px;
}

/* Typed commands (added v108): short code chips inside steps, warnings and help text. */
.steps code,
.troubleshoot code,
.warning code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  font-size: 0.92em;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  white-space: nowrap; /* a short command such as cd %userprofile% is never split over two lines */
}

/* Only on very narrow screens (under 360px) may a long command break, so the page never scrolls sideways. */
@media (max-width: 359px) {
  .steps code,
  .troubleshoot code,
  .warning code {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Enlarge a picture (js/main.js, section 2b): diagrams and photos in a guide open in a full-screen viewer.
   On a phone the picture is wider than the screen, so its small text is readable; scroll sideways or pinch to zoom. */
html.js .step-figure img,
html.js .hero-figure img,
html.js .lesson-figure img,
html.js .unit-hero img {
  cursor: zoom-in;
}

html.js .step-figure img:focus-visible,
html.js .hero-figure img:focus-visible,
html.js .lesson-figure img:focus-visible,
html.js .unit-hero img:focus-visible {
  outline: 3px solid var(--accent-yellow);
  outline-offset: 3px;
}

html.viewer-open {
  overflow: hidden; /* the page behind the viewer does not scroll */
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.88);
}

.image-viewer[hidden] {
  display: none;
}

.image-viewer-close {
  align-self: flex-end;
  min-width: 88px;
  min-height: 48px;
  margin: 8px;
  padding: 0 18px;
  border: 2px solid var(--accent-cyan);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.image-viewer-close:hover,
.image-viewer-close:focus-visible {
  border-color: var(--accent-yellow);
}

.image-viewer-hint {
  position: absolute;
  top: 20px;
  left: 14px;
  margin: 0;
  color: #ffffff;
  font-size: 0.9rem;
}

.image-viewer-scroll {
  flex: 1;
  overflow: auto;
  display: flex;
  padding: 0 8px 16px;
  touch-action: pan-x pan-y pinch-zoom; /* scrolling and pinch-zoom both work */
}

.image-viewer-img {
  /* At least 760px wide, so small text in a diagram is readable on a phone (the viewer scrolls sideways); never wider than 1100px. */
  width: max(100%, 760px);
  max-width: none;
  height: auto;
  margin: auto; /* centred when it is smaller than the screen */
  flex: none;
  max-height: none;
  background: #ffffff;
  border-radius: 6px;
  cursor: default;
}

@media (min-width: 1000px) {
  /* Desktop: the enlarged picture is never larger than the screen. It keeps its shape, and is capped at
     1040px wide and at the height of the screen, less room for the Close button. */
  .image-viewer-img {
    width: auto;
    max-width: min(100%, 1040px);
    max-height: calc(100vh - 110px);
    max-height: calc(100dvh - 110px);
  }

  .image-viewer-hint {
    display: none; /* the picture fits the screen, so there is nothing to scroll */
  }
}

/* v278: a group marked lesson-figure--row2 (Computer systems: laptop, tablet, mobile, diagram) spans the full card width,
   and starts below any picture floated on the right. Tablet and phone: two per row. Desktop (v282): three per row,
   with the system diagram (lesson-figure--span) across the whole second row. */
.lesson-card .figure-group.figure-group:has(> .lesson-figure--row2) {
  clear: right;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--border); /* v279: dividing line above the pictures, same as the sub-section lines */
  padding-top: 16px;
  margin-top: 28px;
}

/* v282: desktop, the Computer systems group (lesson-figure--row2) has three pictures on the first row and the
   system diagram (lesson-figure--span) across the second row. Phones and tablets are unchanged. */
@media (min-width: 1024px) {
  .lesson-card .figure-group.figure-group:has(> .lesson-figure--row2) {
    grid-template-columns: repeat(3, 1fr);
  }
  .lesson-card .figure-group.figure-group:has(> .lesson-figure--row2) > .lesson-figure--span {
    grid-column: 1 / -1;
  }
}

/* v279: a picture marked lesson-figure--half (Computer systems: labelled "A Computer System" diagram) stays in
   its place in the lesson, at half the card width, centred, with a dividing line above it. Desktop only. */
@media (min-width: 1024px) {
  .lesson-card .figure-group:has(> .lesson-figure--half) {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 28px;
  }
  /* v280: a group marked lesson-figure--divider (Computer systems: motherboard, code, PC) has a dividing line above it. Desktop only. */
  .lesson-card .figure-group.figure-group:has(> .lesson-figure--divider) {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 28px;
  }
  .lesson-card .lesson-figure.lesson-figure--half {
    width: 50%;
    margin-left: 0; /* v283: left-aligned */
    margin-right: auto;
  }
}

/* Half-width picture (Network Devices, slides 7 and 11): half the card width, in its place, left-aligned. Desktop only.
   Its own class, so the existing lesson-figure--half pictures on other pages are not changed. */
@media (min-width: 1024px) {
  .lesson-card .figure-group.figure-group:has(> .lesson-figure--half-card) {
    float: none !important;
    width: 50% !important;
    margin: 28px auto 28px 0;
    grid-template-columns: minmax(0, 1fr);
  }
  .lesson-card .lesson-figure.lesson-figure--half-card {
    width: 100%;
    margin-left: 0;
    margin-right: auto;
  }
}

/* Zoom animation: the picture grows quickly from about 40% to full size each time the viewer opens.
   The viewer uses the hidden attribute, so the animation replays on every open. */
@keyframes viewer-grow {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.image-viewer:not([hidden]) .image-viewer-img {
  animation: viewer-grow 0.22s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .image-viewer:not([hidden]) .image-viewer-img {
    animation: none; /* no zoom for visitors who ask for less motion */
  }
}

@media print {
  .image-viewer {
    display: none;
  }
}

/* ---- Teaching lessons: body layout with an "In this unit" box ----
   Phones and tablets: the box sits below the lesson text.
   1024px and up: the box is a sticky right column, 260px wide, inside the normal page width.
   Sizes follow the Fixwise page; only the lesson body is split into columns. */
.lesson-layout { display: block; }
.lesson-side { margin-top: 32px; }
.unit-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.unit-box-title { font-size: 1.15rem; margin: 0 0 4px; }
.unit-name { margin: 0 0 12px; color: var(--text-muted); font-weight: 600; }
.unit-list { list-style: none; margin: 0; padding: 0; }
.unit-list li { border-top: 1px solid var(--border); padding: 8px 0; }
.unit-list a { color: var(--link); }
.unit-back { margin: 0; padding: 12px 8px 4px; border-top: 1px solid var(--border); text-align: center; font-weight: 700; }
.unit-back a { color: var(--link); }
.unit-back--end { grid-column: 1 / -1; margin-top: 24px; padding: 24px 0 0; text-align: left; }
.unit-current { font-weight: 700; color: var(--title); }
.unit-todo { color: var(--text-muted); }
.keywords {
  background: var(--panel-green-bg);
  border-left: 6px solid var(--panel-green-border);
  border-radius: 4px;
  padding: 12px 16px;
  margin: 16px 0;
}
.keywords p { margin: 0; }
.lesson-figure { margin: 16px 0; }
.lesson-figure img { display: block; width: 100%; height: auto; border-radius: 6px; }
.lesson-figure figcaption { font-size: 0.9rem; color: var(--text-muted); margin-top: 6px; text-align: center; }
.lesson-table { border-collapse: collapse; width: 100%; }
.lesson-table th, .lesson-table td { border: 1px solid var(--border); padding: 8px; text-align: left; vertical-align: top; }
.lesson-table thead th { background: var(--table-head); } /* v196: filled top row */
.table-wrap { overflow-x: auto; }
/* Pros-and-cons tables (Intro to Networks): two equal columns holding bullet lists, with a gap between stacked tables */
.table-wrap + .table-wrap { margin-top: 24px; }
.lesson-table--lists { table-layout: fixed; }
.lesson-table--lists th { width: 50%; }
.lesson-table--lists td { overflow-wrap: anywhere; }
/* Comparison table (LAN / WLAN and WAN): two columns of equal width. */
.lesson-table--even { table-layout: fixed; }
.lesson-table--even th, .lesson-table--even td { width: 50%; }
/* Site-wide: any table whose header row has exactly two cells shares the width equally (50% each), on every page. */
.lesson-table:has(> thead > tr > th:first-child:nth-last-child(2)) { table-layout: fixed; }
.lesson-table:has(> thead > tr > th:first-child:nth-last-child(2)) th,
.lesson-table:has(> thead > tr > th:first-child:nth-last-child(2)) td { width: 50%; }
.callout {
  border-left: 6px solid var(--panel-blue-border);
  background: var(--panel-blue-bg);
  border-radius: 4px;
  padding: 12px 16px;
  margin: 16px 0;
}
.callout-green { border-left-color: var(--panel-green-border); background: var(--panel-green-bg); }
.callout-yellow { border-left-color: var(--panel-yellow-border); background: var(--panel-yellow-bg); }
.callout-red { border-left-color: var(--panel-red-border); background: var(--panel-red-bg); }
.callout-blue { border-left-color: var(--panel-blue-border); background: var(--panel-blue-bg); }
.todo {
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px dashed var(--warn-border);
  padding: 8px 12px;
  border-radius: 6px;
}

@media (min-width: 1024px) {
  .lesson-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 24px;
    align-items: stretch; /* the right column is as tall as the lesson, so the unit box can stick inside it */
  }
  .lesson-side {
    margin-top: 0;
  }
  /* The "In this unit" box sticks below the header. When the category row is hidden, the box moves up. */
  .unit-box {
    position: sticky;
    top: calc(var(--brand-h) + var(--nav-h) + 6px);
    transition: top 0.25s ease;
  }
  :root.nav-row-hidden .unit-box {
    top: calc(var(--brand-h) + 6px);
  }
}

/* Very narrow phones (under 360px): a smaller logo so the menu, search and theme buttons still fit. */
@media (max-width: 359.98px) {
  .brand img { height: 42px; }
}

/* Footer text on the dark slate footer (light theme). */
.site-footer, .footer-link { color: var(--footer-text); }

/* The Compute Lounge logo is grey, so it sits on a light tab in the blue header. */
.brand {
  background: var(--surface);
  border-radius: 4px;
  padding: 4px 8px;
}

/* ---------- Original site look: Verdana type, tighter boxes, square bullets, section lines ---------- */
body {
  font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
  font-size: 1.05rem;
  line-height: 1.4;
}

h1, h2, h3, .card-title {
  font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
  letter-spacing: 0;
  color: var(--title);
}
h1 { font-size: 2em; line-height: 1.2; }
h2 { font-size: 1.625em; }
h3 { font-size: 1.375em; }

/* Coloured boxes: less space above and below. Paragraph margins inside a box are removed at its edges. */
.callout { padding: 6px 16px; margin: 12px 0; }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }

/* Yellow definition boxes: one straight " at the start and one at the end (restored in v188). */
.callout-yellow p:first-child::before { content: "\""; }
.callout-yellow p:last-child::after { content: "\""; }

/* All text in yellow definition boxes is italic (Mark, 2026-12-02). */
.callout-yellow, .callout-yellow p, .callout-yellow li { font-style: italic; }

/* Square bullets with a smaller indent (unit lists keep their own style). */
.lesson ul:not(.unit-list),
.callout ul {
  list-style: square;
  padding-left: 1.25em;
  margin: 0.5em 0;
}
/* Bullet points on every page are #EF5D15 (Mark's colour). */
ul li::marker,
ol li::marker { color: #EF5D15; }
.lesson ul:not(.unit-list) li::marker,
.callout ul li::marker { color: #EF5D15; }

/* A 1px line between page sections. Space above the line (24px) matches the space below it (padding-top 24px). */
.lesson h2 {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: 24px;
}
/* v213: dividing line above Tablets, Smartphones and Phablets sections (same as h2). Space above matches space below (24px). */
.lesson h3.section-divider {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: 24px;
}
.course-section {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 28px;
}
.topic-title { margin-top: 16px; font-size: 1.1em; }

/* Previous and next lesson buttons: the arrow moves towards its direction on hover or focus. */
@media (prefers-reduced-motion: no-preference) {
  .guide-nav-arrow { transition: transform 0.2s ease; }
  /* v277: hover rests at the end of the arrow animation (8px), so the arrow finishes on its edge and does not jump back. */
  .guide-nav-prev:hover .guide-nav-arrow { transform: translateX(-8px); }
  .guide-nav-next:hover .guide-nav-arrow { transform: translateX(8px); }
  .guide-nav-prev:focus-visible .guide-nav-arrow { transform: translateX(-4px); }
  .guide-nav-next:focus-visible .guide-nav-arrow { transform: translateX(4px); }
}

/* Header panels: a course's sections in two columns, with the section names as labels. */
@media (min-width: 768px) {
  html.js .nav-group-panel {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
    width: max-content;
    max-width: min(560px, calc(100vw - 32px));
    max-height: 70vh;
    overflow-y: auto;
  }
  .nav-panel-label {
    display: none;
  }
  html.js .nav-panel-label {
    display: block;
    grid-column: 1 / -1;
    margin-top: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--chrome-text);
    opacity: 0.85;
  }
}

/* Phone menu: nested sections and their topics. */
.drawer-section-summary { cursor: pointer; list-style: none; }
.drawer-section-summary::-webkit-details-marker { display: none; }
.drawer-topic { padding-left: calc(var(--gutter) + 34px); }

/* ---------- Unit box and body text size (v159) ---------- */
/* The "In this unit" box uses the subheading font of the page, is centred, and its links use body size. */
.unit-box {
  text-align: center;
  font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
  background: #f5f6f7;                 /* very light grey */
  border-color: #dfe3e8;
}
:root[data-theme="dark"] .unit-box { background: var(--surface); border-color: var(--border); }
/* The "In this unit" title row: a light blue-grey band, the light version of the blue header. */
.unit-box-title {
  font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
  font-size: 1.375em;
  color: var(--title);
  background: #dfe7ef;
  margin: -16px -16px 4px;             /* pull the band out to the box edges (the box padding is 16px) */
  padding: 12px 16px;
  border-radius: 8px 8px 0 0;
}
:root[data-theme="dark"] .unit-box-title { background: #2b3a4f; }
.unit-name {
  font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
  font-size: 1.1em;
  font-weight: 700;
  color: var(--title);
}
.unit-list li { font-size: 1.05rem; }
/* v223: subtle background on the row for the lesson being read (the one with aria-current). */
.unit-list li:has(> .unit-current) { background: var(--current-row); }

/* Desktop: the unit box stays in view while the lesson scrolls. */
@media (min-width: 1024px) {
  .lesson-side { align-self: stretch; }
}

/* The new logo has white lettering on a transparent background, so it sits directly on the blue header. */
.brand { background: none; padding: 0; }

/* ---------- Unit box text and phone menu sections (v160) ---------- */
/* Under the "In this unit" heading: body size, not bold. */
.unit-name { font-size: 1.05rem; font-weight: 400; }

/* Phone menu: the sections (Theory, Practical, Year 7...) get the same animated + / minus sign as the courses,
   and the rows are a little shorter so the menu has less empty space. */
.drawer-section { margin: 0; padding: 0; }
.drawer-section-summary {
  position: relative;
  justify-content: space-between;
  min-height: 46px;
}
.drawer-section-summary::before,
.drawer-section-summary::after {
  content: "";
  position: absolute;
  right: var(--gutter);
  top: 50%;
  width: 16px;
  height: 2px;
  background: currentColor;
}
.drawer-section-summary::before { transform: translateY(-50%); }
.drawer-section-summary::after { transform: translateY(-50%) rotate(90deg); }
.drawer-section[open] > .drawer-section-summary::after { transform: translateY(-50%) rotate(0deg); }
@media (prefers-reduced-motion: no-preference) {
  .drawer-section-summary::after { transition: transform 0.25s ease; }
}
.drawer-topic { min-height: 44px; }

/* ---------- v161: numbered sections, end of topic bar, unit cards ---------- */
:root { --info-heading: #7dd3fc; }                 /* information headings, dark mode (10.7:1 on the dark background) */
:root[data-theme="light"] { --info-heading: #1d5f8a; } /* information headings, light mode (5.9:1 on the page) */

/* Information headings: numbered sections and h2 headings in lessons share one size and colour.
   No grey band or orange tag. The number is plain text, for example "1. Hardware". */
.numbered-section {
  display: block;
  margin: 28px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  background: none;
  color: var(--info-heading);
  font-size: 1.625em;                  /* the same as h2 */
  font-weight: 700;
  line-height: 1.2;
}
.number-tag {
  display: none;                       /* v174: the numbers are no longer shown; the headings stand alone */
  background: none;
  color: inherit;
  width: auto;
  height: auto;
  aspect-ratio: auto;
  padding: 0;
  margin-right: 0.3em;
  font-weight: 700;
  line-height: inherit;
}
.number-tag::after { content: "."; }
.lesson h2 { color: var(--info-heading); }

/* End of the topic: heading, percentage, green progress bar, then the next lesson. */
.lesson-end { margin: 32px 0 16px; border-top: 1px solid var(--border); padding-top: 16px; } /* v219: dividing line above End of the topic */
.end-title { color: var(--title); margin-top: 0; } /* v220: no extra space under the dividing line */
.progress {
  margin: 12px 0 16px;
  background: #ffffff;                 /* the part still to go is white */
  border: 1px solid var(--border);
  height: 1.8em;
}
.progress-bar {
  height: 100%;
  min-width: 3em;
  background: #66bb6a;   /* the original site's green, lightened a little (dark text still meets WCAG AA) */
  color: #1a1a1a;        /* dark text on this green meets WCAG AA (white does not) */
  font-weight: 700;
  text-align: center;
  line-height: 1.8em;
}

/* Course page: unit cards. Cards without a lesson yet are not links. */
.unit-icon { flex: none; width: 40px; height: 40px; color: var(--accent-cyan); }
.unit-icon-svg { display: block; width: 40px; height: 40px; }
.card-static { cursor: default; opacity: 0.85; }
.course-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.course-section .section-title { margin: 0 0 12px; }

/* Mobile (under 768px): a white page background in light mode. Desktop keeps the light grey. */
@media (max-width: 767.98px) {
  :root[data-theme="light"] { --bg: #ffffff; }
}

/* ---------- v168: borders on lesson images, header icons ---------- */
/* Lesson pictures: a thin light grey border, so white or pale pictures do not melt into the page. */
.lesson-figure img { border: 1px solid #cfd5dc; }
:root[data-theme="dark"] .lesson-figure img { border-color: #475569; }

/* Header buttons (colour theme, search, menu): white icons on the slate header bar, with a white outline.
   Only the buttons inside .header-tools change; the menu drawer keeps its own buttons. */
/* Each header icon takes one colour from the logo's rainbow stripe. */
.header-tools .icon-btn { background: transparent; }
.header-tools #themeToggle { color: #ffff00; border-color: #ffff00; }   /* yellow */
.header-tools #searchToggle { color: #00f200; border-color: #00f200; }  /* green */
.header-tools #menuToggle { color: #16f3fc; border-color: #16f3fc; }    /* cyan */
.header-tools #themeToggle:hover,
.header-tools #searchToggle:hover { border-color: #ffffff; }


/* v173: lesson pictures. On a phone, pictures sit two per row (grouped by generate.py). A picture marked
   is-wide, or one that is alone in its group, takes the full width. Tablet and desktop keep one picture per row. */
@media (max-width: 767px) {
  .figure-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 16px 0;
  }
  .figure-group > .lesson-figure { margin: 0; min-width: 0; }
  .figure-group > .lesson-figure.is-wide,
  .figure-group > .lesson-figure.is-phone-wide,
  .figure-group > .lesson-figure:only-child { grid-column: 1 / -1; }
  .figure-group .lesson-figure figcaption { font-size: 0.8rem; }
}

/* v177: analogue and digital clocks sit side by side at the same square size, at every width. */
.clock-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}
.clock-pair > .clock-figure { margin: 0; min-width: 0; }
.clock-pair .clock-figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
}
.clock-pair .clock-figure figcaption { font-size: 0.8rem; text-align: center; margin-top: 6px; }

/* v180: lesson picture rows. Phone: two per row. Tablet and desktop: up to four per row, depending on width. Wide or single pictures take the full row. */
/* Rule: at most three pictures side by side. Two pictures share the row, three or more fill three columns (wrapping).
   A single picture keeps to one column (half the width), unless it is wide (is-wide) and on its own, such as a very detailed diagram. */
@media (min-width: 768px) {
  .figure-group { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 16px 0; }
  .figure-group > .lesson-figure { margin: 0; min-width: 0; }
  .figure-group > .lesson-figure.is-wide:only-child { grid-column: 1 / -1; }
  .figure-group:has(> .lesson-figure:nth-child(3)) { grid-template-columns: repeat(3, 1fr); }
}

/* v182: pictures in the same row share one size. Cropped at 4:3 with the whole picture visible (contain). */
.figure-group > .lesson-figure:not(.is-wide) img {
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #ffffff;
}

/* v189: a small picture (class is-small, for simple cartoon pictures such as the section title pictures) that is
   alone in its group keeps a single column width instead of filling the whole row. */
.figure-group > .lesson-figure.is-small:only-child { grid-column: auto; }

/* v234: smaller heading placed above a picture inside a figure-group (e.g. Essential / Non-essential hardware). */
.figure-title { font-size: 1.1rem; margin: 0 0 8px; }

/* v191: sub-bullets (a list inside a list item) use a hyphen, not a square. Standing rule, 2026-11-30. */
.lesson ul:not(.unit-list) ul,
.callout ul ul {
  list-style-type: "- ";
}
.lesson ul:not(.unit-list) ul li::marker,
.callout ul ul li::marker { color: #EF5D15; }

/* Emerging Technologies lesson (v207): a little space between bullets in lists marked class "spaced". */
.lesson ul.spaced > li + li { margin-top: 0.6em; }

/* v198: lesson breadcrumb. Desktop shows full names and wraps if needed. Phones show the short names
   on one line (the line never wraps; a long name would be cut with an ellipsis). */
.crumb-short { display: none; }
@media (max-width: 767.98px) {
  .lesson-crumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lesson-crumb .crumb-full { display: none; }
  .lesson-crumb .crumb-short { display: inline; }
}

/* ---------- v200: collapsible unit cards on course pages ---------- */
/* A unit with lessons is one card. Its head is a button (icon, label, unit name, then a thick + on the
   right). Under it, a list of lesson links slides down. Units with no lessons yet stay static. */
.card-unit {
  padding: 0;
  gap: 0;
}

.unit-heading {
  margin: 0;
}

.card-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 16px 18px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card-toggle:focus-visible {
  outline: 3px solid var(--accent-cyan);
  outline-offset: -3px;
}

.unit-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

/* The + sign: two thick bars drawn with pseudo-elements. The horizontal bar stays still; the upright
   bar turns a quarter turn when the card opens, so the + becomes a minus (as the drawer groups do). */
.unit-toggle {
  position: relative;
  flex: none;
  width: 22px;
  height: 22px;
  color: inherit;
}

.unit-toggle::before,
.unit-toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.unit-toggle::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.card-toggle[aria-expanded="true"] .unit-toggle::after {
  transform: translate(-50%, -50%) rotate(0deg);
}

@media (prefers-reduced-motion: no-preference) {
  .unit-toggle::after {
    transition: transform 0.25s ease;
  }
}

/* The lesson list. With JavaScript on, it is hidden until the card opens (main.js animates it). */
.unit-panel {
  overflow: hidden;
}

html.js .unit-panel {
  display: none;
}

html.js .card-unit.is-open .unit-panel {
  display: block;
}

.unit-lessons {
  list-style: none;
  margin: 0;
  padding: 0 18px 12px 72px; /* lines up under the card title: 18px gutter + 40px icon + 14px gap */
  border-top: 1px solid var(--border);
}

.unit-lessons li {
  padding: 8px 0;
}

.unit-lessons li + li {
  border-top: 1px solid var(--border);
}

/* Site-wide: page text cannot be selected, so it cannot be dragged, copied or pasted.
   Form fields and the search boxes stay selectable and typeable. */
body {
  -webkit-user-select: none; /* Safari */
  user-select: none;
}

input,
textarea,
select,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}

/* First letters of W-I-M-P in the GUI features list, so the acronym stands out */
.wimp-initial {
  color: #d84315;
}


/* ---------- Unit overview pages ---------- */
/* Phones and tablets: text, then the drawn unit picture across the full width, then the lessons box, then the
   syllabus requirements. Desktop (1024px and up): text | picture | lessons box on the first row, and the
   syllabus requirements under the text and picture on the second row (the lessons box runs down the right). */
.unit-hero { display: block; margin: 16px 0; }
.unit-hero img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 8px; }
/* A unit without a drawn picture still shows its small pixel icon. */
.unit-hero--icon { width: 120px; height: 120px; }
.unit-hero--icon img { height: 100%; aspect-ratio: auto; image-rendering: pixelated; }
/* The syllabus block reuses the lesson heading styles: the h2 has the dividing line above it. */
.unit-syllabus { margin-top: 8px; }
.unit-syllabus > h2:first-child { margin-top: 16px; }
.unit-syllabus .syl-source { color: var(--text-muted); margin: 0 0 8px; }
/* "Including:" examples sit on their own line under the requirement they belong to. */
@media (min-width: 1024px) {
  .unit-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 260px;
    grid-template-areas:
      "text hero side"
      "syllabus syllabus side";
  }
  .unit-layout > .lesson:not(.unit-syllabus) { grid-area: text; }
  .unit-layout > .unit-hero { grid-area: hero; margin: 0; align-self: start; }
  .unit-layout > .unit-hero--icon { width: 200px; height: 200px; }
  .unit-layout > .lesson-side { grid-area: side; }
  .unit-layout > .unit-syllabus { grid-area: syllabus; margin-top: 0; }
}

/* ---------- Desktop lesson layout: white cards, floated single pictures, quick links (1024px and up) ---------- */
/* Phones and tablets do not use these rules: the lesson body stays one column on the page background. */
@media (min-width: 1024px) {
  /* Each section of a lesson (generate.py, wrap_cards) sits in its own white card with a small gap. */
  .lesson-card {
    background: var(--surface);
    border: 1px solid #d0d1d5; /* the grey card edge from the original site */
    border-radius: 4px;
    padding: 20px 24px;
    margin: 0 0 16px;
  }
  :root[data-theme="dark"] .lesson-card { border-color: var(--border); }
  .lesson-card::after { content: ""; display: block; clear: both; } /* keeps a floated picture inside its card */
  .lesson-card > h2:first-child,
  .lesson-card > h3.section-divider:first-child {
    border-top: 0;
    margin-top: 0;
    padding-top: 0;
  }

  /* A single picture (not is-wide) floats to the right of the text. Wide pictures and groups stay full width. */
  .figure-group:has(> .lesson-figure:only-child:not(.is-wide)) {
    float: right;
    width: 33%; /* one third of the card: text takes the other two thirds */
    margin: 4px 0 16px 24px;
    grid-template-columns: 1fr; /* the picture fills the floated box (the group has two columns otherwise) */
  }

  /* Quick links: course main page and units, at the top of the right column. They scroll with the page. */
  .quick-links {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 16px 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    text-align: center;
  }
  /* Heading band for the course menu: the light blue-grey of the "In this unit" band, with the blue heading colour. */
  .quick-links-title {
    font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
    font-size: 1.15rem;
    color: var(--info-heading);
    background: #dfe7ef;
    margin: 0 -16px 8px;
    padding: 12px 16px;
    border-radius: 8px 8px 0 0;
  }
  :root[data-theme="dark"] .quick-links-title { background: #2b3a4f; }
  .quick-links ul { list-style: none; margin: 0; padding: 0; }
  .quick-links li { padding: 3px 0; border-top: 1px solid var(--border); }
  /* Desktop: the In this unit list is more compact too (phones keep their spacing). */
  .unit-list li { padding: 4px 0; }
  .quick-links li:first-child { border-top: 0; }
  .quick-links a { color: var(--link); }
  .quick-links a[aria-current="page"] { font-weight: 700; }
  /* The current unit row gets the same green as the active lesson row in "In this unit". */
  .quick-links li:has(> a[aria-current="page"]) { background: var(--current-row); }
}

/* Phones and tablets: the quick links are not shown (the page works without them). */
@media (max-width: 1023.98px) {
  .quick-links { display: none; }
}

/* Some pictures appear twice in the lesson text, once for each layout, so phones keep their picture position.
   .lesson-figure--desktop: floats beside the text on desktop; hidden on phones and tablets.
   .lesson-figure--phone: the original position; hidden on desktop. Each is hidden with its figure-group wrapper. */
@media (max-width: 1023.98px) {
  .figure-group:has(> .lesson-figure--desktop:only-child) { display: none; }
  .lesson-figure--desktop { display: none; }
}
@media (min-width: 1024px) {
  .figure-group:has(> .lesson-figure--phone:only-child) { display: none; }
  .lesson-figure--phone { display: none; }
}

/* Desktop: boxes and lists beside a floated picture stop at the picture, with the 24px gap (the float's margin).
   flow-root makes a block start a new formatting context, which keeps its background clear of the float. */
@media (min-width: 1024px) {
  .lesson-card ul,
  .lesson-card ol,
  .lesson-card .callout,
  .lesson-card .table-wrap,
  .lesson-card .keywords {
    display: flow-root;
  }
}

/* Desktop: Lesson Objectives sit in the header card, under a dividing line. The heading loses its own line. */
@media (min-width: 1024px) {
  .lesson-head .lesson-objectives {
    border-top: 1px solid var(--border);
    margin-top: 20px;
    padding-top: 8px;
  }
  .lesson-head .lesson-objectives > h2 {
    border-top: 0;
    margin-top: 0;
    padding-top: 0;
  }
}

/* Desktop: a picture that is followed by a section divider starts just under the line, not above it.
   The divider sits 28px above the heading (its margin) and the heading has 16px of padding under the line. */
@media (min-width: 1024px) {
  .figure-group:has(> .lesson-figure:only-child:not(.is-wide)):has(+ h3.section-divider) {
    margin-top: 44px;
  }
}

/* Desktop: the "In this unit" heading matches the course menu heading above it (placed after the unit box rules). */
@media (min-width: 1024px) {
  .unit-box-title { font-size: 1.15rem; }
}

/* Desktop: the "In this unit" links are a little smaller. Phones keep the base size (1.05rem). */
@media (min-width: 1024px) {
  .unit-list li { font-size: 0.9rem; }
}

/* Desktop: the "In this unit" card has the same border and corner rounding as the course menu card above it. */
@media (min-width: 1024px) {
  .unit-box {
    border: 1px solid var(--border);
    border-radius: 8px;
  }
}

/* Desktop: a smaller gap between the header and the first card of a lesson, and the "In this unit" heading
   uses the same blue as the course menu heading above it. */
@media (min-width: 1024px) {
  main:has(.lesson-layout) { padding-top: 12px; }
  .unit-box-title { color: var(--info-heading); }
}

/* Desktop: a section divider moves below any picture floated beside the text above it, so the picture sits above the line.
   Exception: a picture placed directly above a divider keeps the divider beside it (the picture starts just under the line). */
@media (min-width: 1024px) {
  .lesson-card h3.section-divider { clear: right; }
  /* v283: numbered sections (e.g. "3. How hardware and software work together") also drop below a floated picture. */
  .lesson-card .numbered-section { clear: right; }
  .figure-group:has(> .lesson-figure:only-child:not(.is-wide, .lesson-figure--phone)) + h3.section-divider { clear: none; }
}

/* Desktop: a heading that follows a picture at the top of its card sits level with the picture (no divider line above it). */
@media (min-width: 1024px) {
  .lesson-card > .figure-group + h2 {
    border-top: 0;
    margin-top: 0;
    padding-top: 0;
  }
}

/* Desktop: "End of the topic" has no dividing line above it. Its card holds the end block, the pager and a breadcrumb.
   The "In this unit" card is white. The breadcrumb under the layout is for phones, so it is hidden here. */
@media (min-width: 1024px) {
  .lesson-end { border-top: 0; padding-top: 0; margin-top: 0; }
  .lesson-crumb--page { display: none; }
  .unit-box { background: var(--surface); }
  main:has(.lesson-layout) { padding-bottom: 24px; }
}
/* Phones and tablets: the breadcrumb inside the end card is not shown (the page breadcrumb below the layout is). */
@media (max-width: 1023.98px) {
  .lesson-crumb--card { display: none; }
}

/* Desktop: a little more space between the top breadcrumb and the lesson title, and between the
   navigation buttons and the breadcrumb at the end of the lesson card. */
@media (min-width: 1024px) {
  /* Top breadcrumb on desktop: 8px less space above, 4px more below (3 Dec 2026; above changed from 4px to 8px). */
  .lesson-head .lesson-crumb { margin-top: -8px; margin-bottom: 20px; }
  .lesson-crumb--card { margin-top: 28px; }
}

/* Pictures marked lesson-figure--pair (with their captions) always sit two per row, on every width.
   Placed last so it overrides the three-per-row rule above. */
.figure-group.figure-group:has(> .lesson-figure--pair) { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* v285: extra space above and below picture groups that are not next to a dividing line (all widths).
   28px instead of 16px. Where a group sits straight under a heading, or straight above a heading with a line
   (h2, or an h3 section divider), or last in its card, that side keeps 16px. Groups marked divider/half carry their own line.
   On desktop, a single picture floated beside text keeps its own margins (rules above win by specificity). */
.lesson-card .figure-group { margin-top: 28px; margin-bottom: 28px; }
.lesson-card h2 + .figure-group,
.lesson-card h3 + .figure-group { margin-top: 16px; }
/* A picture group directly under a blue box (Lesson Objectives) uses the box's 12px margin, not 28px. */
.lesson-card .callout-blue + .figure-group.figure-group { margin-top: 12px; }
.lesson-card .figure-group:has(+ h2),
.lesson-card .figure-group:has(+ h3.section-divider),
.lesson-card .figure-group:last-child { margin-bottom: 16px; }

/* ---------- v286: course pages on desktop (1024px and up): one white card, tinted unit cards inside ---------- */
/* generate.py course_content() wraps the breadcrumb, title and unit sections in .course-card. Phones and tablets
   keep the plain page. The unit cards (and their drop-down lesson lists) are tinted so they stand out on the white. */
@media (min-width: 1024px) {
  .course-card {
    background: var(--surface);
    border: 1px solid #d0d1d5; /* same card edge as the lesson cards */
    border-radius: 4px;
    padding: 20px 24px;
  }
  :root[data-theme="dark"] .course-card { border-color: var(--border); }
  .course-card .card-unit,
  .course-card .card-static,
  .course-card .card-link { background: #f1f5f9; }                    /* light: soft blue-grey (v289: home page course cards too) */
  :root[data-theme="dark"] .course-card .card-unit,
  :root[data-theme="dark"] .course-card .card-static,
  :root[data-theme="dark"] .course-card .card-link { background: var(--bg); }  /* dark: darker than the card */
}

/* ---------- v287: unit drop-down lessons on course pages: the row changes colour on hover, the link keeps its colour ---------- */
/* The orange text-link hover (v281) is switched off for these links. The row gets the same colour as the current row
   in the "In this unit" box (--current-row). The 8px side padding lets the colour reach past the text; the margin keeps the text where it was. */
.unit-lessons li {
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
}
@media (hover: hover) {
  .unit-lessons li:hover { background: var(--current-row); }
}
.unit-lessons li a:hover { color: var(--link); }

/* ---------- v288: whole row is the link in unit drop-downs; units numbered on desktop ---------- */
/* The link fills the row (the 8px side padding moved from the li to the link), so a click anywhere on the row opens the lesson. */
.unit-lessons li {
  padding: 0;
}
.unit-lessons li a {
  display: block;
  padding: 8px;
}
/* v295: the unit numbers on the IGCSE ICT course page were removed (the v288/v293 numbering block was here). */

/* ---------- v290: right-hand menus (course menu and "In this unit"): grey rows, whole row is the link ---------- */
/* Current unit and current lesson rows use --current-row, now grey (was pale amber). The row colour also shows on hover (devices that can hover).
   The padding moved from the li to the link, so a click anywhere on the row opens the page. The orange text-link hover (v281) is switched off here. */
.unit-list li,
.quick-links li { padding: 0; }
.unit-list li > a,
.unit-list li > .unit-current { display: block; padding: 8px 0; }            /* phones keep the old 8px row spacing */
@media (min-width: 1024px) {
  .unit-list li > a,
  .unit-list li > .unit-current { padding: 4px 0; }                            /* desktop: compact, as before */
  .quick-links li > a { display: block; padding: 3px 0; }
}
@media (hover: hover) {
  .unit-list li:hover,
  .quick-links li:hover { background: var(--current-row); }
}
.unit-list li a:hover,
.quick-links li a:hover { color: var(--link); }

/* ---------- v291: course pages: the bottom breadcrumb is inside the white card, as at the end of a lesson ---------- */
/* generate.py course_content() puts the bottom breadcrumb as the last item of .course-card. The card is then the last thing in main,
   so main keeps one 24px space above the footer (the v222 rule only matches a bottom breadcrumb that is directly in main). */
main:has(> .course-card:last-child > .breadcrumb--bottom:last-child) { padding-bottom: 24px; }

/* v295: the v294 header-blue current row was reverted; current rows use --current-row again (v292). */

/* ---------- v296: phones and tablets (under 1000px): the enlarged picture fits the screen ---------- */
/* Before: the picture opened at least 760px wide, wider than a phone screen, and had to be scrolled sideways.
   Now it opens to fit the screen (the whole picture is visible, keeping its shape: full width, and never taller than the screen
   less room for the Close button). Pinch-zoom still works (touch-action keeps pinch-zoom; the page has no zoom lock). */
@media (max-width: 999px) {
  .image-viewer-img {
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
  }
}

/* v286: a gap between bullet points in page text (lessons, guides, coloured boxes, About and other pages).
   Only plain bullet lists (no class), so unit lists, search results and the sitemap are not changed.
   Mark asked for more space (3 Dec 2026): 2px changed to 8px, then to 5px. */
main ul:not([class]) > li + li {
  margin-top: 5px;
}

/* v297: lesson table with a picture in each row (class lesson-table--pics, for example Examples of
   microprocessor-controlled / Smart devices). Desktop and tablet: a narrow name column, the text, and a picture
   column about a quarter wide. Phones (under 768px): each row stacks as name, text, picture. */
.lesson-table--pics { table-layout: fixed; }
.lesson-table--pics td:first-child { width: 18%; }
.lesson-table--pics td:last-child { width: 26%; }
.lesson-table--pics .figure-group { margin: 0; }
@media (max-width: 767px) {
  .lesson-table--pics, .lesson-table--pics tbody, .lesson-table--pics tr, .lesson-table--pics td { display: block; width: 100%; }
  .lesson-table--pics tr { border: 1px solid var(--border); margin-bottom: 12px; }
  .lesson-table--pics td { border: 0; }
  .lesson-table--pics td:first-child, .lesson-table--pics td:last-child { width: 100%; }
}

/* v298: a second picture beside the same section (class lesson-figure--below) goes under the first picture in the
   right-hand column instead of beside it, so the text keeps its two-thirds width (Effects of ICT on Transport). */
.figure-group:has(> .lesson-figure--below) { clear: right; }

/* v299: a label above a picture inside a figure (class figure-label), such as "Double entry" / "Visual check" (Stage 2: Design). */
.lesson-figure > .figure-label { margin: 0 0 6px; text-align: center; font-weight: 700; }

/* v300: a short, wide picture (class lesson-figure--natural) keeps its own shape instead of the 4:3 box, so a dialog box
   is not padded with white above and below (Stage 2: Design, the two validation messages). */
.figure-group > .lesson-figure.lesson-figure--natural img { aspect-ratio: auto; }

/* Syllabus extract opened in the picture viewer: a tall page, so it fits the screen width and the viewer scrolls down. */
.image-viewer.viewer-tall .image-viewer-img {
  width: min(100%, 900px);
  max-width: none;
  max-height: none;
  margin: 0 auto;
  align-self: flex-start; /* keep the page's own proportions instead of stretching to the screen height */
}
.image-viewer.viewer-tall .image-viewer-hint {
  display: none;
}

/* Larger arrow in the "back to all units" links */
.unit-back-arrow { font-size: 2em; font-weight: 400; line-height: 1; vertical-align: -0.1em; margin-right: 2px; text-decoration: none; display: inline-block; }

/* Unit lists as button rows: "Lessons in this unit" on overview pages and "In this unit" on lesson pages look the same.
   Tint, border and hover colours come from the same teal as the Previous / Next boxes (guide-nav). */
.unit-box .unit-list li,
.unit-box .unit-list li:hover,
.unit-box .unit-list li:has(> .unit-current) { border-top: 0; padding: 0; margin: 0 0 8px; background: transparent; }
.unit-box .unit-list a,
.unit-box .unit-list .unit-current,
.unit-box .unit-list .unit-todo {
  display: block;
  position: relative;
  padding: 10px 34px 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent-cyan) 55%, var(--border));
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-cyan) 14%, var(--surface));
  text-align: left;
  text-decoration: none;
  font-weight: 600;
}
.unit-box .unit-list a::after { content: "\203A"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 1.4em; line-height: 1; }
.unit-box .unit-list a:hover,
.unit-box .unit-list a:focus-visible { background: color-mix(in srgb, var(--accent-cyan) 28%, var(--surface)); text-decoration: underline; }
/* The lesson you are on: a stronger tint and border, no arrow. Lessons not built yet: plain and dashed. */
.unit-box .unit-list .unit-current { background: color-mix(in srgb, var(--accent-cyan) 32%, var(--surface)); border: 2px solid var(--accent-cyan); padding: 9px 13px; color: var(--title); font-weight: 700; }
.unit-box .unit-list .unit-todo { background: transparent; border-style: dashed; font-weight: 400; }
.unit-box .unit-back { border-top: 0; padding: 4px 0 0; }
.unit-layout .unit-box .unit-back a {
  display: block;
  padding: 10px 14px;
  border: 2px solid var(--link);
  border-radius: 6px;
  text-decoration: none;
}
.unit-layout .unit-box .unit-back a:hover,
.unit-layout .unit-box .unit-back a:focus-visible { background: var(--current-row); }
.unit-pager { grid-column: 1 / -1; margin-top: 32px; }

/* Lesson pages: the "IGCSE ICT" units box gets the same button look as "In this unit", in a lighter, shorter form,
   and the "In this unit" buttons are a little tighter so the right column is not much taller than before. */
.quick-links li,
.quick-links li:hover,
.quick-links li:has(> a[aria-current="page"]) { border-top: 0; padding: 0; margin: 0 0 6px; background: transparent; }
.quick-links li > a {
  display: block;
  padding: 6px 14px;
  border: 1px solid color-mix(in srgb, var(--accent-cyan) 55%, var(--border));
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-cyan) 14%, var(--surface));
  text-align: left;
  text-decoration: none;
  font-weight: 600;
}
.quick-links li > a:hover,
.quick-links li > a:focus-visible { background: color-mix(in srgb, var(--accent-cyan) 28%, var(--surface)); text-decoration: underline; }
.quick-links li > a[aria-current="page"] {
  background: color-mix(in srgb, var(--accent-cyan) 32%, var(--surface));
  border: 2px solid var(--accent-cyan);
  padding: 5px 13px;
  color: var(--title);
  font-weight: 700;
}
.lesson-layout:not(.unit-layout) .unit-box .unit-list li { margin-bottom: 6px; }
.lesson-layout:not(.unit-layout) .unit-box .unit-list a,
.lesson-layout:not(.unit-layout) .unit-box .unit-list .unit-todo { padding-top: 6px; padding-bottom: 6px; }
.lesson-layout:not(.unit-layout) .unit-box .unit-list .unit-current { padding-top: 5px; padding-bottom: 5px; }

/* Option A: lesson and unit link rows are white (the card colour) with a coloured bar on the left.
   The bar is navy (teal in dark mode) at rest and orange on hover and for the current lesson. */
.unit-box .unit-list a,
.unit-box .unit-list .unit-current,
.unit-box .unit-list .unit-todo,
.quick-links li > a,
.quick-links li > a[aria-current="page"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent-cyan);
  padding: 10px 34px 10px 10px;
  font-weight: 600;
}
.quick-links li > a,
.quick-links li > a[aria-current="page"] { padding: 6px 10px; }
.unit-box .unit-list a:hover,
.unit-box .unit-list a:focus-visible,
.quick-links li > a:hover,
.quick-links li > a:focus-visible {
  background: var(--current-row);
  border-left-color: #EF5D15;
}
.unit-box .unit-list .unit-current,
.quick-links li > a[aria-current="page"] {
  background: var(--current-row);
  border-left-color: #EF5D15;
  color: var(--title);
  font-weight: 700;
}
.unit-box .unit-list .unit-todo {
  background: transparent;
  border-left: 5px dashed var(--text-muted);
  color: var(--text-muted);
  font-weight: 400;
}
.lesson-layout:not(.unit-layout) .unit-box .unit-list a,
.lesson-layout:not(.unit-layout) .unit-box .unit-list .unit-todo,
.lesson-layout:not(.unit-layout) .unit-box .unit-list .unit-current { padding-top: 6px; padding-bottom: 6px; }

/* Option E: numbered lesson rows. The number badge is the lesson's place in the unit. Rows are white with a hairline border;
   hover turns the border and badge orange; the current lesson has a navy (teal in dark mode) badge and border. */
.unit-box .unit-list a,
.unit-box .unit-list .unit-current,
.unit-box .unit-list .unit-todo {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  padding: 8px 10px;
}
.unit-box .unit-list a::after { content: none; }
.unit-num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--current-row);
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}
.unit-box .unit-list a:hover,
.unit-box .unit-list a:focus-visible { background: var(--surface); border-color: #EF5D15; }
.unit-box .unit-list a:hover .unit-num,
.unit-box .unit-list a:focus-visible .unit-num { background: #FFA66B; color: #0f172a; }
:root[data-theme="light"] .unit-box .unit-list a:hover .unit-num,
:root[data-theme="light"] .unit-box .unit-list a:focus-visible .unit-num { background: #B84A00; color: #ffffff; }
.unit-box .unit-list .unit-current { background: var(--current-row); border: 1px solid var(--accent-cyan); }
.unit-box .unit-list .unit-current .unit-num { background: var(--accent-cyan); color: var(--bg); }
.unit-box .unit-list .unit-todo { border: 1px dashed var(--text-muted); }
.unit-box .unit-list .unit-todo .unit-num { background: transparent; border: 1px dashed var(--text-muted); color: var(--text-muted); line-height: 22px; }
.lesson-layout:not(.unit-layout) .unit-box .unit-list a,
.lesson-layout:not(.unit-layout) .unit-box .unit-list .unit-todo,
.lesson-layout:not(.unit-layout) .unit-box .unit-list .unit-current { padding-top: 6px; padding-bottom: 6px; }

/* v300: phones (under 768px): a 1px dividing line above the "In this unit" box on lesson pages, with the same
   24px of space above and below it. Unit overview pages (.unit-layout) keep their own layout. */
@media (max-width: 767.98px) {
  .lesson-layout:not(.unit-layout) > .lesson-side { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
}

/* v301: "IGCSE ICT main page" link at the bottom of the "In this unit" box on lesson pages (phones and tablets;
   on desktop the course menu card above already has this link). Same outlined button as on the unit overview pages. */
.lesson-layout:not(.unit-layout) .unit-box .unit-back--course { border-top: 0; padding: 4px 0 0; text-align: left; }
.lesson-layout:not(.unit-layout) .unit-box .unit-back--course a {
  display: block; padding: 10px 14px; border: 2px solid var(--link); border-radius: 6px; text-decoration: none;
}
.lesson-layout:not(.unit-layout) .unit-box .unit-back--course a:hover,
.lesson-layout:not(.unit-layout) .unit-box .unit-back--course a:focus-visible { background: var(--current-row); }
@media (min-width: 1024px) { .unit-back--course { display: none; } }

/* v302: phones (under 768px): 1px dividing line above the "In this unit" box on unit overview pages too
   (lesson pages got theirs in v300; overview pages use .unit-layout and were excluded). */
@media (max-width: 767.98px) {
  .unit-layout > .lesson-side { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
}

/* v303 (2026-12-05): desktop menus condensed, long "In this unit" lists fold to half with a button, and unit
   overview pages use the lesson layout (cards on the left, course menu and unit box on the right). Phones unchanged. */
@media (min-width: 1024px) {
  /* Course menu card: smaller text and tighter rows */
  .quick-links { font-size: 0.8rem; padding: 0 10px 6px; margin-bottom: 12px; }
  /* The heading band spans the card's 10px side padding, so it lines up with the link rows (the band's
     margin was -16px, which matched the old 16px padding and made the band wider than the links). */
  .quick-links-title { margin: 0 -10px 6px; padding: 10px; }
  .quick-links li,
  .quick-links li:hover,
  .quick-links li:has(> a[aria-current="page"]) { margin: 0 0 3px; }
  .quick-links li > a,
  .quick-links li > a[aria-current="page"] { padding: 3px 8px; line-height: 1.25; }

  /* "In this unit" box: smaller text, smaller numbers, tighter rows */
  .unit-box .unit-list li,
  .unit-box .unit-list li:hover,
  .unit-box .unit-list li:has(> .unit-current) { margin: 0 0 4px; }
  .unit-box .unit-list a,
  .unit-box .unit-list .unit-current,
  .unit-box .unit-list .unit-todo { padding: 4px 8px 4px 6px; font-size: 0.8rem; line-height: 1.25; gap: 6px; }
  .unit-box .unit-num,
  .unit-box .unit-list .unit-todo .unit-num { width: 20px; height: 20px; font-size: 0.7rem; line-height: 20px; }
  .unit-box .unit-back { padding: 4px 0 0; font-size: 0.8rem; }

  /* Long lists: the first half shows, and a button shows the rest (js/main.js). Off unless the page runs JS. */
  html.js .unit-collapsible:not(.is-open) .unit-more { display: none; }
  html.js .unit-more-btn {
    display: block;
    width: 100%;
    margin: 0 0 4px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--link);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
  }
  html.js .unit-more-btn:hover { background: var(--current-row); }
  html.js .unit-more-btn:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }

  /* Unit overview: the picture floats beside the lead text, as pictures do on lesson pages. */
  .lesson-card .unit-hero { float: right; width: 33%; margin: 4px 0 16px 24px; }
  .lesson-card .unit-hero--icon { width: 200px; height: 200px; }
  .lesson-card .unit-syllabus { margin-top: 0; }
  .lesson-foot .unit-pager { margin-top: 0; }
}
.unit-more-btn { display: none; } /* phones and tablets: every lesson shows, so the button stays hidden */

/* v304 (2026-12-05): desktop only. Links keep one weight and one border width in every state, so nothing moves on
   hover or when a row is current (only colour changes). Rows are condensed further, and the show-more button is solid. */
@media (min-width: 1024px) {
  .unit-box .unit-list a,
  .unit-box .unit-list a:hover,
  .unit-box .unit-list a:focus-visible,
  .unit-box .unit-list .unit-current,
  .unit-box .unit-list .unit-todo,
  .quick-links li > a,
  .quick-links li > a:hover,
  .quick-links li > a:focus-visible,
  .quick-links li > a[aria-current="page"] {
    font-weight: 600;
    border-width: 1px;
    border-left-width: 4px;
    text-decoration-thickness: 1px;
  }
  .quick-links { font-size: 0.75rem; }
  .quick-links li > a,
  .quick-links li > a[aria-current="page"] { padding: 2px 6px; line-height: 1.2; }
  .quick-links li,
  .quick-links li:hover,
  .quick-links li:has(> a[aria-current="page"]) { margin: 0 0 2px; }
  .unit-box .unit-list a,
  .unit-box .unit-list .unit-current,
  .unit-box .unit-list .unit-todo { padding: 3px 6px; font-size: 0.75rem; line-height: 1.2; gap: 5px; }
  .unit-box .unit-num,
  .unit-box .unit-list .unit-todo .unit-num { width: 18px; height: 18px; font-size: 0.65rem; line-height: 18px; }
  .unit-box .unit-list li,
  .unit-box .unit-list li:hover,
  .unit-box .unit-list li:has(> .unit-current) { margin: 0 0 3px; }
  .unit-box .unit-back { font-size: 0.75rem; }

  /* Show-more button: solid, so it reads as a control. Dark mode uses the light cyan. */
  html.js .unit-more-btn {
    background: #1d5f8a;
    border-color: #1d5f8a;
    color: #ffffff;
    padding: 5px 8px;
    font-size: 0.75rem;
  }
  html.js .unit-more-btn:hover { background: #15496b; border-color: #15496b; color: #ffffff; }
  :root[data-theme="dark"] html.js .unit-more-btn { background: #7dd3fc; border-color: #7dd3fc; color: #0f172a; }
  :root[data-theme="dark"] html.js .unit-more-btn:hover { background: #bae6fd; border-color: #bae6fd; color: #0f172a; }
}

/* v305 (2026-12-05): desktop only. The grey left bar is gone: every link row has the same 1px border on all sides.
   Hover, focus and current rows change colour and an inset outline (box-shadow), which takes no room, so no row moves.
   Rows are condensed further. */
@media (min-width: 1024px) {
  .unit-box .unit-list a,
  .unit-box .unit-list .unit-current,
  .unit-box .unit-list .unit-todo,
  .quick-links li > a,
  .quick-links li > a[aria-current="page"] {
    border: 1px solid var(--border);
    border-left: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: none;
    padding: 2px 6px;
    font-size: 0.7rem;
    line-height: 1.2;
    font-weight: 600;
  }
  .unit-box .unit-list a:hover,
  .unit-box .unit-list a:focus-visible,
  .quick-links li > a:hover,
  .quick-links li > a:focus-visible {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: inset 0 0 0 2px #EF5D15;
    text-decoration: none;
    font-weight: 600;
  }
  .unit-box .unit-list .unit-current,
  .quick-links li > a[aria-current="page"] {
    background: var(--current-row);
    border-color: var(--border);
    box-shadow: inset 0 0 0 2px #EF5D15;
    color: var(--title);
    font-weight: 600;
  }
  .unit-box .unit-list .unit-todo { background: transparent; border-style: dashed; }
  .unit-box .unit-list a::after { content: none; }
  .unit-box .unit-num,
  .unit-box .unit-list .unit-todo .unit-num { width: 16px; height: 16px; font-size: 0.6rem; line-height: 16px; }
  .unit-box .unit-list a,
  .unit-box .unit-list .unit-current,
  .unit-box .unit-list .unit-todo { gap: 4px; }
  .unit-box .unit-list li,
  .unit-box .unit-list li:hover,
  .unit-box .unit-list li:has(> .unit-current),
  .quick-links li,
  .quick-links li:hover,
  .quick-links li:has(> a[aria-current="page"]) { margin: 0 0 2px; padding: 0; background: transparent; }
  .quick-links { font-size: 0.7rem; }
}

/* v305b (2026-12-05): the site-wide bullet spacing (5px above every list item after the first) applied at rest only,
   so rows moved when hovered. Desktop menus now use the same 2px spacing in every state. */
@media (min-width: 1024px) {
  main .quick-links ul > li + li,
  main .unit-box .unit-list > li + li,
  main .quick-links ul > li + li:hover,
  main .unit-box .unit-list > li + li:hover { margin-top: 2px !important; }
}

/* v305c (2026-12-05): an earlier desktop rule gave hovered and current rows a 4px left border, which pushed the text
   3px to the right. Every state now has the same 1px left border, so the text stays still. */
@media (min-width: 1024px) {
  .unit-box .unit-list a,
  .unit-box .unit-list a:hover,
  .unit-box .unit-list a:focus-visible,
  .unit-box .unit-list .unit-current,
  .unit-box .unit-list .unit-todo,
  .quick-links li > a,
  .quick-links li > a:hover,
  .quick-links li > a:focus-visible,
  .quick-links li > a[aria-current="page"] {
    border-left-width: 1px;
  }
}

/* v306 (2026-12-05): desktop only. Show-more button back to the light grey look. The current unit or lesson is bold
   with a thick dark grey border (an inset outline, so the text does not move). Dark mode uses light grey. */
@media (min-width: 1024px) {
  html.js .unit-more-btn {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #1f2937;
  }
  html.js .unit-more-btn:hover { background: #d1d5db; border-color: #6b7280; color: #111827; }
  :root[data-theme="dark"] html.js .unit-more-btn { background: #334155; border-color: #64748b; color: #f1f5f9; }
  :root[data-theme="dark"] html.js .unit-more-btn:hover { background: #475569; border-color: #94a3b8; color: #ffffff; }

  .unit-box .unit-list .unit-current,
  .quick-links li > a[aria-current="page"] {
    font-weight: 700;
    border-color: #374151;
    box-shadow: inset 0 0 0 2px #374151;
  }
  :root[data-theme="dark"] .unit-box .unit-list .unit-current,
  :root[data-theme="dark"] .quick-links li > a[aria-current="page"] {
    border-color: #cbd5e1;
    box-shadow: inset 0 0 0 2px #cbd5e1;
  }
}

/* v307 (2026-12-05): desktop only. Hovering a unit or lesson link gives a light grey fill, with no orange border.
   The current unit or lesson keeps its dark grey border on hover. Dark mode uses a darker grey. */
@media (min-width: 1024px) {
  .unit-box .unit-list a:hover,
  .unit-box .unit-list a:focus-visible,
  .quick-links li > a:hover,
  .quick-links li > a:focus-visible {
    background: #d1d5db;
    border-color: var(--border);
    box-shadow: none;
  }
  .unit-box .unit-list .unit-current:hover,
  .unit-box .unit-list .unit-current:focus-visible,
  .quick-links li > a[aria-current="page"]:hover,
  .quick-links li > a[aria-current="page"]:focus-visible {
    background: var(--current-row);
    border-color: #374151;
    box-shadow: inset 0 0 0 2px #374151;
  }
  :root[data-theme="dark"] .unit-box .unit-list a:hover,
  :root[data-theme="dark"] .unit-box .unit-list a:focus-visible,
  :root[data-theme="dark"] .quick-links li > a:hover,
  :root[data-theme="dark"] .quick-links li > a:focus-visible {
    background: #334155;
  }
  :root[data-theme="dark"] .unit-box .unit-list .unit-current:hover,
  :root[data-theme="dark"] .unit-box .unit-list .unit-current:focus-visible,
  :root[data-theme="dark"] .quick-links li > a[aria-current="page"]:hover,
  :root[data-theme="dark"] .quick-links li > a[aria-current="page"]:focus-visible {
    border-color: #cbd5e1;
    box-shadow: inset 0 0 0 2px #cbd5e1;
  }
}

/* v308 (2026-12-05): desktop only. Hovering a unit or lesson link keeps the font colour it has at rest and adds an
   underline. No orange text. The current unit or lesson keeps its title colour on hover. */
@media (min-width: 1024px) {
  .unit-box .unit-list a:hover,
  .unit-box .unit-list a:focus-visible,
  .quick-links li > a:hover,
  .quick-links li > a:focus-visible {
    color: var(--link) !important;
    text-decoration: underline !important;
  }
  .unit-box .unit-list .unit-current:hover,
  .unit-box .unit-list .unit-current:focus-visible,
  .quick-links li > a[aria-current="page"]:hover,
  .quick-links li > a[aria-current="page"]:focus-visible {
    color: var(--title) !important;
    text-decoration: underline !important;
  }
}

/* v309 (2026-12-05): desktop only. The lesson number turns solid teal (#0f766e) with white text on hover or focus. */
@media (min-width: 1024px) {
  .unit-box .unit-list a:hover .unit-num,
  .unit-box .unit-list a:focus-visible .unit-num {
    background: #0f766e !important;
    color: #ffffff !important;
  }
}

/* v310 (2026-12-05): phones (under 768px), unit overview pages only. Order: text, unit picture (under the text), lesson links
   ("In this unit" box), syllabus requirements, then the Previous/Next unit buttons. The page is an article (heading card,
   syllabus, pager) followed by the side box, so display: contents lets the cards and the side box be ordered as
   one column. Desktop and tablets keep the existing layout. */
@media (max-width: 767.98px) {
  .lesson-layout:has(.unit-syllabus) { display: flex; flex-direction: column; }
  .lesson-layout:has(.unit-syllabus) > .lesson { display: contents; }
  .lesson-layout:has(.unit-syllabus) .lesson-head { order: 1; }
  .lesson-layout:has(.unit-syllabus) > .lesson-side { order: 2; }
  .lesson-layout:has(.unit-syllabus) .unit-syllabus { order: 3; margin-top: 8px; }
  .lesson-layout:has(.unit-syllabus) .lesson-foot { order: 4; }
  /* Inside the heading card: breadcrumb, title and lead text first, then the unit picture. */
  .lesson-layout:has(.unit-syllabus) .lesson-head { display: flex; flex-direction: column; }
  .lesson-layout:has(.unit-syllabus) .lesson-head > .unit-hero { order: 1; margin: 16px 0 24px; }
}

/* v311 (2026-12-05): lesson tables, all screen sizes. The paragraphs inside table cells carried the page's 16.8px
   top and bottom margin on top of the 8px cell padding, so a one-line row was 74px tall. Cell paragraphs and lists
   now have no top margin, a 6px gap separates paragraphs and lists in one cell, nothing sits below the last one, and the cell padding is 6px 8px. */
.lesson-table th, .lesson-table td { padding: 6px 8px; }
.lesson-table td > p, .lesson-table td > ul { margin-top: 0; margin-bottom: 6px; }
.lesson-table td > :last-child, .lesson-table th > :last-child { margin-bottom: 0; }

/* v312: lesson table with the text on the left and a picture on the right in each row (class lesson-table--steps,
   for example the encryption steps in Protection of Data). The picture column is 42% wide, so each 4:3 diagram is
   large enough to read, and the picture fills its cell instead of floating at one third width. The selectors are
   long so they beat the site-wide two-column rule (50% each) and the floating single-picture rule.
   Phones (under 768px): each row stacks as the text, then the picture at full width. */
.lesson-table.lesson-table--steps:has(> thead > tr > th:first-child:nth-last-child(2)) { table-layout: fixed; }
.lesson-table.lesson-table--steps:has(> thead > tr > th:first-child:nth-last-child(2)) th:first-child,
.lesson-table.lesson-table--steps:has(> thead > tr > th:first-child:nth-last-child(2)) td:first-child { width: 58%; }
.lesson-table.lesson-table--steps:has(> thead > tr > th:first-child:nth-last-child(2)) th:last-child,
.lesson-table.lesson-table--steps:has(> thead > tr > th:first-child:nth-last-child(2)) td:last-child { width: 42%; }
.lesson-card .lesson-table.lesson-table--steps .figure-group,
.lesson-card .lesson-table.lesson-table--steps .figure-group:has(> .lesson-figure:only-child:not(.is-wide)) {
  float: none; display: block; width: auto; margin: 0;
}
.lesson-table--steps .lesson-figure { margin: 0; }
.lesson-table--steps .lesson-figure img { width: 100%; height: auto; aspect-ratio: 4 / 3; }
@media (max-width: 767.98px) {
  .lesson-table.lesson-table--steps, .lesson-table--steps tbody, .lesson-table--steps tr, .lesson-table--steps td { display: block; width: 100%; }
  .lesson-table--steps thead { display: none; }
  .lesson-table--steps tr { border: 1px solid var(--border); margin-bottom: 12px; }
  .lesson-table--steps td { border: 0; }
  .lesson-table.lesson-table--steps:has(> thead > tr > th:first-child:nth-last-child(2)) td:first-child,
  .lesson-table.lesson-table--steps:has(> thead > tr > th:first-child:nth-last-child(2)) td:last-child { width: 100%; }
}

/* v312: desktop text size (1024px and up). Mark asked for the text size most sites use (16px).
   The page base was 1.05rem (16.8px); body copy, the lead text and the unit lists now use 1rem (16px).
   Headings use em, so they scale with it. Phones and tablets, the header and the sizes of boxes are unchanged. */
@media (min-width: 1024px) {
  body,
  .lead,
  .unit-list li,
  .unit-name { font-size: 1rem; }
}

/* v313 (2026-12-05): phones and tablets (under 1024px). Pressing, hovering or focusing a lesson or unit link used to
   turn its border orange and its number badge burnt orange, and the current row of the course menu kept an orange
   left border. They now use the site's slate blue (--accent-cyan: #36587f in light mode, teal in dark mode), the same
   colour as the current lesson row. The pressed row also takes the row colour. Desktop was already free of orange. */
@media (max-width: 1023px) {
  .unit-box .unit-list a:hover,
  .unit-box .unit-list a:active,
  .unit-box .unit-list a:focus-visible {
    background: var(--current-row);
    border-color: var(--accent-cyan);
  }
  .unit-box .unit-list a:hover .unit-num,
  .unit-box .unit-list a:active .unit-num,
  .unit-box .unit-list a:focus-visible .unit-num,
  :root[data-theme="light"] .unit-box .unit-list a:hover .unit-num,
  :root[data-theme="light"] .unit-box .unit-list a:active .unit-num,
  :root[data-theme="light"] .unit-box .unit-list a:focus-visible .unit-num {
    background: var(--accent-cyan);
    color: var(--bg);
  }
  .quick-links li > a:hover,
  .quick-links li > a:active,
  .quick-links li > a:focus-visible,
  .quick-links li > a[aria-current="page"] {
    border-left-color: var(--accent-cyan);
  }
}

/* v314: "In this unit" box of a unit overview page that has no lessons yet (the practical units). */
.unit-box .unit-empty {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Header logo: the CL icon on phones (under 768px), the full logo from tablet width up. */
@media (max-width: 767.98px) {
  .brand-logo--full { display: none; }
}
@media (min-width: 768px) {
  .brand-logo--icon { display: none; }
}
/* The mark's artwork is cropped to its letters and colour bar (viewBox 10 12 44 40), so at 44px high
   the letters and bar line up with the header buttons (.icon-btn, 44px). Width follows the shape. */
html.js .brand img.brand-logo--icon {
  height: 44px;
  width: auto;
}

/* A word the visitor searched for, highlighted in the lesson text (js/main.js, section 3). */
mark.find-hit {
  background: #fde68a;
  color: #1f2937;
  padding: 0 2px;
  border-radius: 2px;
  scroll-margin-top: 120px;
}

/* A summary over 3 lines is cut short, with a + button (a minus when open) at the right edge under it. js/main.js (section 4) adds the class and the button only when the
   text is longer than that; without the script everything is shown in full. */
html.js .is-clamped {
  display: -webkit-box;
  -webkit-line-clamp: var(--clamp-lines, 4);
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.has-toggle { margin-bottom: 0 !important; }
.clamp-toggle {
  display: block;
  margin: 0 auto 10px;
  padding: 0 14px;
  min-width: 44px;
  min-height: 32px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
/* Key words box: a heading line with a + at the right that opens the list (a minus when open). */
.keywords summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  cursor: pointer;
  list-style: none;
}
.keywords summary::-webkit-details-marker { display: none; }
.keywords summary::after {
  content: "+";
  margin-left: auto;
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}
.keywords[open] summary::after { content: "\2212"; }
.keywords[open] summary { margin-bottom: 6px; }
.keywords .kw-count { color: var(--text-muted); font-size: 0.9rem; }
/* Summary: the + sits at the right edge, just under the text. */
.lead + .clamp-toggle {
  margin: 0 0 8px auto;
  padding: 0 4px;
}
