:root {
  --bg: #faf8f4; --surface: #ffffff; --text: #23201c; --muted: #6f6860;
  --line: #e4dfd6; --accent: #c2502b; --accent-soft: rgba(194, 80, 43, .18);
  --vegan: #2e7d32; --vegetarian: #7cb342; --gluten-free: #e0a100;
  --dairy-free: #1e88e5; --nut-free: #8d6e63;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171513; --surface: #211e1b; --text: #ede8e1; --muted: #a39b91;
    --line: #36312c; --accent: #e9774f; --accent-soft: rgba(233, 119, 79, .22);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 2rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 1.2rem; }
main { max-width: 1040px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

/* header */
header.site {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1040px; margin: 0 auto; padding: 1rem;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.3rem; text-decoration: none; color: var(--accent); }
header.site nav { display: flex; gap: 1.2rem; }
header.site nav a { text-decoration: none; font-weight: 500; }
header.site nav a:hover { color: var(--accent); }
.plan-count {
  display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 1em;
  background: var(--accent); color: #fff; font-size: .75rem; text-align: center;
}

/* buttons */
button { font: inherit; cursor: pointer; color: inherit; }
button.primary {
  background: var(--accent); color: #fff; border: 0; border-radius: var(--radius);
  padding: .65rem 1.1rem; font-weight: 600; margin-top: 1rem;
}
button.ghost { background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: .35rem .7rem; }
.stepper { display: inline-flex; align-items: center; gap: .5rem; }
.stepper button {
  width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); line-height: 1;
}
select {
  font: inherit; padding: .45rem .6rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--text); flex: 1;
}

/* diet badges: standard menu-style circles */
.badges { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
abbr.diet {
  display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem;
  border-radius: 50%; color: #fff; font-size: .68rem; font-weight: 800;
  text-decoration: none; letter-spacing: -.02em; cursor: help; flex: none;
}
.diet-vegan { background: var(--vegan); }
.diet-vegetarian { background: var(--vegetarian); }
.diet-gluten-free { background: var(--gluten-free); }
.diet-dairy-free { background: var(--dairy-free); }
.diet-nut-free { background: var(--nut-free); }

.meta { color: var(--muted); font-size: .9rem; margin: 0 0 .4rem; }
.empty { color: var(--muted); }

/* filters */
.filters { display: grid; gap: .5rem; margin-bottom: 1.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: .3rem .8rem; font-size: .9rem;
}
.chip abbr.diet { width: 1.3rem; height: 1.3rem; font-size: .55rem; }
.chip.active { border-color: var(--accent); background: var(--accent-soft); }

/* cards */
.cards {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.card a {
  display: flex; flex-direction: column; height: 100%; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: border-color .15s;
}
.card a:hover { border-color: var(--accent); }
.card .spider { background: var(--bg); padding: .6rem; height: 150px; }
.card-body { padding: .8rem 1rem 1rem; }
.card h2 { font-size: 1.05rem; margin-bottom: .2rem; }

/* spider chart */
.spider { width: 100%; display: block; }
.spider .grid { fill: none; stroke: var(--line); stroke-width: 1; }
.spider .axis { stroke: var(--line); stroke-width: 1; }
.spider .shape { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.spider .dot { fill: var(--accent); }
.spider.mini .dot { r: 2.5; }
.spider text { fill: var(--muted); font-size: 11px; }
.spider .score { fill: var(--text); font-weight: 700; }

/* recipe page */
.recipe header { margin-bottom: 1.5rem; }
.lede { font-size: 1.1rem; color: var(--muted); margin: 0 0 .8rem; }
.recipe-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr 1fr; align-items: start; }
.ingredients, .flavor, .method, .plan-grid > section {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem;
}
.flavor { margin: 0; }
.flavor figcaption { text-align: center; color: var(--muted); font-size: .85rem; }
.servings { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.ingredients ul { padding-left: 1.1rem; margin: .8rem 0 0; }
.ingredients li { margin: .25rem 0; }
.ingredients .qty { font-weight: 600; }
.ingredients small { color: var(--muted); }
.method { margin-top: 1.5rem; }
.method ol { padding-left: 1.3rem; }
.method li { margin: .5rem 0; }

/* meal plan */
.plan-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr 1fr; align-items: start; }
.row { display: flex; gap: .6rem; align-items: center; justify-content: space-between; }
.plan-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.plan-list li {
  display: flex; align-items: center; gap: .8rem; padding: .6rem 0;
  border-bottom: 1px solid var(--line);
}
.plan-list li a { flex: 1; font-weight: 600; text-decoration: none; }
.plan-list li a:hover { color: var(--accent); }
.shopping ul { list-style: none; padding: 0; margin: 0; }
.shopping li { padding: .2rem 0; }
.shopping label { display: flex; gap: .5rem; align-items: baseline; cursor: pointer; }
.shopping input:checked + span { text-decoration: line-through; color: var(--muted); }

.terms { list-style: none; padding: 0; }

@media (max-width: 720px) {
  .recipe-grid, .plan-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.6rem; }
}
@media print {
  header.site, .filters, button, select { display: none !important; }
  .plan-grid { grid-template-columns: 1fr; }
}
