/* =========================================================================
   Rezepte — "Editorial Cookbook" Theme. Light + Dark (System + Toggle).
   Tinte auf Papier, kontrastreiche Serif-Headlines, Haarlinien statt Boxen.
   ========================================================================= */
:root {
  --paper: #f6f3ed;
  --paper-2: #efeae0;
  --card: #fffdf9;
  --ink: #1b1916;
  --ink-soft: #5b5249;
  --muted: #8a7f72;
  --accent: #9c3b1b;
  --accent-ink: #ffffff;
  --accent-soft: #efe1d7;
  --line: #ddd3c5;
  --rule: #1b1916;
  --radius: 4px;
  --font-display: 'Fraunces', 'Iowan Old Style', Palatino, Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1a1712;
    --paper-2: #221d16;
    --card: #221d16;
    --ink: #efe7da;
    --ink-soft: #c7bbaa;
    --muted: #998d7c;
    --accent: #e0794f;
    --accent-ink: #1a1712;
    --accent-soft: #38241a;
    --line: #39322a;
    --rule: #efe7da;
  }
}
:root[data-theme="dark"] {
  --paper: #1a1712;
  --paper-2: #221d16;
  --card: #221d16;
  --ink: #efe7da;
  --ink-soft: #c7bbaa;
  --muted: #998d7c;
  --accent: #e0794f;
  --accent-ink: #1a1712;
  --accent-soft: #38241a;
  --line: #39322a;
  --rule: #efe7da;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font: 16px/1.65 var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
main { max-width: 880px; margin: 0 auto; padding: 0 32px 96px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 900; letter-spacing: -.01em; overflow-wrap: break-word; hyphens: auto; }

/* Small-caps label utility look */
.kicker, .hero-kicker, .stat-label, .nutri-scope, .meta-line, .chip,
.hero-nav, .card-cat, .index h2 {
  font-family: var(--font-body);
}

/* ---- Icons ---- */
.ic { width: 1.05em; height: 1.05em; flex: none; vertical-align: -.15em; }

/* ---- Theme toggle ---- */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1px solid var(--line);
  background: transparent; border-radius: 999px; font-size: .95rem;
  cursor: pointer; color: var(--ink); transition: border-color .15s ease;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn .ic-check { display: none; }
.icon-btn.copied { border-color: var(--accent); color: var(--accent); }
.icon-btn.copied .ic-share { display: none; }
.icon-btn.copied .ic-check { display: inline; }
#theme-toggle .theme-icon-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-toggle .theme-icon-light { display: none; }
  :root:not([data-theme="light"]) #theme-toggle .theme-icon-dark { display: inline; }
}
:root[data-theme="dark"] #theme-toggle .theme-icon-light { display: none; }
:root[data-theme="dark"] #theme-toggle .theme-icon-dark { display: inline; }
:root[data-theme="light"] #theme-toggle .theme-icon-light { display: inline; }
:root[data-theme="light"] #theme-toggle .theme-icon-dark { display: none; }

/* ============================ INDEX / HERO ============================ */
.hero { max-width: 880px; margin: 0 auto; padding: 28px 32px 4px; }
.hero-bar {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1.5px solid var(--rule); padding-bottom: 16px;
}
.brand { font-family: var(--font-display); font-weight: 900; font-size: 1.5rem; letter-spacing: -.01em; }
.hero-actions { display: flex; align-items: center; gap: 20px; }
.hero-nav { display: none; gap: 20px; }
.hero-nav a {
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; transition: color .15s ease;
}
.hero-nav a:hover { color: var(--accent); }
@media (min-width: 620px) { .hero-nav { display: inline-flex; } }
.hero-kicker {
  margin: 44px 0 0; font-size: .72rem; letter-spacing: .26em;
  text-transform: uppercase; color: var(--accent); font-weight: 600;
}
.hero h1 { font-size: clamp(2.6rem, 7vw, 4.4rem); line-height: 1.0; margin: 10px 0 14px; }
.hero-sub { color: var(--muted); margin: 0 0 28px; font-size: 1rem; }
#search {
  width: 100%; padding: 13px 0; font-size: 1.05rem; font-family: var(--font-body);
  border: none; border-bottom: 1.5px solid var(--ink); background: transparent;
  color: var(--ink); border-radius: 0;
}
#search::placeholder { color: var(--muted); }
#search:focus { outline: none; border-bottom-color: var(--accent); }

