/* TMIMI Explains: short films, each with a page that goes further. Shared by the hub and every episode page.
   Standalone on purpose: none of css/style.css or the course widgets load here. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --ink: #16161f;
  --ink-2: #474756;
  --ink-3: #62626f;
  --rule: #e2dfd7;
  --rule-strong: #cbc7bc;
  --accent: #4f46e5;
  --accent-hover: #3730a3;
  --accent-soft: rgba(79, 70, 229, .09);
  --on-accent: #fff;
  --ok: #17784f;
  --no: #b3261e;
  /* Borders that identify a control: 3:1 against the card and the control's own fill (WCAG 1.4.11). */
  --control: #8f8a7f;
  --wire: linear-gradient(90deg, #ff3d8b 0%, #7a5cff 55%, #2f7dff 100%);
  --shadow: 0 1px 2px rgba(22, 22, 31, .05), 0 8px 28px rgba(22, 22, 31, .07);

  /* One colour, one meaning, shared with the films (animation review §2.3). The films' colours are the dark
     theme's; the light theme uses darker equivalents so that text in them keeps 4.5:1 on every surface. */
  --req: #0369a1;   /* request, client          film #7dd3fc */
  --res: #5a47c8;   /* response, server         film #a8a3ff */
  --data: #9a5b00;  /* body, data only          film #fbbf24 */
  --priv: #be185d;  /* private address, inside  film #ff6aa9 */
  --pub: #1d4ed8;   /* public address, outside  film #6ea8ff */
  --s2: #17784f;    /* 2xx success              film #5fd3a0 */
  --s3: #474756;    /* 3xx look elsewhere: neutral, drawn dashed */
  --s4: #c2410c;    /* 4xx request problem      film #fb923c */
  --s5: #b91c1c;    /* 5xx server problem       film #f87171 */
  --req-soft: color-mix(in srgb, var(--req) 8%, var(--surface));
  --res-soft: color-mix(in srgb, var(--res) 8%, var(--surface));
  --priv-soft: color-mix(in srgb, var(--priv) 8%, var(--surface));
  --pub-soft: color-mix(in srgb, var(--pub) 8%, var(--surface));
  --data-soft: color-mix(in srgb, var(--data) 8%, var(--surface));

  /* Code panels and terminals stay dark in both themes, like the films and the course examples. */
  --code-bg: #12141d;
  --code-rule: #2a2e3e;
  --code-control: #646a80;
  --code-focus: #a8a3ff;
  --code-ink: #e6e8f0;
  --code-dim: #8d93a8;
  /* HTTP message parts: the course's legend (module 0), and the films'. */
  --part-start: #7dd3fc;
  --part-name: #d2dbea;
  --part-value: #a5b4c8;
  --part-body: #fbbf24;
  --code-res: #a8a3ff;
  --code-priv: #ff6aa9;
  --code-pub: #6ea8ff;
  --code-s2: #5fd3a0;
  --code-s4: #fb923c;

  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 14px;
  --gutter: 20px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1017;
  --surface: #171923;
  --surface-2: #1e2130;
  --ink: #ecebf3;
  --ink-2: #b9b9c8;
  --ink-3: #9a9aad;
  --rule: #2a2d3c;
  --rule-strong: #3a3e51;
  --accent: #a8a3ff;
  --accent-hover: #c9c6ff;
  --accent-soft: rgba(168, 163, 255, .12);
  --on-accent: #12131a;
  --ok: #5fd3a0;
  --no: #ff8a80;
  --control: #6b6f86;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  --req: #7dd3fc; --res: #a8a3ff; --data: #fbbf24; --priv: #ff6aa9; --pub: #6ea8ff;
  --s2: #5fd3a0; --s3: #b9b9c8; --s4: #fb923c; --s5: #f87171;
  --code-bg: #0a0b11;
  --code-rule: #262a3a;
}

/* No script, no saved choice: follow the system. Same values as the block above. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0f1017; --surface: #171923; --surface-2: #1e2130;
    --ink: #ecebf3; --ink-2: #b9b9c8; --ink-3: #9a9aad;
    --rule: #2a2d3c; --rule-strong: #3a3e51;
    --accent: #a8a3ff; --accent-hover: #c9c6ff; --accent-soft: rgba(168, 163, 255, .12); --on-accent: #12131a;
    --ok: #5fd3a0; --no: #ff8a80; --control: #6b6f86;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
    --req: #7dd3fc; --res: #a8a3ff; --data: #fbbf24; --priv: #ff6aa9; --pub: #6ea8ff;
    --s2: #5fd3a0; --s3: #b9b9c8; --s4: #fb923c; --s5: #f87171;
    --code-bg: #0a0b11; --code-rule: #262a3a;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
code, kbd, pre { font-family: var(--font-mono); font-variant-ligatures: none; }
:not(pre) > code {
  font-size: .88em;
  padding: .1em .35em;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  white-space: nowrap;
}
kbd {
  font-size: .84em; padding: .08em .4em; border-radius: 5px;
  background: var(--surface); border: 1px solid var(--rule-strong); border-bottom-width: 2px; white-space: nowrap;
}
/* On a phone a long value (HTTP/1.1 404 Everything is fine) can be wider than the line and push the page
   sideways. An inline-block still moves to the next line whole, but then wraps inside; it stops one character
   short of the line so a following full stop stays with it. Not wider up: there Chrome would break between
   the block and its punctuation, which nowrap never does. */
@media (max-width: 480px) {
  :not(pre) > code { display: inline-block; max-width: calc(100% - 1ch); line-height: 1.3; white-space: normal; overflow-wrap: anywhere; }
}
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: var(--gutter); }
.prose { max-width: 680px; margin-inline: auto; }
.wide { max-width: 960px; margin-inline: auto; }

