/* SplitKitch web app: light only, warm cream, deep pistachio, cocoa brown.
   Tokens match splitkitch.com. Buttons depress on press; busy buttons dim
   and swap in a busy label (handled in app.js). 44px minimum tap targets. */

:root {
  color-scheme: light;
  --bg: #fdf6ec;
  --surface: #ffffff;
  --ink: #2b2118;
  --ink-muted: #5d4c3d;
  --pistachio: #38602a;
  --pistachio-bright: #4a7d37;
  --pistachio-soft: #e7efdc;
  --cocoa: #6d4525;
  --cocoa-soft: #a9805c;
  --line: #e8dcc8;
  --free: #38602a;
  --error: #b42318;
  --radius: 18px;
  --shadow-3d: 0 3px 0 rgba(43, 33, 24, 0.22), 0 14px 28px rgba(56, 96, 42, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px; line-height: 1.55;
  padding-bottom: 92px; /* room for the bottom nav */
}
:focus-visible { outline: 3px solid var(--cocoa); outline-offset: 2px; }
a { color: var(--pistachio); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; }
.wrap { max-width: 1020px; margin: 0 auto; padding: 0 20px; }

/* Wordmark: Split raised, cocoa slash, Kitch lowered */
.wordmark { font-weight: 800; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: baseline; font-size: 1.45rem; }
.wordmark .wm-split { transform: translateY(-0.07em); }
.wordmark .wm-slash { color: var(--cocoa); margin: 0 0.02em; }
.wordmark .wm-kitch { color: var(--pistachio); transform: translateY(0.07em); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--surface); box-shadow: 0 6px 18px rgba(43,33,24,0.10); }
.header-inner { display: flex; align-items: center; gap: 14px; min-height: 64px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.header-inner .spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: 0.88rem; min-height: 44px; }
.chip.ok { background: var(--pistachio-soft); border-color: var(--pistachio-bright); color: var(--pistachio); font-weight: 700; }

/* Preview banner */
.preview-banner { background: var(--pistachio-soft); border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.preview-banner .wrap { padding-top: 10px; padding-bottom: 10px; }

/* Buttons: one system. Press = sink + shadow collapse. */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  font: inherit; font-weight: 700; border-radius: 999px;
  min-height: 44px; padding: 10px 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(2px) scale(0.99); }
.btn-primary { background: var(--pistachio); color: #fff; box-shadow: var(--shadow-3d); }
.btn-primary:active { box-shadow: 0 1px 0 rgba(43,33,24,0.22); }
.btn-ghost { background: var(--surface); color: var(--pistachio); border-color: var(--pistachio); }
.btn-cocoa { background: var(--cocoa); color: #fff; }
.btn-sm { min-height: 44px; padding: 6px 14px; font-size: 0.92rem; }
.btn[disabled], .btn.busy { opacity: 0.55; pointer-events: none; }
.btn-block { width: 100%; }

/* Tabs + chips */
.tabs { display: flex; gap: 8px; margin: 18px 0 6px; }
.tab-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; min-height: 44px; padding: 8px 18px; font: inherit; font-weight: 700; cursor: pointer; }
.tab-btn[aria-selected="true"] { background: var(--pistachio); color: #fff; border-color: var(--pistachio); }
.tab-btn:active { transform: translateY(2px); }
.chip-rail { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); }
.chip-rail::-webkit-scrollbar { display: none; }
.fchip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; min-height: 44px; padding: 8px 16px; font: inherit; cursor: pointer; }
.fchip[aria-pressed="true"] { background: var(--pistachio-soft); border-color: var(--pistachio); color: var(--pistachio); font-weight: 700; }
.fchip:active { transform: translateY(2px); }
.filters-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 6px 0 14px; }
.filters-row label { font-size: 0.9rem; color: var(--ink-muted); }
select, input[type="text"], input[type="tel"], input[type="number"], textarea {
  font: inherit; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--surface); color: var(--ink); width: 100%;
}
.filters-row select { width: auto; }

