/* SMM — Standard Mahlzeiten Modell
   Warme, ruhige Oberfläche; mobil zuerst, weil die Liste im Laden benutzt wird. */

:root {
  --bg: #fbf8f3;
  --bg-soft: #f4eee4;
  --surface: #ffffff;
  --text: #241f1a;
  --muted: #7b6f62;
  --line: #e9e0d3;
  --accent: #b4531f;
  --accent-ink: #ffffff;
  --accent-soft: #fdeee4;
  --ok: #3f7d4e;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(36, 31, 26, 0.05), 0 12px 28px -18px rgba(36, 31, 26, 0.35);
  --shadow-lift: 0 2px 4px rgba(36, 31, 26, 0.06), 0 18px 34px -18px rgba(36, 31, 26, 0.45);
  --tint-l: 94%;
  --tint-s: 42%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --bg-soft: #1f1a14;
    --surface: #221d17;
    --text: #f3ece2;
    --muted: #a79a89;
    --line: #342c23;
    --accent: #f0925c;
    --accent-ink: #2a1408;
    --accent-soft: #3a2519;
    --ok: #7cc08c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 30px -18px rgba(0, 0, 0, 0.8);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.5), 0 20px 40px -20px rgba(0, 0, 0, 0.9);
    --tint-l: 22%;
    --tint-s: 30%;
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 84px; /* Platz für die klebende Kopfzeile */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.015em; }

a { color: inherit; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-inline: 20px;
}

/* ------------------------------------------------------------------ Kopfzeile */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand__logo {
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
}

.brand__text { display: grid; }
.brand__text strong { font-size: 18px; letter-spacing: 0.04em; }
.brand__text small { color: var(--muted); font-size: 12px; letter-spacing: 0.02em; }

.nav { display: flex; gap: 6px; }

.nav__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.nav__item:hover { background: var(--bg-soft); color: var(--text); }
.nav__item.is-active { background: var(--accent); color: var(--accent-ink); }

.badge {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.nav__item.is-active .badge {
  background: color-mix(in srgb, var(--accent-ink) 22%, transparent);
  color: var(--accent-ink);
}

/* --------------------------------------------------------------------- Layout */

main { padding-block: 28px 40px; min-height: 60vh; }

/* Die Einkaufsliste liest und tippt sich in schmaler Spalte deutlich besser. */
.view--narrow { max-width: 720px; }

.intro { margin-bottom: 22px; }
.intro h2 { font-size: clamp(26px, 4vw, 34px); }
.intro p { margin: 6px 0 0; color: var(--muted); max-width: 56ch; }

.footer {
  padding-block: 24px 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.footer p { margin: 16px 0 0; max-width: 60ch; }

.empty {
  padding: 32px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

/* -------------------------------------------------------------- Werkzeugleiste */

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search__icon { position: absolute; left: 14px; font-size: 14px; opacity: 0.7; }

.search input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  box-shadow: var(--shadow);
}

.search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tags { display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag:hover { border-color: var(--accent); color: var(--accent); }
.tag.is-active { background: var(--text); border-color: var(--text); color: var(--bg); }

/* ------------------------------------------------------------------- Kacheln */

.course + .course { margin-top: 34px; }

.course__title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.card__banner {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 120% at 20% 0%, hsl(var(--hue) var(--tint-s) var(--tint-l)) 0%, transparent 70%),
    hsl(var(--hue) calc(var(--tint-s) - 12%) calc(var(--tint-l) - 3%));
}

.card__emoji { font-size: 40px; line-height: 1; }

.card__mark {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: transparent;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.16s ease;
}

.card.is-planned { border-color: var(--accent); }
.card.is-planned .card__mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.card__body { padding: 14px 16px 4px; flex: 1; }
.card__body h3 { font-size: 18px; }

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.card__note { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: 12px;
  color: var(--text);
}

.card__footer {
  padding: 14px 16px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.card__action { font-size: 14px; font-weight: 600; color: var(--muted); }
.card.is-planned .card__action { color: var(--accent); }

/* -------------------------------------------------------------- Einkaufsliste */

.progress { margin-bottom: 24px; }

.progress__bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
}

.progress__bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ok);
  transition: width 0.25s ease;
}

.progress p { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

.group { margin-bottom: 26px; }

.group h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.items {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s ease;
}

.item:last-child { border-bottom: none; }
.item:hover { background: var(--bg-soft); }
.item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.item__box {
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-radius: 7px;
  display: grid;
  place-items: center;
  transition: all 0.15s ease;
}

.item__box::after {
  content: "✓";
  font-size: 13px;
  font-weight: 700;
  color: transparent;
  line-height: 1;
}

.item__text { flex: 1; display: grid; font-weight: 500; }
.item__text small { color: var(--muted); font-size: 12px; font-weight: 400; }

.item.is-checked { color: var(--muted); }
.item.is-checked .item__text { text-decoration: line-through; text-decoration-thickness: 1px; }
.item.is-checked .item__box { background: var(--ok); border-color: var(--ok); }
.item.is-checked .item__box::after { color: #fff; }

.item__remove {
  flex: none;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.item__remove:hover { background: var(--accent-soft); color: var(--accent); }

.extra-form { display: flex; gap: 10px; margin: 24px 0 18px; flex-wrap: wrap; }

.extra-form input {
  flex: 1 1 220px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.extra-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.list-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.button {
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.button:hover { border-color: var(--accent); color: var(--accent); }
.button--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button--primary:hover { color: var(--accent-ink); filter: brightness(1.06); }
.button--quiet { color: var(--muted); }

@media (min-width: 640px) {
  .toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
  .search { flex: 0 1 320px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
