/* Day of Meals — minimalist recipe UI
   Design tokens, then components. System fonts, no external requests. */
:root {
  --bg: #ffffff;
  --surface: #faf8f5;
  --surface-2: #f2efe9;
  --ink: #1f1d1a;
  --ink-soft: #5c574f;
  --muted: #8a8479;
  --line: #e7e2d9;
  --accent: #c2410c;      /* warm terracotta */
  --accent-soft: #fbeae0;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
  --wrap: 1140px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.lead { font-size: 1.1rem; color: var(--ink-soft); max-width: 60ch; }

.skip-link {
  position: absolute; left: -999px;
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.15rem; }
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.3rem; }
.search { display: flex; flex: 1; max-width: 460px; margin-left: auto; }
.search input {
  flex: 1; border: 1px solid var(--line); border-right: 0;
  border-radius: 999px 0 0 999px; padding: 9px 16px; font-size: .95rem; background: var(--surface);
}
.search button {
  border: 0; background: var(--accent); color: #fff; padding: 0 18px;
  border-radius: 0 999px 999px 0; cursor: pointer; font-weight: 600;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.site-nav a { font-weight: 600; color: var(--ink-soft); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 32px 0; background: var(--surface); }
.site-footer p { margin: 4px 0; }

/* Hero */
.hero { background: linear-gradient(180deg, var(--accent-soft), var(--bg)); padding: 64px 0 48px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); margin: 0 0 12px; }
.hero-lead { color: var(--ink-soft); font-size: 1.15rem; margin: 0 auto 28px; max-width: 46ch; }
.hero-search { display: flex; max-width: 540px; margin: 0 auto; box-shadow: var(--shadow); border-radius: 999px; }
.hero-search input { flex: 1; border: 1px solid var(--line); border-right: 0; border-radius: 999px 0 0 999px; padding: 15px 22px; font-size: 1rem; }
.hero-search button { border: 0; background: var(--accent); color: #fff; padding: 0 28px; border-radius: 0 999px 999px 0; font-weight: 700; cursor: pointer; }

/* Sections */
.section { padding: 40px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.section-head h2 { font-size: 1.4rem; margin: 0; }
.section-head a { color: var(--accent); font-weight: 600; font-size: .95rem; }

/* Category tiles */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.cat-tile { display: flex; flex-direction: column; gap: 4px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: transform .12s, box-shadow .12s; }
.cat-tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.cat-name { font-weight: 700; }
.cat-count { color: var(--muted); font-size: .85rem; }

/* Chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip, .chip-lg {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 15px; font-weight: 600; color: var(--ink-soft);
}
.chip-lg { padding: 12px 20px; font-size: 1.02rem; color: var(--ink); }
.chip:hover, .chip-lg:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.chip span, .chip-lg span { color: var(--muted); font-weight: 500; font-size: .85em; }

/* Recipe grid + cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .12s, box-shadow .12s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-media { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media--empty { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 2.4rem; opacity: .5; }
.card-fav { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.92); color: var(--accent); border-radius: 999px; width: 30px; height: 30px; display: grid; place-items: center; font-size: .95rem; box-shadow: var(--shadow); }
.card-body { padding: 14px 15px 17px; }
.card-eyebrow { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.card-title { font-size: 1.02rem; margin: 5px 0 8px; }
.card-title a:hover { text-decoration: none; color: var(--accent); }
.card-meta { font-size: .84rem; color: var(--muted); margin: 0 0 10px; display: flex; gap: 6px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }

.pill { display: inline-block; font-size: .74rem; font-weight: 600; background: var(--surface-2); color: var(--ink-soft); border-radius: 999px; padding: 3px 9px; }
.pill--diet { background: var(--accent-soft); color: var(--accent); }
.pill--on, .ingredient-cloud .pill.pill--on { background: var(--accent); color: #fff; }

/* Listing layout */
.listing { padding: 32px 0 0; }
.listing-head h1 { font-size: 2rem; margin: 0 0 6px; }
.listing-body { display: grid; grid-template-columns: 250px 1fr; gap: 34px; margin-top: 22px; align-items: start; }

.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.pill--remove { background: var(--accent-soft); color: var(--accent); cursor: pointer; padding: 5px 11px; font-size: .8rem; }
.pill--remove:hover { text-decoration: none; background: var(--accent); color: #fff; }
.pill--clear { background: transparent; color: var(--muted); text-decoration: underline; padding: 5px 4px; }

/* Filters sidebar */
.filters { position: sticky; top: 84px; }
.filters-search { display: flex; margin-bottom: 18px; }
.filters-search input { flex: 1; border: 1px solid var(--line); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding: 9px 12px; }
.filters-search button { border: 0; background: var(--ink); color: #fff; padding: 0 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; cursor: pointer; }
.facet { border-bottom: 1px solid var(--line); padding: 12px 0; }
.facet summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.facet summary::after { content: "＋"; color: var(--muted); }
.facet[open] summary::after { content: "－"; }
.facet ul { list-style: none; margin: 12px 0 4px; padding: 0; max-height: 260px; overflow: auto; }
.facet li a { display: flex; justify-content: space-between; padding: 5px 8px; border-radius: 7px; color: var(--ink-soft); font-size: .92rem; }
.facet li a:hover { background: var(--surface); text-decoration: none; }
.facet li a.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.facet li a span { color: var(--muted); font-weight: 500; }
.ingredient-cloud { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.ingredient-cloud .pill { cursor: pointer; }
.ingredient-cloud .pill:hover { text-decoration: none; background: var(--accent-soft); color: var(--accent); }

/* Results */
.results-bar { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.results-bar select { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px; background: var(--bg); font: inherit; }
.empty { padding: 60px 0; text-align: center; color: var(--muted); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 40px 0 8px; }
.pagination a { font-weight: 700; color: var(--accent); }
.pagination .disabled { color: var(--line); }
.page-status { color: var(--muted); font-size: .92rem; }

/* Recipe detail */
.recipe { padding: 28px 0 0; }
.breadcrumb { font-size: .88rem; color: var(--muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--ink-soft); }
.recipe-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 10px; max-width: 20ch; }
.recipe-facts { display: flex; flex-wrap: wrap; gap: 26px; list-style: none; padding: 18px 0; margin: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.recipe-facts li { display: flex; flex-direction: column; font-weight: 700; }
.recipe-facts span { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.recipe-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.recipe-tags .pill { padding: 5px 12px; font-size: .82rem; }
.recipe-hero { margin: 0 0 32px; border-radius: var(--radius); overflow: hidden; }
.recipe-hero img { width: 100%; max-height: 520px; object-fit: cover; }
.recipe-body { display: grid; grid-template-columns: 320px 1fr; gap: 46px; align-items: start; }
.ingredients { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.ingredients h2, .method h2 { font-size: 1.3rem; }
.ingredient-list { list-style: none; padding: 0; margin: 14px 0 0; }
.ingredient-list li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.ingredient-list li:last-child { border-bottom: 0; }
.ingredient-list .amount { font-weight: 700; }
.ingredient-list a { color: var(--ink-soft); }
.steps { padding-left: 20px; margin: 12px 0 30px; }
.steps li { margin-bottom: 16px; padding-left: 6px; }
.steps li::marker { color: var(--accent); font-weight: 700; }

/* Responsive */
@media (max-width: 900px) {
  .listing-body { grid-template-columns: 1fr; }
  .filters { position: static; }
  .recipe-body { grid-template-columns: 1fr; gap: 28px; }
  .ingredients { position: static; }
}
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 12px; }
  .search { max-width: none; order: 3; flex-basis: 100%; }
  .site-nav { margin-left: auto; }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17150f; --surface: #201d16; --surface-2: #2a261d; --ink: #f2ede3;
    --ink-soft: #c3bcae; --muted: #8f887b; --line: #33302a;
    --accent: #f97316; --accent-soft: #3a2414;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.4);
  }
  .site-header { background: rgba(23,21,15,.92); }
  .card-fav { background: rgba(0,0,0,.5); }
}