/* ---------- Header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-head__bar { display: flex; align-items: center; gap: 12px; min-height: 60px; }
/* The series name sits on two short lines ("Mehdi Tmimi" over "Explains"), so it fits a 320 px phone
   next to the navigation without being cut. */
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand:hover { color: var(--ink); }
.brand img { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.brand__text { display: grid; min-width: 0; line-height: 1.1; }
.brand__by { font-weight: 600; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; letter-spacing: -.005em; white-space: nowrap; }
.site-nav { display: flex; align-items: center; gap: 4px; flex: none; }
.site-nav a {
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .92rem;
  padding: 8px 10px; border-radius: 999px; white-space: nowrap;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.theme-toggle {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 999px; border: 1px solid var(--control); background: var(--surface); color: var(--ink);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--ink-3); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: none; }
}
@media (max-width: 560px) {
  .site-nav a.hide-sm { display: none; }
}
@media (max-width: 400px) {
  .site-head__bar { gap: 8px; }
  .site-nav a { padding-inline: 8px; }
}
@media (max-width: 339px) { .brand img { display: none; } }

/* ---------- The wire: the section's mark. A request goes out, a response comes back. ---------- */
/* Packets sit in flow, 12% in from each end (less on phones), so they can never overlap; if they
   cannot share a row they stack on either side of the line. */
.wire {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  min-height: 34px; margin: 28px 0 32px; padding-inline: clamp(4%, (100% - 300px) / 2, 12%);
}
.wire::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; transform: translateY(-50%);
  background: var(--wire); border-radius: 2px; opacity: .85;
}
.wire__pkt {
  position: relative;
  font: 600 .72rem/1 var(--font-mono); letter-spacing: .02em;
  padding: 6px 9px; border-radius: 7px;
  background: var(--code-bg); color: var(--part-start);
  border: 1px solid var(--code-rule);
  white-space: nowrap;
}
.wire__pkt::after { content: " →"; color: var(--code-dim); }
.wire__pkt--back { margin-left: auto; color: var(--code-res); }
.wire__pkt--back::after { content: ""; }
.wire__pkt--back::before { content: "← "; color: var(--code-dim); }

/* ---------- Hero ---------- */
.hero { padding: 44px 0 0; }
.eyebrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 18px;
  font-size: .75rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3);
}
/* Underlined because its colour alone barely differs from the grey crumbs around it (WCAG 1.4.1). */
.eyebrow a { color: var(--accent); text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: .3em; }
.eyebrow a:hover { text-decoration-color: currentColor; }
.eyebrow .sep { color: var(--rule-strong); }
.hero h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.05rem, 5.8vw, 3.35rem); line-height: 1.1; letter-spacing: -.01em;
  margin: 0 0 18px; max-width: 21ch; text-wrap: balance;
}
.lede { font-size: clamp(1.1rem, 2.4vw, 1.3rem); line-height: 1.55; color: var(--ink-2); margin: 0 0 18px; max-width: 58ch; }
/* Each dot sits in the gap before its item, so a dot that would start a wrapped line falls outside and is clipped. */
.byline { display: flex; flex-wrap: wrap; gap: 4px 24px; font-size: .9rem; color: var(--ink-3); margin: 0; overflow: hidden; }
.byline > span + span::before { content: "·"; display: inline-block; width: 24px; margin-left: -24px; text-align: center; color: var(--rule-strong); }

/* ---------- Film (lite embed) ---------- */
.film { margin: 0 0 12px; }
.film__frame {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; container-type: inline-size;
  border-radius: var(--radius); background: #0b0c12; box-shadow: var(--shadow);
}
.film__frame img, .film__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
/* Scales with the frame so that on a phone it does not cover the poster's title. */
.film__play {
  position: absolute; inset: 0; margin: auto;
  width: clamp(52px, 17cqi, 84px); height: clamp(52px, 17cqi, 84px); border-radius: 999px;
  display: grid; place-items: center; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .94); color: #16161f; box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  transition: transform .2s ease;
}
.film__play:hover { transform: scale(1.06); }
/* The display above would beat the browser's own [hidden] rule: without script, a play button that does nothing. */
.film__play[hidden] { display: none; }
.film__play svg { width: 36%; height: 36%; margin-left: 6%; }
/* Before the film is online: a quiet label on the poster. Bottom-left on narrow frames, top-right from 720 px. */
.film__status {
  position: absolute; left: 10px; bottom: 10px; margin: 0;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .74rem; font-weight: 600; line-height: 1.2; letter-spacing: .02em; color: #fff;
  background: rgba(10, 11, 17, .84); padding: 6px 11px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
}
.film__status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid #fff; }
@media (max-width: 400px) { .film__status { left: 8px; bottom: 8px; padding: 5px 10px; font-size: .7rem; } }
@media (min-width: 720px) { .film__status { left: auto; bottom: auto; right: 16px; top: 16px; font-size: .8rem; padding: 9px 13px; } }
.film[data-state="ready"] .film__status { display: none; }
.film[data-state="pending"] .film__play { display: none; }
.film__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin: 10px 2px 0; font-size: .86rem; color: var(--ink-3); }
.film__meta a { font-weight: 600; }

