/* Index cards — each chapter on its own ruled index card, in a deck you flick through sideways. Shows off
   scroll-snap: the deck is a scroll container with scroll-snap-type: x mandatory, and every card snaps square to
   its edge. Designed by machine for the Slopwright. */
:root {
  color-scheme: light;
  --desk: #3d4a3f;
  --card: #fffdf5;
  --rule: #b9d3e6;
  --margin: #d9534f;
  --ink: #1b1d22;
  --dim: #545a63;
  --type: "Courier New", Courier, "Liberation Mono", monospace;
  --hand: "Segoe Print", "Bradley Hand", "Comic Sans MS", "Chalkboard SE", cursive;
}
* { box-sizing: border-box; }
html { overflow-x: clip; }
body {
  min-width: 320px; margin: 0; color: #f3f1ea; font: 16px/1.5 Arial, Helvetica, sans-serif;
  background: radial-gradient(ellipse at 30% 0, #55665a, transparent 70%), repeating-linear-gradient(100deg, rgba(0, 0, 0, .05) 0 3px, transparent 3px 9px), var(--desk);
}
a { color: inherit; text-underline-offset: 3px; }
:where(a, [tabindex], .manual):focus-visible { outline: 3px solid #ffd54a; outline-offset: 4px; }
img { max-width: 100%; height: auto; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 10; padding: 10px 16px; background: #ffd54a; color: #000; }
.skip:focus { top: 12px; }
.extra { display: none; }
.page { max-width: 1280px; margin: auto; padding: 0 4%; }
.main:focus { outline: none; }

.site-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 20px; padding: 20px 0; }
.masthead { display: flex; align-items: center; }
.masthead .brand { display: flex; align-items: center; min-height: 42px; padding: 6px 10px; background: var(--card); border-radius: 3px; transform: rotate(-1deg); }
.masthead .brand img { display: block; height: 22px; width: auto; }
.site-name { margin-left: 14px; color: #fff; font: 700 18px var(--type); text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0 18px; font-size: 14px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 42px; color: #fff; text-decoration: none; font-weight: 700; }
.site-nav a:hover { text-decoration: underline; }

/* the deck */
.manual {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 52px) / 3); gap: 26px; align-items: stretch;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: 4px;
  padding: 30px 4px 34px; margin-top: 10px;
  scrollbar-color: #ffd54a transparent;
}
.manual > * { scroll-snap-align: start; scroll-snap-stop: always; }
.title-block, .contents, .chapter {
  position: relative; height: 440px; overflow-y: auto; scrollbar-width: thin; padding: 44px 26px 26px 52px; color: var(--ink);
  font: 15px/28px var(--type);
  background:
    linear-gradient(90deg, transparent 38px, var(--margin) 38px 40px, transparent 40px),
    linear-gradient(var(--card) 0 40px, var(--margin) 40px 42px, transparent 42px),
    repeating-linear-gradient(transparent 0 27px, var(--rule) 27px 28px),
    var(--card);
  background-position: 0 0, 0 0, 0 14px, 0 0; background-attachment: local;
  border-radius: 3px; box-shadow: 0 1px 0 #ddd8c8, 0 14px 30px rgba(0, 0, 0, .4);
}
.title-block { transform: rotate(-1deg); }
.chapter:nth-child(odd) { transform: rotate(.6deg); }
/* the hint that there's more to the right */
.title-block::after { content: "Flick through the deck →"; position: absolute; right: 22px; top: 400px; color: #a8261f; font: 15px var(--hand); }
.edition { margin: -30px 0 0; color: #a8261f; font: 700 13px/14px var(--type); letter-spacing: .1em; text-transform: uppercase; }
.title { margin: 24px 0 0; font: 700 40px/56px var(--hand); }
.subtitle { margin: 0; font: 17px/28px var(--hand); color: var(--dim); }
.contents-title, .chapter-title { margin: -30px 0 14px; font: 700 20px/28px var(--type); text-transform: uppercase; letter-spacing: .04em; }
.chapter-num { display: inline-block; min-width: 1.6em; color: var(--margin); }
.chapter-num::after { content: "."; }
.contents-list { margin: 0; padding-left: 1.6em; }
.contents-list a { display: inline-block; min-height: 28px; }
.chapter-body p { margin: 0 0 28px; }
.first { font-family: var(--hand); font-size: 17px; }
.plate { margin: 0 0 28px; }
.plate img { display: block; width: 100%; border: 6px solid #fff; transform: rotate(-2deg); box-shadow: 0 6px 12px rgba(0, 0, 0, .25); }
.plate figcaption { font: 15px/28px var(--hand); color: var(--dim); }
.tools, .rules { margin: 0 0 28px; padding-left: 1.4em; }
.note { margin: 0 0 28px; padding: 0 10px; background: rgba(255, 213, 74, .55); transform: rotate(-.5deg); }
.note p { margin: 0; }
.table-wrap { overflow-x: auto; margin-bottom: 28px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 28px; }
caption { text-align: left; color: var(--dim); font-family: var(--hand); }
th, td { padding: 0 8px 0 0; text-align: left; vertical-align: top; }
thead th { color: var(--margin); text-transform: uppercase; font-size: 12px; }
.saying { margin: 0; font: 19px/28px var(--hand); }
.saying p { margin: 0; }
.saying footer { color: var(--dim); font: 13px/28px var(--type); }
.saying footer::before { content: "— "; }
.hazards { margin: 0; }
dt { font-weight: 700; }
dd { margin: 0 0 0 1.6em; }
.sign-off { font-family: var(--hand); }

/* other outfits: a row of small cards pinned below the deck */
.outfits { padding: 30px 0; }
.outfits-title { margin: 0; color: #fff; font: 700 26px var(--type); text-transform: uppercase; }
.outfits-lede { color: #e4e8e2; }
.outfit-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 16px 0 0; padding: 0; list-style: none; }
.outfit { padding: 10px 14px; background: var(--card); color: var(--ink); border-radius: 2px; font: 13px/1.45 var(--type); box-shadow: 0 6px 12px rgba(0, 0, 0, .3); }
.outfit-link { display: inline-block; min-height: 24px; font-weight: 700; font-size: 15px; }
.outfit-by, .outfit-note { display: none; }
.outfit-technique { display: block; color: var(--dim); }
#th-cards { background: #ffd54a; transform: rotate(-2deg); outline: 2px solid var(--ink); }
#th-cards .outfit-technique { color: var(--ink); }
#th-cards .outfit-link::before { content: "✱ "; }
#th-cards .outfit-link::after { content: " (this deck)"; font-weight: 400; }

.site-foot { padding: 20px 0 50px; color: #e4e8e2; font-size: 14px; }
.site-foot p { margin: 0 0 6px; }

@media (max-width: 1000px) { .manual { grid-auto-columns: calc((100% - 26px) / 2); } }
@media (max-width: 600px) {
  .manual { grid-auto-columns: 88%; gap: 14px; }
  .title-block, .contents, .chapter { height: min(560px, 72vh); padding: 44px 16px 22px 48px; }
  .title-block::after { top: auto; bottom: 10px; }
  .title { font-size: 32px; line-height: 42px; }
  .title-block, .chapter:nth-child(odd) { transform: none; }
}

/* 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; } }
