/* ==========================================================================
   Protein Plate — stylesheet
   --------------------------------------------------------------------------
   Read top to bottom:

     1. Design tokens (every colour, font and spacing decision, in one place)
     2. Dark mode
     3. Base elements
     4. Shared building blocks (page width, buttons, cards, sections)
     5. Header and navigation
     6. Hero
     7. Planner (targets, diet, allergens, results)
     8. Recipe cards and recipe pages
     9. About page
    10. Footer
    11. Small screens, motion and print

   To change the whole feel of the site, start with the colour values in
   section 1. Everything else uses them.
   ========================================================================== */

/* 1. Design tokens -------------------------------------------------------- */
:root {
  /* Warm paper, deep green, a little chilli. */
  --bg: #fbfaf6;
  --bg-alt: #f3f1e8;
  --surface: #ffffff;
  --surface-2: #fdfcf8;
  --line: #e6e2d5;
  --line-strong: #d3cdb9;
  --ink: #1e241c;
  --muted: #5f685b;
  --faint: #8b9384;

  --accent: #2f6b45;
  --accent-strong: #235335;
  --accent-soft: #e4f0e5;
  /* Text/icon colour that sits on top of --accent. */
  --on-accent: #ffffff;

  --protein: #2f6b45;
  --carb: #c58a2e;
  --fat: #b4553c;

  --good: #2f6b45;
  --bad: #a33a2f;
  --bad-soft: #fbe9e6;

  /* Shape and depth */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 26px;
  --shadow-sm: 0 1px 2px rgba(30, 36, 28, 0.05);
  --shadow: 0 14px 40px -24px rgba(30, 36, 28, 0.4);
  --shadow-lg: 0 30px 70px -40px rgba(30, 36, 28, 0.55);

  /* Type */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Layout */
  --wrap: 1160px;
  --wrap-narrow: 760px;
}

