/* Charlie — öffentliche SSR-Seiten. Mobile-first, ein Output für Web+App-Container.
   Layout passt sich dem Viewport an: Phone = 1 Spalte, Tablet/Desktop = fluides Karten-Grid
   (repeat(auto-fill, minmax())), Inhalt in fluidem max-width-Container statt randlos gedehnt.
   Nur die public Vike-Seiten — der Ionic-App-Bereich bringt sein eigenes Theme mit. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f8;
  --text: #1a1a1d;
  --text-muted: #666;
  --border: #e6e6e9;
  --brand: #2f6f4f;          /* Low-Carb-Grün */
  --brand-ink: #1d4a34;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
  --container: 1100px;       /* max Inhaltsbreite auf großen Screens */
  --measure: 68ch;           /* lesbare Zeilenlänge für Fließtext */
  --gap: clamp(1rem, 2.5vw, 1.75rem);
  --pad-inline: clamp(1rem, 4vw, 2rem);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1113; --surface: #16191c; --surface-2: #1c2024;
    --text: #e8e8ea; --text-muted: #a0a4ab; --border: #2a2f35;
    --brand: #5fc28b; --brand-ink: #8fe0b0;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 22px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-inline-size: 100%; block-size: auto; }

/* Fluider Container — randlos auf Phone, zentriert + begrenzt auf Desktop. */
.container {
  inline-size: 100%;
  max-inline-size: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad-inline);
  padding-block: clamp(1.25rem, 3vw, 2.5rem);
}

/* Kopf / Fuß */
.site-header, .site-footer {
  border-block-end: 1px solid var(--border);
  background: var(--surface);
}
.site-footer { border-block: 1px solid var(--border) 0; border-block-start: 1px solid var(--border); }
.site-header__inner, .site-footer__inner {
  max-inline-size: var(--container);
  margin-inline: auto;
  padding: 0.9rem var(--pad-inline);
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.site-header__brand { font-weight: 800; color: var(--text); font-size: 1.15rem; letter-spacing: -0.02em; }
.site-header__nav { margin-inline-start: auto; display: flex; gap: 1.1rem; }
.site-footer__inner { color: var(--text-muted); font-size: 0.9rem; }

/* Typografie */
h1 { font-size: clamp(1.6rem, 1.2rem + 2.2vw, 2.6rem); line-height: 1.1; letter-spacing: -0.02em; margin-block: 0 0.5rem; }
h2 { font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem); margin-block: 2rem 0.6rem; }
.lead { font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem); color: var(--text-muted); max-inline-size: var(--measure); }
.muted { color: var(--text-muted); }

/* Rezept-Grid: 1 Spalte mobil → füllt sich automatisch je Viewport. */
.recipe-grid {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: var(--gap);
}
.recipe-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.recipe-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.recipe-card a { color: inherit; }
.recipe-card a::after { content: ""; position: absolute; inset: 0; } /* ganze Karte klickbar */
.recipe-card { position: relative; }
.recipe-card__title { font-size: 1.15rem; font-weight: 700; line-height: 1.25; }
.recipe-card__meta { color: var(--text-muted); font-size: 0.9rem; margin-block-start: auto; }
.recipe-card__badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-block-start: 0.3rem; }
.badge {
  font-size: 0.78rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
}
.badge--carbs { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand-ink); }

/* Rezept-Detail: 1 Spalte mobil → Nährwert-Karte als Sidebar ab Tablet. */
.recipe-detail { display: grid; gap: var(--gap); }
@media (min-width: 820px) {
  .recipe-detail { grid-template-columns: minmax(0, 1fr) clamp(240px, 30%, 320px); align-items: start; }
  .recipe-detail__aside { position: sticky; top: 1.5rem; }
}
.recipe-detail__main { min-inline-size: 0; }
.recipe-detail__main h2:first-child { margin-block-start: 0.5rem; }
.prose { max-inline-size: var(--measure); }
.prose ul, .prose ol { padding-inline-start: 1.25rem; }
.prose li { margin-block: 0.25rem; }

.nutrition-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.25rem;
}
.nutrition-card h2 { margin-block: 0 0.75rem; font-size: 1.15rem; }
.nutrition-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.nutrition-list li { display: flex; justify-content: space-between; gap: 1rem; border-block-end: 1px dashed var(--border); padding-block-end: 0.4rem; }
.nutrition-list li:last-child { border-block-end: 0; }
.nutrition-list b { font-variant-numeric: tabular-nums; }

.backlink { display: inline-block; margin-block-end: 0.5rem; color: var(--text-muted); font-size: 0.92rem; }
.center { text-align: center; }

/* Portionen-Umsteller (Rezept-Detail, progressive enhancement via stepper.js) */
.portion-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-block: 0.25rem 0.75rem;
}
.portion-stepper button {
  inline-size: 2rem;
  block-size: 2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.portion-stepper button:hover { border-color: var(--brand); color: var(--brand); }

/* Rezept-Suche (GET-Formular, /rezepte) */
.recipe-search {
  display: flex;
  gap: 0.5rem;
  margin-block: 0.75rem 0.25rem;
  max-inline-size: 28rem;
}
.recipe-search input {
  flex: 1;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  background: var(--surface);
}
.recipe-search button {
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.recipe-search button:hover { background: var(--brand-ink); }

/* Rezept-Medien: Karten-Bild, Detail-Hero, Galerie */
.recipe-card__image { display: block; margin: -1rem -1rem 0.75rem; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.recipe-card__image img { display: block; inline-size: 100%; block-size: 160px; object-fit: cover; }
.recipe-hero { margin: 1rem 0; }
.recipe-hero img, .recipe-hero video { display: block; inline-size: 100%; max-block-size: 420px; object-fit: cover; border-radius: var(--radius); }
.recipe-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; margin-block: 0.75rem 1rem; }
.recipe-gallery img, .recipe-gallery video { display: block; inline-size: 100%; block-size: 120px; object-fit: cover; border-radius: calc(var(--radius) - 4px); }