/* ---------- Article ---------- */
.article { padding: 8px 0 24px; }
.article > .prose > p, .article li { font-size: 1.07rem; }
/* :where keeps this at one class of weight, so a component can set its own margins. */
.article :where(p) { margin: 0 0 1.05em; }
.answer {
  font-size: clamp(1.14rem, 2.3vw, 1.26rem) !important; line-height: 1.6;
  padding: 18px 20px; margin: 30px 0 28px !important; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.answer strong { color: var(--ink); }
.answer__kicker { display: block; font-size: .74rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; line-height: 1.3; }
.article h2 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.6rem, 3.6vw, 2.1rem); line-height: 1.18; letter-spacing: -.005em;
  margin: 2.2em 0 .6em; text-wrap: balance;
}
.article h3 { font-size: 1.12rem; line-height: 1.35; margin: 1.6em 0 .5em; }
.article h2 code, .article h3 code, .hero h1 code { display: inline; line-height: inherit; font-size: .92em; background: none; border: 0; padding: 0; white-space: normal; }
.article ul, .article ol { padding-left: 1.25em; margin: 0 0 1.1em; }
.article li { margin: .35em 0; }
.article li::marker { color: var(--ink-3); }
.article blockquote {
  margin: 0 0 1.1em; padding: 4px 0 4px 16px; border-left: 3px solid var(--rule-strong); color: var(--ink-2);
}
.article blockquote p { margin: 0 !important; }

/* An aside inside the text: "What differs?", a footnote from the film, a disclosure. */
.note {
  margin: 22px 0 24px; padding: 14px 16px 4px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--rule);
}
.note > :where(p, ul, ol) { font-size: 1rem !important; }
.note__title { font-weight: 700; margin: 0 0 6px !important; font-size: 1rem !important; }
.note--dashed { border-style: dashed; border-color: var(--rule-strong); background: transparent; }

/* ---------- Code, terminals and HTTP messages ---------- */
.panel {
  margin: 22px 0 26px; border-radius: 12px; overflow: hidden; color-scheme: dark;
  background: var(--code-bg); border: 1px solid var(--code-rule); color: var(--code-ink);
}
/* A request panel carries the request colour on its top edge, a response panel the response colour. */
.panel--req { box-shadow: inset 0 3px 0 var(--part-start); }
.panel--res { box-shadow: inset 0 3px 0 var(--code-res); }
/* Panels and the film are dark in both themes: the light theme's indigo ring would be 2.9:1 on them. */
.panel :focus-visible, .film__frame :focus-visible { outline-color: var(--code-focus); }
.panel__bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px;
  padding: 9px 12px 9px 16px; border-bottom: 1px solid var(--code-rule);
  font: 500 .76rem/1.3 var(--font-body); color: var(--code-dim); letter-spacing: .02em;
}
/* The date stays on one line; when it cannot share the row with the title, it moves under it. */
.panel__bar > span + span { white-space: nowrap; }
.panel__bar b { color: var(--code-ink); font-weight: 600; }
.panel__bar code { display: inline; line-height: inherit; background: none; border: 0; padding: 0; color: inherit; font-size: .95em; }
.panel pre {
  margin: 0; padding: 14px 18px 16px; overflow-x: auto;
  font-size: .84rem; line-height: 1.62; tab-size: 8;
}
.panel pre:focus-visible { outline-offset: -3px; }
@media (max-width: 480px) {
  .panel__bar { padding-left: 14px; }
  .panel pre { padding-inline: 14px; font-size: .8rem; }
}
/* HTTP messages wrap instead of scrolling, with a hanging indent so a wrapped value never looks like a new header.
   Each line is its own block, so the source can hold one line per line: the whitespace between them is dropped. */
