/* Pantry — an open cupboard and the dinners it can make.
 * One Page Toys tool family, self-contained, theme-aware (light/dark).
 * The cupboard is painted sage wood with oak shelves and a scalloped paper
 * liner. By day the inside is cream beadboard; at night (dark theme) the same
 * cupboard is lit by a warm strip light under each shelf. */

@import url("https://fonts.googleapis.com/css2?family=Young+Serif&family=Inter:wght@400;500;600;700;800&display=swap");

:root{
  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ink: #2b2219;
  --bg: #f5efe4;
  --surface: #fffcf5;
  --surface-2: #efe7d8;
  --muted: #776a58;
  --line: #e5dac7;
  --line-strong: #cfbfa5;
  --accent: #b24f28;
  --accent-hover: #963f1d;
  --accent-soft: rgba(178, 79, 40, 0.14);
  --ok: #3e7a2c;
  --ok-soft: rgba(62, 122, 44, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow: 0 2px 8px rgba(60, 40, 18, 0.07);
  --shadow-md: 0 10px 26px rgba(60, 40, 18, 0.12);
  --shadow-lg: 0 22px 50px rgba(60, 40, 18, 0.18);
  /* the cupboard */
  --paint: #56775f;
  --paint-hi: #6c8e75;
  --paint-lo: #3f5b48;
  --paint-ink: #f4f0e2;
  --paint-muted: rgba(244, 240, 226, 0.72);
  --inside: #f1e7d1;
  --inside-line: rgba(130, 96, 52, 0.09);
  --inside-glow: rgba(255, 255, 255, 0.0);
  --label-ink: #4a3b29;
  --label-on: #2b2219;
  --oak: #c99b61;
  --oak-hi: #e2bb83;
  --oak-lo: #9c703d;
  --liner: #c4573f;
  --brass: #e8c27a;
  /* the table under each dish */
  --table: #ece2d0;
  --table-line: rgba(120, 90, 50, 0.06);
  --table-glow: rgba(255, 255, 255, 0.2);
}
:root[data-theme="dark"]{
  --ink: #f2eadc;
  --bg: #12100c;
  --surface: #1c1813;
  --surface-2: #251f18;
  --muted: #a99b86;
  --line: #2e271f;
  --line-strong: #463b2e;
  --accent: #ee9064;
  --accent-hover: #f6a882;
  --accent-soft: rgba(238, 144, 100, 0.16);
  --ok: #9fd06c;
  --ok-soft: rgba(159, 208, 108, 0.14);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 30px -6px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 22px 54px -10px rgba(0, 0, 0, 0.7);
  --paint: #3e5847;
  --paint-hi: #4e6b58;
  --paint-lo: #2b3f33;
  --inside: #2a241c;
  --inside-line: rgba(255, 226, 180, 0.035);
  --inside-glow: rgba(255, 196, 120, 0.2);
  --label-ink: rgba(244, 232, 210, 0.62);
  --label-on: #f6ead4;
  --oak: #a87a46;
  --oak-hi: #c8995e;
  --oak-lo: #7a542a;
  --liner: #a8463a;
  --table: #241d16;
  --table-line: rgba(255, 220, 170, 0.03);
  --table-glow: rgba(255, 200, 140, 0.05);
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{ -webkit-tap-highlight-color: transparent; }
body{
  margin: 0; min-height: 100vh;
  display: flex; flex-direction: column;
  font-family: var(--font-sans); color: var(--ink);
  background: radial-gradient(70% 40% at 50% 0%, var(--accent-soft), transparent 70%), var(--bg);
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
button{ font: inherit; color: inherit; }

/* ---------- Top bar (family chrome) ---------- */
.topbar{
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 30px);
  padding-top: max(14px, env(safe-area-inset-top));
  padding-left: max(clamp(16px, 4vw, 30px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 30px), env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand{ display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-sans); font-weight: 800; font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); text-decoration: none; }
.brand__mark{ width: 1.35em; height: 1.35em; background: url("../../assets/brand-mark-64.png") center / contain no-repeat; }
.topbar__right{ display: inline-flex; align-items: center; gap: 10px; }
.topbar__tag{ font-size: 0.7rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.iconbtn{ appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; font-size: 1rem; line-height: 1; border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow); transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease; }
.iconbtn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ink); }
.iconbtn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }
.iconbtn svg{ width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#soundBtn .snd-off{ display: none; }
#soundBtn[aria-pressed="false"] .snd-on{ display: none; }
#soundBtn[aria-pressed="false"] .snd-off{ display: inline; }
.theme-toggle__sun, .theme-toggle__moon, .theme-toggle__auto{ display: none; }
:root[data-theme-mode="system"] .theme-toggle__auto{ display: inline; }
:root[data-theme-mode="light"] .theme-toggle__sun{ display: inline; }
:root[data-theme-mode="dark"] .theme-toggle__moon{ display: inline; }

/* ---------- Stage ---------- */
.stage{
  position: relative; z-index: 2; flex: 1 0 auto;
  width: 100%; max-width: 1180px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 26px;
  padding: clamp(22px, 4vw, 44px) clamp(16px, 3vw, 28px) clamp(56px, 7vw, 84px);
  padding-left: max(clamp(16px, 3vw, 28px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 3vw, 28px), env(safe-area-inset-right));
  padding-bottom: max(clamp(72px, 8vw, 96px), env(safe-area-inset-bottom));
}

.hero{ text-align: center; max-width: 740px; margin: 0 auto; }
.eyebrow{ margin: 0 0 10px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }
.headline{
  margin: 0; font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2rem, 6.2vw, 3.5rem); line-height: 1.04; letter-spacing: -0.015em;
}
.headline em{ font-style: normal; color: var(--accent); }
.headline .n{ font-variant-numeric: lining-nums tabular-nums; }
.lede{ margin: 14px auto 0; max-width: 580px; font-size: 1rem; line-height: 1.55; color: var(--muted); }
.sharehost{ display: flex; justify-content: center; margin-top: 4px; min-height: 8px; }

