:root {
  color: #172235;
  background: #f3f6f8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --navy: #10233f;
  --navy-soft: #1b365f;
  --cream: #fffdf8;
  --orange: #e85f3a;
  --orange-dark: #c84526;
  --green: #2f6c59;
  --line: #d6dee5;
  --muted: #647184;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body { margin: 0; min-width: 320px; min-height: 100vh; }

button, select { font: inherit; }

button { cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  min-height: 74px;
  padding: 14px clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--navy);
  color: white;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--orange);
  font-family: Inter, sans-serif;
  font-size: 1rem;
}

.controls { display: flex; align-items: center; gap: 10px; }

select,
.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0 15px;
  font-weight: 700;
  font-size: 0.9rem;
}

select {
  padding-right: 34px;
  border-color: #55667f;
  background: var(--navy-soft);
  color: white;
}

.button-secondary { border-color: #55667f; background: transparent; color: white; }
.button-primary { background: var(--orange); color: white; }
.button-primary:hover { background: var(--orange-dark); }
.button-secondary:hover { background: rgba(255, 255, 255, 0.08); }

.intro {
  padding: 56px clamp(20px, 4vw, 64px) 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: end;
  color: white;
  background:
    radial-gradient(circle at 80% 20%, rgba(232, 95, 58, 0.35), transparent 28%),
    linear-gradient(115deg, #18365e, #0d1c32 68%);
  border-bottom: 5px solid var(--orange);
}

.eyebrow {
  margin: 0 0 12px;
  color: #f2ad91;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 12px;
  max-width: 720px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.intro-copy { margin-bottom: 0; max-width: 640px; color: #cad4e1; font-size: 1.05rem; line-height: 1.6; }

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(5, 15, 29, 0.28);
  backdrop-filter: blur(8px);
}

.summary div { padding: 18px; border-left: 1px solid rgba(255, 255, 255, 0.16); }
.summary div:first-child { border-left: 0; }
.summary strong { display: block; color: #fff; font-family: Georgia, serif; font-size: 1.75rem; }
.summary span { display: block; margin-top: 4px; color: #bdc9d8; font-size: 0.74rem; white-space: nowrap; }

.week-grid {
  padding: 32px clamp(20px, 4vw, 64px) 48px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  background: #e9eef2;
}

.day-card {
  min-height: 250px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-top: 4px solid var(--orange);
  border-radius: 10px;
  background: var(--cream);
  box-shadow: 0 8px 24px rgba(16, 35, 63, 0.06);
}

.day-card-leftovers { border-top-color: var(--green); }

.day-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-heading p { margin: 0; color: var(--muted); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; }
.meal-state { color: var(--orange-dark); font-size: 0.68rem; font-weight: 800; text-transform: uppercase; }
.day-card-leftovers .meal-state { color: var(--green); }

.day-card h2 {
  margin: 26px 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.15rem, 1.4vw, 1.45rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.allocations { margin-top: auto; display: grid; gap: 8px; }

.allocation {
  width: 100%;
  padding: 9px 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--navy);
  text-align: left;
}

.allocation:hover span { color: var(--orange-dark); }
.allocation span { font-size: 0.8rem; font-weight: 800; }
.allocation small { margin-top: 3px; color: var(--muted); font-size: 0.72rem; }

.catalogue { padding: 64px clamp(20px, 8vw, 128px); background: white; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.section-heading h2 { margin-bottom: 0; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -0.03em; }
.section-heading > p { margin-bottom: 5px; color: var(--muted); }
.catalogue .eyebrow { color: var(--orange-dark); }

.recipe-list { border-top: 1px solid var(--line); }
.recipe-item { border-bottom: 1px solid var(--line); }
.recipe-item summary { padding: 20px 4px; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; cursor: pointer; list-style: none; }
.recipe-item summary::-webkit-details-marker { display: none; }
.recipe-item summary > span:first-child { display: grid; gap: 5px; }
.recipe-item strong { font-family: Georgia, serif; font-size: 1.2rem; }
.recipe-item small { color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.recipe-meta { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.recipe-item ul { margin: -4px 0 20px; padding: 18px 22px 18px 42px; border-radius: 8px; background: #f5f7f8; columns: 2; }
.recipe-item li { padding: 4px 12px 4px 0; color: #3d4a5d; }

footer { padding: 28px clamp(20px, 4vw, 64px); display: flex; justify-content: space-between; gap: 20px; background: var(--navy); color: #bdc9d8; font-size: 0.8rem; }
footer p { margin: 0; }
footer code { color: white; }

.toast { position: fixed; right: 20px; bottom: 20px; padding: 12px 18px; border-radius: 8px; background: var(--navy); color: white; opacity: 0; transform: translateY(8px); pointer-events: none; transition: 160ms ease; }
.toast-visible { opacity: 1; transform: translateY(0); }

.error { min-height: 100vh; padding: 15vh 10vw; background: var(--navy); color: white; }
.error p:last-child { max-width: 620px; color: #cad4e1; font-size: 1.1rem; }

button:focus-visible,
select:focus-visible,
summary:focus-visible { outline: 3px solid #ffc4ad; outline-offset: 3px; }

@media (max-width: 1120px) {
  .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .intro { grid-template-columns: 1fr; }
  .summary { max-width: 520px; }
}

@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .controls { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .controls label { grid-column: 1 / -1; }
  select { width: 100%; }
  .intro { padding-top: 40px; }
  .summary { width: 100%; grid-template-columns: 1fr; }
  .summary div { display: flex; align-items: baseline; gap: 10px; border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.16); }
  .summary div:first-child { border-top: 0; }
  .summary strong { font-size: 1.45rem; }
  .week-grid { grid-template-columns: 1fr; }
  .day-card { min-height: 0; }
  .day-card h2 { margin: 20px 0; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .recipe-item summary { grid-template-columns: 1fr; gap: 10px; }
  .recipe-item ul { columns: 1; }
  footer { flex-direction: column; }
}

@media print {
  .topbar, .catalogue, footer, .toast { display: none; }
  .intro { padding: 24px; color: #172235; background: white; border-bottom-color: #172235; }
  .intro-copy, .summary span { color: #4d596b; }
  .summary { border-color: #c8d0d8; background: white; }
  .summary div { border-color: #c8d0d8; }
  .summary strong { color: #172235; }
  .week-grid { padding: 20px; grid-template-columns: repeat(2, 1fr); background: white; }
  .day-card { break-inside: avoid; box-shadow: none; }
}
