/* ==========================================================================
   Kochbuch – Design-System
   Ohne Build-Schritt, ohne externe Fonts (DSGVO-freundlich).
   ========================================================================== */

:root {
    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;

    --bg: #fbf7f2;
    --bg-soft: #f4ede4;
    --surface: #ffffff;
    --surface-2: #faf6f1;
    --border: #eadfd3;
    --text: #2b211a;
    --text-soft: #6f6258;
    --primary: #c2410c;
    --primary-600: #a33709;
    --primary-soft: #fde7da;
    --accent: #3f7d4e;
    --accent-soft: #e2f1e5;
    --danger: #c0262d;
    --danger-soft: #fde4e4;
    --warning: #a86a00;
    --warning-soft: #fff1d6;
    --info-soft: #e3eefc;

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 1px 2px rgb(60 30 10 / .06), 0 1px 1px rgb(60 30 10 / .04);
    --shadow: 0 8px 24px -8px rgb(60 30 10 / .16), 0 2px 6px rgb(60 30 10 / .05);
    --shadow-lg: 0 24px 60px -18px rgb(60 30 10 / .30);
    --ring: 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent);
    --ease: cubic-bezier(.2, .8, .2, 1);
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #15110e;
    --bg-soft: #1d1814;
    --surface: #221c17;
    --surface-2: #2a231d;
    --border: #3a3029;
    --text: #f3ebe3;
    --text-soft: #b3a598;
    --primary: #f97341;
    --primary-600: #fb8a5e;
    --primary-soft: #3d2217;
    --accent: #7cc68c;
    --accent-soft: #1f3324;
    --danger: #f36b70;
    --danger-soft: #3b1c1e;
    --warning: #f3b64b;
    --warning-soft: #3a2c12;
    --info-soft: #1c2a3d;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow: 0 10px 30px -10px rgb(0 0 0 / .6);
    --shadow-lg: 0 30px 60px -20px rgb(0 0 0 / .7);
    color-scheme: dark;
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font: 16px/1.6 var(--font-sans);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--primary-600); }
h1, h2, h3 { font-family: var(--font-serif); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
code { background: var(--bg-soft); padding: .1em .4em; border-radius: 6px; font-size: .9em; word-break: break-all; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
::selection { background: var(--primary-soft); }

.container { width: min(1200px, 100% - 2rem); margin-inline: auto; }
.container--narrow { width: min(880px, 100% - 2rem); }
.main { flex: 1; padding-bottom: 4rem; }
.muted { color: var(--text-soft); }
.small { font-size: .875rem; }
.inline { display: inline; margin: 0; }
.sr-only, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: .5rem; z-index: 100; background: var(--surface); padding: .5rem 1rem; border-radius: 8px; }
.skip-link:focus { left: .5rem; }

/* ---------- Icons ---------- */
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.icon--xs { width: .85em; height: .85em; }
.icon--sm { width: 1em; height: 1em; }
.icon--lg { width: 2.2rem; height: 2.2rem; }
.icon--sun { display: none; }
[data-theme="dark"] .icon--sun { display: inline; }
[data-theme="dark"] .icon--moon { display: none; }

/* ---------- Buttons ---------- */
.btn {
    --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border);
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .65rem 1.1rem; border-radius: 999px; border: 1px solid var(--btn-bd);
    background: var(--btn-bg); color: var(--btn-fg); font: 600 .95rem/1.2 var(--font-sans);
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: transform .15s var(--ease), background .2s, box-shadow .2s, border-color .2s;
}
.btn:hover { color: var(--btn-fg); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn--primary { --btn-bg: var(--primary); --btn-fg: #fff; --btn-bd: transparent;
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #e11d48)); }
.btn--primary:hover { box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--primary) 60%, transparent); }
.btn--ghost { --btn-bg: transparent; }
.btn--ghost:hover { --btn-bg: var(--surface); }
.btn--ghost.is-fav { --btn-fg: #e11d48; --btn-bd: color-mix(in srgb, #e11d48 40%, transparent); }
.btn--ghost.is-fav .icon { fill: currentColor; }
.btn--danger-ghost { --btn-bg: transparent; --btn-fg: var(--danger); --btn-bd: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn--danger-ghost:hover { --btn-bg: var(--danger-soft); }
.btn--sm { padding: .45rem .85rem; font-size: .875rem; }
.btn--lg { padding: .85rem 1.5rem; font-size: 1rem; }
.btn--block { width: 100%; }

.icon-btn {
    display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 999px;
    border: 1px solid transparent; background: transparent; color: var(--text-soft); cursor: pointer;
    transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.icon-btn--sm { width: 2rem; height: 2rem; }
.icon-btn--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Topbar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar__inner { display: flex; align-items: center; gap: 1rem; min-height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font: 700 1.3rem var(--font-serif); color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand__mark { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 12px; font-size: 1.3rem;
    background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft)); box-shadow: var(--shadow-sm); }
.brand--center { justify-content: center; width: 100%; margin-bottom: 1.5rem; }
.topnav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.topnav__link { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .85rem; border-radius: 999px;
    color: var(--text-soft); text-decoration: none; font-weight: 500; }
.topnav__link:hover { color: var(--text); background: var(--bg-soft); }
.topnav__link.is-active { color: var(--primary); background: var(--primary-soft); }
.topnav .btn { margin-left: .5rem; }
.topbar__toggle { display: none; margin-left: auto; }

@media (max-width: 860px) {
    .topbar__toggle { display: inline-grid; }
    .topnav { position: absolute; inset: 100% 0 auto; flex-direction: column; align-items: stretch; padding: .75rem 1rem 1rem;
        background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); display: none; }
    .topnav.is-open { display: flex; }
    .topnav .btn { margin: .5rem 0 0; }
    .topnav .icon-btn { align-self: flex-start; }
}

/* ---------- Hero & Suche ---------- */
.hero {
    position: relative; overflow: hidden; padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem);
    background:
        radial-gradient(900px 400px at 10% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 70%),
        radial-gradient(700px 360px at 95% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
        var(--bg);
}
.hero__inner { text-align: center; }
.hero__title { font-size: clamp(2rem, 5vw, 3.4rem); margin-bottom: .3rem; }
.hero__sub { color: var(--text-soft); margin-bottom: 1.75rem; }
.search {
    position: relative; display: flex; align-items: center; gap: .5rem; max-width: 720px; margin: 0 auto;
    padding: .4rem .4rem .4rem 1.1rem; border-radius: 999px; background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow); transition: box-shadow .2s, border-color .2s;
}
.search:focus-within { border-color: var(--primary); box-shadow: var(--shadow), var(--ring); }
.search__icon { color: var(--text-soft); }
.search__input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 1.05rem; color: var(--text); padding: .6rem 0; }
.search__input:focus { outline: none; box-shadow: none; }
.search__btn { flex: none; }
@media (max-width: 520px) { .search__btn { padding-inline: .9rem; } .search__input { font-size: 1rem; } }

