@font-face { font-family: 'Geist'; font-weight: 400 600; font-display: swap; src: url(fonts/geist.woff2) format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-weight: 500 600; font-display: swap; src: url(fonts/instrument-sans.woff2) format('woff2'); }
@font-face { font-family: 'Mynerve'; font-weight: 400; font-display: swap; src: url(fonts/mynerve.woff2) format('woff2'); }

:root {
  --paper: #f5f4f0;
  --surface: #ffffff;
  --ink: #23211d;
  --muted: #6b675f;
  --line: #e4e1d9;
  --lavender: #efe9ff;
  --lavender-ink: #5a4a8c;
  --oat: #f3ebdc;
  --radius: 14px;
  --gutter: 16px;
  --heading: 'Instrument Sans', system-ui, sans-serif;
  --body: 'Geist', system-ui, sans-serif;
  --hand: 'Mynerve', cursive;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.5 var(--body);
}

main, article {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(48px + env(safe-area-inset-bottom));
}

h1, h2, h3 { font-family: var(--heading); font-weight: 600; line-height: 1.2; margin: 0; }

button, input, select { font: inherit; color: inherit; }

p { margin: 0; }

:focus-visible { outline: 2px solid var(--lavender-ink); outline-offset: 2px; }

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

.hand { font-family: var(--hand); font-weight: 400; }

.pill {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  white-space: nowrap;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: calc(20px + env(safe-area-inset-top));
}

.top h1 { font-size: 1.6rem; }

.info-link { color: var(--lavender-ink); font-size: 0.95rem; }

.controls {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0 calc(-1 * var(--gutter));
  padding: 12px var(--gutter) 10px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.search input, .age select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.age { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.age span { font-size: 0.85rem; color: var(--muted); }

.tabs { display: grid; grid-template-columns: repeat(4, auto); gap: 6px; }

.tabs button {
  padding: 7px 4px;
  font-size: 0.93rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
}

.tabs button[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.tabs .count { color: var(--lavender-ink); font-weight: 600; }
.tabs button[aria-current] .count { color: var(--lavender); }

.chapter {
  margin: 20px calc(-1 * var(--gutter)) 8px;
  padding: 24px var(--gutter);
  background: var(--lavender);
}

.chapter h2 { font-size: 2.4rem; letter-spacing: -0.01em; }
.chapter .hand { margin: 0; font-size: 1.5rem; color: var(--lavender-ink); }
.chapter-intro { margin: 12px 0 0; color: var(--muted); max-width: 34em; }

.section h3 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 10px;
  font-size: 1.05rem;
}

.section-age { font-family: var(--body); font-weight: 400; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }

.rows { display: grid; gap: 8px; }

.result-count, .empty { color: var(--muted); margin: 20px 0 10px; }

.row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.row img { width: 96px; height: 64px; object-fit: cover; border-radius: 9px; background: var(--line); }
.row-text { display: grid; gap: 4px; }
.row-title { font-family: var(--heading); font-weight: 500; line-height: 1.25; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.row-meta .pill { background: var(--paper); }
.fav-mark { margin-left: 6px; color: var(--lavender-ink); }

.recipe-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  margin: 0 calc(-1 * var(--gutter));
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: var(--paper);
}

.recipe-bar button {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
}

.fav-toggle[aria-pressed="true"] { background: var(--lavender); border-color: var(--lavender); color: var(--lavender-ink); }

.hero {
  display: block;
  width: calc(100% + 2 * var(--gutter));
  height: auto;
  margin: 0 calc(-1 * var(--gutter));
  aspect-ratio: 1000 / 671;
  object-fit: cover;
  background: var(--line);
}

.recipe-body > * + * { margin-top: 28px; }
.recipe-body h1 { margin-top: 20px; font-size: 1.9rem; letter-spacing: -0.01em; }
.recipe-body h2 { font-size: 1.2rem; margin-bottom: 10px; }
.recipe-body p + p { margin-top: 10px; }

.recipe-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.age-note { margin-top: 8px; color: var(--lavender-ink); font-size: 0.95rem; }

.ingredients-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ingredients-head h2 { margin: 0; }

.stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.stepper button {
  width: 42px;
  height: 40px;
  border: 0;
  background: none;
  font-size: 1.3rem;
  cursor: pointer;
}

.stepper button:disabled { opacity: 0.3; }
.stepper output { min-width: 7.5em; text-align: center; font-weight: 500; }

.group-title { font-size: 1rem; margin: 16px 0 6px; color: var(--muted); }

.ingredients { width: 100%; border-collapse: collapse; }
.ingredients td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.ingredients td:first-child { width: 6.5em; padding-right: 12px; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ingredients .scaled td:first-child { color: var(--lavender-ink); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 10px; }

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--lavender);
  color: var(--lavender-ink);
  font-weight: 600;
  font-size: 0.9rem;
}

.note { padding: 16px 18px 18px; border-radius: var(--radius); }
.note h2.hand { font-size: 1.6rem; margin-bottom: 4px; }
.tip, .safety { background: var(--lavender); }
.tip h2, .safety h2 { color: var(--lavender-ink); }
.box { background: var(--oat); }
.safety ul { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }

.nutrition .basis { font-family: var(--body); font-weight: 400; font-size: 0.9rem; color: var(--muted); }

.nutrition dl {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 8px;
  margin: 0;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
}

.nutrition dt { font-size: 0.75rem; color: var(--muted); }
.nutrition dd { margin: 0; font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.nutrition dd small { font-size: 0.75rem; font-weight: 400; color: var(--muted); }

.spotlight { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-size: 0.9rem; }
.estimate { margin-top: 10px; font-size: 0.85rem; color: var(--muted); }

.lead { font-size: 1.1rem; }

@media (max-width: 380px) {
  .nutrition dl { grid-template-columns: repeat(2, 1fr); }
  .age { grid-template-columns: 1fr; gap: 4px; }
}