/* ---------- The cupboard ---------- */
.cupboard{
  position: relative;
  border-radius: 22px;
  padding: 12px clamp(10px, 1.8vw, 16px) 14px;
  color: var(--paint-ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 30%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.025) 0 2px, transparent 2px 7px, rgba(255, 255, 255, 0.02) 7px 9px, transparent 9px 17px),
    var(--paint);
  box-shadow:
    var(--shadow-lg),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -2px 0 rgba(0, 0, 0, 0.18),
    0 0 0 1px var(--paint-lo);
}
/* a carved crown along the top of the cupboard */
.cupboard::before{
  content: ""; position: absolute; left: 18px; right: 18px; top: 5px; height: 2px; border-radius: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18) 12%, rgba(255, 255, 255, 0.18) 88%, transparent);
}
.cupboard__head{
  display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  padding: 4px 2px 12px;
}
.tabs{ display: flex; gap: 4px; flex-wrap: wrap; }
.tab{
  appearance: none; border: 1px solid transparent; background: transparent; cursor: pointer;
  padding: 7px 12px; border-radius: 8px;
  font-size: 0.8rem; font-weight: 600; color: var(--paint-muted); white-space: nowrap;
  transition: color 140ms ease, background 140ms ease;
}
.tab:hover{ color: var(--paint-ink); background: rgba(255, 255, 255, 0.07); }
/* the selected shelf wears a little paper label */
.tab[aria-selected="true"]{
  color: #2b2219; background: #f6eedb;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.22), inset 0 0 0 1px rgba(120, 90, 50, 0.18);
}
.tab .tab__n{
  display: inline-block; margin-left: 6px; min-width: 1.5em; padding: 0 5px; border-radius: 99px;
  font-size: 0.7rem; font-weight: 700; line-height: 1.5; text-align: center; font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.16); color: var(--paint-ink);
}
.tab[aria-selected="true"] .tab__n{ background: var(--paint); color: #f6eedb; }
.tab:focus-visible{ outline: 2px solid var(--brass); outline-offset: 2px; }
.cupboard__tools{ display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; font-size: 0.8rem; }
.cupboard__tools > *{ white-space: nowrap; }
.cupboard__count{ color: var(--paint-muted); font-variant-numeric: tabular-nums; }
.linkbtn{ appearance: none; border: 0; background: none; padding: 4px 0; cursor: pointer; font-weight: 600; color: var(--paint-ink); text-decoration: underline; text-decoration-color: rgba(244, 240, 226, 0.45); text-underline-offset: 3px; }
.linkbtn:hover{ text-decoration-color: currentColor; }
.linkbtn:focus-visible{ outline: 2px solid currentColor; outline-offset: 2px; border-radius: 3px; }
.book .linkbtn, .slist .linkbtn, .empty .linkbtn{ color: var(--accent); text-decoration-color: var(--accent-soft); }

.listbtn{
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-pill);
  border: 1px solid #f6eedb; background: #f6eedb;
  font-size: 0.84rem; font-weight: 700; color: #2b2219;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  transition: background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.listbtn svg{ width: 15px; height: 15px; fill: none; stroke: #2b2219; stroke-width: 2.4; stroke-linecap: round; }
.listbtn b{ min-width: 1.5em; padding: 1px 7px; border-radius: 999px; background: var(--liner); color: #fff7ea; font-size: 0.74rem; text-align: center; font-variant-numeric: tabular-nums; }
.listbtn:hover{ background: #fffaf0; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22); }
.listbtn:focus-visible{ outline: 2px solid var(--brass); outline-offset: 2px; }
.listbtn.bump b, .listfab.bump b{ animation: bump 360ms cubic-bezier(.2,.9,.3,1.5); }
@keyframes bump{ 40%{ transform: scale(1.35); } }

/* inside the cupboard */
.cupboard__inner{
  position: relative; overflow: hidden;
  border-radius: 12px;
  padding: 12px clamp(8px, 1.6vw, 16px) 6px;
  background:
    radial-gradient(120% 70% at 50% 0%, var(--inside-glow), transparent 60%),
    repeating-linear-gradient(90deg, transparent 0 21px, var(--inside-line) 21px 22px, rgba(255, 255, 255, 0.05) 22px 23px),
    var(--inside);
  box-shadow:
    inset 0 10px 18px -8px rgba(30, 20, 8, 0.35),
    inset 8px 0 14px -10px rgba(30, 20, 8, 0.3),
    inset -8px 0 14px -10px rgba(30, 20, 8, 0.3),
    0 0 0 1px rgba(0, 0, 0, 0.18);
}
.find{
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 8px;
  max-width: 420px; height: 42px; padding: 0 6px 0 12px; margin: 0 0 6px;
  border-radius: 10px; background: rgba(255, 252, 244, 0.86);
  border: 1px solid rgba(120, 90, 50, 0.22);
  box-shadow: 0 1px 2px rgba(60, 40, 18, 0.08);
}
:root[data-theme="dark"] .find{ background: rgba(18, 15, 11, 0.6); border-color: rgba(255, 230, 190, 0.14); }
.find:focus-within{ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.find svg{ width: 17px; height: 17px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.find input{ flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 1rem; color: var(--ink); }
.find input::placeholder{ color: var(--muted); opacity: 0.85; }
.find input::-webkit-search-cancel-button{ display: none; }
.find__x{ appearance: none; flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.find__x:hover{ color: var(--ink); background: var(--accent-soft); }
.find__x:focus-visible{ outline: 2px solid var(--accent); }
.find__x[hidden]{ display: none; }

/* The shelves: a fixed row height, so every row gets an oak plank with a
   scalloped paper liner hanging from its edge. Layers, top to bottom:
   the plank's lit top edge, its front, the liner's scallops. */
.shelf{
  --row: 136px;
  --plank: calc(var(--row) - 34px);
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); grid-auto-rows: var(--row);
  column-gap: 2px;
  min-height: var(--row);
  background:
    radial-gradient(circle at 7px 0, var(--liner) 0 5.5px, transparent 6px) 0 calc(var(--plank) + 9px) / 14px var(--row) repeat,
    repeating-linear-gradient(180deg,
      transparent 0 var(--plank),
      var(--oak-hi) var(--plank) calc(var(--plank) + 2px),
      var(--oak) calc(var(--plank) + 2px) calc(var(--plank) + 7px),
      var(--oak-lo) calc(var(--plank) + 7px) calc(var(--plank) + 9px),
      transparent calc(var(--plank) + 9px) var(--row));
}
/* the warm strip light under each shelf, at night */
:root[data-theme="dark"] .shelf::after{
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: -1;
  background: repeating-linear-gradient(180deg, rgba(255, 200, 130, 0.10) 0, transparent 46px, transparent var(--row));
  background-position: 0 calc(var(--plank) + 15px);
}
.shelf.is-search{ min-height: var(--row); }
.shelf__none{ grid-column: 1 / -1; align-self: center; margin: 0; padding: 0 8px 30px; text-align: center; color: var(--label-ink); font-size: 0.9rem; }
.jarbtn{
  appearance: none; border: 0; background: none; cursor: pointer; padding: 0;
  position: relative; display: flex; flex-direction: column; align-items: center;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}
.jarbtn__art{
  position: absolute; left: 50%; top: calc(var(--plank) - 70px); width: 64px; height: 76px; margin-left: -32px;
  transition: transform 200ms cubic-bezier(.2,.9,.3,1.3), opacity 220ms ease, filter 220ms ease;
}
.jarbtn__art svg{ width: 100%; height: 100%; overflow: visible; display: block; }
/* not in the kitchen: a faded ghost of the thing, so the shelf still reads as a shelf */
.jarbtn:not(.is-on) .jarbtn__art{ opacity: 0.3; filter: grayscale(0.85) contrast(0.8); }
:root[data-theme="dark"] .jarbtn:not(.is-on) .jarbtn__art{ opacity: 0.3; filter: grayscale(0.9) brightness(0.9); }
.jarbtn.is-on .jarbtn__art{ opacity: 1; filter: drop-shadow(0 3px 2px rgba(40, 24, 10, 0.18)); }
:root[data-theme="dark"] .jarbtn.is-on .jarbtn__art{ filter: drop-shadow(0 0 8px rgba(255, 196, 120, 0.22)) drop-shadow(0 3px 2px rgba(0, 0, 0, 0.4)); }
@media (hover: hover){
  .jarbtn:hover .jarbtn__art{ transform: translateY(-4px); }
  .jarbtn:not(.is-on):hover .jarbtn__art{ opacity: 0.55; }
}
.jarbtn.land .jarbtn__art{ animation: land 460ms cubic-bezier(.2,.8,.3,1); }
@keyframes land{
  0%{ transform: translateY(-16px); }
  55%{ transform: translateY(0) scale(1.06, 0.92); }
  75%{ transform: translateY(-2px) scale(0.98, 1.03); }
  100%{ transform: none; }
}
.jarbtn__label{
  position: absolute; left: 3px; right: 3px; top: calc(var(--plank) + 15px); height: 22px;
  display: flex; align-items: flex-start; justify-content: center; text-align: center;
  font-size: 0.68rem; line-height: 1.12; font-weight: 600; color: var(--label-ink);
}
.jarbtn.is-on .jarbtn__label{ color: var(--label-on); font-weight: 700; }
.jarbtn.is-on .jarbtn__label::before{
  content: ""; flex: none; width: 7px; height: 7px; margin: 4px 4px 0 0; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft);
}
.jarbtn:focus-visible{ outline: none; }
.jarbtn:focus-visible .jarbtn__label{ outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.jarbtn:focus-visible .jarbtn__art{ transform: translateY(-4px); }

.cupboard__foot{ display: flex; flex-direction: column; gap: 10px; padding: 12px 2px 0; }
.nextbuy{ display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.nextbuy[hidden]{ display: none; }
.nextbuy__k{ font-size: 0.68rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass); }
.nextbuy__list{ display: flex; gap: 8px; flex-wrap: wrap; }
.buy{ display: inline-flex; align-items: stretch; border-radius: var(--radius-pill); border: 1px solid rgba(244, 240, 226, 0.32); background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.buy__main, .buy__have{ appearance: none; border: 0; background: transparent; cursor: pointer; color: var(--paint-ink); }
.buy__main{ display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 10px 8px 13px; font-size: 0.82rem; font-weight: 600; }
.buy__main b{ color: var(--brass); font-weight: 800; }
.buy__main .buy__add{ color: var(--paint-muted); font-weight: 600; font-size: 0.72rem; }
.buy__have{ padding: 0 12px; font-size: 0.72rem; font-weight: 600; color: var(--paint-muted); border-left: 1px solid rgba(244, 240, 226, 0.22); }
.buy:hover{ border-color: rgba(244, 240, 226, 0.6); }
.buy__main:hover, .buy__have:hover{ background: rgba(255, 255, 255, 0.1); color: var(--paint-ink); }
.buy.is-listed{ background: rgba(232, 194, 122, 0.2); border-color: var(--brass); }
.buy.is-listed .buy__add{ color: var(--brass); }
.buy__main:focus-visible, .buy__have:focus-visible{ outline: 2px solid var(--brass); outline-offset: -2px; }
.staples{ margin: 0; font-size: 0.78rem; line-height: 1.45; color: var(--paint-muted); }
.staples b{ color: var(--paint-ink); font-weight: 700; }

/* the floating list button: bottom center, clear of the tickets pill
   (bottom left) and the tip-jar and fullscreen badges (right edge) */
.listfab{
  position: fixed; z-index: 20; left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
  transform: translate(-50%, 0);
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.18); background: var(--paint); color: var(--paint-ink);
  font-size: 0.9rem; font-weight: 700;
  box-shadow: 0 12px 30px rgba(20, 30, 20, 0.35);
  transition: transform 260ms cubic-bezier(.2,.9,.3,1.2), opacity 200ms ease;
}
.listfab[hidden]{ display: none; }
.listfab.is-away{ transform: translate(-50%, 140%); opacity: 0; pointer-events: none; }
.listfab svg{ width: 17px; height: 17px; fill: none; stroke: var(--brass); stroke-width: 2.4; stroke-linecap: round; }
.listfab b{ min-width: 1.6em; padding: 2px 8px; border-radius: 999px; background: #f6eedb; color: #2b2219; font-size: 0.78rem; text-align: center; font-variant-numeric: tabular-nums; }
.listfab:focus-visible{ outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- The dinners ---------- */
.book{ display: flex; flex-direction: column; gap: 14px; }
.book__bar{ display: flex; gap: 10px; }
.search{
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 48px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow);
}
.search:focus-within{ border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search svg{ width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input{ flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 1rem; color: var(--ink); }
.search input::placeholder{ color: var(--muted); opacity: 0.8; }

.btn{
  appearance: none; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 0.92rem;
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}
.btn:hover{ transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--ink); }
.btn:focus-visible{ outline: none; box-shadow: 0 0 0 4px var(--accent-soft); border-color: var(--accent); }
.btn--primary{ background: var(--accent); border-color: var(--accent); color: #fff8ee; }
:root[data-theme="dark"] .btn--primary{ color: #1c120a; }
.btn--primary:hover{ background: var(--accent-hover); border-color: var(--accent-hover); }
.btn[hidden]{ display: none; }
.btn svg{ width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.starbtn[aria-pressed="true"]{ background: var(--surface); color: var(--accent); border-color: var(--accent); }
.starbtn[aria-pressed="true"] svg{ fill: currentColor; }

.filters{ display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.seg{ display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line); }
.seg button{
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 8px 13px; border-radius: var(--radius-pill); font-size: 0.84rem; font-weight: 600; color: var(--muted);
  transition: background 140ms ease, color 140ms ease;
}
.seg button b{ margin-left: 4px; font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"]{ background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg button:focus-visible{ outline: 2px solid var(--accent); outline-offset: 1px; }
.chips{ display: flex; gap: 6px; flex-wrap: wrap; }
.chip{
  appearance: none; cursor: pointer;
  padding: 7px 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: transparent;
  font-size: 0.8rem; font-weight: 600; color: var(--muted);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.chip:hover{ color: var(--ink); border-color: var(--ink); }
.chip[aria-pressed="true"]{ background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip[aria-pressed="true"]::before{ content: "✓ "; }
.chip:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.book__count{ margin: 0; font-size: 0.82rem; color: var(--muted); }

.grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.dish{
  position: relative; display: flex; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.dish:hover{ transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.dish.is-ready{ border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.dish__open{
  appearance: none; cursor: pointer; text-align: left; padding: 0; border: 0; background: none; width: 100%;
  display: flex; flex-direction: column;
}
.dish__open:focus-visible{ outline: none; }
.dish:has(.dish__open:focus-visible){ border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.dish__art{
  position: relative; display: block; height: 152px;
  background:
    repeating-linear-gradient(0deg, var(--table-line) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, var(--table-line) 0 1px, transparent 1px 4px),
    radial-gradient(80% 90% at 50% 40%, var(--table-glow), transparent 70%),
    var(--table);
  border-bottom: 1px solid var(--line);
}
.dish__art svg{ position: absolute; inset: 6px 10px; width: calc(100% - 20px); height: calc(100% - 12px); }
.dish__body{ padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.dish__meta{ font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.dish__name{ font-family: var(--font-display); font-size: 1.14rem; line-height: 1.16; color: var(--ink); }
.dish__tags{ display: flex; flex-wrap: wrap; gap: 4px; }
.tag{
  display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 6px;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.02em; color: var(--muted); background: var(--surface-2);
}
.tag--veg{ color: var(--ok); background: var(--ok-soft); }
.tag--quick{ color: var(--accent); background: var(--accent-soft); }
.dish__status{ margin-top: auto; padding-top: 8px; font-size: 0.76rem; font-weight: 700; color: var(--muted); }
.dish.is-ready .dish__status{ color: var(--ok); }
.dish.is-one .dish__status{ color: var(--accent); }
.dish__star{
  position: absolute; top: 10px; right: 10px; z-index: 1;
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(60, 40, 18, 0.12);
  background: rgba(255, 252, 245, 0.92); color: #8a7a64; box-shadow: 0 2px 6px rgba(40, 24, 10, 0.14);
  transition: transform 160ms ease, color 160ms ease;
}
:root[data-theme="dark"] .dish__star{ background: rgba(28, 24, 19, 0.88); border-color: rgba(255, 230, 190, 0.12); color: #a99b86; }
.dish__star svg{ width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.dish__star:hover{ color: var(--accent); transform: scale(1.06); }
.dish__star[aria-pressed="true"]{ color: #e0a21e; }
.dish__star[aria-pressed="true"] svg{ fill: currentColor; stroke: #b07a10; }
.dish__star.pop svg{ animation: starpop 420ms cubic-bezier(.2,.9,.3,1.5); }
@keyframes starpop{ 40%{ transform: scale(1.4) rotate(12deg); } }
.dish__star:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }

.empty{ margin: 18px 0; text-align: center; color: var(--muted); }
.empty[hidden]{ display: none; }
.backlink{ align-self: center; margin-top: 10px; font-size: 0.82rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.backlink:hover{ color: var(--ink); }

/* ---------- Dialogs ---------- */
.recipe, .slist{
  max-height: calc(100vh - 32px); padding: 0;
  border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg); overflow: auto; overscroll-behavior: contain;
}
.recipe{ width: min(920px, calc(100vw - 24px)); }
.slist{ width: min(540px, calc(100vw - 24px)); }
.recipe::backdrop, .slist::backdrop{ background: rgba(20, 14, 8, 0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.recipe[open], .slist[open]{ animation: rise 260ms cubic-bezier(.2,.9,.3,1.1); }
@keyframes rise{ from{ opacity: 0; transform: translateY(18px) scale(0.98); } to{ opacity: 1; transform: none; } }
.recipe__inner{ position: relative; display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); }
.recipe__close{
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--surface); cursor: pointer; font-size: 1.4rem; line-height: 1; color: var(--ink);
}
.recipe__close:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.recipe__art{
  position: relative; display: flex; align-items: flex-start; justify-content: center; min-height: 380px; padding: 36px 0;
  background:
    repeating-linear-gradient(0deg, var(--table-line) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, var(--table-line) 0 1px, transparent 1px 4px),
    radial-gradient(70% 60% at 50% 40%, var(--table-glow), transparent 70%),
    var(--table);
}
.recipe__art svg{ width: 92%; height: auto; aspect-ratio: 4 / 3; max-height: 320px; position: sticky; top: 36px; }
.recipe__body{ padding: 30px 30px 26px; display: flex; flex-direction: column; gap: 11px; min-width: 0; }
.recipe__meta{ margin: 0; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); padding-right: 46px; }
.recipe__meta span{ margin: 0 6px; opacity: 0.6; }
.recipe__name{ margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.8rem, 4.4vw, 2.4rem); line-height: 1.06; letter-spacing: -0.01em; }
.recipe__badges{ display: flex; flex-wrap: wrap; gap: 5px; }
.recipe__badges .tag{ font-size: 0.72rem; padding: 3px 8px; }
.recipe__badges:empty{ display: none; }
.recipe__status{ margin: 0; font-size: 0.88rem; font-weight: 600; color: var(--muted); }
.recipe__status.is-ready{ color: var(--ok); }
.recipe__status.is-one{ color: var(--accent); }
.recipe__h{ margin: 8px 0 0; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.recipe__ing{ list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.recipe__ing li{
  display: grid; grid-template-columns: 7.4em 1fr auto; align-items: baseline; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.94rem;
}
.recipe__ing .amt{ font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.recipe__ing .t{ font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.recipe__ing .t--have{ color: var(--ok); }
.recipe__ing .t--miss{ color: var(--accent); }
.recipe__ing .t--opt, .recipe__ing .t--staple{ color: var(--muted); font-weight: 600; }
.recipe__ing li.is-missing .name{ color: var(--accent); }
.recipe__ing li.is-staple .name, .recipe__ing li.is-staple .amt{ color: var(--muted); font-weight: 500; }
.recipe__steps{ margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 10px; }
.recipe__steps li{ position: relative; padding-left: 36px; font-size: 0.98rem; line-height: 1.55; counter-increment: step; }
.recipe__steps li::before{
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 25px; height: 25px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 0.86rem; color: var(--accent); background: var(--accent-soft);
}
.recipe__note{ margin: 2px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.86rem; line-height: 1.5; color: var(--muted); }
.recipe__note[hidden]{ display: none; }
.recipe__actions{ display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.slist__inner{ position: relative; padding: 28px 26px 24px; display: flex; flex-direction: column; gap: 10px; }
.slist__title{ margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 2rem; line-height: 1.05; }
.slist__sum{ margin: 0; font-size: 0.95rem; color: var(--muted); line-height: 1.5; }
.slist__sum:empty{ display: none; }
.slist__sum b{ color: var(--ink); }
.slist__aisle{ margin: 10px 0 0; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.slist__items, .slist__stars{ list-style: none; margin: 4px 0 0; padding: 0; border-top: 1px solid var(--line); }
.slist__items li, .slist__stars li{ display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.slist__stars li{ grid-template-columns: 1fr auto auto; }
.slist__name{ font-weight: 700; font-size: 1rem; }
.slist__items .slist__name{ grid-column: 2; }
.slist__items .slist__for{ grid-column: 2; }
.slist__items .slist__got{ grid-row: 1 / span 2; }
.slist__items .slist__x{ grid-column: 3; grid-row: 1 / span 2; }
.slist__for{ font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.slist__stars .linkbtn{ text-align: left; font-size: 0.95rem; padding: 2px 0; }
.slist__got{
  appearance: none; cursor: pointer; width: 30px; height: 30px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: transparent; display: inline-flex; align-items: center; justify-content: center;
}
.slist__got span{ width: 12px; height: 7px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg) translate(1px, -1px); opacity: 0; transition: opacity 120ms ease; }
.slist__got:hover{ border-color: var(--ok); }
.slist__got:hover span{ opacity: 0.7; }
.slist__got:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.slist__x{
  appearance: none; cursor: pointer; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: transparent; color: var(--muted); font-size: 1.1rem; line-height: 1;
}
.slist__x:hover{ color: var(--ink); border-color: var(--ink); }
.slist__x:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.slist__empty{ margin: 4px 0 8px; color: var(--muted); line-height: 1.5; }
.slist__empty[hidden], .slist .recipe__actions[hidden]{ display: none; }
.slist .recipe__actions{ align-items: center; }

@media (max-width: 760px){
  .recipe, .slist{ width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .recipe__inner{ grid-template-columns: 1fr; }
  .recipe__art{ min-height: 0; height: 210px; padding: 10px 0; align-items: center; }
  .recipe__art svg{ position: static; width: auto; height: 190px; max-height: none; }
  .recipe__body{ padding: 20px 18px 28px; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .slist__inner{ padding: 24px 18px 26px; padding-bottom: max(26px, env(safe-area-inset-bottom)); }
}
@media (max-width: 600px){
  .cupboard{ padding: 10px 8px 12px; border-radius: 18px; }
  .cupboard__head{ padding: 2px 0 10px; }
  /* the shelf names run in one swipeable row */
  .tabs{ flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 16px); margin: 0 -8px; padding: 2px 8px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar{ display: none; }
  .cupboard__tools{ width: 100%; }
  #listBtn{ order: 0; }
  .cupboard__count{ order: 1; flex: 1 1 auto; text-align: right; }
  #starterBtn{ order: 2; flex: 1 1 auto; text-align: left; }
  #clearBtn{ order: 3; }
  .cupboard__inner{ padding: 10px 6px 4px; }
  .find{ max-width: none; }
  .eyebrow{ font-size: 0.62rem; letter-spacing: 0.13em; }
  .shelf{ --row: 116px; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); column-gap: 0; }
  .jarbtn__art{ width: 52px; height: 62px; margin-left: -26px; top: calc(var(--plank) - 57px); }
  .jarbtn__label{ font-size: 0.6rem; left: 1px; right: 1px; }
  .jarbtn.is-on .jarbtn__label::before{ width: 6px; height: 6px; margin: 3px 3px 0 0; }
  .dish__kind{ display: none; }
  .grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dish__art{ height: 118px; }
  .dish__art svg{ inset: 4px 4px; width: calc(100% - 8px); height: calc(100% - 8px); }
  .dish__body{ padding: 10px 11px 12px; }
  .dish__name{ font-size: 1rem; }
  .dish__meta{ font-size: 0.6rem; letter-spacing: 0.08em; }
  .dish__star{ width: 34px; height: 34px; top: 6px; right: 6px; }
  .dish__tags .tag{ font-size: 0.6rem; padding: 2px 5px; }
  .book__bar{ flex-wrap: wrap; }
  .search{ flex-basis: 100%; }
  .book__bar .btn{ flex: 1; }
  .seg{ width: 100%; }
  .seg button{ flex: 1 1 auto; padding: 8px 4px; font-size: 0.78rem; white-space: nowrap; }
  .recipe__ing li{ grid-template-columns: 6.2em 1fr auto; font-size: 0.9rem; }
}
/* a phone on its side: a narrow art column so the recipe has room */
@media (orientation: landscape) and (max-height: 500px){
  .recipe{ max-height: calc(100vh - 16px); }
  .recipe__inner{ grid-template-columns: minmax(0, 0.62fr) minmax(0, 1.38fr); }
  .recipe__art{ min-height: 0; padding: 20px 0; }
  .recipe__art svg{ top: 20px; max-height: 220px; }
  .recipe__body{ padding: 22px 24px 20px; }
}
@media (max-width: 360px){
  .grid{ grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
