/* ==========================================================
   DDLV guide: builds on /styles.css (ink, paper & wheat tokens)
   Reading comfort first: large type, generous spacing, left aligned.
   ========================================================== */

.guide {
  --top-h: 56px;
  --nav-w: 290px;
  --neg: #a8402c;
  font-size: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .guide { --neg: #ff9a85; }
}
:root[data-theme="dark"] .guide { --neg: #ff9a85; }


.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 50;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  font-weight: 700;
}
.skip:focus { top: 10px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--paper);
  border-bottom: 1.5px solid var(--ink);
}
.topbar a { text-decoration: none; }
.topbar__home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
}
.topbar__home:hover { color: var(--ink); }
.topbar__title {
  font-family: var(--f-display);
  font-size: 20px;
  margin-right: auto;
}
.topbar__menu {
  padding: 7px 14px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: none;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
@media (min-width: 1000px) { .topbar__menu { display: none; } }

/* ---------- Layout ---------- */
.layout {
  max-width: 1280px;
  margin: 0 auto;
}
@media (min-width: 1000px) {
  .layout {
    display: grid;
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
  }
}

.main {
  min-width: 0;
  padding: 32px 20px 56px;
}
@media (min-width: 1000px) {
  .main { padding: 48px 56px 72px; }
}

/* ---------- Sidebar navigation ---------- */
.nav {
  display: none;
  padding: 20px 16px 40px;
  font-size: 16px;
}
.nav-open .nav {
  display: block;
  position: fixed;
  inset: var(--top-h) 0 0 0;
  z-index: 25;
  overflow-y: auto;
  background: var(--paper);
}
@media (min-width: 1000px) {
  .nav {
    display: block;
    position: sticky;
    top: var(--top-h);
    height: calc(100vh - var(--top-h));
    overflow-y: auto;
    border-right: 1.5px solid var(--ink);
  }
  .nav-open .nav { position: sticky; inset: auto; }
}

.nav a { text-decoration: none; color: var(--ink-soft); }
.nav a:hover { color: var(--ink); }

.nav__start {
  display: block;
  margin: 18px 0 6px;
  font-weight: 700;
}
.nav__section {
  margin: 24px 0 6px;
  font-family: var(--f-display);
  font-size: 17px;
  color: var(--brown);
}
.nav__list, .nav__toc { list-style: none; margin: 0; padding: 0; }
.nav__list > li > a {
  display: flex;
  gap: 10px;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 4px;
  line-height: 1.35;
}
.nav__num {
  flex: none;
  min-width: 1.6em;
  font-family: var(--f-display);
  color: var(--ink-faint);
}
.nav a.is-current,
.nav__start.is-current {
  color: var(--ink);
  font-weight: 700;
  background: linear-gradient(100deg, transparent 0 1%, var(--gold-wash) 2% 98%, transparent 99%);
}
.nav__toc {
  margin: 4px 0 8px 2.1em;
  border-left: 1.5px solid var(--ink-faint);
}
.nav__toc a {
  display: block;
  padding: 3px 0 3px 12px;
  font-size: 14.5px;
  line-height: 1.35;
}

/* ---------- Search ---------- */
.search { position: relative; }
.search input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
.search input::placeholder { color: var(--ink-faint); }
.search__results {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  border-bottom: 1.5px solid var(--ink);
}
.search__results li { background: var(--rule) repeat-x left bottom / 240px 6px; }
.search__results a { display: block; padding: 10px 2px; color: var(--ink); }
.search__results .r-title { display: block; font-weight: 700; line-height: 1.3; }
.search__results .r-where { display: block; font-size: 13px; color: var(--brown); }
.search__results .r-snip { display: block; font-size: 14px; color: var(--ink-soft); line-height: 1.45; margin-top: 2px; }
.search__results mark,
.prose mark {
  color: inherit;
  background: var(--gold-wash);
  padding: 0 2px;
  border-radius: 2px;
}
.search__empty { padding: 10px 2px; color: var(--ink-faint); font-size: 15px; }

/* ---------- Prose ---------- */
.prose {
  max-width: 46rem;
  line-height: 1.75;
}
.prose > * + * { margin-top: 1.1em; }
.prose p { margin: 0; }
.prose p + p { margin-top: 1em; }
.prose strong { font-weight: 700; }

/* chapter opening, like the first page of a book chapter */
.opener {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 30px;
  padding-bottom: 22px;
  background: var(--rule) repeat-x left bottom / 240px 6px;
}
.opener__num {
  flex: none;
  font-family: var(--f-display);
  font-size: clamp(64px, 11vw, 92px);
  line-height: .85;
  color: var(--gold);
  text-shadow: -3px 2px 0 var(--brown);
}
.opener__num--mark { font-size: clamp(44px, 8vw, 60px); }
.opener__section {
  margin: 0 0 4px;
  font-style: italic;
  color: var(--ink-soft);
}
.prose .opener h1 { margin: 0; }

.prose h1,
.hero h1 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.1;
  margin: 0 0 28px;
}
.prose h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 2.2em;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 27px;
  line-height: 1.2;
  scroll-margin-top: calc(var(--top-h) + 16px);
}
.prose h2::before {
  content: "";
  flex: none;
  width: 9px;
  height: 15px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--gold);
  box-shadow: -2px 1px 0 var(--brown);
  transform: rotate(28deg) translateY(-2px);
}
.prose h3 {
  margin-top: 1.8em;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 21px;
  scroll-margin-top: calc(var(--top-h) + 16px);
}
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .4em; }
.prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
}
.prose a:hover { text-decoration-color: var(--ink); }

