/* =====================================================================
   Bench Press Scientific Guide — stylesheet
   Look: a printed training manual. Paper, ink, ruled lines.
   Colour only comes from competition plate colours, one per section:
     The Science = blue (20 kg)   Bench Press = red (25 kg)
     Case Study  = yellow (15 kg) Sources     = green (10 kg)
   Mobile-first: base styles are for phones; @media (min-width: …)
   adds the tablet (768px) and computer (1024px+) layouts.
   ===================================================================== */

/* ---------- 0. Font ---------- */
/* Archivo, stored in fonts/ (no requests to Google). Only the two styles the site uses:
   bold at normal width (headings) and extra-bold at 125% width (site name, page titles, big numbers).
   Licence: SIL Open Font License, see fonts/OFL.txt. */
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-bold.woff2") format("woff2");
  font-weight: 700;
  font-stretch: 100%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-extrabold-expanded.woff2") format("woff2");
  font-weight: 800;
  font-stretch: 125%;
  font-style: normal;
  font-display: swap;
}

/* ---------- 1. Tokens ---------- */
/* Light (default): chalk-white and iron-black. Dark (turned on with the
   switch in the header): rubber-floor black with chalk text.
   Plate colours mark the sections. */
:root {
  --paper: #f3f4f4;       /* chalk */
  --paper-2: #e5e7e8;     /* placeholder boxes */
  --ink: #16181b;         /* iron */
  --muted: #575d65;
  --rule: rgb(22 24 27 / 0.16);

  /* competition plate colours */
  --red: #c4312a;
  --blue: #2451a6;
  --yellow: #e2b322;
  --green: #2f7a4b;
  --on-plate: #ffffff;    /* text on red / blue / green */
  --on-yellow: #16181b;   /* text on yellow */

  --sec: var(--ink);      /* current section colour (set per page below) */
  --sec-ink: var(--on-plate);

  --note-bg: #fbf0c6;     /* "what goes here" notes */
  --note-ink: #3d3520;
  --note-rule: var(--yellow);
  --video-bg: #26282c;

  /* RPE scale (Effort page): RPE 10 strongest, RPE 6 faintest. Text on each step is 4.5:1 or more. */
  --rpe-10: #1e3f8a; --rpe-ink-10: #ffffff;
  --rpe-9:  #2f5bb8; --rpe-ink-9:  #ffffff;
  --rpe-8:  #6b8fd6; --rpe-ink-8:  #16181b;
  --rpe-7:  #a9bfea; --rpe-ink-7:  #16181b;
  --rpe-6:  #dbe4f6; --rpe-ink-6:  #16181b;
  --ph-cross: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 0L100 100M100 0L0 100' stroke='%2316181b' stroke-opacity='.16' stroke-width='.6' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");

  --font-head: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;

  --gutter: 1rem;         /* 16px side padding on phones */
  --wrap: 70rem;
  --measure: 36rem;       /* about 65 characters per line */
  color-scheme: light;
}
:root[data-theme="dark"] {
    --paper: #121315;     /* rubber gym floor */
  --paper-2: #1d1f22;
  --ink: #e9ebec;       /* chalk */
  --muted: #9ea4ab;
  --rule: rgb(233 235 236 / 0.16);
  --red: #f0605a;
  --blue: #739cf0;
  --yellow: #f0c443;
  --green: #55bd7e;
  --on-plate: #121315;
  --on-yellow: #121315;
  --note-bg: #332b12;
  --note-ink: #f1e4bb;
  --video-bg: #050506;
  --rpe-10: #2f5fd0; --rpe-ink-10: #ffffff;
  --rpe-9:  #2a4b9a; --rpe-ink-9:  #e9ebec;
  --rpe-8:  #26396f; --rpe-ink-8:  #e9ebec;
  --rpe-7:  #222d4c; --rpe-ink-7:  #e9ebec;
  --rpe-6:  #1d2333; --rpe-ink-6:  #e9ebec;
  --ph-cross: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 0L100 100M100 0L0 100' stroke='%23e9ebec' stroke-opacity='.14' stroke-width='.6' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  color-scheme: dark;
}
@media (min-width: 768px) {
  :root { --gutter: 2rem; }
}

