/* Plant Kitchen – ruhig, typografisch, wie ein Kochbuch.
   Farbe kommt nur über Rezeptfotos; die UI nutzt eine einzige gedämpfte Akzentfarbe. */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f6f3ed;
  --surface: #fbf9f5;
  --text: #1d1c1a;
  --muted: #6e6a62;
  --line: #e3ddd2;
  --accent: #5e6b3c;
  --accent-contrast: #fbf9f5;
  --accent-soft: #eceee3;
  --danger: #8a3b2e;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 6px;
  --tabbar: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151513;
    --surface: #1e1d1a;
    --text: #ece8e0;
    --muted: #a29d93;
    --line: #2e2c28;
    --accent: #a4ae7e;
    --accent-contrast: #151513;
    --accent-soft: #23261c;
    --danger: #d98a7a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151513;
  --surface: #1e1d1a;
  --text: #ece8e0;
  --muted: #a29d93;
  --line: #2e2c28;
  --accent: #a4ae7e;
  --accent-contrast: #151513;
  --accent-soft: #23261c;
  --danger: #d98a7a;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.55 var(--sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
}
body.guest { padding-bottom: 0; }

a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.4rem); letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1rem; }

.eyebrow {
  font: 600 0.72rem/1.4 var(--sans);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.serif { font-family: var(--serif); }
.nums { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.icon { width: 1.25rem; height: 1.25rem; flex: none; vertical-align: -0.25em; }

/* Kopfzeile und Navigation */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  max-width: 760px; margin: 0 auto; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font: 500 1.2rem/1 var(--serif);
  text-decoration: none; letter-spacing: 0.01em;
  margin-right: auto;
}
.nav-top { display: none; gap: 1.5rem; }
.nav-top a { text-decoration: none; color: var(--muted); font-size: 0.95rem; }
.nav-top a[aria-current="page"] { color: var(--text); }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.02em;
}
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar .icon { width: 1.4rem; height: 1.4rem; }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .nav-top { display: flex; }
}

.page { max-width: 760px; margin: 0 auto; padding: 28px 16px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head p { margin: 0.35rem 0 0; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
section + section { margin-top: 2.25rem; }

/* Buttons und Formulare */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 44px; padding: 0 1rem;
  font: 500 0.95rem/1 var(--sans); color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.05); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); padding: 0 0.6rem; }
.btn-quiet:hover { color: var(--text); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-icon { width: 44px; padding: 0; }
.btn[disabled] { opacity: 0.6; cursor: wait; }

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

.field { display: grid; gap: 0.35rem; margin-bottom: 1.1rem; }
.field label, .label { font-size: 0.875rem; font-weight: 500; }
.field .hint { font-size: 0.8rem; color: var(--muted); }
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; min-height: 44px; padding: 0.6rem 0.75rem;
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
textarea { min-height: 9rem; line-height: 1.6; resize: vertical; }
textarea.tall { min-height: 14rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 1.15rem; height: 1.15rem; margin: 0; }
input[type="file"] { font: inherit; font-size: 0.9rem; color: var(--muted); }

.search { position: relative; margin-bottom: 1rem; }
.search .icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 2.4rem; }

.inline-form { display: flex; gap: 0.5rem; }
.inline-form input { flex: 1; }

/* Meldungen */
.notice, .error-box {
  padding: 0.8rem 1rem; margin-bottom: 1.25rem; border-radius: var(--radius);
  background: var(--accent-soft); border-left: 3px solid var(--accent); font-size: 0.95rem;
}
.error-box { background: transparent; border: 1px solid var(--line); border-left: 3px solid var(--danger); }
.error-box ul { margin: 0; padding-left: 1.1rem; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty p { font-family: var(--serif); font-style: italic; font-size: 1.15rem; margin-bottom: 1.25rem; }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.tag {
  display: inline-block; padding: 0.2rem 0.65rem; font-size: 0.8rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; text-decoration: none;
}
.tag[aria-current="true"] { color: var(--text); border-color: var(--text); }

/* Rezeptliste */
.recipe-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.recipe-list li { border-bottom: 1px solid var(--line); }
.recipe-list a { display: flex; gap: 1rem; align-items: center; padding: 0.9rem 0; text-decoration: none; min-height: 64px; }
.recipe-list img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; flex: none; }
.recipe-list .title { font: 500 1.12rem/1.3 var(--serif); display: block; }
.recipe-list .meta { font-size: 0.85rem; color: var(--muted); }
.recipe-list li.match { display: flex; align-items: center; gap: 0.5rem; }
.recipe-list li.match > a:first-child { flex: 1; min-width: 0; }
.chips { margin-top: 1rem; }