.callout {
  padding: 4px 22px 22px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: var(--paper-deep);
  box-shadow: 4px 4px 0 var(--gold);
}
.callout h2 { margin-top: 18px; }

.wip {
  padding: 6px 0 6px 14px;
  border-left: 3px dashed var(--ink-faint);
  color: var(--ink-faint);
  font-style: italic;
}

/* ---------- Tables ---------- */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  -webkit-overflow-scrolling: touch;
}
.prose .table-wrap { margin-top: 1.4em; }
/* wide tables may use the full content width, beyond the reading column */
.prose:has(.table-wrap) { max-width: 60rem; }
.prose > p, .prose > ul, .prose > ol, .prose > h2, .prose > h3, .prose > .callout, .prose > .wip { max-width: 46rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15.5px;
  line-height: 1.45;
}
th, td {
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}
th {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-soft);
  border-bottom: 1.5px solid var(--ink);
  white-space: nowrap;
}
tbody tr { background: var(--rule) repeat-x left bottom / 240px 6px; }
tbody tr:last-child { background: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.neg { color: var(--neg); font-weight: 700; }
td:first-child { font-weight: 700; }
.t-keyed td:first-child { white-space: nowrap; font-family: var(--f-display); font-weight: 400; font-size: 17px; }

th button {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
th button::after { content: "↕"; opacity: .35; font-size: 12px; }
th[aria-sort="ascending"] button::after { content: "↑"; opacity: 1; }
th[aria-sort="descending"] button::after { content: "↓"; opacity: 1; }
th button:focus-visible { outline: 2px dashed var(--ink); outline-offset: 3px; }

td.media img {
  display: inline-block;
  height: 76px;
  width: auto;
  margin: 2px 4px 2px 0;
  border-radius: 4px;
  cursor: zoom-in;
  vertical-align: middle;
}

/* redeem codes */
.code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 8px 2px 0;
}
.code code {
  padding: 2px 8px;
  border: 1.5px dashed var(--ink-faint);
  border-radius: 4px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 14.5px;
  letter-spacing: .03em;
}
.code__copy {
  padding: 1px 8px;
  border: 1.5px solid var(--ink-faint);
  border-radius: 4px;
  background: none;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.code__copy:hover { border-color: var(--ink); color: var(--ink); }
.code__copy.is-done { border-color: var(--mint); color: var(--mint); }

/* ---------- Images ---------- */
.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 1.4em;
}
.gallery figure { margin: 0; flex: 0 1 200px; }
.gallery--single figure { flex: 0 1 auto; max-width: 100%; }
.gallery img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  cursor: zoom-in;
}
.gallery figcaption { margin-top: 6px; font-size: 14px; color: var(--ink-soft); line-height: 1.4; }

