/* Playfair's "&" is a decorative squiggle; this face swaps in a plain one for "&" only (unicode-range) */
@font-face { font-family: "Plain Amp"; src: local("Georgia Bold"), local("Georgia-Bold"), local("Times New Roman Bold"), local("TimesNewRomanPS-BoldMT"), local("Noto Serif Bold"), local("NotoSerif-Bold"), local("DroidSerif-Bold"); font-weight: 600 900; unicode-range: U+0026; }
@font-face { font-family: "Plain Amp"; src: local("Georgia"), local("Times New Roman"), local("Noto Serif"), local("NotoSerif-Regular"), local("DroidSerif"); font-weight: 100 500; unicode-range: U+0026; }
/* Smart Kitchen: a calm, editorial recipe app.
   White page, serif headings, system sans for everything you read quickly,
   one tomato-red accent for links and the selected state. Lists are divided by rules, not boxed. */
:root {
  /* same palette as the shop (cookingforyou.app): cream page, forest green, terracotta accent */
  --bg: #faf6ee;
  --card: #fffdf8;
  --ink: #2a2a26;
  --muted: #6b6a65;
  --rule: #ebe2cf;
  --rule-strong: #e2d3b3;
  --forest: #1f4a37;
  --forest-dark: #163628;
  --sage: #e6eee2;
  --gold: #f2c14e;
  --accent: #a8461f;
  --accent-tint: #f7ebe3;
  --warn-bg: #fbf2cf;
  --warn-ink: #5b4500;
  --serif: "Plain Amp", "Playfair Display", "Iowan Old Style", "Georgia", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-underline-offset: 2px; }
button, input, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  max-width: 980px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  background: var(--bg); border-bottom: 1px solid var(--rule);
}
.brand { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; color: var(--forest); text-decoration: none; letter-spacing: -.01em; }
.link-btn { background: none; border: 0; padding: 8px 0; color: var(--muted); cursor: pointer; font-size: .875rem; }
.link-btn:hover { color: var(--ink); }

main { max-width: 980px; margin: 0 auto; padding: 24px 20px 32px; outline: none; }
main:focus, main:focus-visible { outline: none; } /* main gets focus after each screen change (for screen readers); no visible ring */
h1 { font-family: var(--serif); font-weight: 600; font-size: 2.125rem; line-height: 1.12; letter-spacing: -.015em; margin: 4px 0 8px; text-wrap: balance; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 1.25rem; line-height: 1.3; margin: 36px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hint { color: var(--muted); font-size: .875rem; margin: -4px 0 10px; }
.loading { color: var(--muted); }

.btn { border: 0; border-radius: 3px; padding: 12px 18px; font-weight: 600; cursor: pointer; min-height: 46px; transition: opacity .15s; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--forest); color: var(--bg); width: 100%; border-radius: 999px; }
.btn-secondary { background: var(--forest); color: var(--bg); border-radius: 999px; }
.btn-ghost { background: none; color: var(--ink); border: 1px solid var(--rule-strong); width: 100%; }

/* ---------- sign in ---------- */
.login-card { max-width: 420px; margin: 8vh 0 0; display: grid; gap: 10px; }
.login-card h1 { margin-bottom: 0; }
.login-card > p:first-of-type { margin: 0 0 12px; color: var(--muted); }
.login-card label { font-weight: 600; font-size: .9375rem; }
input[type=email], input[type=search], textarea {
  width: 100%; border: 1px solid var(--rule-strong); background: var(--bg); border-radius: 3px; padding: 11px 12px;
  font-size: 16px; /* stops iOS zoom */
}
input:focus, textarea:focus { border-color: var(--ink); outline: none; }
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-msg { min-height: 1.5em; margin: 0; color: var(--muted); }

/* ---------- goals: quiet checkboxes ---------- */
.goals { border: 0; padding: 0; margin: 0 0 20px; }
.goals legend { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; padding: 0; margin-bottom: 10px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 0;
  background: none; border: 0; cursor: pointer; font-size: .9375rem; color: var(--ink);
}
.chip::before {
  content: ""; flex: none; width: 16px; height: 16px; border: 1.5px solid var(--rule-strong); border-radius: 2px;
  background: var(--bg) center / 11px no-repeat; transition: background-color .12s, border-color .12s;
}
.chip[aria-pressed="true"]::before {
  background-color: var(--accent); border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.2 4.8 9 10 3' fill='none' stroke='white' stroke-width='1.8'/%3E%3C/svg%3E");
}

