/* ==========================================================================
   DryFood KB — design system
   Zero dependencies. Light + dark themes via <html data-theme="…">.
   Sections: tokens · base · typography · links · forms · skip · topbar
             shell + sidebar · content blocks · tables · callouts · badges
             chips · steps/kv/def/timeline · glossary · troubleshooting/FAQ
             tools · pager + footer · print · responsive
   ========================================================================== */

/* ------------------------------------------------------------------ tokens */
:root {
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --topbar-h: 56px;
  --header-h: 98px;   /* topbar + menu bar; re-measured on load and on resize */

  --bg: #f6f3ec;
  --surface: #fffdf9;
  --surface-2: #efeae0;
  --border: #e0d9cb;
  --border-strong: #c9bfab;
  --text: #221d17;
  --muted: #6b6255;

  --accent: #a85a12;
  --accent-ink: #fffdf9;
  --accent-soft: #f7e8d3;
  --ok: #2f7d4f;
  --ok-soft: #dff0e5;
  --warn: #8a5a00;
  --warn-soft: #fbecd0;
  --danger: #a32218;
  --danger-soft: #f8dcd8;
  --info: #1c6a86;
  --info-soft: #d9ecf3;

  --cat-fruit: #b3452a;
  --cat-vegetable: #3f7a34;
  --cat-herb: #2f7a6a;
  --cat-meat: #8c4a52;
  --cat-fish: #2f6386;
  --cat-nut: #7a5a2f;
  --cat-seed: #6b6b2f;
  --cat-other: #6b6255;

  --shadow: 0 1px 2px rgba(40, 30, 15, .06), 0 2px 8px rgba(40, 30, 15, .05);
  --shadow-sm: 0 1px 2px rgba(40, 30, 15, .07);
}

html[data-theme="dark"] {
  --bg: #17140f;
  --surface: #201c16;
  --surface-2: #2a251d;
  --border: #3a332a;
  --border-strong: #4d4436;
  --text: #ece6db;
  --muted: #a99e8c;

  --accent: #e0a45e;
  --accent-ink: #241a08;
  --accent-soft: #38291a;
  --ok: #7bc79b;
  --ok-soft: #1d3326;
  --warn: #e3bc72;
  --warn-soft: #3a2d14;
  --danger: #ef8a7e;
  --danger-soft: #3d1d19;
  --info: #7fc6de;
  --info-soft: #16303a;

  --cat-fruit: #e6937a;
  --cat-vegetable: #9ccf8b;
  --cat-herb: #88d2c2;
  --cat-meat: #dda0a8;
  --cat-fish: #8fc0dd;
  --cat-nut: #d6b483;
  --cat-seed: #cdcd92;
  --cat-other: #a99e8c;

  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
img, svg, canvas { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.6rem 0; }

/* -------------------------------------------------------------- typography */
h1, h2, h3, h4 { line-height: 1.2; }

h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.6rem);
  margin: .2rem 0 .6rem;
}

h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  margin: 2.3rem 0 .6rem;
  padding-top: .8rem;
  border-top: 1px solid var(--border);
  position: relative;
  scroll-margin-top: calc(var(--header-h) + 12px);
}

h3 {
  font-family: var(--serif);
  font-size: 1.12rem;
  margin: 1.6rem 0 .4rem;
  scroll-margin-top: calc(var(--header-h) + 12px);
}

h4 { font-size: .95rem; margin: 1.2rem 0 .3rem; }

p { margin: .7rem 0; }
ul, ol { padding-left: 1.25rem; }
li { margin: .25rem 0; }
small { font-size: .84em; }
strong { font-weight: 700; }
mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 .12em; }
abbr[title] { text-decoration: underline dotted; cursor: help; }
blockquote { margin: 1.2rem 0; padding: .5rem 0 .5rem 1rem; border-left: 3px solid var(--border-strong); color: var(--muted); }

code, kbd, pre, samp { font-family: var(--mono); }
:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: .05em .35em;
  border-radius: 5px;
  font-size: .88em;
}

.anchor {
  margin-left: .4rem;
  color: var(--border-strong);
  text-decoration: none;
  opacity: 0;
  font-size: .8em;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; color: var(--accent); }

.muted { color: var(--muted); }
.compact { font-size: .88rem; }
.compact table { font-size: .85rem; }

/* ------------------------------------------------------------------- links */
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

