/* Recipe site styles. Inspired by the calm, typographic feel of recipe apps like Mela:
   serif titles, one warm accent, generous whitespace, pill buttons, two columns on wide screens. */
:root {
  --bg: #fbfaf7; --panel: #ffffff; --fg: #1f1d1a; --muted: #77716a; --line: #ebe6de;
  --accent: #f2b705; --accent-ink: #2a2100; --accent-soft: #fdf1c7; --done: #b5aea5;
  --serif: ui-serif, "New York", Georgia, serif;
  --sans: -apple-system, system-ui, "Helvetica Neue", sans-serif;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514; --panel: #201f1d; --fg: #f3efe9; --muted: #a39c93; --line: #34312d;
    --accent: #f5c02a; --accent-ink: #231b00; --accent-soft: #3a3115; --done: #6c665f;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 18px/1.55 var(--sans); }
a { color: inherit; }
button { font: inherit; color: inherit; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px 16px 48px; }
h1, h2, .serif { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--muted); }

/* ---------- pills & buttons ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .35em; min-height: 40px; padding: 0 16px;
  border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer;
}
.pill.ghost { background: var(--accent-soft); color: var(--fg); }
.pill[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }

/* ---------- library (home) ---------- */
.lib { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
.lib > *, .row a > * { min-width: 0; }
@media (min-width: 820px) { .lib { grid-template-columns: 220px minmax(0, 1fr); } }
.lib h1 { font-size: 2.1rem; margin: 4px 0 12px; }
.side nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.side nav::-webkit-scrollbar { display: none; }
.side .group { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; margin: 14px 0 6px; display: none; }
.coll {
  flex: none; display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 7px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  cursor: pointer; font-size: .92rem; white-space: nowrap;
}
.coll .n { color: var(--muted); font-size: .8rem; }
.coll.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.coll.on .n { color: inherit; opacity: .7; }
@media (min-width: 820px) {
  .side { position: sticky; top: 16px; align-self: start; }
  .side nav { flex-direction: column; gap: 2px; overflow: visible; }
  .side .group { display: block; }
  .coll { border: 0; background: transparent; border-radius: 10px; padding: 8px 12px; }
  .coll:hover { background: var(--accent-soft); }
}
.search {
  width: 100%; font-size: 1rem; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--fg); margin-bottom: 12px;
}
.rows { list-style: none; margin: 0; padding: 0; background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.row a { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 10px 14px; text-decoration: none; }
.row + .row a { border-top: 1px solid var(--line); }
.row a:hover { background: var(--accent-soft); }
.thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.6rem; color: var(--accent-ink); background: var(--accent-soft); }
.row .t { font-family: var(--serif); font-size: 1.1rem; line-height: 1.25; }
.row .s { color: var(--muted); font-size: .85rem; }
.row .fav { color: var(--accent); font-size: 1.1rem; }
.empty { color: var(--muted); padding: 24px 4px; }

/* ---------- recipe page ---------- */
.back { color: var(--muted); text-decoration: none; font-size: .95rem; }
.r-head h1 { font-size: 2.2rem; line-height: 1.15; margin: 8px 0 4px; }
.src-link { color: var(--muted); font-size: .92rem; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: .92rem; margin-top: 6px; }
.facts b { color: var(--fg); font-weight: 600; }
.scale { display: none; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; padding: 10px 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.scale.open { display: flex; }
.scale .lbl { color: var(--muted); font-size: .85rem; margin-right: 6px; }
.scale a { min-width: 44px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: 999px; text-decoration: none; background: var(--accent-soft); }
.scale a.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.note { color: var(--muted); font-size: .85rem; font-style: italic; margin: 4px 0; }

.r-body { display: grid; gap: 8px; grid-template-areas: "photo" "intro" "ing" "method" "notes" "foot"; margin-top: 12px; }
.col-main, .col-side { display: contents; }
.photo { grid-area: photo; } .intro { grid-area: intro; } .ing-box { grid-area: ing; }
.method { grid-area: method; } .notes { grid-area: notes; } .foot { grid-area: foot; }
@media (min-width: 820px) {
  .r-body { display: grid; grid-template-columns: 1fr minmax(280px, 380px); grid-template-areas: none; gap: 40px; align-items: start; }
  .col-main, .col-side { display: block; }
  .col-side { position: sticky; top: 16px; display: grid; gap: 14px; }
  .r-body h2:first-child { margin-top: 6px; }
  .photo, .intro, .ing-box, .method, .notes, .foot { grid-area: auto; }
  .method h2 { margin-top: 18px; }
}
.photo img { width: 100%; max-height: 42svh; object-fit: cover; border-radius: var(--radius); display: block; }
.intro p { font-size: 1.05rem; margin: 6px 0; }
.r-body h2 { font-size: 1.3rem; margin: 18px 0 8px; }
.ing-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px 10px; }
.ing { list-style: none; margin: 0; padding: 0; }
.ing li { padding: 8px 0 8px 30px; position: relative; border-top: 1px solid var(--line); cursor: pointer; }
.ing li:first-child { border-top: 0; }
.ing li::before { content: ""; position: absolute; left: 0; top: 12px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); }
.ing li.grp { padding: 14px 0 4px; cursor: default; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-top: 0; }
.ing li.grp::before { display: none; }
.ing li.done { color: var(--done); text-decoration: line-through; }
.ing li.done::before { background: var(--accent); border-color: var(--accent); }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 10px 0; cursor: pointer; }
.steps li::before { content: counter(s); font-family: var(--serif); font-weight: 600; font-size: 1.2rem; color: var(--accent-ink);
  background: var(--accent-soft); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.steps li.done { color: var(--done); }
.steps li.done::before { background: var(--accent); }
.foot { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 16px; }
.foot p { margin: 2px 0; }
.scan { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); margin-top: 8px; }

/* ---------- cook mode ---------- */
.cook { position: fixed; inset: 0; background: var(--bg); z-index: 10; display: none; grid-template-rows: auto 1fr auto; }
.cook.open { display: grid; }
.cook header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.cook header .t { font-family: var(--serif); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cook main { display: grid; gap: 20px; padding: 16px; overflow: auto; }
@media (min-width: 700px) { .cook main { grid-template-columns: 1fr 300px; } }
.cook .count { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
.cook .step { font-family: var(--serif); font-size: clamp(1.35rem, 3.4vw, 2.1rem); line-height: 1.4; margin: 6px 0 0; }
.cook aside h3 { margin: 0 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cook aside li.used { background: var(--accent-soft); border-radius: 6px; }
.cook footer { display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); }
.cook footer .pill { min-width: 120px; justify-content: center; }
.timer-btn { background: var(--accent-soft); border: 0; border-radius: 6px; padding: 0 4px; cursor: pointer; font: inherit; color: inherit; text-decoration: underline dotted; }
.timers { position: fixed; right: 12px; bottom: 74px; display: flex; flex-direction: column; gap: 6px; z-index: 11; }
.timer { background: var(--fg); color: var(--bg); border-radius: 999px; padding: 6px 14px; font-variant-numeric: tabular-nums; font-weight: 600; cursor: pointer; }
.timer.ring { background: var(--accent); color: var(--accent-ink); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
