/* =========================================================================
   Kochbuch – Stylesheet
   Modernes CSS ohne Build-Schritt: Custom Properties, light-dark(), Nesting,
   :has(), Container Queries, Cascade Layers, View Transitions.
   ========================================================================= */

@layer reset, base, layout, components, pages, utilities, print;

@view-transition { navigation: auto; }

/* ---------- Design-Tokens ---------- */
@layer base {
  :root {
    color-scheme: light dark;

    --paper:     light-dark(#ffffff, #111113);
    --paper-2:   light-dark(#f5f5f6, #18181b);
    --surface:   light-dark(#ffffff, #1b1b1e);
    --surface-2: light-dark(#f4f4f5, #26262a);
    --ink:       light-dark(#18181b, #f4f4f5);
    --ink-2:     light-dark(#52525b, #d4d4d8);
    --muted:     light-dark(#71717a, #a1a1aa);
    --line:      light-dark(#e7e7ea, #2e2e33);
    --line-2:    light-dark(#d4d4d8, #3f3f46);

    --accent:      light-dark(#dc2626, #ef4444);
    --accent-ink:  #ffffff;
    --accent-soft: light-dark(#fee2e2, #3b1517);
    --herb:        light-dark(#3f7a4c, #7fc28c);
    --herb-soft:   light-dark(#e1efe2, #1f3324);
    --amber:       light-dark(#a86a06, #f0b54a);
    --amber-soft:  light-dark(#f8ecd2, #3a2e15);
    --danger:      light-dark(#b42318, #ff8a7a);
    --danger-soft: light-dark(#fbe4e1, #3d1f1b);
    --star:        light-dark(#e09a12, #f5b93c);

    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Source Serif Pro", Georgia, serif;
    --font-display: var(--font-serif);
    --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

    --radius-sm: .5rem;
    --radius: .875rem;
    --radius-lg: 1.25rem;
    --shadow-sm: 0 1px 2px light-dark(rgb(60 40 20 / .06), rgb(0 0 0 / .3));
    --shadow: 0 1px 2px light-dark(rgb(60 40 20 / .05), rgb(0 0 0 / .25)), 0 8px 24px -8px light-dark(rgb(60 40 20 / .14), rgb(0 0 0 / .5));
    --shadow-lg: 0 24px 48px -16px light-dark(rgb(60 40 20 / .25), rgb(0 0 0 / .6));
    --accent-2: var(--herb);
    --grad: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 60%, var(--amber)));
    --hero-overlay: linear-gradient(to top, rgb(12 8 6 / .82) 0%, rgb(12 8 6 / .45) 45%, rgb(12 8 6 / .05) 80%);
    --display-weight: 700;
    --ring: 0 0 0 3px color-mix(in oklab, var(--accent) 35%, transparent);

    --wrap: 76rem;
    --gutter: clamp(1rem, 3vw, 2rem);
    --header-h: 4rem;
    --ease: cubic-bezier(.2, .7, .2, 1);
  }
  :root[data-theme="light"] { color-scheme: light; }
  :root[data-theme="dark"]  { color-scheme: dark; }
}

/* ---------- Reset ---------- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; hanging-punctuation: first last; }
  body { min-height: 100dvh; line-height: 1.6; -webkit-font-smoothing: antialiased; }
  img, picture, video, svg, iframe { display: block; max-width: 100%; }
  img, video { height: auto; }
  input, button, textarea, select { font: inherit; color: inherit; }
  p, h1, h2, h3, h4, li, dd, figcaption { overflow-wrap: break-word; }
  h1, h2, h3, h4 { text-wrap: balance; }
  p { text-wrap: pretty; }
  button { cursor: pointer; }
  [hidden] { display: none !important; }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    @view-transition { navigation: none; }
  }
}

/* ---------- Basis ---------- */
@layer base {
  html { scroll-padding-top: calc(var(--header-h) + 1rem); }
  body {
    font-family: var(--font-sans);
    font-size: clamp(1rem, .96rem + .2vw, 1.0625rem);
    color: var(--ink);
    background: var(--paper);
    accent-color: var(--accent);
  }
  h1, h2, h3 { font-family: var(--font-display); font-weight: var(--display-weight); line-height: 1.15; letter-spacing: -.015em; }
  h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem); }
  h2 { font-size: clamp(1.35rem, 1.15rem + .8vw, 1.75rem); }
  h3 { font-size: 1.2rem; }
  h4 { font-size: 1rem; font-weight: 650; }
  a { color: var(--accent); text-decoration-thickness: .08em; text-underline-offset: .18em; }
  a:hover { text-decoration-thickness: .14em; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
  ::selection { background: var(--accent-soft); }
  code { font-family: var(--font-mono); font-size: .875em; background: var(--surface-2); padding: .1em .35em; border-radius: .3em; }
  hr { border: 0; border-top: 1px solid var(--line); }
  .icon { width: 1.15em; height: 1.15em; flex: none; }

  /* Formularelemente (im Basis-Layer, damit Komponenten sie überschreiben) */
  input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"])), select, textarea {
    width: 100%; min-height: 2.75rem; padding: .6rem .8rem;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
    &::placeholder { color: color-mix(in oklab, var(--muted) 80%, transparent); }
    &:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
    &[aria-invalid="true"] { border-color: var(--danger); }
  }
  textarea { resize: vertical; field-sizing: content; min-height: 5rem; line-height: 1.5; }
  select {
    appearance: none; padding-right: 2.2rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 1.1rem) 52%, calc(100% - .75rem) 52%; background-size: .35rem .35rem; background-repeat: no-repeat;
  }
  input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; }
}

/* ---------- Layout ---------- */
@layer layout {
  .wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
  .main { padding-block: clamp(1.5rem, 4vw, 3rem) 4rem; min-height: 60dvh; }

  .skip-link {
    position: absolute; left: 1rem; top: -4rem; z-index: 100;
    background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: var(--radius-sm);
    &:focus { top: 1rem; }
  }

  .site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in oklab, var(--paper) 82%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--line);
    view-transition-name: site-header;
  }
  .header-inner { display: flex; align-items: center; gap: 1rem; min-height: var(--header-h); }

  .brand {
    display: inline-flex; align-items: center; gap: .5rem;
    font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -.02em;
    color: var(--ink); text-decoration: none;
    .icon { width: 1.6rem; height: 1.6rem; color: var(--accent); }
  }

  .header-search {
    position: relative; flex: 1 1 14rem; max-width: 24rem;
    .icon { position: absolute; left: .8rem; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
    input {
      width: 100%; height: 2.5rem; padding: 0 1rem 0 2.4rem;
      border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
      &:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
    }
  }

  .main-nav {
    display: flex; gap: .25rem;
    a {
      position: relative; display: inline-flex; align-items: center; gap: .4rem;
      padding: .5rem .75rem; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: .95rem;
      &:hover { background: var(--surface-2); color: var(--ink); }
      &[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
    }
    .badge {
      min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem;
      display: grid; place-items: center; border-radius: 999px; font-size: .7rem; font-weight: 700;
      background: var(--accent); color: var(--accent-ink);
    }
  }
  .header-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }

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

  @media (max-width: 62rem) {
    .main-nav a span { display: none; }
    .main-nav .badge { position: absolute; top: .1rem; right: .05rem; }
    .main-nav a { padding: .55rem; }
    .new-recipe span { display: none; }
  }
  @media (max-width: 44rem) {
    .header-inner { flex-wrap: wrap; gap: .5rem; padding-block: .5rem; }
    .brand span { display: none; }
    .header-search { order: 10; flex-basis: 100%; max-width: none; }
    .main-nav { gap: 0; }
  }

  .site-footer {
    border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; padding-block: 2rem;
    a { color: var(--ink-2); }
  }
  .footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; p { display: flex; align-items: center; gap: .4rem; } }

  .two-col { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); align-items: start; margin-top: 1.5rem; }
  .stack { display: grid; gap: 1rem; }
  .stack-lg { display: grid; gap: 1.75rem; align-content: start; }
}

/* ---------- Komponenten ---------- */
@layer components {
  /* Buttons */
  .btn {
    --bg: var(--surface); --fg: var(--ink); --bd: var(--line-2);
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 2.5rem; padding: .5rem 1rem; border-radius: 999px;
    border: 1px solid var(--bd); background: var(--bg); color: var(--fg);
    font-weight: 600; font-size: .95rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
    transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
    &:hover { --bg: var(--surface-2); text-decoration: none; }
    &:active { transform: translateY(1px); }
    &:focus-visible { outline: none; box-shadow: var(--ring); }
    &:disabled { opacity: .5; pointer-events: none; }
  }
  .btn-primary { --bg: var(--accent); --fg: var(--accent-ink); --bd: transparent;
    &:hover { --bg: color-mix(in oklab, var(--accent) 88%, var(--ink)); } }
  .btn-secondary { --bg: var(--herb-soft); --fg: var(--herb); --bd: transparent;
    &:hover { --bg: color-mix(in oklab, var(--herb-soft) 85%, var(--herb)); } }
  .btn-ghost { --bg: transparent; --bd: transparent; --fg: var(--ink-2);
    &:hover { --bg: var(--surface-2); --fg: var(--ink); } }
  .btn-danger { --fg: var(--danger); &:hover { --bg: var(--danger-soft); --fg: var(--danger); } }
  .btn-sm { min-height: 2.1rem; padding: .35rem .8rem; font-size: .875rem; }
  .btn-icon { padding: 0; width: 2.5rem; min-width: 2.5rem; &.btn-sm { width: 2.1rem; min-width: 2.1rem; } }
  .btn-block { width: 100%; }

  .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
  .toolbar-sep { width: 1px; height: 1.5rem; background: var(--line); margin-inline: .25rem; }
  .toolbar form { display: contents; }

  /* Karten */
  .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1rem, 2.5vw, 1.5rem); box-shadow: var(--shadow-sm); }

  /* Avatare */
  .avatar {
    display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent); font-weight: 700; text-decoration: none; flex: none;
    list-style: none; cursor: pointer;
    &::-webkit-details-marker { display: none; }
  }
  .avatar-sm { width: 1.9rem; height: 1.9rem; font-size: .8rem; }
  .avatar-lg { width: 5rem; height: 5rem; font-size: 2rem; font-family: var(--font-display); }
  .avatar.status-yes { background: var(--herb-soft); color: var(--herb); }
  .avatar.status-maybe { background: var(--amber-soft); color: var(--amber); }
  .avatar.status-no { background: var(--surface-2); color: var(--muted); }

  /* Dropdown-Menüs auf Basis von <details> */
  .menu { position: relative; }
  .menu > summary { list-style: none; &::-webkit-details-marker { display: none; } }
  .menu-panel {
    position: absolute; right: 0; top: calc(100% + .4rem); z-index: 60; min-width: 14rem;
    display: grid; padding: .4rem; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
    animation: pop .14s var(--ease);
    a, button {
      display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .7rem; border-radius: var(--radius-sm);
      border: 0; background: none; color: var(--ink); text-decoration: none; font-size: .95rem; text-align: left;
      &:hover { background: var(--surface-2); }
      .icon { color: var(--muted); }
    }
    form { display: block; }
  }
  .share .menu-panel, .calendar-add .menu-panel { left: 0; right: auto; }
  .menu-head { display: grid; padding: .5rem .7rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; small { color: var(--muted); } }
  @keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

  /* Flash-Meldungen */
  .flash {
    display: flex; align-items: flex-start; gap: .7rem; padding: .85rem 1rem; margin-bottom: 1.25rem;
    border-radius: var(--radius); border: 1px solid; font-weight: 500;
    animation: pop .2s var(--ease);
    > .icon { margin-top: .2rem; }
    p { flex: 1; }
    a { font-weight: 700; }
  }
  .flash-success { background: var(--herb-soft); border-color: color-mix(in oklab, var(--herb) 30%, transparent); color: var(--herb); }
  .flash-info { background: var(--amber-soft); border-color: color-mix(in oklab, var(--amber) 30%, transparent); color: var(--amber); }
  .flash-error { background: var(--danger-soft); border-color: color-mix(in oklab, var(--danger) 30%, transparent); color: var(--danger); }
  .flash-close { border: 0; background: none; color: inherit; opacity: .6; padding: .15rem; border-radius: .3rem; &:hover { opacity: 1; } }

  /* Formulare */
  .field { display: grid; gap: .35rem; align-content: start; }
  .field label, .field-label { font-weight: 600; font-size: .9rem; display: flex; justify-content: space-between; gap: .5rem; align-items: baseline;
    small { font-weight: 400; color: var(--muted); } }
  .label-link { font-weight: 500; font-size: .85rem; }
  .field-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); }
  .field-error { color: var(--danger); font-size: .875rem; font-weight: 500; }
  .hp { position: absolute; left: -9999px; }
  .form-section { display: grid; gap: 1.1rem; > h2 { font-size: 1.3rem; } }
  .form-section-plain { padding: 0; }
  .form-actions {
    position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; justify-content: flex-end;
    padding: .9rem 0; margin-top: .5rem;
    background: linear-gradient(to top, var(--paper) 70%, transparent);
  }
  .form-status { margin-right: auto; color: var(--muted); font-size: .9rem; }

  /* Chips, Tags, Pills */
  .chips { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: 1rem; scrollbar-width: thin; }
  .chip {
    display: inline-flex; align-items: center; gap: .35rem; flex: none; padding: .45rem .9rem; border-radius: 999px;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: .92rem;
    small { color: var(--muted); font-weight: 500; }
    &:hover { border-color: var(--line-2); color: var(--ink); }
    &[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--paper); small { color: inherit; opacity: .7; } }
  }
  .tag-cloud { display: flex; flex-wrap: wrap; gap: .35rem .75rem; margin-block: .5rem 1.5rem; }
  .tag { color: var(--ink-2); text-decoration: none; font-size: .92rem; &:hover { color: var(--accent); } &[aria-current] { color: var(--accent); font-weight: 700; } }
  .pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
  .pill-yes { background: var(--herb-soft); color: var(--herb); }
  .pill-maybe { background: var(--amber-soft); color: var(--amber); }
  .pill-no { background: var(--danger-soft); color: var(--danger); }
  .eyebrow { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); text-decoration: none; }

  /* Sterne */
  .stars { display: inline-flex; gap: .05rem; color: var(--line-2);
    .icon { width: 1em; height: 1em; }
    .on { color: var(--star); .icon { fill: currentColor; } } }

  /* Rezeptkarten */
  .recipe-grid { display: grid; gap: clamp(1rem, 2vw, 1.5rem); grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr)); }
  .recipe-grid-compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); }
  .recipe-card {
    container-type: inline-size; position: relative; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease);
    &:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
    &:hover .card-media img { scale: 1.04; }
    &:has(.card-title a:focus-visible) { box-shadow: var(--ring); }
  }
  .card-media {
    position: relative; aspect-ratio: 3 / 2; overflow: hidden; background: var(--surface-2);
    img { width: 100%; height: 100%; object-fit: cover; transition: scale .5s var(--ease); }
  }
  .card-placeholder { display: grid; place-items: center; height: 100%; .icon { width: 3rem; height: 3rem; opacity: .45; } }
  .tone-0 { background: light-dark(#f6e0cf, #3a2a20); color: light-dark(#b8582d, #f0a27a); }
  .tone-1 { background: light-dark(#e3ecd9, #24301f); color: light-dark(#4c7a3c, #9fcf8c); }
  .tone-2 { background: light-dark(#f4e6c4, #382f1c); color: light-dark(#9b6d12, #e8bf6a); }
  .tone-3 { background: light-dark(#ecdcd8, #35241f); color: light-dark(#9a4a3a, #e59b88); }
  .tone-4 { background: light-dark(#dfe6e4, #222c2a); color: light-dark(#3f6b62, #8fc4b8); }
  .card-badge {
    position: absolute; left: .7rem; top: .7rem; display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700;
    background: rgb(0 0 0 / .62); color: #fff; backdrop-filter: blur(6px);
    .icon { width: .8rem; height: .8rem; fill: currentColor; }
  }
  .card-body { display: grid; gap: .35rem; padding: 1rem 1.1rem 1.15rem; flex: 1; align-content: start; }
  .card-body .eyebrow { position: relative; z-index: 2; width: fit-content; }
  .card-title {
    font-size: 1.2rem; line-height: 1.25;
    a { color: var(--ink); text-decoration: none; &::after { content: ""; position: absolute; inset: 0; z-index: 1; } &:focus-visible { outline: none; } }
  }
  .card-meta { display: flex; flex-wrap: wrap; gap: .3rem .9rem; color: var(--muted); font-size: .85rem;
    span { display: inline-flex; align-items: center; gap: .3rem; }
    .icon { width: .95rem; height: .95rem; } }
  .rating-inline .icon { color: var(--star); fill: currentColor; }
  .card-author { font-size: .85rem; color: var(--muted); margin-top: auto; padding-top: .3rem;
    a { position: relative; z-index: 2; color: var(--ink-2); text-decoration: none; &:hover { color: var(--accent); } } }
  @container (min-width: 24rem) { .card-title { font-size: 1.4rem; } }

  /* Leerzustände */
  .empty-state {
    display: grid; justify-items: center; gap: .6rem; text-align: center; padding: clamp(2rem, 6vw, 4rem) 1rem;
    color: var(--ink-2);
    p:last-child { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin-top: .4rem; }
    &.compact { padding: 2rem 1rem; }
  }
  .empty-icon { width: 3.5rem; height: 3.5rem; color: var(--accent); opacity: .7; }
  .error-code { font-family: var(--font-display); font-size: 5rem; line-height: 1; color: var(--accent); opacity: .5; }

  /* Seitenköpfe */
  .page-head { margin-bottom: 1.5rem; display: grid; gap: .4rem; }
  .page-head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; }
  .breadcrumbs { display: flex; gap: .4rem; font-size: .9rem; color: var(--muted); margin-bottom: .6rem;
    a { color: var(--ink-2); text-decoration: none; &:hover { color: var(--accent); } } }
  .lead { font-size: clamp(1.05rem, 1rem + .3vw, 1.25rem); color: var(--ink-2); max-width: 62ch; }
  .muted { color: var(--muted); }
  .small { font-size: .875rem; }

  /* Pagination */
  .pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 2.5rem; }
  .pagination-info { color: var(--muted); font-size: .9rem; }

  /* YouTube mit Zwei-Klick-Lösung */
  .yt {
    position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
    background: radial-gradient(circle at 30% 20%, #3b2a22, #120d0b 70%); color: #fff;
    iframe { width: 100%; height: 100%; border: 0; }
  }
  .yt-consent {
    position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .5rem;
    border: 0; background: none; color: inherit; text-align: center; padding: 1rem;
    small { opacity: .7; max-width: 32ch; }
    &:hover .yt-play { scale: 1.08; background: #e62117; }
  }
  .yt-play { display: grid; place-items: center; width: 4.2rem; height: 3rem; border-radius: .9rem; background: rgb(255 255 255 / .16); transition: scale .2s, background .2s;
    .icon { fill: currentColor; } }
  .yt-label { font-weight: 700; font-size: 1.05rem; }
  .yt-link { position: absolute; right: .7rem; bottom: .6rem; display: inline-flex; gap: .3rem; align-items: center; color: rgb(255 255 255 / .75); font-size: .8rem; text-decoration: none;
    .icon { width: .85rem; height: .85rem; } &:hover { color: #fff; } }
  .yt:has(iframe) .yt-link { display: none; }

  /* Medien */
  .media-figure {
    display: grid; gap: .5rem;
    img, video { width: 100%; border-radius: var(--radius); background: var(--surface-2); }
    video { aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
    figcaption { color: var(--muted); font-size: .9rem; font-style: italic; }
    a[data-lightbox] { cursor: zoom-in; display: block; width: fit-content; max-width: 100%; }
    .step-body &, .cook-inner & { img { width: auto; max-height: min(34rem, 75vh); } }
  }
  .prose {
    display: grid; gap: .8rem; max-width: 68ch;
    ul, ol { padding-left: 1.3rem; display: grid; gap: .3rem; }
    li::marker { color: var(--accent); }
    h4 { font-family: var(--font-display); font-size: 1.15rem; margin-top: .4rem; }
  }

  /* Lightbox */
  .lightbox {
    max-width: min(96vw, 110rem); max-height: 94dvh; padding: 0; border: 0; border-radius: var(--radius); background: transparent; overflow: visible;
    &::backdrop { background: rgb(10 8 6 / .88); backdrop-filter: blur(4px); }
    img { max-height: 94dvh; width: auto; margin-inline: auto; border-radius: var(--radius); }
    &[open] { animation: pop .2s var(--ease); }
  }
  .lightbox-close { position: absolute; top: -.75rem; right: -.75rem; z-index: 2; --bg: var(--surface); box-shadow: var(--shadow); }

  /* Segmented Control */
  .segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; border: 0; padding: 0; }
  .seg {
    input { position: absolute; opacity: 0; pointer-events: none; }
    span { display: grid; place-items: center; min-height: 2.75rem; padding: .4rem; border-radius: var(--radius-sm); border: 1px solid var(--line-2); font-weight: 600; font-size: .92rem; text-align: center; cursor: pointer; transition: all .15s; }
    &:hover span { border-color: var(--ink-2); }
    input:focus-visible + span { box-shadow: var(--ring); }
  }
  .seg-yes input:checked + span { background: var(--herb); border-color: var(--herb); color: var(--surface); }
  .seg-maybe input:checked + span { background: var(--amber); border-color: var(--amber); color: var(--surface); }
  .seg-no input:checked + span { background: var(--ink-2); border-color: var(--ink-2); color: var(--surface); }

  .copy-field { display: flex; gap: .5rem; input { font-family: var(--font-mono); font-size: .85rem; } }

  .table-wrap { overflow-x: auto; margin-inline: calc(-1 * clamp(1rem, 2.5vw, 1.5rem)); padding-inline: clamp(1rem, 2.5vw, 1.5rem); }
  .table { width: 100%; border-collapse: collapse; font-size: .92rem;
    th, td { padding: .65rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
    th { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
    .actions { text-align: right; white-space: nowrap; form { display: inline-block; } }
    tr.is-blocked td:first-child a { text-decoration: line-through; color: var(--muted); } }

  .link-list { list-style: none; padding: 0; display: grid; gap: .4rem; }
  .admin-list { list-style: none; padding: 0; margin-block: .75rem 1rem;
    li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
    a { color: var(--ink); } }
  .inline-form { display: flex; gap: .5rem; }

  .toast {
    position: fixed; left: 50%; bottom: 1.5rem; translate: -50% 0; z-index: 200;
    padding: .7rem 1.1rem; border-radius: 999px; background: var(--ink); color: var(--paper); font-weight: 600; font-size: .92rem;
    box-shadow: var(--shadow-lg); animation: toast .25s var(--ease);
  }
  @keyframes toast { from { opacity: 0; translate: -50% 1rem; } }
}

/* ---------- Seiten ---------- */
@layer pages {
  /* Start */
  .intro {
    display: grid; gap: 1.25rem; padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1.25rem, 4vw, 3rem); margin-bottom: 2rem;
    border-radius: var(--radius-lg);
    background:
      radial-gradient(circle at 92% 10%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 42%),
      radial-gradient(circle at 70% 120%, color-mix(in oklab, var(--herb) 20%, transparent), transparent 45%),
      var(--paper-2);
    border: 1px solid var(--line);
    h1 { max-width: 16ch; margin-block: .3rem .6rem; }
    &.photo-backdrop { border: 0; min-height: clamp(16rem, 32vw, 22rem); align-content: start; }
  }
  .intro-credit {
    position: absolute; right: 1rem; bottom: .9rem; display: inline-flex; align-items: center; gap: .35rem;
    padding: .3rem .75rem; border-radius: 999px; font-size: .8rem; font-weight: 600; text-decoration: none;
    color: #fff; background: rgb(0 0 0 / .35); backdrop-filter: blur(8px); border: 1px solid rgb(255 255 255 / .25);
    .icon { width: .9rem; height: .9rem; } &:hover { background: rgb(0 0 0 / .55); }
    @media (max-width: 40rem) { position: static; justify-self: start; }
  }
  .intro-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

  .filter-bar {
    display: grid; gap: .75rem; align-items: end; margin-bottom: 1rem;
    grid-template-columns: minmax(12rem, 2fr) repeat(3, minmax(8rem, 1fr)) auto;
    @media (max-width: 56rem) { grid-template-columns: 1fr 1fr; .field-search { grid-column: 1 / -1; } .btn { grid-column: 1 / -1; } }
    label { font-size: .8rem; color: var(--muted); }
  }

  /* Bild hinter Texten (Startseite, Rezeptkopf). Die Texte behalten ihre Position. */
  .photo-backdrop { position: relative; isolation: isolate; overflow: hidden; color: #fff; }
  .backdrop-media, .backdrop-media img, .backdrop-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
  .photo-backdrop::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background:
      linear-gradient(100deg, rgb(12 12 14 / .74) 0%, rgb(12 12 14 / .48) 42%, rgb(12 12 14 / .12) 78%),
      linear-gradient(to bottom, rgb(12 12 14 / .25), transparent 45%);
  }
  .photo-backdrop {
    h1 { color: #fff; text-shadow: 0 2px 22px rgb(0 0 0 / .3); }
    .lead { color: rgb(255 255 255 / .9); }
    .eyebrow { color: #fff; opacity: .9; }
    .breadcrumbs { color: rgb(255 255 255 / .7); a { color: rgb(255 255 255 / .9); &:hover { color: #fff; } } }
    .btn-ghost { --fg: #fff; &:hover { --bg: rgb(255 255 255 / .15); --fg: #fff; } }
  }

  /* Rezept */
  .recipe-head { display: grid; gap: 1rem; margin-bottom: 1.75rem; }
  .head-visual { display: grid; gap: 1rem; .breadcrumbs { margin: 0; } }
  .head-visual.photo-backdrop {
    align-content: start; min-height: clamp(18rem, 42vw, 30rem); padding: clamp(1.25rem, 4vw, 2.5rem);
    border-radius: var(--radius-lg); margin-bottom: .25rem;
    @media (max-width: 44rem) { margin-inline: calc(-1 * var(--gutter)); margin-top: -1.5rem; border-radius: 0; min-height: 75vw; }
  }
  .recipe-title { font-size: clamp(2.2rem, 1.4rem + 3.4vw, 3.75rem); max-width: 22ch; view-transition-name: recipe-title; }
  .head-caption { position: absolute; right: 1rem; bottom: .8rem; max-width: 40%; text-align: right; font-size: .75rem; color: rgb(255 255 255 / .8); }
  .head-sound { position: absolute; right: 1rem; bottom: 1rem; z-index: 2; --bg: rgb(0 0 0 / .45); --fg: #fff; --bd: rgb(255 255 255 / .3); backdrop-filter: blur(8px);
    &:hover { --bg: rgb(0 0 0 / .65); --fg: #fff; } }
  .head-visual.is-playing { .head-text, &::after { opacity: 0; pointer-events: none; transition: opacity .3s; } .backdrop-media { z-index: 1; } }

  .recipe-byline { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; color: var(--ink-2);
    a { color: var(--ink); } }
  .rating-summary { display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; margin-left: .25rem; span { color: var(--ink-2); } }
  .facts {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 1px;
    background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
    > div { background: var(--surface); padding: .75rem 1rem; }
    dt { display: flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
    dd { font-weight: 650; font-size: 1.05rem; }
  }
  .fav-btn[aria-pressed="true"] { color: var(--accent); .icon { fill: currentColor; } }
  .recipe-hero { margin-bottom: 2rem; max-width: 52rem; .yt { border-radius: var(--radius-lg); } }

  .recipe-layout {
    display: grid; gap: clamp(1.5rem, 4vw, 3rem); align-items: start;
    grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr);
    @media (max-width: 52rem) { grid-template-columns: 1fr; }
  }
  .ingredients {
    position: sticky; top: calc(var(--header-h) + 1rem); display: grid; gap: 1rem;
    max-height: calc(100dvh - var(--header-h) - 2rem); overflow: auto;
    @media (max-width: 52rem) { position: static; max-height: none; }
  }
  .ingredients-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
  .stepper {
    display: inline-flex; align-items: center; gap: .1rem; border: 1px solid var(--line-2); border-radius: 999px; padding: .15rem;
    .btn-icon { width: 2rem; min-width: 2rem; min-height: 2rem; }
    label { display: inline-flex; align-items: baseline; gap: .3rem; font-size: .85rem; color: var(--muted); }
    input { width: 2.6rem; min-height: 0; padding: .1rem; border: 0; text-align: center; font-weight: 700; font-size: 1rem; background: transparent; color: var(--ink);
      -moz-appearance: textfield; &::-webkit-inner-spin-button, &::-webkit-outer-spin-button { -webkit-appearance: none; } &:focus { box-shadow: none; } }
  }
  .ingredient-list { list-style: none; padding: 0; display: grid;
    li:not(.ingredient-group) { border-bottom: 1px dashed var(--line); }
    label { display: grid; grid-template-columns: auto minmax(4.5rem, auto) 1fr; gap: .65rem; align-items: baseline; padding: .55rem 0; cursor: pointer; }
    input { translate: 0 .15rem; }
    .qty { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
    label:has(input:checked) { color: var(--muted); .ing-name, .qty { text-decoration: line-through; } }
  }
  .ingredient-group { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; padding: 1rem 0 .25rem; color: var(--accent); }

  .steps > h2 { margin-bottom: 1.25rem; }
  .step-list { list-style: none; padding: 0; display: grid; gap: 2.25rem; counter-reset: step; }
  .step { display: grid; grid-template-columns: 2.6rem 1fr; gap: 1rem; }
  .step-num {
    display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%;
    background: var(--ink); color: var(--paper); font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  }
  .step-body { display: grid; gap: 1rem; min-width: 0; padding-top: .3rem; }
  .step-title { font-size: 1.35rem; }

  .rating { margin-top: 2.5rem; display: grid; gap: .8rem; }
  .rating-stats { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; .stars { font-size: 1.2rem; } }
  .star-input { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
  .star-buttons { display: inline-flex; }
  .star {
    border: 0; background: none; padding: .2rem; color: var(--line-2); border-radius: .4rem;
    .icon { width: 1.9rem; height: 1.9rem; transition: transform .15s; }
    &.on { color: var(--star); .icon { fill: currentColor; } }
    &:hover .icon { transform: scale(1.15); }
  }
  .star-buttons:has(.star:hover) .star { color: var(--star); .icon { fill: currentColor; } }
  .star-buttons .star:hover ~ .star { color: var(--line-2); .icon { fill: none; } }
  .more { margin-top: 4rem; h2 { margin-bottom: 1.25rem; } }

  /* Kochmodus */
  .bare { background: var(--paper); }
  .cook { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); height: 100dvh; overflow: hidden; }
  .cook-bar { display: flex; align-items: center; gap: .75rem; padding: .6rem var(--gutter); border-bottom: 1px solid var(--line); }
  .cook-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  [data-wakelock][aria-pressed="true"] { color: var(--amber); background: var(--amber-soft); }
  .cook-progress { height: 4px; background: var(--line); span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s var(--ease); } }
  .cook-track {
    display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none;
    &::-webkit-scrollbar { display: none; }
    &:focus { outline: none; }
  }
  .cook-slide { scroll-snap-align: start; overflow-y: auto; padding: clamp(1.5rem, 5vw, 3.5rem) var(--gutter); }
  .cook-inner {
    max-width: 46rem; margin-inline: auto; display: grid; gap: 1.25rem; font-size: clamp(1.15rem, 1rem + .8vw, 1.5rem); line-height: 1.55;
    h2 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.8rem); }
    .prose { max-width: none; }
  }
  .cook-label { font-size: .85rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
  .cook-ingredients label { grid-template-columns: auto minmax(6rem, auto) 1fr; }
  .cook-done .cook-inner { justify-items: center; text-align: center; padding-top: 10vh; }
  .cook-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem var(--gutter) max(.75rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface);
    .btn { min-height: 3rem; padding-inline: 1.4rem; font-size: 1.05rem; } }
  .cook-counter { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

  /* Editor */
  .recipe-form { display: grid; gap: 1.5rem; max-width: 56rem; }
  .editor-list { display: grid; gap: .5rem; }
  .ing-row {
    display: grid; grid-template-columns: auto 5.5rem 7rem minmax(0, 1fr) auto; gap: .5rem; align-items: center;
    padding: .35rem; border-radius: var(--radius-sm); background: var(--surface);
    input { min-height: 2.5rem; }
    &.is-heading { grid-template-columns: auto minmax(0, 1fr) auto; input { font-family: var(--font-display); font-weight: 700; color: var(--accent); } }
    @media (max-width: 40rem) {
      grid-template-columns: auto 4.5rem 5.5rem minmax(0, 1fr);
      .row-tools { grid-column: 2 / -1; justify-content: flex-end; }
    }
  }
  .row-tools { display: flex; gap: .1rem; .btn { width: 2.1rem; min-width: 2.1rem; min-height: 2.1rem; } }
  .drag-handle { cursor: grab; color: var(--muted); padding: .4rem .2rem; border: 0; background: none; border-radius: .3rem; touch-action: none;
    &:active { cursor: grabbing; } .icon { width: 1.1rem; height: 1.1rem; } }
  .is-dragging { opacity: .45; }
  .drop-before { box-shadow: 0 -3px 0 var(--accent); }
  .drop-after { box-shadow: 0 3px 0 var(--accent); }
  .editor-add { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
  .bulk-box { display: grid; gap: .5rem; padding: 1rem; border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--surface-2); }

  .step-card {
    position: relative; display: grid; gap: 1rem; padding: 1rem 1.1rem 1.1rem; margin-bottom: 1rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    transition: border-color .15s, background .15s;
    &.is-dropzone { border-color: var(--accent); border-style: dashed; background: var(--accent-soft); }
  }
  .step-card-head { display: flex; align-items: center; gap: .5rem;
    .step-num { width: 2.1rem; height: 2.1rem; font-size: 1rem; flex: none; }
    input { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; } }
  .block-list { display: grid; gap: .75rem; }
  .block {
    position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .5rem; align-items: start;
    padding: .5rem; border-radius: var(--radius); border: 1px solid transparent;
    &:hover, &:focus-within { border-color: var(--line); background: var(--paper); }
  }
  .block-main { display: grid; gap: .5rem; min-width: 0; }
  .block-tools { display: flex; flex-direction: column; gap: .1rem; .btn { width: 2rem; min-width: 2rem; min-height: 2rem; } }
  .block-type { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
    .icon { width: .9rem; height: .9rem; } }
  .text-toolbar { display: flex; flex-wrap: wrap; gap: .15rem; .btn { min-height: 1.9rem; padding: .2rem .55rem; font-size: .82rem; } }
  .block-preview {
    border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); max-width: 26rem;
    img, video { width: 100%; max-height: 16rem; object-fit: cover; }
  }
  .yt-preview { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; background: #1b1411; color: #fff; border-radius: var(--radius-sm); font-size: .9rem; max-width: 26rem;
    .icon { color: #ff4e45; } code { background: rgb(255 255 255 / .12); color: #fff; } }
  .upload-progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; max-width: 26rem;
    span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; } }
  .upload-error { color: var(--danger); font-size: .9rem; font-weight: 500; }
  .step-add { display: flex; flex-wrap: wrap; gap: .4rem; padding-top: .25rem; border-top: 1px dashed var(--line); }
  .hero-box { display: grid; gap: .75rem; }
  .hero-preview { max-width: 34rem; border-radius: var(--radius); overflow: hidden;
    img, video { width: 100%; max-height: 22rem; object-fit: cover; } }
  .dropzone {
    display: grid; place-items: center; gap: .4rem; padding: 1.75rem 1rem; text-align: center;
    border: 2px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); cursor: pointer; transition: all .15s;
    .icon { width: 2rem; height: 2rem; }
    &:hover, &.is-over { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
  }
  .inline-input { display: flex; gap: .5rem; }

  /* Auth */
  .auth { max-width: 27rem; margin: 1rem auto; display: grid; gap: 1.1rem; h1 { font-size: 2rem; } }
  .auth-switch { text-align: center; color: var(--muted); font-size: .95rem; }

  /* Profil */
  .profile-head { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; }
  .profile-bio { max-width: 60ch; margin-top: .5rem; color: var(--ink-2); }

  /* Einkaufsliste */
  .shopping-layout { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr) 18rem; align-items: start;
    @media (max-width: 52rem) { grid-template-columns: 1fr; } }
  .shopping-card { display: grid; gap: 1rem; }
  .quick-add { display: flex; gap: .5rem; }
  .shopping-list { list-style: none; padding: 0; }
  .shopping-item {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .75rem; padding: .35rem 0; border-bottom: 1px solid var(--line);
    &:last-child { border-bottom: 0; }
    form { display: contents; }
    .btn-icon { opacity: .4; &:hover { opacity: 1; } }
    &.is-checked .shopping-text { color: var(--muted); text-decoration: line-through; }
  }
  .shopping-item + .shopping-item.is-checked:not(.shopping-item.is-checked + .shopping-item.is-checked) { margin-top: 1rem; border-top: 1px solid var(--line); }
  .check {
    display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: .5rem; border: 2px solid var(--line-2); background: var(--surface); color: transparent; transition: all .15s;
    .icon { width: 1rem; height: 1rem; stroke-width: 3; }
    &:hover { border-color: var(--herb); }
    &[aria-pressed="true"] { background: var(--herb); border-color: var(--herb); color: var(--surface); }
  }
  .shopping-text { padding: .45rem 0; strong { font-variant-numeric: tabular-nums; margin-right: .2rem; } }
  .shopping-footer { justify-content: space-between; border-top: 1px solid var(--line); padding-top: .75rem; }

  /* Events */
  .events-layout { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1.6fr) minmax(18rem, 1fr); align-items: start;
    @media (max-width: 60rem) { grid-template-columns: 1fr; } }
  .calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; h2 { font-size: 1.4rem; } }
  .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .calendar-wd { background: var(--surface-2); padding: .4rem; font-size: .75rem; font-weight: 700; text-align: center; color: var(--muted); }
  .calendar-day {
    background: var(--surface); min-height: 5.5rem; padding: .3rem; display: grid; align-content: start; gap: .2rem;
    &.is-outside { background: var(--paper); .calendar-date { color: var(--muted); opacity: .6; } }
    &.is-today .calendar-date { background: var(--accent); color: var(--accent-ink); }
    @media (max-width: 40rem) { min-height: 3.2rem; }
  }
  .calendar-date { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; font-size: .85rem; font-weight: 600; color: var(--ink); text-decoration: none;
    &:hover { background: var(--surface-2); } }
  .calendar-event {
    display: block; padding: .15rem .35rem; border-radius: .35rem; background: var(--accent-soft); color: var(--accent);
    font-size: .75rem; font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    span { opacity: .75; }
    @media (max-width: 40rem) { font-size: 0; height: .45rem; padding: 0; }
  }
  .event-list-wrap h2 { font-size: 1.3rem; margin-bottom: .75rem; }
  .event-list { list-style: none; padding: 0; display: grid; gap: .6rem; }
  .event-item {
    display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; text-decoration: none; color: var(--ink);
    transition: border-color .15s; &:hover { border-color: var(--line-2); }
    > .icon { color: var(--muted); margin-left: auto; }
  }
  .event-item-body { display: grid; gap: .1rem; small { color: var(--muted); } }
  .date-badge { display: grid; place-items: center; width: 3.2rem; padding: .3rem 0; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); line-height: 1.1; flex: none;
    small { font-size: .7rem; font-weight: 700; text-transform: uppercase; } strong { font-family: var(--font-display); font-size: 1.4rem; } }
  .rsvp-mini { display: flex; gap: .6rem; .ok { color: var(--herb); font-weight: 600; } }
  .past-events { margin-top: 1.5rem; summary { cursor: pointer; color: var(--ink-2); font-weight: 600; margin-bottom: .75rem; } }

  .event-form { display: grid; gap: 1.5rem; max-width: 48rem; }
  .filter-input { max-width: 20rem; }
  .recipe-choices { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
  .recipe-choice {
    display: flex; align-items: center; gap: .7rem; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
    &:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
    .thumb { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); color: var(--muted); flex: none;
      img { width: 100%; height: 100%; object-fit: cover; } }
    .choice-title { display: grid; font-weight: 600; font-size: .92rem; line-height: 1.3; small { color: var(--muted); font-weight: 500; } }
  }

  .event-layout { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1.5fr) minmax(18rem, 1fr); align-items: start;
    @media (max-width: 56rem) { grid-template-columns: 1fr; } }
  .event-facts { display: grid; gap: 1rem; margin-bottom: 1.25rem;
    > div { display: grid; grid-template-columns: 2.4rem 1fr; gap: .5rem; align-items: start; }
    dt { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--accent); } }
  .event-description { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
  .invite-box { display: grid; gap: .8rem; h2 { display: flex; align-items: center; gap: .5rem; font-size: 1.25rem; } }
  .invite-head { display: grid; gap: .6rem; margin-bottom: 1.75rem; justify-items: start; h1 { font-size: clamp(2.2rem, 1.5rem + 3vw, 3.5rem); } }
  .rsvp-form { display: grid; gap: 1rem; }
  .rsvp-counts { display: flex; flex-wrap: wrap; gap: .4rem; margin-block: .5rem 1rem; }
  .rsvp-overview h3 { font-size: .8rem; font-family: var(--font-sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-block: 1rem .4rem; }
  .rsvp-list { list-style: none; padding: 0; display: grid; gap: .6rem;
    li { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; }
    li > span:nth-child(2) { display: grid; small { color: var(--muted); } }
    form { display: contents; } }
  .status-label { font-weight: 600; &.status-yes { color: var(--herb); } &.status-maybe { color: var(--amber); } &.status-no { color: var(--muted); } }

  /* Admin */
  .stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); margin-bottom: 1.5rem; }
  .stat { display: grid; gap: .1rem; strong { font-family: var(--font-display); font-size: 2rem; line-height: 1.1; } span { color: var(--muted); font-size: .9rem; } }
  #nutzer h2 { margin-bottom: .75rem; }
}

/* ---------- Hilfsklassen ---------- */
@layer utilities {
  .sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
}

/* ---------- Druck ---------- */
@layer print {
  @media print {
    :root { color-scheme: light; --paper: #fff; --surface: #fff; }
    body { font-size: 11pt; }
    .site-header, .site-footer, .recipe-actions, .rating, .more, .no-print, .flash, .stepper, .form-actions, .yt, video, .breadcrumbs, .calendar-add { display: none !important; }
    .main { padding: 0; }
    .card { box-shadow: none; border: 0; padding: 0; }
    .recipe-layout { grid-template-columns: 16rem 1fr; gap: 2rem; }
    .ingredients { position: static; max-height: none; overflow: visible; }
    .photo-backdrop { color: #000; min-height: 0 !important; padding: 0 !important; margin: 0 !important; }
    .photo-backdrop::after, .backdrop-media video, .head-sound, .head-caption, .breadcrumbs { display: none !important; }
    .backdrop-media { position: static; margin-bottom: .75rem; } .backdrop-media img { position: static; max-height: 8cm; border-radius: 8px; }
    .photo-backdrop h1, .photo-backdrop .lead { color: #000 !important; text-shadow: none !important; }
    .step { break-inside: avoid; }
    .step-num { background: none; color: #000; border: 1.5px solid #000; }
    .ingredient-list input, .shopping-item .check { border-color: #000; }
    a { color: inherit; text-decoration: none; }
    .shopping-layout { display: block; }
  }
}

@layer pages {
  .stack-lg > section > h2, .event-layout section > h2 { margin-bottom: 1rem; }
}

@layer pages {
  .cook-counter { white-space: nowrap; }
  @media (max-width: 30rem) { .yt-consent small { display: none; } .cook-nav .btn span { display: none; } }
}

@layer components {
  /* SMS nur auf Geräten mit Touch anbieten */
  @media (hover: hover) and (pointer: fine) { .share-sms { display: none !important; } }
}

/* ---------- Einladungen & Rezept-Abstimmung ---------- */
@layer pages {
  .pill-invite { background: light-dark(#eef2ff, #1e2340); color: light-dark(#3949ab, #9fa8ff); }
  .pill-poll { background: var(--accent-soft); color: var(--accent); .icon { width: .85rem; height: .85rem; } }
  .event-item.is-invite { border-style: dashed; }
  .calendar-event.is-invite { background: transparent; border: 1px dashed currentColor; }
  .check-row { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; input { margin-top: .2rem; } }
  @media (max-width: 56rem) {
    .invite .event-layout > aside { display: contents; }
    .invite .event-layout .rsvp-form { order: -1; }
    .invite .event-layout > aside > :not(.rsvp-form) { order: 1; }
  }
  .guest-list li { align-items: start; }
  .guest-note { font-style: italic; }
  .guest-menu .menu-panel { min-width: 15rem; }
  .guest-menu summary { font-size: 1.2rem; line-height: 1; }
  .avatar.status-open { background: var(--surface-2); color: var(--muted); }
  .invite-form { gap: .5rem; margin-bottom: 1.25rem; textarea { min-height: 3rem; } }

  .poll { display: grid; gap: 1.1rem; scroll-margin-top: calc(var(--header-h) + 1rem); }
  .poll-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
    h2 { display: flex; align-items: center; gap: .5rem; } }
  .phase-steps { list-style: none; padding: 0; display: flex; gap: .25rem; counter-reset: none;
    li { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem .3rem .35rem; border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--muted); background: var(--surface-2); }
    li span { display: grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: var(--line); color: var(--ink-2); font-size: .72rem; }
    li.is-done { color: var(--herb); span { background: var(--herb); color: var(--surface); } }
    li.is-current { color: var(--accent); background: var(--accent-soft); span { background: var(--accent); color: var(--accent-ink); } } }
  .poll-message { padding: .75rem 1rem; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
  .poll-status { color: var(--ink-2); strong { color: var(--ink); } }
  .empty-hint { display: flex; align-items: center; gap: .5rem; color: var(--muted); padding: 1rem; border: 1px dashed var(--line-2); border-radius: var(--radius); justify-content: center; }
  .suggestions { list-style: none; padding: 0; display: grid; gap: .6rem; }
  .suggestion {
    display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto; gap: .9rem; align-items: center;
    padding: .7rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
    &.is-winner { border-color: color-mix(in oklab, var(--herb) 50%, transparent); background: color-mix(in oklab, var(--herb-soft) 50%, var(--surface)); }
  }
  .sug-thumb { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); color: var(--muted);
    img { width: 100%; height: 100%; object-fit: cover; } b { font-family: var(--font-display); font-size: 1.4rem; color: var(--ink-2); } }
  .sug-body { display: grid; gap: .15rem; min-width: 0;
    strong { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; a { color: var(--ink); } }
    small { color: var(--muted); } p { font-size: .92rem; color: var(--ink-2); }
    .pill .icon { width: .8rem; height: .8rem; fill: currentColor; } }
  .sug-actions { display: flex; align-items: center; gap: .25rem; form { display: contents; } }
  .vote-btn {
    display: inline-flex; align-items: center; gap: .4rem; min-height: 2.5rem; padding: .4rem .9rem; border-radius: 999px;
    border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-weight: 650; font-size: .9rem; transition: all .15s;
    &:hover { border-color: var(--accent); color: var(--accent); }
    &[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); .icon { fill: currentColor; } }
    &:active { transform: scale(.96); }
  }
  .vote-count { text-align: right; font-size: .85rem; color: var(--muted); white-space: nowrap; strong { display: block; font-size: 1.3rem; color: var(--ink); line-height: 1.1; } }
  .result-bar { display: block; height: .4rem; margin-top: .35rem; border-radius: 999px; background: var(--surface-2); overflow: hidden;
    span { display: block; height: 100%; background: var(--accent); border-radius: inherit; } }
  .is-winner .result-bar span { background: var(--herb); }
  .result-bar .w-0 { width: 0%; } .result-bar .w-5 { width: 5%; } .result-bar .w-10 { width: 10%; } .result-bar .w-15 { width: 15%; } .result-bar .w-20 { width: 20%; } .result-bar .w-25 { width: 25%; } .result-bar .w-30 { width: 30%; } .result-bar .w-35 { width: 35%; } .result-bar .w-40 { width: 40%; } .result-bar .w-45 { width: 45%; } .result-bar .w-50 { width: 50%; } .result-bar .w-55 { width: 55%; } .result-bar .w-60 { width: 60%; } .result-bar .w-65 { width: 65%; } .result-bar .w-70 { width: 70%; } .result-bar .w-75 { width: 75%; } .result-bar .w-80 { width: 80%; } .result-bar .w-85 { width: 85%; } .result-bar .w-90 { width: 90%; } .result-bar .w-95 { width: 95%; } .result-bar .w-100 { width: 100%; } 
  .suggest-form { display: grid; gap: .8rem; padding: 1rem; border-radius: var(--radius); background: var(--surface-2);
    h3 { font-size: 1.1rem; } input { background: var(--surface); } }
  .suggest-search { position: relative; }
  .search-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: .25rem; display: grid; padding: .3rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
  .search-item { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; border: 0; border-radius: var(--radius-sm); background: none; text-align: left; color: var(--ink);
    img { width: 2.4rem; height: 2.4rem; border-radius: .4rem; object-fit: cover; }
    span { display: grid; } small { color: var(--muted); }
    &:hover, &.is-active { background: var(--surface-2); } }
  .picked { font-size: .88rem; color: var(--herb); font-weight: 600; }
  .poll-join { display: flex; align-items: center; gap: .5rem; color: var(--ink-2); padding: .8rem 1rem; border-radius: var(--radius); background: var(--surface-2); }
  .host-controls { display: grid; gap: .75rem; padding-top: 1rem; border-top: 1px dashed var(--line-2); }
  .host-label { display: flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); .icon { width: .95rem; height: .95rem; } }
  .poll-settings-details summary { cursor: pointer; font-weight: 600; color: var(--ink-2); margin-bottom: .75rem; }
  @media (max-width: 34rem) {
    .suggestion { grid-template-columns: 2.75rem minmax(0, 1fr); .sug-thumb { width: 2.75rem; height: 2.75rem; } .sug-actions { grid-column: 2; } }
    .phase-steps li { font-size: 0; gap: 0; padding: .3rem; } .phase-steps li.is-current { font-size: .82rem; gap: .4rem; padding-right: .7rem; }
  }
}

@layer pages {
  .calendar-legend { display: flex; gap: .5rem; margin-top: .75rem; justify-content: flex-end; .calendar-event { display: inline-block; font-size: .72rem; @media (max-width: 40rem) { font-size: .72rem; height: auto; padding: .15rem .35rem; } } }
}

/* ---------- Rezeptfilter & Facetten ---------- */
@layer pages {
  .filter-form { display: grid; gap: .25rem; margin-bottom: .5rem; }
  .filter-bar { grid-template-columns: minmax(12rem, 1fr) minmax(10rem, 14rem) auto;
    @media (max-width: 40rem) { grid-template-columns: 1fr 1fr; .field-search { grid-column: 1 / -1; } } }
  .filter-form .chips { margin-bottom: .25rem; }
  .filter-panel {
    > summary { width: fit-content; list-style: none; --bd: var(--line-2); &::-webkit-details-marker { display: none; } }
    .badge { display: grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 .35rem; border-radius: 999px; font-size: .72rem; background: var(--accent); color: var(--accent-ink); }
    &[open] > summary { background: var(--surface-2); }
  }
  .filter-body {
    display: grid; gap: 1.1rem; margin-top: .75rem; padding: clamp(1rem, 2.5vw, 1.5rem);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
    animation: pop .15s var(--ease);
  }
  .facet { border: 0; padding: 0; min-width: 0; display: grid; gap: .5rem; align-content: start;
    legend { font-weight: 700; font-size: .9rem; margin-bottom: .45rem; padding: 0; small { font-weight: 400; color: var(--muted); margin-left: .3rem; } } }
  .facet-ingredients, .filter-actions { grid-column: 1 / -1; }
  .facet-options { display: flex; flex-wrap: wrap; gap: .35rem; }
  .opt {
    position: relative; cursor: pointer;
    input { position: absolute; opacity: 0; pointer-events: none; }
    span { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--line-2);
      font-size: .88rem; font-weight: 550; color: var(--ink-2); background: var(--surface); transition: background .12s, border-color .12s, color .12s; }
    small { color: var(--muted); font-weight: 500; }
    &:hover span { border-color: var(--ink-2); color: var(--ink); }
    input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); small { color: inherit; opacity: .8; } }
    input:focus-visible + span { box-shadow: var(--ring); }
    &.is-empty span { opacity: .55; }
  }
  .filter-actions { display: flex; justify-content: flex-end; gap: .5rem; padding-top: .75rem; border-top: 1px solid var(--line); }
  .active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .75rem 0 1.25rem; }
  .chip-active { background: var(--accent-soft); border-color: transparent; color: var(--accent); gap: .3rem;
    .icon { width: .85rem; height: .85rem; } &:hover { border-color: var(--accent); color: var(--accent); } }
  .reset-link { font-size: .88rem; margin-left: .3rem; }
  .diet-badge { padding: .05rem .45rem; border-radius: 999px; background: var(--herb-soft); color: var(--herb); font-weight: 650; font-size: .75rem; }

  .facet-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
  .facet-chip { padding: .25rem .7rem; border-radius: 999px; font-size: .82rem; font-weight: 600; text-decoration: none;
    background: var(--surface-2); color: var(--ink-2); &:hover { color: var(--accent); background: var(--accent-soft); } }
  .facet-chip.facet-diet { background: var(--herb-soft); color: var(--herb); }

  .facet-editor { display: grid; gap: 1rem; padding: 1rem; border-radius: var(--radius); background: var(--surface-2);
    .opt span { background: var(--surface); } }
}

@layer pages { .opt input:disabled + span { opacity: .4; cursor: not-allowed; text-decoration: line-through; } }