/* ---------- Chips, Toolbar ---------- */
.chips { display: flex; gap: .5rem; overflow-x: auto; padding: .25rem .1rem 1rem; scrollbar-width: thin; scroll-snap-type: x proximity; }
.chip { flex: none; scroll-snap-align: start; padding: .45rem .9rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
    color: var(--text); text-decoration: none; font-size: .9rem; font-weight: 500; transition: all .2s; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.is-active { background: var(--text); border-color: var(--text); color: var(--bg); }
.toolbar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin: .25rem 0 1.5rem; }
.segmented { display: inline-flex; padding: .25rem; background: var(--bg-soft); border-radius: 999px; border: 1px solid var(--border); }
.segmented__item { padding: .4rem 1rem; border-radius: 999px; color: var(--text-soft); text-decoration: none; font-weight: 500; font-size: .9rem; }
.segmented__item.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Formularelemente ---------- */
.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .4rem; font-weight: 500; font-size: .92rem; }
.field > span:first-child { color: var(--text-soft); }
input:not([type="checkbox"], [type="radio"], [type="file"]), textarea, .select {
    width: 100%; font: inherit; font-weight: 400; font-size: 1rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: .7rem .9rem; transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 3rem; line-height: 1.5; }
input:focus, textarea:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.select { appearance: none; padding-right: 2.4rem; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23887766' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .8rem center; background-size: 1.1rem; }
.sort .select { width: auto; border-radius: 999px; padding-block: .5rem; }
.field__error { color: var(--danger); font-size: .85rem; margin: 0; font-weight: 500; }
.field:has(.field__error) input, .field:has(.field__error) textarea, .field:has(.field__error) .select { border-color: var(--danger); }
.grid-2, .grid-3 { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2--top { align-items: start; margin-top: 1.5rem; }
.checkbox { display: inline-flex; gap: .5rem; align-items: center; font-size: .92rem; cursor: pointer; margin-top: .5rem; }
input[type="checkbox"] { accent-color: var(--primary); width: 1.05rem; height: 1.05rem; }

.switch { display: inline-flex; align-items: center; gap: .7rem; cursor: pointer; font-weight: 500; font-size: .92rem; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track { position: relative; flex: none; width: 2.75rem; height: 1.55rem; border-radius: 999px; background: var(--border); transition: background .2s; }
.switch__track::after { content: ""; position: absolute; top: .2rem; left: .2rem; width: 1.15rem; height: 1.15rem; border-radius: 50%;
    background: #fff; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease); }
.switch input:checked + .switch__track { background: var(--primary); }
.switch input:checked + .switch__track::after { transform: translateX(1.2rem); }
.switch input:focus-visible + .switch__track { box-shadow: var(--ring); }
.switch--field { align-self: end; padding-bottom: .7rem; }

.password-wrap { position: relative; display: block; }
.password-toggle { position: absolute; right: .5rem; top: 50%; translate: 0 -50%; border: 0; background: none; cursor: pointer; font-size: 1.1rem; opacity: .6; }
.password-toggle:hover { opacity: 1; }
.strength { display: block; height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.strength__bar { display: block; height: 100%; width: 0; transition: width .3s, background .3s; background: var(--danger); }
.strength[data-score="2"] .strength__bar { width: 40%; background: var(--warning); }
.strength[data-score="1"] .strength__bar { width: 20%; }
.strength[data-score="3"] .strength__bar { width: 70%; background: #84a93b; }
.strength[data-score="4"] .strength__bar { width: 100%; background: var(--accent); }

/* ---------- Alerts & Toasts ---------- */
.alert { padding: .85rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .93rem; border: 1px solid transparent; }
.alert--error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert--success { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.alert--warning { background: var(--warning-soft); color: var(--warning); }
.alert--info { background: var(--info-soft); }
.toasts { position: fixed; z-index: 80; right: 1rem; bottom: 1rem; display: grid; gap: .6rem; max-width: min(420px, calc(100% - 2rem)); }
.toast { display: flex; gap: .75rem; align-items: center; padding: .85rem .9rem .85rem 1.1rem; border-radius: var(--radius);
    background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); animation: toast-in .4s var(--ease); font-weight: 500; }
.toast--error { background: var(--danger); color: #fff; }
.toast--success::before { content: "✓"; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; flex: none; border-radius: 50%; background: var(--accent); color: #fff; font-size: .8rem; }
.toast__close { margin-left: auto; border: 0; background: none; color: inherit; opacity: .7; cursor: pointer; display: grid; }
.toast.is-leaving { animation: toast-out .3s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px); } }

/* ---------- Karten-Grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.5rem; }
.card { position: relative; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius-lg);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    transition: transform .3s var(--ease), box-shadow .3s var(--ease); animation: rise .5s var(--ease) both; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card:nth-child(2) { animation-delay: .04s; } .card:nth-child(3) { animation-delay: .08s; } .card:nth-child(4) { animation-delay: .12s; }
.card:nth-child(n+5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.card__media { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft)); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.card:hover .card__media img { transform: scale(1.06); }
.card__placeholder { display: grid; place-items: center; height: 100%; font-size: 4.5rem; filter: drop-shadow(0 8px 12px rgb(0 0 0 / .15)); transition: transform .5s var(--ease); }
.card:hover .card__placeholder { transform: scale(1.1) rotate(-6deg); }
.card__media .badge { position: absolute; left: .8rem; top: .8rem; }
.card__fav { position: absolute; right: .7rem; top: .7rem; margin: 0; }
.fav-btn { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 0; cursor: pointer;
    background: rgb(255 255 255 / .85); color: #6b5a4e; backdrop-filter: blur(6px); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), color .2s; }
.fav-btn:hover { transform: scale(1.1); color: #e11d48; }
.fav-btn.is-active { color: #e11d48; }
.fav-btn.is-active .icon { fill: currentColor; }
.card__body { display: flex; flex-direction: column; gap: .5rem; padding: 1.1rem 1.2rem 1.2rem; flex: 1; }
.card__title { font-size: 1.2rem; margin: 0; }
.card__title a { color: var(--text); text-decoration: none; }
.card__title a::after { content: ""; position: absolute; inset: 0; z-index: 0; } /* ganze Karte klickbar */
.card__fav, .card__media .badge { z-index: 1; }
.card__desc { color: var(--text-soft); font-size: .92rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__foot { display: flex; align-items: center; gap: .5rem; margin-top: auto; padding-top: .6rem; border-top: 1px dashed var(--border); }
.card__likes { margin-left: auto; display: inline-flex; gap: .25rem; align-items: center; }
.meta { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; color: var(--text-soft); }
.meta span { display: inline-flex; align-items: center; gap: .3rem; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
    background: var(--bg-soft); color: var(--text-soft); border: 1px solid var(--border); }
.badge--accent { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge--glass { background: rgb(255 255 255 / .82); color: #3b2e25; border: 0; backdrop-filter: blur(8px); }
.avatar { display: inline-grid; place-items: center; flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #e11d48); color: #fff; font-size: .8rem; font-weight: 700; }
.avatar--xl { width: 4.5rem; height: 4.5rem; font-size: 1.8rem; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 2.5rem; }

.empty { text-align: center; padding: 4rem 1rem; }
.empty--page { padding-top: 6rem; }
.empty__emoji { font-size: 4rem; margin-bottom: .5rem; animation: bob 3s ease-in-out infinite; }
.empty__title { font-size: 1.8rem; }
@keyframes bob { 50% { transform: translateY(-8px); } }

/* ---------- Seitenköpfe & Panels ---------- */
.page-head { padding: 2rem 0 1.25rem; }
.page-head--row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; }
.page-title { font-size: clamp(1.7rem, 3.5vw, 2.4rem); margin: .3rem 0 0; }
.back-link { display: inline-flex; align-items: center; gap: .35rem; color: rgb(255 255 255 / .9); text-decoration: none; font-size: .9rem; font-weight: 500; }
.back-link:hover { color: #fff; }
.back-link--dark { color: var(--text-soft); }
.back-link--dark:hover { color: var(--primary); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(1.1rem, 3vw, 1.75rem); box-shadow: var(--shadow-sm); }
.panel + .panel { margin-top: 1.25rem; }
.panel--flush { padding: 0; overflow: hidden; }
.panel--note { background: linear-gradient(135deg, var(--warning-soft), var(--surface)); }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .25rem; }
.panel__title { font-size: 1.3rem; margin-bottom: .75rem; }
.panel__head .panel__title { margin: 0; }
.section-title { font-size: 1.1rem; margin: .75rem 0 0; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; flex-wrap: wrap; margin-top: .5rem; }
.recipe-form .panel + .panel { margin-top: 0; }

/* ---------- Dynamische Zeilen (Zutaten, Schritte) ---------- */
.rows { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .6rem; }
.row { display: grid; gap: .5rem; align-items: start; animation: rise .3s var(--ease); }
.row--ing { grid-template-columns: 5.5rem 6.5rem 1fr auto; }
.row--step { grid-template-columns: auto 1fr auto; }
.row__tools { display: flex; gap: .1rem; padding-top: .25rem; }
.row:first-child [data-row-up], .row:last-child [data-row-down] { visibility: hidden; }
@media (max-width: 600px) {
    .row--ing { grid-template-columns: 1fr 1fr; }
    .row--ing input:nth-child(3) { grid-column: 1 / -1; }
    .row--ing .row__tools { grid-column: 1 / -1; justify-content: flex-end; padding: 0; }
    .row--ing { padding-bottom: .6rem; border-bottom: 1px dashed var(--border); }
    .row--step { grid-template-columns: auto 1fr; }
    .row--step .row__tools { grid-column: 2; justify-content: flex-end; }
}

.upload { position: relative; }
.upload__preview { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 7; border-radius: var(--radius); overflow: hidden;
    border: 2px dashed var(--border); background: var(--surface-2); color: var(--text-soft); text-align: center; transition: border-color .2s, background .2s; }
.upload__preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.upload__preview.has-image .upload__hint { opacity: 0; background: rgb(0 0 0 / .45); color: #fff; padding: .8rem 1.2rem; border-radius: var(--radius); position: relative; transition: opacity .2s; }
.upload:hover .upload__preview.has-image .upload__hint { opacity: 1; }
.upload.is-drag .upload__preview { border-color: var(--primary); background: var(--primary-soft); }
.upload__input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.upload:focus-within .upload__preview { border-color: var(--primary); box-shadow: var(--ring); }

/* ---------- Rezept-Detail ---------- */
.recipe-hero { position: relative; min-height: clamp(280px, 48vh, 520px); display: grid; overflow: hidden; background: #2b211a; }
.recipe-hero--plain { min-height: 320px; background: linear-gradient(135deg, var(--primary), #9f1239 60%, #3f2a1e); }
.recipe-hero__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: zoom 1.4s var(--ease); }
@keyframes zoom { from { transform: scale(1.08); } }
.recipe-hero__emoji { position: absolute; right: 8%; top: 50%; translate: 0 -50%; font-size: clamp(7rem, 18vw, 12rem); opacity: .9; filter: drop-shadow(0 20px 30px rgb(0 0 0 / .35)); }
.recipe-hero__overlay { position: relative; align-self: end; padding: 5rem 0 2rem; color: #fff;
    background: linear-gradient(to top, rgb(20 12 6 / .85), rgb(20 12 6 / .35) 60%, transparent); }
.recipe-hero__title { font-size: clamp(2rem, 5.5vw, 3.8rem); margin: .5rem 0 .25rem; text-wrap: balance; text-shadow: 0 2px 20px rgb(0 0 0 / .3); }
.recipe-hero__by { margin: 0; opacity: .85; }
.recipe-hero__badges { display: flex; gap: .5rem; margin-top: 1rem; }
.recipe__body { margin-top: -1.5rem; position: relative; }
.recipe__bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.25rem; box-shadow: var(--shadow); }
.stats { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0; }
.stats dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); display: flex; align-items: center; gap: .3rem; }
.stats dd { margin: 0; font-weight: 700; font-size: 1.05rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.recipe__lead { font-size: 1.15rem; color: var(--text-soft); max-width: 70ch; margin: 2rem 0 0; font-family: var(--font-serif); font-style: italic; }
.recipe__cols { display: grid; grid-template-columns: minmax(280px, 1fr) 2fr; gap: 1.5rem; margin: 2rem 0 1.5rem; align-items: start; }
.recipe__cols .panel + .panel { margin-top: 0; }
.ingredients { position: sticky; top: 5rem; }
@media (max-width: 860px) { .recipe__cols { grid-template-columns: 1fr; } .ingredients { position: static; } }

.stepper { display: inline-flex; align-items: center; gap: .25rem; background: var(--bg-soft); border-radius: 999px; padding: .15rem; }
.stepper__value { min-width: 2ch; text-align: center; font-weight: 700; }
.ing-list { list-style: none; margin: .5rem 0 0; padding: 0; }
.ing-list li + li { border-top: 1px solid var(--border); }
.ing { display: grid; grid-template-columns: auto minmax(4.5rem, auto) 1fr; gap: .75rem; align-items: baseline; padding: .6rem 0; cursor: pointer; }
.ing__amount { font-weight: 700; color: var(--primary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ing:has(.ing__check:checked) { opacity: .45; }
.ing:has(.ing__check:checked) .ing__name { text-decoration: line-through; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; counter-reset: s; }
.step { display: grid; grid-template-columns: auto 1fr; gap: 1rem; padding: 1rem; border-radius: var(--radius); background: var(--surface-2); cursor: pointer; transition: opacity .2s, background .2s; }
.step:hover { background: var(--bg-soft); }
.step.is-done { opacity: .5; }
.step.is-done .step__num { background: var(--accent); }
.step.is-done .step__num::after { content: "✓"; }
.step.is-done .step__num { font-size: 0; }
.step.is-done .step__num::after { font-size: 1rem; }
.step__num { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; flex: none;
    background: var(--primary); color: #fff; font-weight: 700; font-family: var(--font-serif); }
.step__text { margin: .2rem 0 0; }

/* ---------- Tabelle ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); background: var(--surface-2); }
.table th, .table td { padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table__actions { text-align: right; white-space: nowrap; }
.user-cell { display: flex; gap: .75rem; align-items: center; }
.user-cell .avatar { width: 2.4rem; height: 2.4rem; font-size: 1rem; }
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .3rem; }
.dot--on { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot--off { background: var(--text-soft); }
.dot--warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
@media (max-width: 760px) {
    .table thead { display: none; }
    .table tr { display: grid; grid-template-columns: 1fr 1fr; padding: .75rem 0; border-bottom: 1px solid var(--border); }
    .table td { border: 0; padding: .35rem 1rem; }
    .table td[data-label="Benutzer"], .table__actions { grid-column: 1 / -1; }
    .table td[data-label]:not([data-label="Benutzer"])::before { content: attr(data-label); display: block; font-size: .72rem; text-transform: uppercase; color: var(--text-soft); }
    .table__actions { text-align: left; }
}

/* ---------- Profil ---------- */
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; margin-top: 2rem; }
.profile-head .page-title { margin: 0; }
.profile-head p { margin: 0; }
.profile-stats { display: flex; gap: 2rem; margin: 0 0 0 auto; }
.profile-stats dt { font-size: .78rem; text-transform: uppercase; color: var(--text-soft); }
.profile-stats dd { margin: 0; font: 700 1.8rem var(--font-serif); }

/* ---------- Login / Auth ---------- */
.auth-page { background:
    radial-gradient(800px 500px at 0% 0%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 60%),
    var(--bg); }
.auth-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.auth-bg span { position: absolute; font-size: 3rem; opacity: .22; animation: float 14s ease-in-out infinite; }
.auth-bg span:nth-child(1) { left: 8%; top: 14%; }
.auth-bg span:nth-child(2) { left: 82%; top: 10%; animation-delay: -2s; }
.auth-bg span:nth-child(3) { left: 14%; top: 72%; animation-delay: -4s; }
.auth-bg span:nth-child(4) { left: 88%; top: 64%; animation-delay: -6s; }
.auth-bg span:nth-child(5) { left: 48%; top: 6%; animation-delay: -8s; }
.auth-bg span:nth-child(6) { left: 70%; top: 86%; animation-delay: -3s; }
.auth-bg span:nth-child(7) { left: 30%; top: 90%; animation-delay: -5s; }
.auth-bg span:nth-child(8) { left: 4%; top: 44%; animation-delay: -7s; }
@keyframes float { 50% { transform: translateY(-24px) rotate(12deg); } }
.auth-shell { position: relative; flex: 1; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-shell--wide .auth-card { max-width: 640px; }
.auth-card { width: 100%; max-width: 420px; padding: clamp(1.5rem, 5vw, 2.5rem); border-radius: 28px;
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(20px);
    border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: rise .6s var(--ease); }
.auth-title { font-size: 1.9rem; text-align: center; margin-bottom: .25rem; }
.auth-sub { text-align: center; margin-bottom: 1.5rem; }
.auth-foot { text-align: center; margin: 1.25rem 0 0; font-size: .92rem; color: var(--text-soft); }
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .3rem; font-size: .92rem; }
.checklist .ok { color: var(--accent); }
.checklist .fail { color: var(--danger); font-weight: 600; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 1.5rem 0; font-size: .85rem; }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.auth-page .footer { display: none; }

/* ---------- Bewegung reduzieren ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Druck ---------- */
@media print {
    .topbar, .footer, .no-print, .toasts, .back-link, .skip-link { display: none !important; }
    body { background: #fff; color: #000; font-size: 11pt; }
    .recipe-hero { min-height: 0; background: none; }
    .recipe-hero__img { position: static; max-height: 7cm; width: auto; border-radius: 8px; animation: none; }
    .recipe-hero__emoji { display: none; }
    .recipe-hero__overlay { background: none; color: #000; padding: .5rem 0; }
    .recipe-hero__title { text-shadow: none; }
    .badge--glass { border: 1px solid #ccc; }
    .recipe__body { margin: 0; }
    .recipe__bar, .panel { box-shadow: none; border: 1px solid #ddd; }
    .recipe__cols { grid-template-columns: 1fr 2fr; }
    .ingredients { position: static; }
    .step { background: none; padding: .3rem 0; break-inside: avoid; }
    .ing__check { display: none; }
}

/* ---------- Dialog ---------- */
.btn--danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: transparent; }
.dialog { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; max-width: min(440px, calc(100% - 2rem));
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog[open] { animation: rise .25s var(--ease); }
.dialog::backdrop { background: rgb(20 12 6 / .5); backdrop-filter: blur(3px); }
.dialog__text { font-size: 1.05rem; margin-bottom: 1.25rem; }
.dialog__actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* ---------- Spezifitäts-Korrekturen ---------- */
.search input.search__input { border: 0; background: transparent; box-shadow: none; padding: .6rem 0; border-radius: 0; }
.card__media { text-decoration: none; }

/* ---------- Rechtliches (Impressum, Datenschutz) ---------- */
.legal { margin-top: 2rem; line-height: 1.7; }
.legal .page-title { margin-bottom: .5rem; }
.legal h2 { font-size: 1.25rem; margin: 2rem 0 .6rem; scroll-margin-top: 5rem; }
.legal address { font-style: normal; margin: 0 0 1em; padding: .9rem 1.1rem; border-left: 3px solid var(--primary);
    background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.legal ul { padding-left: 1.2rem; margin: 0 0 1em; }
.legal li + li { margin-top: .35rem; }
.legal__note { padding: .9rem 1.1rem; border-radius: var(--radius-sm); background: var(--info-soft); }
.legal__toc { margin: 1.25rem 0 0; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.legal__toc ol { margin: 0; padding-left: 1.2rem; columns: 2 16rem; column-gap: 2rem; }
.legal__toc a { text-decoration: none; }
.legal__table { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.legal__table .table tr { display: table-row; padding: 0; }
.legal__table .table thead { display: table-header-group; }
.legal__table .table td { display: table-cell; padding: .6rem .9rem; border-bottom: 1px solid var(--border); }
.legal__table .table td::before { content: none !important; }
.footer__links { display: flex; gap: 1.25rem; }
.footer__links a { color: var(--text-soft); text-decoration: none; }
.footer__links a:hover { color: var(--primary); text-decoration: underline; }
.topbar__login { margin-left: auto; }
.auth-legal { position: relative; display: flex; justify-content: center; gap: 1.5rem; padding: 0 1rem 1.5rem; font-size: .85rem; }
.auth-legal a { color: var(--text-soft); text-decoration: none; }
.auth-legal a:hover { color: var(--primary); text-decoration: underline; }
@media print { .legal__toc { display: none; } }

/* ---------- Geschützte E-Mail-Adresse ---------- */
.mail { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; vertical-align: middle; }
.mail__img { display: inline-block; line-height: 0; }
.mail__img img { width: 165px; height: auto; user-select: none; -webkit-user-drag: none; }
.mail__img--dark { display: none; }
[data-theme="dark"] .mail__img--light { display: none; }
[data-theme="dark"] .mail__img--dark { display: inline; }
.mail__btn[hidden] { display: none; }
@media print { .mail__btn { display: none !important; } }
