/* weekprep — one stylesheet for the site and the app. Plain on purpose: the
   people reading it are busy, often tired, and sometimes on a phone in a
   hospital corridor. Large text, clear buttons, nothing that moves. */

:root {
  color-scheme: light dark;
  --ink: #1f2420;
  --bg: #f7f5ee;
  --paper: #ffffff;
  --line: #e0dccf;
  --muted: #5c665e;
  --brand: #2e6b3f;
  --brand-ink: #f7f5ee;
  --accent: #b8621f;
  --good: #1d7a4f;
  --bad: #b23b3b;
  --warn-bg: #fff4dc;
  --warn-line: #ecc77a;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7e5df; --bg: #121715; --paper: #1a211e; --line: #2c3632; --muted: #9ba7a1;
    --brand: #7fc493; --brand-ink: #0d1412; --accent: #e3a26f; --good: #4cc08a; --bad: #ef7d7d;
    --warn-bg: #2d2717; --warn-line: #6d5a2c;
  }
}

* { box-sizing: border-box; }
/* Classes that set display (.claim, .btn, .card…) must not win over hidden. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--brand); }
h1 { font-size: clamp(28px, 4.6vw, 42px); letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 12px; }
h2 { font-size: 22px; letter-spacing: -0.01em; margin: 32px 0 10px; }
h3 { font-size: 17px; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small, .hint { font-size: 14px; }
.hint { color: var(--muted); margin-top: 6px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.debt { color: var(--bad); font-weight: 650; }
.credit { color: var(--good); font-weight: 650; }
.error { color: var(--bad); min-height: 1em; }
.ok { color: var(--good); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--paper); padding: 8px 12px; z-index: 10; }

main { max-width: 780px; margin: 0 auto; padding: 36px 20px 64px; }
main.wide { max-width: 1120px; }

/* ── Header and footer ─────────────────────────────────────────────────── */

.site-header {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.site-header nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; font-weight: 550; }
.site-header nav a[aria-current="page"], .site-header nav a:hover { color: var(--ink); }
.site-header .account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.sync-dot[data-state="synced"] { background: var(--good); }
.sync-dot[data-state="syncing"] { background: var(--accent); }
.sync-dot[data-state="error"], .sync-dot[data-state="offline"] { background: var(--bad); }

.claim { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 10px 20px; background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); }

.site-footer {
  display: flex; gap: 18px; justify-content: space-between; flex-wrap: wrap;
  padding: 24px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px;
}
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }

/* ── Controls ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 650;
  text-decoration: none; cursor: pointer;
}
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 5px 11px; font-size: 14px; }
.btn.link { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; font-weight: 500; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 4px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; margin: 0; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
input[type="checkbox"], input[type="radio"] { width: auto; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }
.honeypot { position: absolute; left: -5000px; }

/* ── Blocks ────────────────────────────────────────────────────────────── */

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.notice { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; }
.notice ul { margin: 0; padding-left: 18px; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; border: 1px solid var(--line); color: var(--muted); }
.pill.good { color: var(--good); border-color: var(--good); }
.pill.bad { color: var(--bad); border-color: var(--bad); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
th, td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
tr:last-child td { border-bottom: 0; }


/* ── App ───────────────────────────────────────────────────────────────── */

.app-top { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; justify-content: space-between; }
.week-title { margin-bottom: 0; }
.summary { margin: 10px 0; }
.toolbar input[type="search"] { flex: 1 1 220px; width: auto; }
.toolbar select { width: auto; }
.row select { width: auto; }
.pre { white-space: pre-wrap; }

/* The week: seven day columns, a slot per meal. One column on a phone. */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 14px 0; }
.week .day { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-width: 0; }
.week .day.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.week .day h3 { margin: 0 0 6px; font-size: 15px; }
.week .slot { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.week .slot-name { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.week .meal {
  display: flex; flex-direction: column; text-align: left; gap: 1px; width: 100%;
  font: inherit; color: inherit; cursor: pointer; padding: 5px 7px; border-radius: 7px;
  border: 0; border-left: 4px solid var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent);
}
.week .meal.leftover { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.week .meal.plain { border-left-style: dashed; }
.week .meal-title { font-weight: 650; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.week .meal-meta { font-size: 12px; color: var(--muted); }
.week .add {
  font: inherit; font-size: 18px; line-height: 1; padding: 4px; cursor: pointer; color: var(--muted);
  background: transparent; border: 1px dashed var(--line); border-radius: 7px;
}
.week .add:hover { color: var(--brand); border-color: var(--brand); }
@media (max-width: 860px) {
  .week { grid-template-columns: 1fr; }
  .week .day { display: grid; grid-template-columns: 90px 1fr; gap: 0 10px; }
  .week .day h3 { grid-row: span 3; }
  .week .slot { margin-top: 0; margin-bottom: 6px; }
}

/* The recipe library. */
.recipes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 14px 0; }
.recipe-card {
  display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; overflow: hidden;
}
.recipe-card:hover { border-color: var(--brand); }
.recipe-card img { width: calc(100% + 24px); margin: -12px -12px 6px; aspect-ratio: 4 / 3; object-fit: cover; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.recipe-detail h2 { margin-top: 8px; }
.recipe-photo { width: 100%; max-height: 360px; object-fit: cover; border-radius: var(--radius); }

/* Ticked lists: the shopping list and the prep steps. */
.aisles { columns: 2 300px; column-gap: 28px; }
.aisle { break-inside: avoid; }
.aisle h3 { margin-top: 14px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.check { display: flex; gap: 10px; align-items: baseline; font-weight: 450; margin: 0; cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; transform: translateY(3px); }
.check.done > span { text-decoration: line-through; color: var(--muted); }
.for { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 18px 0 8px; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--brand); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; max-width: 600px; width: calc(100% - 32px); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: rgb(0 0 0 / 0.35); }
dialog textarea { min-height: 90px; }

/* ── Marketing ─────────────────────────────────────────────────────────── */

.hero { padding: 24px 0 8px; }
.hero .lede { font-size: 19px; color: var(--muted); max-width: 640px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.features .card { margin: 0; }
.features h3 { margin-top: 0; }
.hero .cta { margin-top: 18px; }
.steps { counter-reset: step; padding: 0; list-style: none; }
.steps li { counter-increment: step; position: relative; padding-left: 40px; margin: 0 0 14px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 750; font-size: 14px; }
.plan-pro { border: 2px solid var(--brand); }
.example { background: color-mix(in srgb, var(--brand) 8%, var(--paper)); border-radius: 16px; padding: 4px 22px 18px; margin-top: 28px; }
.example-week { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.example-week li { background: var(--paper); border-radius: 8px; padding: 10px; font-size: 14px; }
.example-week strong, .example-week span { display: block; }
.example-details { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
@media (max-width: 760px) {
  .example-week { grid-template-columns: repeat(2, 1fr); }
  .example-details { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .site-footer, .claim, .tabs, .no-print, .app-top .btn { display: none !important; }
  .check input { display: none; }
  .aisles { columns: 2; }
  body { background: #fff; color: #000; }
  main, main.wide { max-width: none; padding: 0; }
  .card, table { border-color: #ccc; }
}
