/* For the printer — laid out as A4 sheets on a grey desk on screen, and properly paged when printed: @page margins,
   break rules that keep headings with their text, and link addresses written out after each link.
   Designed by machine for the Slopwright. */
:root {
  color-scheme: light;
  --desk: #5b5f63;
  --sheet: #ffffff;
  --ink: #111111;
  --grey: #555555;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}
* { box-sizing: border-box; }
html { overflow-x: clip; }
body { margin: 0; min-width: 320px; color: var(--ink); font: 11.5pt/1.5 var(--serif); background: var(--desk) linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px) 0 0 / 100% 4px; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; background: #fff3a8; }
img { max-width: 100%; height: auto; }
.skip { position: absolute; left: 10px; top: -80px; z-index: 10; padding: 8px 12px; background: #fff; color: var(--ink); }
.skip:focus { top: 10px; }
.main:focus { outline: none; }

/* the printer's toolbar on screen */
.site-head { position: sticky; top: 0; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; padding: 8px 4%; background: #2e3134; color: #f1f1f1; font: 14px Arial, sans-serif; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.masthead { display: flex; align-items: center; gap: 12px; }
.masthead .brand { display: inline-flex; align-items: center; min-height: 36px; padding: 0 8px; background: #fff; border-radius: 3px; }
.masthead .brand img { display: block; height: 20px; width: auto; }
.site-name { display: inline-flex; align-items: center; min-height: 36px; color: #fff; font-weight: 700; text-decoration: none; }
.site-name::after { content: " — print preview"; font-weight: 400; color: #d0d0d0; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0 16px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 36px; color: #fff; text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }
.site-head a:focus-visible { outline-color: #fff; background: transparent; }

/* sheets: the title page, each chapter and the outfits list are separate A4 sheets on screen */
.main { padding: 30px 12px 10px; }
.title-block, .contents, .chapter, .outfits { position: relative; width: 100%; max-width: 210mm; margin: 0 auto 24px; padding: 18mm 18mm 22mm; background: var(--sheet); box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35); }
.title-block { min-height: 140mm; display: flex; flex-direction: column; justify-content: center; text-align: center; border-top: 0; }
.contents { margin-top: -24px; padding-top: 0; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
/* page numbers in the footer of every sheet */
.manual { counter-reset: sheet; }
.title-block, .chapter, .outfits { counter-increment: sheet; }
.chapter::after, .outfits::after { content: "The workshop manual · " counter(sheet); position: absolute; left: 18mm; right: 18mm; bottom: 8mm; padding-top: 4px; border-top: .5pt solid #999; color: var(--grey); font: 9pt Arial, sans-serif; text-align: right; }

.edition { margin: 0 0 12px; font: 9pt Arial, sans-serif; letter-spacing: 3px; text-transform: uppercase; color: var(--grey); }
.title { margin: 0; font: 400 clamp(32px, 7vw, 52pt)/1.05 var(--serif); letter-spacing: -.01em; }
.subtitle { margin: 16px auto 0; max-width: 34ch; font-style: italic; font-size: 13pt; }
.contents-title { margin: 0 0 8px; padding-top: 10mm; border-top: .5pt solid #999; font: 700 10pt Arial, sans-serif; text-transform: uppercase; letter-spacing: 2px; }
.contents-list { margin: 0; padding: 0; list-style: none; counter-reset: c; }
.contents-list li { counter-increment: c; display: flex; gap: 6px; }
.contents-list li::before { content: counter(c) "."; width: 2em; }
.contents-list a { flex: 1; display: flex; min-height: 26px; text-decoration: none; }
.contents-list a::after { content: ""; flex: 1; margin: 0 4px 6px; border-bottom: 1pt dotted #888; }
.contents-list li::after { content: "p. " counter(c); color: var(--grey); }

.chapter-title { margin: 0 0 12px; font: 700 18pt/1.2 var(--serif); break-after: avoid; }
.chapter-num { display: block; font: 9pt Arial, sans-serif; letter-spacing: 3px; text-transform: uppercase; color: var(--grey); }
.chapter-num::before { content: "Chapter "; }
.chapter-body { max-width: 62ch; }
.chapter-body p { orphans: 3; widows: 3; text-align: justify; hyphens: auto; }
.first::first-line { font-variant: small-caps; letter-spacing: .05em; }
.plate { margin: 14px 0 0; break-inside: avoid; }
.plate img { display: block; width: 100%; filter: grayscale(1); }
.plate figcaption { margin-top: 6px; font-size: 9.5pt; color: var(--grey); }
.tools, .rules { padding-left: 20px; }
.tools li, .rules li { margin: 4px 0; }
.note { margin: 14px 0; padding: 8px 12px; border: 1pt solid var(--ink); break-inside: avoid; }
.note p { margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 400px; border-collapse: collapse; font-size: 10pt; break-inside: avoid; }
caption { text-align: left; padding-bottom: 6px; font-style: italic; }
th, td { padding: 5px 8px 5px 0; border-bottom: .5pt solid #999; text-align: left; vertical-align: top; }
thead th { border-bottom: 1.5pt solid var(--ink); }
.saying { margin: 16px 0 0; padding: 0 0 0 16px; border-left: 2pt solid var(--ink); }
.saying p { margin: 0; font-style: italic; font-size: 13pt; }
.saying footer { font-size: 9.5pt; color: var(--grey); }
.hazard { break-inside: avoid; margin-bottom: 8px; }
.hazard dt, .glossary dt { font-weight: 700; break-after: avoid; }
.hazard dd, .glossary dd { margin: 0 0 6px 20px; }
.sign-off { font-style: italic; }

/* link addresses written out after links that leave the page */
.chapter a[href^="http"]::after, .site-foot a[href^="http"]::after, .outfits a[href^="/"]::after { content: " (" attr(href) ")"; font-size: .85em; color: var(--grey); word-break: break-all; }

.outfits-title { margin: 0 0 6px; font: 700 18pt/1.2 var(--serif); }
.outfits-lede { font-style: italic; }
.outfit-list { margin: 10px 0 0; padding: 0; list-style: none; }
.outfit { padding: 5px 0; border-bottom: .5pt solid #ccc; font-size: 10pt; break-inside: avoid; }
.outfit-link { font-weight: 700; display: inline-block; min-height: 24px; }
.outfit-by, .outfit-note { display: none; }
.outfit-technique { color: var(--grey); }
#th-print { padding: 6px 8px; border: 1.5pt solid var(--ink); background: #f1f1f1; }
#th-print .outfit-link::before { content: "▶ Printing now: "; font-weight: 400; }
#th-print .outfit-by, #th-print .outfit-note { display: block; font-size: 9.5pt; }

.site-foot { max-width: 210mm; margin: 0 auto 40px; padding: 0 12px; color: #eeeeee; font: 13px Arial, sans-serif; }
.site-foot a { color: #ffffff; }
.site-foot a[href^="http"]::after { color: #dddddd; }
.site-foot p { margin: 0 0 6px; }
.extra { display: none; }

@media (max-width: 600px) {
  .main { padding: 16px 8px 4px; }
  .title-block, .contents, .chapter, .outfits { padding: 26px 18px 40px; }
  .title-block { min-height: 0; padding-top: 50px; padding-bottom: 50px; }
  .contents { padding-top: 0; }
  .chapter::after, .outfits::after { left: 18px; right: 18px; bottom: 12px; }
  .chapter-body p { text-align: left; }
}

/* ---------------------------------------------------------------- on paper */
@page { size: A4; margin: 20mm 18mm 22mm; }
@page :first { margin-top: 40mm; }
@media print {
  body { background: none; font-size: 11pt; }
  .site-head, .skip, .site-nav { display: none; }
  .main { padding: 0; }
  .title-block, .contents, .chapter, .outfits { max-width: none; margin: 0; padding: 0; box-shadow: none; min-height: 0; }
  .title-block { break-after: page; min-height: 0; padding-top: 60mm; }
  .contents { break-after: page; margin-top: 0; }
  .chapter { break-before: page; }
  .chapter::after, .outfits::after { content: none; }
  h1, h2, .chapter-title, dt { break-after: avoid; }
  figure, table, blockquote, .note, li { break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; }
  a[href^="#"]::after { content: none; }
  .outfits { break-before: page; }
  .site-foot { max-width: none; margin: 10mm 0 0; padding: 0; color: #444; }
  .site-foot a { color: #000; }
  img { filter: grayscale(1); }
}

@media (max-width: 600px) { table { min-width: 0; } }

/* moving between outfits: a cross-document view transition where the browser has them (Chromium did, Firefox did not, when check.mjs last ran), with the
   masthead and the title carried across; an ordinary page load elsewhere, and under reduced motion */
@view-transition { navigation: auto; }
.masthead { view-transition-name: masthead; }
.title { view-transition-name: manual-title; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
