/* Mobile-first, no framework. Big tap targets for kitchen use. */
:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #6b655c;
  --line: #e7e0d5;
  --accent: #b4532a;
  --accent-soft: #f6e3d7;
  --meal: #2f6b4f;
  --meal-soft: #dcefe4;
  --done: #a39d93;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18;
    --surface: #24221f;
    --text: #f1ece4;
    --muted: #a8a196;
    --line: #3a3732;
    --accent: #e98a5c;
    --accent-soft: #3d2a20;
    --meal: #7cc7a0;
    --meal-soft: #1f3529;
    --done: #6d675e;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--font);
}
a { color: var(--accent); }
h1, h2 { line-height: 1.2; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-weight: 400; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

.site-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.site-header nav a { text-decoration: none; font-weight: 600; padding: 8px 4px; }
.site-footer { color: var(--muted); font-size: 0.85rem; padding: 32px 16px 48px; }

/* Home */
.search { padding-top: 16px; }
.search input {
  width: 100%; font: inherit; font-size: 1.05rem;
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chips.small { gap: 6px; margin: 8px 0 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 0.9rem; line-height: 1;
  padding: 10px 14px; min-height: 40px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer;
}
.chips.small .chip { font-size: 0.78rem; padding: 5px 10px; min-height: 0; }
.chips.big .chip { font-size: 1rem; }
.chip.meal { border-color: color-mix(in srgb, var(--meal) 35%, var(--line)); color: var(--meal); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.meal.active { background: var(--meal); border-color: var(--meal); color: var(--bg); }
#tag-filter { flex-wrap: nowrap; overflow-x: auto; margin: 12px -16px; padding: 0 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
#tag-filter::-webkit-scrollbar { display: none; }
#tag-filter .chip { flex: none; }
@media (min-width: 720px) { #tag-filter { flex-wrap: wrap; overflow: visible; margin: 12px 0; padding: 0; } }
.count { color: var(--muted); font-size: 0.9rem; margin: 4px 0 8px; }
.cards { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 12px; }
.card a {
  display: block; overflow: hidden; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
.card a:active { transform: scale(0.99); }
.card-body { padding: 14px 16px 16px; }
.card-media { aspect-ratio: 4 / 3; background: var(--line); }
.card-media picture, .card-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--accent); background: linear-gradient(135deg, var(--accent-soft), var(--bg)); }
.placeholder svg { width: 34%; max-width: 140px; opacity: 0.75; }
.ph-breakfast, .ph-brunch { color: #c58a1a; background: linear-gradient(135deg, color-mix(in srgb, #f4c460 22%, var(--bg)), var(--bg)); }
.ph-lunch, .ph-side, .ph-appetizer { color: var(--meal); background: linear-gradient(135deg, var(--meal-soft), var(--bg)); }
.ph-dessert, .ph-snack { color: #a8456b; background: linear-gradient(135deg, color-mix(in srgb, #e9a3bf 25%, var(--bg)), var(--bg)); }

/* Photos */
.hero { margin: 0 -16px; }
.hero picture, .hero img { display: block; width: 100%; height: auto; }
.hero figcaption { color: var(--muted); font-size: 0.78rem; margin: 6px 16px 0; }
@media (min-width: 760px) { .hero { margin: 16px 0 0; } .hero img { border-radius: var(--radius); } .hero figcaption { margin: 6px 0 0; } }
.gallery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gallery-item { display: block; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--line); }
.gallery-item picture, .gallery-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card h2 { font-size: 1.15rem; margin: 0 0 4px; }
.card p { margin: 0 0 8px; color: var(--muted); font-size: 0.95rem; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 0.88rem; }
.empty { color: var(--muted); }
.page-title { margin: 20px 0 12px; }
.section-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 20px 0 0; }

/* Recipe */
.recipe-head { padding: 16px 0 8px; }
.recipe-head h1 { margin: 0 0 6px; font-size: 1.7rem; }
.lede { margin: 0 0 8px; color: var(--muted); }
.recipe-head .chip { pointer-events: auto; }

.toolbar {
  position: sticky; top: 53px; z-index: 4;
  display: flex; flex-wrap: nowrap; align-items: center; gap: 10px;
  margin: 8px -16px 0; padding: 10px 16px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper-label { color: var(--muted); font-size: 0.95rem; }
.step {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.step:active { background: var(--accent-soft); }
#servings {
  width: 64px; height: 44px; text-align: center; font: inherit; font-weight: 700; font-size: 1.1rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text);
}
.ghost { font: inherit; font-size: 0.9rem; background: none; border: 0; color: var(--accent); padding: 8px; cursor: pointer; }
.wake { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--muted); margin: 10px 0 2px; min-height: 32px; }
.wake input { width: 20px; height: 20px; }

.recipe h2 { font-size: 1.25rem; margin: 24px 0 8px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { border-bottom: 1px solid var(--line); }
.checklist label { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; cursor: pointer; }
.checklist input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.checklist input:checked + span { color: var(--done); text-decoration: line-through; }
.amt { font-weight: 700; }
.checklist li.subhead { border: 0; padding: 16px 0 4px; font-weight: 700; color: var(--muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }
.review { background: var(--accent-soft); color: var(--text); padding: 10px 12px; border-radius: 10px; font-size: 0.9rem; }
.source { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.note { color: var(--muted); }

.steplist { padding-left: 0; margin: 0; list-style: none; counter-reset: step; }
.steplist li {
  counter-increment: step; position: relative;
  padding: 12px 0 12px 44px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.steplist li::before {
  content: counter(step); position: absolute; left: 0; top: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 0.9rem;
  background: var(--accent-soft); color: var(--accent);
}
.steplist li.done { color: var(--done); }
.steplist li.done::before { content: "✓"; background: var(--line); color: var(--muted); }

.notes p { margin: 0 0 8px; }

.badge {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: middle;
}
.portion { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 12px; }
.portion > span { color: var(--muted); font-size: 0.95rem; margin-right: 4px; }
.portion .chip { min-height: 36px; padding: 8px 12px; }
.nut { width: 100%; border-collapse: collapse; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.nut th, .nut td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.nut th[scope="row"], .nut thead th:first-child { text-align: left; white-space: normal; font-weight: 500; }
.nut thead th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.nut tr.group th { text-align: left; font-weight: 700; padding-top: 16px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.nut tr.indent th[scope="row"] { padding-left: 16px; color: var(--muted); }
.nut .unit { color: var(--muted); font-size: 0.8em; }
.nut .dv { color: var(--muted); width: 3.5em; }
.nut tr[data-key="calories"] th, .nut tr[data-key="calories"] td { font-weight: 700; font-size: 1.05rem; }
.nut sup { color: var(--accent); }
.fine { color: var(--muted); font-size: 0.85rem; margin-top: 12px; }
.fine summary { cursor: pointer; color: var(--accent); padding: 8px 0; }
.trace { padding-left: 18px; }

@media (min-width: 720px) {
  body { font-size: 18px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .recipe-head h1 { font-size: 2.2rem; }
}
@media print {
  .site-header, .toolbar, .portion, .site-footer, .checklist input { display: none !important; }
}
