/* Coherent Energy Transformations - Shock: site styles. No external fonts or requests. */

:root {
  --bg: #f3f2ee;
  --bg-alt: #e9edf1;
  --panel: #ffffff;
  --ink: #1b1f23;
  --ink-2: #4a525a;
  --ink-3: #6b737b;
  --rule: #cfd3d6;
  --rule-2: #e1e3e4;
  --grid: rgba(60, 120, 90, 0.07);
  --accent: #b5651d;        /* copper */
  --accent-ink: #8a4a12;
  --signal: #f2c230;        /* cap-lid yellow */
  --danger: #c4261d;
  --danger-bg: #fbeceb;
  --ok: #2f8a5b;
  --focus: #1f6feb;
  --stage: #e9edf1;
  --shadow: 0 1px 2px rgba(20, 24, 28, .06), 0 6px 24px rgba(20, 24, 28, .06);
  --radius: 6px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --wrap: 1180px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121518;
    --bg-alt: #171b1f;
    --panel: #1d2226;
    --ink: #e7e9ea;
    --ink-2: #b4bbc1;
    --ink-3: #8c949b;
    --rule: #343b41;
    --rule-2: #272d32;
    --grid: rgba(120, 200, 160, 0.05);
    --accent: #e08a45;
    --accent-ink: #f0a465;
    --signal: #f2c230;
    --danger: #ff6b5e;
    --danger-bg: #2c1a19;
    --ok: #5cc48c;
    --focus: #6ea8ff;
    --stage: #1a1f23;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--rule-2); padding: .05em .35em; border-radius: 3px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; }
h3 { font-size: 1.12rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
.small { font-size: .875rem; color: var(--ink-2); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--panel); padding: .5em 1em; }
.skip:focus { left: 8px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

.eyebrow {
  font: 600 .72rem/1.3 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .6em;
}

/* ---------- 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);
}
.head-row { display: flex; align-items: center; gap: 20px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand-mark {
  font: 700 .78rem/1 var(--mono); letter-spacing: .05em;
  padding: 6px 7px; border: 1.5px solid var(--ink); border-radius: 3px;
  background: var(--signal); color: #1b1f23;
}
.brand-text { font-weight: 650; font-size: .92rem; letter-spacing: -.005em; }
.site-nav { flex: 1; min-width: 0; overflow-x: auto; scroll-behavior: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 92%, transparent); }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav ul { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; justify-content: flex-end; }
.site-nav a {
  display: block; padding: 8px 10px; border-radius: 4px; white-space: nowrap;
  font: 500 .82rem/1 var(--sans); color: var(--ink-2); text-decoration: none;
}
.site-nav a:hover { color: var(--ink); background: var(--rule-2); }
.site-nav a[aria-current="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
@media (max-width: 900px) {
  .head-row { flex-wrap: wrap; gap: 0; padding-top: 8px; }
  .brand { width: 100%; }
  .site-nav { margin: 0 -16px; padding: 0 12px; }
  .site-nav ul { justify-content: flex-start; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 .9rem/1 var(--sans);
  padding: 11px 16px; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
  text-decoration: none; cursor: pointer; min-height: 40px;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn-sm { padding: 8px 12px; font-size: .82rem; min-height: 36px; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  border-bottom: 1px solid var(--rule);
  padding: 48px 0 56px;
}
.hero-grid { display: grid; gap: 36px; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.05fr 1fr; gap: 48px; } .hero { padding: 72px 0 80px; } }
.hero h1 {
  font-size: clamp(2rem, 1.3rem + 3.2vw, 3.4rem);
  letter-spacing: -.025em; line-height: 1.05; margin-bottom: .2em; font-weight: 750;
}
.strapline {
  font: italic 400 clamp(1.3rem, 1rem + 1.4vw, 1.9rem)/1.25 var(--serif);
  color: var(--accent-ink); margin-bottom: .9em;
}
.lede { font-size: 1.06rem; color: var(--ink-2); max-width: 60ch; }
.status-plate {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--rule); border-inline-start: 4px solid var(--signal);
  background: var(--panel); padding: 12px 14px; border-radius: var(--radius); margin: 20px 0;
  max-width: 60ch;
}
.status-plate p { margin: 0; font-size: .92rem; }
.status-led { flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 30%, transparent); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.question-note { margin-top: 20px; font-size: .9rem; color: var(--ink-2); max-width: 60ch; border-top: 1px dashed var(--rule); padding-top: 14px; }
.hero-figure { margin: 0; }
.hero-figure img { border-radius: 8px; border: 1px solid var(--rule); box-shadow: var(--shadow); background: var(--stage); }
.hero-figure figcaption { font: .78rem var(--mono); color: var(--ink-3); margin-top: 8px; }

/* ---------- sections ---------- */
.section { padding: 64px 0; border-bottom: 1px solid var(--rule); }
.section-alt { background: var(--bg-alt); }
.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 24px; border-bottom: 1px solid var(--rule); padding-bottom: 12px; }
.section-head h2 { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem); letter-spacing: -.02em; margin: 0; }
.sec-no { font: 600 .8rem/1 var(--mono); color: var(--accent-ink); margin: 0; padding: 4px 6px; border: 1px solid currentColor; border-radius: 3px; }
.sub { margin-top: 40px; font-size: 1.2rem; letter-spacing: -.01em; }
.lead-sm { color: var(--ink-2); max-width: 70ch; }
.prose { max-width: 68ch; }
.prose ul, .note-card ul, .limits { padding-inline-start: 1.2em; }
.prose li, .note-card li, .limits li { margin-bottom: .4em; }
.cols-2 { display: grid; gap: 28px; }
@media (min-width: 860px) { .cols-2 { grid-template-columns: 1fr 1fr; gap: 40px; } }
.cards-3 { display: grid; gap: 16px; }
@media (min-width: 860px) { .cards-3 { grid-template-columns: repeat(3, 1fr); } }

