/* =========================================================
   Nedal's Hexenkessel — App Components
   Baut auf den Design-Tokens aus nedals-hexenkessel.css auf
   ========================================================= */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* Ensure [hidden] always wins over display:grid/flex from author CSS */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

img { display: block; max-width: 100%; }

button { cursor: pointer; font-family: inherit; }

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in oklch, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
}

.site-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 32px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg);
  line-height: 1;
  flex-shrink: 0;
}

.brand-text {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 500;
  font-size: 26px;
  letter-spacing: 0.04em;
  color: var(--fg);
  white-space: nowrap;
}

.brand-text em {
  font-style: normal;
  font-weight: inherit;
  color: inherit;
}

/* ============ Animated Cauldron ============ */
.cauldron .spoon {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: cauldron-stir 3.2s ease-in-out infinite;
}
@keyframes cauldron-stir {
  0%   { transform: rotate(-22deg) translateY(0); }
  25%  { transform: rotate(0deg)   translateY(-0.6px); }
  50%  { transform: rotate(22deg)  translateY(0); }
  75%  { transform: rotate(0deg)   translateY(0.4px); }
  100% { transform: rotate(-22deg) translateY(0); }
}

.cauldron .bubble {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: cauldron-bubble 2.6s ease-in infinite;
  opacity: 0;
}
.cauldron .b1 { animation-delay: 0s; }
.cauldron .b2 { animation-delay: 0.7s; }
.cauldron .b3 { animation-delay: 1.3s; }
.cauldron .b4 { animation-delay: 1.9s; }
@keyframes cauldron-bubble {
  0%   { transform: translateY(2px) scale(0.4); opacity: 0; }
  20%  { transform: translateY(0)    scale(1);  opacity: 0.95; }
  70%  { transform: translateY(-3px) scale(0.9); opacity: 0.55; }
  100% { transform: translateY(-6px) scale(0.3); opacity: 0; }
}

.cauldron .puff {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: cauldron-steam 4.2s ease-out infinite;
  opacity: 0;
}
.cauldron .p1 { animation-delay: 0s; }
.cauldron .p2 { animation-delay: 1.4s; }
.cauldron .p3 { animation-delay: 2.8s; }
@keyframes cauldron-steam {
  0%   { transform: translateY(2px)  scale(0.4); opacity: 0; }
  20%  { transform: translateY(-2px) scale(1);   opacity: 0.65; }
  100% { transform: translateY(-14px) scale(1.6); opacity: 0; }
}

/* Flammen */
.cauldron .flame {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: cauldron-flicker 0.55s ease-in-out infinite alternate;
}
.cauldron .f1 { animation-delay: 0s; }
.cauldron .f2 { animation-delay: 0.18s; }
.cauldron .f3 { animation-delay: 0.32s; }
@keyframes cauldron-flicker {
  0%   { transform: scaleY(0.78) scaleX(1.08); opacity: 0.78; }
  100% { transform: scaleY(1.12) scaleX(0.93); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .cauldron .spoon  { animation: none; transform: rotate(-10deg); }
  .cauldron .bubble { animation: none; opacity: 0.8; }
  .cauldron .puff   { animation: none; opacity: 0.5; }
  .cauldron .flame  { animation: none; opacity: 0.9; }
}

/* ============ Search ============ */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elev);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0 14px;
  height: 42px;
  transition: box-shadow var(--duration-fast), border-color var(--duration-fast);
  position: relative;
  min-width: 0;
}

/* Intentionally no focus-within style — search bar should not change visually on focus */

.search-wrap svg { color: var(--fg-muted); flex-shrink: 0; }

.search-input {
  flex: 1;
  min-width: 0; /* Default <input>-Min-Width verhindert sonst Shrinking */
  border: none;
  background: transparent;
  color: var(--fg);
  font-weight: 500;
  font-size: 14px;
  outline: none;
  padding: 0;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.search-input:focus,
.search-input:focus-visible { outline: none; box-shadow: none; }
.search-input::placeholder { color: var(--fg-muted); opacity: 0.7; font-weight: 400; }
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

.kbd-hint {
  font-weight: 600;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--violet-900);
  background: var(--yellow-100);
  flex-shrink: 0;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 200;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
  color: var(--fg);
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--divider);
  transition: background .1s;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover, .search-result-item[aria-selected="true"] {
  background: var(--bg-tint);
}

