/* ==========================================================================
   Food & Health Infos - Mobile first. Alles in einer Datei, keine Frameworks.
   ========================================================================== */

@font-face { font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 400; src: url('font/inter-v19-latin-regular.woff2') format('woff2'); }
@font-face { font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 600; src: url('font/inter-v19-latin-600.woff2') format('woff2'); }
@font-face { font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 700; src: url('font/inter-v19-latin-700.woff2') format('woff2'); }

/* --- Farben: dunkel als Standard, hell per System oder Umschalter --------- */
:root {
  --bg: #0f1115;
  --bg-soft: #151922;
  --surface: #191d26;
  --surface-2: #212734;
  --line: #2b3242;
  --text: #e9ecf3;
  --muted: #99a3b7;
  --accent: #a78bfa;
  --accent-ink: #1a1030;

  --no: #ff6b72;
  --care: #ffb454;
  --meh: #94a3bb;
  --yes: #4ade80;
  --info: #60a5fa;

  --tint: 16%;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --tap: 48px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f6fb;
    --bg-soft: #eef1f8;
    --surface: #ffffff;
    --surface-2: #f2f4fa;
    --line: #dfe4ef;
    --text: #161a22;
    --muted: #5d6679;
    --accent: #6d4aff;
    --accent-ink: #ffffff;
    --no: #d92d3a;
    --care: #b26a00;
    --meh: #5d6679;
    --yes: #16874a;
    --info: #1d5fd0;
    --tint: 10%;
    --shadow: 0 1px 2px rgba(16,24,40,.06), 0 10px 26px -14px rgba(16,24,40,.28);
  }
}

:root[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-soft: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f2f4fa;
  --line: #dfe4ef;
  --text: #161a22;
  --muted: #5d6679;
  --accent: #6d4aff;
  --accent-ink: #ffffff;
  --no: #d92d3a;
  --care: #b26a00;
  --meh: #5d6679;
  --yes: #16874a;
  --info: #1d5fd0;
  --tint: 10%;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 10px 26px -14px rgba(16,24,40,.28);
}

/* --- Basis ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }

/* Muss staerker sein als display-Regeln der Komponenten. */
[hidden] { display: none !important; }

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

.wrap {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding-inline: max(16px, env(safe-area-inset-left));
}

.visually-hidden, .sr-status {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skiplink {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 60;
  text-decoration: none;
}
.skiplink:focus { left: 16px; }

/* --- Kopfzeile ------------------------------------------------------------ */
.topbar { padding-top: calc(14px + env(safe-area-inset-top)); }

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }

.brand__mark {
  flex: none;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  font-size: 22px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__title {
  font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand__sub { font-size: .78rem; color: var(--muted); }

.topbar__actions { display: flex; gap: 8px; flex: none; }

.iconbtn {
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.iconbtn:active { transform: scale(.94); background: var(--surface-2); }

.ico {
  width: 21px; height: 21px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.ico--moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .ico--moon { display: block; }
  :root:not([data-theme="dark"]) .ico--sun { display: none; }
}
:root[data-theme="light"] .ico--moon { display: block; }
:root[data-theme="light"] .ico--sun { display: none; }

/* --- Intro ---------------------------------------------------------------- */
.intro { margin: 18px 0 16px; }
.intro p {
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
}

/* --- Suche ---------------------------------------------------------------- */
.searchbar {
  position: sticky;
  top: 0;
  z-index: 30;
  margin-inline: calc(-1 * max(16px, env(safe-area-inset-left)));
  padding: 10px max(16px, env(safe-area-inset-left)) 8px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  transition: box-shadow .2s ease;
}
.searchbar.is-stuck {
  box-shadow: 0 1px 0 var(--line), 0 12px 20px -18px rgba(0,0,0,.9);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search__ico {
  position: absolute; left: 15px;
  width: 20px; height: 20px;
  fill: none; stroke: var(--muted);
  stroke-width: 1.9; stroke-linecap: round;
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 52px;
  padding: 0 48px 0 44px;
  font-size: 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  appearance: none;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); }
.search input::-webkit-search-cancel-button { display: none; }

.search__clear {
  position: absolute; right: 6px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
}
.search__clear:active { background: var(--surface-2); }

/* --- Filter-Chips --------------------------------------------------------- */
.chips {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  font-size: .88rem; font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: transform .12s ease;
}
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* --- Ampel-Farbe pro Eintrag ---------------------------------------------- */
[data-level="no"]   { --lv: var(--no); }
[data-level="care"] { --lv: var(--care); }
[data-level="meh"]  { --lv: var(--meh); }
[data-level="yes"]  { --lv: var(--yes); }
[data-level="info"] { --lv: var(--info); }
[data-level="none"] { --lv: var(--muted); }

/* --- Antwort-Banner der Suche --------------------------------------------- */
.verdict {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 0 4px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--lv) 45%, var(--line));
  background: color-mix(in srgb, var(--lv) var(--tint), var(--surface));
  animation: pop .18s ease-out;
}
.verdict__icon { font-size: 26px; flex: none; line-height: 1; }
.verdict__title { font-weight: 700; font-size: 1.05rem; color: var(--lv); }
.verdict__text { font-size: .88rem; color: var(--muted); }

@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* --- Gruppen -------------------------------------------------------------- */
.group { margin-top: 26px; }
.group__head { margin: 0 4px 10px; }
.group__title {
  margin: 0;
  font-size: 1.02rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.group__blurb { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }

/* --- Eintrag -------------------------------------------------------------- */
.item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
  scroll-margin-top: 120px;
}

.item__head {
  width: 100%;
  min-height: 66px;
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px;
  background: none; border: 0;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}
.item__head:active { background: var(--surface-2); }

.item__icon {
  flex: none;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  font-size: 22px; line-height: 1;
  border-radius: 14px;
  background: color-mix(in srgb, var(--lv) var(--tint), transparent);
}

.item__text { flex: 1; min-width: 0; }
.item__name { display: block; font-weight: 600; letter-spacing: -.01em; }
.item__sub {
  display: block;
  font-size: .82rem; line-height: 1.35;
  color: var(--muted);
}

.pill {
  flex: none;
  font-size: .66rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--lv);
  background: color-mix(in srgb, var(--lv) var(--tint), transparent);
}

