/* ==========================================================================
   makermanuals — styles
   Screen: laptop first, works down to phone.
   Print: A4, colour, one step per row, steps never split across pages.
   ========================================================================== */

/* ---------- fonts (Atkinson Hyperlegible, SIL OFL — see fonts/OFL.txt) ---------- */

@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/atkinson-regular-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/atkinson-regular-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("../fonts/atkinson-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("../fonts/atkinson-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/atkinson-bold-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/atkinson-bold-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- tokens ---------- */

:root {
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;

  --bg: #f4f4f2;
  --surface: #ffffff;
  --ink: #1d1f21;
  --muted: #5f6368;
  --line: #e3e3df;
  --line-strong: #d0d0ca;

  --accent: #f26b1d;        /* safety orange */
  --accent-dark: #c9520f;
  --accent-ink: #ffffff;

  --info: #2a6fdb;   --info-bg: #eaf1fc;   --info-ink: #173e7a;
  --warn: #c98a00;   --warn-bg: #fff5d6;   --warn-ink: #5c4100;
  --danger: #d42b2b; --danger-bg: #fdeceb; --danger-ink: #7a1414;

  --radius: 10px;
  --radius-sm: 6px;
  --container: 1120px;
  --gap: 24px;
}

/* ---------- base ---------- */

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

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

a { color: inherit; }

h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 700; letter-spacing: -0.01em; }

button { font: inherit; color: inherit; }

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

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

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

.print-only { display: none; }

/* ---------- header ---------- */

.site-header { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 30; }
/* jumps to an anchor land below the sticky header */
html { scroll-padding-top: 80px; }

.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}

.wordmark {
  font-size: 26px; font-weight: 700; letter-spacing: -0.02em;
  text-decoration: none;
}
.wordmark span { color: var(--accent); }

/* language dropdown (details/summary, works without JS) */
.lang-switch { position: relative; }
.lang-switch summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid rgba(255,255,255,.35); border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700;
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.lang-switch ul {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  min-width: 180px; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.lang-switch a { display: block; padding: 8px 10px; border-radius: 4px; text-decoration: none; }
.lang-switch a:hover { background: var(--bg); }
.lang-switch a[aria-current] { font-weight: 700; color: var(--accent-dark); }

/* ---------- shared bits ---------- */

.button {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 2px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button-secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.button-secondary:hover { background: var(--surface); border-color: var(--ink); }
.button svg { width: 18px; height: 18px; flex: none; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tag {
  display: inline-block; padding: 3px 10px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: 14px; color: var(--muted); text-decoration: none; background: var(--surface);
}
a.tag:hover { border-color: var(--ink); color: var(--ink); }

.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 15px; color: var(--muted); }
.meta b { color: var(--ink); }

.page-banner { padding: 10px 16px; background: var(--warn-bg); border-bottom: 1px solid #e9cf7d; color: var(--warn-ink); text-align: center; font-size: 15px; }
.page-banner a { color: inherit; font-weight: 700; }
.site-footer { margin-top: 64px; padding: 48px 0 32px; background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px 48px; }
.site-footer h2 { margin: 0 0 8px; font-size: 16px; color: var(--ink); }
.site-footer h2:not(:first-child) { margin-top: 24px; }
.site-footer p { margin: 0 0 10px; max-width: 52ch; }
.site-footer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.site-footer a { color: var(--ink); }
.site-footer a:hover { color: var(--accent-dark); }
.site-footer .footer-bottom { margin: 32px 0 0; max-width: none; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }
@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-about { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.not-found { padding: 64px 0; }
.not-found h1 { font-size: 36px; margin-bottom: 8px; }
.not-found p { font-size: 18px; color: var(--muted); }

/* ---------- overview ---------- */

.search { position: relative; max-width: 560px; margin: 40px 0 0; }
.search svg {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--muted); pointer-events: none;
}
.search input {
  width: 100%; min-height: 52px; padding: 12px 16px 12px 48px;
  font: inherit; font-size: 18px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(242,107,29,.35); }

.no-results { margin: 32px 0 0; font-size: 18px; color: var(--muted); }

/* ---------- categories: tiles on the overview, hero on their page ---------- */

.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 32px 0 0; padding: 0; list-style: none; }
.cat-tile {
  position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius); background: var(--ink); color: #fff; text-decoration: none;
  transition: transform .15s;
}
.cat-tile:hover { transform: translateY(-2px); }
.cat-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cat-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0) 60%); }
.cat-tile span { position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 1; display: grid; gap: 2px; }
.cat-tile strong { font-size: 22px; line-height: 1.15; }
.cat-tile small { font-size: 14px; opacity: .85; }