.panel--msg pre { white-space: normal; overflow-wrap: anywhere; overflow-x: visible; }
.panel--msg .ln { display: block; white-space: pre-wrap; padding-left: 2.5ch; text-indent: -2.5ch; }
.panel--msg .ln--sub { padding-left: 4.5ch; text-indent: -2.5ch; }
.panel--msg .ln--label { color: var(--code-dim); font-style: italic; margin-top: .35em; }
.panel--msg .ln--label:first-child { margin-top: 0; }
.m-start { color: var(--part-start); font-weight: 700; }
.m-name { color: var(--part-name); font-weight: 600; }
.m-value { color: var(--part-value); }
.m-body { color: var(--part-body); }
.m-code--2 { color: var(--code-s2); }
.m-code--4 { color: var(--code-s4); }
/* The token that tells two User-Agents apart. */
.m-id { color: var(--code-ink); font-weight: 600; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .45); text-underline-offset: .22em; }
/* text-indent: 0 because an inline-block inherits the line's hanging indent, which pushed "↵" out of the panel. */
.m-empty {
  display: inline-block; min-width: 13ch; color: var(--code-dim); font-size: .92em; text-indent: 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .28); line-height: 1.15;
}
.m-note { color: var(--code-dim); font-style: italic; }
/* Lines left out are collapsed in place, never moved: "⋯ 4 more headers" stands where they were. */
.m-more {
  display: inline-block; text-indent: 0; color: var(--code-dim); font-style: italic; font-size: .92em;
  padding: 0 .6em; border-radius: 6px; background: rgba(255, 255, 255, .06); line-height: 1.5;
}
.m-nobody {
  display: inline-block; text-indent: 0; color: var(--code-dim); font-style: italic; font-size: .92em;
  padding: 0 .7em; border: 1px dashed rgba(255, 255, 255, .28); border-radius: 6px; line-height: 1.5;
}
/* Terminals: the command in the bar, the output verbatim below. */
.panel--term pre { white-space: pre; color: #c9ccd8; }
/* Output with no columns to keep aligned (curl -v) wraps on narrow screens; tables (netstat) scroll. */
@media (max-width: 560px) { .panel--term.is-wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; } }
.t-priv { color: var(--code-priv); font-weight: 600; }
.t-pub { color: var(--code-pub); font-weight: 600; }
.t-hi { color: var(--code-ink); font-weight: 600; }
.t-req { color: var(--part-start); }
.t-res { color: var(--code-res); }
.t-dim { color: #7d8398; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: -12px 0 24px; font-size: .84rem; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend .l-start { background: #0284c7; }
.legend .l-head { background: #7c8aa3; }
.legend .l-empty { border: 1.5px dashed var(--ink-3); }
.legend .l-body { background: #d97706; }

/* Three captures: stacked, full width, in the order they were captured. */
.captures { display: grid; gap: 14px; margin: 20px 0 8px; }
.captures .panel { margin: 0; }
.captures + .legend { margin-top: 12px; }

/* ---------- Figures (ep. 01) ---------- */
figure { margin: 0; }
.fig { margin: 24px 0 28px; }
.fig figcaption, .fig__caption { font-size: .88rem; color: var(--ink-3); margin-top: 10px; line-height: 1.5; }

/* ---------- Screenshots, filmstrip and the request chain (ep. 04) ---------- */
/* A real screenshot in its own frame; the caption names the tool and the date. The picture links to the full file. */
.shot { margin: 22px 0 26px; }
.shot > a { display: block; border-radius: 12px; }
.shot img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--rule-strong); background: var(--surface-2); box-shadow: var(--shadow); }
.shot figcaption { font-size: .88rem; color: var(--ink-3); margin-top: 10px; line-height: 1.5; }
.shot figcaption b { color: var(--ink-2); font-weight: 600; }
/* A narrow crop keeps about its own width, so its text stays near the size DevTools drew it. */
.shot--narrow { max-width: 340px; }
.shots { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; margin: 22px 0 26px; }
.shots .shot { margin: 0; }
@media (max-width: 640px) { .shots { grid-template-columns: 1fr; } }
/* DevTools' filmstrip: frames of one load, each with its time. */
.filmstrip { list-style: none; padding: 0 !important; margin: 22px 0 10px !important; display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.filmstrip li { margin: 0 !important; font-size: .86rem !important; line-height: 1.4; color: var(--ink-3); }
.filmstrip img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--rule-strong); background: #fff; }
.filmstrip b { display: block; margin: 6px 0 2px; font: 600 .86rem/1.3 var(--font-mono); color: var(--ink); }
@media (max-width: 640px) { .filmstrip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* The request initiator chain as a tree: one chip per request, its initiator beside it in small type. */
.chain { margin: 22px 0 10px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); }
.chain ul { list-style: none; margin: 0 !important; padding: 0 !important; }
.chain li { margin: 0 !important; font-size: .98rem !important; }
.chain ul ul { margin-left: 13px !important; }
.chain ul ul > li { position: relative; padding-left: 26px; }
.chain ul ul > li::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 2px solid var(--rule-strong); }
.chain ul ul > li:last-child::before { bottom: auto; height: 1.3em; }
.chain ul ul > li::after { content: ""; position: absolute; left: 0; top: 1.3em; width: 18px; border-top: 2px solid var(--rule-strong); }
.chain__node { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 5px 0; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--rule); max-width: 100%; }
.chain__node code { display: inline; background: none; border: 0; padding: 0; font: 600 .9rem/1.35 var(--font-mono); color: var(--req); white-space: normal; overflow-wrap: anywhere; }
.chain__by { font-size: .8rem; color: var(--ink-3); }
.chain__by b { font: 600 .82rem/1 var(--font-mono); color: var(--ink); }
.chain__alone { margin-top: 10px !important; padding-top: 6px; border-top: 1px dashed var(--rule-strong); }
@media (max-width: 480px) {
  .chain { padding: 12px; }
  .chain ul ul { margin-left: 8px !important; }
  .chain ul ul > li { padding-left: 18px; }
  .chain ul ul > li::after { width: 12px; }
}

/* Role tags: the client's colour is the request's, the server's is the response's. */
.role { display: inline-block; font: 700 .7rem/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase; padding: 5px 9px; border-radius: 999px; border: 1.5px solid currentColor; }
.role--client { color: var(--req); background: var(--req-soft); }
.role--server { color: var(--res); background: var(--res-soft); }

/* Many clients, one server */
.clients {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(150px, 1fr) minmax(0, 1fr); align-items: center; gap: 14px;
  padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule);
}
.clients__side { display: grid; gap: 10px; justify-items: start; }
.clients__list { list-style: none; margin: 0 !important; padding: 0 !important; display: grid; gap: 8px; width: 100%; }
.clients__list li, .clients__server {
  display: flex; align-items: center; gap: 10px; margin: 0 !important; font-size: .95rem !important; line-height: 1.3;
  padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--rule);
}
.clients__server { flex-direction: column; align-items: flex-start; padding: 14px; }
.clients__list svg, .clients__server svg { width: 30px; height: 30px; flex: none; color: var(--ink-2); }
.clients__wire { position: relative; display: grid; gap: 22px; padding: 6px 0; }
.clients__msg { display: flex; align-items: center; gap: 6px; font: 600 .88rem/1.2 var(--font-body); white-space: nowrap; }
.num { display: inline-grid; place-items: center; width: 1.45em; height: 1.45em; margin-right: .3em; border-radius: 50%; border: 1.5px solid currentColor; font: 700 .78em/1 var(--font-body); vertical-align: .08em; }
.clients__msg::before { content: ""; flex: 1; height: 2px; border-radius: 2px; background: currentColor; order: 1; }
.clients__msg--req { color: var(--req); }
.clients__msg--req::after { content: ""; order: 2; border: 6px solid transparent; border-left: 9px solid currentColor; border-right: 0; }
.clients__msg--res { color: var(--res); }
.clients__msg--res::before { order: 0; }
.clients__msg--res > span { order: 1; }
.clients__msg--res::after { content: ""; order: -1; border: 6px solid transparent; border-right: 9px solid currentColor; border-left: 0; }
@media (max-width: 640px) {
  .clients { grid-template-columns: 1fr; }
  .clients { padding: 14px; }
  .clients__wire { grid-template-columns: 1fr 1fr; gap: 12px; padding: 0; }
  .clients__msg { flex-direction: column; white-space: normal; text-align: center; }
  .clients__msg::before { width: 2px; height: 22px; flex: none; }
  .clients__msg--req::after { border: 6px solid transparent; border-top: 9px solid currentColor; border-bottom: 0; }
  .clients__msg--res::after { border: 6px solid transparent; border-bottom: 9px solid currentColor; border-top: 0; }
}

