:root {
  --bg: #fdf6ec;
  --card: #ffffff;
  --ink: #3a2e25;
  --muted: #8a7a6b;
  --accent: #c0392b;
  --accent-soft: #f4d9d5;
  --line: #ece0d0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.site {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0.9rem 1.25rem;
  position: sticky; top: 0; z-index: 10;
}
header.site .wrap { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
header.site .brand { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
header.site .brand .heart { color: var(--accent); }
header.site nav { display: flex; gap: 1rem; font-size: 0.95rem; }
header.site form.search { margin-left: auto; }
header.site form.search input {
  border: 1px solid var(--line); border-radius: 999px; padding: 0.4rem 0.9rem; font-size: 0.95rem;
  min-width: 180px; outline: none; background: var(--bg);
}
header.site form.search input:focus { border-color: var(--accent); }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

h1.page { font-size: 1.7rem; margin-bottom: 0.3rem; letter-spacing: -0.01em; }
.count { color: var(--muted); font-size: 0.95rem; margin-bottom: 1.2rem; }

.facets { display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; margin-bottom: 1.5rem; }
.facets .group-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; align-self: center; margin-right: 0.2rem; }
.chip {
  display: inline-block; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.22rem 0.7rem; font-size: 0.85rem; color: var(--ink);
}
.chip:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .n { opacity: 0.55; font-size: 0.78em; margin-left: 0.25em; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.rcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s;
}
.rcard:hover { box-shadow: 0 6px 24px rgba(58,46,37,0.12); transform: translateY(-2px); text-decoration: none; }
.rcard .thumb { aspect-ratio: 4 / 3; background: var(--accent-soft); overflow: hidden; }
.rcard .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rcard .thumb.placeholder { display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 2rem; }
.rcard .body { padding: 0.7rem 0.85rem 0.9rem; flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }
.rcard .rtitle { font-weight: 600; color: var(--ink); line-height: 1.3; }
.rcard .meta { font-size: 0.78rem; color: var(--muted); margin-top: auto; }
.rcard .minitags { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.minitag { font-size: 0.7rem; background: var(--bg); border-radius: 999px; padding: 0.1rem 0.45rem; color: var(--muted); }

/* recipe page */
.recipe-head { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.recipe-head .photo { flex: 0 0 320px; max-width: 100%; }
.recipe-head .photo img { width: 100%; border-radius: 14px; border: 1px solid var(--line); display: block; }
.recipe-head .info { flex: 1; min-width: 240px; }
.recipe-head h1 { font-size: 2rem; letter-spacing: -0.01em; margin-bottom: 0.4rem; }
.recipe-head .submeta { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.8rem; }
.recipe-head .tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.cols { display: grid; grid-template-columns: 1fr 1.6fr; gap: 2rem; }
@media (max-width: 720px) { .cols { grid-template-columns: 1fr; } }
.cols h2 { font-size: 1.15rem; border-bottom: 2px solid var(--accent-soft); padding-bottom: 0.3rem; margin-bottom: 0.8rem; }
.ingredients h3, .instructions h3 { font-size: 0.95rem; color: var(--accent); margin: 0.9rem 0 0.3rem; }
.ingredients ul { list-style: none; }
.ingredients li { padding: 0.28rem 0; border-bottom: 1px dashed var(--line); font-size: 0.97rem; }
.ingredients li .q { color: var(--muted); margin-right: 0.4em; }
.instructions ol { padding-left: 1.3rem; }
.instructions li { margin-bottom: 0.7rem; }
.notes { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 0.7rem 0.9rem; font-size: 0.92rem; color: var(--muted); margin-top: 1.2rem; }

footer.site { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 2rem 1rem 3rem; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.backlink { display: inline-block; margin-bottom: 1rem; font-size: 0.9rem; }

/* ---- auth pages ---- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; }
.auth-card { background: var(--card); border-radius: 18px; box-shadow: 0 8px 40px rgba(58,46,37,0.10); padding: 2.2rem 2rem; max-width: 380px; width: 100%; text-align: center; }
.auth-heart { font-size: 2.2rem; color: var(--accent); }
.auth-card h1 { font-size: 1.6rem; margin: 0.4rem 0 0.2rem; }
.auth-sub { color: var(--muted); margin-bottom: 1.2rem; }
.auth-card form { display: flex; flex-direction: column; gap: 0.8rem; text-align: left; }
.auth-card label { font-size: 0.85rem; color: var(--muted); display: flex; flex-direction: column; gap: 0.25rem; }
.auth-card input { border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem; font-size: 1rem; outline: none; background: var(--bg); color: var(--ink); }
.auth-card input:focus { border-color: var(--accent); }
.auth-card button { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 0.6rem; font-size: 1rem; font-weight: 600; cursor: pointer; margin-top: 0.3rem; }
.auth-card button:hover { filter: brightness(1.06); }
.auth-error { background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.9rem; margin-bottom: 0.9rem; }
.auth-hint { color: var(--muted); font-size: 0.8rem; margin-top: 1rem; }

/* ---- user box in header ---- */
header.site .userbox { display: flex; align-items: center; gap: 0.7rem; font-size: 0.88rem; white-space: nowrap; }
header.site .userbox .who { font-weight: 600; }
header.site .userbox .link { color: var(--muted); }
header.site .userbox .link:hover { color: var(--accent); }
@media (max-width: 760px) {
  header.site .wrap { gap: 0.6rem; }
  header.site form.search { order: 5; flex: 1 1 100%; }
  header.site form.search input { width: 100%; }
}

/* ---- add / cook forms ---- */
.addform { display: flex; flex-direction: column; gap: 0.7rem; max-width: 640px; }
.addform label { font-size: 0.85rem; color: var(--muted); display: flex; flex-direction: column; gap: 0.3rem; }
.addform input[type=url], .addform textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem; font-size: 1rem;
  background: var(--bg); color: var(--ink); outline: none; font-family: inherit; resize: vertical;
}
.addform input:focus, .addform textarea:focus { border-color: var(--accent); }
.addform .or { text-align: center; color: var(--muted); font-size: 0.85rem; }
.addform button {
  align-self: flex-start; background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 0.55rem 1.3rem; font-size: 1rem; font-weight: 600; cursor: pointer; margin-top: 0.3rem;
}
.addform button:hover { filter: brightness(1.06); }
.suggestions { list-style: none; margin-top: 0.8rem; }
.suggestions li { padding: 0.55rem 0; border-bottom: 1px dashed var(--line); }

/* ---- language bar on recipe page ---- */
.langbar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; margin: 0.4rem 0 0.2rem; }
.langbar .lbl { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-right: 0.2rem; }

/* ---- homepage hero (Herzli cover) ---- */
.hero { display: flex; gap: 1.2rem; align-items: stretch; margin-bottom: 1.6rem; border-radius: 16px; overflow: hidden; background: var(--card); border: 1px solid var(--line); }
.hero-img { flex: 0 0 38%; min-height: 160px; background-size: cover; background-position: center; }
.hero-text { flex: 1; padding: 1.4rem 1.6rem; display: flex; flex-direction: column; justify-content: center; }
.hero-text h1 { font-size: 1.9rem; letter-spacing: -0.01em; margin-bottom: 0.3rem; }
.hero-text p { color: var(--muted); }
@media (max-width: 640px) { .hero { flex-direction: column; } .hero-img { flex: none; height: 130px; } }

/* ---- language toggle in header ---- */
header.site .langtoggle { font-size: 0.82rem; display: inline-flex; gap: 0.25rem; align-items: center; }
header.site .langtoggle b { color: var(--accent); }
header.site .langtoggle a { color: var(--muted); }

/* ---- recipe toolbar (scaling / units) ---- */
.rtoolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0 0.9rem; }
.rtoolbar .rt-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-right: 0.1rem; }
.rtoolbar .rt-sep { width: 1px; height: 1.1rem; background: var(--line); margin: 0 0.3rem; }
.rtoolbar button.chip { cursor: pointer; }
.qedit { width: 5em; border: 1px solid var(--accent); border-radius: 4px; padding: 0 0.2rem; font: inherit; }

