/* Handbook site. Mobile first: one column, large tap targets, no horizontal scroll. */
@font-face { font-family: "DyslexicFont"; src: url("fonts/DyslexicFont-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "DyslexicFont"; src: url("fonts/DyslexicFont-Bold.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "DyslexicFont"; src: url("fonts/DyslexicFont-Italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "DyslexicFont"; src: url("fonts/DyslexicFont-BoldItalic.woff") format("woff"); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  --scale: 1;
  --bg: #2a211a;
  --panel: #382c22;
  --panel-2: #44362a;
  --line: #5c4a39;
  --text: #f0e6d2;
  --muted: #bcab8f;
  --link: #9fd4ff;
  --accent: #e7b866;
  --chip: #4a3b2e;
  --mark: #6b5320;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh: 1.6;
  --size: 1rem;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4ecdb; --panel: #eadfc8; --panel-2: #e0d2b6; --line: #c9b792; --text: #2b2118; --muted: #65553f;
    --link: #1d5c96; --accent: #86540f; --chip: #e3d6ba; --mark: #f1d58a;
  }
}
:root[data-theme="light"] {
  --bg: #f4ecdb; --panel: #eadfc8; --panel-2: #e0d2b6; --line: #c9b792; --text: #2b2118; --muted: #65553f;
  --link: #1d5c96; --accent: #86540f; --chip: #e3d6ba; --mark: #f1d58a;
}
:root[data-font="dys"] {
  --font: "DyslexicFont", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --lh: 1.75;
  --size: 0.9rem;      /* the dyslexic face is wide: slightly smaller and a little tighter keeps enough words per line */
}
/* This face leaves 0.3 em of air beside every letter; at phone width that is four words a line. Take part of it back. */
:root[data-font="dys"] body { letter-spacing: -0.1em; word-spacing: -0.12em; }
:root[data-font="dys"] .search input { letter-spacing: -0.1em; }

* { box-sizing: border-box; }
/* touch: no double-tap zoom delay, a soft tap flash instead of Android's blue box */
html { touch-action: manipulation; -webkit-tap-highlight-color: rgba(231, 184, 102, 0.22); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: calc(var(--size) * var(--scale)); line-height: var(--lh);
  overflow-wrap: anywhere; word-break: normal;
}
a { color: var(--link); text-underline-offset: 0.15em; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- top bar ---- */
.bar {
  position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 0.5rem max(0.75rem, env(safe-area-inset-left)) 0.5rem max(0.75rem, env(safe-area-inset-right));
  padding-top: max(0.5rem, env(safe-area-inset-top));
}
.bar-row { display: flex; align-items: center; gap: 0.5rem; max-width: 46rem; margin: 0 auto; }
.home { font-weight: 700; color: var(--accent); text-decoration: none; padding: 0.6rem 0.25rem; white-space: nowrap; }
.search { flex: 1 1 auto; min-width: 0; }
.search input {
  width: 100%; min-height: 3rem; padding: 0.4rem 0.75rem; border-radius: 0.5rem;
  border: 1px solid var(--line); background: var(--bg); font-size: max(16px, 1em);   /* 16px stops iOS zooming in */
}
.search input::placeholder { color: var(--muted); }
.icon-btn {
  flex: 0 0 auto; min-width: 3rem; min-height: 3rem; border-radius: 0.5rem; border: 1px solid var(--line);
  background: var(--panel-2); font-weight: 700; cursor: pointer;
}
.icon-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.prefs { max-width: 46rem; margin: 0.5rem auto 0; display: grid; gap: 0.5rem; }
.prefs[hidden] { display: none; }
.pref { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.pref-label { color: var(--muted); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 0.5rem; overflow: hidden; }
.seg button {
  min-height: 3rem; min-width: 4rem; padding: 0.25rem 0.8rem; border: 0; border-left: 1px solid var(--line);
  background: var(--bg); cursor: pointer;
}
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--bg); font-weight: 700; }

/* ---- layout ---- */
main { max-width: 46rem; margin: 0 auto; padding: 0.75rem max(0.75rem, env(safe-area-inset-left)) 2rem max(0.75rem, env(safe-area-inset-right)); min-height: 60vh; }
main:focus { outline: none; }
.note { color: var(--muted); margin: 1rem 0; }
.foot { max-width: 46rem; margin: 0 auto; padding: 1rem 0.75rem 2.5rem; color: var(--muted); font-size: 0.85em; border-top: 1px solid var(--line); }

/* ---- tabs ---- */
.tabs { display: flex; gap: 0.5rem; margin: 0.25rem 0 0.75rem; }
.tabs a {
  flex: 1 1 0; text-align: center; min-height: 3rem; display: flex; align-items: center; justify-content: center;
  padding: 0.3rem 0.5rem; border: 1px solid var(--line); border-radius: 0.5rem; background: var(--panel);
  color: var(--text); text-decoration: none;
}
.tabs a[aria-current="page"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* ---- lists ---- */
details.mod { border: 1px solid var(--line); border-radius: 0.6rem; background: var(--panel); margin: 0 0 0.6rem; overflow: hidden; }
details.mod > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; min-height: 3rem;
  padding: 0.5rem 0.75rem; font-weight: 700;
}
details.mod > summary::-webkit-details-marker { display: none; }
details.mod > summary::before { content: "\25B8"; color: var(--accent); flex: 0 0 auto; width: 1em; }
details.mod[open] > summary::before { content: "\25BE"; }
.count { margin-left: auto; color: var(--muted); font-weight: 400; font-size: 0.9em; white-space: nowrap; }
ul.rows { list-style: none; margin: 0; padding: 0; }
ul.rows li { border-top: 1px solid var(--line); }
ul.rows a, ul.rows .row {
  display: block; min-height: 3rem; padding: 0.7rem 0.75rem; color: var(--text); text-decoration: none;
}
ul.rows a:active { background: var(--panel-2); }
ul.rows.plain { border: 1px solid var(--line); border-radius: 0.6rem; background: var(--panel); overflow: hidden; }
ul.rows.plain li:first-child { border-top: 0; }
.sub { display: block; color: var(--muted); font-size: 0.85em; line-height: 1.35; margin-top: 0.15rem; }
.snip mark { background: var(--mark); color: inherit; border-radius: 0.2em; padding: 0 0.1em; }
h2.sec { font-size: 1.05em; margin: 1.2rem 0 0.5rem; color: var(--accent); }
.more-btn {
  display: block; width: 100%; min-height: 3rem; margin: 0.6rem 0; border-radius: 0.6rem; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer;
}

/* ---- a page ---- */
.crumbs { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; color: var(--muted); font-size: 0.9em; margin: 0.1rem 0 0.4rem; }
.crumbs a, .crumbs button {
  display: inline-flex; align-items: center; min-height: 3rem; padding: 0 0.7rem; border: 1px solid var(--line);
  border-radius: 0.5rem; background: var(--panel); color: var(--text); text-decoration: none; cursor: pointer;
}
.page h1 { font-size: 1.45em; line-height: 1.25; margin: 0.4rem 0 0.2rem; color: var(--accent); }
.page .meta { color: var(--muted); font-size: 0.85em; margin: 0 0 0.9rem; }
.body { border: 1px solid var(--line); border-radius: 0.6rem; background: var(--panel); padding: 0.9rem 0.9rem 1.1rem; }
.body a { padding: 0.25em 0; }      /* taller touch area for links inside text */
.body strong { color: var(--text); }
.body .big { line-height: 1.3; }
.body .blk { display: block; }
.body .clr { display: block; clear: both; }
.body .fc { color: var(--c); }
.body kbd {
  display: inline-block; font: inherit; font-size: 0.88em; line-height: 1.3; padding: 0.05em 0.45em; margin: 0 0.1em;
  border: 1px solid var(--muted); border-bottom-width: 2px; border-radius: 0.35em; background: var(--bg); white-space: nowrap;
}
.body code { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 0.92em; background: var(--bg); padding: 0.05em 0.3em; border-radius: 0.25em; }
.body .stack {
  display: inline-block; font-size: 0.9em; line-height: 1.3; padding: 0.1em 0.5em; margin: 0.1em 0.1em; border-radius: 0.4em;
  background: var(--chip); border: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.body a.stack { border-color: var(--link); }
.body .stack .more { color: var(--muted); }
.body .ref { border-bottom: 1px dotted var(--muted); }
.body .icon { color: var(--accent); font-size: 0.8em; }
.body a.ext::after { content: " \2197"; font-size: 0.8em; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .body .fc { color: var(--text); color: color-mix(in srgb, var(--c) 45%, #000); font-weight: 600; }
}
:root[data-theme="light"] .body .fc { color: var(--text); color: color-mix(in srgb, var(--c) 45%, #000); font-weight: 600; }

/* ---- item pages ---- */
.body + .body, .body + h2.sec { margin-top: 0.9rem; }
.recipe { border: 1px solid var(--line); border-radius: 0.6rem; background: var(--panel); padding: 0.75rem; margin: 0 0 0.6rem; }
.grid { display: grid; gap: 0.3rem; margin: 0 0 0.5rem; }
.cell {
  min-height: 3.2rem; border: 1px solid var(--line); border-radius: 0.4rem; background: var(--bg); padding: 0.3rem;
  font-size: 0.82em; line-height: 1.25; display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--text); text-decoration: none;
}
.cell.empty { background: transparent; border-style: dashed; opacity: 0.5; }
a.cell { border-color: var(--link); }
.recipe .out { font-weight: 700; }
.recipe .rnote { color: var(--muted); font-size: 0.88em; }
ul.ings { margin: 0.2rem 0 0.4rem; padding-left: 1.2rem; }
.codeline { font-family: ui-monospace, Consolas, monospace; font-size: 0.8em; color: var(--muted); }

@media (min-width: 40rem) {
  .cell { font-size: 0.9em; min-height: 3.6rem; }
  .grid { max-width: 28rem; }
}

/* narrow Android phones (320 to 360 px) */
@media (max-width: 22.5rem) {
  .home { font-size: 0.95em; }
  .seg button { min-width: 3.4rem; padding: 0.25rem 0.55rem; }
  .body { padding: 0.8rem 0.75rem 1rem; }
  .cell { font-size: 0.78em; padding: 0.25rem; }
}
/* installed to the home screen: no browser bar, so keep clear of the gesture area */
@media (display-mode: standalone) {
  .foot { padding-bottom: max(2.5rem, env(safe-area-inset-bottom)); }
}