/* ---------- chapter tabs: text with an underline ---------- */
.tabs { display: flex; gap: 22px; overflow-x: auto; margin: 0 -20px 16px; padding: 0 20px; border-bottom: 1px solid var(--rule); scrollbar-width: none; overscroll-behavior-x: contain; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 10px 0; margin-bottom: -1px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer; white-space: nowrap; font-size: .9375rem; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.search { margin-bottom: 8px; }

/* ---------- recipe list ---------- */
.recipe-list { list-style: none; padding: 0; margin: 0; }
.recipe-list > li { border-bottom: 1px solid var(--rule); }
.recipe-card { display: grid; gap: 3px; padding: 18px 0; color: var(--ink); text-decoration: none; }
.recipe-card:hover .card-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.recipe-card.has-photo { grid-template-columns: 1fr 112px; column-gap: 16px; }
.recipe-card.has-photo > :not(.card-photo) { grid-column: 1; }
.card-photo { grid-column: 2; grid-row: 1 / span 6; width: 112px; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 2px; align-self: start; }
.card-chapter { font-size: .8125rem; color: var(--muted); margin: 0; }
.card-title { font-family: var(--serif); font-size: 1.3125rem; font-weight: 600; line-height: 1.25; }
.card-replaces { color: var(--muted); font-size: .9375rem; margin: 0; }
.card-time { font-size: .8125rem; color: var(--muted); }
.match { font-size: .8125rem; color: var(--accent); }
.empty { color: var(--muted); padding: 24px 0; }
.nutri { list-style: none; display: flex; gap: 18px; padding: 0; margin: 4px 0 0; font-size: .875rem; color: var(--muted); }
.nutri b { color: var(--ink); font-weight: 600; }

/* ---------- recipe page ---------- */
.recipe { max-width: 640px; }
.back { display: inline-block; padding: 4px 0 12px; font-size: .875rem; text-decoration: none; }
.back:hover { text-decoration: underline; }
.recipe-photo { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; margin: 0 0 20px; border-radius: 2px; background: var(--rule); }
.moment { font-family: var(--serif); font-style: italic; font-size: 1.125rem; color: var(--muted); margin: 0 0 14px; }
.recipe .card-replaces { margin-bottom: 14px; }
.meta { display: flex; gap: 28px; margin: 0; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.meta div { display: grid; }
.meta dt { font-size: .8125rem; color: var(--muted); }
.meta dd { margin: 0; font-weight: 600; }
.recipe .nutri { margin-top: 12px; }

.diet { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 4px; }
.diet-tag { display: grid; grid-template-columns: 7.5em auto 1fr; gap: 0 12px; font-size: .875rem; align-items: baseline; }
.diet-name { font-weight: 600; }
.diet-status { color: var(--muted); }
.diet-no .diet-status { color: var(--accent); }
.diet-fix { color: var(--muted); }
@media (max-width: 520px) { .diet-tag { grid-template-columns: 7.5em 1fr; } .diet-fix { grid-column: 2; } }

.ingredients { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.ingredients > li { border-bottom: 1px solid var(--rule); }
.ing-btn {
  width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; text-align: left;
  background: none; border: 0; padding: 12px 0; cursor: pointer; min-height: 46px;
}
.swap-hint { flex: none; font-size: .8125rem; font-weight: 600; color: var(--accent); }
@media (hover: hover) { .ing-btn:hover .swap-hint { text-decoration: underline; text-underline-offset: 2px; } }
.ing-plain { display: block; padding: 12px 0; }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 18px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2rem 1fr; line-height: 1.6; }
.steps li::before { content: counter(step); font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--accent); line-height: 1.3; }

.why { margin-top: 32px; padding-left: 16px; border-left: 2px solid var(--rule-strong); }
.why h2 { margin-top: 0; font-size: 1rem; }
.why p { margin: 0; font-family: var(--serif); font-size: 1.0625rem; line-height: 1.6; }

.tips ul { padding-left: 1.1em; margin: 0; display: grid; gap: 6px; }
.tips li::marker { color: var(--muted); }

.ask { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--rule-strong); display: grid; gap: 10px; }
.ask label { font-family: var(--serif); font-size: 1.125rem; font-weight: 600; }
.ask .btn { justify-self: start; }
.ask-answer { white-space: pre-wrap; min-height: 1em; }
.ask-answer:not(:empty) { padding: 12px 0 4px; }

