/* Recipe Book: warm, photo-first, phone-first. */
:root {
  --bg: #fbf8f3; --surface: #ffffff; --fg: #2a2420; --muted: #7a6f66; --line: #e8e0d6;
  --accent: #b4532a; --accent-fg: #ffffff; --accent-soft: #f6e6dc; --ok: #3f7a4a; --danger: #a33a2a;
  --mark: #fff3c4; --shadow: 0 1px 2px rgb(60 40 20 / .06), 0 4px 16px rgb(60 40 20 / .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917; --surface: #262220; --fg: #f0ebe5; --muted: #a69b90; --line: #3a332e;
    --accent: #e0835a; --accent-fg: #1c1917; --accent-soft: #3b2a21; --ok: #7fbf8a; --danger: #ef8a78;
    --mark: #4a3f1c; --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 var(--sans); }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; font-weight: 600; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: .2em 0 .3em; letter-spacing: -.01em; }
h2 { font-size: 1.35rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1.05rem; margin: 1em 0 .3em; }
.muted { color: var(--muted); } .small { font-size: .875rem; }
.count { font: 500 .9rem var(--sans); margin-left: .3em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 16px 16px 72px; }
.narrow { max-width: 760px; margin: 0 auto; }
.eyebrow { font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.eyebrow a { text-decoration: none; }
.lede { font-family: var(--serif); font-size: 1.15rem; margin: 0 0 .6em; }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; gap: 12px; align-items: center;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none;
  font: 600 1.1rem var(--serif); white-space: nowrap; }
.search { flex: 1; min-width: 0; }
.search input { width: 100%; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); font: inherit; }
.nav { display: flex; align-items: center; gap: 12px; }
.nav > a { color: var(--fg); text-decoration: none; font-weight: 500; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: 42px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); min-width: 220px; }
.menu-body p { margin: 0 0 8px; }
@media (max-width: 560px) { .brand span { display: none; } .nav > a { font-size: .95rem; } }

/* buttons, chips, forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  font: 500 .95rem var(--sans); text-decoration: none; cursor: pointer; min-height: 40px; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.big { padding: 14px 26px; font-size: 1.05rem; }
.btn.small { padding: 4px 12px; min-height: 32px; font-size: .85rem; }
.btn:disabled { opacity: .4; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.danger { color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { display: inline-block; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); text-decoration: none; font-size: .88rem; white-space: nowrap; }
.chip.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.chip.big { font-size: 1rem; padding: 8px 14px; }
.chip.suggested { border-style: dashed; color: var(--muted); }
.tag-review { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 12px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
input, select, textarea { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; max-width: 100%; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--fg); }
.form { display: grid; gap: 14px; max-width: 640px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.form-actions { display: flex; gap: 16px; align-items: center; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end;
  margin: 8px 0 16px; }
.toast { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.toast.error { background: color-mix(in srgb, var(--danger) 15%, var(--bg)); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.note { background: var(--mark); border-radius: 10px; padding: 8px 12px; }
.badge { position: absolute; top: 8px; left: 8px; background: var(--accent); color: var(--accent-fg);
  border-radius: 999px; padding: 2px 10px; font-size: .75rem; font-weight: 600; }

/* cards & grids */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 220px), 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius);
  overflow: hidden; color: var(--fg); text-decoration: none; box-shadow: var(--shadow); transition: transform .12s; }