/* ---------- Pet cards ---------- */
.pet {
  margin-top: 1.4em;
  padding: 18px 20px 20px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  scroll-margin-top: calc(var(--top-h) + 16px);
}
.prose > .pet { max-width: 46rem; }
.pet__name {
  margin: 0 0 12px !important;
  font-size: 24px !important;
}
.pet__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 0 0 14px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid var(--ink);
}
.pet__fact dt {
  font-size: 14px;
  font-style: italic;
  color: var(--brown);
}
.pet__fact dd { margin: 0; font-weight: 700; line-height: 1.35; }
.pet__variants {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px 28px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.pet__variant { padding: 8px 0; margin: 0 !important; }
.pet__vhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pet__vname { font-weight: 700; }
.pet__tag {
  font-size: 13.5px;
  color: var(--ink-soft);
  padding: 0 6px;
  background: var(--gold-wash);
  border-radius: 3px;
}
.pet__schedule {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.pet__schedule li { margin: 0 !important; }
.pet__day { display: inline-block; min-width: 6.2em; color: var(--ink); }

/* ---------- Landing ---------- */
.hero {
  display: grid;
  gap: 28px;
  align-items: center;
  max-width: 60rem;
  margin-bottom: 44px;
}
@media (min-width: 760px) {
  .hero { grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 44px; }
}
.hero__cover {
  width: 100%;
  max-width: 280px;
  height: auto;
  border: 1.5px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  transform: rotate(-1.5deg);
}
.hero h1 { margin-bottom: 8px; }
.hero__by { margin: 0 0 22px; color: var(--ink-soft); }

.chapters { max-width: 60rem; margin-top: 52px; }
.toc__section {
  margin: 34px 0 10px;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 24px;
}
.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0 40px;
}
@media (min-width: 760px) { .toc { grid-template-columns: 1fr 1fr; } }
.toc li { background: var(--rule) repeat-x left bottom / 240px 6px; }
.toc a {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 13px 2px 12px;
  text-decoration: none;
}
.toc__num { font-family: var(--f-display); color: var(--ink-faint); min-width: 1.6em; }
.toc__title {
  font-family: var(--f-display);
  font-size: 19px;
  line-height: 1.3;
  background: linear-gradient(100deg, transparent 0 2%, var(--gold-wash) 3% 97%, transparent 98%) no-repeat 0 85% / 0% 55%;
  transition: background-size .4s var(--ease);
}
.toc a:hover .toc__title { background-size: 100% 55%; }

/* ---------- Pager ---------- */
.pager {
  display: grid;
  gap: 14px;
  max-width: 46rem;
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1.5px solid var(--ink);
}
@media (min-width: 640px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a {
  display: block;
  padding: 14px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  text-decoration: none;
  font-family: var(--f-display);
  font-size: 18px;
  line-height: 1.3;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.pager a:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--gold); }
.pager span {
  display: block;
  margin-bottom: 4px;
  font-family: var(--f-body);
  font-size: 14px;
  font-style: italic;
  color: var(--brown);
}
.pager__next { text-align: right; grid-column: -2; }

/* ---------- Footer ---------- */
.gfoot {
  padding: 28px 20px 40px;
  border-top: 1.5px solid var(--ink);
  text-align: center;
  font-size: 15px;
  color: var(--ink-faint);
}
.gfoot p { margin: 0; }
.gfoot a { color: var(--ink-soft); }

/* ---------- Lightbox ---------- */
.lightbox {
  max-width: min(92vw, 1100px);
  max-height: 92vh;
  padding: 16px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}
.lightbox::backdrop { background: rgba(20, 14, 10, .7); }
.lightbox img { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto; }
.lightbox p { margin: 10px 0 0; text-align: center; color: var(--ink-soft); font-size: 15px; }
.lightbox p:empty { display: none; }
.lightbox__close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  background: var(--paper);
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- Small screens ---------- */
.prose .pet ul { padding-left: 0; }
@media (max-width: 480px) {
  .guide { font-size: 17px; }
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar__home { font-size: 0; gap: 0; }        /* keep just the wheat icon */
  .topbar__title { font-size: 18px; white-space: nowrap; }
  .pet { padding: 14px 14px 16px; }
  .pet__day { min-width: 5.6em; }
  .main { padding-left: 16px; padding-right: 16px; }
}

/* data tables: compact rows, first column stays visible while scrolling sideways */
.table-wrap[data-sortable] th,
.table-wrap[data-sortable] td { white-space: nowrap; }
.table-wrap[data-sortable] tr > :first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background-color: var(--paper);
  box-shadow: 1.5px 0 0 var(--ink-faint);
}
.table-wrap[data-sortable] th { white-space: normal; min-width: 4.8em; vertical-align: bottom; }
.table-wrap[data-sortable] tr > :first-child { white-space: normal; min-width: 6.5em; max-width: 9em; }