/* ------------------------------------------------------------------- forms */
input, select, textarea, button { font: inherit; }
input[type="search"],
input[type="number"],
input[type="text"],
input:not([type]),
select,
textarea {
  width: 100%;
  padding: .5rem .6rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
textarea { min-height: 6rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* -------------------------------------------------------------- skip link */
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus {
  left: 1rem; top: .5rem; z-index: 100;
  padding: .5rem .8rem;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: .7rem;
  min-height: var(--topbar-h);
  padding: .5rem 1.1rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: .45rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark { font-size: 1.1rem; }
.brand small {
  font-family: var(--sans);
  font-weight: 500;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
}

.iconbtn {
  flex: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1;
  padding: .4rem .5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.iconbtn:hover { background: var(--surface-2); }
#menuBtn { display: none; }

.searchwrap {
  position: relative;
  flex: 1 1 240px;
  max-width: 520px;
  margin-left: auto;
}
.searchwrap input[type="search"] { padding-right: 2.2rem; }
.kbd {
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .7rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .05rem .3rem;
  background: var(--surface-2);
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + .4rem);
  left: 0;
  right: 0;
  z-index: 50;
  max-height: min(60vh, 460px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.sr-item {
  display: block;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}
.sr-item:last-child { border-bottom: 0; }
.sr-item:hover, .sr-item.is-active { background: var(--surface-2); }
.sr-item strong { display: block; font-family: var(--serif); font-weight: 600; font-size: .95rem; }
.sr-item span { display: block; font-size: .78rem; color: var(--muted); }
.sr-empty { margin: 0; padding: .7rem .8rem; font-size: .85rem; color: var(--muted); }

/* -------------------------------------------------------- shell + top menu */
/* The shell is full-bleed so the menu bar can sit edge to edge directly under
   the topbar; each band insets its own content to the 1320px reading width. */
.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

/* the menu bar sits directly under the sticky topbar and sticks with it */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 30;
  grid-column: 1 / -1;
  /* no bottom padding: the group's own padding carries the panel's hover
     bridge and puts the dropdown edge exactly on the bar's bottom border */
  padding: .2rem max(1.2rem, calc((100% - 1320px) / 2 + 1.2rem)) 0;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.sidebar > nav { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0 .1rem; }

.navgroup { position: relative; padding: 0 0 .5rem; }
.navhead {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  padding: .45rem .68rem;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.navhead:hover { background: var(--surface-2); }
.navgroup[data-open="1"] > .navhead { background: var(--accent-soft); color: var(--accent); }
.navgroup:has(a[aria-current="page"]) > .navhead { color: var(--accent); }
.caret { font-size: .72em; line-height: 1; opacity: .72; transition: transform .15s ease; }
.navgroup[data-open="1"] > .navhead .caret { transform: rotate(180deg); }

.navmenu {
  min-width: 232px;
  margin: 0;
  padding: .35rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.navmenu a {
  display: block;
  padding: .38rem .6rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: .89rem;
}
.navmenu a:hover { background: var(--surface-2); }
.navmenu a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* Dropdowns need scripting. Without it the groups stay a plain wrapping list,
   which keeps the whole menu reachable from the filesystem with JS disabled. */
html:not(.navjs) .sidebar > nav { display: block; }
html:not(.navjs) .navhead {
  display: block;
  width: auto;
  padding: .5rem 0 .25rem;
  color: var(--muted);
  font-size: .71rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  pointer-events: none;
  cursor: default;
}
html:not(.navjs) .caret { display: none; }
html:not(.navjs) .navmenu {
  display: flex;
  flex-wrap: wrap;
  gap: 0 .2rem;
  min-width: 0;
  padding: 0 0 .6rem;
  background: transparent;
  border: 0;
  box-shadow: none;
}

html.navjs .navmenu { position: absolute; top: 100%; left: 0; z-index: 50; display: none; }
html.navjs .navgroup[data-open="1"] > .navmenu { display: block; }

/* width:100% keeps the box inside its grid track at every viewport; the
   max-width and auto margins then centre it on a wide screen */
main { width: 100%; min-width: 0; max-width: 1320px; margin: 0 auto; padding: 1.6rem 1.2rem 3rem; }
article { max-width: 900px; }
article.wide { max-width: none; }

/* --------------------------------------------------------- content headings */
.eyebrow {
  margin: 0;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.lede { font-size: 1.12rem; color: var(--muted); margin: .2rem 0 1rem; max-width: 72ch; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; color: var(--muted); font-size: .85rem; margin: .2rem 0 1rem; }
.meta .dot { opacity: .55; }

nav.toc {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  margin: 1.3rem 0 1.8rem;
}
nav.toc h2 {
  margin: 0 0 .45rem;
  padding: 0;
  border: 0;
  font-family: var(--sans);
  font-size: .71rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
nav.toc ol { margin: 0; padding-left: 1.15rem; columns: 2; column-gap: 1.6rem; font-size: .9rem; }
nav.toc li { margin: .14rem 0; break-inside: avoid; }

/* ------------------------------------------------------------------- cards */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: 1.2rem 0; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}
a.card { text-decoration: none; color: inherit; transition: transform .15s ease, border-color .15s ease; }
a.card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.card .icon { display: block; font-size: 1.4rem; }
.card h2 { border: 0; padding: 0; margin: .3rem 0 .35rem; font-size: 1.05rem; }
.card h3 { margin: .3rem 0 .35rem; font-family: var(--serif); font-size: 1.02rem; }
.card p { margin: 0; font-size: .9rem; color: var(--muted); }

/* ----------------------------------------------------------- video gallery */
.vidgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.1rem; margin: 1.3rem 0; }
.vid { display: flex; flex-direction: column; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.vid-thumb {
  position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: pointer;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--surface-2), color-mix(in srgb, var(--accent) 16%, var(--surface-2)));
}
.vid-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vid-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .34), rgba(0, 0, 0, 0) 62%); }
.vid-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 3.5rem; height: 2.45rem;
  background: rgba(0, 0, 0, .62); color: #fff; border-radius: .55rem;
  font-size: 1.05rem; line-height: 1; transition: background .15s ease;
}
.vid-thumb:hover .vid-play, .vid-thumb:focus-visible .vid-play { background: var(--accent); color: var(--accent-ink); }
.vid-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.vid-meta { display: grid; gap: .25rem; align-content: start; padding: .75rem .85rem .85rem; }
.vid-meta .badge { justify-self: start; }
.vid-meta strong { font-family: var(--serif); font-size: .98rem; line-height: 1.3; }
.vid-meta .muted { font-size: .79rem; }
.vid-note { font-size: .82rem; color: var(--muted); }
.vid-meta a { font-size: .8rem; }

/* ------------------------------------------------------------------ tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td { font-size: .92rem; }
.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tablewrap {
  overflow-x: auto;
  margin: 1.1rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tablewrap table { min-width: 100%; }
.tablewrap thead th { background: var(--surface-2); }
.tablewrap tbody tr:last-child td { border-bottom: 0; }
.tablewrap caption {
  caption-side: bottom;
  padding: .55rem .7rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--muted);
  text-align: left;
}

/* ----------------------------------------------------------------- callouts */
.callout {
  display: flex;
  gap: .8rem;
  margin: 1.2rem 0;
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}
.callout .ico { flex: none; font-size: 1.2rem; line-height: 1.3; }
.callout .body { min-width: 0; }
.callout .body > p:first-child { margin-top: 0; }
.callout .ctitle { display: block; font-family: var(--serif); font-weight: 700; }
.callout p { margin: .25rem 0 0; font-size: .93rem; }
.callout.tip { border-left-color: var(--info); background: color-mix(in srgb, var(--info-soft) 55%, var(--surface)); }
.callout.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn-soft) 60%, var(--surface)); }
.callout.danger { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger-soft) 60%, var(--surface)); }