/* 2. Dark mode ------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101411;
    --bg-alt: #171c18;
    --surface: #1b211c;
    --surface-2: #202720;
    --line: #2d352e;
    --line-strong: #424d43;
    --ink: #eef2ea;
    --muted: #aeb8a9;
    --faint: #859080;

    --accent: #7fc79a;
    --accent-strong: #a5dcb9;
    --accent-soft: #1d3325;
    --on-accent: #0e1512;

    --protein: #7fc79a;
    --carb: #e3b463;
    --fat: #e08c74;

    --good: #7fc79a;
    --bad: #ff9d90;
    --bad-soft: #341c19;

    --shadow: 0 14px 40px -24px rgba(0, 0, 0, 0.9);
    --shadow-lg: 0 30px 70px -40px rgba(0, 0, 0, 0.95);
  }
}

/* 3. Base elements ------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

main {
  flex: 1;
}

img,
svg {
  max-width: 100%;
  display: block;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

a {
  color: var(--accent-strong);
  text-decoration: none;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--accent);
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
  color: var(--ink);
}

h1 { font-size: clamp(2.1rem, 5.2vw, 3.5rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); }
h3 { font-size: 1.15rem; }

p { text-wrap: pretty; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* 4. Shared building blocks --------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 22px;
}
.wrap-narrow {
  max-width: var(--wrap-narrow);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -140%);
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 100;
  font-size: 0.9rem;
}
.skip-link:focus {
  transform: translate(-50%, 0);
  color: var(--on-accent);
}

.section {
  margin-top: clamp(38px, 6vw, 64px);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.section-head h2 { margin: 0; }
.section-head .more { font-size: 0.92rem; white-space: nowrap; }

.eyebrow {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.lede {
  font-size: 1.05rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease,
    border-color 0.15s ease;
}
.btn:hover {
  background: var(--accent-strong);
  color: var(--on-accent);
  text-decoration: none;
  transform: translateY(-2px);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover {
  background: var(--surface);
  color: var(--accent-strong);
  border-color: var(--accent);
}
.btn-quiet {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  box-shadow: none;
}
.btn-quiet:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}
.btn-generate {
  padding-inline: 28px;
}

.pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 11px;
  white-space: nowrap;
}
.pill-quiet {
  color: var(--muted);
  background: var(--bg-alt);
}

.notice {
  padding: 18px 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}
.notice-bad {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad);
}

/* 5. Header and navigation ---------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.22rem;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-sm);
}
.brand-mark svg { width: 24px; height: 24px; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 13px;
  border-radius: 999px;
}
.site-nav a:hover {
  color: var(--ink);
  background: var(--bg-alt);
  text-decoration: none;
}
.site-nav a[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

/* 6. Hero ---------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.85fr);
  gap: clamp(26px, 4vw, 56px);
  align-items: center;
  margin-top: clamp(24px, 4vw, 44px);
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(110% 150% at 100% 0%, var(--accent-soft) 0%, transparent 55%),
    linear-gradient(155deg, var(--surface-2), var(--bg-alt));
  box-shadow: var(--shadow);
}
.hero h1 { margin-bottom: 16px; }
.hero-lede {
  max-width: 54ch;
  color: var(--muted);
  font-size: 1.06rem;
}
.hero-points {
  list-style: none;
  display: grid;
  gap: 8px;
  margin-top: 22px;
}
.hero-points li {
  position: relative;
  padding-left: 26px;
  color: var(--muted);
  font-size: 0.95rem;
}
.hero-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  mask: radial-gradient(circle at center, transparent 0 27%, #000 29%);
  -webkit-mask: radial-gradient(circle at center, transparent 0 27%, #000 29%);
}

.hero-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero-card-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.hero-card-number {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 6vw, 4.2rem);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  margin: 10px 0 4px;
}
.hero-card-number span {
  font-size: 0.42em;
  margin-left: 2px;
}
.hero-card-number .hero-card-value {
  font-size: 1em;
  margin-left: 0;
}
.hero-card-caption {
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 26ch;
}
.hero-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 74px;
  margin-top: 22px;
}
.hero-bars span {
  flex: 1;
  height: var(--h);
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-soft));
  opacity: 0.85;
}
.hero-bars span:nth-child(even) {
  background: linear-gradient(180deg, var(--carb), color-mix(in srgb, var(--carb) 25%, transparent));
}

/* 7. Planner ------------------------------------------------------------- */
.planner {
  margin-top: clamp(34px, 5vw, 56px);
  padding: clamp(22px, 3vw, 34px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.planner-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.planner-head h2 { margin-bottom: 6px; }
.planner-head p {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 62ch;
}

.config {
  display: grid;
  gap: 30px;
}
.config-block {
  border: 0;
  min-width: 0;
}
.config-block > legend {
  padding: 0;
  margin-bottom: 14px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.config-hint {
  color: var(--faint);
  font-size: 0.88rem;
  margin-top: 8px;
}

/* Targets ---------------------------------------------------------------- */
.target + .target { margin-top: 24px; }
.target-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.target-head label {
  font-weight: 600;
  font-size: 0.98rem;
}
.target-head output {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 12px;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent) var(--fill, 50%),
    var(--bg-alt) var(--fill, 50%),
    var(--bg-alt) 100%
  );
  cursor: pointer;
  outline-offset: 6px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: var(--shadow-sm);
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: var(--shadow-sm);
}
.range-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--faint);
}