.search-result-item__title { font-weight: 600; flex: 1; }

.search-result-item__img {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-sunken);
}

.search-result-item__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-result-item__placeholder {
  font-size: 14px;
  color: var(--fg-faint);
}

/* ============ Header actions ============ */
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.iconbtn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.iconbtn:hover {
  color: var(--fg);
  background: var(--bg-tint);
}

.iconbtn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Theme toggle icon visibility */
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark  { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-light { display: none; }
  :root:not([data-theme="light"]) .theme-icon-dark  { display: block; }
}

/* ============ Segmented control ============ */
.seg {
  display: inline-flex;
  background: var(--bg-sunken);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.seg button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--duration-fast);
}

.seg button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--fg-on-accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ============ Tag filter row ============ */
.tag-bar {
  position: sticky;
  top: 71px;
  z-index: 20;
  background: color-mix(in oklch, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--divider);
}

.tag-bar-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 32px;
}

.tag {
  font-family: inherit;
  font-weight: 500;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--tag-bg);
  color: var(--tag-fg);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--duration-fast);
  text-decoration: none;
}

.tag:hover { filter: brightness(1.05); }

.tag[aria-pressed="true"],
.tag.active {
  background: var(--accent);
  color: var(--fg-on-accent);
  font-weight: 600;
}

.tag-count {
  font-weight: 400;
  font-size: 11px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.tag[aria-pressed="true"] .tag-count,
.tag.active .tag-count {
  color: var(--fg-on-accent);
  opacity: 0.75;
}

/* ============ Main column ============ */
.main-content {
  flex: 1;
  padding: 28px 32px 60px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--fg);
}

.section-head .count {
  font-weight: 500;
  font-size: 13px;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}

/* ============ Grid view ============ */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.tile {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-base), background var(--duration-fast);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.tile:hover {
  box-shadow: var(--shadow-md);
  background: var(--bg-tint);
}

.tile .photo {
  aspect-ratio: 4/3;
  display: flex;
  align-items: flex-end;
  padding: 10px;
  gap: 6px;
  flex-wrap: wrap;
  position: relative;
  background: var(--bg-sunken);
  overflow: hidden;
}

.tile .photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.05);
}

.tile .photo .title-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.015em;
  color: color-mix(in oklch, var(--violet-50) 85%, transparent);
  text-align: center;
  padding: 12px;
  line-height: 1.15;
  pointer-events: none;
}

.tile .chip {
  position: relative;
  z-index: 1;
  background: color-mix(in oklch, var(--bg-elev) 85%, transparent);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 11px;
  padding: 4px 9px;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.tile .info { padding: 14px 16px 16px; }

.tile h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--fg);
  text-wrap: balance;
}

.tile .meta {
  font-weight: 400;
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.tile .meta .sep { opacity: 0.45; }

/* ============ List view ============ */
.recipe-list {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  transition: background var(--duration-fast);
  text-decoration: none;
  color: inherit;
}

.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--bg-tint); }

.list-row .thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  flex: none;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--bg-sunken);
}

.list-row .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-row .thumb-initial {
  font-weight: 700;
  color: color-mix(in oklch, var(--violet-50) 85%, transparent);
  font-size: 18px;
  letter-spacing: -0.02em;
  text-align: center;
}

.list-row .row-body { flex: 1; min-width: 0; }