/* word & picture tables turn into cards on phones */
@media (max-width: 760px) {
  .table-wrap--stack { border: 0; overflow: visible; }
  .table-wrap--stack table,
  .table-wrap--stack tbody,
  .table-wrap--stack tr,
  .table-wrap--stack td { display: block; width: auto; }
  .table-wrap--stack thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
  }
  .table-wrap--stack tr {
    margin-top: 14px;
    padding: 12px 16px 14px;
    border: 1.5px solid var(--ink);
    border-radius: 8px;
    background: var(--paper);
  }
  .table-wrap--stack tbody tr:last-child { background: var(--paper); }
  .table-wrap--stack td { padding: 4px 0; }
  .table-wrap--stack td.empty { display: none; }
  .table-wrap--stack td:first-child {
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1.5px solid var(--ink);
    font-family: var(--f-display);
    font-weight: 400;
    font-size: 20px;
    white-space: normal;
  }
  .table-wrap--stack td:not(:first-child)[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 14px;
    font-style: italic;
    color: var(--brown);
  }
  .table-wrap--stack td.media img { height: 92px; }
}

/* single pictures: tall/square ones stay thumbnail-sized, wide banners keep full width */
.gallery--single img { max-height: 360px; width: auto; }
.gallery:not(.gallery--single) img { max-height: 260px; width: auto; }
.opener__section { line-height: 1.35; }
.prose .opener h1 { line-height: 1.08; }

/* ==========================================================
   Highlighter strokes, the main site's signature, used for emphasis
   ========================================================== */
.guide {
  --mk-gold: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(239,190,90,0.6)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
  --mk-pink: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(255,138,180,0.42)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
  --mk-mint: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(88,214,146,0.45)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
  --mk-grey: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(150,135,115,0.28)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
  --mk-red: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(232,96,72,0.38)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .guide {
    --mk-gold: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(240,200,112,0.32)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
    --mk-pink: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(255,150,190,0.3)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
    --mk-mint: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(110,214,160,0.28)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
    --mk-grey: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(200,185,165,0.18)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
    --mk-red: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(255,120,100,0.32)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
  }
}
:root[data-theme="dark"] .guide {
  --mk-gold: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(240,200,112,0.32)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
  --mk-pink: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(255,150,190,0.3)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
  --mk-mint: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(110,214,160,0.28)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
  --mk-grey: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(200,185,165,0.18)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
  --mk-red: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'><path fill='rgba(255,120,100,0.32)' d='M4 5C22 2 40 4.5 60 3.2S88 2.4 97 3.5l-1.6 5 3.4 4.2-2.6 4.6 2.2 5.4C80 26 62 25.5 44 26.8S14 27.6 2.5 26.6l2-4.8L1 17l2.8-4.4L1.6 7.8z'/></svg>");
}


