/* ============ theme presets ============ */
:root,
[data-theme="sand"] {
  --bg: #faf7f2;  --surface: #fffdfa; --line: #e7dfd3;
  --text: #221f1b; --muted: #8a8175;  --faint: #b5aa9b;
  --accent: #3f3a33; --on-accent: #fdfbf7;
  --sold: #b9b1a5;  --hot: #b4462f;
}
[data-theme="mono"] {
  --bg: #ffffff;  --surface: #ffffff; --line: #e6e6e6;
  --text: #111111; --muted: #767676;  --faint: #aaaaaa;
  --accent: #111111; --on-accent: #ffffff;
  --sold: #b0b0b0;  --hot: #c0392b;
}
[data-theme="forest"] {
  --bg: #f5f7f3;  --surface: #fdfefc; --line: #dde3d8;
  --text: #1c2419; --muted: #6f7c69;  --faint: #a3ad9d;
  --accent: #2f4a34; --on-accent: #f4f8f2;
  --sold: #a9b2a4;  --hot: #a8442c;
}
[data-theme="night"] {
  --bg: #14140f;  --surface: #1c1c17; --line: #2e2e27;
  --text: #f0ece4; --muted: #9a9488;  --faint: #6d675d;
  --accent: #e8e2d6; --on-accent: #1a1a15;
  --sold: #5f5a51;  --hot: #e08a6e;
}

/* ============ base ============ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
body.is-locked { overflow: hidden; }

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }

#app { max-width: 560px; margin: 0 auto; background: var(--bg); }

/* ============ hero ============ */
.hero { position: relative; }
.hero__cover { width: 100%; height: 168px; object-fit: cover; }
.hero__body { padding: 20px 20px 16px; text-align: center; }
.hero__logo { width: 52px; height: 52px; object-fit: contain; margin: 0 auto 10px; border-radius: 50%; }
.hero__cover + .hero__body .hero__logo { margin-top: -42px; border: 3px solid var(--surface); background: var(--surface); }

.hero__name {
  font-family: "Noto Serif Thai", Georgia, serif;
  font-weight: 500; font-size: 26px; line-height: 1.25; letter-spacing: -0.01em;
}
.hero__tagline { color: var(--muted); font-size: 13.5px; margin-top: 5px; }
.hero__tagline:empty { display: none; }

