/* Vkusito: warm home-kitchen look, light and dark theme, no truncated text anywhere. */

:root {
  --bg: #fbf6ef;
  --surface: #fffdf9;
  --surface-2: #f4ebdf;
  --fg: #2a211a;
  --muted: #74665a;
  --border: #e8dccd;
  --accent: #c8553d;
  --accent-strong: #a8432e;
  --on-accent: #fff8ef;
  --herb: #4f6b3f;
  --tag-bg: #eef0e2;
  --heart: #d64545;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.06), 0 6px 20px rgba(60, 40, 20, 0.06);
  --radius: 16px;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1814;
    --surface: #25201b;
    --surface-2: #2e2721;
    --fg: #f3ebe2;
    --muted: #b8a898;
    --border: #3b3129;
    --accent: #e7795f;
    --accent-strong: #f08f77;
    --on-accent: #22160f;
    --herb: #a9c48f;
    --tag-bg: #2f3527;
    --heart: #ff6b6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 var(--sans);
  overflow-wrap: break-word;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-bottom: 3rem; }
a { color: var(--accent-strong); text-underline-offset: 0.15em; }
a:hover { color: var(--accent); }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
@media (min-width: 720px) { .wrap { padding-left: 32px; padding-right: 32px; } }

.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.brand .mark { width: 36px; height: 36px; }
.wordmark { font-family: var(--serif); font-weight: 700; font-size: 1.6rem; letter-spacing: -0.01em; color: var(--fg); }
.wordmark span { color: var(--accent); font-style: italic; font-weight: 600; }
.wordmark.small { font-size: 1.05rem; }
.header-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav-fav { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--fg); padding: 8px 12px; border-radius: 999px; }
.nav-fav:hover, .nav-fav[aria-current] { background: var(--surface-2); color: var(--fg); }
.nav-fav .i-heart { fill: var(--heart); stroke: var(--heart); }
.fav-count { background: var(--accent); color: var(--on-accent); border-radius: 999px; font-size: 0.75rem; padding: 0 7px; font-weight: 600; }
.auth { display: inline-flex; align-items: center; gap: 8px; }
.user { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.95rem; }
.user img { width: 30px; height: 30px; border-radius: 50%; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1.5px solid transparent; text-decoration: none; cursor: pointer; font-weight: 500; line-height: 1.3; text-align: center; }
.btn-signin, .btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-signin:hover, .btn-primary:hover { background: var(--accent-strong); color: var(--on-accent); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--fg); }
.btn-ghost:hover { border-color: var(--accent); color: var(--fg); }
.linklike { background: none; border: 0; padding: 0; color: var(--accent-strong); text-decoration: underline; cursor: pointer; }

/* Home */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; padding-top: 40px; padding-bottom: 12px; }
.hero h1 { font-family: var(--serif); font-size: clamp(2rem, 4.5vw, 3.2rem); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.015em; }
.lead { color: var(--muted); font-size: 1.12rem; margin: 0; max-width: 46rem; }

.filters { display: grid; gap: 14px; padding-top: 16px; padding-bottom: 20px; }
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 999px; padding: 0 18px; max-width: 640px; color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg); font: inherit; padding: 12px 0; outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 0.95rem; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.chip-fav .i-heart { fill: var(--heart); stroke: var(--heart); width: 1em; height: 1em; }
.count { margin: 0; color: var(--muted); font-size: 0.95rem; }