.list-row .title {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.list-row .meta {
  font-weight: 400;
  font-size: 12px;
  color: var(--fg-subtle);
  margin-top: 3px;
  display: flex;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.list-row .meta .sep { opacity: 0.4; }

.list-row .tags {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.list-row .tag {
  font-size: 11px;
  padding: 3px 9px;
  cursor: default;
  pointer-events: none;
}

/* ============ Buttons ============ */
.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn--primary {
  background: var(--accent);
  color: var(--fg-on-accent);
}
.btn--primary:hover { background: var(--accent-hover); }

.btn--secondary {
  background: var(--bg-elev);
  color: var(--fg);
  border: 1.5px solid var(--border-strong);
}
.btn--secondary:hover { background: var(--bg-tint); }

.btn--ghost {
  background: transparent;
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklch, var(--fg) 30%, transparent);
  text-underline-offset: 4px;
}
.btn--ghost:hover {
  background: var(--accent);
  color: var(--fg-on-accent);
  text-decoration-color: transparent;
}

.btn--success {
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
}

.btn--lg { font-size: 15px; padding: 13px 20px; }

/* ============ No Results ============ */
.no-results {
  padding: 60px 20px;
  text-align: center;
  color: var(--fg-faint);
  font-family: var(--font-body);
}

/* ============ Recipe Detail ============ */
.detail {
  max-width: 1240px;
  margin: 0 auto;
}

.crumbs {
  font-weight: 500;
  font-size: 12px;
  color: var(--fg-subtle);
  margin-bottom: 18px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.crumbs .sep { opacity: 0.4; }

.detail-hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 32px;
  align-items: end;
  margin-bottom: 32px;
}

@media (max-width: 800px) {
  .detail-hero { grid-template-columns: 1fr; }
}

.detail-photo {
  aspect-ratio: 4/3;
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-sunken);
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.detail-photo.drag-over {
  box-shadow: 0 0 0 3px var(--violet-400), inset 0 0 0 2px var(--violet-400);
}

.detail-photo .drop-hint {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: color-mix(in oklch, var(--violet-900) 75%, transparent);
  color: var(--violet-100);
  font-weight: 600;
  font-size: 15px;
  pointer-events: none;
  border-radius: var(--radius-xl);
  z-index: 10;
}

.detail-photo.drag-over .drop-hint {
  display: flex;
}

.detail-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.05);
}

.detail-photo .title-fallback {
  font-weight: 700;
  font-size: 36px;
  letter-spacing: -0.025em;
  color: var(--fg-muted);
  text-align: center;
  padding: 24px;
  line-height: 1.1;
  position: relative;
}

.detail-title-area .eyebrow {
  font-weight: 600;
  font-size: 12px;
  color: var(--fg-subtle);
  margin-bottom: 10px;
}

.detail h1 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(38px, 5vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.005em;
  margin-bottom: 14px;
}

.detail-description {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--fg-muted);
  max-width: 480px;
  margin-bottom: 18px;
  line-height: 1.55;
}

.detail-meta {
  display: flex;
  gap: 14px;
  align-items: center;
  font-weight: 500;
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 20px;
  font-variant-numeric: tabular-nums;
}
.detail-meta .sep { opacity: 0.4; }

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

.detail-tags--above {
  margin-bottom: 14px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
  align-items: center;
}

.recipe-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-subtle);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  transition: color var(--duration-fast), background var(--duration-fast);
}
.recipe-source:hover {
  color: var(--fg);
  background: var(--bg-tint);
}

/* Detail body: two-column on landscape */
.detail-body {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 48px;
  align-items: start;
}

@media (max-width: 800px) {
  .detail-body { grid-template-columns: 1fr; gap: 32px; }
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}

.panel h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: 0.025em;
  margin-bottom: 14px;
}

/* Ingredients */
.scaler {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 14px;
}

.scaler .btn-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--fg);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}

.scaler .btn-circle:hover {
  background: var(--bg-tint);
}

.scaler .portions {
  font-weight: 700;
  font-size: 18px;
  color: var(--fg);
  min-width: 28px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.scaler .portions-label { margin-left: 6px; }

.ingredients {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ingredients li {
  padding: 0;
  border-bottom: 1px dashed var(--divider);
  font-size: 15px;
}

.ingredients li:last-child { border-bottom: none; }

.ingredients .ing-row {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  cursor: pointer;
  user-select: none;
}

.ingredients .ing-row:hover .name {
  color: var(--accent);
}

.ingredients .qty {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  font-size: 14px;
}

.ingredients .name {
  color: var(--fg);
  transition: color var(--duration-fast);
}

/* Custom checkbox — passt sich automatisch ans Theme an */
.ingredients input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-elev);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: background var(--duration-fast), border-color var(--duration-fast);
  flex-shrink: 0;
}