/* Filter chips — small-caps text with active underline */
.chips { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 20px; }
.chip {
  border: none; background: none; cursor: pointer; padding: 4px 0 6px;
  font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); border-bottom: 2px solid transparent; transition: color .15s ease;
}
.chip:hover { color: var(--ink); }
.chip.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- Index sections ---- */
.index section { margin-top: 52px; scroll-margin-top: 24px; }
.index h2 {
  display: flex; align-items: center; gap: 18px;
  font-family: var(--font-body); font-weight: 600;
  font-size: .78rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 22px;
}
.index h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 34px 28px; }
.empty { text-align: center; color: var(--muted); margin-top: 60px; }

/* Tag-Detailseite */
.taglist { padding-top: 4px; }
.taglist .hero-kicker { margin-top: 4px; }
.tag-title { font-family: var(--font-display); font-weight: 900; font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.05; margin: 6px 0 6px; letter-spacing: -.01em; }
.taglist .grid { margin-top: 30px; }

/* Flat editorial cards */
.card { display: block; text-decoration: none; color: inherit; min-width: 0; }
.card-media-wrap { position: relative; margin-bottom: 14px; }
.card-media {
  aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius);
  background: var(--paper-2); border: 1px solid var(--line);
}
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.card:hover .card-media img { transform: scale(1.04); }
.card h3 {
  font-size: 1.35rem; line-height: 1.12; margin: 0 0 8px;
  transition: color .15s ease;
  overflow-wrap: anywhere; hyphens: auto;
}
.card:hover h3 { color: var(--accent); }
.card-body { padding: 0; }
.card-sub {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 0 0 10px;
  font-size: .76rem; letter-spacing: .04em; color: var(--muted);
}
.card-sub .ic { color: var(--muted); }
.card-sub .dot { color: var(--line); }
.health-dot {
  position: absolute; top: 10px; left: 10px; width: 11px; height: 11px;
  border-radius: 999px; box-shadow: 0 0 0 2px var(--card);
}
.health-dot.leicht { background: #4f9e6a; }
.health-dot.ausgewogen { background: #c79a2e; }
.health-dot.soulfood { background: var(--accent); }

/* ---- Fallback tile ---- */
.tile {
  display: flex; align-items: center; justify-content: center; height: 100%;
  background: linear-gradient(135deg, hsl(var(--h) 30% 86%), hsl(calc(var(--h) + 20) 26% 74%));
}
:root[data-theme="dark"] .tile { background: linear-gradient(135deg, hsl(var(--h) 22% 26%), hsl(calc(var(--h) + 20) 24% 18%)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tile { background: linear-gradient(135deg, hsl(var(--h) 22% 26%), hsl(calc(var(--h) + 20) 24% 18%)); }
}
.tile-emoji { font-size: 2.2rem; opacity: .85; }

/* ---- Tags & Badges (einheitliche Größe) ---- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag, .health-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; line-height: 1; letter-spacing: .03em;
  height: 1.6rem; box-sizing: border-box; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--line);
  text-decoration: none; white-space: nowrap;
}
/* Emoji nicht größer als der Text rendern, damit alle Pills gleich hoch sind. */
.tag-emoji { font-size: .9em; line-height: 1; }
.tag { color: var(--muted); border-color: var(--muted); }
.tag:hover { border-color: var(--accent); color: var(--accent); }
.tag.diet { color: var(--accent); border-color: var(--accent); }
.stars { color: var(--accent); letter-spacing: 1px; }
.stars.small { font-size: .8rem; margin-top: 4px; }

/* ============================ RECIPE ============================ */
.topbar {
  max-width: 880px; margin: 0 auto; padding: 22px 32px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.back { text-decoration: none; color: var(--muted); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; }
.back:hover { color: var(--accent); }
.topbar-actions { display: flex; gap: 8px; }
.wakelock.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.media.hero-media {
  width: 100%; aspect-ratio: 16 / 7; border-radius: var(--radius); overflow: hidden;
  margin: 6px 0 30px; background: var(--paper-2); border: 1px solid var(--line);
}
.media.hero-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.kicker { margin: 0 0 6px; font-size: .72rem; letter-spacing: .26em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.recipe h1 { font-size: clamp(2.4rem, 6vw, 3.8rem); line-height: 1.0; margin: 0 0 22px; }

/* Badges row */
.badges-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 26px; }
.health-badge { font-weight: 600; text-transform: uppercase; letter-spacing: .08em; border-color: var(--accent); color: var(--accent); }
.health-badge.leicht { border-color: #4f9e6a; color: #4f9e6a; }
.health-badge.ausgewogen { border-color: #b58a1f; color: #b58a1f; }

/* Stat row — wie die Nährwert-Reihe: großer Wert, kleines Label, Haarlinien */
.stats {
  display: flex; flex-wrap: wrap; border-top: 1.5px solid var(--rule);
  border-bottom: 1.5px solid var(--rule); margin: 0 0 22px;
}
.stat {
  flex: 1; min-width: 110px; display: flex; flex-direction: column; justify-content: center;
  gap: 7px; padding: 16px 22px; border-right: 1px solid var(--line); min-height: 78px;
}
.stat:first-child { padding-left: 0; }
.stat:last-child { border-right: none; padding-right: 0; }
.stat-val { font-family: var(--font-display); font-weight: 900; font-size: 1.45rem; line-height: 1.1; }
.stat-label { font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

/* Scaler stepper im Portionen-Block */
.stat-scaler .stat-val { display: flex; }
.scaler-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; width: fit-content; }
.scaler-dec, .scaler-inc { border: none; background: none; color: var(--accent); font-size: 1.05rem; width: 28px; height: 30px; cursor: pointer; line-height: 1; }
.scaler-dec:hover, .scaler-inc:hover { background: var(--accent-soft); }
.scaler-input { width: 34px; text-align: center; border: none; background: none; font-family: var(--font-display); font-weight: 900; font-size: 1.25rem; color: var(--ink); padding: 2px 0; }
.scaler-input:focus { outline: none; }
.scaler-total { font-size: .78rem; color: var(--muted); letter-spacing: .01em; }
.scaler-total-num { font-variant-numeric: tabular-nums; }

/* Meta line */
.meta-line { display: flex; flex-wrap: wrap; gap: 20px; margin: 0 0 22px; color: var(--ink-soft); font-size: .82rem; }
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.meta-item .ic { color: var(--muted); }
.meta-item.stars { color: var(--accent); }

.scaler-extra { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 0 0 6px; }
.scaler-reset { border: 1px solid var(--line); background: none; color: var(--ink-soft); border-radius: 999px; padding: 5px 12px; font-size: .72rem; letter-spacing: .06em; cursor: pointer; }
.scaler-reset:hover { border-color: var(--accent); color: var(--accent); }
.scaler-hint { font-size: .8rem; color: var(--muted); }
.qty-demo { color: var(--accent); font-weight: 600; }

/* Nutrition — hairline row, no boxes */
.nutrition { margin: 48px 0 8px; }
.nutri-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.nutri-head h2 { font-family: var(--font-body); font-weight: 600; font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin: 0; }
.nutri-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.nutri-opt { border: none; background: none; padding: 6px 14px; font-family: var(--font-body); font-size: .72rem; letter-spacing: .03em; color: var(--muted); cursor: pointer; transition: background .15s ease, color .15s ease; }
.nutri-opt + .nutri-opt { border-left: 1px solid var(--line); }
.nutri-opt:hover { color: var(--ink); }
.nutri-opt.is-active { background: var(--accent); color: var(--accent-ink); }
.nutri-mult { font-style: normal; }
.nutri-grid { display: flex; border-top: 1.5px solid var(--rule); margin-top: 16px; }
.nutri-card { flex: 1; padding: 26px 28px; border-right: 1px solid var(--line); }
.nutri-card:first-child { padding-left: 0; }
.nutri-card:last-child { border-right: none; padding-right: 0; }
.nutri-ic { display: none; }
.nutri-val { font-family: var(--font-display); font-weight: 900; font-size: 1.95rem; line-height: 1; display: block; }
.nutri-num { font-variant-numeric: tabular-nums; }
.nutri-label { font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 10px; display: block; }
.nutri-note { color: var(--muted); font-size: .74rem; margin: 14px 0 0; font-style: italic; }

/* ---- Content ---- */
.content { margin-top: 38px; }
/* Lesbare Zeilenlänge für Fließtext-Abschnitte (volle Breite nur fürs Raster) */
.content > p, .content > ul, .content > ol, .content > h2, .content > h3,
.content > blockquote, .content > hr { max-width: 42em; }

/* Zweispaltig: Zutaten (sticky) links, Zubereitung rechts */
.recipe-cols {
  display: grid; grid-template-columns: minmax(0, 290px) minmax(0, 1fr);
  gap: 8px 52px; align-items: start; margin: 8px 0;
}
.col-ingredients { position: sticky; top: 24px; }
.col-ingredients h2, .col-steps h2 { margin-top: 0; }
.col-steps { min-width: 0; }
/* Schritt-Überschriften "### N. Titel" → große Serif-Ziffer + Titel */
.step-head {
  display: flex; align-items: baseline; gap: 16px;
  font-family: var(--font-display); font-weight: 900; letter-spacing: -.01em;
  text-transform: none; color: var(--ink); font-size: 1.1rem;
  margin: 26px 0 8px;
}
.step-head:first-of-type { margin-top: 4px; }
.step-num { font-family: var(--font-display); font-weight: 900; font-size: 2.1rem; line-height: 1; color: var(--line); flex: none; }
.step-title { padding-top: .15em; }
/* Schritt-Listen ohne Aufzählungspunkte, ruhiger gesetzt */
.col-steps ul { list-style: none; padding-left: 0; }
.col-steps ul li { padding-left: 16px; position: relative; }
.col-steps ul li::before { content: "–"; position: absolute; left: 0; color: var(--muted); }
@media (max-width: 760px) {
  .recipe-cols { display: block; }
  .col-ingredients { position: static; }
}
.content h2 {
  font-family: var(--font-body); font-weight: 600;
  font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; color: var(--accent);
  margin: 44px 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.content h3 {
  font-family: var(--font-body); font-weight: 600;
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  margin: 24px 0 8px;
}
.content p { margin: 0 0 16px; }
.content ul, .content ol { margin: 12px 0 20px; }
.content ul { padding-left: 20px; }
.content li { margin: 6px 0; }

/* Intro blockquote = large serif with drop cap */
.content > blockquote:first-child {
  font-family: var(--font-display); font-weight: 400; font-style: normal;
  font-size: 1.5rem; line-height: 1.45; color: var(--ink); border: none;
  background: none; padding: 0; margin: 0 0 34px;
}
.content > blockquote:first-child::first-letter {
  float: left; font-weight: 900; font-size: 4em; line-height: .72;
  padding: .06em .1em 0 0; color: var(--accent);
}
/* Other blockquotes = accent rule */
.content blockquote {
  margin: 0 0 20px; padding: 6px 0 6px 20px; border-left: 2px solid var(--accent);
  font-style: italic; color: var(--ink-soft);
}
.content hr { border: none; border-top: 1px solid var(--line); margin: 32px 0; }
.content code { background: var(--paper-2); padding: 1px 6px; border-radius: 4px; font-size: .9em; }
.content a { color: var(--accent); text-underline-offset: 2px; }
/* Temperaturen im Text dezent hervorgehoben */
.temp { color: var(--accent); font-weight: 600; white-space: nowrap; }

/* Numbered steps as editorial numerals */
.content ol { list-style: none; counter-reset: step; padding-left: 0; }
.content ol > li {
  position: relative; padding-left: 62px; margin-bottom: 20px; min-height: 38px;
}
.content ol > li::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: -4px;
  font-family: var(--font-display); font-weight: 900; font-size: 2.1rem; line-height: 1;
  color: var(--line);
}

/* Ingredients: checkbox · name (links) · Menge (rechtsbündig) */
.content ul.ingredients { list-style: none; padding-left: 0; margin: 8px 0 22px; }
.ingredient { display: flex; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ing-check { align-self: center; width: 16px; height: 16px; flex: none; accent-color: var(--accent); cursor: pointer; }
.ing-name { flex: 1; min-width: 0; transition: opacity .15s ease; }
.ing-amt { flex: none; text-align: right; font-family: var(--font-display); font-weight: 600; color: var(--accent); white-space: nowrap; }
.ingredient.done .ing-name { text-decoration: line-through; opacity: .45; }
.ingredient.done .ing-amt { opacity: .4; }
.qty {
  cursor: text; font-family: var(--font-display); font-weight: 600;
  color: var(--accent); border-radius: 3px; padding: 0 2px; font-variant-numeric: tabular-nums;
}
.qty:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.qty:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--accent); }

.hint { margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

/* ---- Timer button ---- */
.timer-btn, .timer-btn-demo {
  display: inline-flex; align-items: center; gap: 3px; background: var(--accent-soft);
  color: var(--accent); border: none; border-bottom: 1px dashed var(--accent);
  border-radius: 3px; padding: 0 5px; font: inherit; font-size: .95em; cursor: pointer;
}
.timer-btn:hover { background: var(--accent); color: var(--accent-ink); }
.timer-btn-demo { cursor: default; }

/* ---- Timer panel ---- */
.timer-panel { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.timer-item { display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--paper); border-radius: 6px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.timer-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; min-width: 56px; }
.timer-label { font-size: .8rem; opacity: .8; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-cancel { margin-left: auto; background: transparent; border: none; color: inherit; cursor: pointer; font-size: 1rem; opacity: .7; }
.timer-cancel:hover { opacity: 1; }
.timer-item.done { background: var(--accent); color: var(--accent-ink); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.03); } }

/* ---- Responsive ---- */
@media (max-width: 700px) {
  main, .hero, .topbar { padding-left: 20px; padding-right: 20px; }
  .stats { flex-direction: column; }
  .stat { min-height: 0; width: 100%; padding: 14px 0; border-right: none; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: none; }
  .nutri-grid { flex-wrap: wrap; }
  .nutri-card { flex: 0 0 50%; padding: 22px 18px; border-bottom: 1px solid var(--line); }
  .nutri-card:nth-child(odd) { border-right: 1px solid var(--line); padding-left: 0; }
  .nutri-card:nth-last-child(-n+2) { border-bottom: none; }
  .nutri-card:last-child { padding-right: 18px; }
}
@media (max-width: 480px) {
  /* Mehr Seitenrand, damit die zwei Karten nebeneinander nicht am
     Bildschirmrand kleben, sondern mittig/eingerückt wirken. */
  main, .hero, .topbar { padding-left: 26px; padding-right: 26px; }
  .grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px 20px; }
  .card h3 { font-size: 1.1rem; }
}
