/* =============================================================
   ลานหอม (ตัวอย่างงานออกแบบ) — style.css
   ชุดสี/ฟอนต์/โทเคน อ้างอิงจาก design spec "Warm Table"
   (output/showcase/restaurant/design-spec.md) ข้อ 3, 4, 6
   เขียนแบบ mobile-first — ใช้ @media (min-width) เท่านั้น
   ============================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  /* Brand */
  --color-primary:        #B03A1E;
  --color-primary-hover:  #8E2E17;
  --color-secondary:      #2F4B3F;
  --color-accent:         #E8A33D;

  /* Neutral / Surface */
  --color-bg:             #FFFBF5;
  --color-surface:        #FFFFFF;
  --color-surface-alt:    #F6EFE6;
  --color-border:         #E7DCCF;
  --color-border-strong:  #8C7461;

  /* Text */
  --color-text:           #2A211C;
  --color-text-muted:     #6B5B50;
  --color-text-on-dark:   #F5EDE3;

  /* Status */
  --color-open:           #1F7A4D;
  --color-closed:         #B03A1E;

  /* Placeholder */
  --ph-bg:                #F1E5D6;
  --ph-art:               #C9B49B;
  --ph-label:             #8C7461;

  /* Spacing */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px;

  /* Radius */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;

  /* Shadow */
  --sh-1: 0 1px 2px rgba(42,33,28,.06);
  --sh-2: 0 2px 8px rgba(42,33,28,.08);
  --sh-3: 0 8px 24px rgba(42,33,28,.12);

  /* Layout */
  --container: 1200px;
  --measure: 34rem;
  --pad-x: 20px;
  --section-y: 48px;
  --header-h: 56px;
  --bottombar-h: 64px;

  /* Type */
  --font-display: 'Trirong', Georgia, serif;
  --font-body: 'IBM Plex Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --fs-h1: 2rem;        --lh-h1: 1.25;
  --fs-h2: 1.625rem;    --lh-h2: 1.3;
  --fs-h3: 1.1875rem;   --lh-h3: 1.35;
  --fs-h4: 1.0625rem;
  --fs-body: 1.0625rem; --lh-body: 1.75;
  --fs-body-sm: 0.9375rem;
  --fs-caption: 0.8125rem;
  --fs-price: 1.125rem;
  --fs-btn: 1.0625rem;
  --fs-badge: 0.75rem;
}

:root[data-theme="dark"] {
  --color-primary:        #E8724A;
  --color-primary-hover:  #F08A66;
  --color-secondary:      #3E6354;
  --color-accent:         #E8A33D;
  --color-bg:             #16120F;
  --color-surface:        #211B16;
  --color-surface-alt:    #2B231D;
  --color-border:         #3A3029;
  --color-border-strong:  #6E5D4F;
  --color-text:           #F5EDE3;
  --color-text-muted:     #C0B0A0;
  --color-text-on-dark:   #F5EDE3;
  --color-open:           #4FBE85;
  --color-closed:         #E8724A;
  --ph-bg:                #2B231D;
  --ph-art:               #4E4136;
  --ph-label:             #9A8877;
  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 2px 8px rgba(0,0,0,.45);
  --sh-3: 0 8px 24px rgba(0,0,0,.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary:        #E8724A;
    --color-primary-hover:  #F08A66;
    --color-secondary:      #3E6354;
    --color-bg:             #16120F;
    --color-surface:        #211B16;
    --color-surface-alt:    #2B231D;
    --color-border:         #3A3029;
    --color-border-strong:  #6E5D4F;
    --color-text:           #F5EDE3;
    --color-text-muted:     #C0B0A0;
    --color-open:           #4FBE85;
    --color-closed:         #E8724A;
    --ph-bg:                #2B231D;
    --ph-art:               #4E4136;
    --ph-label:             #9A8877;
    --sh-1: 0 1px 2px rgba(0,0,0,.4);
    --sh-2: 0 2px 8px rgba(0,0,0,.45);
    --sh-3: 0 8px 24px rgba(0,0,0,.55);
  }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  word-break: normal;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--bottombar-h); /* กันแถบล่างทับเนื้อหา */
}
body.is-locked { overflow: hidden; }