.ingredients input[type="checkbox"]::before {
  content: '';
  width: 12px;
  height: 12px;
  background-color: var(--accent);
  clip-path: polygon(14% 44%, 0 60%, 40% 100%, 100% 20%, 86% 6%, 38% 70%);
  transform: scale(0);
  transition: transform var(--duration-fast);
}

.ingredients input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--bg-elev);
}

.ingredients input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.ingredients input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Steps */
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  align-items: start;
  cursor: pointer;
}

.steps li::before {
  content: counter(step);
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  color: var(--fg-on-accent);
  background: var(--accent);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.01em;
}

.steps .step-body {
  font-weight: 400;
  font-size: 17px;
  line-height: 1.55;
  padding-top: 6px;
}

.steps li.done .step-body {
  color: var(--fg-faint);
  text-decoration: line-through;
  text-decoration-color: var(--fg-faint);
}

.steps li.done::before {
  background: var(--bg-sunken);
  color: var(--fg-faint);
}

/* Zubereitung heading */
.zubereitung-heading {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  margin-bottom: 18px;
  letter-spacing: 0.025em;
}

/* Nutrition box */
.nutri {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.nutri .cell {
  background: var(--bg-sunken);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.nutri .label {
  font-weight: 500;
  font-size: 13px;
  color: var(--fg-subtle);
}

.nutri .val {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nutri .val .unit {
  font-size: 11px;
  color: var(--fg-subtle);
}

/* Notes block */
.notes {
  margin-top: 22px;
  background: var(--bg-elev);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
}

.notes-heading {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  font-weight: 400;
  color: var(--fg);
  margin-bottom: 8px;
  line-height: 1.1;
}

.notes textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--fg);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  min-height: 60px;
}

.notes textarea::placeholder { color: var(--fg-faint); }

.notes-body {
  font-size: var(--fs-sm);
  line-height: var(--lh-loose);
}

/* Foto-Erinnerung */
.foto-reminder {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-sunken);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  font-weight: 600;
  color: var(--fg-muted);
  transition: border-color 0.15s, background 0.15s;
}

.foto-reminder.drag-over {
  border-color: var(--violet-400);
  background: color-mix(in oklch, var(--violet-900) 30%, var(--bg-sunken));
}

/* ============ Cook Mode ============ */
.cook {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.cook-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  border-bottom: 1px solid var(--divider);
}

.cook-head-left {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.cook-head .title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: 0.025em;
}

.cook-progress {
  font-weight: 500;
  font-size: 13px;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}

/* Body: 2 Spalten — Zutaten | Schritte */
.cook-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

/* --- Zutaten-Sidebar --- */
.cook-ings {
  border-right: 1px solid var(--divider);
  background: var(--bg-sunken);
  padding: 32px 28px;
  overflow-y: auto;
}
.cook-ings h3 { margin-bottom: 4px; }
.cook-ings-meta {
  font-size: 13px;
  color: var(--fg-subtle);
  margin-bottom: 18px;
}
.cook-ings-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cook-ings-list li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  transition: background .12s;
}
.cook-ings-list li:hover { background: var(--bg-tint); }
.cook-ings-list li .qty {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--fg);
  font-size: 14px;
}
.cook-ings-list li .name { color: var(--fg); font-weight: 500; }
.cook-ings-list li.done { opacity: 0.4; }
.cook-ings-list li.done .name {
  text-decoration: line-through;
  text-decoration-color: var(--fg-muted);
}