.note-card {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 18px 20px; align-self: start; box-shadow: var(--shadow);
}
.note-card h3 { font-size: 1rem; }
#smd-board { margin: 16px 0; }
.note-card p:last-child, .note-card ul:last-child { margin-bottom: 0; }
.note-card.warn { border-top: 3px solid var(--danger); }
.note-card.warn h3 { color: var(--danger); }

.pieces .piece-fig { margin: 0 0 14px; }
.piece-fig img { border-radius: var(--radius); border: 1px solid var(--rule); background: var(--stage); aspect-ratio: 4/3; object-fit: cover; width: 100%; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); margin: 12px 0 16px; }
table.data { border-collapse: collapse; width: 100%; font-size: .9rem; }
.data th, .data td { text-align: start; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--rule-2); }
.data thead th { font: 600 .72rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); background: var(--bg-alt); border-bottom: 1px solid var(--rule); }
.data tbody th { font-weight: 600; }
.data tr:last-child > * { border-bottom: 0; }
.data .hl { background: color-mix(in srgb, var(--signal) 14%, transparent); }
.data thead .hl { color: var(--ink); }
.conditions td, .conditions th { min-width: 7em; }
.hazards th[scope="row"] { min-width: 11em; color: var(--danger); }
.hazards td { min-width: 15em; }
.timing td:first-child { white-space: nowrap; }