h1, h2, h3, h4 { margin: 0 0 var(--sp-3); font-weight: 600; letter-spacing: 0; }
h1 { font-family: var(--font-display); font-size: var(--fs-h1); line-height: var(--lh-h1); }
h2 { font-family: var(--font-display); font-size: var(--fs-h2); line-height: var(--lh-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); }
h4 { font-size: var(--fs-h4); line-height: 1.4; }
p { margin: 0 0 var(--sp-4); }
img, svg { max-width: 100%; }
ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.25em; }

a { color: var(--color-primary); text-underline-offset: 3px; }
a:hover { color: var(--color-primary-hover); }

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}
.measure { max-width: var(--measure); }
.muted { color: var(--color-text-muted); }
.tnum { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--sp-4); top: -100px; z-index: 100;
  background: var(--color-primary); color: #fff; padding: 12px 20px;
  border-radius: var(--r-sm); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 8px; color: #fff; }

.section { padding-block: var(--section-y); }
.section--alt { background: var(--color-surface-alt); }
.section__head { margin-bottom: var(--sp-5); }
.section__head p { margin: 0; color: var(--color-text-muted); font-size: var(--fs-body-sm); }
.section__head .row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap;
}

/* ---------- 3. แถบแจ้งว่าเป็นตัวอย่าง ---------- */
.demo-banner {
  background: var(--color-secondary);
  color: var(--color-text-on-dark);
  font-size: var(--fs-caption);
  line-height: 1.6;
  padding: 10px var(--pad-x);
  text-align: center;
}
.demo-banner strong { font-weight: 600; }
.demo-banner span { display: block; opacity: .88; }
@media (min-width: 768px) {
  .demo-banner span { display: inline; margin-left: 8px; }
}

/* ---------- 4. Header ---------- */
.header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow .2s ease;
}
.header.is-scrolled { box-shadow: var(--sh-1); }
.header__inner {
  height: 100%;
  display: flex; align-items: center; gap: var(--sp-2);
  max-width: var(--container); margin-inline: auto; padding-inline: var(--pad-x);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 600;
  color: var(--color-text); text-decoration: none; margin-right: auto;
}
.brand__mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--color-primary); color: #fff;
  display: grid; place-items: center; font-size: .95rem; font-family: var(--font-body);
}
.brand small { display: block; font-size: 10px; font-family: var(--font-body); font-weight: 400; color: var(--color-text-muted); line-height: 1; }

.nav-desktop { display: none; }
@media (min-width: 900px) {
  :root { --header-h: 72px; --pad-x: 32px; }
  .nav-desktop { display: flex; align-items: center; gap: var(--sp-5); margin-right: var(--sp-5); }
  .nav-desktop a {
    color: var(--color-text); text-decoration: none; font-size: 1rem; font-weight: 500;
    padding: 8px 2px; border-bottom: 2px solid transparent;
  }
  .nav-desktop a:hover { border-bottom-color: var(--color-primary); }
  .nav-desktop a[aria-current="page"] { border-bottom-color: var(--color-primary); font-weight: 600; }
  .icon-btn--menu { display: none; }
}
@media (min-width: 1200px) { :root { --pad-x: 48px; } }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  background: transparent; border: 0; border-radius: var(--r-sm);
  color: var(--color-text); cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--color-surface-alt); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cart-count {
  position: absolute; top: 3px; right: 2px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--color-primary); color: #fff;
  font-size: 11px; font-weight: 600; line-height: 20px; text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- 5. Drawer (เมนูมือถือ) ---------- */
