/* Colours come from config.theme (set as CSS variables at startup). Everything else derives from them. */
:root {
  --accent: #B4441E;
  --gold: #E3A42B;
  --bg: #F6F1E9;
  --ink: #1F1A15;
  --muted: color-mix(in srgb, var(--ink) 64%, var(--bg));
  --line: color-mix(in srgb, var(--ink) 11%, transparent);
  --card: color-mix(in srgb, #fff 55%, var(--bg));
  --wash: color-mix(in srgb, var(--ink) 5%, var(--bg));
  --veg: #2F7D45;
  --nonveg: #A2401B;
  --wa: #0F7B41;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: 20px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
html.locked { overflow: hidden; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { display: block; max-width: 100%; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
ul { list-style: none; margin: 0; padding: 0; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* Instant press feedback on everything tappable */
.add, .stepper button, .primary, .wa-btn, .cartbar, .chip, .ghost-btn, .icon-btn, .item-main, .feat-main, .add-more, .seg-opt span {
  transition: transform 140ms var(--ease-out), background-color 160ms ease, color 160ms ease, opacity 160ms ease;
}
.add:active, .stepper button:active, .primary:active, .wa-btn:active, .ghost-btn:active, .icon-btn:active, .chip:active { transform: scale(0.95); }
.cartbar:active, .feat-main:active { transform: scale(0.98); }

.setup-error { background: #7A1F12; color: #fff; padding: 14px var(--gutter); font-size: 14px; }
.setup-error ul { margin-top: 6px; padding-left: 18px; list-style: disc; }

/* ---------- Hero ---------- */
.hero { position: relative; }
.cover { height: 216px; overflow: hidden; background: #3a2a1e; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover::after { content: ""; position: absolute; inset: 0 0 auto; height: 216px; background: linear-gradient(to bottom, transparent 55%, rgba(20, 14, 10, 0.35)); pointer-events: none; }
.intro {
  position: relative; margin: -28px 12px 0; padding: 20px 20px 18px;
  background: var(--bg); border-radius: 22px 22px 0 0;
}
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.wordmark {
  margin: 4px 0 12px; font: 500 40px/1 var(--serif); letter-spacing: -0.025em;
  font-variation-settings: "opsz" 96;
}
.wordmark em { font-style: italic; color: var(--accent); font-weight: 500; margin: 0 0.06em 0 0; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--muted); }
.status { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.status.open { color: var(--veg); }
.status.closed { color: var(--nonveg); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }

/* ---------- Category chips ---------- */
.cats {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid transparent; transition: border-color 200ms ease;
}
.cats.stuck { border-bottom-color: var(--line); }
.cats-track {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px var(--gutter);
  scrollbar-width: none; scroll-padding-inline: var(--gutter);
}
.cats-track::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 9px 15px; border-radius: 999px;
  font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink);
  background: var(--wash); white-space: nowrap;
}
.chip.active { background: var(--ink); color: var(--bg); }

/* ---------- Sections ---------- */
.menu { padding-bottom: 32px; }
.sec-title {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0; padding: 30px var(--gutter) 6px;
  font: 500 26px/1.15 var(--serif); letter-spacing: -0.015em;
}
.count { font: 600 13px var(--sans); color: var(--muted); letter-spacing: 0; }

/* Featured rail */
.rail {
  display: flex; gap: 12px; overflow-x: auto; padding: 10px var(--gutter) 6px;
  scroll-snap-type: x mandatory; scrollbar-width: none; scroll-padding: 0 var(--gutter);
}
.rail::-webkit-scrollbar { display: none; }
.feat { position: relative; flex: none; width: 168px; scroll-snap-align: start; }
.feat-main { display: block; width: 100%; text-align: left; }
.feat-photo { display: block; aspect-ratio: 132 / 150; border-radius: 18px; overflow: hidden; background: var(--wash); }
.feat-photo img { width: 100%; height: 100%; object-fit: cover; }
.feat-name { display: flex; align-items: center; gap: 6px; margin-top: 10px; font: 500 16px/1.25 var(--serif); }
.feat-price { display: block; margin-top: 2px; font-size: 14px; font-weight: 600; }
.feat-slot { position: absolute; top: calc(168px * 150 / 132 - 48px); right: 8px; }
.feat-slot .add { min-width: 0; }

/* Item rows */
.items { padding: 0 var(--gutter); }
.item { position: relative; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item-main {
  display: grid; grid-template-columns: 1fr 124px; gap: 16px; align-items: start;
  width: 100%; padding: 18px 0 30px; text-align: left;
}
.item.no-photo .item-main { grid-template-columns: 1fr 104px; padding-bottom: 18px; }
.item-text { display: flex; flex-direction: column; min-width: 0; }
.item-meta { display: flex; align-items: center; gap: 8px; min-height: 16px; }
.item-name { margin-top: 6px; font: 500 19px/1.2 var(--serif); letter-spacing: -0.01em; }
.item-price { margin-top: 4px; font-size: 15px; font-weight: 600; }
.onwards { font-weight: 500; color: var(--muted); font-size: 13px; }
.item-desc {
  margin-top: 6px; font-size: 14px; line-height: 1.45; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item-photo { display: block; width: 124px; height: 124px; border-radius: 18px; overflow: hidden; background: var(--wash); }
.item-photo img { width: 100%; height: 100%; object-fit: cover; }
.item .slot {
  position: absolute; right: 0; top: calc(18px + 124px - 20px); width: 124px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.item.no-photo .slot { top: 40px; width: 104px; }
.sold-out .item-main { opacity: 0.5; }
.sold { font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 0; }

.tag {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); background: color-mix(in srgb, var(--gold) 22%, transparent);
  padding: 2px 7px; border-radius: 6px;
}

/* Veg / non-veg marks (Indian convention: square + dot / square + triangle) */
.diet { flex: none; position: relative; width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 3px; }
.diet.veg { color: var(--veg); }
.diet.nonveg { color: var(--nonveg); }
.diet::after { content: ""; position: absolute; inset: 2.5px; background: currentColor; border-radius: 50%; }
.diet.nonveg::after { border-radius: 0; inset: 2px 2px 3px; clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* Add button + stepper */
.add {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 96px; height: 40px; padding: 0 16px; border-radius: 12px;
  background: #fff; color: var(--accent); font-weight: 700; font-size: 15px; letter-spacing: 0.02em;
  box-shadow: 0 1px 2px rgba(31, 26, 21, 0.08), 0 6px 16px -6px rgba(31, 26, 21, 0.25);
}
.add svg { width: 16px; height: 16px; stroke-width: 2.6; }
.stepper {
  display: inline-flex; align-items: center; justify-content: space-between;
  min-width: 96px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}
.stepper button { width: 36px; height: 40px; display: grid; place-items: center; }
.stepper button:disabled { opacity: 0.35; }
.stepper .q { min-width: 20px; text-align: center; font-weight: 700; font-size: 15px; }
.stepper.big { height: 52px; min-width: 124px; border-radius: 16px; background: var(--wash); color: var(--ink); box-shadow: none; }
.stepper.big button { width: 44px; height: 52px; }
.stepper.small { height: 34px; min-width: 88px; border-radius: 10px; background: #fff; color: var(--accent); box-shadow: inset 0 0 0 1px var(--line); }
.stepper.small button { width: 32px; height: 34px; }
.stepper.small svg { width: 16px; height: 16px; }

/* ---------- Footer ---------- */
.footer { padding: 28px var(--gutter) 140px; border-top: 1px solid var(--line); margin: 0 var(--gutter); padding-left: 0; padding-right: 0; font-size: 14px; color: var(--muted); display: grid; gap: 4px; }
.foot-name { font: 500 20px var(--serif); color: var(--ink); margin-bottom: 4px; }
.foot-how { margin-top: 12px; color: var(--ink); }
.foot-small { margin-top: 12px; font-size: 12px; }
.footer a { color: inherit; }

/* ---------- Cart bar ---------- */
.cartbar-wrap {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; pointer-events: none;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom));
}
.cartbar {
  pointer-events: auto; width: 100%; max-width: 520px; margin: 0 auto; height: 60px;
  display: flex; align-items: center; gap: 12px; padding: 0 18px 0 12px;
  border-radius: 18px; background: var(--ink); color: var(--bg);
  box-shadow: 0 12px 32px -10px rgba(31, 26, 21, 0.55);
  animation: rise 420ms var(--ease-drawer);
}
.cb-count {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
}
.cb-label { flex: 1; text-align: left; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-total { font-weight: 700; font-size: 16px; }
.cartbar.bump { animation: bump 380ms var(--ease-out); }
@keyframes rise { from { transform: translateY(120%); } }
@keyframes bump { 40% { transform: scale(1.035); } }

/* ---------- Sheets (native <dialog>) ---------- */
.sheet {
  position: fixed; inset: auto 0 0; margin: 0; padding: 0; border: 0;
  width: 100%; max-width: 100%; max-height: min(92dvh, 92vh);
  background: var(--bg); color: var(--ink); border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px -12px rgba(0, 0, 0, 0.35);
  transform: translateY(0); transition: transform 380ms var(--ease-drawer);
  overflow: hidden;
}
.sheet::backdrop { background: rgba(20, 14, 10, 0.45); transition: opacity 300ms ease; }
.sheet.pre { transform: translateY(100%); transition-duration: 240ms; transition-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.sheet.pre::backdrop { opacity: 0; }
.sheet-inner { display: flex; flex-direction: column; max-height: min(92dvh, 92vh); }
.sheet-scroll { overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
.sheet-foot {
  display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--bg);
}

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--wash); color: var(--ink);
}
.sheet-close { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(255, 255, 255, 0.92); box-shadow: 0 2px 10px rgba(0,0,0,.12); }

/* Item sheet */
.sheet-photo { aspect-ratio: 16 / 11; background: var(--wash); }
.sheet-photo img { width: 100%; height: 100%; object-fit: cover; }
.sheet-body { padding: 20px var(--gutter) 24px; }
.item-form.no-photo .sheet-body { padding-top: 24px; padding-right: 64px; }
.sheet-title { margin: 8px 0 0; font: 500 28px/1.1 var(--serif); letter-spacing: -0.02em; }
.sheet-price { margin-top: 6px; font-weight: 600; }
.sheet-desc { margin-top: 8px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.opt { margin: 22px 0 0; padding: 0; border: 0; }
.opt legend { display: flex; width: 100%; justify-content: space-between; align-items: baseline; padding: 0 0 6px; font-weight: 700; font-size: 15px; }
.opt legend em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); }
.choice {
  display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 2px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.choice:last-child { border-bottom: 0; }
.choice input { appearance: none; flex: none; width: 22px; height: 22px; margin: 0; border: 2px solid color-mix(in srgb, var(--ink) 28%, transparent); border-radius: 50%; display: grid; place-items: center; transition: border-color 140ms ease, background-color 140ms ease; }
.choice input[type="checkbox"] { border-radius: 7px; }
.choice input:checked { border-color: var(--accent); background: var(--accent); }
.choice input:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.choice input[type="checkbox"]:checked::after { width: 10px; height: 6px; border-radius: 0; background: none; border: solid #fff; border-width: 0 0 2.4px 2.4px; transform: translateY(-1px) rotate(-45deg); }
.choice-name { flex: 1; font-size: 15px; }
.choice-price { font-size: 14px; color: var(--muted); font-weight: 600; }

.primary {
  flex: 1; height: 52px; border-radius: 16px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  font-weight: 700; font-size: 16px;
}

/* Cart sheet */
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 10px var(--gutter); }
.cart-head h2 { margin: 0; font: 500 26px var(--serif); letter-spacing: -0.015em; }
.lines { padding: 0 var(--gutter); }
.line { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.line-photo { flex: none; width: 56px; height: 56px; border-radius: 12px; overflow: hidden; background: var(--wash); }
.line-photo img { width: 100%; height: 100%; object-fit: cover; }
.line-text { flex: 1; min-width: 0; }
.line-name { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 15px; line-height: 1.3; }
.line-name .diet { width: 12px; height: 12px; }
.line-name .diet::after { inset: 2px; }
.line-sum { font-size: 13px; color: var(--muted); margin-top: 2px; }
.line-total { font-size: 14px; font-weight: 600; margin-top: 3px; }
.add-more { display: block; margin: 6px var(--gutter) 0; padding: 12px 0; color: var(--accent); font-weight: 700; font-size: 15px; }

.field-label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.field-label em { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 4px; }
.seg { margin: 14px var(--gutter) 0; padding: 0; border: 0; }
.seg legend { padding: 0; }
.seg-track { display: flex; gap: 4px; padding: 4px; background: var(--wash); border-radius: 14px; }
.seg-opt { flex: 1; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: grid; place-items: center; height: 40px; border-radius: 11px; font-weight: 600; font-size: 15px; color: var(--muted); cursor: pointer; }
.seg-opt input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(31, 26, 21, 0.12); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.field { display: block; margin: 16px var(--gutter) 0; }
.field textarea {
  width: 100%; resize: none; border: 0; border-radius: 14px; padding: 12px 14px;
  background: #fff; box-shadow: inset 0 0 0 1px var(--line); font-size: 16px; line-height: 1.4;
}
.field textarea::placeholder { color: color-mix(in srgb, var(--ink) 45%, transparent); }
.field textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }

.bill { margin: 20px var(--gutter) 0; padding-top: 6px; }
.bill div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 15px; color: var(--muted); }
.bill dd, .bill dt { margin: 0; }
.bill .grand { color: var(--ink); font-weight: 700; font-size: 18px; border-top: 1px dashed color-mix(in srgb, var(--ink) 22%, transparent); margin-top: 6px; padding-top: 10px; }
.trust { margin: 12px var(--gutter) 22px; font-size: 13px; line-height: 1.45; color: var(--muted); }

.wa-btn {
  flex: 1; height: 56px; border-radius: 16px; background: var(--wa); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 0 20px; font-weight: 700; font-size: 17px;
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--wa) 80%, transparent);
}
.wa-btn svg { width: 24px; height: 24px; stroke: none; }
.wa-btn #wa-label { flex: 1; text-align: left; }
.wa-btn:disabled { background: color-mix(in srgb, var(--ink) 30%, var(--bg)); box-shadow: none; cursor: not-allowed; }

.cart-empty, .sent { padding: 28px var(--gutter) calc(32px + env(safe-area-inset-bottom)); text-align: center; display: grid; justify-items: center; gap: 8px; }
.empty-title, .sent-title { margin: 0; font: 500 22px var(--serif); }
.ghost-btn { margin-top: 10px; height: 48px; padding: 0 22px; border-radius: 14px; background: var(--wash); font-weight: 700; }
.link-btn { padding: 10px; color: var(--muted); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.sent-mark { width: 64px; height: 64px; border-radius: 50%; background: color-mix(in srgb, var(--wa) 14%, var(--bg)); color: var(--wa); display: grid; place-items: center; margin-bottom: 6px; }
.sent-mark svg { width: 30px; height: 30px; stroke-width: 2.6; }
.sent .muted { max-width: 34ch; }

/* ---------- Hover (real pointers only) ---------- */
@media (hover: hover) and (pointer: fine) {
  .chip:not(.active):hover { background: color-mix(in srgb, var(--ink) 10%, var(--bg)); }
  .item-main:hover .item-name, .feat-main:hover .feat-name { color: var(--accent); }
  .add:hover { background: color-mix(in srgb, var(--accent) 6%, #fff); }
}

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  :root { --gutter: 32px; }
  body { font-size: 16px; }
  .hero, .cats-track, .menu, .footer { max-width: 1080px; margin-left: auto; margin-right: auto; }
  .cover { height: 360px; margin: 24px 24px 0; border-radius: 28px; }
  .cover::after { display: none; }
  .intro { margin: -60px 56px 0; padding: 28px 32px 22px; border-radius: 24px 24px 0 0; }
  .wordmark { font-size: 56px; }
  .items { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; }
  .item:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
  .feat { width: 200px; }
  .feat-slot { top: calc(200px * 150 / 132 - 48px); }
  .footer { margin-top: 24px; }
  .sheet {
    inset: 0; margin: auto; max-width: 480px; max-height: min(86vh, 820px);
    border-radius: 24px; transition: transform 300ms var(--ease-out), opacity 220ms ease;
  }
  .sheet-inner { max-height: min(86vh, 820px); }
  .sheet.pre { transform: translateY(16px) scale(0.98); opacity: 0; transition-duration: 180ms; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop { animation: none !important; transition-property: opacity, background-color, color !important; }
  .sheet.pre { transform: none; opacity: 0; }
}