/* Meal count ------------------------------------------------------------- */
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.segmented label { position: relative; }
.segmented input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.segmented span {
  display: grid;
  place-items: center;
  min-width: 44px;
  padding: 7px 14px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.segmented input:checked + span {
  background: var(--accent);
  color: var(--on-accent);
}
.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Diet ------------------------------------------------------------------- */
.diet-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.diet-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.diet-option:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.diet-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.diet-option input {
  margin-top: 4px;
  accent-color: var(--accent);
}
.diet-name {
  display: block;
  font-weight: 600;
  font-size: 0.96rem;
}
.diet-desc {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
  margin-top: 2px;
}

/* Allergen chips --------------------------------------------------------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  position: relative;
  cursor: pointer;
}
.chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.chip span {
  display: inline-block;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
}
.chip:hover span { border-color: var(--accent); color: var(--ink); }
.chip input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.chip input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 4px;
}

/* Results ---------------------------------------------------------------- */
.results {
  margin-top: clamp(34px, 5vw, 56px);
  padding-top: clamp(26px, 4vw, 40px);
  border-top: 1px solid var(--line);
  scroll-margin-top: 90px;
}
.results-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 26px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.results-head h2 { margin-bottom: 6px; }
.results-summary {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 54ch;
}

.totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, 1fr));
  gap: 10px;
  min-width: min(100%, 430px);
}
.total {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.total-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.total-value {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.total-value span {
  font-family: var(--font-mono);
  font-size: 0.62em;
  font-weight: 500;
  color: var(--muted);
  margin-left: 3px;
}
.total-protein .total-value { color: var(--protein); }
.total-note {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--faint);
  margin-top: 2px;
}
.total-meter {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: var(--bg-alt);
  margin-top: 8px;
  overflow: hidden;
}
.total-meter span {
  display: block;
  height: 100%;
  background: var(--protein);
  border-radius: 999px;
}
.total-calories .total-meter span { background: var(--carb); }

.plan {
  display: grid;
  gap: 12px;
}
.plan.is-fresh .meal {
  animation: meal-in 0.32s ease both;
}
.plan.is-fresh .meal:nth-child(2) { animation-delay: 0.04s; }
.plan.is-fresh .meal:nth-child(3) { animation-delay: 0.08s; }
.plan.is-fresh .meal:nth-child(4) { animation-delay: 0.12s; }
.plan.is-fresh .meal:nth-child(5) { animation-delay: 0.16s; }
.plan.is-fresh .meal:nth-child(6) { animation-delay: 0.2s; }

@keyframes meal-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.meal {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.meal:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.meal-slot {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 5px 10px;
  text-align: center;
  justify-self: start;
  white-space: nowrap;
}
.meal-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.meal-head h3 { font-size: 1.1rem; }
.meal-head h3 a { color: var(--ink); }
.meal-head h3 a:hover { color: var(--accent-strong); text-decoration: none; }
.meal-time {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--faint);
}
.meal-macros {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 5px;
  font-size: 0.84rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.meal-protein {
  font-weight: 700;
  color: var(--protein);
}
.meal-meta {
  margin-top: 5px;
  font-size: 0.76rem;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.meal-allergens {
  color: var(--fat);
}
.meal-actions { justify-self: end; }
.btn-swap {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line-strong);
  font-size: 0.85rem;
  padding: 8px 16px;
  box-shadow: none;
}
.btn-swap:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: none;
}

.plan-foot {
  margin-top: 16px;
  font-size: 0.86rem;
  color: var(--faint);
}

/* 8. Recipe cards and recipe pages -------------------------------------- */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}
.recipe-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: inherit;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.recipe-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line-strong);
  text-decoration: none;
}
.recipe-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.recipe-card h3 {
  font-size: 1.16rem;
  color: var(--ink);
}
.recipe-card:hover h3 { color: var(--accent-strong); }
.recipe-time {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--faint);
  white-space: nowrap;
}
.recipe-macros {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 0.84rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.recipe-macros strong { color: var(--protein); }
.recipe-allergens {
  font-size: 0.76rem;
  color: var(--fat);
}
.recipe-more {
  margin-top: auto;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-strong);
}
.macro-bar {
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-alt);
  gap: 2px;
}
.macro-bar span { display: block; height: 100%; }
.macro-bar .macro-protein { background: var(--protein); }
.macro-bar .macro-carb { background: var(--carb); }
.macro-bar .macro-fat { background: var(--fat); }
.macro-bar-lg { height: 10px; margin-top: 16px; }

.page-head {
  margin-top: 14px;
  margin-bottom: 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.page-head p {
  color: var(--muted);
  margin-top: 10px;
  max-width: 62ch;
}

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.jump a {
  padding: 7px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--muted);
}
.jump a:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  text-decoration: none;
  background: var(--accent-soft);
}