/* Roles figure: client and server are roles, not machines. */
.roles svg { width: 100%; max-width: 700px; margin: 0 auto; }
.roles .r-box { fill: var(--surface); stroke: var(--rule-strong); }
.roles .r-name { fill: var(--ink); font: 600 15px var(--font-body); }
.roles .r-role { font: 700 11px var(--font-body); letter-spacing: .12em; }
.roles .r-client { fill: var(--req); }
.roles .r-server { fill: var(--res); }
.roles .r-line { stroke: var(--ink-3); stroke-width: 1.5; fill: none; }
.roles .r-hop { fill: var(--ink-3); font: 500 12px var(--font-body); }
/* Below 600 px the wide drawing shrinks its labels under 9 px, so a vertical one (.roles__narrow) takes over. */
.roles .roles__narrow { display: none; max-width: 340px; }
@media (max-width: 599px) {
  .roles .roles__wide { display: none; }
  .roles .roles__narrow { display: block; }
}

/* From the address bar to the request */
.urlsplit { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); }
.urlsplit__label { font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px !important; }
.urlsplit__bar {
  display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 18px; padding: 10px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--rule-strong); font: 600 1.02rem/1.3 var(--font-mono);
}
.urlsplit__bar span { padding: 1px 2px; border-bottom: 3px solid transparent; }
.u-scheme { color: var(--ink-3); }
.u-host { color: var(--ink); }
.u-path { color: var(--req); }
.urlsplit__bar .u-scheme { border-bottom: 3px dotted var(--ink-3); }
.urlsplit__bar .u-host { border-bottom-color: var(--ink-2); }
.urlsplit__bar .u-path { border-bottom-color: var(--req); }
.urlsplit__map { list-style: none; margin: 0 !important; padding: 0 !important; display: grid; gap: 10px; }
.urlsplit__map li {
  display: grid; grid-template-columns: minmax(0, 13.5em) minmax(0, 1fr); gap: 4px 14px; align-items: baseline; margin: 0 !important;
  padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: .98rem !important;
}
.urlsplit__map .part { font: 600 .95rem/1.4 var(--font-mono); overflow-wrap: anywhere; }
.urlsplit__map .into { display: block; }
.urlsplit__map .into code { font-size: .92em; }
.urlsplit__map .why { display: block; color: var(--ink-3); font-size: .9rem; margin-top: 2px; }
@media (max-width: 560px) {
  .urlsplit { padding: 14px; }
  .urlsplit__bar { border-radius: 12px; font-size: .92rem; }
  .urlsplit__map li { grid-template-columns: 1fr; }
}

/* ---------- Tables ---------- */
.table-wrap { margin: 20px 0 26px; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .96rem; line-height: 1.45; }
.data-table caption { text-align: left; font-size: .88rem; color: var(--ink-3); padding: 0 2px 8px; caption-side: top; }
.data-table th, .data-table td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.data-table thead th { font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1.5px solid var(--rule-strong); }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tbody th { font-weight: 600; }
.data-table code { white-space: nowrap; }
.data-table .muted { color: var(--ink-3); }
.table-box { border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); overflow: hidden; }
/* Below 640 px a row becomes a small card: each cell shows its column name. The explicit roles in the HTML keep
   the table semantics that display: block would otherwise remove. */
@media (max-width: 640px) {
  .stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stack, .stack tbody, .stack tr, .stack th, .stack td { display: block; }
  .stack caption { display: block; }
  .stack tbody tr { padding: 10px 12px; border-bottom: 1px solid var(--rule); }
  .stack tbody tr:last-child { border-bottom: 0; }
  .stack tbody th, .stack tbody td { padding: 3px 0; border: 0; }
  .stack tbody th { font-size: 1.02rem; padding-bottom: 5px; }
  .stack td[data-label]::before {
    content: attr(data-label); content: attr(data-label) / "";
    display: block; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
  }
  .stack code { white-space: normal; }
}

/* ---------- Four methods on one order (ep. 01) ---------- */
.method { font: 700 .95em/1 var(--font-mono); color: var(--req); letter-spacing: .01em; }
.exchange { margin: 30px 0 34px; }
.exchange__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 10px; }
.exchange__head h3 { margin: 0 !important; font-size: 1.15rem !important; }
.exchange__head p { margin: 0 !important; color: var(--ink-3); font-size: .95rem !important; }
.exchange__pair { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.exchange__pair .panel { margin: 0; }
.exchange__pair .panel pre { font-size: .8rem; }
@media (max-width: 760px) { .exchange__pair { grid-template-columns: 1fr; } }
/* The server's data after each exchange: amber means data, as in the films. */
.orders { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 10px 0 0 !important; font-size: .92rem !important; color: var(--ink-3); }
.order {
  display: inline-flex; align-items: center; gap: 6px; font: 600 .84rem/1.2 var(--font-mono); color: var(--data);
  padding: 5px 9px; border-radius: 8px; background: var(--data-soft); border: 1px solid color-mix(in srgb, var(--data) 35%, transparent);
}
.order em { font: italic 500 .78rem/1 var(--font-body); color: var(--ink-2); }
.order--gone { color: var(--ink-3); background: transparent; border-style: dashed; border-color: var(--rule-strong); }
.order--gone s { text-decoration-thickness: 1.5px; }

/* The body and its length */
.bytes { margin: 18px 0 24px; padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); }
.bytes__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 !important; }
.bytes__row + .bytes__row { margin-top: 10px !important; }
.bytes__body { font: 600 .92rem/1.3 var(--font-mono); color: var(--data); padding: 6px 8px 8px; border-bottom: 2px solid var(--data); border-radius: 4px 4px 0 0; background: var(--data-soft); overflow-wrap: anywhere; }
.bytes__count { font-size: .92rem; color: var(--ink-2); }