/* --- Schritte (Hauptspalte) --- */
.cook-steps {
  overflow-y: auto;
  padding: 40px 56px 80px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.cook-step {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 20px;
  align-items: start;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all .25s ease;
  border: 1px solid transparent;
}
.cook-step-num {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex: none;
  transition: all .25s ease;
}
.cook-step-body {
  font-weight: 500;
  line-height: 1.4;
  text-wrap: pretty;
  transition: all .25s ease;
}

/* --- past --- */
.cook-step--past .cook-step-num {
  width: 36px; height: 36px;
  font-size: 16px;
  background: var(--bg-tint);
  color: var(--fg-muted);
}
.cook-step--past .cook-step-body {
  font-size: 15px;
  color: var(--fg-muted);
  opacity: 0.65;
}
.cook-step--past:hover { background: var(--bg-tint); }

/* --- upcoming --- */
.cook-step--upcoming .cook-step-num {
  width: 36px; height: 36px;
  font-size: 16px;
  background: var(--bg-tint);
  color: var(--fg-muted);
}
.cook-step--upcoming .cook-step-body {
  font-size: 16px;
  color: var(--fg-muted);
}
.cook-step--upcoming:hover { background: var(--bg-tint); }

/* --- active: enlarged with accent --- */
.cook-step--active {
  grid-template-columns: 80px 1fr;
  background: var(--bg-elev);
  border-color: var(--border);
  box-shadow: var(--shadow-md);
  padding: 28px 32px;
  scroll-margin-top: 32px;
}
.cook-step--active .cook-step-num {
  width: 64px; height: 64px;
  font-size: 28px;
  background: var(--accent);
  color: var(--fg-on-accent);
}
.cook-step--active .cook-step-body {
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--fg);
  font-weight: 500;
  text-wrap: balance;
}

/* --- Finish card --- */
.cook-finish {
  margin-top: 8px;
  padding: 20px 22px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--fg-muted);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cook-finish-inner {
  text-align: center;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  font-size: 18px;
}

/* --- Bottom Nav --- */
.cook-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 18px 32px 24px;
  border-top: 1px solid var(--divider);
  background: var(--bg);
}
.cook-nav > .btn:first-child { justify-self: start; }
.cook-nav > .btn:last-child  { justify-self: end; }
.cook-nav .btn { padding: 12px 22px; font-size: 14px; }
.cook-nav-counter {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 18px;
  color: var(--fg);
}
.cook-nav-sep { color: var(--fg-subtle); font-weight: 400; }
.cook-nav-total { color: var(--fg-subtle); font-weight: 500; }

/* Cook Mode: mobile — single column, ingredients hidden */
@media (max-width: 800px) {
  .cook-body {
    grid-template-columns: 1fr;
  }
  .cook-ings { display: none; }
  .cook-steps { padding: 24px 20px 60px; }
  .cook-step--active { padding: 20px 18px; }
  .cook-step--active .cook-step-body { font-size: clamp(18px, 4vw, 24px); }
  .cook-head { padding: 14px 16px; }
  .cook-nav { padding: 14px 16px 20px; }
}

/* Cook Mode hidden state */
.cook[hidden] { display: none; }

/* ============ Placeholder Photo Gradients ============ */
.ph-1 { background: linear-gradient(135deg, oklch(82% 0.110 60), oklch(70% 0.130 30)); }
.ph-2 { background: linear-gradient(135deg, oklch(78% 0.140 90), oklch(64% 0.140 60)); }
.ph-3 { background: linear-gradient(135deg, oklch(72% 0.120 25), oklch(58% 0.140 350)); }
.ph-4 { background: linear-gradient(135deg, oklch(76% 0.110 150), oklch(60% 0.120 180)); }
.ph-5 { background: linear-gradient(135deg, oklch(78% 0.130 80), oklch(64% 0.150 50)); }
.ph-6 { background: linear-gradient(135deg, oklch(75% 0.125 110), oklch(60% 0.140 90)); }
.ph-7 { background: linear-gradient(135deg, oklch(74% 0.110 320), oklch(58% 0.140 290)); }
.ph-8 { background: linear-gradient(135deg, oklch(80% 0.110 50), oklch(66% 0.140 25)); }
.ph-9 { background: linear-gradient(135deg, oklch(72% 0.130 140), oklch(56% 0.140 120)); }
.ph-10 { background: linear-gradient(135deg, oklch(70% 0.140 35), oklch(54% 0.150 15)); }
.ph-11 { background: linear-gradient(135deg, oklch(76% 0.100 200), oklch(62% 0.130 230)); }
.ph-12 { background: linear-gradient(135deg, oklch(75% 0.135 70), oklch(60% 0.150 45)); }
.ph-default { background: var(--bg-sunken); }

/* ============ SVG Icon (inline) ============ */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
}

.icon svg {
  width: 100%;
  height: 100%;
}