.drawer { position: fixed; inset: 0; z-index: 60; background: rgba(22,18,15,.55); }
.drawer__panel {
  position: absolute; inset: 0;
  background: var(--color-bg); color: var(--color-text);
  display: flex; flex-direction: column;
  padding: var(--sp-4) var(--pad-x) calc(var(--sp-8) + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.drawer__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.drawer__nav { list-style: none; margin: 0 0 var(--sp-6); padding: 0; }
.drawer__nav a {
  display: flex; align-items: center; min-height: 56px;
  font-size: 1.25rem; font-weight: 500; color: var(--color-text); text-decoration: none;
  border-bottom: 1px solid var(--color-border);
}
.drawer__foot { margin-top: auto; font-size: var(--fs-body-sm); color: var(--color-text-muted); }
.drawer__foot p { margin-bottom: var(--sp-2); }

/* ---------- 6. แถบล่างติดหน้าจอ (มือถือ) ---------- */
.bottombar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--bottombar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 12px rgba(42,33,28,.10);
}
.bottombar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--color-text); text-decoration: none;
  font-size: 12px; font-weight: 600; line-height: 1; position: relative;
}
.bottombar svg { width: 22px; height: 22px; fill: none; stroke: var(--color-primary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottombar a[aria-current="page"] { color: var(--color-primary); }
.bottombar .cart-count { top: 6px; right: 50%; margin-right: -22px; }
@media (min-width: 900px) {
  .bottombar { display: none; }
  body { padding-bottom: 0; }
}

/* ---------- 7. ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 24px;
  border-radius: var(--r-md); border: 1.5px solid transparent;
  font-family: var(--font-body); font-size: var(--fs-btn); font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, transform .1s ease;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-hover); color: #fff; }
.btn--secondary { background: transparent; border-color: var(--color-primary); color: var(--color-primary); }
.btn--secondary:hover { background: var(--color-surface-alt); color: var(--color-primary); }
.btn--ghost { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-text); }
.btn--ghost:hover { background: var(--color-surface-alt); color: var(--color-text); }
.btn--sm { min-height: 44px; padding: 0 16px; font-size: var(--fs-body-sm); }
.btn--block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}
.btn-row { display: flex; flex-direction: column; gap: var(--sp-3); }
@media (min-width: 600px) { .btn-row { flex-direction: row; flex-wrap: wrap; } .btn-row .btn { flex: 1 1 auto; } }

/* ---------- 8. Badge / pill ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: var(--fs-badge); font-weight: 600; line-height: 1;
  background: var(--color-surface-alt); color: var(--color-text);
}
.badge--hot { background: var(--color-accent); color: #2A211C; }
.badge--new { background: var(--color-secondary); color: #fff; }
.badge--spicy { background: #F6E3DD; color: #8E2E17; }
:root[data-theme="dark"] .badge--spicy { background: #3A241D; color: #F0A98F; }
.badge--out { background: var(--color-text-muted); color: var(--color-bg); }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- 9. Placeholder รูป ---------- */
.ph { display: block; width: 100%; height: auto; background: var(--ph-bg); }
.ph-bg { fill: var(--ph-bg); }
.ph-art { fill: var(--ph-art); }
.ph-art .ph-stroke { stroke: var(--ph-bg); fill: none; }
.ph-art .ph-stroke-fill { fill: var(--ph-bg); }
.ph-label { fill: var(--ph-label); font-family: var(--font-body); font-size: 7px; }
.ph-frame { border-radius: var(--r-md); overflow: hidden; background: var(--ph-bg); }

/* ---------- 10. Hero ---------- */
.hero { position: relative; background: var(--color-surface-alt); overflow: hidden; }
.hero__media { position: absolute; inset: 0; }
.hero__media .ph { width: 100%; height: 100%; object-fit: cover; }
.hero__scrim {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(22,18,15,.82) 0%, rgba(22,18,15,.45) 45%, rgba(22,18,15,.25) 100%);
}
.hero__inner {
  position: relative;
  min-height: 74svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding-block: var(--sp-8) var(--sp-6);
  color: #fff;
}
.hero__inner h1 { color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.5); margin-bottom: var(--sp-2); }
.hero__inner p { color: #F5EDE3; max-width: 30rem; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.hero .btn--secondary { border-color: #fff; color: #fff; background: rgba(22,18,15,.35); }
.hero .btn--secondary:hover { background: rgba(22,18,15,.55); color: #fff; }
.pill-status {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 14px; margin-bottom: var(--sp-3);
  border-radius: var(--r-pill);
  background: rgba(255,251,245,.94); color: #2A211C;
  font-size: var(--fs-caption); font-weight: 600; width: fit-content;
}
.pill-status::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: #1F7A4D;
}
@media (min-width: 1024px) {
  .hero__inner { min-height: 560px; justify-content: center; padding-block: var(--sp-20); }
  .hero__scrim { background: linear-gradient(to right, rgba(22,18,15,.85) 0%, rgba(22,18,15,.5) 55%, rgba(22,18,15,.2) 100%); }
}

/* ---------- 11. Grid หมวดหมู่ ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
@media (min-width: 768px) { .cat-grid { grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); } }
@media (min-width: 1024px) { .cat-grid { grid-template-columns: repeat(6, 1fr); } }
.cat-card {
  display: block; text-decoration: none; color: var(--color-text);
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--r-md); overflow: hidden; box-shadow: var(--sh-1);
}
.cat-card:hover { color: var(--color-text); box-shadow: var(--sh-2); }
.cat-card__body { padding: var(--sp-3); }
.cat-card__body strong { display: block; font-size: var(--fs-body-sm); font-weight: 600; line-height: 1.4; }
.cat-card__body span { font-size: var(--fs-caption); color: var(--color-text-muted); }

/* ---------- 12. การ์ดสินค้า ---------- */
/* มือถือ: แถวแนวนอน (สแกนเร็ว ตาม spec 6.2) */
.prod-list { display: flex; flex-direction: column; gap: var(--sp-3); list-style: none; margin: 0; padding: 0; }
.prod-card {
  position: relative;
  display: flex; gap: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: 14px;
  box-shadow: var(--sh-1); padding: 14px;
}
.prod-card.is-out { opacity: .62; }
.prod-card__media { width: 96px; flex: none; border-radius: 10px; overflow: hidden; position: relative; background: var(--ph-bg); }
.prod-card__media .ph { aspect-ratio: 1 / 1; height: 100%; object-fit: cover; }
.prod-card__out {
  position: absolute; inset: auto 0 0 0; padding: 3px 0;
  background: rgba(42,33,28,.82); color: #fff;
  font-size: 11px; font-weight: 600; text-align: center;
}
.prod-card__body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.prod-card__title { margin: 0 0 2px; font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 600; }
.prod-card__title a { color: var(--color-text); text-decoration: none; }
.prod-card__title a:hover { color: var(--color-primary); text-decoration: underline; }
.prod-card__title a::after { content: ''; position: absolute; inset: 0; } /* ทั้งการ์ดกดได้ */
.prod-card__desc {
  margin: 0 0 var(--sp-2); font-size: var(--fs-body-sm); line-height: 1.7; color: var(--color-text-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden;
}
.prod-card__foot { margin-top: auto; display: flex; align-items: center; gap: var(--sp-3); }
.price {
  font-size: var(--fs-price); font-weight: 600; color: var(--color-primary);
  font-variant-numeric: tabular-nums; line-height: 1.3;
}
.price--lg { font-size: 1.75rem; }
.price small { font-size: var(--fs-caption); font-weight: 400; color: var(--color-text-muted); }
.prod-card .badge-row { margin-bottom: 6px; }
.prod-card__add {
  position: relative; z-index: 1; margin-left: auto;
  width: 44px; height: 44px; flex: none; border-radius: var(--r-sm);
  border: 1.5px solid var(--color-primary); background: var(--color-primary); color: #fff;
  display: grid; place-items: center; cursor: pointer;
}
.prod-card__add:hover { background: var(--color-primary-hover); }
.prod-card__add svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.prod-card__add[disabled] { background: transparent; color: var(--color-text-muted); border-color: var(--color-border-strong); cursor: not-allowed; }

/* แท็บเล็ต/เดสก์ท็อป: การ์ดแนวตั้งใน grid */
@media (min-width: 768px) {
  .prod-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
  .prod-card { flex-direction: column; gap: var(--sp-3); padding: 0; overflow: hidden; }
  .prod-card__media { width: 100%; border-radius: 0; }
  .prod-card__media .ph { aspect-ratio: 4 / 3; }
  .prod-card__body { padding: 0 var(--sp-4) var(--sp-4); }
  .prod-card__title { font-size: 1.25rem; }
  .prod-card:hover { transform: translateY(-3px); box-shadow: var(--sh-3); transition: transform .2s ease, box-shadow .2s ease; }
}
@media (min-width: 1024px) { .prod-list { grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); } }
@media (prefers-reduced-motion: reduce) { .prod-card:hover { transform: none; } }

/* แถวเลื่อนแนวนอนบนหน้าแรก */
.scroller {
  display: grid; grid-auto-flow: column; grid-auto-columns: 78%;
  gap: var(--sp-3); overflow-x: auto; scroll-snap-type: x proximity;
  padding-bottom: var(--sp-2); margin-inline: calc(var(--pad-x) * -1); padding-inline: var(--pad-x);
  scrollbar-width: none; list-style: none; margin-block: 0;
}
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { scroll-snap-align: start; }
.scroller .prod-card { flex-direction: column; gap: var(--sp-3); padding: 0; overflow: hidden; height: 100%; }
.scroller .prod-card__media { width: 100%; border-radius: 0; }
.scroller .prod-card__media .ph { aspect-ratio: 4 / 3; }
.scroller .prod-card__body { padding: 0 var(--sp-4) var(--sp-4); }
@media (min-width: 768px) { .scroller { grid-auto-columns: 42%; } }
@media (min-width: 1024px) {
  .scroller {
    grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); overflow: visible;
    margin-inline: 0; padding-inline: 0; gap: var(--sp-6);
  }
}