/* Status code families */
.families { list-style: none; padding: 0 !important; margin: 18px 0 24px !important; display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.families li { margin: 0 !important; padding: 12px 14px 12px 16px; border-radius: 11px; border: 1px solid var(--rule); border-left-width: 4px; background: var(--surface); font-size: .97rem !important; line-height: 1.45; }
.families b { display: block; font: 700 1.1rem/1.2 var(--font-mono); margin-bottom: 3px; }
.families .f2 { border-left-color: var(--s2); }
.families .f2 b { color: var(--s2); }
.families .f3 { border-left-style: dashed; border-left-color: var(--s3); }
.families .f3 b { color: var(--s3); }
.families .f4 { border-left-color: var(--s4); }
.families .f4 b { color: var(--s4); }
.families .f5 { border-left-color: var(--s5); }
.families .f5 b { color: var(--s5); }
@media (max-width: 440px) { .families { grid-template-columns: 1fr; } }

/* The question the film asks, answered on the page */
.question {
  margin: 26px 0 16px; padding: 16px 18px; border-radius: var(--radius);
  border: 1.5px dashed var(--rule-strong); background: var(--surface);
}
.question__q { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.25rem, 2.8vw, 1.45rem); line-height: 1.3; margin: 0 0 6px !important; }
.question__a { margin: 0 !important; }
.question__q code { display: inline; font-size: .86em; background: none; border: 0; padding: 0; white-space: normal; }

/* ---------- Addresses and ports (ep. 02) ---------- */
/* An endpoint is two things joined by a colon: an address chip (pink inside, blue outside) and a port chip. */
.addr, .port {
  display: inline-block; font: 600 .86em/1.25 var(--font-mono); padding: .08em .4em; border-radius: 6px; white-space: nowrap;
}
.addr--priv { color: var(--priv); background: var(--priv-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--priv) 40%, transparent); }
.addr--pub { color: var(--pub); background: var(--pub-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pub) 40%, transparent); }
.port { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.ep { white-space: nowrap; }
.ep .colon { font: 600 .86em/1 var(--font-mono); color: var(--ink-3); margin: 0 1px; }
/* A label the router rewrote on this leg. */
.rw { outline: 2px solid currentColor; outline-offset: 1px; }
.rw-tag { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-left: 4px; white-space: nowrap; }

/* The map */
.map { margin: 22px 0 30px; }
.map__canvas { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); padding: 10px; }
.map svg { width: 100%; margin: 0 auto; }
.map__narrow { display: none; max-width: 460px; }
/* Below 960 px the wide drawing's smallest labels would fall under 10.5 px: the vertical one takes over. */
@media (max-width: 959px) {
  .map__wide { display: none; }
  .map__narrow { display: block; }
}
.map .z-home { fill: var(--priv-soft); stroke: color-mix(in srgb, var(--priv) 45%, transparent); stroke-width: 1.5; }
.map .z-net { fill: var(--pub-soft); stroke: color-mix(in srgb, var(--pub) 45%, transparent); stroke-width: 1.5; }
.map .z-tag { font: 700 11px var(--font-body); letter-spacing: .13em; }
.map .z-tag--home { fill: var(--priv); }
.map .z-tag--net { fill: var(--pub); }
.map .dev { fill: var(--surface); stroke: var(--ink-2); stroke-width: 2; stroke-linejoin: round; }
.map .dev-line { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.map .dev-screen { fill: var(--surface-2); stroke: var(--ink-2); stroke-width: 2; }
.map .name { fill: var(--ink); font: 600 14px var(--font-body); }
.map .gloss { fill: var(--ink-3); font: italic 500 11.5px var(--font-body); }
.map .chip { stroke-width: 1.5; }
.map .chip--priv { fill: var(--priv-soft); stroke: var(--priv); }
.map .chip--pub { fill: var(--pub-soft); stroke: var(--pub); }
.map .chip--port { fill: var(--surface-2); stroke: var(--ink-3); }
.map .chip--temp { stroke-dasharray: 4 3; }
.map .chip-t { font: 600 13px var(--font-mono); }
.map .chip-t--priv { fill: var(--priv); }
.map .chip-t--pub { fill: var(--pub); }
.map .chip-t--port { fill: var(--ink); }
.map .chip-t--sm { font-size: 12px; }
.map .router-in { fill: var(--priv-soft); stroke: var(--priv); stroke-width: 1.5; }
.map .router-out { fill: var(--pub-soft); stroke: var(--pub); stroke-width: 1.5; }
.map .face { font: 700 10.5px var(--font-body); letter-spacing: .12em; }
.map .face--in { fill: var(--priv); }
.map .face--out { fill: var(--pub); }
.map .link { fill: none; stroke: var(--ink-3); stroke-width: 2.5; stroke-linecap: round; }
.map .link--wifi { stroke-dasharray: 2 7; stroke-width: 3; }
.map .hop { fill: var(--surface); stroke: var(--ink-3); stroke-width: 2; }
.map .leg { stroke-width: 2; }
.map .leg--req { fill: var(--req-soft); stroke: var(--req); }
.map .leg--res { fill: var(--res-soft); stroke: var(--res); }
.map .leg-t { font: 700 12px var(--font-body); }
.map .leg-t--req { fill: var(--req); }
.map .leg-t--res { fill: var(--res); }
.map .arrow--req { fill: none; stroke: var(--req); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.map .arrow--res { fill: none; stroke: var(--res); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.map .tiny { fill: var(--ink-3); font: 500 11px var(--font-body); }

/* The packets of the laptop's conversation, laid out under the map: out on top, back below. */
.packets { list-style: none; margin: 14px 0 0 !important; padding: 0 !important; display: grid; gap: 10px 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "p1 p2" "p4 p3"; }
.packets > li { margin: 0 !important; display: grid; }
.packets .p1 { grid-area: p1; } .packets .p2 { grid-area: p2; } .packets .p3 { grid-area: p3; } .packets .p4 { grid-area: p4; }
.pkt {
  position: relative; padding: 10px 12px 10px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--rule); border-left: 4px solid var(--req); font-size: .92rem; line-height: 1.5;
}
.pkt--res { border-left-color: var(--res); }
.pkt__leg { display: flex; align-items: center; gap: 8px; margin: 0 0 6px !important; font-weight: 600; font-size: .92rem !important; }
.pkt__n { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; font: 700 .76rem/1 var(--font-body); color: var(--req); border: 2px solid currentColor; }
.pkt--res .pkt__n { color: var(--res); }
.pkt__dir { font-weight: 700; }
.pkt--req .pkt__dir { color: var(--req); }
.pkt--res .pkt__dir { color: var(--res); }
.pkt__labels { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; margin: 0; align-items: baseline; }
.pkt__labels dt { font: 700 .66rem/1.8 var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.pkt__labels dd { margin: 0; font-size: 1rem; }
.pkt__note { margin: 6px 0 0 !important; font-size: .84rem !important; color: var(--ink-3); line-height: 1.4; }
.rule-card { margin: 12px 0 0 !important; padding: 10px 14px; border-radius: 12px; border: 1.5px dashed var(--rule-strong); text-align: center; font-size: .98rem; line-height: 1.45; }
.rule-card b { display: block; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
@media (max-width: 700px) {
  .packets { grid-template-columns: 1fr; grid-template-areas: "p1" "p2" "p3" "p4"; }
}
.pkt--single { margin: 18px 0 22px; max-width: 520px; }
.pkt__inside { font-size: .95rem !important; color: var(--ink-2); }
.pkt--blocked { border-left-color: var(--ink-3); border-style: dashed; border-left-style: solid; }
.pkt--blocked .pkt__n { color: var(--ink-2); }

/* The four legs, spelled out, with the map's numbers. */
.legs { list-style: none; padding: 0 !important; margin: 16px 0 20px !important; display: grid; gap: 10px; }
.legs > li { position: relative; margin: 0 !important; padding: 10px 14px 10px 50px; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); }
.legs > li > .num { position: absolute; left: 14px; top: 11px; margin: 0; }
.legs__req > .num, .num--req { color: var(--req); }
.legs__res > .num, .num--res { color: var(--res); }
.trip th .num { margin-right: .5em; }

/* NAT table: under the router, one row per conversation. */
.nat { margin-top: 14px; }
.nat__title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; margin: 0 0 8px !important; }
.nat__title b { font-size: 1rem; }
.nat__title span { font-size: .84rem; color: var(--ink-3); }
.nat .data-table td, .nat .data-table th { vertical-align: middle; }
.nat .dev-cell { white-space: nowrap; }
.nat .data-table thead .h-in { color: var(--priv); }
.nat .data-table thead .h-out { color: var(--pub); }
/* The film subdues the third column; on the page its header does, so the addresses keep full contrast. */
.nat .data-table thead th:last-child { color: var(--ink-3); font-weight: 600; }
.nat tr.clash > * { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--ink-3) 12%, transparent) 6px 8px); }
.nat tr.clash .x { font-weight: 700; color: var(--ink); }