/* A single recipe */
.recipe {
  max-width: 1040px;
  margin-inline: auto;
  scroll-margin-top: 90px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 18px;
}
.back:hover { color: var(--accent-strong); text-decoration: none; }
.recipe-header {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.recipe-labels {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.recipe-header h1 { margin-bottom: 10px; }
.recipe-note {
  color: var(--muted);
  font-style: italic;
}
.recipe-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  gap: clamp(28px, 4vw, 54px);
  margin-top: 34px;
  align-items: start;
}
.recipe-main h2,
.recipe-side h2 {
  font-size: 1.1rem;
  margin-bottom: 14px;
}
.ingredients {
  list-style: none;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}
.ingredients li {
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.ingredients li::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 12px;
  vertical-align: 2px;
}
.steps {
  display: grid;
  gap: 14px;
  list-style: none;
  counter-reset: step;
}
.steps li {
  position: relative;
  counter-increment: step;
  padding-left: 46px;
  color: var(--muted);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.9rem;
}
.recipe-side {
  display: grid;
  gap: 18px;
}
.nutrition,
.allergens {
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.nutrition-list {
  display: grid;
  gap: 2px;
}
.nutrition-list > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}
.nutrition-list > div:last-child { border-bottom: 0; }
.nutrition-list dt { color: var(--muted); font-size: 0.92rem; }
.nutrition-list dd {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.macro-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  list-style: none;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--faint);
}
.macro-key li { display: inline-flex; align-items: center; gap: 6px; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-protein { background: var(--protein); }
.dot-carb { background: var(--carb); }
.dot-fat { background: var(--fat); }

.allergens ul {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  list-style: none;
}
.allergens li {
  font-size: 0.82rem;
  padding: 4px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fat) 12%, transparent);
  color: var(--fat);
  font-weight: 600;
}
.allergens .lede { font-size: 0.88rem; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.tag {
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
}
.recipe-cta {
  margin-top: 42px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* 9. About page --------------------------------------------------------- */
.about-page {
  /* The column itself is centred by .wrap-narrow; on a wide screen the page
     heading joins it in the middle while the paragraphs stay left-aligned. */
  margin-inline: auto;
}
@media (min-width: 960px) {
  .about-page .page-head {
    text-align: center;
  }
  .about-page .page-head p {
    margin-inline: auto;
  }
}
.prose {
  font-size: 1.02rem;
}
.prose > * + * { margin-top: 1em; }
.prose h2 {
  margin-top: 2em;
  font-size: 1.5rem;
}
.prose h2:first-child { margin-top: 0; }
.prose p,
.prose li { color: var(--muted); }
.prose ul,
.prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.45em; }
.prose strong { color: var(--ink); }
.prose a {
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 2px;
}

/* 10. Footer ------------------------------------------------------------ */
.site-footer {
  margin-top: clamp(56px, 9vw, 96px);
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  padding: 44px 0 30px;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer-inner {
  display: grid;
  gap: 28px;
  grid-template-columns: 1.5fr 1fr 1fr;
  align-items: start;
}
.footer-brand .brand { font-size: 1.15rem; }
.footer-brand p { margin-top: 12px; max-width: 36ch; }
.footer-col h4 {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 12px;
}
.footer-col ul {
  list-style: none;
  display: grid;
  gap: 8px;
}
.footer-col a { color: var(--muted); }
.footer-col a:hover { color: var(--accent-strong); }
.footer-legal {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--faint);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* 11. Small screens, motion and print ---------------------------------- */
@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-card {
    max-width: 380px;
  }
  .recipe-layout {
    grid-template-columns: 1fr;
  }
  .recipe-side {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .header-inner {
    min-height: auto;
    padding-block: 12px;
  }
  .site-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .site-nav a { white-space: nowrap; }
  .footer-inner { grid-template-columns: 1fr; }
  .results-head { flex-direction: column; }
  .totals {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    min-width: 0;
  }
  .meal {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .meal-actions {
    justify-self: start;
  }
  .btn-swap { padding: 7px 14px; }
  .hero-card { max-width: none; }
  .recipe-side { grid-template-columns: 1fr; }
  .config-actions .btn-generate { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .planner,
  .hero,
  .plan-foot,
  .meal-actions,
  .section {
    display: none !important;
  }
  body { background: #fff; font-size: 12pt; }
  .results { border-top: 0; margin-top: 0; padding-top: 0; }
  .meal {
    break-inside: avoid;
    box-shadow: none;
    border-color: #ccc;
  }
  .totals { grid-template-columns: repeat(4, 1fr); }
  .results-head { margin-bottom: 12px; }
}