/* ============ Mobile ============ */
@media (max-width: 600px) {
  .site-header-inner {
    padding: 12px 16px;
    gap: 12px;
  }

  .brand-text { display: none; }

  .main-content {
    padding: 16px 16px 48px;
  }

  .tag-bar-inner {
    padding-block: 10px;
    padding-left: 16px;
    padding-right: 16px;
  }


  .detail-hero {
    gap: 20px;
  }

  .detail h1 {
    font-size: 32px;
  }

  .nutri {
    grid-template-columns: repeat(2, 1fr);
  }

  .seg button {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Header-Actions auf Mobile: alle Buttons als Icon-only, Text einklappen.
     SVGs haben width/height-Attribute und bleiben sichtbar bei font-size: 0. */
  .header-actions { gap: 4px; }

  #add-recipe-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 0;
    gap: 0;
    justify-content: center;
  }
  #add-recipe-btn svg { width: 16px; height: 16px; }

  .seg button {
    padding: 8px;
    gap: 0;
    font-size: 0;
  }
  .seg button svg { width: 16px; height: 16px; }

  /* ⌘K-Hint hat auf Mobile keine Funktion und nimmt Platz weg */
  .kbd-hint { display: none; }
}

/* ── Login-Page ──────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* Ambient-Background: zwei langsam driftende, radiale Farbblobs in Palette-Tönen.
   Pseudoelemente, kein zusätzliches DOM. blur sorgt für weiches Glühen. */
.login-page::before,
.login-page::after {
  content: '';
  position: absolute;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}
.login-page::before {
  background:
    radial-gradient(38% 38% at 22% 30%, color-mix(in oklch, var(--violet-500) 60%, transparent), transparent 70%),
    radial-gradient(32% 32% at 78% 70%, color-mix(in oklch, var(--plum) 55%, transparent), transparent 70%);
  animation: login-bg-drift-a 28s ease-in-out infinite alternate;
}
.login-page::after {
  background:
    radial-gradient(30% 30% at 70% 20%, color-mix(in oklch, var(--yellow-100) 45%, transparent), transparent 70%),
    radial-gradient(36% 36% at 30% 80%, color-mix(in oklch, var(--violet-700) 50%, transparent), transparent 70%);
  animation: login-bg-drift-b 36s ease-in-out infinite alternate;
  opacity: 0.45;
}
@keyframes login-bg-drift-a {
  from { transform: translate(-4%, -3%) scale(1);    }
  to   { transform: translate( 5%,  4%) scale(1.08); }
}
@keyframes login-bg-drift-b {
  from { transform: translate( 4%,  3%) scale(1.04); }
  to   { transform: translate(-5%, -4%) scale(1);    }
}

[data-theme="dark"] .login-page::before { opacity: 0.40; }
[data-theme="dark"] .login-page::after  { opacity: 0.30; }

@media (prefers-reduced-motion: reduce) {
  .login-page::before,
  .login-page::after { animation: none; }
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 44px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  text-align: center;
}

.login-brand {
  justify-content: center;
  margin: 0 0 24px;
  pointer-events: none;
}

/* Desktop/Tablet: Logo oben, Wortmarke darunter (Brand-Stack). Mobile bleibt
   horizontal kompakt, damit oben kein Platz unnötig verbraten wird. */
@media (min-width: 600px) {
  .login-brand {
    flex-direction: column;
    gap: 14px;
  }
  .login-brand .brand-text {
    font-size: 32px;
  }
}

.login-welcome {
  margin: 12px 0 24px;
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 0.02em;
  line-height: 1.45;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.login-form label {
  font-size: 14px;
  color: var(--fg-subtle);
}

.login-form input[type="password"] {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
}

.login-form input[type="password"]:focus {
  outline: 2px solid var(--violet-500);
  outline-offset: 2px;
}

.login-form button {
  margin-top: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--violet-700);
  color: white;
  font-size: 16px;
  cursor: pointer;
}

.login-form button:hover {
  background: var(--violet-800);
}

.login-error {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid color-mix(in oklch, var(--rust) 55%, transparent);
  background: color-mix(in oklch, var(--rust) 14%, transparent);
  color: var(--rust);
  font-size: 14px;
  font-weight: 500;
}

/* Logout-Button in Top-Nav */
.logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.logout-btn:hover {
  background: var(--bg-elev);
}