.section-head { margin: 48px 0 0; font-size: 26px; }
.section-head.small { font-size: 20px; }
main > .section-head + .search { margin-top: 16px; }

.back-link { display: inline-block; margin: 24px 0 0; color: var(--muted); text-decoration: none; font-size: 16px; }
.back-link:hover { color: var(--ink); }

.cat-hero {
  position: relative; margin: 16px 0 24px; overflow: hidden;
  aspect-ratio: 21 / 8; min-height: 240px; border-radius: var(--radius); background: var(--ink); color: #fff;
}
.cat-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cat-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.75), rgba(0,0,0,.05) 65%); }
.cat-hero div { position: absolute; left: 32px; right: 32px; bottom: 28px; z-index: 1; max-width: 640px; }
.cat-hero h1 { font-size: 48px; line-height: 1.05; }
.cat-hero p { margin: 8px 0 0; font-size: 19px; opacity: .92; }
.cat-hero + .filters { margin-top: 0; }

.cat-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.cat-links a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 6px 16px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  font-size: 15px; text-decoration: none;
}
.cat-links a:hover { border-color: var(--ink); }
.cat-links .count { color: var(--muted); margin-left: 6px; }

@media (max-width: 860px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 560px) {
  .cat-tile strong { font-size: 18px; }
  .cat-tile span { left: 12px; right: 12px; bottom: 10px; }
  .cat-hero { aspect-ratio: 4 / 3; }
  .cat-hero div { left: 18px; right: 18px; bottom: 18px; }
  .cat-hero h1 { font-size: 34px; }
  .cat-hero p { font-size: 16px; }
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.filter {
  min-height: 40px; padding: 6px 16px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); font-size: 15px; cursor: pointer;
}
.filter:hover { border-color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter .count { color: var(--muted); margin-left: 4px; }
.filter[aria-pressed="true"] .count { color: rgba(255,255,255,.7); }
.filter[aria-pressed="true"]:not([data-tag="all"])::after { content: "×"; margin-left: 6px; opacity: .7; }
.filter:disabled { opacity: .4; cursor: default; }
.filter:disabled:hover { border-color: var(--line-strong); }

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--gap); margin: 24px 0 0; padding: 0; list-style: none;
}
.card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-decoration: none;
  transition: border-color .15s, transform .15s;
}
a.card:hover { border-color: var(--ink); transform: translateY(-2px); }
.card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--line); }
.card-body { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 14px 16px 16px; }
.card h2 { font-size: 20px; }
.card p { margin: 0 0 4px; color: var(--muted); font-size: 15px; }
.card .meta { margin-top: auto; }
.card[aria-disabled="true"] { cursor: default; }
.card-grid li[hidden] { display: none; }

/* ---------- tutorial: hero ---------- */

.breadcrumb { padding: 20px 0 0; font-size: 15px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); text-decoration: underline; }

.tutorial-hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 36px; align-items: start; padding: 20px 0 0;
}
.hero-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: var(--line); }
.hero-text h1 { font-size: 44px; }
.hero-text .lead { margin: 10px 0 20px; font-size: 20px; color: var(--muted); }

.facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.fact {
  min-width: 110px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.fact dt { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fact dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; }

.hero-text .tag-list { margin-bottom: 24px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- tutorial: what you need ---------- */

.needs { margin: 48px 0 0; }
.section-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.section-head h2 { font-size: 28px; }

.unit-toggle {
  display: inline-flex; padding: 3px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px;
}
.unit-toggle button {
  min-height: 36px; padding: 4px 16px; border: 0; border-radius: 999px;
  background: transparent; font-size: 15px; cursor: pointer; color: var(--muted);
}
.unit-toggle button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 700; }

.needs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.need-box {
  padding: 20px 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.need-box h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }

.checklist { margin: 0; padding: 0; list-style: none; columns: 2 220px; column-gap: 24px; }
.checklist li { position: relative; padding: 5px 0 5px 26px; break-inside: avoid; }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 15px; height: 15px; border: 2px solid var(--line-strong); border-radius: 3px;
}

/* ---------- tutorial: steps ---------- */

.steps { margin: 48px 0 0; }
.steps > h2 { font-size: 28px; margin-bottom: 16px; }

.step {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 28px; margin: 0 0 20px; padding: 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  scroll-margin-top: 16px;
}

/* gallery: big photo + thumbnails on screen, a photo grid in print */
.gallery { margin: 0; }
.gallery-main { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); background: var(--line); }
.gallery-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.gallery-thumbs button {
  padding: 0; border: 2px solid transparent; border-radius: 6px; background: none; cursor: pointer;
  opacity: .65; transition: opacity .15s;
}
.gallery-thumbs button:hover { opacity: 1; }
.gallery-thumbs button[aria-pressed="true"] { opacity: 1; border-color: var(--accent); }
.gallery-thumbs img { width: 76px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; }
.gallery[data-count="1"] .gallery-thumbs { display: none; }

/* each step is a table for print (see there); on screen only its cells take part in the grid */
.step table, .step tbody, .step tr, .step td { display: contents; }
.step td.step-body { display: block; }

.step-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.step-num {
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--ink); color: #fff; font-weight: 700; font-size: 17px;
}
.step-head h3 { font-size: 24px; padding-top: 3px; }

.substeps { margin: 0; padding: 0; list-style: none; }
.substeps li {
  position: relative; padding: 9px 0 9px 22px;
  border-bottom: 1px solid var(--line);
}
.substeps li:last-child { border-bottom: 0; }
.substeps li::before {
  content: ""; position: absolute; left: 3px; top: 19px;
  width: 8px; height: 8px; border-radius: 2px; background: var(--accent);
}