.mk, .shout, .prose strong, .mk-h, .pet__name span, .code code,
.prose mark, .search__results mark {
  background-repeat: no-repeat;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Pairy's own emphasis: bold -> gold marker, ALL CAPS -> pink marker */
.prose strong {
  background-image: var(--mk-gold);
  background-size: 100% 62%;
  background-position: 0 80%;
  padding: 0 .16em;
}
.shout {
  background-image: var(--mk-pink);
  background-size: 100% 58%;
  background-position: 0 82%;
  padding: 0 .12em;
}
.prose h1 strong, .prose th strong { background: none; padding: 0; }

/* section headings: a gold stroke behind the words instead of the kernel */
.prose h2::before { display: none; }
.mk-h {
  background-image: var(--mk-gold);
  background-size: 100% 50%;
  background-position: 0 90%;
  padding: 0 .22em;
  margin-left: -.22em;
}

.pet__name span {
  background-image: var(--mk-mint);
  background-size: 100% 55%;
  background-position: 0 88%;
  padding: 0 .2em;
  margin-left: -.2em;
}

.mk { padding: 1px .35em; }
.mk--gold { background-image: var(--mk-gold); background-size: 100% 100%; }
.mk--grey { background-image: var(--mk-grey); background-size: 100% 100%; }
.mk--red  { background-image: var(--mk-red);  background-size: 100% 100%; }

/* coming soon: a grey stroke label, no dashed box */
.wip {
  padding: 0;
  border: 0;
  font-style: normal;
  color: var(--ink-soft);
}
.wip .mk { margin-right: .4em; color: var(--ink); font-weight: 700; }

/* negative profits */
td.neg { color: var(--ink); }

/* redeem codes sit on a marker stroke instead of a dashed box */
.code code {
  border: 0;
  padding: 3px 10px;
  background-image: var(--mk-gold);
  background-size: 100% 100%;
}

/* search hits and the current chapter in the sidebar */
.prose mark,
.search__results mark {
  background-color: transparent;
  background-image: var(--mk-gold);
  background-size: 100% 80%;
  background-position: 0 70%;
  padding: 0 .15em;
}
.nav a.is-current,
.nav__start.is-current {
  background: var(--mk-gold) no-repeat 0 50% / 100% 92%;
}
.prose ol { padding-left: 2em; }
.code { flex-wrap: wrap; max-width: 100%; }

/* breathing room between a heading and what follows it
   (".prose p { margin: 0 }" above would otherwise win) */
.prose :is(h2, h3) + * { margin-top: .9em; }
.prose h2 + .pet, .prose h3 + .pet, .prose :is(h2, h3) + .table-wrap { margin-top: 1.1em; }
.callout h2 + * { margin-top: .8em; }

/* column dividers: hand-drawn like the row rules */
.guide { --rule-v: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='240' viewBox='0 0 6 240'><path d='M3.2 0C2.1 20 4.1 38 3.1 60s-1.3 41 .1 60 1.2 42-.2 60-.7 42 .4 60' fill='none' stroke='%232a2622' stroke-opacity='.3' stroke-width='1.2' stroke-linecap='round'/></svg>"); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .guide { --rule-v: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='240' viewBox='0 0 6 240'><path d='M3.2 0C2.1 20 4.1 38 3.1 60s-1.3 41 .1 60 1.2 42-.2 60-.7 42 .4 60' fill='none' stroke='%23f1e7d6' stroke-opacity='.26' stroke-width='1.2' stroke-linecap='round'/></svg>"); }
}
:root[data-theme="dark"] .guide { --rule-v: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='240' viewBox='0 0 6 240'><path d='M3.2 0C2.1 20 4.1 38 3.1 60s-1.3 41 .1 60 1.2 42-.2 60-.7 42 .4 60' fill='none' stroke='%23f1e7d6' stroke-opacity='.26' stroke-width='1.2' stroke-linecap='round'/></svg>"); }

table :is(th, td) + :is(th, td) {
  background-image: var(--rule-v);
  background-repeat: repeat-y;
  background-position: left top;
  background-size: 6px 240px;
}
@media (max-width: 760px) {
  .table-wrap--stack table :is(th, td) + :is(th, td) { background-image: none; }
}

/* the active chapter's number is highlighted along with its title */
.nav a.is-current .nav__num { color: var(--ink); }

/* ==========================================================
   Hand-drawn frames (style A). guide.js gives every element its own
   corners and tilt (--sk-r, --sk-tilt), seeded from its text so the
   look is stable across reloads; these values are the no-JS fallback.
   ========================================================== */
.guide .btn,
.topbar__menu,
.code__copy {
  background: none;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--sk-r, 255px 15px 225px 15px / 15px 225px 15px 255px);
  box-shadow: none;
  transform: rotate(var(--sk-tilt, -1deg));
  transition: transform .25s var(--ease), background .25s;
}
.guide .btn { padding: 10px 22px; font-weight: 700; }
.code__copy { border-width: 1.5px; color: var(--ink-soft); }
.guide .btn:hover,
.topbar__menu:hover,
.code__copy:hover,
.guide .btn:focus-visible,
.topbar__menu:focus-visible {
  background: var(--mk-gold) no-repeat center / 100% 100%;
  color: var(--ink);
  transform: rotate(0);
  box-shadow: none;
}
.code__copy.is-done { border-color: var(--mint); color: var(--ink); background: var(--mk-mint) no-repeat center / 100% 100%; }

/* cards: random corners, no tilt so longer text stays crisp */
.pager a,
.pet,
.callout,
.search input {
  border: 1.5px solid var(--ink);
  border-radius: var(--sk-r, 12px 4px 14px 5px / 5px 14px 4px 12px);
}
.pager a { transform: rotate(var(--sk-tilt, 0deg)); }
.pager a:hover {
  transform: rotate(0);
  box-shadow: none;
  background: var(--mk-gold) no-repeat center / 100% 100%;
}
@media (max-width: 760px) {
  .table-wrap--stack tr { border-radius: var(--sk-r, 12px 4px 14px 5px / 5px 14px 4px 12px); }
}