.storage { margin-top: 40px; padding-top: 4px; border-top: 1px solid var(--rule-strong); }
.storage h2 { margin-top: 16px; }
.storage dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
.storage dt { color: var(--muted); }
.storage dd { margin: 0; }

/* ---------- nav + library ---------- */
.topnav { display: flex; align-items: center; gap: 18px; font-size: .875rem; }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--ink); }
.library { list-style: none; padding: 0; margin: 20px 0 0; border-top: 1px solid var(--rule-strong); }
.library-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.library-title { font-family: var(--serif); font-size: 1.125rem; font-weight: 600; }
.library-get { flex: none; font-weight: 600; font-size: .9375rem; }
.library-next { margin-top: 24px; }
.upsell { margin-top: 40px; padding: 20px; border: 1px solid var(--rule-strong); border-radius: 4px; }
.upsell h2 { margin-top: 0; }
.upsell p { margin: 0 0 14px; max-width: 38em; }
.upsell-link { display: inline-flex; align-items: center; text-decoration: none; }

/* ---------- footer ---------- */
.site-foot { max-width: 980px; margin: 32px auto 0; padding: 16px 20px calc(28px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); color: var(--muted); font-size: .8125rem; }
.site-foot p { margin: 0 0 8px; max-width: 46em; }
.site-foot ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-foot a { color: var(--muted); }

