/* ===================================================================== Kuchařka */
:root {
  --bg: #f6f1e9;
  --surface: #fffdf9;
  --surface-2: #efe7da;
  --ink: #2a211b;
  --ink-soft: #4a3f36;
  --muted: #7a6c60;
  --line: #e3d8c7;
  --accent: #b5452b;
  --accent-hover: #9c3a23;
  --accent-ink: #ffffff;
  --accent-soft: #f5e0d6;
  --herb: #50703f;
  --herb-soft: #e2ead9;
  --danger: #a8322a;
  --danger-soft: #f7dcd8;
  --shadow-sm: 0 1px 2px rgba(70, 45, 20, .06);
  --shadow: 0 1px 2px rgba(70, 45, 20, .05), 0 10px 30px -12px rgba(70, 45, 20, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1613;
    --surface: #231e1a;
    --surface-2: #2c2621;
    --ink: #f0e8dd;
    --ink-soft: #d5c9bb;
    --muted: #a89a8b;
    --line: #3a322b;
    --accent: #e07352;
    --accent-hover: #ea876a;
    --accent-ink: #1a1613;
    --accent-soft: #3b2620;
    --herb: #a3c08f;
    --herb-soft: #26301f;
    --danger: #ef7d72;
    --danger-soft: #3a211e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; margin: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
h2 { font-size: 1.45rem; }
p { margin: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.muted { color: var(--muted); }
.lead { font-size: 1.125rem; color: var(--ink-soft); }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

.icon { width: 1.15em; height: 1.15em; flex: none; }

/* ------------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: 16px;
  min-height: 68px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
}
.brand-mark .icon { width: 22px; height: 22px; }
.brand-name { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; letter-spacing: -.01em; }

.search {
  order: 3; flex: 1 1 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px; height: 44px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: inherit; }
@media (min-width: 760px) {
  .brand { margin-right: 0; }
  .search { order: 0; flex: 1 1 auto; max-width: 460px; margin: 0 auto; }
}

.nav { display: flex; align-items: center; gap: 10px; }

/* ------------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 .95rem/1 var(--sans); text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, .card:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent-soft); outline-offset: 2px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger-ghost:hover { color: var(--danger); background: var(--danger-soft); }
.btn-icon { width: 42px; padding: 0; }
.btn-lg { height: 50px; padding: 0 26px; font-size: 1rem; }
@media (max-width: 559px) {
  .hide-sm { display: none; }
  .nav .btn, .actions .btn { width: 42px; padding: 0; }
}

/* ------------------------------------------------------------------- user menu */
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; border-radius: 999px; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--herb-soft); color: var(--herb); font-weight: 700; font-size: .9rem;
  border: 1px solid var(--line);
}
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 260px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column;
}
.menu-head { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head .muted { font-size: .85rem; overflow-wrap: anywhere; }
.menu-head .badge { margin-top: 6px; }
.menu a { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px; text-decoration: none; }
.menu a:hover { background: var(--surface-2); }
.menu-logout { color: var(--danger); }

.badge {
  align-self: flex-start; display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 700; letter-spacing: .02em;
  background: var(--surface-2); color: var(--ink-soft);
}
.badge-admin { background: var(--accent-soft); color: var(--accent); }
.badge-writer { background: var(--herb-soft); color: var(--herb); }

/* ------------------------------------------------------------------- layout */
.main { flex: 1; padding-top: 32px; padding-bottom: 64px; }
.site-footer { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: .875rem; text-align: center; }

.flash {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px;
  background: var(--herb-soft); color: var(--herb); border: 1px solid color-mix(in srgb, var(--herb) 25%, transparent);
}
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.flash ul { margin: 6px 0 0; padding-left: 20px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head .muted { margin-top: 4px; }

.back {
  display: inline-flex; align-items: center; gap: 4px; color: var(--muted);
  text-decoration: none; font-weight: 600; font-size: .925rem;
}
.back:hover { color: var(--ink); }

/* ------------------------------------------------------------------- chips */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px 18px;
  scrollbar-width: thin;
}
.chip {
  flex: none; padding: 7px 15px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  font-size: .9rem; font-weight: 600; transition: background .15s, border-color .15s;
}
.chip:hover { border-color: var(--muted); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ------------------------------------------------------------------- cards */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-media { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-media img { transform: scale(1.04); }
.card-cat {
  position: absolute; left: 12px; top: 12px; padding: 4px 11px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink);
  font-size: .78rem; font-weight: 700; box-shadow: var(--shadow-sm);
}
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-size: 1.3rem; }
.card-summary { color: var(--muted); font-size: .925rem; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: auto; padding-top: 8px; color: var(--muted); font-size: .85rem; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }

.placeholder { width: 100%; height: 100%; display: grid; place-items: center; }
.placeholder span { font-family: var(--serif); font-size: 4.5rem; font-weight: 600; opacity: .85; }
.ph-0 { background: linear-gradient(135deg, #f3d6c4, #e7b49a); color: #8a3a22; }
.ph-1 { background: linear-gradient(135deg, #dfe8cf, #bcd0a5); color: #44602f; }
.ph-2 { background: linear-gradient(135deg, #f5e5bf, #e8cd8b); color: #7d5a12; }
.ph-3 { background: linear-gradient(135deg, #ead7d9, #d6b0b5); color: #7a3843; }
.ph-4 { background: linear-gradient(135deg, #d9e3e5, #b3c8cc); color: #345860; }
@media (prefers-color-scheme: dark) {
  .placeholder { filter: brightness(.55) saturate(.9); }
  .placeholder span { color: #fff; }
}

/* ------------------------------------------------------------------- empty / landing */
.empty { text-align: center; padding: 64px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-icon { width: 64px; height: 64px; color: var(--accent); opacity: .8; margin-bottom: 6px; }
.empty .btn { margin-top: 10px; }
.actions-center { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

.landing { max-width: 620px; margin: 6vh auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.landing-art {
  width: 112px; height: 112px; border-radius: 32px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); transform: rotate(-6deg);
}
.landing-icon { width: 60px; height: 60px; }
.landing h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
.landing .btn { margin-top: 8px; }

/* ------------------------------------------------------------------- recipe detail */
.recipe-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.actions { display: flex; gap: 8px; align-items: center; }
.actions form { margin: 0; }

.recipe-head { display: grid; gap: 28px; margin-bottom: 40px; }
@media (min-width: 900px) {
  .recipe-head.has-image { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 44px; }
}
.recipe-hero { margin: 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 4 / 3; background: var(--surface-2); }
.recipe-hero img { width: 100%; height: 100%; object-fit: cover; }
.recipe-intro { display: flex; flex-direction: column; gap: 14px; }
.eyebrow { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; text-decoration: none; }
.recipe-intro h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); }

.facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 0; }
.facts div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 16px; min-width: 104px; }
.facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.facts dd { margin: 2px 0 0; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.byline { font-size: .9rem; }

.recipe-body { display: grid; gap: 28px; }
@media (min-width: 900px) { .recipe-body { grid-template-columns: 340px 1fr; gap: 48px; align-items: start; } }

.ingredients {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 22px 14px; box-shadow: var(--shadow-sm);
}
@media (min-width: 900px) { .ingredients { position: sticky; top: 92px; } }
.ingredients h2, .steps h2 { margin-bottom: 14px; }
.ingredients ul { list-style: none; margin: 0; padding: 0; }
.ingredients li { border-bottom: 1px dashed var(--line); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients label { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; cursor: pointer; }
.ingredients input[type="checkbox"] {
  appearance: none; flex: none; width: 20px; height: 20px; margin: 2px 0 0;
  border: 1.5px solid var(--muted); border-radius: 6px; display: grid; place-items: center; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ingredients input[type="checkbox"]::after {
  content: ""; width: 10px; height: 6px; border: 2px solid var(--accent-ink);
  border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); opacity: 0;
}
.ingredients input:checked { background: var(--herb); border-color: var(--herb); }
.ingredients input:checked::after { opacity: 1; }
.ingredients input:checked + span { color: var(--muted); text-decoration: line-through; }
.ing-heading {
  padding: 16px 0 4px; font-weight: 700; font-size: .8rem; text-transform: uppercase;
  letter-spacing: .07em; color: var(--accent); border-bottom: 0 !important;
}
.ing-heading:first-child { padding-top: 0; }

.steps ol { list-style: none; counter-reset: step; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 44px 1fr; gap: 16px; font-size: 1.06rem; line-height: 1.7; }
.steps li::before {
  content: counter(step);
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--serif); font-weight: 700; font-size: 1.2rem;
}
.source { margin-top: 32px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .925rem; }
.source a { color: var(--accent); overflow-wrap: anywhere; }

/* ------------------------------------------------------------------- forms */
.form-page { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.recipe-form { display: flex; flex-direction: column; gap: 18px; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 18px; box-shadow: var(--shadow-sm);
}
@media (max-width: 559px) { .panel { padding: 16px; } }
.row { display: grid; gap: 18px; }
@media (min-width: 600px) { .row { grid-template-columns: 1fr 1fr; } .row-3 { grid-template-columns: 1fr 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 700; font-size: .925rem; }
.opt { font-weight: 500; color: var(--muted); font-size: .8rem; margin-left: 4px; }
.hint { color: var(--muted); font-size: .85rem; margin-top: -2px; }

input:not([type="checkbox"]):not([type="file"]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 13px;
  transition: border-color .15s, box-shadow .15s;
}
input:not([type="checkbox"]):not([type="file"]), select { height: 46px; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input:focus { box-shadow: none; }

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  min-height: 150px; padding: 18px; border: 2px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--muted); cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-text { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-preview { max-height: 220px; border-radius: 8px; object-fit: cover; }
.dropzone-preview[hidden] { display: none; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: .925rem; cursor: pointer; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }

.inline-form { display: flex; gap: 10px; align-items: center; flex-direction: row; }
.inline-form input { flex: 1; }
.cat-list { list-style: none; margin: 0; gap: 0; padding: 8px 22px; }
.cat-list li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cat-list li:last-child { border-bottom: 0; }
.cat-list .inline-form { flex: 1; }
.cat-list form { margin: 0; }
.cat-list .count { font-size: .85rem; white-space: nowrap; }
@media (max-width: 559px) { .cat-list .count { display: none; } }

/* ------------------------------------------------------------------- print */
@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #000; --muted: #444; --line: #ccc; }
  .site-header, .site-footer, .recipe-top, .flash { display: none !important; }
  .main { padding: 0; }
  .recipe-head.has-image { grid-template-columns: 1fr 1.4fr; }
  .recipe-hero { box-shadow: none; max-height: 7cm; }
  .recipe-body { grid-template-columns: 6.5cm 1fr; }
  .ingredients { position: static; box-shadow: none; }
  .ingredients input { display: none; }
  .steps li::before { border: 1px solid #000; background: none; color: #000; }
  .steps li { break-inside: avoid; }
}