/* ------------------------------------------------------- badges / chips */
.badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 600;
  padding: .1rem .5rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  vertical-align: .08em;
  white-space: nowrap;
}
.badge.ok { --c: var(--accent); }
.badge.risk { --c: var(--danger); }
.badge.cool { --c: var(--info); }
.badge.fruit { --c: var(--cat-fruit); }
.badge.vegetable { --c: var(--cat-vegetable); }
.badge.herb { --c: var(--cat-herb); }
.badge.meat { --c: var(--cat-meat); }
.badge.fish { --c: var(--cat-fish); }
.badge.nut { --c: var(--cat-nut); }
.badge.seed { --c: var(--cat-seed); }
.badge.other { --c: var(--cat-other); }
.badge.ok, .badge.risk, .badge.cool,
.badge.fruit, .badge.vegetable, .badge.herb, .badge.meat, .badge.fish, .badge.nut, .badge.seed, .badge.other {
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border-color: color-mix(in srgb, var(--c) 36%, transparent);
}

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0 1.1rem; }
.chip {
  font-size: .82rem;
  padding: .24rem .7rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 1rem 0 .4rem; }
.filterbar input[type="search"] { flex: 1 1 220px; }
.count { font-size: .82rem; color: var(--muted); white-space: nowrap; }