/* ---------- 13. Toolbar + ฟิลเตอร์ ---------- */
.toolbar { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.search-field { position: relative; }
.search-field svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; fill: none; stroke: var(--color-border-strong); stroke-width: 1.8; pointer-events: none;
}
.search-field input { padding-left: 44px; }
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; background: transparent; color: var(--color-text-muted);
  border-radius: var(--r-sm); cursor: pointer; font-size: 1.1rem;
}
@media (min-width: 768px) {
  .toolbar { flex-direction: row; align-items: flex-end; }
  .toolbar .search-field { flex: 1; }
  .toolbar .field { width: 260px; }
}

.filterbar {
  position: sticky; top: var(--header-h); z-index: 30;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  margin-inline: calc(var(--pad-x) * -1);
  padding: 8px 0;
}
.filterbar__scroll {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding-inline: var(--pad-x); scroll-snap-type: x proximity;
}
.filterbar__scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 40px; padding: 0 16px; border-radius: var(--r-pill);
  background: var(--color-surface-alt); color: var(--color-text);
  border: 1px solid var(--color-border);
  font-family: var(--font-body); font-size: var(--fs-body-sm); font-weight: 500;
  white-space: nowrap; cursor: pointer; scroll-snap-align: start;
}
.chip:hover { border-color: var(--color-border-strong); }
.chip[aria-selected="true"] { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.chip span { font-size: var(--fs-caption); opacity: .8; }

.result-line {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  margin: var(--sp-4) 0; font-size: var(--fs-body-sm); color: var(--color-text-muted);
}

/* ---------- 14. ฟอร์ม ---------- */
.field { display: block; margin-bottom: var(--sp-5); }
.field > label, .fieldset__legend {
  display: block; font-size: var(--fs-body-sm); font-weight: 500; margin-bottom: 6px; color: var(--color-text);
}
.field .hint { display: block; font-size: var(--fs-caption); color: var(--color-text-muted); margin-top: 4px; }
.req { color: var(--color-primary); }
input[type="text"], input[type="tel"], input[type="email"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; min-height: 52px; padding: 12px 16px;
  font-family: var(--font-body); font-size: 1rem; line-height: 1.6;
  color: var(--color-text); background: var(--color-surface);
  border: 1.5px solid var(--color-border-strong); border-radius: 10px;
  appearance: none;
}
textarea { min-height: 120px; resize: vertical; }
select {
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
  padding-right: 42px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(176,58,30,.25); outline-offset: 0; border-color: var(--color-primary);
}
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--color-primary); border-width: 2px; }
.field__error { display: none; margin-top: 6px; font-size: var(--fs-caption); color: var(--color-primary); font-weight: 500; }
.field__error.is-shown { display: block; }
.grid-2 { display: grid; gap: 0 var(--sp-4); }
@media (min-width: 600px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

fieldset { border: 0; margin: 0 0 var(--sp-5); padding: 0; }
.fieldset__legend { padding: 0; }
.choice-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.choice {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: 14px 16px; border: 1.5px solid var(--color-border); border-radius: var(--r-md);
  background: var(--color-surface); cursor: pointer;
}
.choice:hover { border-color: var(--color-border-strong); }
.choice input { margin: 2px 0 0; width: 20px; height: 20px; flex: none; accent-color: var(--color-primary); }
.choice__text { flex: 1; min-width: 0; }
.choice__text strong { display: block; font-weight: 600; font-size: 1rem; }
.choice__text small { display: block; font-size: var(--fs-caption); color: var(--color-text-muted); line-height: 1.6; }
.choice__price { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.choice:has(input:checked) { border-color: var(--color-primary); background: var(--color-surface-alt); }
.choice:has(input:focus-visible) { outline: 3px solid var(--color-primary); outline-offset: 2px; }
.choice.is-disabled { opacity: .55; cursor: not-allowed; }
label.check { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: var(--fs-body-sm); line-height: 1.7; }
label.check input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--color-primary); }