body[data-section="science"] { --sec: var(--blue); }
body[data-section="bench"]   { --sec: var(--red); }
body[data-section="case"]    { --sec: var(--yellow); --sec-ink: var(--on-yellow); }
body[data-section="sources"] { --sec: var(--green); }

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden {        /* read by screen readers, not shown */
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;   /* 17px on phones */
  line-height: 1.6;
  overflow-wrap: break-word;
  transition: background-color 0.2s, color 0.2s;
}
@media (min-width: 768px) {
  body { font-size: 1.125rem; } /* 18px */
}

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

h1, h2, h3 {
  margin: 0 0 0.5em;
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.1;
  text-wrap: balance;
}
h1 {
  font-size: clamp(2.25rem, 1.5rem + 3.6vw, 4rem);
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.015em;
  line-height: 1;
}
h2 { font-size: clamp(1.5rem, 1.3rem + 1vw, 2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25rem; }
li + li { margin-top: 0.3em; }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--sec);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 4px; }

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

.mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--paper);
}
.skip-link:focus { top: 1rem; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- 3. "What goes here" notes (delete each one once written) ---------- */
.todo {
  max-width: var(--measure);
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--note-bg);
  border-left: 3px solid var(--note-rule);
  color: var(--note-ink);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.todo::before { content: "WRITE HERE: "; font-weight: 700; }
.todo.todo-visual::before { content: "SHOW HERE: "; }

/* ---------- 4. Header + navigation ---------- */
.plates {               /* thin strip of the four plate colours */
  display: flex;
  height: 6px;
}
.plates span { flex: 1; }
.plates span:nth-child(1) { background: var(--red); }
.plates span:nth-child(2) { background: var(--blue); }
.plates span:nth-child(3) { background: var(--yellow); }
.plates span:nth-child(4) { background: var(--green); }

.site-header { border-bottom: 2px solid var(--ink); }
.header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "brand toggle" "nav nav";
  align-items: center;
  gap: 0.75rem 1rem;
  padding-top: 0.875rem;
}
.brand {
  grid-area: brand;
  display: block;
  width: fit-content;
  font-family: var(--font-head);
  font-size: 1.125rem;
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-decoration: none;
  text-wrap: balance;   /* phones: "Bench Press / Scientific Guide" */
}
.site-nav { grid-area: nav; min-width: 0; }

/* Dark mode switch */
.theme-toggle {
  grid-area: toggle;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}
.theme-toggle:hover .theme-label { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.switch {
  position: relative;
  flex: none;
  width: 2.5rem;
  height: 1.375rem;
  border: 2px solid var(--ink);
}
.knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.375rem - 8px);
  height: calc(1.375rem - 8px);
  background: var(--ink);
  transition: transform 0.15s;
}
.theme-toggle[aria-checked="true"] .knob { transform: translateX(calc(2.5rem - 1.375rem)); }

/* Phones: a ruled 3 + 2 grid of links. */
.site-nav ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin: 0 calc(var(--gutter) * -1);
  padding: 0;
  border-top: 1px solid var(--rule);
}
.site-nav li { grid-column: span 2; margin: 0; }
.site-nav li:nth-child(n + 4) { grid-column: span 3; }
.site-nav a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.25rem;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-head);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav li:nth-child(3) a,
.site-nav li:nth-child(5) a { border-right: 0; }
.site-nav li:nth-child(n + 4) a { border-bottom: 0; }
.site-nav a::after {          /* coloured bar under the current page */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: var(--c, var(--ink));
  transition: height 0.12s;
}
.site-nav a:hover::after { height: 3px; }
.site-nav a[aria-current]::after { height: 5px; }
.nav-science { --c: var(--blue); }
.nav-bench   { --c: var(--red); }
.nav-case    { --c: var(--yellow); }
.nav-sources { --c: var(--green); }

@media (max-width: 359px) {
  .site-nav a { font-size: 0.875rem; }
}

/* Phones under 600px: compact header (about 100px tall). Site name on two short lines with the
   Dark switch beside it, then the links in one row that scrolls sideways if it doesn't fit. */