/* ============ Voice Search Button ============ */
.voice-btn {
  background: none;
  border: none;
  color: var(--fg-subtle);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.voice-btn:hover { color: var(--fg); background: var(--bg-elev); }
.voice-btn--active { color: var(--accent) !important; animation: voice-pulse 1s ease-in-out infinite; }
@keyframes voice-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ============ Add-Recipe Button (small) ============ */
.btn--sm {
  font-size: 13px;
  padding: 6px 12px;
  gap: 5px;
  height: 32px;
}

/* ============ Modals / Dialogs ============ */
.recipe-dialog {
  background: var(--bg-elev);
  border: 1px solid var(--divider);
  border-radius: 16px;
  padding: 0;
  width: min(680px, 95vw);
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
  color: var(--fg);
}
.recipe-dialog::backdrop {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--divider);
  position: sticky;
  top: 0;
  background: var(--bg-elev);
  z-index: 1;
}
.dialog-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
.dialog-close {
  background: none;
  border: none;
  color: var(--fg-subtle);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.dialog-close:hover { background: var(--bg); color: var(--fg); }

.dialog-tabs {
  display: flex;
  gap: 0;
  padding: 0 24px;
  border-bottom: 1px solid var(--divider);
}
.dialog-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--fg-subtle);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 16px 10px;
  cursor: pointer;
  margin-bottom: -1px;
}
.dialog-tab:hover { color: var(--fg); }
.dialog-tab.active { color: var(--fg); border-bottom-color: var(--accent); }

.dialog-tab-content { padding: 24px; }
.dialog-hint {
  color: var(--fg-subtle);
  font-size: 14px;
  margin: 0 0 16px;
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--divider);
  position: sticky;
  bottom: 0;
  background: var(--bg-elev);
}

/* ============ Recipe Form ============ */
.recipe-form { }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 0 24px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field--wide { grid-column: 1 / -1; }

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
.form-hint {
  font-weight: 400;
  color: var(--fg-subtle);
}

.form-field input,
.form-field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  width: 100%;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
}
.form-field input:focus,
.form-field textarea:focus { border-color: var(--accent); }

/* Fehlerhafte Felder — Design-System --rust.
   :user-invalid greift erst nach User-Interaktion (kein "alles rot" beim Öffnen). */
.form-field input:user-invalid,
.form-field textarea:user-invalid,
.form-field input[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
  border-color: var(--rust);
  background: color-mix(in oklch, var(--rust) 8%, var(--bg-elev));
}
.form-field input:user-invalid:focus,
.form-field textarea:user-invalid:focus,
.form-field input[aria-invalid="true"]:focus,
.form-field textarea[aria-invalid="true"]:focus {
  border-color: var(--rust);
  outline: 2px solid color-mix(in oklch, var(--rust) 30%, transparent);
  outline-offset: 0;
}
.form-field:has(:user-invalid) > label,
.form-field:has([aria-invalid="true"]) > label {
  color: var(--rust);
}

.form-error {
  display: block;
  flex: 1;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid color-mix(in oklch, var(--rust) 55%, transparent);
  background: color-mix(in oklch, var(--rust) 14%, transparent);
  color: var(--rust);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}
.form-error[hidden] { display: none; }

@media (max-width: 540px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-field--wide { grid-column: 1; }
  .recipe-dialog { border-radius: 12px 12px 0 0; align-self: flex-end; }
}

/* ============ Notes Editor ============ */
.notes-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}
.notes-edit-btn {
  background: none;
  border: none;
  color: var(--fg-subtle);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}
.notes-edit-btn:hover { background: var(--bg-elev); color: var(--fg); }

.notes-empty {
  color: var(--fg-subtle);
  font-size: 14px;
  font-style: italic;
}

.notes-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.notes-textarea:focus { border-color: var(--accent); }

.notes-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

/* ============ Foto Upload ============ */
.foto-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--fg-subtle);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  transition: color 0.15s, border-color 0.15s;
}
.foto-upload-label:hover {
  color: var(--fg);
  border-color: var(--accent);
}
.foto-upload-status {
  font-size: 13px;
  color: var(--fg-subtle);
  margin-left: 8px;
}