.card:hover { transform: translateY(-2px); }
.card-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.card-body { padding: 10px 12px 12px; }
.card-body h3 { margin: 0 0 2px; font-size: 1.02rem; }
.card-body p { margin: 0; }
.placeholder { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; color: rgb(255 255 255 / .9);
  font: 600 3rem var(--serif); background: linear-gradient(135deg, #c8794f, #9a4a2a); }
.course-side, .course-salad { background: linear-gradient(135deg, #8aa66b, #5b7a45); }
.course-dessert, .course-breakfast { background: linear-gradient(135deg, #d9a35b, #b0743a); }
.course-soup, .course-sauce { background: linear-gradient(135deg, #c5643f, #8b3a24); }
.course-bread, .course-appetizer { background: linear-gradient(135deg, #c9a46a, #977140); }
.course-drink { background: linear-gradient(135deg, #6f97a8, #476f80); }
.row { margin-bottom: 8px; }
.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 220px); gap: 14px;
  overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x mandatory; }
.scroller .card { scroll-snap-align: start; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-head h2 { margin-bottom: 0; }

/* recipe page */
.recipe { padding-bottom: 72px; }
.hero { position: relative; margin: 0; max-height: 62vh; overflow: hidden; background: var(--line); }
.hero img, .hero .placeholder { width: 100%; height: auto; max-height: 62vh; object-fit: cover; aspect-ratio: 16 / 10; }
.hero-action { position: absolute; right: 12px; bottom: 12px; background: rgb(0 0 0 / .55); color: #fff;
  padding: 6px 14px; border-radius: 999px; text-decoration: none; font-size: .88rem; backdrop-filter: blur(6px); }
.recipe .wrap.narrow { padding: 16px; max-width: 1000px; }
.times { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.servings label { flex-direction: row; align-items: center; gap: 6px; color: var(--fg); }
.servings input { width: 3.6em; text-align: center; }
.step { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  color: var(--fg); font-size: 1.1rem; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg a { padding: 7px 14px; text-decoration: none; color: var(--fg); font-size: .9rem; }
.seg a[aria-current] { background: var(--fg); color: var(--bg); }
.columns { display: grid; gap: 8px 40px; }
@media (min-width: 820px) { .columns { grid-template-columns: minmax(260px, 1fr) 2fr; }
  .ingredients { position: sticky; top: 72px; align-self: start; } }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.checklist label { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--fg); font-size: 1rem; cursor: pointer; }
.checklist input { margin-top: 5px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; }
.optional span { color: var(--muted); font-style: italic; }
.changed { background: var(--mark); border-radius: 6px; padding-left: 6px !important; }
.steps ol { padding-left: 1.3em; margin: 0; }
.steps li { margin-bottom: 1.1em; padding: 2px 0; }
.steps li::marker { font: 600 1.05rem var(--serif); color: var(--accent); }
.steps h3 { margin: 0 0 .2em; }
.steps p { margin: 0 0 .4em; font-size: 1.05rem; }
.step-photo { border-radius: 10px; margin: 8px 0; max-height: 360px; object-fit: cover; }
.timer { border: 1px solid var(--accent); color: var(--accent); background: transparent; border-radius: 999px;
  padding: 4px 12px; font: 500 .9rem var(--sans); cursor: pointer; }
.timer.running { background: var(--accent); color: var(--accent-fg); }
.notes { white-space: pre-line; font-family: var(--serif); font-size: 1.05rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gallery figure { margin: 0; } .gallery img { border-radius: 10px; aspect-ratio: 1; object-fit: cover; cursor: zoom-in; }
.gallery figcaption { font-size: .82rem; color: var(--muted); }
.gallery.small img { aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.cooklog { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.cooklog .grow { flex: 1 1 220px; }
.stars { border: 0; padding: 0; margin: 0; display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label { font-size: 1.7rem; color: var(--line); cursor: pointer; padding: 0 1px; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #e0a32e; }
.stars input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 24px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.actions form { display: inline; }
.shared-note { margin-top: 32px; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 92vh; }
.lightbox::backdrop { background: rgb(0 0 0 / .85); }
.lightbox img { max-width: 96vw; max-height: 88vh; object-fit: contain; border-radius: 8px; }
.lightbox form { position: absolute; top: 8px; right: 8px; }
.lightbox button { border: 0; background: rgb(0 0 0 / .6); color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 1.5rem; cursor: pointer; }

/* history */
.log, .versions { padding-left: 1.2em; } .log li, .versions li { margin-bottom: 12px; }
.versions p { margin: .2em 0; }
.diff { list-style: none; padding-left: 0; font-size: .92rem; }
.diff .add { color: var(--ok); } .diff .del { color: var(--danger); text-decoration: line-through; }

/* photos admin & upload */
.drop { display: grid; place-items: center; border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 28px 16px; text-align: center; color: var(--fg); cursor: pointer; margin-bottom: 12px; }
.drop input { max-width: 100%; }
.upload progress { width: 100%; margin-top: 10px; }
.photo-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.photo-item { position: relative; display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px; }
.photo-item img { border-radius: 10px; aspect-ratio: 4 / 3; object-fit: cover; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.center-card { max-width: 440px; margin: 10vh auto; text-align: center; display: grid; justify-items: center; gap: 8px; }
.copy { width: 100%; text-align: center; }

/* cook mode */
.cooking { background: var(--bg); }
.cook-top { position: sticky; top: 0; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--bg); z-index: 5; }
.cook-top .back { text-decoration: none; color: var(--fg); font-size: 1.3rem; }
.cook-title { flex: 1; font: 600 1rem var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cook { max-width: 820px; margin: 0 auto; padding: 24px 20px 140px; }
.cook-text { font: 1.75rem/1.45 var(--serif); margin: .4em 0 .8em; }
@media (max-width: 560px) { .cook-text { font-size: 1.45rem; } }
.timer.big { font-size: 1.15rem; padding: 10px 20px; }
.cook-nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line); }
.cook-nav .btn { min-width: 112px; min-height: 52px; font-size: 1.05rem; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); }
.sheet { position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 20; display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-body { background: var(--surface); width: 100%; max-height: 80vh; overflow: auto; border-radius: 18px 18px 0 0;
  padding: 16px 20px max(20px, env(safe-area-inset-bottom)); }
.timers { position: fixed; right: 12px; bottom: 92px; display: grid; gap: 8px; z-index: 15; }
.timer-chip { background: var(--fg); color: var(--bg); border-radius: 999px; padding: 8px 14px; font: 600 .95rem var(--sans);
  box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.timer-chip.done { background: var(--accent); color: var(--accent-fg); animation: pulse 1s infinite; }
.timer-chip button { background: none; border: 0; color: inherit; font-size: 1.1rem; cursor: pointer; }
@keyframes pulse { 50% { transform: scale(1.05); } }
body:not(.cooking) .timers { bottom: 16px; }

@media print {
  .top, .toolbar, .actions, #cook-log, .hero-action, .variations, .timer, .timers { display: none !important; }
  body { background: #fff; color: #000; }
  .hero { max-height: 3in; }
}

/* legal pages */
.legal { padding: 8px 0 48px; }
.legal h2 { font-size: 1.15rem; margin-top: 1.6em; }
.legal li { margin: .4em 0; }