/* ---------- swap sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .32); opacity: 0; transition: opacity .2s; z-index: 20; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 85vh; overflow-y: auto; overscroll-behavior: contain;
  max-width: 640px; margin: 0 auto; padding: 8px 20px calc(18px + env(safe-area-inset-bottom));
  background: var(--bg); border-radius: 10px 10px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .12);
  transform: translateY(100%); transition: transform .26s var(--ease);
}
.sheet.open { transform: translateY(0); }
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--rule-strong); margin: 0 auto 8px; }
.sheet-title { margin: 8px 0 4px; font-size: 1.375rem; }
.swap-list { list-style: none; padding: 0; margin: 0 0 16px; }
.swap { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.swap p { margin: 0 0 4px; }
.swap-name { font-weight: 600; font-size: 1.0625rem; }
.swap-adds, .swap-costs { display: grid; grid-template-columns: 7.5em 1fr; gap: 12px; font-size: .9375rem; }
.tag { font-size: .8125rem; font-weight: 600; }
.tag-good { color: var(--ink); }
.tag-cost { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- My library (cards + covers) ---------- */
.library-page { padding-bottom: 8px; }
.lib-head h1 { color: var(--forest); }
.lib-thanks { margin: 18px 0 4px; padding: 16px 18px; background: var(--sage); border: 1px solid #cfe0cb; border-radius: 14px; }
.lib-thanks p { margin: 0; }
.lib-thanks-title { font-family: var(--serif); font-weight: 700; font-size: 1.25rem; color: var(--forest); margin-bottom: 4px !important; }
.lib-main {
  display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: center;
  margin-top: 22px; padding: 22px; background: var(--card); border: 1px solid var(--rule-strong); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 14px 30px -22px rgba(31,74,55,.45);
}
.lib-cover { display: block; width: 100%; height: auto; border-radius: 6px; box-shadow: 0 10px 22px -8px rgba(0,0,0,.35); }
.lib-main-body { min-width: 0; }
.lib-main-body .muted { margin: 0 0 16px; }
.lib-kicker { margin: 0 0 4px; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.lib-title { margin: 0 0 6px; font-size: 1.75rem; line-height: 1.15; color: var(--forest); }
.btn.lib-btn, .btn.lib-btn-light {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border-radius: 999px; padding: 13px 24px;
}
.btn.lib-btn { background: var(--forest); color: var(--bg); }
.btn.lib-btn:hover { background: var(--forest-dark); }
.lib-kitchen {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 22px;
  background: var(--forest); color: var(--bg); border-radius: 18px;
}
.lib-kitchen h2 { margin: 0 0 4px; color: var(--bg); font-size: 1.25rem; }
.lib-kitchen p { margin: 0; color: #d9e4dc; max-width: 34em; }
.btn.lib-btn-light { flex: none; background: var(--gold); color: var(--forest-dark); }
.lib-minis h2 { color: var(--forest); margin-top: 34px; }
.lib-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.lib-card-link {
  display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 10px 10px 14px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--rule-strong); border-radius: 14px; transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.lib-card-link:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -16px rgba(31,74,55,.55); }
.lib-card-cover { display: block; width: 100%; height: auto; border-radius: 6px; margin-bottom: 6px; background: var(--sage); }
.lib-card-title { font-family: var(--serif); font-weight: 700; font-size: 1rem; line-height: 1.25; color: var(--forest); }
.lib-card-sub { font-size: .8125rem; line-height: 1.4; color: var(--muted); }
.lib-card-get { margin-top: auto; padding-top: 8px; font-size: .875rem; font-weight: 700; color: var(--accent); }
.lib-help { margin-top: 32px; font-size: .875rem; }
@media (max-width: 640px) {
  .lib-main { grid-template-columns: 112px 1fr; gap: 16px; padding: 16px; }
  .lib-title { font-size: 1.375rem; }
  .lib-kitchen { flex-direction: column; align-items: stretch; }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (prefers-reduced-motion: reduce) { .lib-card-link { transition: none; } .lib-card-link:hover { transform: none; } }
.lib-card.library-item { display: block; padding: 0; border: 0; }

/* ---------- Smart Kitchen home: hero, pill goals + tabs, recipe cards ---------- */
.kitchen-hero {
  margin: 4px 0 22px; padding: 26px 24px 24px; border-radius: 20px; color: var(--bg);
  background: radial-gradient(120% 140% at 100% 0%, #2d6a4f 0%, var(--forest) 55%, var(--forest-dark) 100%);
}
.hero-kicker { margin: 0 0 6px; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.kitchen-hero h1 { color: var(--bg); margin: 0 0 6px; font-size: 2rem; }
.hero-sub { margin: 0 0 16px; color: #d9e4dc; }
.kitchen-hero .search {
  width: 100%; margin: 0; padding: 14px 18px 14px 44px; border: 0; border-radius: 999px; background: var(--card); color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%236b6a65' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='M12.5 12.5 17 17'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 16px 50%; box-shadow: 0 6px 18px -10px rgba(0,0,0,.5);
}
.kitchen-hero .search:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.goals legend { font-family: var(--sans); font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.chip-row { gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; border-radius: 999px; min-height: 40px;
  background: var(--card); border: 1px solid var(--rule-strong); color: var(--ink); font-size: .9375rem; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chip::before { content: "+"; width: auto; height: auto; border: 0; background: none; font-weight: 700; color: var(--forest); }
.chip:hover { border-color: var(--forest); }
.chip[aria-pressed="true"] { background: var(--forest); border-color: var(--forest); color: var(--bg); }
.chip[aria-pressed="true"]::before { content: "\2713"; color: var(--gold); background: none; border: 0; box-shadow: none; }

.tabs { gap: 8px; border-bottom: 0; margin-bottom: 18px; padding-bottom: 2px; }
.tab { padding: 8px 14px; border: 1px solid transparent; border-radius: 999px; margin: 0; color: var(--muted); font-weight: 500; }
.tab:hover { color: var(--forest); background: var(--sage); }
.tab[aria-selected="true"] { color: var(--bg); background: var(--forest); border-bottom-color: transparent; }

.list-count { margin: 0 0 12px; font-size: .875rem; color: var(--muted); }
.recipe-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.recipe-list > li { border: 0; min-width: 0; }
.recipe-list > li.empty { grid-column: 1 / -1; color: var(--muted); }
.recipe-card {
  --chip: var(--forest); display: flex; flex-direction: column; gap: 0; height: 100%; padding: 0; overflow: hidden;
  background: var(--card); border: 1px solid var(--rule-strong); border-radius: 16px; border-top: 5px solid var(--chip);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.recipe-card:hover { transform: translateY(-2px); box-shadow: 0 14px 26px -18px rgba(31,74,55,.6); }
.recipe-card:hover .card-title { text-decoration: none; }
.recipe-card.has-photo { display: flex; border-top-width: 1px; }
.recipe-card .card-photo { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 0; grid-row: auto; }
.card-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; flex: 1; }
.recipe-card .card-chapter { font-size: .6875rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--chip); }
.recipe-card .card-title { font-size: 1.1875rem; line-height: 1.25; color: var(--forest); }
.recipe-card .card-replaces { font-size: .875rem; }
.recipe-card .nutri { flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; font-size: .8125rem; }
.recipe-card .nutri li { padding: 3px 9px; border-radius: 999px; background: var(--sage); color: var(--forest); }
.recipe-card .nutri li:nth-child(2) { background: #e8eef7; color: #2b4a73; }
.recipe-card .nutri li:nth-child(3) { background: #fbf0d6; color: #7a5a12; }
.recipe-card .nutri b { color: inherit; font-weight: 700; }
.recipe-card .match { font-weight: 600; }
.recipe-card .card-time { margin-top: auto; padding-top: 8px; font-size: .8125rem; color: var(--muted); }
.ch-store_swaps { --chip: #a8461f; }
.ch-breakfast_snacks { --chip: #b8860b; }
.ch-mains { --chip: #1f4a37; }
.ch-soups_sides { --chip: #4f7a3a; }
.ch-desserts { --chip: #8a3b5c; }
.ch-holiday { --chip: #b3261e; }
@media (max-width: 640px) {
  .kitchen-hero { padding: 22px 18px 18px; border-radius: 16px; }
  .kitchen-hero h1 { font-size: 1.625rem; }
  .recipe-list { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .recipe-card { transition: none; } .recipe-card:hover { transform: none; } }
.topnav { white-space: nowrap; }
.topnav a, .topnav .link-btn { white-space: nowrap; }
@media (max-width: 480px) {
  .brand { font-size: 1.0625rem; white-space: nowrap; }
  .topnav { gap: 12px; font-size: .8125rem; }
  .topbar { gap: 10px; }
}

/* ---------- recipe page as a cookbook page ---------- */
.recipe.recipe-book { max-width: none; --chip: var(--forest); }
.book-page {
  position: relative; background: var(--card); border: 1px solid var(--rule-strong); border-top: 6px solid var(--chip);
  border-radius: 18px; padding: 28px 32px 30px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 22px 40px -30px rgba(31,74,55,.55);
}
.book-page .recipe-photo { display: block; width: calc(100% + 64px); max-width: none; margin: -28px -32px 22px; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 0; }
.rb-head { text-align: center; padding-bottom: 18px; border-bottom: 1px dashed var(--rule-strong); }
.rb-head .card-chapter { font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--chip); margin-bottom: 6px; }
.rb-head h1 { color: var(--forest); font-size: 2.375rem; margin: 0 0 6px; }
.rb-head .moment { margin: 0 0 4px; color: var(--accent); }
.rb-head .card-replaces { margin: 0; }
.rb-facts { display: grid; grid-template-columns: auto 1fr; gap: 14px 28px; align-items: start; padding: 18px 0 20px; border-bottom: 1px dashed var(--rule-strong); }
.rb-facts .meta { border: 0; padding: 0; gap: 10px; }
.rb-facts .meta div { padding: 8px 14px; background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; text-align: center; min-width: 76px; }
.rb-facts .meta dt { font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.rb-facts .meta dd { font-family: var(--serif); font-size: 1.125rem; color: var(--forest); }
.rb-label { margin: 0 0 6px; font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.rb-per .nutri { margin: 0; flex-wrap: wrap; gap: 6px; font-size: .8125rem; }
.rb-per .nutri li { padding: 3px 10px; border-radius: 999px; background: var(--sage); color: var(--forest); }
.rb-per .nutri li:nth-child(2) { background: #e8eef7; color: #2b4a73; }
.rb-per .nutri li:nth-child(3) { background: #fbf0d6; color: #7a5a12; }
.rb-per .nutri b { color: inherit; }
.rb-facts .diet { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.rb-facts .diet-tag { display: inline-flex; gap: 6px; align-items: baseline; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--rule-strong); background: var(--bg); font-size: .8125rem; }
.rb-facts .diet-ok { border-color: #cfe0cb; background: var(--sage); }
.rb-facts .diet-ok .diet-status { color: var(--forest); }
.rb-facts .diet-fix { flex-basis: 100%; font-size: .75rem; }
.rb-cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 34px; margin-top: 6px; }
.rb-cols h2 { font-family: var(--serif); color: var(--forest); font-size: 1.375rem; margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--gold); display: inline-block; }
.rb-ings .ingredients { border-top: 0; }
.rb-ings .ingredients > li { border-bottom: 1px dotted var(--rule-strong); }
.rb-ings .swap-hint { padding: 2px 9px; border-radius: 999px; background: var(--accent-tint); color: var(--accent); font-size: .75rem; font-weight: 700; }
.rb-steps .steps { gap: 16px; }
.rb-steps .steps li { grid-template-columns: 2.25rem 1fr; }
.rb-steps .steps li::before {
  width: 1.75rem; height: 1.75rem; display: grid; place-items: center; border-radius: 50%; background: var(--forest); color: var(--bg);
  font-family: var(--sans); font-size: .8125rem; font-weight: 700; line-height: 1;
}
.book-page .why { margin-top: 26px; padding: 16px 18px; border: 0; border-left: 4px solid var(--gold); background: #fdf6e3; border-radius: 0 12px 12px 0; }
.book-page .why h2 { color: var(--forest); }
.rb-tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 22px; }
.rb-tips:empty { display: none; }
.rb-tips .tips { margin: 0; padding: 14px 16px; background: var(--bg); border: 1px solid var(--rule); border-radius: 14px; }
.rb-tips .tips h2 { margin: 0 0 8px; font-size: 1rem; color: var(--forest); }
.book-page .ask { margin-top: 26px; padding: 18px; border: 1px solid var(--rule-strong); border-radius: 14px; background: var(--bg); }
.book-page .storage { margin-top: 26px; padding-top: 2px; border-top: 1px dashed var(--rule-strong); }
.book-page .storage h2 { color: var(--forest); }
@media (max-width: 720px) {
  .book-page { padding: 22px 18px 24px; border-radius: 14px; }
  .book-page .recipe-photo { width: calc(100% + 36px); margin: -22px -18px 18px; }
  .rb-head h1 { font-size: 1.875rem; }
  .rb-facts { grid-template-columns: 1fr; }
  .rb-cols { grid-template-columns: 1fr; gap: 0; }
}
.recipe-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.library-page { max-width: 820px; margin: 0 auto; }

/* every card gets a picture area: the photo, or a chapter-coloured panel (no empty gaps in mixed rows) */
.recipe-card, .recipe-card.has-photo { border-top-width: 1px; }
.card-ph {
  display: grid; place-items: center; aspect-ratio: 16 / 10; padding: 18px; text-align: center;
  background:
    radial-gradient(circle at 18% 22%, color-mix(in srgb, var(--chip) 16%, transparent) 0 14px, transparent 15px),
    radial-gradient(circle at 82% 30%, color-mix(in srgb, var(--chip) 10%, transparent) 0 22px, transparent 23px),
    radial-gradient(circle at 30% 85%, color-mix(in srgb, var(--chip) 10%, transparent) 0 18px, transparent 19px),
    radial-gradient(circle at 75% 80%, color-mix(in srgb, var(--chip) 16%, transparent) 0 10px, transparent 11px),
    color-mix(in srgb, var(--chip) 9%, var(--card));
}
.card-ph-text { font-family: var(--serif); font-weight: 700; font-size: 4.5rem; line-height: 1; color: var(--chip); opacity: .55; }