.item__chev {
  flex: none;
  width: 16px; height: 16px;
  fill: none; stroke: var(--muted);
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .2s ease;
}
.item__head[aria-expanded="true"] .item__chev { transform: rotate(90deg); }
.item--flat .item__chev { visibility: hidden; }

.item__body {
  padding: 2px 14px 15px 14px;
  border-top: 1px solid var(--line);
  margin-top: 2px;
}
.item__note {
  margin: 12px 0 0;
  font-size: .9rem;
  color: var(--text);
}

.facts { list-style: none; margin: 10px 0 0; padding: 0; }
.fact {
  display: flex; gap: 10px;
  align-items: flex-start;
  padding: 5px 0;
  font-size: .91rem;
}
.fact__m {
  flex: none;
  width: 21px; height: 21px;
  margin-top: 1px;
  display: grid; place-items: center;
  border-radius: 7px;
  font-size: 12px; font-weight: 700;
}
.fact--no .fact__m { color: var(--no); background: color-mix(in srgb, var(--no) var(--tint), transparent); }
.fact--ok .fact__m { color: var(--yes); background: color-mix(in srgb, var(--yes) var(--tint), transparent); }

.hidden-in { margin-top: 14px; }
.hidden-in__title {
  margin: 0;
  font-size: .74rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 8px 0 0; padding: 0;
  list-style: none;
}
.tags li {
  font-size: .8rem;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

mark {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  color: inherit;
  border-radius: 4px;
  padding: 0 2px;
}

/* --- Kein Treffer --------------------------------------------------------- */
.empty {
  margin-top: 16px;
  padding: 22px 18px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty__icon { font-size: 30px; }
.empty__title { margin: 8px 0 4px; font-size: 1.02rem; font-weight: 700; }
.empty__text { margin: 0; font-size: .9rem; color: var(--muted); }

/* --- Beispiele & Aktionen -------------------------------------------------- */
.examples { margin-top: 28px; }
.examples__title {
  margin: 0 4px 10px;
  font-size: .74rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.examples__list { display: flex; flex-wrap: wrap; gap: 8px; }
.example {
  min-height: 40px;
  padding: 0 14px;
  font-size: .88rem; font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: transform .12s ease;
}
.example:active { transform: scale(.95); }

.toolbar {
  display: flex;
  gap: 10px;
  margin-top: 26px;
}
.btn {
  flex: 1;
  min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 14px;
  font-size: .92rem; font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 14px;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.97); }
.btn--ghost {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}
.btn.is-done { opacity: .75; }

/* --- Fuss ----------------------------------------------------------------- */
.foot {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.foot__line { margin: 0; font-size: .92rem; color: var(--text); }
.foot__meta { margin: 8px 0 0; font-size: .78rem; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 16px;
}

/* --- Toast ---------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  z-index: 80;
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  font-size: .9rem; font-weight: 600;
  text-align: center;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.6);
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* --- Etwas mehr Luft auf grossen Displays --------------------------------- */
@media (min-width: 620px) {
  body { font-size: 16.5px; }
  .brand__title { font-size: 1.15rem; }
  .intro p { font-size: 1rem; }
}

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

/* --- Druck / PDF ---------------------------------------------------------- */
@media print {
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #fff;
    --line: #c9cede; --text: #000; --muted: #444;
    --tint: 12%;
    --shadow: none;
  }
  body { padding: 0; }
  .topbar__actions, .searchbar, .examples, .toolbar, .toast, .skiplink, .verdict { display: none !important; }
  .item { break-inside: avoid; page-break-inside: avoid; }
  .item__body[hidden] { display: block !important; }
  .item__chev { display: none; }
  .group { margin-top: 18px; }
  a[href]::after { content: ""; }
}