@media (max-width: 599px) {
  .header-inner { row-gap: 0; padding-top: 0.125rem; }
  .brand { padding-block: 0.25rem; font-size: 1rem; line-height: 1.05; }
  .site-nav ul {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .site-nav ul::-webkit-scrollbar { display: none; }
  .site-nav li:nth-child(n) { flex: 1 0 auto; }
  .site-nav li:nth-child(n) a {
    min-height: 44px;
    padding: 0 0.875rem;
    border-bottom: 0;
    border-right: 1px solid var(--rule);
  }
  .site-nav li:last-child a { border-right: 0; }
  /* Soft fade on the right edge while more links are off-screen (js/theme.js adds .has-more). */
  .site-nav { position: relative; }
  .site-nav::after {
    content: "";
    position: absolute;
    top: 1px;
    bottom: 0;
    right: calc(var(--gutter) * -1);
    width: 3rem;
    background: linear-gradient(to right, transparent, var(--paper) 85%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .site-nav.has-more::after { opacity: 1; }
}

/* Tablet and small laptops (768-1151px): site name and switch on one line, then all 5 links in one ruled row. */
@media (min-width: 768px) and (max-width: 1151px) {
  .header-inner { padding-top: 1rem; row-gap: 1rem; }
  .brand { font-size: 1.25rem; }
  .site-nav ul { grid-template-columns: repeat(5, 1fr); }
  .site-nav li:nth-child(n) { grid-column: span 1; }
  .site-nav li:nth-child(n) a { border-bottom: 0; border-right: 1px solid var(--rule); font-size: 1rem; }
  .site-nav li:last-child a { border-right: 0; }
}

/* Wide screens: name on the left, then the links, then the switch, in one row.
   Starts at 1152px: below that the three don't fit side by side, so the tablet layout is used. */
@media (min-width: 1152px) {
  .header-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand nav toggle";
    align-items: stretch;
    gap: 0;
    padding-top: 0;
  }
  .brand { align-self: center; padding-block: 1.1rem; font-size: 1.25rem; }
  .site-nav { justify-self: end; }
  .site-nav ul {
    display: flex;
    height: 100%;
    margin: 0;
    border: 0;
  }
  .site-nav li:nth-child(n) a {
    height: 100%;
    padding: 0 1rem;
    border: 0;
    border-left: 1px solid var(--rule);
    font-size: 1rem;
  }
  .theme-toggle { padding-left: 1rem; border-left: 1px solid var(--rule); }
}

/* ---------- 5. Page heading ---------- */
.page-head {
  padding-block: 2rem 1.75rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2rem;
}
@media (min-width: 768px) {
  .page-head { padding-block: 3.5rem 2.5rem; margin-bottom: 3rem; }
}
.crumbs { margin-bottom: 1.25rem; color: var(--muted); }
.crumbs a { color: var(--muted); }

.sec-num {               /* the coloured section number, like a plate label */
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.15em 0.45em 0.1em;
  background: var(--sec);
  color: var(--sec-ink);
  font-family: var(--font-head);
  font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 1;
}
.page-head h1 { max-width: 18ch; }
.lede {
  max-width: var(--measure);
  color: var(--muted);
  font-size: 1.125rem;
}
@media (min-width: 768px) {
  .lede { font-size: 1.25rem; }
}
.page-head .todo { margin-top: 1rem; }

/* Topic strip on Science pages: 1.1  1.2  1.3  1.4  1.5 */
.topics {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: var(--measure);
  margin: 1.75rem 0 0;
  padding: 0;
  border: 1px solid var(--ink);
}
.topics li { margin: 0; }
.topics li + li { border-left: 1px solid var(--ink); }
.topics a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  height: 100%;
  padding: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}
.topics a:hover { background: var(--paper-2); }
.topics a[aria-current] { background: var(--sec); color: var(--sec-ink); }
.topic-name { display: none; }
@media (min-width: 1024px) {
  .topics { max-width: none; }
  .topics a { padding: 0.5rem; }
  .topic-name { display: block; font-family: var(--font-head); font-size: 0.875rem; font-weight: 700; }
}

/* ---------- 6. Article layout ---------- */
.layout { display: grid; gap: 2rem; padding-bottom: 1rem; }
.article { min-width: 0; max-width: var(--measure); }
.article > section { margin-bottom: 3rem; }

.article > section > h2 {
  padding-top: 1.25rem;
  border-top: 2px solid var(--ink);
}
/* Subheadings inside a section */
.article > section > h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  font-size: clamp(1.125rem, 1.05rem + 0.4vw, 1.3rem);
}