.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card { position: relative; display: flex; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 56px 20px 20px; box-shadow: var(--shadow); transition: transform 0.15s ease, border-color 0.15s ease; }
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.card[hidden] { display: none; }
.card-mono { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-family: var(--serif); font-size: 1.6rem; font-weight: 700; color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.card-body { min-width: 0; flex: 1; }
.card-title { font-family: var(--serif); font-size: 1.22rem; line-height: 1.3; margin: 0 0 8px; font-weight: 600; }
.card-title a { color: var(--fg); text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card-title a:hover { color: var(--accent-strong); }
.card-meta { display: grid; gap: 4px; margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; }
.meta-item { display: inline-flex; gap: 8px; align-items: flex-start; }
.meta-item .i { margin-top: 0.22em; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tag { position: relative; z-index: 1; display: inline-block; border: 0; background: var(--tag-bg); color: var(--herb); border-radius: 999px; padding: 2px 10px; font-size: 0.85rem; text-decoration: none; cursor: pointer; }
.tag:hover { color: var(--fg); }

.fav { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; color: var(--muted); padding: 0; }
.fav .i-heart { width: 22px; height: 22px; stroke-width: 1.8; }
.fav:hover { color: var(--heart); border-color: var(--heart); }
.fav[aria-pressed="true"] { color: var(--heart); border-color: color-mix(in srgb, var(--heart) 40%, var(--border)); }
.fav[aria-pressed="true"] .i-heart { fill: var(--heart); }
.fav.pop { animation: pop 0.3s ease; }
@keyframes pop { 50% { transform: scale(1.18); } }
.card-fav { position: absolute; top: 14px; right: 14px; z-index: 2; }
.fav-big { width: 46px; height: 46px; }

.empty { color: var(--muted); padding: 24px 0; }
.note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; background: var(--surface-2); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; }
.note p { margin: 0; flex: 1 1 320px; }

/* Recipe */
.recipe { padding-top: 24px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.back:hover { color: var(--accent-strong); }
.recipe-head { padding: 12px 0 8px; max-width: 980px; }
.recipe-head h1 { font-family: var(--serif); font-size: clamp(1.9rem, 4.2vw, 3rem); line-height: 1.15; margin: 4px 0 14px; letter-spacing: -0.015em; }
.recipe-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; color: var(--muted); margin: 0 0 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.intro { max-width: 980px; font-size: 1.05rem; }

.recipe-cols { display: grid; gap: 28px; margin-top: 24px; }
@media (min-width: 960px) {
  .recipe-cols { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 48px; align-items: start; }
}
.ingredients { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.ingredients h2 { font-family: var(--serif); font-size: 1.5rem; margin: 0 0 4px; }
.hint { color: var(--muted); font-size: 0.88rem; margin: 0 0 12px; }
.checklist { list-style: none; margin: 0 0 8px; padding: 0; }
.checklist li { border-bottom: 1px dashed var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist label { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px; padding: 10px 0; cursor: pointer; }
.checklist input { grid-row: span 2; width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--accent); }
.ing-name { font-weight: 500; }
.ing-qty { grid-column: 2; color: var(--muted); font-size: 0.94rem; }
.checklist input:checked ~ span { text-decoration: line-through; opacity: 0.55; }
.ing-notes { font-size: 0.94rem; margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }

.recipe-main { min-width: 0; }
.block { margin-bottom: 32px; }
.block h2, .page-text h2 { font-family: var(--serif); font-size: 1.55rem; line-height: 1.25; margin: 0 0 12px; }
.block-tips, .block-variants { background: var(--surface-2); border-radius: var(--radius); padding: 20px 24px; }

.prose { max-width: 900px; }
.prose p { margin: 0 0 12px; }
.prose ol, .prose ul { padding-left: 1.4em; margin: 0 0 14px; }
.prose li { margin-bottom: 8px; }
.prose li > ul { margin-top: 6px; }
.block-steps ol { padding-left: 2em; }
.block-steps ol > li { margin-bottom: 14px; padding-left: 6px; }
.block-steps ol > li::marker { color: var(--accent-strong); font-weight: 700; font-family: var(--serif); font-size: 1.1em; }
.prose table { border-collapse: collapse; width: 100%; margin: 8px 0 16px; font-size: 0.95rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.prose th { font-weight: 600; background: var(--surface-2); }
.prose blockquote { margin: 0 0 12px; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose strong { font-weight: 600; }
.page-text { padding-top: 40px; max-width: 860px; }
.page-text h1 { font-family: var(--serif); font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 16px; }
.page-text h2 { margin-top: 28px; }
.muted { color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.92rem; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 20px; padding-bottom: 28px; }
.footer-row p { margin: 0; }

/* Toast and sign-in prompt */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100vw - 32px); text-align: center; }
.prompt { position: fixed; right: 16px; bottom: 16px; left: 16px; margin-left: auto; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; z-index: 55; box-shadow: 0 10px 40px rgba(40, 20, 10, 0.18); }
.prompt p { margin: 0 0 14px; }
.prompt-actions { display: flex; flex-wrap: wrap; gap: 10px; }
[hidden] { display: none !important; }

/* Print: just the recipe */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --fg: #000; --muted: #333; --border: #bbb; --accent: #000; --on-accent: #fff; --shadow: none; }
  body { font-size: 11.5pt; display: block; }
  .site-header, .site-footer, .actions, .back, .hint, .toast, .prompt, .skip, [data-reset-checks] { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .recipe-cols { display: grid; grid-template-columns: 34% 1fr; gap: 24px; }
  .ingredients { position: static; max-height: none; overflow: visible; border: 0; padding: 0; }
  .checklist input { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; border: 1px solid #000; border-radius: 2px; }
  .checklist input:checked ~ span { text-decoration: none; opacity: 1; }
  .block-tips, .block-variants { padding: 0; }
  .block, .checklist li { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  .tags .tag { background: none; padding: 0 6px 0 0; color: #333; }
}