/* ตัวเลือกสินค้าแบบ pill */
.opt-list { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1.5px solid var(--color-border); background: var(--color-surface);
  font-size: var(--fs-body-sm); font-weight: 500; cursor: pointer;
}
.opt input { position: absolute; opacity: 0; width: 100%; height: 100%; left: 0; top: 0; margin: 0; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--color-primary); background: var(--color-primary); color: #fff; }
.opt:has(input:focus-visible) { outline: 3px solid var(--color-primary); outline-offset: 2px; }
.opt.is-out { opacity: .5; cursor: not-allowed; text-decoration: line-through; }
.opt__delta { font-variant-numeric: tabular-nums; font-size: var(--fs-caption); }

/* ---------- 15. Stepper จำนวน ---------- */
.stepper {
  display: inline-flex; align-items: center;
  border: 1.5px solid var(--color-border-strong); border-radius: var(--r-pill);
  background: var(--color-surface); overflow: hidden;
}
.stepper button {
  width: 44px; height: 44px; border: 0; background: transparent; color: var(--color-text);
  font-size: 1.25rem; line-height: 1; cursor: pointer;
}
.stepper button:hover:not([disabled]) { background: var(--color-surface-alt); }
.stepper button[disabled] { opacity: .35; cursor: not-allowed; }
.stepper input {
  width: 48px; min-height: 44px; padding: 0; text-align: center;
  border: 0; border-inline: 1px solid var(--color-border); border-radius: 0;
  font-variant-numeric: tabular-nums; font-weight: 600; background: transparent;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- 16. Alert / toast ---------- */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r-md);
  font-size: var(--fs-body-sm); line-height: 1.7;
  border: 1px solid var(--color-border); background: var(--color-surface-alt);
  margin-bottom: var(--sp-3);
}
.alert p { margin: 0; }
.alert--warn { border-color: var(--color-primary); background: rgba(176,58,30,.08); color: var(--color-text); }
.alert--error { border-color: var(--color-primary); background: rgba(176,58,30,.12); color: var(--color-text); font-weight: 500; }
.alert--ok { border-color: var(--color-open); background: rgba(31,122,77,.10); }
.alert--info { border-color: var(--color-border-strong); }
.alert__title { font-weight: 600; display: block; margin-bottom: 2px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--bottombar-h) + 16px); z-index: 70;
  transform: translate(-50%, 20px);
  display: flex; align-items: center; gap: 10px;
  max-width: min(92vw, 460px); padding: 12px 18px;
  background: var(--color-text); color: var(--color-bg);
  border-radius: var(--r-pill); box-shadow: var(--sh-3);
  font-size: var(--fs-body-sm); font-weight: 500; line-height: 1.5;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: var(--color-primary); color: #fff; }