/* callouts: info / warn / danger. Icon + label so they read without colour too. */
.substeps li.callout {
  margin: 8px 0; padding: 10px 14px 10px 46px;
  border: 0; border-left: 4px solid; border-radius: var(--radius-sm);
}
.substeps li.callout::before {
  left: 13px; top: 12px; width: 22px; height: 22px; border-radius: 50%;
  color: #fff; font-size: 14px; font-weight: 700; line-height: 22px; text-align: center;
}
.callout-label { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

.substeps li.callout-info   { background: var(--info-bg);   color: var(--info-ink);   border-color: var(--info); }
.substeps li.callout-warn   { background: var(--warn-bg);   color: var(--warn-ink);   border-color: var(--warn); }
.substeps li.callout-danger { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger); }
.substeps li.callout-info::before   { content: "i"; background: var(--info); }
.substeps li.callout-warn::before   { content: "!"; background: var(--warn); }
.substeps li.callout-danger::before { content: "!"; background: var(--danger); border-radius: 4px; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .tutorial-hero, .step { grid-template-columns: 1fr; }
  .tutorial-hero { gap: 20px; }
  .step { gap: 18px; padding: 18px; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .search { margin-top: 24px; }
  .hero-text h1 { font-size: 32px; }
  .hero-text .lead { font-size: 18px; }
  .needs-grid { grid-template-columns: 1fr; }
  .needs, .steps { margin-top: 36px; }
  .section-head h2, .steps > h2 { font-size: 24px; }
  .step { padding: 14px; border-radius: var(--radius-sm); }
  .step-head h3 { font-size: 21px; }
  .gallery-thumbs img { width: 64px; }
  .card-grid { gap: 16px; }
}

/* ==========================================================================
   Print — A4, colour
   Rule of thumb: everything that must not split is a plain block with
   break-inside: avoid, and no flex/grid ancestor around the steps.
   ========================================================================== */

@page {
  size: A4;
  /* margins this small also stop Chrome printing its own date/title header and URL footer */
  margin: 8mm 10mm 10mm;
  @bottom-left  { content: "makermanuals"; font-family: var(--font); font-size: 8pt; color: #888; }
  @bottom-right { content: counter(page) " / " counter(pages); font-family: var(--font); font-size: 8pt; color: #888; }
}

@media print {
  :root { --gap: 5mm; }

  html, body { background: #fff; }
  body { font-size: 10pt; line-height: 1.4; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .screen-only, .lang-switch, .breadcrumb, .site-footer, .actions, .unit-toggle { display: none !important; }
  .print-only { display: block; }

  .container { max-width: none; padding: 0; }

  /* compact header: wordmark only */
  .site-header { position: static; background: none; color: var(--ink); border-bottom: 0.5mm solid var(--ink); margin-bottom: 5mm; }
  .site-header .container { height: auto; padding-bottom: 2mm; }
  .wordmark { font-size: 14pt; }

  /* page 1: photo, title, facts, QR */
  .tutorial-hero {
    display: block; position: relative; padding: 0; min-height: 52mm;
    padding-left: 74mm; padding-right: 30mm;
    break-inside: avoid;
  }
  .hero-photo { position: absolute; left: 0; top: 0; width: 68mm; border-radius: 2mm; }
  .hero-text h1 { font-size: 22pt; }
  .hero-text .lead { font-size: 11pt; margin: 1.5mm 0 3mm; }
  .facts { gap: 2mm; margin-bottom: 3mm; }
  .fact { min-width: 0; padding: 1.5mm 3mm; border-radius: 1.5mm; }
  .fact dt { font-size: 7pt; }
  .fact dd { font-size: 11pt; }
  .hero-text .tag-list { margin-bottom: 3mm; }
  .tag { font-size: 8pt; padding: 0.5mm 2.5mm; }
  .print-downloads { margin: 0; font-size: 9pt; color: var(--muted); }
  .print-downloads b { color: var(--ink); }

  .qr {
    position: absolute; right: 0; top: 0;
    width: 26mm; text-align: center; font-size: 7pt; color: var(--muted);
  }
  .qr-code { display: block; width: 26mm; height: 26mm; margin-bottom: 1mm; }

  /* what you need */
  .needs { margin: 6mm 0 0; break-inside: avoid; }
  .section-head { margin-bottom: 2mm; }
  .section-head h2, .steps > h2 { font-size: 13pt; }
  .needs-grid { display: block; columns: 2; column-gap: 5mm; }
  .need-box { padding: 3mm 4mm; border-radius: 2mm; break-inside: avoid; margin-bottom: 0; }
  .need-box h3 { font-size: 8pt; margin-bottom: 1mm; }
  .checklist { columns: 1; }
  .checklist li { padding: 0.8mm 0 0.8mm 5.5mm; }
  .checklist li::before { top: 1.6mm; width: 3.2mm; height: 3.2mm; border-width: 0.35mm; border-color: var(--ink); border-radius: 0.6mm; }

  /* steps: one per row, photos left, text right.
     A long step carries on onto the next page, breaking between photos or
     list items, never through one. Chrome repeats a table's <thead> on every
     page the table spans, so that row holds "2 Drill the hole — continued".
     The row itself has no height: its heading floats over the top of the text
     column, so photos start level with it, as on a step's first page. There
     the step's own heading (opaque, on top) hides it. */
  .steps { margin: 6mm 0 0; }
  .steps > h2 { margin-bottom: 3mm; }

  .step {
    display: block; margin: 0 0 4mm; padding: 0;
    border: 0; background: none;
  }
  .step table {
    display: table; width: 100%; table-layout: fixed;
    border-collapse: separate; border-spacing: 0;
    border: 1px solid var(--line); border-radius: 2mm;
    -webkit-box-decoration-break: clone; box-decoration-break: clone;
  }
  .step thead.print-only { display: table-header-group; }
  .step tbody { display: table-row-group; }
  .step tr { display: table-row; }
  .step td, .step td.step-body { display: table-cell; vertical-align: top; padding: 0 4mm 4mm; }
  .step td.step-photos { width: 50%; padding-right: 2mm; }
  .step td.step-body { padding-top: 4mm; padding-left: 2mm; }
  .step td.step-body[colspan] { padding-left: 4mm; }

  .step thead td { position: relative; padding: 0; }
  .step thead .step-head {
    position: absolute; top: 4mm; left: 2mm; right: 4mm; margin: 0;
  }
  .step thead td[colspan] .step-head { left: 4mm; }
  .step thead h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .step thead i { font-weight: 400; color: var(--muted); }
  .step tbody .step-head { position: relative; z-index: 1; background: var(--surface); }

  /* top padding repeats on every page a column carries onto (clone), so the
     photos start 4mm down and the text clears the "continued" heading;
     on the first page the negative margin cancels it for the text */
  .gallery { padding-top: 4mm; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  .step-body .substeps {
    padding-top: 10.5mm; margin-top: -10.5mm;
    -webkit-box-decoration-break: clone; box-decoration-break: clone;
  }

  .gallery-thumbs button, .gallery-main, .substeps li { break-inside: avoid; }
  .step-head { break-after: avoid; }

  /* Up to 6 photos: all full size, stacked in one column.
     7 or more: two side by side, smaller. */
  .gallery-main { border-radius: 1.5mm; }
  .gallery:not([data-count="1"]) .gallery-main { display: none; }
  .gallery-thumbs { display: block; margin: 0; }
  .gallery-thumbs button { display: block; width: 100%; margin: 0 0 2mm; opacity: 1; border: 0; border-radius: 0; break-inside: avoid; }
  .gallery-thumbs button:last-child { margin-bottom: 0; }
  .gallery-thumbs img { width: 100%; border-radius: 1.5mm; }

  .gallery[data-count="7"] .gallery-thumbs,
  .gallery[data-count="8"] .gallery-thumbs,
  .gallery[data-count="9"] .gallery-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5mm; }
  .gallery[data-count="7"] .gallery-thumbs button,
  .gallery[data-count="8"] .gallery-thumbs button,
  .gallery[data-count="9"] .gallery-thumbs button { margin: 0; }
  .gallery[data-count="7"] .gallery-thumbs img,
  .gallery[data-count="8"] .gallery-thumbs img,
  .gallery[data-count="9"] .gallery-thumbs img { border-radius: 1mm; }

  .step-head { gap: 2.5mm; margin-bottom: 1.5mm; }
  .step-num { width: 7mm; height: 7mm; font-size: 10pt; border-radius: 1.5mm; }
  .step-head h3 { font-size: 12pt; padding-top: 0.8mm; }
  .substeps li { padding: 1.4mm 0 1.4mm 4.5mm; }
  .substeps li::before { left: 0.5mm; top: 3.1mm; width: 1.6mm; height: 1.6mm; }
  .substeps li.callout { margin: 1.5mm 0; padding: 1.8mm 2.5mm 1.8mm 9mm; border-left-width: 1mm; }
  .substeps li.callout::before { left: 2.2mm; top: 2.2mm; width: 4.5mm; height: 4.5mm; font-size: 8pt; line-height: 4.5mm; }
  .callout-label { font-size: 7pt; }

  a { text-decoration: none; }
}