/* ---------- source ---------- */
.cols-logbook { display: grid; gap: 32px; }
@media (min-width: 960px) { .cols-logbook { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 44px; } }
.logbook { margin: 0; }
.zoomable {
  display: block; position: relative; padding: 0; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--panel); cursor: zoom-in; width: 100%; overflow: hidden;
}
.zoomable img { width: 100%; }
.zoom-hint {
  position: absolute; right: 10px; bottom: 10px;
  font: 600 .72rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  background: rgba(20, 24, 28, .78); color: #fff; padding: 7px 9px; border-radius: 4px;
}
figcaption { font-size: .85rem; color: var(--ink-2); margin-top: 8px; }
.sem-card {
  margin-top: 24px; padding: 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--rule); border-inline-start: 4px solid var(--accent);
  box-shadow: var(--shadow);
}
.sem-card h3 { font-size: 1.15rem; }
.sem-card .plates { max-width: 380px; margin: 4px 0 18px; }
.sem-links { display: flex; flex-wrap: wrap; gap: 10px; }
.videos { display: grid; gap: 22px; }
@media (min-width: 760px) { .videos { grid-template-columns: repeat(3, 1fr); } }
/* four items: 2 x 2 at tablet and laptop widths, four across on wide screens (no orphan in a row of three) */
@media (min-width: 760px) { .videos:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .videos:has(> :nth-child(4):last-child) { grid-template-columns: repeat(4, 1fr); } }
.video { margin: 0; }
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #0d0f11; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--rule); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: #0d0f11; }
.films-local #films .yt-note { display: none; }
.films-no-yt #films .yt-note { display: none; }
.films-off #films, .films-off li:has(> a[href="#films"]) { display: none; }
/* the sound of a locally played film is a separate track: its own small control sits in the corner of the frame */
.film-sound { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; align-items: center; gap: 6px;
  padding: 4px 6px; border-radius: 999px; background: rgba(13,15,17,.72); color: #f2efe8; }
.film-sound-btn { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; padding: 0; }
.film-sound-btn:hover, .film-sound-btn:focus-visible { background: rgba(255,255,255,.16); }
.film-sound-btn[aria-pressed="false"] { color: #ffb38a; }
.film-sound-vol { width: 0; opacity: 0; margin: 0; transition: width .15s, opacity .15s; accent-color: var(--accent); }
.film-sound:hover .film-sound-vol, .film-sound:focus-within .film-sound-vol { width: 84px; opacity: 1; margin-right: 6px; }
@media (hover: none) { .film-sound-vol { width: 84px; opacity: 1; margin-right: 6px; } }
@media print { .film-sound { display: none; } }
video::cue { font: 500 1em/1.35 var(--sans); background: rgba(13,15,17,.78); color: #fff; }
.video figcaption a { display: inline-block; margin-inline-start: .3em; }

/* ---------- viewer ---------- */
.viewer { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.viewer-tabs { display: flex; border-bottom: 1px solid var(--rule); overflow-x: auto; }
.viewer-tabs button {
  font: 600 .86rem/1 var(--sans); color: var(--ink-2); background: none; border: 0;
  padding: 15px 18px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.viewer-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.viewer-tabs button:focus-visible { outline-offset: -3px; }
@media (max-width: 600px) { .viewer-tabs { flex-wrap: wrap; overflow-x: visible; } .viewer-tabs button { padding: 12px 13px; } }
.viewer-body { display: grid; }
@media (min-width: 900px) { .viewer-body { grid-template-columns: minmax(0, 1fr) 300px; } }
.viewer-stage { position: relative; background: radial-gradient(ellipse at 50% 35%, color-mix(in srgb, var(--stage) 60%, #fff) 0%, var(--stage) 70%); min-height: 360px; aspect-ratio: 4 / 3; }
@media (prefers-color-scheme: dark) { .viewer-stage { background: radial-gradient(ellipse at 50% 35%, #262c31 0%, var(--stage) 70%); } }
@media (min-width: 900px) { .viewer-stage { aspect-ratio: auto; height: 560px; } }
.viewer-canvas { position: absolute; inset: 0; touch-action: none; }
.viewer-canvas canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.viewer-canvas canvas:active { cursor: grabbing; }
.viewer-canvas:focus-visible { outline-offset: -4px; }
.viewer-status {
  position: absolute; left: 12px; top: 12px; margin: 0; pointer-events: none;
  font: .74rem/1.3 var(--mono); color: var(--ink-3); background: color-mix(in srgb, var(--panel) 80%, transparent);
  padding: 5px 8px; border-radius: 4px;
}
.viewer-status:empty { display: none; }
.viewer-tip {
  position: absolute; pointer-events: none; transform: translate(12px, -50%);
  background: var(--ink); color: var(--bg); font: 600 .8rem/1.2 var(--sans);
  padding: 6px 9px; border-radius: 4px; max-width: 240px; z-index: 3;
}
.viewer-controls {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.explode {
  display: flex; align-items: center; gap: 10px; flex: 1 1 220px;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0 12px; min-height: 40px;
  font: 600 .74rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2);
}
.explode input { flex: 1; accent-color: var(--accent); min-width: 80px; height: 28px; }
.viewer-fallback {
  position: absolute; inset: 0; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; text-align: center;
}
.viewer-fallback p { max-width: 46ch; margin: 0; color: var(--ink-2); font-size: .92rem; }
.viewer-fallback img { max-height: 72%; width: auto; border-radius: var(--radius); border: 1px solid var(--rule); }
.viewer-fallback .fb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; width: 100%; max-width: 640px; }
.viewer-fallback .fb-grid img { max-height: none; width: 100%; }
.viewer-side { border-top: 1px solid var(--rule); padding: 18px; display: flex; flex-direction: column; min-height: 0; }
@media (min-width: 900px) { .viewer-side { border-top: 0; border-inline-start: 1px solid var(--rule); max-height: 560px; } }
.part-info { border-bottom: 1px solid var(--rule-2); padding-bottom: 12px; margin-bottom: 12px; min-height: 120px; }
.part-info h3 { font-size: 1.05rem; margin-bottom: .3em; }
.part-info .group-chip { margin-inline-start: 0; }
.parts-title { font: 600 .72rem/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.part-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; max-height: 300px; }
@media (min-width: 900px) { .part-list { max-height: none; flex: 1; } }
.part-list button {
  width: 100%; text-align: start; display: flex; align-items: center; gap: 8px;
  background: none; border: 0; border-radius: 4px; padding: 7px 8px; cursor: pointer;
  font: .86rem/1.3 var(--sans); color: var(--ink);
}
.part-list button:hover, .part-list button.hover { background: var(--rule-2); }
.part-list button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.part-list button:disabled { color: var(--ink-3); cursor: default; }
.swatch { flex: none; width: 10px; height: 10px; border-radius: 2px; border: 1px solid rgba(0,0,0,.25); }
.group-chip { margin-inline-start: auto; font: .66rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- galleries ---------- */
.area-block + .area-block { margin-top: 12px; }
.area-content { display: grid; gap: 24px; }
.gal-hero { margin: 0; }
.gal-hero img, .gal-grid img { border-radius: var(--radius); background: var(--stage); }
.gal-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.gal-grid figure { margin: 0; }
.gal-grid figcaption strong, .gal-hero figcaption strong { color: var(--ink); }
.gal-empty { color: var(--ink-3); font-size: .9rem; }

.hotspot-fig { margin: 0; }
.hotspot-layout { display: grid; gap: 18px; }
@media (min-width: 960px) { .hotspot-layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.hotspot-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--rule); background: var(--stage); }
.hotspot-wrap img { width: 100%; }
.hotspot {
  position: absolute; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px)));
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #fff; background: var(--ink); color: #fff;
  font: 700 .74rem/1 var(--mono); cursor: pointer; padding: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  transition: transform .15s, background .15s;
}
.hotspot:hover, .hotspot.active { background: var(--accent); transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(1.15); }
.hotspot-lead {
  position: absolute; height: 2px; margin-top: -1px; transform-origin: 0 50%; pointer-events: none;
  background: var(--ink); box-shadow: 0 0 0 1px rgba(255,255,255,.85); border-radius: 1px;
}
@media (prefers-color-scheme: dark) { .hotspot-lead { background: #1b1f23; } }
/* each marker sits beside its part; a thin leader points at the part and stops just short of it, so nothing is
   drawn on the part itself (places from assets/img/markers.json) */
.hotspot-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.hotspot-lines line { vector-effect: non-scaling-stroke; stroke-linecap: round; }
.hotspot-lines .halo { stroke: rgba(255,255,255,.92); stroke-width: 4px; }
.hotspot-lines .ink { stroke: var(--ink); stroke-width: 1.6px; }
.hotspot-lines g.active .ink { stroke: var(--accent); stroke-width: 2.2px; }
@media (max-width: 600px) { .hotspot-lines .halo { stroke-width: 3px; } .hotspot-lines .ink { stroke-width: 1.3px; } }
@media (prefers-color-scheme: dark) { .hotspot-lines .ink { stroke: #1b1f23; } }
@media (prefers-color-scheme: dark) { .hotspot { background: #1b1f23; } }
@media (max-width: 600px) { .hotspot { width: 24px; height: 24px; font-size: .66rem; } }
.hotspot-card {
  position: absolute; z-index: 4; width: min(280px, 80%);
  background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 10px 12px; box-shadow: var(--shadow); font-size: .86rem; pointer-events: none;
}
.hotspot-card strong { display: block; margin-bottom: 2px; }
.hotspot-legend { list-style: none; margin: 0; padding: 0; font-size: .86rem; max-height: 520px; overflow: auto; }
.hotspot-legend li button {
  display: grid; grid-template-columns: 26px 1fr; gap: 8px; width: 100%; text-align: start;
  background: none; border: 0; border-radius: 4px; padding: 6px; cursor: pointer; color: var(--ink); font: inherit;
}
.hotspot-legend li button:hover, .hotspot-legend li button.active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.hotspot-legend .n { font: 700 .74rem/1.6 var(--mono); color: var(--accent-ink); }
.hotspot-legend .p { display: block; color: var(--ink-2); font-size: .8rem; }
.labeled-link { font-size: .85rem; margin-top: 8px; }
.print-only { display: none; }

/* stepper */
.steppers { display: grid; gap: 8px; }
.stepper { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.stepper-main { display: grid; }
@media (min-width: 900px) { .stepper-main { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.stepper-img { background: var(--stage); position: relative; }
.stepper-img img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; cursor: zoom-in; }
.stepper-text { padding: 20px; display: flex; flex-direction: column; }
.stepper-count { font: 600 .74rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 10px; }
.stepper-nav { margin-top: auto; display: flex; gap: 8px; padding-top: 14px; }
.stepper-dots { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--rule-2); }
.stepper-dots button {
  min-width: 34px; height: 30px; border-radius: 4px; border: 1px solid var(--rule); background: var(--bg);
  font: 600 .76rem/1 var(--mono); color: var(--ink-2); cursor: pointer;
}
.stepper-dots button[aria-current="step"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  aspect-ratio: 16 / 9; width: 100%;
  border: 1.5px dashed var(--rule); border-radius: var(--radius);
  color: var(--ink-3); text-align: center; padding: 12px;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 16px 16px;
}
.placeholder span { font: 600 .74rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.placeholder small { font-size: .8rem; }

/* ---------- build ---------- */
.build-order { counter-reset: b; list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 10px; }
@media (min-width: 860px) { .build-order { grid-template-columns: 1fr 1fr 1fr; } }
.build-order li { counter-increment: b; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; padding-inline-start: 52px; position: relative; font-size: .92rem; }
.build-order li::before { content: counter(b); position: absolute; inset-inline-start: 14px; top: 13px; font: 700 .9rem/26px var(--mono); width: 26px; text-align: center; border: 1.5px solid var(--ink); border-radius: 50%; }

/* ---------- protocol ---------- */
.layout-figure { margin: 0 0 28px; }
.layout-figure img { border-radius: var(--radius); border: 1px solid var(--rule); background: var(--stage); cursor: zoom-in; }
.protocol { list-style: none; margin: 0 0 32px; padding: 0; display: grid; gap: 12px; }
.protocol > li {
  display: grid; gap: 16px; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 16px; align-items: start;
}
@media (min-width: 760px) { .protocol > li { padding: 18px 20px; } .protocol > li.has-fig { grid-template-columns: minmax(0, 1fr) 280px; } }
.p-fig:empty { display: none; }
.protocol > li.teacher { border-inline-start: 4px solid var(--signal); }
.p-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.p-no { font: 700 1.3rem/1 var(--mono); color: var(--ink); min-width: 1.6em; }
.tbadge {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  font: 700 .7rem/1 var(--mono); padding: 4px 6px; border-radius: 3px;
  background: var(--signal); color: #1b1f23; letter-spacing: .04em;
}
.protocol .tbadge::after { content: var(--i18n-teacher-only, "Teacher only"); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .62rem; }
.protocol li[data-step="9"] .tbadge::after { content: var(--i18n-teacher-step, "Teacher step"); }
.p-text > p:last-child { margin-bottom: 0; }
.p-fig img { border-radius: 4px; border: 1px solid var(--rule); cursor: zoom-in; background: var(--stage); }
.p-fig .placeholder { aspect-ratio: 4 / 3; }
.p-fig figcaption { font-size: .78rem; }
.p-fig figure { margin: 0; }

/* ---------- safety ---------- */
details.numbers { margin: 8px 0 0; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0 18px; }
details.numbers summary { cursor: pointer; padding: 14px 0; font-weight: 600; }
details.numbers ul { padding-inline-start: 1.2em; margin-top: 0; }
.checklist { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 6px 20px 16px; box-shadow: var(--shadow); margin-bottom: 32px; }
.checklist fieldset { border: 0; border-bottom: 1px solid var(--rule-2); margin: 0; padding: 14px 0; }
.checklist legend { font-weight: 700; padding: 0; margin-bottom: 8px; float: left; width: 100%; }
.checklist legend + * { clear: both; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; padding: 7px 4px; border-radius: 4px; cursor: pointer; font-size: .92rem; }
.checklist label:hover { background: var(--rule-2); }
.checklist input { margin-top: 4px; width: 18px; height: 18px; flex: none; accent-color: var(--ok); }
.checklist input:checked + span { color: var(--ink-3); }
.checklist label b { font-family: var(--mono); color: var(--accent-ink); margin-inline-end: 6px; }
.check-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 14px 0 0; }
.check-progress { font: .8rem var(--mono); color: var(--ink-3); margin-inline-start: auto; }

/* ---------- how ---------- */
.doc-figure { margin: 24px 0; }
.doc-figure .zoomable { background: #fff; }
.doc-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.doc-grid .doc-figure { margin: 8px 0; }
.how-cols { align-items: start; }
.how-cols .table-scroll { margin-top: 40px; }
.calc { font-size: .92rem; max-width: none; }
.timeline { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
.tl-row { display: grid; grid-template-columns: 8.5em 1fr 6.5em; gap: 10px; align-items: center; font-size: .82rem; }
.tl-label { color: var(--ink-2); }
.tl-end { font: .75rem var(--mono); color: var(--ink-3); }
.tl-track { position: relative; height: 14px; background: var(--rule-2); border-radius: 2px; }
.tl-bar { position: absolute; top: 0; bottom: 0; left: calc(var(--a) * 1%); width: calc(var(--b) * 1%); min-width: 3px; border-radius: 2px; }
.tl-lock { background: #e0a020; }
.tl-win { background: var(--ink-2); }
.tl-pulse { background: var(--danger); }
.tl-note { margin: 0; }
@media (max-width: 480px) { .tl-row { grid-template-columns: 6.5em 1fr 5em; } }

/* ---------- downloads ---------- */
.dl-all-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 0 0 18px; }
.dl-all-row p { margin: 0; }
.dl-version { max-width: 78ch; margin: 0 0 22px; }
.dl-version > p { margin: 0 0 8px; }
.dl-version li { margin-bottom: .5em; }
.dl-all .dl-size { font-weight: 400; }
.dl-programs { margin-top: 28px; max-width: 78ch; }
.dl-programs ul { padding-inline-start: 1.2em; }
.dl-programs li { margin-bottom: .5em; }
.downloads { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.downloads a {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "type name" "type desc" "type size";
  column-gap: 14px; row-gap: 2px; height: 100%;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px;
  text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.downloads a:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.dl-type { grid-area: type; align-self: start; font: 700 .7rem/1 var(--mono); padding: 8px 6px; border-radius: 3px; background: var(--ink); color: var(--bg); min-width: 40px; text-align: center; }
.dl-name { grid-area: name; font-weight: 650; }
.dl-desc { grid-area: desc; font-size: .84rem; color: var(--ink-2); }
.dl-size { grid-area: size; font: .74rem var(--mono); color: var(--ink-3); }

/* ---------- footer ---------- */
.site-foot { padding: 32px 0 48px; font-size: .88rem; color: var(--ink-2); }
.foot-row { display: grid; gap: 4px; }

/* ---------- lightbox ---------- */
.lightbox {
  width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0;
  background: rgba(10, 12, 14, .94); color: #eee;
}
.lightbox::backdrop { background: rgba(10, 12, 14, .7); }
.lightbox[open] { display: flex; flex-direction: column; }
.lb-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid #2a2f34; }
.lb-caption { margin: 0; font-size: .88rem; flex: 1 1 240px; color: #d8dcdf; }
.lb-actions { display: flex; gap: 6px; }
.lightbox .btn { background: #1d2226; color: #eee; border-color: #3a4147; }
.lightbox .btn[aria-pressed="true"] { background: #eee; color: #111; }
.lb-stage { flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 12px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; background: #fff; }
.lb-stage.zoomed { overflow: auto; display: block; padding: 0; }
.lb-stage.zoomed img { max-width: none; max-height: none; cursor: zoom-out; }
.lb-stage.photo img { background: transparent; }

/* ---------- print ---------- */
@media print {
  :root { --bg: #fff; --bg-alt: #fff; --panel: #fff; --ink: #000; --shadow: none; }
  .site-head, .viewer, #viewer, .videos iframe, .film iframe, .hero-actions, .stepper-nav, .stepper-dots, .check-foot button, .skip, .lightbox, .hotspot, .hotspot-lead, .hotspot-lines, .hotspot-card, .motion-controls { display: none !important; }
  .section { padding: 18px 0; break-inside: auto; }
  .print-only { display: block; }
  .screen-only { display: none !important; }
  .table-scroll { overflow: visible; }
  a { color: #000; }
  .protocol > li, .note-card, figure { break-inside: avoid; }
}

/* keep big single images within the viewport */
.gal-hero img, .layout-figure img { width: 100%; max-height: min(72vh, 640px); object-fit: contain; background: var(--stage); }
.part-meta { display: block; margin-top: 4px; }
.gal-grid img, .p-fig img { aspect-ratio: 4 / 3; object-fit: contain; width: 100%; }
.gal-hero img:not([src]), .layout-figure img { min-height: 200px; }

/* single-column grids must not grow past the viewport (tables scroll inside their own box) */
.cols-2, .cols-logbook, .viewer-body, .hotspot-layout, .stepper-main, .hero-grid, .protocol > li { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .cols-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (min-width: 960px) { .cols-logbook { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } .hero-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } .hotspot-layout { grid-template-columns: minmax(0, 1fr) 300px; } }
@media (min-width: 900px) { .viewer-body { grid-template-columns: minmax(0, 1fr) 300px; } .stepper-main { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
@media (min-width: 760px) { .protocol > li.has-fig { grid-template-columns: minmax(0, 1fr) 280px; } }

[hidden] { display: none !important; }
@media (max-width: 900px) { .site-nav { flex: 1 0 100%; } }
.viewer-fallback p { width: 100%; }
.viewer-fallback .fb-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); }
.viewer-stage:has(.viewer-fallback:not([hidden])) { aspect-ratio: auto; height: auto; min-height: 0; }
.viewer-stage:has(.viewer-fallback:not([hidden])) .viewer-fallback { position: static; padding: 48px 16px 20px; }
.data td { min-width: 9.5em; }
.timing td:first-child { min-width: 0; }
.hotspot { width: 24px; height: 24px; font-size: .68rem; }
@media (max-width: 600px) { .hotspot { width: 20px; height: 20px; font-size: .6rem; border-width: 1.5px; } }

/* ---- integration pass: real assets ---- */
figure.img-missing, .gal-grid figure:has(.img-missing) { display: none; }
.stepper-img.img-missing { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; }
.stepper-img.img-missing::after { content: var(--i18n-picture-missing, "Picture not available yet"); font: 600 .74rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
@media (min-width: 760px) { .gal-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gal-grid-2 img { aspect-ratio: 3 / 2; }
.annotated { margin-top: 8px; }
.view-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.view-tabs button {
  font: 600 .82rem/1 var(--sans); padding: 9px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--panel); color: var(--ink-2);
}
.view-tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
/* hotspot image keeps its own aspect (portrait or landscape) and never exceeds the viewport */
.hotspot-layout > .hotspot-wrap { justify-self: center; width: fit-content; max-width: 100%; }
.hotspot-wrap img { width: auto; max-width: 100%; max-height: min(78vh, 760px); }
.hotspot-legend { max-height: min(78vh, 760px); }
@media (max-width: 959px) { .hotspot-legend { max-height: 320px; border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 4px; } }
.labeled-fallback img { max-height: min(85vh, 900px); width: auto; margin: 0 auto; }
.viewer-progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--rule-2); z-index: 2; }
.viewer-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.part-filter {
  width: 100%; margin: 0 0 8px; padding: 8px 10px; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--bg); color: var(--ink); font: .86rem var(--sans);
}
.part-group { margin-bottom: 2px; }
.part-group details > summary {
  display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none;
  padding: 7px 8px; border-radius: 4px;
  font: 600 .72rem/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2);
}
.part-group details > summary::-webkit-details-marker { display: none; }
.part-group details > summary::before { content: "\25B8"; margin-inline-end: 8px; transition: transform .15s; }
.part-group details[open] > summary::before { transform: rotate(90deg); }
.part-group details > summary > span:first-child { flex: 1; }
.part-group summary:hover { background: var(--rule-2); }
.group-count { font-weight: 500; color: var(--ink-3); }
.part-group ul { list-style: none; margin: 0 0 6px; padding: 0; padding-inline-start: 10px; border-inline-start: 1px solid var(--rule-2); margin-inline-start: 12px; }
.motion-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.motion-clip { margin: 0; }
.motion-frame { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--rule); background: var(--stage); }
.motion-frame video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
@media (min-width: 760px) { .motion-grid { grid-template-columns: repeat(2, 1fr); } }
.motion-fs { display: inline-flex; align-items: center; justify-content: center; padding-inline: 9px; }
.motion-controls { position: absolute; inset-inline-end: 10px; bottom: 10px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: calc(100% - 20px); }
/* full screen: the whole frame on black (the browser adds its own controls) */
.motion-frame video:fullscreen { object-fit: contain; background: #000; aspect-ratio: auto; height: 100%; }
.motion-frame video:-webkit-full-screen { object-fit: contain; background: #000; aspect-ratio: auto; height: 100%; }
.about-pictures { font-size: .88rem; color: var(--ink-2); background: var(--panel); border: 1px solid var(--rule); border-inline-start: 4px solid var(--ink-3); border-radius: var(--radius); padding: 10px 14px; max-width: 78ch; margin: 0 0 8px; }
.layout-figure .annotated { margin-top: 0; }
.layout-figure > * + * { margin-top: 20px; }
/* phones: fixed stage height (aspect-ratio plus min-height made the stage wider than the panel) */
.viewer-stage { width: 100%; min-width: 0; }
@media (max-width: 899px) { .viewer-stage { aspect-ratio: auto; height: clamp(360px, 92vw, 520px); } }
@media (max-width: 899px) {
  .viewer-stage { height: auto; display: flex; flex-direction: column; }
  .viewer-canvas { position: relative; inset: auto; height: clamp(320px, 88vw, 500px); }
  .viewer-controls { position: static; padding: 10px 12px; border-top: 1px solid var(--rule); background: var(--panel); flex-wrap: nowrap; }
  .explode { flex: 1 1 auto; min-width: 0; padding: 0 10px; gap: 8px; }
  .explode input { min-width: 60px; }
  .viewer-controls .btn-sm { padding: 8px 10px; }
}
@media (max-width: 380px) { .explode > span { display: none; } }
.btn { white-space: nowrap; }
.sources { padding-inline-start: 1.2em; font-size: .9rem; max-width: 80ch; }
.sources li { margin-bottom: .5em; }

/* ---------- films and campaign note ---------- */
.campaign-note { margin: 14px 0 0; padding: 10px 14px; border: 1px dashed var(--rule); border-radius: var(--radius); font-size: .92rem; color: var(--ink-2); }
.campaign-note strong { color: var(--ink); }
.films-note { margin: 0 0 18px; color: var(--ink-2); }
.film { margin: 0; min-width: 0; }
.film video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #0d0f11; border-radius: var(--radius); border: 1px solid var(--rule); }
.film figcaption { margin-top: 8px; font-size: .9rem; color: var(--ink-2); overflow-wrap: anywhere; }
.film figcaption strong { color: var(--ink); }
.film-len { font: .78rem var(--mono); color: var(--ink-3); margin: 0 .4em; }
.film-main { margin-bottom: 26px; }
.films-grid { display: grid; gap: 22px; }
@media (min-width: 640px) { .films-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .films-grid { grid-template-columns: repeat(3, 1fr); } }


/* ---------- lists never trap the wheel (20 Nov 2026) ----------
   The part list beside the 3D viewer and the numbered legends beside the annotated pictures used to
   scroll on their own, so a wheel or two-finger scroll over them moved the list and the page stood
   still. They are now clipped, with a button that opens the whole list in the page. Scripts can still
   bring an entry into view (scrollTop works on a clipped list). */
.hotspot-legend, .part-list { overflow: hidden; }
.table-scroll { overflow-y: hidden; }
.list-wrap { min-width: 0; display: flex; flex-direction: column; }
.viewer-side > .list-wrap { flex: 1; min-height: 0; }
.viewer-side > .list-wrap > .part-list { flex: 1; min-height: 0; }
.list-wrap.is-open > .hotspot-legend, .list-wrap.is-open > .part-list { max-height: none; flex: none; }
.viewer-side.is-open { max-height: none; }
.list-more {
  align-self: flex-start; margin-top: 8px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 4px;
  background: var(--panel); color: var(--ink); font: 600 .78rem/1.2 var(--sans); cursor: pointer;
}
.list-more:hover { background: var(--rule-2); }
@media print { .list-more { display: none; } .hotspot-legend, .part-list { max-height: none; overflow: visible; } }

/* source videos: the YouTube player loads only on a click, so nothing heavy loads while scrolling */
.yt-load { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; cursor: pointer; color: #f2efe8;
  background: radial-gradient(ellipse at 50% 40%, #2a3036 0%, #0d0f11 75%); display: grid; place-content: center; justify-items: center; gap: 8px; font: 600 .95rem/1.2 var(--sans); }
.yt-load:hover .yt-play, .yt-load:focus-visible .yt-play { background: var(--accent); }
.yt-play { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.16); border: 2px solid rgba(255,255,255,.7); position: relative; transition: background .15s; }
.yt-play::after { content: ""; position: absolute; left: 25px; top: 18px; border-style: solid; border-width: 13px 0 13px 21px; border-color: transparent transparent transparent #fff; }
.yt-note { font: 400 .74rem/1.2 var(--mono); color: #b9b4a8; }
/* films: the same click-to-load player, with the film's poster behind the play button */
.yt-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.6); }
.yt-poster > span { position: relative; }
.yt-poster .yt-play { background: rgba(13,15,17,.72); }
.yt-poster .yt-label, .yt-poster .yt-note { background: rgba(13,15,17,.78); padding: 3px 9px; border-radius: 4px; }
.yt-poster .yt-note { color: #e4e0d6; }
.film .video-frame { border-radius: var(--radius); }
.film-link { margin: 4px 0 0; font-size: .85rem; }

/* the picture keeps its own height beside a taller legend, so the numbered markers stay on the parts */
.hotspot-layout { align-items: start; }
.hotspot-layout > .hotspot-wrap { align-self: start; }


/* ---------- languages (21 Nov 2026) ----------
   Translated pages are built by tools/build_i18n.py into <lang>/index.html. Everything with a side above
   uses logical properties (inline-start/end), so it mirrors for right-to-left pages; the rules below
   cover what logical properties cannot. Pictures, numbered markers on pictures, the timeline bars and
   the 3D viewer keep their left-to-right geometry. */

/* language menu in the header (present only when more than one language is built) */
.lang-switch { position: relative; flex: none; }
.lang-switch > summary {
  list-style: none; display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 9px;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); cursor: pointer;
  font: 600 .74rem/1 var(--mono); letter-spacing: .06em; color: var(--ink-2);
}
.lang-switch > summary::-webkit-details-marker { display: none; }
.lang-switch > summary::after { content: ""; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; }
.lang-switch > summary:hover, .lang-switch[open] > summary { color: var(--ink); border-color: var(--ink-3); }
.lang-globe { fill: none; stroke: currentColor; stroke-width: 1.6; flex: none; }
.lang-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 30;
  display: grid; grid-template-columns: repeat(2, minmax(8.5rem, 1fr)); gap: 2px;
  list-style: none; margin: 0; padding: 6px; max-height: min(75vh, 32rem); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow);
}
.lang-menu a { display: block; padding: 8px 10px; border-radius: 4px; color: var(--ink); text-decoration: none; font-size: .9rem; line-height: 1.3; }
.lang-menu a:hover { background: var(--rule-2); color: var(--ink); }
.lang-menu a[aria-current="page"] { font-weight: 650; box-shadow: inset 3px 0 0 var(--accent); }
/* With the menu present the section links may not all fit: they then scroll sideways from the first one
   (an end-aligned row that overflows would hide its first links where they cannot be scrolled to). */
.head-row:has(> .lang-switch) .site-nav ul { width: max-content; margin-inline-start: auto; justify-content: flex-start; }
/* Phones: the brand keeps its own row; the language button sits at the end of the scrolling link row. */
@media (max-width: 900px) {
  .head-row:has(> .lang-switch) .site-nav { flex: 1 1 0; margin-inline-end: 0; }
  .lang-switch { margin-inline-start: 6px; }
  .lang-switch > summary { min-height: 29px; padding: 3px 7px; }
}
@media print { .lang-switch { display: none; } }

/* one-line notes that appear only on translated pages: films, labelled pictures, documents, other sites */
.i18n-note {
  font-size: .85rem; color: var(--ink-2); max-width: 78ch; margin: 6px 0 16px;
  padding-inline-start: 10px; border-inline-start: 3px solid var(--ink-3);
}

/* translated pages only: a long word (a compound, a chemical name) wraps rather than widening its column */
html:not([lang="en"]) body { overflow-wrap: anywhere; }
/* Long compounds (Finnish, Hungarian, German ...) in narrow table columns: break at syllables where the browser can. */
html:not([lang="en"]) :is(td, th) { -webkit-hyphens: auto; hyphens: auto; }

/* right to left */
[dir="rtl"] .skip { left: auto; right: -9999px; }
[dir="rtl"] .skip:focus { right: 8px; }
[dir="rtl"] .site-nav { mask-image: linear-gradient(270deg, #000 92%, transparent); }
[dir="rtl"] .part-list button[aria-pressed="true"] { box-shadow: inset -3px 0 0 var(--accent); }
[dir="rtl"] .lang-menu a[aria-current="page"] { box-shadow: inset -3px 0 0 var(--accent); }
[dir="rtl"] .part-group details > summary::before { content: "\25C2"; }
[dir="rtl"] .part-group details[open] > summary::before { transform: rotate(-90deg); }
[dir="rtl"] .checklist legend { float: right; }
[dir="rtl"] .lb-actions, [dir="rtl"] .explode input, [dir="rtl"] .tl-track { direction: ltr; }
[dir="rtl"] code, [dir="rtl"] .mono, [dir="rtl"] .dl-size { unicode-bidi: isolate; }

/* system fonts for other scripts (no font downloads). Latin text keeps the stack above. */
:root:lang(ar), :root:lang(fa) {
  --sans: system-ui, -apple-system, "SF Arabic", "Geeza Pro", "Segoe UI", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
}
:root:lang(ur) {
  --sans: system-ui, -apple-system, "Noto Nastaliq Urdu", "Urdu Typesetting", "SF Arabic", "Geeza Pro", "Segoe UI", "Noto Sans Arabic", Tahoma, sans-serif;
}
:root:lang(hi) {
  --sans: system-ui, -apple-system, "Kohinoor Devanagari", "Devanagari Sangam MN", "Nirmala UI", Mangal, "Noto Sans Devanagari", sans-serif;
}
:root:lang(bn) {
  --sans: system-ui, -apple-system, "Kohinoor Bangla", "Bangla Sangam MN", "Nirmala UI", Vrinda, "Noto Sans Bengali", sans-serif;
}
:root:lang(th) {
  --sans: system-ui, -apple-system, Thonburi, "Sukhumvit Set", "Leelawadee UI", Tahoma, "Noto Sans Thai", sans-serif;
}
:root:lang(ja) {
  --sans: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
}
:root:lang(zh) {
  --sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
}
:root:lang(ko) {
  --sans: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif;
}
:root:is(:lang(ar), :lang(fa), :lang(ur), :lang(hi), :lang(bn), :lang(th), :lang(ja), :lang(zh), :lang(ko)) { --serif: var(--sans); }
:root:is(:lang(ar), :lang(fa), :lang(ur), :lang(hi), :lang(bn), :lang(th), :lang(ja), :lang(zh), :lang(ko)) .strapline { font-style: normal; font-weight: 600; }
/* letter-spacing breaks joined and stacked letters in these scripts */
:root:is(:lang(ar), :lang(fa), :lang(ur), :lang(hi), :lang(bn), :lang(th)) body * { letter-spacing: normal !important; }
:root:lang(ur) body { line-height: 1.9; }
:root:is(:lang(ar), :lang(fa)) body { line-height: 1.75; }

/* ---- 21 Nov 2026: fixes reported by the translators ---- */
/* Right to left: cells and labels that hold only Latin text and numbers ("20 ms", "3 min 56 s") keep their own order */
[dir="rtl"] td, [dir="rtl"] th, [dir="rtl"] .film-len, [dir="rtl"] .stepper-count, [dir="rtl"] .parts-title { unicode-bidi: plaintext; }
[dir="rtl"] td, [dir="rtl"] th { text-align: right; }
/* English quotations and titles inside right-to-left text are isolated, so their punctuation stays with them */
[dir="rtl"] [lang="en"] { unicode-bidi: isolate; direction: ltr; }
[dir="rtl"] q { quotes: "\00AB" "\00BB" "\2039" "\203A"; }
/* Arabic-script letters must join: no monospaced face for them */
:root:is(:lang(ar), :lang(fa), :lang(ur)) { --mono: var(--sans); }
/* Korean breaks lines between words, not inside them */
:root:lang(ko) body { word-break: keep-all; }
/* Vietnamese needs a serif with its stacked accents */
:root:lang(vi) { --serif: "Times New Roman", "Noto Serif", "Liberation Serif", serif; }

/* the power-parts table on a narrow screen: one block per part, each cell under its column heading */
@media (max-width: 720px) {
  table.power-parts, table.power-parts tbody, table.power-parts tr, table.power-parts th, table.power-parts td { display: block; width: auto; }
  table.power-parts thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.power-parts tr { padding: 12px 0; border-bottom: 1px solid var(--rule); }
  table.power-parts tr:last-child { border-bottom: 0; }
  table.power-parts th[scope="row"] { font-size: 1rem; padding: 0 12px 4px; border: 0; }
  table.power-parts td { padding: 4px 12px; border: 0; }
  table.power-parts td[data-label]::before { content: attr(data-label); display: block; font-family: var(--mono, ui-monospace, monospace); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-top: 6px; }
}