.toast__icon {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700;
  background: rgba(255,255,255,.22);
}
@media (min-width: 900px) { .toast { bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- 17. หน้าสินค้า (รายละเอียด) ---------- */
.breadcrumb { font-size: var(--fs-caption); color: var(--color-text-muted); margin: var(--sp-4) 0; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb li + li::before { content: '›'; margin-right: 6px; color: var(--color-border-strong); }

.pdp { display: grid; gap: var(--sp-6); }
@media (min-width: 900px) { .pdp { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-12); align-items: start; } }
.pdp__gallery { display: grid; gap: var(--sp-2); }
.pdp__thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.pdp__thumbs .ph-frame { border: 1px solid var(--color-border); }
.pdp__buy { position: sticky; top: calc(var(--header-h) + 16px); }
.stock-line { display: flex; align-items: center; gap: 8px; font-size: var(--fs-body-sm); font-weight: 500; margin-bottom: var(--sp-4); }
.stock-line::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--color-open); flex: none; }
.stock-line.is-low { color: var(--color-primary); }
.stock-line.is-low::before { background: var(--color-accent); }
.stock-line.is-out { color: var(--color-text-muted); }
.stock-line.is-out::before { background: var(--color-text-muted); }
.buy-row { display: flex; gap: var(--sp-3); align-items: center; margin-bottom: var(--sp-4); flex-wrap: wrap; }
.buy-row .btn { flex: 1 1 200px; }
.spec-table { width: 100%; border-collapse: collapse; font-size: var(--fs-body-sm); }
.spec-table th, .spec-table td { text-align: left; padding: 10px 0; border-bottom: 1px solid var(--color-border); vertical-align: top; }
.spec-table th { width: 40%; font-weight: 500; color: var(--color-text-muted); }