/* Favoriten */
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.fav-toggle.on, .fav-mark { color: var(--accent); }
.fav-toggle.on svg, .fav-mark svg { fill: currentColor; }
.fav-mark svg { width: 0.95rem; height: 0.95rem; vertical-align: -0.1em; }
.tag .icon { width: 0.95rem; height: 0.95rem; vertical-align: -0.15em; }
.tag[aria-current="true"] .icon { fill: currentColor; }
.tag-form { width: 100%; align-items: center; padding: 0.4rem 0; }

/* Rezeptansicht */
.hero { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); margin-bottom: 1.5rem; display: block; }
.recipe-head { margin-bottom: 1.75rem; }
.recipe-head h1 { margin-bottom: 0.6rem; }
.lede { font: 400 1.12rem/1.55 var(--serif); color: var(--muted); margin: 0.5rem 0 1rem; }
.meta-line { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; color: var(--muted); font-size: 0.9rem; }
.meta-line span { display: inline-flex; align-items: center; gap: 0.35rem; }

.servings { display: flex; align-items: center; gap: 0.25rem; margin-bottom: 1rem; }
.servings .count { min-width: 6.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.servings .cook-link { margin-left: auto; }
.plan-quick { margin-bottom: 1rem; }
.plan-quick > summary { list-style: none; display: inline-flex; }
.plan-quick > summary::-webkit-details-marker { display: none; }
.plan-quick[open] > summary { margin-bottom: 0.75rem; }
.plan-quick form { padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

.ingredients { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.ingredients li {
  display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.75rem;
  padding: 0.45rem 0; border-bottom: 1px solid var(--line);
}
.ingredients .qty { font-variant-numeric: tabular-nums; font-weight: 500; }
.ingredients .note { color: var(--muted); }
.replaced { display: block; font-size: 0.8rem; color: var(--muted); }
.replaced::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 0.4rem; vertical-align: 0.1em; }
.group-title { font: italic 500 1.02rem/1.3 var(--serif); margin: 1.25rem 0 0.25rem; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.25rem 1fr; gap: 0.5rem; margin-bottom: 1.1rem; }
.steps li::before { content: counter(step); font: 500 1.25rem/1.3 var(--serif); color: var(--accent); }

.two-col { display: grid; gap: 2.25rem; }
.two-col > section + section, section.day + section.day { margin-top: 0; }
@media (min-width: 720px) {
  .two-col { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}

.footer-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }

/* Kochmodus */
body.guest .page:has(.cook) { padding-top: 12px; }
.cook-bar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.cook-heading { min-width: 0; }
.cook-title { font: 500 1.05rem/1.3 var(--serif); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cook-heading .small { margin: 0; }
.cook-step { padding-bottom: 1.5rem; }
.cook.js .cook-step { display: none; }
.cook.js .cook-step.active { display: block; }
.cook:not(.js) .cook-nav { display: none; }
.cook.js .cook-step > .eyebrow { display: none; }  /* steht schon in der Kopfzeile */
.cook-text { font: 400 clamp(1.45rem, 1.1rem + 1.8vw, 2.1rem)/1.45 var(--serif); margin: 0 0 1.5rem; }
.timer-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.ingredients.compact li { padding: 0.3rem 0; }
.timers { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.timers:empty { display: none; }
.timer { display: flex; align-items: center; gap: 0.75rem; padding: 0.25rem 0.25rem 0.25rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 0.9rem; }
.timer span { flex: 1; color: var(--muted); }
.timer strong { font-variant-numeric: tabular-nums; font-size: 1.1rem; font-weight: 600; }
.timer.done { border-color: var(--accent); background: var(--accent-soft); }
.timer.done strong { color: var(--accent); }
.cook-nav { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.cook-nav .btn { min-height: 56px; font-size: 1.05rem; }
.cook-nav .btn[disabled] { opacity: 0.4; cursor: default; }
@media (orientation: landscape) and (min-width: 640px) and (max-height: 600px) {
  .cook.js .cook-step.active:has(.compact) { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); column-gap: 2rem; }
  .cook-step .compact { grid-column: 2; grid-row: 1 / span 3; }
}

/* Menüplan */
.week-nav { display: flex; align-items: center; gap: 0.25rem; }
.day { padding: 1.1rem 0; border-top: 1px solid var(--line); scroll-margin-top: 1rem; }
.day-head { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.6rem; }
.day-head h2 { font-size: 1.2rem; }
.day.today .day-head h2 { color: var(--accent); }
.today-label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.meal { display: grid; grid-template-columns: 6.5rem 1fr auto; align-items: start; gap: 0.5rem; min-height: 44px; }
.meal-label { font-size: 0.8rem; color: var(--muted); padding-top: 0.7rem; }
.meal-entries { list-style: none; margin: 0; padding: 0; }
.meal-entries li { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; }
.meal-entries .entry-title { font-family: var(--serif); font-size: 1.05rem; }
.meal-entries .free { font-style: italic; color: var(--muted); }
.meal-entries .portion { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.meal-entries .edit { margin-left: auto; }

.pick-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.pick-list li { border-bottom: 1px solid var(--line); }
.pick-list button {
  width: 100%; min-height: 52px; padding: 0.6rem 0; text-align: left;
  font: 500 1.05rem/1.3 var(--serif); color: var(--text); background: none; border: 0; cursor: pointer;
}

/* Einkaufsliste */
.shop-group { margin-bottom: 1.5rem; }
.shop-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.shop-list li { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.shop-list label { flex: 1; display: flex; align-items: center; gap: 0.85rem; min-height: 52px; padding: 0.4rem 0; cursor: pointer; }
.shop-list input[type="checkbox"] { width: 1.35rem; height: 1.35rem; }
.shop-list .qty { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 0.35rem; }
.shop-list.done label { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted); }
.shop-form { margin-bottom: 1.75rem; }
details.generate { margin-bottom: 1.75rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 1rem; background: var(--surface); }
details.generate summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; font-weight: 500; }
details.generate[open] { padding-bottom: 1rem; }

details.pantry summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); font-size: 0.9rem; }
.pantry .shop-list li { justify-content: space-between; min-height: 48px; color: var(--muted); }

/* Reihenfolge der Kategorien */
.order-list { list-style: none; margin: 0 0 1rem; padding: 0; border-top: 1px solid var(--line); }
.order-list li { display: flex; align-items: center; justify-content: space-between; min-height: 48px; border-bottom: 1px solid var(--line); }
.order-list form { display: flex; }
.order-list .btn[disabled] { opacity: 0.25; cursor: default; }
.ingredient-form { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.ingredient-form select { width: auto; flex: 1; min-width: 11rem; }

/* Tabellen (Einstellungen) */
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 0.55rem 0.5rem 0.55rem 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.saved { font-size: 0.8rem; color: var(--accent); margin-left: 0.5rem; }

.token { font-family: ui-monospace, "SF Mono", Consolas, monospace; word-break: break-all; padding: 0.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.vegan-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; background: var(--surface); }
.vegan-card h3 { margin-bottom: 0.25rem; }
.choice { display: flex; align-items: center; gap: 0.6rem; min-height: 40px; }

.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login h1 { margin-bottom: 0.4rem; }
.login .lede { margin-bottom: 2rem; }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }

@media (max-width: 420px) {
  .ingredients li { grid-template-columns: 5.5rem 1fr; }
  .meal { grid-template-columns: 5.25rem 1fr auto; }
  .field-row { grid-template-columns: 1fr 1fr; }
}