.lang {
  position: absolute; top: 12px; right: 12px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.status { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.status__dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--faint); margin-right: 6px; vertical-align: 1px;
}
.status.is-open .status__dot { background: #3faa62; }
.status__note { color: var(--faint); }

.contact { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.contact a {
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); text-decoration: none; font-size: 13px; font-weight: 500;
}
.contact a:active { background: var(--bg); }

/* ============ sticky tabs ============ */
.tabs {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.tabs__inner {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  padding: 9px 14px; max-width: 560px; margin: 0 auto;
}
.tabs__inner::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 6px 13px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500; color: var(--muted); white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab.is-active { background: var(--accent); color: var(--on-accent); }

/* ============ menu ============ */
.cat { padding: 26px 20px 4px; }
.cat__head { margin-bottom: 14px; }
.cat__name {
  font-family: "Noto Serif Thai", Georgia, serif;
  font-weight: 500; font-size: 19px; letter-spacing: -0.01em;
}
.cat__note { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.cat.is-pinned .cat__name::before {
  content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--hot); vertical-align: 4px; margin-right: 7px;
}

.item {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.cat__list > .item:first-child { border-top: 0; padding-top: 0; }
.item.is-out { opacity: .45; }

.item__no {
  flex: 0 0 auto; min-width: 22px; padding-top: 1px;
  font-size: 12.5px; font-variant-numeric: tabular-nums;
  color: var(--faint); font-weight: 500;
}
.item__main { flex: 1 1 auto; min-width: 0; }

.item__name { font-size: 15.5px; font-weight: 600; line-height: 1.35; }
.item__alt  { font-size: 12.5px; color: var(--faint); line-height: 1.35; margin-top: 1px; }
.item__desc { font-size: 13px; color: var(--muted); margin-top: 4px; }

.badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.badge {
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 7px; border-radius: 4px;
  border: 1px solid var(--line); color: var(--muted); background: var(--surface);
}
.badge--best, .badge--rec { border-color: var(--accent); color: var(--accent); }
.badge--spicy { border-color: var(--hot); color: var(--hot); }
.badge--out { border-color: var(--sold); color: var(--sold); background: transparent; }

.prices { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 7px; align-items: baseline; }
.price { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.price__label { font-size: 12px; font-weight: 400; color: var(--muted); margin-right: 4px; }
.price--was { font-size: 12.5px; font-weight: 400; color: var(--faint); text-decoration: line-through; }

.item__side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.item__img {
  width: 84px; height: 84px; object-fit: cover; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line);
}
.add {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 17px; line-height: 1; color: var(--muted);
  display: grid; place-items: center;
}
.add.is-on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.add__n { font-size: 13px; font-weight: 600; }

/* ============ footer ============ */
.foot { padding: 32px 20px 40px; border-top: 1px solid var(--line); margin-top: 28px; }
.hours { font-size: 13px; }
.hours__row { display: flex; justify-content: space-between; padding: 3px 0; color: var(--muted); }
.hours__row.is-today { color: var(--text); font-weight: 600; }
.hours__row span:last-child { font-variant-numeric: tabular-nums; }
.hours__note { color: var(--faint); font-size: 12.5px; margin-top: 6px; }

.wifi {
  margin-top: 18px; padding: 11px 13px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px;
}
.wifi b { font-weight: 600; }
.wifi span { color: var(--muted); }

.foot__note    { font-size: 12.5px; color: var(--muted); margin-top: 18px; }
.foot__updated { font-size: 11.5px; color: var(--faint); margin-top: 5px; }

.spacer { height: 76px; }

/* ============ pick bar ============ */
.pickbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 40; max-width: 536px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: 12px;
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 6px 24px rgba(0,0,0,.22);
  animation: rise .22s ease-out;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0 } }
.pickbar__count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--on-accent); color: var(--accent);
  font-size: 12.5px; font-weight: 600; display: grid; place-items: center;
}
.pickbar__label { flex: 1; text-align: left; font-size: 14.5px; font-weight: 500; }
.pickbar__total { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============ sheet ============ */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet__scrim { position: absolute; inset: 0; background: rgba(0,0,0,.42); animation: fade .2s; }
@keyframes fade { from { opacity: 0 } }
.sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  background: var(--bg); border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  max-height: 84vh; display: flex; flex-direction: column;
  animation: up .24s cubic-bezier(.2,.8,.3,1);
}
@keyframes up { from { transform: translateY(100%) } }
.sheet__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--line);
}
.sheet__head h2 { font-family: "Noto Serif Thai", Georgia, serif; font-weight: 500; font-size: 17px; }
.sheet__x { font-size: 15px; color: var(--muted); padding: 4px 6px; }
.sheet__body { overflow-y: auto; padding: 6px 18px; -webkit-overflow-scrolling: touch; }

.line { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.line:first-child { border-top: 0; }
.line__main { flex: 1; min-width: 0; }
.line__name { font-size: 14.5px; font-weight: 600; }
.line__meta { font-size: 12px; color: var(--muted); }
.line__sum  { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 54px; text-align: right; }
.qty { display: flex; align-items: center; gap: 3px; }
.qty button {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; line-height: 1; display: grid; place-items: center;
}
.qty span { min-width: 22px; text-align: center; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

.opt {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 14px 0; border-top: 1px solid var(--line); font-size: 15px; text-align: left;
}
.opt:first-child { border-top: 0; }
.opt b { font-weight: 600; font-variant-numeric: tabular-nums; }

.sheet__foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-top: 1px solid var(--line);
  font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.sheet__clear { font-size: 13px; font-weight: 400; color: var(--muted); text-decoration: underline; }
.sheet__hint { padding: 0 18px 16px; font-size: 12px; color: var(--faint); text-align: center; }

/* ============ lightbox ============ */
.lightbox {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.9);
  display: grid; place-items: center; padding: 18px; animation: fade .2s;
}
.lightbox img { max-height: 88vh; border-radius: 8px; }

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

/* ============ print — ร้านสั่งพิมพ์เมนูกระดาษจากหน้าเดียวกันได้ ============ */
@media print {
  .tabs, .lang, .contact, .pickbar, .sheet, .lightbox, .add, .spacer, .status { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  #app { max-width: none; }
  .hero__cover { height: 120px; }
  .cat { padding: 14px 0 0; break-inside: auto; }
  .item { break-inside: avoid; padding: 8px 0; }
  .item__img { width: 60px; height: 60px; }
  .item.is-out { opacity: 1; }
  .item.is-out .item__name { text-decoration: line-through; }
  .foot { break-before: avoid; }
}
