/* Layout: one column, phone-first, read at arm's length from the counter.
   Herb green accent; quantities set heavier than the words so tsp/tbsp stand out. */
:root {
  --bg: #f7f6f1;
  --surface: #ffffff;
  --fg: #1f2420;
  --muted: #5f6a62;
  --line: #dfe2d9;
  --accent: #2f6b4f;
  --accent-fg: #ffffff;
  --accent-soft: #e3efe7;
  --tick: #9aa59c;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --step: 1.125rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151916;
    --surface: #1e2420;
    --fg: #edf0ea;
    --muted: #a3aea6;
    --line: #313a34;
    --accent: #8fcaa8;
    --accent-fg: #0f1a14;
    --accent-soft: #23352a;
    --tick: #6c776f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--step);
  line-height: 1.55;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
#app {
  max-width: 40rem;
  margin: 0 auto;
  padding-block: 20px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0; }

/* ---------- Home ---------- */
.home { display: grid; gap: 20px; }
.home-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.book-title { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.01em; }
.count { margin: 0; color: var(--muted); font-size: 0.95rem; }

.controls { display: grid; gap: 12px; }
.search {
  width: 100%;
  min-height: 52px;
  font: inherit;
  font-size: 1.1rem;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--fg);
}
.search:focus { border-color: var(--accent); outline: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 44px;
  padding: 0 16px;
  font: inherit;
  font-size: 1rem;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 700; }

.results { display: grid; gap: 10px; }
.card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  min-height: 104px;
}
.card:active { background: var(--accent-soft); }
.thumb { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; }
.card-text { display: grid; gap: 2px; min-width: 0; }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; line-height: 1.2; }
.card-meta { color: var(--muted); font-size: 0.95rem; }
.empty { margin: 8px 0; color: var(--muted); }

.placeholder {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  font-size: 2.2rem;
  line-height: 1;
}

/* ---------- Recipe ---------- */
.recipe { display: grid; gap: 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  text-decoration: none;
}
.awake {
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--fg);
}
.hero { width: 100%; aspect-ratio: 4 / 3; max-width: 100%; object-fit: cover; border-radius: 18px; }
.hero.placeholder { aspect-ratio: 5 / 2; font-size: 3.5rem; }
.recipe-head { display: grid; gap: 6px; }
.recipe-head h1 { font-size: 2rem; }
.meta { margin: 0; color: var(--muted); }

section { display: grid; gap: 10px; }
section h2 { font-size: 1.4rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.clear {
  min-height: 44px;
  padding: 0 14px;
  font: inherit;
  font-size: 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}
.ingredients h3 { font-size: 1.05rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 6px; }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; }
.checklist li { display: flex; gap: 14px; align-items: flex-start; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist input {
  flex: none;
  width: 26px;
  height: 26px;
  margin: 13px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.checklist label { flex: 1; min-width: 0; padding: 10px 0; cursor: pointer; min-height: 52px; }
.qty { font-weight: 700; white-space: nowrap; }
.checklist input:checked + label { color: var(--tick); text-decoration: line-through; text-decoration-thickness: 2px; }

.plain { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 18px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); gap: 12px; }
.steps li::before {
  content: counter(step);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-fg);
}
.notes p { margin: 0; color: var(--muted); }

.message { display: grid; gap: 12px; padding-block: 24px; }
.message h1 { font-size: 1.6rem; }
.message p { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  .card, .chip { transition: background-color 120ms ease, border-color 120ms ease; }
}