/* Cards */
.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card img { width: 100%; height: 190px; object-fit: cover; display: block; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { font-size: 1.08rem; margin: 0; }
.card .desc { color: var(--ink-muted); font-size: 0.95rem; margin: 0; }
.card .meta { font-size: 0.88rem; color: var(--ink-muted); display: flex; gap: 10px; flex-wrap: wrap; }
.card .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.price { font-weight: 800; font-size: 1.1rem; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 10px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.02em; }
.badge-free { background: var(--pistachio); color: #fff; }
.badge-fresh { background: var(--pistachio-soft); color: var(--pistachio); box-shadow: inset 0 0 0 1px var(--pistachio-bright); }
.badge-soldout { background: var(--pistachio); color: #fff; }
.badge-expired { background: #e8e0d4; color: var(--ink-muted); }
.card.dead img { filter: grayscale(1); opacity: 0.65; }
.gone-title { margin-bottom: 2px; }
.badge-org { background: var(--cocoa); color: #fff; }
.badge-mode { background: var(--pistachio-soft); color: var(--pistachio); }
.badge-ad { background: var(--ink); color: #fff; }
.left-count { font-weight: 700; color: var(--cocoa); }
.permit-line { font-size: 0.82rem; color: var(--ink-muted); border-top: 1px dashed var(--line); padding-top: 8px; }
.permit-line a { font-weight: 700; }

/* Sheets / modal */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(43,33,24,0.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); border-radius: 22px 22px 0 0; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; padding: 22px 22px 30px; }
@media (min-width: 640px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 22px; } }
.sheet img.hero { width: 100%; height: 220px; object-fit: cover; border-radius: 14px; }
.field { margin: 12px 0; }
.field label { display: block; font-weight: 700; margin-bottom: 5px; font-size: 0.95rem; }
.field .hint { font-size: 0.85rem; color: var(--ink-muted); margin-top: 4px; }
.stepper { display: inline-flex; align-items: center; gap: 12px; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--pistachio); background: var(--surface); color: var(--pistachio); font-size: 1.2rem; font-weight: 800; cursor: pointer; }
.stepper button:active { transform: translateY(2px); }
.pickup-code { font-size: 2rem; font-weight: 800; letter-spacing: 0.3em; text-align: center; background: var(--pistachio-soft); border-radius: 14px; padding: 12px; }
.error { color: var(--error); font-size: 0.92rem; }
.fineprint { font-size: 0.85rem; color: var(--ink-muted); }

/* Bottom nav */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); box-shadow: 0 -6px 18px rgba(43,33,24,0.10); }
.bottom-nav .wrap { position: relative; display: flex; justify-content: space-around; padding-top: 6px; padding-bottom: 8px; }
.nav-pill { position: absolute; top: 6px; left: 0; height: 44px; width: 64px; border-radius: 999px; background: var(--pistachio-soft); opacity: 0; pointer-events: none; transition: transform 0.28s ease, width 0.28s ease, opacity 0.2s ease; }
.nav-btn { position: relative; z-index: 1; background: none; border: none; font: inherit; font-size: 0.82rem; font-weight: 700; color: var(--ink-muted); min-height: 44px; min-width: 64px; cursor: pointer; border-radius: 12px; }
.nav-btn.on { color: var(--pistachio); }
.nav-btn:active { transform: translateY(2px); }
.nav-btn.post { background: var(--pistachio); color: #fff; border-radius: 999px; padding: 0 18px; box-shadow: var(--shadow-3d); }

/* Sections, resources, rules */
.section { padding: 26px 0; }
.resgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.rescard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.rescard .type { font-size: 0.8rem; font-weight: 800; color: var(--cocoa); text-transform: uppercase; letter-spacing: 0.04em; }
.rescard h3 { margin-top: 4px; }
.rescard .serves { font-size: 0.88rem; color: var(--ink-muted); }
.help211 { background: var(--pistachio); color: #fff; border-radius: 20px; padding: 22px; margin: 18px 0; }
.help211 a { color: #fff; font-weight: 800; }
.help211 .big211 { font-size: 34px; font-weight: 900; display: block; margin-top: 8px; }
.rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.rule { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.rule h3 { color: var(--cocoa); font-size: 1.02rem; }
.toast { position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; z-index: 50; font-size: 0.95rem; max-width: 90vw; text-align: center; }
.view[hidden] { display: none; }
.stars button { background: none; border: none; font-size: 1.6rem; cursor: pointer; min-width: 44px; min-height: 44px; color: var(--cocoa-soft); }
.stars button.on { color: var(--cocoa); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:active, .tab-btn:active, .fchip:active, .stepper button:active, .nav-btn:active { transform: none; }
}

/* Empty state: an invitation, never a void. */
.empty-state { text-align: center; background: var(--surface); border: 1px dashed var(--cocoa-soft); border-radius: var(--radius); padding: 36px 24px; margin: 18px 0; }
.empty-state .empty-icon { border-radius: 18px; margin-bottom: 10px; }
.empty-state h2 { margin-bottom: 0.35em; }
.empty-state p { color: var(--ink-muted); max-width: 46ch; margin: 0 auto 18px; }