/* ---------- Asides: try it, quiz, mistakes ---------- */
.card {
  margin: 34px 0; padding: 22px 22px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow);
}
@media (max-width: 480px) { .card { padding: 18px 16px 16px; } }
.card__kicker { margin: 0 0 6px !important; font-size: .74rem !important; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--accent); }
.card h2 { margin-top: 0 !important; font-size: clamp(1.4rem, 3vw, 1.7rem) !important; }
.card h3 { margin: 1.5em 0 .5em !important; font-size: 1.06rem !important; }
.card .panel { margin: 12px 0 16px; }
.card .panel pre { font-size: .78rem; }
.steps { padding-left: 1.4em !important; }
.steps > li { margin: .7em 0 !important; }
.steps > li::marker { font-weight: 700; color: var(--ink-2); }
.fr { color: var(--ink-3); font-size: .95em; }
.fr i { font-style: italic; color: var(--ink-2); }
/* line-height 1.25 (padding trimmed to keep the height) so a label that wraps on a phone does not touch itself. */
.btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 4px;
  font: 600 .95rem/1.25 var(--font-body); text-decoration: none;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: var(--on-accent);
}
.btn:hover { color: var(--on-accent); background: var(--accent-hover); text-decoration: none; }
.small-note { font-size: .9rem !important; color: var(--ink-3); margin-top: 10px !important; }
/* A command to type: its own dark line, wrapping anywhere rather than overflowing the card. */
code.cmd {
  display: block; width: fit-content; max-width: 100%; margin: .45em 0 .5em; padding: 7px 12px; border-radius: 8px;
  font: 600 .86rem/1.5 var(--font-mono); color: var(--code-ink); background: var(--code-bg); border: 1px solid var(--code-rule);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
code.cmd::before { content: "> "; content: "> " / ""; color: var(--code-dim); }

.quiz + .quiz { margin-top: 22px; padding-top: 20px; border-top: 1px dashed var(--rule-strong); }
.quiz__q { font-weight: 600; margin-bottom: 12px !important; }
.quiz__opts { display: grid; gap: 8px; margin: 0 0 12px; }
.quiz__opt {
  text-align: left; font: 500 .98rem/1.4 var(--font-body); color: var(--ink);
  padding: 11px 14px; border-radius: 10px; cursor: pointer;
  background: var(--surface-2); border: 1.5px solid var(--control);
}
.quiz__opt:hover:not([disabled]) { border-color: var(--accent); }
.quiz__opt[disabled] { cursor: default; }
.quiz__opt[data-result="right"] { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.quiz__opt[data-result="wrong"] { border-color: var(--no); background: color-mix(in srgb, var(--no) 10%, var(--surface)); }
.quiz__opt[data-result]::after { font-weight: 700; margin-left: 8px; }
/* The text after "/" is what screen readers say instead of "check mark" / "ballot x". */
.quiz__opt[data-result="right"]::after { content: "✓ right"; content: "✓ right" / "the right answer"; color: var(--ok); }
.quiz__opt[data-result="wrong"]::after { content: "✗ your pick"; content: "✗ your pick" / "your pick, not the answer"; color: var(--no); }
.quiz details summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.quiz details[open] summary { margin-bottom: 8px; }
.quiz.js-ready details summary { display: none; }
.quiz__why { font-size: .98rem !important; }

.mistakes { list-style: none; padding: 0 !important; counter-reset: m; }
.mistakes li { position: relative; padding: 2px 0 14px 44px; margin: 0 0 12px !important; border-bottom: 1px dashed var(--rule); }
.mistakes li:last-child { border-bottom: 0; }
.mistakes li::before {
  counter-increment: m; content: counter(m);
  position: absolute; left: 0; top: 2px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font: 700 .9rem/1 var(--font-mono);
  color: var(--ink-2); border: 1.5px solid var(--rule-strong);
}
.mistakes li > b:first-child { display: block; margin-bottom: 2px; }
.evidence { display: block; font-size: .88rem; color: var(--ink-3); margin-top: 4px; }

/* English → French glossary */
.glossary { margin: 18px 0 8px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
.glossary summary { cursor: pointer; padding: 12px 16px; font-weight: 600; }
.glossary[open] summary { border-bottom: 1px solid var(--rule); }
.glossary .data-table { font-size: .95rem; }
.glossary .data-table td:last-child { color: var(--ink-2); }
.glossary > div { padding: 4px 6px 6px; }

/* ---------- Next / sources / footer ---------- */
.next-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 18px 0 8px; }
@media (min-width: 640px) { .next-grid { grid-template-columns: 1fr 1fr; } }
.next-grid > div { padding: 16px 18px; border-radius: 12px; border: 1px solid var(--rule); background: var(--surface); }
.next-grid .label { display: block; font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.next-grid p { margin: 0 !important; font-size: 1rem !important; }
.soon { display: inline-block; margin-left: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--rule-strong); padding: 2px 7px; border-radius: 999px; vertical-align: 2px; }
.sources { font-size: .93rem; color: var(--ink-2); }
.sources h2 { font-size: 1.35rem !important; }
.sources li { font-size: .93rem !important; }
.back-link { display: inline-flex; margin: 26px 0 8px; font-weight: 600; text-decoration: none; }
.site-foot { margin-top: 48px; border-top: 1px solid var(--rule); padding: 26px 0 40px; font-size: .88rem; color: var(--ink-3); }
.site-foot__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; }
.site-foot a { color: var(--ink-2); text-decoration: none; }
.site-foot a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Hub ---------- */
.hub-hero { padding: 52px 0 0; }
.hub-hero h1 { max-width: 16ch; }
.course-group { margin: 12px 0 40px; }
.course-group__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin: 0 0 16px; }
.course-group__head h2 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: clamp(1.45rem, 3.2vw, 1.8rem); }
.course-group__head a { font-weight: 600; font-size: .95rem; }
.episodes { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.episodes > li { display: grid; }
/* One card per episode: the tile on top, whole (16:9, never cropped), the text below. Cards in a row share a height. */
.episode-card {
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow);
}
.episode-card__media { position: relative; display: block; aspect-ratio: 16 / 9; background: #0f1017; }
.episode-card__media img { width: 100%; height: 100%; object-fit: cover; }
.episode-card__body { flex: 1; padding: 20px 22px 22px; display: flex; flex-direction: column; }
.episode-card__eyebrow { font-size: .74rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px; }
.episode-card__eyebrow .n { color: var(--accent); }
.episode-card h3 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.35rem, 2.6vw, 1.55rem); line-height: 1.2; margin: 0 0 10px; text-wrap: balance; }
.episode-card h3 a { color: var(--ink); text-decoration: none; }
.episode-card h3 a:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; }
.episode-card p { margin: 0 0 12px; color: var(--ink-2); }
.episode-card .meta { font-size: .86rem; color: var(--ink-3); margin-bottom: 16px; }
.episode-card .btn { align-self: flex-start; margin-top: auto; }
.upcoming { list-style: none; padding: 0; margin: 18px 0 0; border-radius: var(--radius); border: 1px dashed var(--rule-strong); background: transparent; }
.upcoming li { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 13px 16px; border-top: 1px solid var(--rule); }
.upcoming li:first-child { border-top: 0; }
.upcoming .n { font: 700 .9rem/1 var(--font-mono); color: var(--ink-3); }
.upcoming .t { font-weight: 500; color: var(--ink-2); }
@media (max-width: 480px) { .upcoming li { grid-template-columns: 34px 1fr; } .upcoming .soon { grid-column: 2; justify-self: start; margin-left: 0; } }
.hub-note { font-size: .92rem; color: var(--ink-3); margin: 14px 2px 0; }

@media (min-width: 900px) {
  :root { --gutter: 32px; }
  body { font-size: 1.0625rem; }
  .panel pre { font-size: .88rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