/* cards drawn with four pen strokes (guide.js); the CSS border is only the no-JS fallback */
.pen-frame { position: relative; border-color: transparent !important; }
.pen-frame::after {
  content: "";
  position: absolute;
  inset: -8.5px;            /* 7px stroke room + the 1.5px border */
  background: var(--sk-frame) no-repeat 0 0;
  pointer-events: none;
}
.table-wrap--stack tr.pen-frame { border-color: var(--ink) !important; }
.table-wrap--stack tr.pen-frame::after { display: none; }
@media (max-width: 760px) {
  .table-wrap--stack tr.pen-frame { border-color: transparent !important; }
  .table-wrap--stack tr.pen-frame::after { display: block; }
}

/* OpenDyslexic is wider and taller; keep lines comfortable */
:root[data-font="dyslexic"] .guide { font-size: 16px; }
:root[data-font="dyslexic"] .prose { line-height: 1.8; }
:root[data-font="dyslexic"] .opener__num { font-size: clamp(52px, 9vw, 74px); }
.topbar .prefs { margin-left: auto; }
.topbar__title { margin-right: 0; }
@media (max-width: 480px) { .topbar .pref { width: 34px; height: 32px; } }

/* sort arrows: clear icons instead of faint text glyphs */
th button::after {
  content: "";
  flex: none;
  width: .95em;
  height: .95em;
  opacity: .75;
  background: currentColor;
  -webkit-mask: url("/assets/icons/fa-arrow-up-arrow-down.svg") center / contain no-repeat;
  mask: url("/assets/icons/fa-arrow-up-arrow-down.svg") center / contain no-repeat;
  font-size: inherit;
}
th button:hover::after { opacity: 1; }
th[aria-sort] button {
  color: var(--ink);
  background: var(--mk-gold) no-repeat 0 60% / 100% 85%;
  padding: 1px 6px;
  margin: -1px -6px;
}
th[aria-sort="ascending"] button::after,
th[aria-sort="descending"] button::after { content: ""; opacity: 1; }
th[aria-sort="ascending"] button::after {
  -webkit-mask-image: url("/assets/icons/fa-arrow-up.svg");
  mask-image: url("/assets/icons/fa-arrow-up.svg");
}
th[aria-sort="descending"] button::after {
  -webkit-mask-image: url("/assets/icons/fa-arrow-down.svg");
  mask-image: url("/assets/icons/fa-arrow-down.svg");
}

/* chapter numeral shadow: the wheat-outline brown in both modes
   (--brown itself turns light at night for readable text) */
.guide { --numeral-shadow: #5c3b17; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .guide { --numeral-shadow: #7a4f1d; }
}
:root[data-theme="dark"] .guide { --numeral-shadow: #7a4f1d; }
.opener__num { text-shadow: -3px 2px 0 var(--numeral-shadow); }

/* lightbox: the close button gets its own strip above the picture */
.lightbox { padding: 52px 16px 16px; outline: none; }
.lightbox__close {
  top: 8px;
  right: 10px;
  width: 38px;
  height: 36px;
  border: 1.5px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  color: var(--ink);
  font-size: 24px;
  transform: rotate(-2deg);
}
.lightbox__close:hover { background: var(--mk-gold) no-repeat center / 100% 100%; transform: rotate(0); }
.lightbox img { max-height: calc(92vh - 110px); }

/* ```columns rows: picture | text | picture, like Pairy's doc layout */
.cols {
  display: grid;
  gap: 18px 24px;
  align-items: center;
  max-width: 54rem;
  margin-top: 1.4em;
}
.cols--3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr) minmax(0, 1fr); }
.cols--2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr); }
.col > * + * { margin-top: 1em; }
.col p { margin: 0; }
.cols .gallery { margin: 0; }
.cols .gallery figure { flex: 1 1 auto; }
.cols .gallery img,
.cols .gallery--single img { width: 100%; max-height: none; }
@media (max-width: 640px) {
  /* phones: the two pictures sit side by side above the text */
  .cols--3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cols--3 .col--text { grid-column: 1 / -1; order: 2; }
  .cols--2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); align-items: start; }
}
