:root {
  --bg: #fbf7f1;
  --paper: #ffffff;
  --ink: #2d241e;
  --muted: #6f625a;
  --line: #ecdfd2;
  --accent: #b5532a;
  --accent-dark: #8f3f1e;
  --accent-soft: #fbeadf;
  --warn-bg: #fff4dc;
  --warn-line: #f0c869;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--font); }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 18px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.site-header .wrap { padding-top: 14px; padding-bottom: 14px; }
.brand { font: 700 1.25rem/1 var(--serif); color: var(--ink); text-decoration: none; }
.brand-mark { margin-right: 4px; }
.site-footer { margin-top: 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.site-footer .wrap { padding-top: 18px; padding-bottom: 30px; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; font-family: var(--font); font-weight: 700; color: var(--accent-dark); margin-top: 1em; }

/* Home */
.hero { padding: 36px 0 12px; }
.hero p { color: var(--muted); margin: 0; }
.search input {
  width: 100%; margin-top: 14px; padding: 14px 16px; font: inherit; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 999px; outline: none;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.chip {
  font: 600 .88rem/1 var(--font); padding: 8px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
.chip .count { color: var(--muted); font-weight: 500; margin-left: 2px; }
.chip:hover { border-color: var(--accent); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.is-active .count { color: #fde5d7; }
.result-count { color: var(--muted); font-size: .9rem; margin: 8px 0; }
.recipe-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.recipe-card a {
  display: block; height: 100%; padding: 18px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: transform .12s, border-color .12s;
}
.recipe-card a:hover { transform: translateY(-2px); border-color: var(--accent); }
.recipe-card h3 { font: 700 1.2rem/1.25 var(--serif); color: var(--ink); margin: 0 0 6px; }
.recipe-card p { margin: 0 0 10px; color: var(--muted); font-size: .95rem; }
.card-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.empty { color: var(--muted); text-align: center; padding: 24px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .78rem; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); text-decoration: none; }
a.tag:hover { background: var(--accent); color: #fff; }

/* Recipe page */
.crumbs { padding: 18px 0 4px; font-size: .95rem; }
.crumbs a { text-decoration: none; }
.recipe-head { padding: 8px 0 16px; }
.summary { font-size: 1.1rem; color: var(--muted); margin: 0 0 14px; }
.credit {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 10px 16px;
  background: var(--accent); color: #fff; border-radius: 12px; text-decoration: none; box-shadow: var(--shadow);
}
.credit:hover { background: var(--accent-dark); color: #fff; }
.credit-label { font-size: .85rem; opacity: .9; }
.credit-name { font-weight: 700; }
.photo-placeholder {
  margin: 0 0 18px; padding: 26px 18px; text-align: center; border-radius: var(--radius);
  border: 1.5px dashed #e2c9b3; background: linear-gradient(135deg, #fff6ec, #fbeadf);
}
.photo-art svg { max-width: 100%; height: auto; }
.photo-placeholder figcaption { margin-top: 8px; color: var(--muted); font-size: .95rem; }
.photo-placeholder figcaption a { font-weight: 600; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card > h2:first-child { margin-top: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.fact dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fact dd { margin: 2px 0 0; font-weight: 600; }
.headsup { background: var(--warn-bg); border-color: var(--warn-line); }
.flags { margin: 0; padding-left: 1.2em; }
.flags li { margin: 6px 0; }
.flag-high { font-weight: 700; }
.flag-low { color: var(--muted); font-size: .95rem; }
.cols { display: grid; gap: 18px; grid-template-columns: 1fr; }
.cols .card { margin-bottom: 0; }
.cols + * { margin-top: 18px; }
@media (min-width: 760px) { .cols { grid-template-columns: 5fr 6fr; align-items: start; } }
.ing-group h3:first-child, .step-group h3:first-child { margin-top: .2em; }
.ingredients { list-style: none; padding: 0; margin: 0 0 8px; }
.ingredients li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.ingredients li:last-child { border-bottom: 0; }
.ing-amt { font-weight: 700; display: inline-block; min-width: 4.2em; }
.ing-note { color: var(--muted); font-size: .9rem; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 8px; }
.steps li { counter-increment: step; position: relative; padding: 4px 0 12px 44px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 2px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; display: grid; place-items: center; font-size: .9rem;
}
.notes { margin: 0; padding-left: 1.2em; }
.notes li { margin: 5px 0; }
.source-card .btn {
  display: inline-block; margin-top: 4px; padding: 10px 16px; border-radius: 10px; background: var(--accent);
  color: #fff; font-weight: 700; text-decoration: none;
}
.source-card .btn:hover { background: var(--accent-dark); }
.added { color: var(--muted); font-size: .85rem; margin: 12px 0 0; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .card { padding: 16px; }
  .credit { width: 100%; justify-content: center; }
}
@media print {
  .site-header, .site-footer, .crumbs, .photo-placeholder, .credit-go { display: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