/* ---- image gallery on recipe page ---- */
.photo.gallery .thumbs { display: flex; gap: 0.4rem; margin-top: 0.5rem; flex-wrap: wrap; }
.photo.gallery .thumb-mini { width: 56px; height: 44px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.photo.gallery .thumb-mini.active { border-color: var(--accent); }
.manage-images { display: inline-block; margin-top: 0.6rem; font-size: 0.85rem; }
.manage-images.add { display: flex; align-items: center; justify-content: center; aspect-ratio: 4/3; background: var(--accent-soft); color: var(--accent); border-radius: 14px; font-weight: 600; }

/* ---- image management page ---- */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 1rem; }
.img-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.img-card.is-main { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.img-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.img-meta { font-size: 0.75rem; color: var(--muted); padding: 0.3rem 0.5rem; }
.img-actions { display: flex; gap: 0.3rem; padding: 0 0.5rem 0.6rem; }
.img-actions button { font-size: 0.8rem; border: 1px solid var(--line); background: var(--bg); border-radius: 6px; padding: 0.25rem 0.5rem; cursor: pointer; color: var(--ink); }
.img-actions button.del { color: var(--accent); }
.add-img-forms { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 0.8rem; }
.add-img-forms .addform { max-width: 340px; }

/* ---- comments ---- */
.comments-sec { margin-top: 2.2rem; }
.comments-sec h2 { font-size: 1.2rem; border-bottom: 2px solid var(--accent-soft); padding-bottom: 0.3rem; margin-bottom: 0.8rem; }
.comments { list-style: none; }
.comments li { padding: 0.6rem 0; border-bottom: 1px dashed var(--line); }
.comments .c-head { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 0.5rem; }
.comments .c-head strong { color: var(--ink); }
.comments .c-when { font-size: 0.78rem; }
.comments .c-del { margin-left: auto; }
.comments .c-del button { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; }
.comments .c-del button:hover { color: var(--accent); }
.comments .c-body { white-space: pre-wrap; margin-top: 0.15rem; }
.comment-form { display: flex; gap: 0.5rem; margin-top: 0.8rem; align-items: flex-start; }
.comment-form textarea { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.6rem; font: inherit; background: var(--bg); resize: vertical; }
.comment-form button { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 0.5rem 1rem; font-weight: 600; cursor: pointer; }

/* ---- delete UI ---- */
.del-banner { background: #fff3f1; border: 1px solid var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 8px; padding: 0.6rem 0.9rem; margin-bottom: 1rem; display: flex; align-items: center; flex-wrap: wrap; gap: 0.7rem; font-size: 0.92rem; }
.del-banner form { display: inline; }
.del-banner button { border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 0.3rem 0.7rem; font-size: 0.85rem; cursor: pointer; color: var(--ink); }
.del-banner button.danger { background: var(--accent); color: #fff; border-color: var(--accent); }
.danger-zone { margin-top: 2.5rem; text-align: right; }
.danger-zone .danger-link { background: none; border: none; color: var(--muted); font-size: 0.85rem; cursor: pointer; text-decoration: underline; }
.danger-zone .danger-link:hover { color: var(--accent); }

/* ---- online image-search candidate grid ---- */
.cand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 0.8rem; margin-top: 0.8rem; }
.cand { margin: 0; }
.cand button { display: block; width: 100%; padding: 0; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); cursor: pointer; position: relative; }
.cand button:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(58,46,37,0.15); }
.cand button img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; background: var(--accent-soft); }
.cand .cand-src { position: absolute; left: 0; right: 0; bottom: 0; font-size: 0.65rem; color: #fff; background: rgba(0,0,0,0.45); padding: 0.15rem 0.35rem; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-online-btn { display: inline-block; background: var(--accent); color: #fff; border-radius: 8px; padding: 0.55rem 1.1rem; font-size: 0.95rem; font-weight: 600; }
.search-online-btn:hover { filter: brightness(1.06); text-decoration: none; }