/* -------------------------------------------- steps / kv / def / timeline */
ol.steps { list-style: none; counter-reset: step; padding-left: 0; margin: 1rem 0; }
ol.steps > li { position: relative; padding-left: 2.15rem; margin: .55rem 0; }
ol.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: .12em;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 700;
}

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .28rem 1rem; margin: .7rem 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; font-size: .9rem; }

.def { margin: .9rem 0; }
.def dt, .def .t { display: block; font-family: var(--serif); font-weight: 700; font-size: .98rem; margin-top: .75rem; }
.def > dt:first-child, .def > .t:first-child { margin-top: 0; }
.def dd { margin: .15rem 0 0; font-size: .92rem; }

.timeline { list-style: none; padding: 0; margin: 1.2rem 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; margin: 0; padding: 0 0 .9rem 1.25rem; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: .5em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.timeline b { display: block; font-size: .82rem; color: var(--accent); }
.timeline span { font-size: .93rem; }

/* --------------------------------------------------------------- glossary */
.glossary { display: grid; gap: .7rem; }
.gterm {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.gterm dl { margin: 0; }
.gterm dt { font-family: var(--serif); font-weight: 700; }
.gterm dd { margin: .2rem 0 0; font-size: .9rem; color: var(--muted); }
.alpha { display: flex; flex-wrap: wrap; gap: .25rem; margin: .6rem 0 1rem; }
.alpha a {
  min-width: 1.75rem;
  text-align: center;
  padding: .15rem .35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: .82rem;
}
.alpha a:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------ troubleshooting / FAQ */
.trouble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  margin: .9rem 0;
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.trouble h4 { display: flex; align-items: baseline; gap: .5rem; margin: 0 0 .35rem; font-family: var(--serif); font-size: 1rem; }
.trouble .sym { font-size: 1.15rem; }
.trouble dl { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .9rem; margin: .3rem 0 0; font-size: .9rem; }
.trouble dt { color: var(--muted); }
.trouble dd { margin: 0; }

.qa {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .1rem .95rem;
  margin: .6rem 0;
}
.qa summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
  padding: .65rem 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  list-style: none;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: "+"; color: var(--accent); font-family: var(--sans); font-weight: 700; }
.qa[open] summary::after { content: "–"; }
.qa .answer { padding: .1rem 0 .8rem; }
.qa .answer p { margin: .2rem 0 0; font-size: .93rem; }

.dive { max-width: 900px; }

/* ------------------------------------------------------------------ tools */
.tool {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
  margin: 1.4rem 0;
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.tool h3 { margin: 0 0 .3rem; }
.tool-desc { margin: .2rem 0 .9rem; font-size: .9rem; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem .9rem; margin: .4rem 0; }
.field label { display: block; margin-bottom: .22rem; font-size: .82rem; font-weight: 600; }
.field .hint { display: block; margin-top: .22rem; font-size: .76rem; color: var(--muted); }
.btnrow { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }

.btn {
  display: inline-block;
  font-size: .88rem;
  font-weight: 600;
  padding: .45rem .9rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--border-strong); }
.btn.ghost:hover { border-color: var(--accent); background: var(--accent-soft); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }

.result { display: block; margin-top: .8rem; padding: .7rem .9rem; background: var(--surface-2); border-radius: var(--radius-sm); font-size: .9rem; }
.result.out {
  display: inline-block;
  margin: 0;
  padding: 0;
  background: none;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}
.sub { display: block; margin-top: .15rem; font-size: .85rem; color: var(--muted); }
.err { color: var(--danger); font-weight: 600; }

/* ------------------------------------------------------------ pager / foot */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: 2.2rem 0 1rem; }
.pager a {
  display: flex;
  flex-direction: column;
  gap: .12rem;
  padding: .7rem .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-size: .9rem;
}
.pager a:hover { border-color: var(--accent); }
.pager a.next { grid-column: 2; text-align: right; align-items: flex-end; }
.pager .dir { font-size: .71rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

footer.site { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .82rem; color: var(--muted); }
.footlinks { display: flex; flex-wrap: wrap; gap: .3rem .85rem; margin-bottom: .7rem; }
.footlinks a { color: var(--muted); text-decoration: none; }
.footlinks a:hover { color: var(--accent); text-decoration: underline; }

/* --------------------------------------------------------------- utilities */
.no-print { }

/* ------------------------------------------------------------------ print */
@media print {
  .topbar, .sidebar, .pager, footer.site, .skip, .no-print, .search-results, .vidgrid { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .shell { display: block; padding: 0; }
  main { padding: 0; }
  article { max-width: none; }
  a { color: #000; text-decoration: none; }
  .card, .tablewrap, .callout, .tool { box-shadow: none; border-color: #999; }
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 1000px) {
  #menuBtn { display: inline-flex; }
  /* the menu becomes a slide-in panel of accordions */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(340px, 86vw);
    margin: 0;
    padding: 1rem 1rem 3rem;
    background: var(--surface);
    border-right: 1px solid var(--border);
    border-bottom: 0;
    box-shadow: var(--shadow);
    overflow: auto;
    transform: translateX(-102%);
    transition: transform .2s ease;
  }
  body.navopen .sidebar { transform: none; }
  .sidebar > nav { display: block; }
  /* Without scripting nothing can open the panel, so the fallback list is
     shown inline instead of parked off-screen. */
  html:not(.navjs) .sidebar {
    position: static;
    width: auto;
    padding: .2rem 1.2rem 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    overflow: visible;
    transform: none;
  }
  .navgroup { padding: 0; border-bottom: 1px solid var(--border); }
  .navgroup:last-child { border-bottom: 0; }
  .navhead {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: .62rem .5rem;
    font-size: .95rem;
    border-radius: 0;
  }
  html.navjs .navmenu {
    position: static;
    min-width: 0;
    padding: 0 0 .5rem .35rem;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .navmenu a { padding: .4rem .5rem; font-size: .92rem; }
}

@media (max-width: 700px) {
  nav.toc ol { columns: 1; }
  .searchwrap { max-width: none; }
  .brand small { display: none; }
}

@media (max-width: 560px) {
  .pager { grid-template-columns: 1fr; }
  .pager a.next { grid-column: 1; text-align: left; align-items: flex-start; }
  .kv, .trouble dl { grid-template-columns: 1fr; gap: .05rem 0; }
  .kv dd, .trouble dd { margin-bottom: .5rem; }
}

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

/* ==========================================================================
   Tier-1 additions: figures, wizard, bench card
   Appended to the DryFood KB design system.
   ========================================================================== */

/* ---------- figure blocks (SVG library) ---------- */
.svgfig {
  margin: 1.4rem 0; padding: 1.1rem 1.2rem .8rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.svgfig .figsvg { display: block; max-width: 640px; margin: 0 auto; height: auto; color: var(--text); }
.svgfig + .figcaption,
figure.figure .figcaption { margin-top: .55rem; font-size: .83rem; color: var(--muted); }
.figrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin: 1.3rem 0; }
.figrow .svgfig { margin: 0; }
.svgfig text { font-family: var(--sans); }

/* On a phone a 560px-wide chart shrinks until its labels are unreadable, so
   the figure keeps a legible minimum and scrolls sideways instead — the same
   treatment tables get. */
@media (max-width: 760px) {
  .svgfig { overflow-x: auto; }
  .svgfig .figsvg { min-width: 470px; }
}

/* ---------- figure motion ----------
   Decorative only, and always optional: the prefers-reduced-motion rule
   near the top of this file switches every animation off, and nothing moves
   in print. Each figure still reads as a static diagram. */
.anim-slide { animation: kb-slide 1.6s ease-in-out infinite alternate; }
.anim-move { animation: kb-move 2.6s linear infinite; }
.anim-dash { animation: kb-dash 2.4s linear infinite; }
.anim-pulse { animation: kb-pulse 3.4s ease-in-out infinite; }
@keyframes kb-slide { from { transform: translateX(0); } to { transform: translateX(5px); } }
@keyframes kb-move {
  0% { transform: translateX(0); opacity: 0; }
  15% { opacity: .9; }
  85% { opacity: .9; }
  100% { transform: translateX(var(--dx, 40px)); opacity: 0; }
}
@keyframes kb-dash { to { stroke-dashoffset: -26; } }
@keyframes kb-pulse { 0%, 100% { opacity: .95; } 50% { opacity: .3; } }

/* ---------- figure / ASCII blocks ---------- */
.figure { margin: 1.2rem 0; }
.ascii {
  margin: 0; padding: .8rem .9rem;
  font-family: var(--mono); font-size: .78rem; line-height: 1.45;
  white-space: pre; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text);
}

/* ---------- wizard ---------- */
.wiz { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem 1.5rem; margin: 1.6rem 0; }
.wiz-steps { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 1.1rem; }
.wiz-dot { font-size: .78rem; color: var(--muted); padding: .22rem .6rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.wiz-dot.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.wiz-q { margin: 1rem 0 .5rem; font-size: 1.05rem; font-family: var(--serif); font-weight: 700; }
.wiz-hint { font-size: .86rem; color: var(--muted); margin: 0 0 .8rem; }
.wiz-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; }
.wiz-opt {
  text-align: left; padding: .7rem .85rem; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.wiz-opt:hover { border-color: var(--border-strong); }
.wiz-opt[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.wiz-opt b { display: block; font-size: .95rem; }
.wiz-opt span { display: block; font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.wiz-nav { display: flex; gap: .5rem; margin-top: 1.2rem; flex-wrap: wrap; }
.wiz-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem .9rem; }

/* ---------- plan output ---------- */
.plan { margin-top: 1.5rem; display: grid; gap: 1rem; }
.plan-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .8rem; }
.plan-head h3 { margin: 0; }
.plan-badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.plan h4 { margin: 1.1rem 0 .4rem; font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .65rem; }
.stat b { display: block; font-family: var(--serif); font-size: 1.12rem; line-height: 1.2; color: var(--accent); }
.stat span { display: block; margin-top: .12rem; font-size: .76rem; color: var(--muted); }
.plan .kv { margin-top: .4rem; }
.plan .kv dd { max-width: 60ch; }
.plan-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; }
.badge.ok { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 34%, transparent); }
.badge.risk { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.badge.cool { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }

/* ---------- bench card ---------- */
.bench {
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  padding: 1.2rem 1.4rem; margin: 1.4rem 0;
}
.bench-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .9rem; border-bottom: 2px solid var(--border-strong); padding-bottom: .6rem; margin-bottom: .8rem; }
.bench-title h3 { margin: 0; font-size: 1.25rem; }
.bench-title .muted { font-size: .85rem; }
.bench h4 { margin: .9rem 0 .3rem; font-size: .75rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.bench .kv { grid-template-columns: auto 1fr; gap: .25rem 1rem; }
.bench-fill { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem 1.2rem; margin: .4rem 0; }
.bench-fill .bf { font-size: .86rem; }
.bench-fill .bf i { display: block; height: 1.35em; border-bottom: 1px dotted var(--border-strong); }
.bench-checks { list-style: none; padding: 0; margin: .4rem 0 0; }
.bench-checks li { display: flex; gap: .55rem; align-items: baseline; padding: .22rem 0; font-size: .9rem; }
.bench-checks .box { flex: none; width: 1.05em; height: 1.05em; border: 1.6px solid var(--border-strong); border-radius: 4px; display: inline-block; position: relative; top: .12em; }
.bench-foot { margin-top: 1rem; padding-top: .6rem; border-top: 1px dashed var(--border-strong); font-size: .78rem; color: var(--muted); }
.bench-tool-hidden { display: none !important; }
body.printing-card .bench-tool-hidden { display: block !important; }

/* ---------- printable templates ---------- */
.tpl { background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius); padding: 1.3rem 1.5rem; margin: 1.6rem 0; }
.tpl h3 { margin-top: 0; }
.tpl-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 0; }
.tpl table { font-size: .86rem; }
.tpl .meta-line { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem 1.4rem; margin: .8rem 0; }
.tpl .meta-line div { font-size: .88rem; }
.tpl .meta-line i { display: block; height: 1.3em; border-bottom: 1px dotted var(--border-strong); }
.tpl ol.steps { font-size: .92rem; }
.tpl .signoff { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.2rem; margin-top: 1.2rem; font-size: .86rem; }
.tpl .signoff i { display: block; height: 2em; border-bottom: 1px dotted var(--border-strong); margin-top: 1.6em; }

/* ---------- progress / batch tracker ---------- */
.tracker { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem 1.4rem; margin: 1.6rem 0; }
.tracker .fields { margin-bottom: .5rem; }
.tracker-log { margin: .8rem 0 0; }
.tracker-log table { font-size: .86rem; }
.tracker-canvas { width: 100%; height: auto; display: block; margin-top: 1rem; color: var(--text); }
.tracker-note { font-size: .84rem; color: var(--muted); margin-top: .5rem; }

/* ---------- print rules ---------- */
@media print {
  .svgfig { box-shadow: none; break-inside: avoid; }
  .wiz, .wiz-steps, .plan-actions, .tracker-form, .no-print { display: none !important; }
  .plan, .bench, .tpl { box-shadow: none; break-inside: avoid; }
  .bench { border-width: 2px; }
}