/* ---------- 18. ตะกร้า / สรุปยอด ---------- */
.cart-layout { display: grid; gap: var(--sp-6); }
@media (min-width: 1024px) { .cart-layout { grid-template-columns: minmax(0, 1fr) 380px; gap: var(--sp-8); align-items: start; } }

.cart-line {
  display: flex; gap: var(--sp-3); padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--color-border);
}
.cart-line__media { width: 84px; flex: none; }
.cart-line__body { flex: 1; min-width: 0; }
.cart-line__title { font-size: var(--fs-h4); font-weight: 600; margin: 0 0 2px; }
.cart-line__title a { color: var(--color-text); text-decoration: none; }
.cart-line__opts { font-size: var(--fs-caption); color: var(--color-text-muted); line-height: 1.7; margin: 0 0 var(--sp-2); }
.cart-line__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.cart-line__price { font-weight: 600; font-variant-numeric: tabular-nums; }
.link-btn {
  background: none; border: 0; padding: 8px 4px; min-height: 44px;
  color: var(--color-primary); font-family: var(--font-body); font-size: var(--fs-body-sm);
  font-weight: 500; text-decoration: underline; cursor: pointer;
}

.panel {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--sh-1);
}
.panel + .panel { margin-top: var(--sp-4); }
.panel h2, .panel h3 { font-family: var(--font-body); font-size: var(--fs-h4); margin-bottom: var(--sp-4); }
@media (min-width: 1024px) { .cart-layout__side { position: sticky; top: calc(var(--header-h) + 16px); } }

.sum-row {
  display: flex; justify-content: space-between; gap: var(--sp-3);
  font-size: var(--fs-body-sm); padding: 6px 0;
}
.sum-row span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum-row--free span:last-child { color: var(--color-open); font-weight: 600; }
.sum-row--discount span:last-child { color: var(--color-open); font-weight: 600; }
.sum-total {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3);
  margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--color-border);
  font-size: var(--fs-h4); font-weight: 600;
}
.sum-total strong { font-size: 1.5rem; color: var(--color-primary); font-variant-numeric: tabular-nums; }
.sum-note { font-size: var(--fs-caption); color: var(--color-text-muted); margin-top: 4px; }

.coupon-row { display: flex; gap: var(--sp-2); }
.coupon-row input { text-transform: uppercase; }
.coupon-row .btn { flex: none; }
.coupon-applied {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 10px 14px; border-radius: var(--r-md);
  background: rgba(31,122,77,.10); border: 1px solid var(--color-open);
  font-size: var(--fs-body-sm);
}
.coupon-hints { margin: var(--sp-3) 0 0; padding: 0; list-style: none; font-size: var(--fs-caption); color: var(--color-text-muted); }
.coupon-hints li { padding: 3px 0; }
.coupon-hints code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  background: var(--color-surface-alt); padding: 2px 6px; border-radius: 4px; color: var(--color-text);
}