/* "On this page" */
/* Hidden on phones and tablets (pages are short; the topic strip and
   previous/next links do the navigating). A sidebar on computers. */
.toc { display: none; }
.toc-title { margin-bottom: 0.25rem; color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.toc li { margin: 0; border-bottom: 1px solid var(--rule); }
.toc a {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.7rem 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}
.toc a:hover { text-decoration: underline; text-decoration-color: var(--sec); }

@media (min-width: 1024px) {
  .layout {
    grid-template-columns: 13rem minmax(0, 1fr);
    gap: 4rem;
    align-items: start;
  }
  .toc { display: block; position: sticky; top: 1.5rem; }
}

/* ---------- 7. Content pieces ---------- */

/* In-text MLA citation, e.g. (Schoenfeld). Links to the Sources page. */
.cite {
  /* long citations, e.g. (American College of Sports Medicine), may wrap on phones */
  text-decoration-style: dotted;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1.5px;
}
.cite:hover { text-decoration-style: solid; text-decoration-color: var(--green); }

/* Key points box */
.keypoints {
  margin-bottom: 3rem;
  padding: 1rem 1.25rem 0.25rem;
  border: 2px solid var(--ink);
  border-top-width: 6px;
  border-top-color: var(--sec);
}
.keypoints h2 { font-size: 1.125rem; margin-bottom: 0.5rem; }
.keypoints ol { padding-left: 1.25rem; }
.keypoints li::marker { font-family: var(--font-mono); font-size: 0.875em; color: var(--muted); }

/* Figures + placeholder boxes (swap for a real image later) */
.fig { margin: 2rem 0; }
.ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  aspect-ratio: 4 / 3;
  padding: 1rem;
  border: 1px solid var(--ink);
  background-color: var(--paper-2);
  /* the classic "image goes here" cross */
  background-image: var(--ph-cross);
  background-size: 100% 100%;
  text-align: center;
}
@media (min-width: 768px) {
  .ph { aspect-ratio: 16 / 9; }
}
.ph-tag, .ph-label {
  padding: 0.15rem 0.6rem;
  background: var(--paper);
}
.ph-tag {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ph-label {
  max-width: 90%;
  font-family: var(--font-head);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}
.ph--video { background-color: var(--video-bg); background-image: none; border-color: var(--video-bg); }
.ph-play {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 0.5rem;
  padding-left: 0.2rem;
  background: var(--yellow);
  color: var(--on-yellow);
  font-size: 1.25rem;
  line-height: 1;
}
.fig .todo { margin-top: 0.75rem; }
.fig img {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--rule);
  background: #ffffff;   /* always white, even in dark mode, so line art on a clear background shows */
}
.fig--photo img { padding: 0; border: 0; background: none; }
figure { margin: 0; }
figcaption {
  max-width: var(--measure);
  margin-top: 0.625rem;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.fig-no {
  margin-right: 0.35rem;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
}
/* long web addresses in captions wrap instead of pushing the page sideways */
figcaption a {
  overflow-wrap: anywhere;
  padding-block: 0.25rem;   /* invisible: makes each link at least 24px tall to tap */
}

/* "Enlarge" button (added by js/enlarge.js) and the full-screen figure view */
.enlarge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  margin-top: 0.375rem;
  padding: 0 0.75rem;
  border: 1.5px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}
.enlarge:hover { border-color: var(--ink); }
.enlarge:focus-visible, .zoom-close:focus-visible { outline: 3px solid var(--sec); outline-offset: 2px; }
.enlarge-icon { flex: none; }

html.zoom-open { overflow: hidden; }
.zoom {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
}
.zoom::backdrop { background: rgb(0 0 0 / 0.6); }
.zoom-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  padding: max(0.75rem, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right))
           max(1rem, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}
