/* Recipe → Grocery List
 * Two panes: recipes go in on the left, one aisle-grouped list comes out on
 * the right. The signature is the aisle sections — each with a colored tab —
 * that make "sorted for the store" the thing you see first.
 * Type: Bricolage Grotesque (display) + Inter (body). Aisle colors from the
 * validated dataviz categorical palette (one fixed hue per aisle).
 */

:root {
  --bg: #eef1ee;
  --surface: #ffffff;
  --ink: #1a201c;
  --ink-2: #566058;
  --ink-3: #899186;
  --line: #e2e6e1;
  --line-2: #eef1ee;
  --accent: #2f8f5b;         /* market green */
  --accent-ink: #1f6e44;
  --shadow: 0 1px 2px rgba(26,32,28,.05), 0 14px 30px -18px rgba(26,32,28,.28);

  /* aisle hues (light) — dataviz categorical order */
  --slot-0:#2a78d6; --slot-1:#eb6834; --slot-2:#1baf7a; --slot-3:#eda100;
  --slot-4:#e87ba4; --slot-5:#008300; --slot-6:#4a3aa7; --slot-7:#e34948;
  --slot-8:#5b6472; --slot-9:#899186;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d100e;
    --surface: #171b18;
    --ink: #e9ede9;
    --ink-2: #a3ada4;
    --ink-3: #6b746c;
    --line: #262b27;
    --line-2: #1c211d;
    --accent: #46b277;
    --accent-ink: #6fce98;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 14px 30px -18px rgba(0,0,0,.7);
    --slot-0:#3987e5; --slot-1:#d95926; --slot-2:#199e70; --slot-3:#c98500;
    --slot-4:#d55181; --slot-5:#008300; --slot-6:#9085e9; --slot-7:#e66767;
    --slot-8:#8b94a1; --slot-9:#6b746c;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0 auto;
  max-width: 1080px;
  padding: 2.8rem 1.1rem 5rem;
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- masthead ---------- */
.masthead { margin-bottom: 2.2rem; }
.masthead h1 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1.02;
  letter-spacing: -.02em;
  margin: 0 0 .7rem;
}
.arrow { color: var(--accent); }
.lede { max-width: 40rem; font-size: 1.05rem; color: var(--ink-2); margin: 0 0 .5rem; }
.fineprint { font-size: .82rem; color: var(--ink-3); margin: 0; }
.fineprint a { color: var(--accent-ink); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3rem; align-items: start; }
@media (max-width: 780px) { .layout { grid-template-columns: 1fr; } }

.pane {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.3rem 1.4rem 1.5rem;
}
.pane-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; gap: 1rem; }
.pane-head h2 { font-family: "Bricolage Grotesque", sans-serif; font-weight: 500; font-size: 1.25rem; margin: 0; }
.count { font-size: .82rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- recipe composer ---------- */
#recipe-form { display: flex; flex-direction: column; gap: .6rem; }
input, textarea, button, select {
  font: inherit; font-size: .92rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem;
}
textarea { resize: vertical; line-height: 1.5; font-family: "Inter", sans-serif; }
input:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
button { cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; }
.form-actions { display: flex; align-items: center; gap: .7rem; }
#form-msg { font-size: .84rem; }
#form-msg.err { color: var(--slot-7); }
#form-msg.ok { color: var(--accent-ink); }

/* ---------- sample chips ---------- */
.samples { margin: 1.2rem 0 .4rem; }
.samples-label { font-size: .8rem; color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.chip {
  font-size: .84rem; padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--line-2); color: var(--ink-2); cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- recipe cards ---------- */
#recipe-list { margin-top: 1rem; display: flex; flex-direction: column; gap: .55rem; }
.recipe {
  display: flex; justify-content: space-between; align-items: center; gap: .8rem;
  padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 11px;
}
.recipe-title { font-weight: 600; font-size: .96rem; margin: 0; }
.recipe-meta { font-size: .78rem; color: var(--ink-3); margin: .1rem 0 0; }
.recipe-controls { display: flex; align-items: center; gap: .35rem; flex: none; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stepper button { border: none; border-radius: 0; padding: .2rem .55rem; background: var(--line-2); font-size: 1rem; line-height: 1; }
.stepper button:hover { background: var(--accent); color: #fff; }
.stepper .mult { padding: 0 .5rem; font-size: .84rem; font-variant-numeric: tabular-nums; min-width: 2.4rem; text-align: center; }
button.icon { border: none; background: none; padding: .2rem .35rem; font-size: .95rem; color: var(--ink-3); }
button.icon:hover { color: var(--accent); }
button.icon.delete:hover { color: var(--slot-7); }

/* ---------- grocery list (the signature) ---------- */
.list-tools { display: flex; align-items: center; gap: .8rem; }
.aisle { margin-bottom: 1.1rem; }
.aisle-head {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem;
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 500; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2);
}
.aisle-tab { width: 10px; height: 18px; border-radius: 3px; background: var(--aisle); flex: none; }
.aisle-n { color: var(--ink-3); font-weight: 400; }
.items { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex; align-items: center; gap: .6rem;
  padding: .38rem .3rem; border-bottom: 1px solid var(--line-2);
  cursor: pointer;
}
.item:last-child { border-bottom: none; }
.item input[type="checkbox"] {
  appearance: none; width: 18px; height: 18px; flex: none; margin: 0;
  border: 1.5px solid var(--ink-3); border-radius: 5px; cursor: pointer; position: relative;
  background: var(--surface);
}
.item input:checked { background: var(--aisle); border-color: var(--aisle); }
.item input:checked::after {
  content: "✓"; color: #fff; font-size: .8rem; position: absolute;
  inset: 0; display: flex; align-items: center; justify-content: center;
}
.item input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.item-name { flex: 1; font-size: .94rem; }
.item-qty { font-size: .86rem; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.item.done .item-name, .item.done .item-qty { color: var(--ink-3); text-decoration: line-through; }

#empty-list { color: var(--ink-3); text-align: center; padding: 2rem 0; }
#empty-list.hidden-empty { display: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