.empty-state { text-align: center; padding: var(--sp-12) var(--sp-4); }
.empty-state svg { width: 64px; height: 64px; margin-bottom: var(--sp-4); fill: none; stroke: var(--color-border-strong); stroke-width: 1.5; }

/* ---------- 19. Steps (checkout) ---------- */
.steps { display: flex; gap: var(--sp-2); list-style: none; margin: 0 0 var(--sp-6); padding: 0; font-size: var(--fs-caption); }
.steps li { display: flex; align-items: center; gap: 6px; color: var(--color-text-muted); }
.steps li + li::before { content: '›'; margin-right: 6px; }
.steps li[aria-current] { color: var(--color-primary); font-weight: 600; }
.steps b {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--color-surface-alt); font-size: 11px; font-weight: 600;
}
.steps li[aria-current] b { background: var(--color-primary); color: #fff; }

/* ---------- 20. หน้ายืนยันคำสั่งซื้อ ---------- */
.success-head { text-align: center; padding: var(--sp-8) 0 var(--sp-6); }
.success-mark {
  width: 68px; height: 68px; margin: 0 auto var(--sp-4); border-radius: 50%;
  background: var(--color-open); color: #fff; display: grid; place-items: center; font-size: 2rem;
}
.order-no {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 1.375rem; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--color-surface-alt); border: 1px dashed var(--color-border-strong);
  padding: 10px 18px; border-radius: var(--r-md);
}
.bank-box { display: grid; gap: var(--sp-3); }
.bank-row { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-body-sm); }
.bank-row strong { font-variant-numeric: tabular-nums; text-align: right; }
.dropzone {
  border: 2px dashed var(--color-border-strong); border-radius: var(--r-md);
  padding: var(--sp-6) var(--sp-4); text-align: center; background: var(--color-surface-alt);
}
.dropzone p { margin: 0 0 var(--sp-3); font-size: var(--fs-body-sm); color: var(--color-text-muted); }
.slip-preview { margin-top: var(--sp-3); font-size: var(--fs-body-sm); }
.copy-box {
  white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.75; background: var(--color-surface-alt);
  border: 1px solid var(--color-border); border-radius: var(--r-md);
  padding: var(--sp-4); max-height: 260px; overflow: auto; margin-bottom: var(--sp-3);
}

/* ---------- 21. Footer ---------- */
.footer {
  background: var(--color-secondary); color: var(--color-text-on-dark);
  padding: var(--sp-12) 0 var(--sp-8); margin-top: var(--section-y);
}
.footer a { color: var(--color-text-on-dark); }
.footer h2 { font-family: var(--font-body); font-size: var(--fs-h4); margin-bottom: var(--sp-3); }
.footer__grid { display: grid; gap: var(--sp-8); }
@media (min-width: 768px) { .footer__grid { grid-template-columns: repeat(3, 1fr); } }
.footer__links { list-style: none; margin: 0; padding: 0; }
.footer__links a { display: flex; align-items: center; min-height: 40px; text-decoration: none; }
.footer__links a:hover { text-decoration: underline; }
.footer__bottom {
  margin-top: var(--sp-8); padding-top: var(--sp-5); border-top: 1px solid rgba(245,237,227,.25);
  font-size: var(--fs-caption); display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); align-items: center;
}
.footer .btn--ghost { background: transparent; border-color: rgba(245,237,227,.5); color: var(--color-text-on-dark); }
.footer .btn--ghost:hover { background: rgba(245,237,227,.12); color: var(--color-text-on-dark); }

/* ---------- 22. Desktop type scale ---------- */
@media (min-width: 1024px) {
  :root {
    --fs-h1: 3.5rem; --lh-h1: 1.15;
    --fs-h2: 2.5rem; --lh-h2: 1.25;
    --fs-h3: 1.375rem;
    --fs-body: 1.125rem; --lh-body: 1.8;
    --fs-caption: 0.875rem;
    --section-y: 96px;
  }
  .pdp h1, .page-head h1 { font-size: 2.5rem; }
}

/* ---------- 23. พิมพ์ ---------- */
@media print {
  .header, .bottombar, .footer, .demo-banner, .toast, .no-print { display: none !important; }
  body { padding: 0; background: #fff; }
}