.zoom-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.zoom-title { margin: 0; color: var(--muted); }
.zoom-close {
  min-height: 44px;
  padding: 0 1rem;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.zoom-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.zoom-stage svg { width: 100%; height: 100%; max-width: none; }
.zoom-stage img { width: auto; height: auto; max-width: 100%; max-height: 100%; }
.zoom-stage.is-img img { padding: 0.75rem; border: 1px solid var(--rule); background: #ffffff; }
.zoom-stage.is-html { overflow: auto; align-items: flex-start; }
.zoom-stage.is-html > .diagram { width: 100%; max-width: 48rem; margin: auto; border: 0; }
@media (min-width: 1024px) and (min-height: 600px) {
  .zoom-stage.is-html > .diagram { max-width: 40rem; zoom: 1.4; }   /* the meal cards are HTML, so scale them up */
}
/* Zoom cursors, only where there's a mouse or trackpad */
@media (pointer: fine) {
  .fig--zoomable img, .fig--zoomable svg.dg, .fig--zoomable .diagram { cursor: zoom-in; }
  .zoom-stage > * { cursor: zoom-out; }
  .fig--zoomable a, .zoom-stage a { cursor: pointer; }
}
.zoom-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}
@media (min-width: 600px) {
  .zoom-hint { display: none; }
}
.zoom-cap {
  width: 100%;
  max-width: 48rem;
  max-height: 30vh;
  margin: 0 auto;
  overflow: auto;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.zoom-cap a { overflow-wrap: anywhere; }

/* Built diagrams (inline SVG in the HTML).
   Every colour comes from the tokens above, so diagrams follow dark mode
   and the section colour (--sec). Sizes inside the SVG are in viewBox units:
   each diagram is 320 units wide, and the box never shrinks below 288px on a
   phone, so 16-unit text never shows smaller than 14px. */
.diagram {
  padding: 1.25rem 0 1rem;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
.diagram svg { width: 100%; max-width: 26rem; height: auto; overflow: visible; }
.dg text { fill: var(--ink); font-family: var(--font-body); font-size: 16px; }
.dg .b { font-family: var(--font-head); font-weight: 700; }
.dg .sb { font-weight: 700; }
.dg .mono { font-family: var(--font-mono); }
.dg .m { fill: var(--muted); }
.dg .on { fill: var(--sec-ink); }
.dg .acc { fill: var(--sec); }
.dg .fill-sec { fill: var(--sec); }
.dg .fill-2 { fill: var(--paper-2); }
.dg .box { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.dg .box-sec { fill: var(--paper); stroke: var(--sec); stroke-width: 2; }
.dg .ink { fill: var(--ink); }
.dg .line { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.dg .line-sec { fill: none; stroke: var(--sec); stroke-width: 3; stroke-linejoin: round; }
.dg .line-ink { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.dg .grid { fill: none; stroke: var(--rule); stroke-width: 1; }
.dg .off { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.dg .dash { stroke-dasharray: 6 5; }
/* Diagrams with a phone version and a wide version (MLA citation on Sources, timeline on Case Study):
   the phone version under 600px, the wide one from 600px */
.mla-wide, .dg-wide { display: none; }
.diagram svg.mla-wide, .diagram svg.dg-wide { max-width: 40rem; }
@media (min-width: 600px) {
  .mla-wide, .dg-wide { display: block; }
  .mla-stack, .dg-narrow { display: none; }
}
/* Case Study graph and timeline points */
.dg .pt-filled { fill: var(--ink); stroke: var(--paper); stroke-width: 1.5; }
.dg .pt-hollow { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.dg .fill-red { fill: var(--red); }
.diagram[data-loading] { min-height: 16rem; }   /* keeps the space while the CSV loads */
.data-msg { color: var(--muted); font-size: 0.9375rem; }

/* Case Study training log table: scrolls sideways inside its own box on narrow screens,
   with the Date column staying visible */
.table-scroll {
  overflow-x: auto;
  margin-top: 2rem;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
/* The table may be wider than the text column: up to 46rem, but never wider than the space there is */
.table-scroll { width: min(46rem, calc(100vw - 2 * var(--gutter) - 1rem)); max-width: none; }
@media (max-width: 599px) { .table-scroll { width: auto; } }
@media (min-width: 1024px) {
  .table-scroll { width: min(46rem, calc(100vw - 2 * var(--gutter) - 17rem - 1rem)); }   /* minus the "On this page" column */
}
.table-scroll:focus-visible { outline: 3px solid var(--sec); outline-offset: 2px; }
.log { width: 100%; min-width: 36rem; border-collapse: separate; border-spacing: 0; font-size: 0.9375rem; line-height: 1.4; }
.log th, .log td { padding: 0.5rem 0.625rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.log thead th {
  background: var(--paper-2);
  font-family: var(--font-head);
  font-size: 0.875rem;
  font-weight: 700;
  vertical-align: bottom;
}
.log tbody th { font-weight: 700; white-space: nowrap; }
.log th:first-child { position: sticky; left: 0; z-index: 1; background: var(--paper); box-shadow: inset -1px 0 0 var(--rule); }
.log thead th:first-child { z-index: 2; background: var(--paper-2); }
.log .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.log .src { min-width: 9.5rem; }
.log .notes { min-width: 10rem; }
.log tr.injury td, .log tr.injury th { color: var(--muted); }
.table-cap {
  max-width: var(--measure);
  margin: 0.625rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.dg .halo { stroke: var(--paper); stroke-width: 5px; stroke-linejoin: round; paint-order: stroke; }
.dg .dot { fill: var(--sec); stroke: var(--paper); stroke-width: 2; }
.dg .link { fill: var(--sec); text-decoration: underline; text-decoration-thickness: 1px; }
.dg a:hover .link { text-decoration-thickness: 2px; }
.dg .tbox { fill: var(--paper); stroke: var(--sec); stroke-width: 1.5; }
.dg a:hover .tbox { fill: var(--paper-2); }
.dg .unit-off { fill: var(--paper); stroke: var(--muted); stroke-width: 2; }
.dg .rpe-10 { fill: var(--rpe-10); } .dg .rpe-ink-10 { fill: var(--rpe-ink-10); }
.dg .rpe-9 { fill: var(--rpe-9); }   .dg .rpe-ink-9 { fill: var(--rpe-ink-9); }
.dg .rpe-8 { fill: var(--rpe-8); }   .dg .rpe-ink-8 { fill: var(--rpe-ink-8); }
.dg .rpe-7 { fill: var(--rpe-7); }   .dg .rpe-ink-7 { fill: var(--rpe-ink-7); }
.dg .rpe-6 { fill: var(--rpe-6); }   .dg .rpe-ink-6 { fill: var(--rpe-ink-6); }

/* Protein per meal (Nutrition page): HTML cards, 2 x 2 on phones, 4 in a row when there's room */
.meal-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
@media (min-width: 560px) {
  .meal-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .meal-amount { font-size: 1.625rem; }
}
.meal-card {
  padding: 0.75rem 0.75rem 0.875rem;
  border: 1.5px solid var(--ink);
  border-top: 6px solid var(--sec);
  background: var(--paper);
}
.meal-name {
  display: block;
  min-height: 2.5em;     /* room for two lines, so every "~26 g" lines up */
  font-family: var(--font-head);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.25;
}
.meal-amount {
  display: block;
  margin-top: 0.625rem;
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  font-stretch: 125%;
  line-height: 1;
  white-space: nowrap;
}
.meal-unit { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.9375rem; }
.meal-total { margin: 1rem 0 0; font-family: var(--font-head); font-size: 1.0625rem; font-weight: 700; }
.dg a:focus-visible { outline: 2px solid var(--sec); outline-offset: 2px; }

/* Contents lists (Home + The Science) */
.contents { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.contents > li { margin: 0; border-bottom: 1px solid var(--rule); }
.c-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.25rem 1rem;
  align-items: start;
  padding: 1.25rem 0;
  text-decoration: none;
}
.c-num {
  min-width: 2.75rem;
  padding: 0.25em 0.4em 0.15em;
  background: var(--c, var(--ink));
  color: var(--c-ink, var(--on-plate));
  font-family: var(--font-head);
  font-size: 1.0625rem;
  font-weight: 800;
  font-stretch: 125%;
  line-height: 1.2;
  text-align: center;
}
.c-title {
  display: block;
  font-family: var(--font-head);
  font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.625rem);
  font-weight: 700;
  line-height: 1.2;
}
.c-desc { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 1rem; }
.c-arrow { font-family: var(--font-head); font-size: 1.5rem; line-height: 1.2; transition: transform 0.12s; }
.c-row:hover .c-title { text-decoration: underline; text-decoration-color: var(--c, var(--ink)); text-decoration-thickness: 3px; text-underline-offset: 0.2em; }
.c-row:hover .c-arrow { transform: translateX(4px); }
.c-sub {
  list-style: none;
  display: grid;
  margin: -0.5rem 0 1.25rem;
  padding: 0;
}
.c-sub li { margin: 0; }
.c-sub a {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  min-height: 44px;
  padding: 0.6rem 0;
  border-top: 1px dashed var(--rule);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}
.c-sub a:hover { text-decoration: underline; text-decoration-color: var(--blue); }
.c-sub .mono { color: var(--muted); }
@media (min-width: 768px) {
  .c-sub { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2rem; margin-left: 3.75rem; }
}
.c-science { --c: var(--blue); }
.c-bench   { --c: var(--red); }
.c-case    { --c: var(--yellow); --c-ink: var(--on-yellow); }
.c-sources { --c: var(--green); }

/* Home */
.home-head {
  display: grid;
  gap: 2rem;
  padding-block: 2.25rem 2.5rem;
  border-bottom: 1px solid var(--rule);
}
.home-head h1 { font-size: clamp(2.5rem, 1.25rem + 5.5vw, 5rem); }
.home-head .fig { margin: 0; }
.byline {
  margin: -0.25rem 0 1.25rem;
  font-family: var(--font-head);
  font-size: 1.125rem;
  font-weight: 700;
}
@media (min-width: 1024px) {
  .home-head { grid-template-columns: 1fr 1fr; align-items: end; gap: 4rem; padding-block: 4.5rem 3.5rem; }
}
.block { padding-block: 2.5rem; }
@media (min-width: 768px) {
  .block { padding-block: 3.5rem; }
}
.block > h2, .block > p { max-width: var(--measure); }

/* ---------- 8. Sources (MLA works cited) ---------- */
.works-cited { margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.works-cited > p {
  max-width: none;
  margin: 0;
  padding: 1rem 0 1rem 0.5in;
  text-indent: -0.5in;            /* MLA hanging indent: first line flush left, the rest indented 0.5in */
  border-bottom: 1px solid var(--rule);
}
.works-cited a { overflow-wrap: anywhere; }   /* long web addresses wrap instead of widening the page */
.works-cited > p:target { background: var(--paper-2); box-shadow: inset 4px 0 0 var(--green); }

/* Page not found (404.html) */
.nf-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 3rem; padding: 0; list-style: none; }
.nf-links li { margin: 0; }
.nf-links a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 1.25rem;
  border: 2px solid var(--ink);
  font-family: var(--font-head);
  font-weight: 700;
  text-decoration: none;
}
.nf-links a:hover { background: var(--paper-2); }

/* ---------- 9. Previous / next ---------- */
.pager {
  display: grid;
  margin-top: 1rem;
  border-top: 2px solid var(--ink);
}
.pager a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}
.pager .next { text-align: right; }
@media (min-width: 768px) {
  .pager { grid-template-columns: 1fr 1fr; }
  .pager a { border-bottom: 0; }
  .pager .prev { padding-right: 1rem; }
  .pager .next { grid-column: 2; padding-left: 1rem; border-left: 1px solid var(--rule); }
}
.pager-dir { color: var(--muted); }
.pager-title { font-family: var(--font-head); font-size: 1.125rem; font-weight: 700; line-height: 1.25; }
.pager a:hover .pager-title { text-decoration: underline; text-decoration-color: var(--sec); text-decoration-thickness: 3px; }

/* ---------- 10. Footer ---------- */
.site-footer {
  margin-top: 4rem;
  padding-block: 2rem 2.5rem;
  border-top: 2px solid var(--ink);
  font-size: 0.9375rem;
}
.footer-inner { display: grid; gap: 1.25rem; }
.footer-brand {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1.125rem;
  font-weight: 800;
  font-stretch: 125%;
}
.footer-inner p { margin: 0; color: var(--muted); }
.footer-inner .footer-brand { color: var(--ink); }
.footer-inner .footer-note { margin: 0.25rem 0 0.375rem; font-size: 0.9375rem; }

/* Privacy and disclaimer page: "Last updated" line */
.updated { margin: 0 0 3rem; color: var(--muted); }
.footer-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0 1.5rem; margin: 0; padding: 0; }
.footer-nav li { margin: 0; }
.footer-nav a, .to-top { display: inline-flex; align-items: center; min-height: 44px; }
@media (min-width: 1024px) {
  .footer-inner { grid-template-columns: 1fr auto auto; align-items: center; gap: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
