/* Hanft Recipes – schlicht, weiß & schwarz */

:root {
  --bg: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #2a2a2a;
  --muted: #6f6f6f;
  --faint: #a3a3a3;
  --line: #e7e7e5;
  --soft: #f4f4f2;
  --soft-2: #ececea;
  --danger: #b3261e;
  --radius: 18px;
  --radius-sm: 12px;
  --serif: 'Instrument Serif', 'Times New Roman', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1240px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

main { outline: none; min-height: 70vh; padding-bottom: 120px; }

.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Kopfzeile ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--ink); color: #fff;
  font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1;
  padding-top: 2px;
}
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: .01em; }
.brand-name em { font-family: var(--serif); font-weight: 400; font-size: 22px; letter-spacing: 0; margin-right: 1px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff;
  text-decoration: none; transition: background .15s, transform .15s;
}
.icon-btn:hover { background: var(--soft); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Plus-Button ---------- */

.fab {
  position: fixed; z-index: 30;
  right: calc(var(--gutter) + env(safe-area-inset-right));
  bottom: calc(22px + env(safe-area-inset-bottom));
  display: grid; place-items: center;
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--ink); color: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,.22), 0 2px 6px rgba(0,0,0,.18);
  transition: transform .25s var(--ease), opacity .2s;
}
.fab svg { width: 28px; height: 28px; stroke-width: 2; }
.fab:hover { transform: rotate(90deg); }
.fab:active { transform: scale(.92); }
.fab.hidden { opacity: 0; pointer-events: none; transform: scale(.6); }

/* ---------- Startseite ---------- */

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.hero { padding: clamp(26px, 6vw, 72px) 0 clamp(18px, 3vw, 30px); text-align: center; }
.hero .eyebrow::after { content: ''; width: 26px; height: 1px; background: currentColor; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before { content: ''; width: 26px; height: 1px; background: currentColor; }
.hero h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(46px, 11vw, 116px);
  line-height: .92; letter-spacing: -.02em;
  margin: 14px 0 0;
}
.hero h1 em { font-style: normal; }

.toolbar {
  position: sticky; top: calc(62px + env(safe-area-inset-top)); z-index: 10;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  margin: 0 calc(var(--gutter) * -1); padding: 10px var(--gutter) 12px;
}
.search {
  position: relative; display: flex; align-items: center;
}
.search svg { position: absolute; left: 16px; width: 19px; height: 19px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 50px; padding: 0 44px 0 46px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--soft);
  font-size: 16px; outline: none; transition: border-color .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
.search input:focus { background: #fff; border-color: var(--ink); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute; right: 8px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted); display: grid; place-items: center;
}
.search-clear svg { position: static; width: 16px; height: 16px; }

.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 12px calc(var(--gutter) * -1) 0; padding: 0 var(--gutter);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 15px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .count { opacity: .5; margin-left: 5px; font-weight: 400; }

.grid {
  display: grid; gap: clamp(16px, 3vw, 34px) clamp(12px, 2.4vw, 28px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card { text-decoration: none; display: block; animation: rise .5s var(--ease) both; }
.card-media {
  position: relative; aspect-ratio: 4 / 5; border-radius: var(--radius);
  overflow: hidden; background: var(--soft);
}
.card-media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .7s var(--ease), opacity .4s;
}
.card-media img.loading { opacity: 0; }
.card:hover .card-media img { transform: scale(1.045); }
.card:active .card-media { transform: scale(.985); }
.card-media { transition: transform .2s var(--ease); }
.card-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(22px, 2.6vw, 28px); line-height: 1.08;
  margin: 12px 2px 0;
  overflow-wrap: anywhere; hyphens: auto;
}

.placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  background:
    radial-gradient(circle at 30% 20%, #fafaf8 0, transparent 60%),
    var(--soft);
}
.placeholder span {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(64px, 12vw, 120px); line-height: 1; color: var(--ink);
  opacity: .9;
}
.placeholder::after {
  content: ''; position: absolute; inset: 12px; border-radius: calc(var(--radius) - 8px);
  border: 1px solid rgba(0,0,0,.08);
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.empty {
  text-align: center; padding: 60px 20px 40px; max-width: 460px; margin: 0 auto;
}
.empty h2 { font-family: var(--serif); font-weight: 400; font-size: 38px; line-height: 1.05; margin: 0 0 10px; }
.empty p { color: var(--muted); margin: 0 0 22px; }

.footer {
  margin-top: 70px; padding-top: 22px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: space-between;
  font-size: 13px; color: var(--muted);
}
.footer a { color: var(--muted); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: 999px;
  border: 1px solid var(--ink); background: #fff; color: var(--ink);
  font-weight: 500; font-size: 15px; text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s, transform .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #262626; }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { border-color: transparent; color: var(--danger); padding: 0 6px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-sm { height: 38px; padding: 0 15px; font-size: 14px; }

/* ---------- Rezept-Detail ---------- */

.recipe { animation: fade .35s var(--ease) both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.recipe-hero {
  position: relative; max-width: var(--max); margin: 0 auto;
  padding: 0 var(--gutter);
}
.recipe-hero .media {
  position: relative; overflow: hidden; border-radius: var(--radius);
  aspect-ratio: 4 / 3; background: var(--soft);
  max-height: 72vh; width: 100%;
}
@media (min-width: 900px) { .recipe-hero .media { aspect-ratio: 16 / 9; } }
.recipe-hero .media img { width: 100%; height: 100%; object-fit: cover; }
.recipe-hero .media .placeholder span { font-size: clamp(120px, 26vw, 260px); }

@media (max-width: 640px) {
  .recipe-hero { padding: 0; }
  .recipe-hero .media { border-radius: 0; aspect-ratio: 1 / 1; max-height: 64vh; }
}

.float-bar {
  position: absolute; left: calc(var(--gutter) + 12px); right: calc(var(--gutter) + 12px); top: 12px;
  display: flex; justify-content: space-between; pointer-events: none;
}
.float-bar > * { pointer-events: auto; }
@media (max-width: 640px) { .float-bar { left: 14px; right: 14px; } }
.float-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 42px; min-width: 42px; padding: 0 14px; justify-content: center;
  border-radius: 999px; border: 0;
  background: rgba(255,255,255,.92); color: var(--ink);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  text-decoration: none; font-size: 14px; font-weight: 500;
}
.float-btn svg { width: 18px; height: 18px; }

.recipe-head { max-width: 900px; padding-top: clamp(22px, 4vw, 44px); }
.recipe-head .eyebrow { margin-bottom: 12px; }
.recipe-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(44px, 9vw, 92px); line-height: .95; letter-spacing: -.02em;
  margin: 0; overflow-wrap: anywhere; hyphens: auto;
}
.recipe-intro { font-size: 18px; color: var(--ink-2); margin: 18px 0 0; max-width: 680px; white-space: pre-line; }

.meta {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px;
}
.meta-item {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 14px;
}
.meta-item svg { width: 18px; height: 18px; color: var(--muted); }
.meta-item b { font-weight: 600; }

.stepper { padding: 0 5px; gap: 2px; }
.stepper button {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; font-size: 20px; line-height: 1;
}
.stepper button:hover { background: var(--soft); }
.stepper .val { min-width: 92px; text-align: center; }

.toggle { cursor: pointer; user-select: none; -webkit-user-select: none; background: #fff; }
.toggle[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.toggle[aria-pressed="true"] svg { color: #fff; }

.recipe-body {
  display: grid; gap: 44px; margin-top: 44px;
}
@media (min-width: 880px) {
  .recipe-body { grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 64px; align-items: start; }
  .ingredients-panel { position: sticky; top: calc(84px + env(safe-area-inset-top)); }
}

.section-label {
  display: flex; align-items: baseline; justify-content: space-between;
  font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1;
  margin: 0 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--ink);
}
.section-label small { font-family: var(--sans); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.ing-list { list-style: none; margin: 0; padding: 0; }
.ing-list li { border-bottom: 1px solid var(--line); }
.ing-list li.group {
  border: 0; padding: 22px 0 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.ing-list li.group:first-child { padding-top: 4px; }
.ing {
  display: flex; gap: 14px; align-items: flex-start; width: 100%;
  padding: 13px 2px; border: 0; background: transparent; text-align: left;
  font-size: 16px; line-height: 1.4;
}
.ing .box {
  flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 6px;
  border: 1.5px solid var(--ink); display: grid; place-items: center;
  transition: background .15s;
}
.ing .box svg { width: 13px; height: 13px; stroke-width: 3; color: #fff; opacity: 0; }
.ing .qty { font-weight: 600; }
.ing.done { color: var(--faint); }
.ing.done .txt { text-decoration: line-through; text-decoration-thickness: 1px; }
.ing.done .box { background: var(--ink); }
.ing.done .box svg { opacity: 1; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 4px;
  padding: 20px 10px 22px 0; border-bottom: 1px solid var(--line);
  cursor: pointer; border-radius: 4px; transition: background .2s, opacity .2s;
}
.step::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  font-family: var(--serif); font-size: 44px; line-height: .9;
  color: transparent; -webkit-text-stroke: 1px var(--ink);
  transition: color .2s;
}
.step p { margin: 3px 0 0; font-size: 17px; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
.steps.has-active .step { opacity: .38; }
.steps.has-active .step.active { opacity: 1; }
.step.active::before { color: var(--ink); }
.steps-hint { font-size: 13px; color: var(--muted); margin: 14px 0 0; }

.step-heading {
  font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  padding: 26px 0 4px; list-style: none;
}

.notes {
  margin-top: 40px; padding: 24px 24px 22px; border-radius: var(--radius); background: var(--soft);
}
.notes h3 { margin: 0 0 8px; font-family: var(--serif); font-weight: 400; font-size: 26px; }
.notes p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }

.recipe-foot {
  margin-top: 36px; display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 14px; color: var(--muted);
}
.recipe-foot a { color: var(--ink); overflow-wrap: anywhere; }

/* ---------- Formulare ---------- */

.page-head { padding: clamp(22px, 5vw, 50px) 0 22px; }
.page-head h1 {
  font-family: var(--serif); font-weight: 400; margin: 10px 0 0;
  font-size: clamp(40px, 8vw, 72px); line-height: .95; letter-spacing: -.02em;
}

.form { max-width: 760px; }
.field { margin-bottom: 22px; }
.field label, .label {
  display: block; margin-bottom: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: .02em;
}
.field .hint { font-weight: 400; color: var(--muted); }
.input, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; padding: 13px 15px; font-size: 16px; outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.input:focus, .textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
.input-title { font-family: var(--serif); font-size: 30px; padding: 10px 15px; line-height: 1.2; }
.textarea { min-height: 140px; resize: vertical; line-height: 1.55; }
.textarea.tall { min-height: 260px; }
.row { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .row { grid-template-columns: repeat(3, 1fr); } }

.photo-drop {
  position: relative; display: grid; place-items: center; width: 100%;
  aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden;
  border: 1.5px dashed #cfcfcc; background: var(--soft); cursor: pointer;
  text-align: center; color: var(--muted); transition: border-color .15s;
}
.photo-drop:hover, .photo-drop.drag { border-color: var(--ink); color: var(--ink); }
.photo-drop svg { width: 34px; height: 34px; margin: 0 auto 8px; stroke-width: 1.4; }
.photo-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-drop.has-image { border-style: solid; border-color: transparent; }
.photo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-actions { display: flex; gap: 8px; margin-top: 10px; }
.photo-busy {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(255,255,255,.7); color: var(--ink); font-weight: 500;
}

details.paste {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0 18px; margin: 4px 0 28px;
}
details.paste summary {
  cursor: pointer; list-style: none; padding: 16px 0; font-weight: 500;
  display: flex; align-items: center; justify-content: space-between;
}
details.paste summary::-webkit-details-marker { display: none; }
details.paste summary::after { content: '+'; font-size: 22px; font-weight: 300; }
details.paste[open] summary::after { content: '–'; }
details.paste .inner { padding-bottom: 18px; }
details.paste p { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
details.paste .btn svg { width: 17px; height: 17px; }
.grab-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.grab-file { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--soft); }
.grab-file img { width: 100%; height: 100%; object-fit: cover; }
.grab-file button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; padding: 0; }
.grab-file button svg { width: 12px; height: 12px; }

.save-bar {
  position: sticky; bottom: 0; z-index: 15;
  margin: 30px calc(var(--gutter) * -1) 0; padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex; gap: 10px; align-items: center;
}
.save-bar .spacer { flex: 1; }

.form-error { color: var(--danger); font-size: 14px; margin: 10px 0 0; }

.card-box {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
}
.card-box h2 { margin: 0 0 6px; font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.1; }
.card-box p { margin: 0 0 14px; color: var(--muted); }
.card-box ol { margin: 0 0 16px; padding-left: 20px; color: var(--ink-2); }
.card-box ol li { margin-bottom: 6px; }
.stack { display: grid; gap: 12px; }
.inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Import ---------- */

.import-list { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--line); }
.import-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.import-item input[type=checkbox] { width: 20px; height: 20px; margin-top: 3px; accent-color: #000; flex: none; }
.import-item .thumb { flex: none; width: 56px; height: 56px; border-radius: 10px; background: var(--soft); object-fit: cover; }
.import-item .t { font-weight: 600; line-height: 1.3; }
.import-item .s { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.import-item .tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); margin-right: 4px; color: var(--muted); }
.import-item.state-done { opacity: .5; }
.import-item.state-error .t { color: var(--danger); }
.progress { height: 4px; border-radius: 4px; background: var(--soft-2); overflow: hidden; margin-top: 14px; }
.progress div { height: 100%; width: 0; background: var(--ink); transition: width .3s; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 500; max-width: calc(100vw - 32px); text-align: center;
  transition: opacity .25s, transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.spinner {
  width: 26px; height: 26px; border-radius: 50%; margin: 80px auto;
  border: 2px solid var(--line); border-top-color: var(--ink);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .topbar, .fab, .float-bar, .meta .toggle, .steps-hint, .toast { display: none !important; }
  .recipe-hero .media { max-height: 40vh; }
}
