/* =====================================================================
   ธีม "เทศกาลเจ" — เหลืองธงเจ แดงชาด พื้นครีม
   ไฟล์นี้กำหนดหน้าตาทับ styles.css (ซึ่งเป็นโครงและการทำงาน)
   ธีมเดิม (ใบตองสีเขียว) ยังอยู่ที่ theme-baitong.css เปลี่ยนกลับได้ที่แท็ก <link> ใน index.html

   สเกลที่ใช้ทั้งเว็บ (มุมโค้งเท่ากันทุกด้าน)
     มุมโค้ง : --r-xs 6 ป้ายเล็ก · --r-sm 10 ปุ่ม/ช่อง · --r-md 14 การ์ด · --r-lg 20 แผงใหญ่
     ระยะ section : 44px มือถือ / 72px จอใหญ่
     หัวข้อ section : คำนำสีแดง → หัวข้อ → คำอธิบาย และลิงก์ "ดูทั้งหมด ›" สีแดงด้านขวา
   ===================================================================== */
:root {
  --yellow: #F6C343; --yellow-100: #FFF0C2; --yellow-50: #FFF8E1;
  --red: #C8282B; --red-700: #9E1F22; --red-50: #FDECEA;
  --ink: #2E2216; --ink-2: #6E5F50; --bg: #FFFCF5; --surface: #FFFFFF;
  --line: #EFE3CC; --line-2: #F3EBDD; --cocoa: #4A1A14;
  --green: #22743F; --green-50: #E6F4EA; --star: #E5A100; --focus: #9E1F22;
  --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-lg: 20px;
  --sh-1: 0 2px 10px rgba(110, 70, 0, .05);
  --sh-2: 0 4px 10px rgba(110, 70, 0, .06), 0 18px 36px rgba(110, 70, 0, .12);
}
body { background: var(--bg); }

/* ---------- App bar: สีเดียวกับ hero ตอนอยู่บนสุด แล้วเป็นสีครีมเมื่อเลื่อนลง ---------- */
.appbar { background: rgba(254, 217, 79, .94); border-color: transparent; box-shadow: none; }
.appbar.is-scrolled { background: rgba(255, 252, 245, .97); border-color: var(--line); box-shadow: 0 6px 20px rgba(110, 70, 0, .08); }
.brand__logo { background: var(--red); color: #FFE08A; border-radius: var(--r-sm); }
.brand__text strong { color: var(--ink); }
.brand__text small { color: #6B5320; }
.appbar .icon-btn { background: #fff; border-color: rgba(160, 110, 0, .2); border-radius: 50%; }
.appbar .icon-btn .dot { background: var(--red); }
.topnav a { color: #4A3517; border-radius: var(--r-sm); }
.topnav a.is-active { background: rgba(255, 255, 255, .8); color: var(--ink); }
.appbar.is-scrolled .topnav a.is-active { background: var(--yellow-100); }
.appbar .btn--red { background: var(--red); color: #fff; border-radius: var(--r-sm); box-shadow: 0 6px 14px rgba(200, 40, 43, .25); }

/* ---------- หัวข้อ section ---------- */
.section { margin-top: 72px; }
.section-kicker { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .5px; line-height: 1.6; color: var(--red-700); }
.section-kicker::before { content: ""; flex: none; width: 18px; height: 2px; border-radius: 2px; background: var(--red); }
.section__head { margin-bottom: 20px; }
.section__head h2 { font-size: 27px; line-height: 1.35; }
.section__note { margin-top: 4px; font-size: 14.5px; color: var(--ink-2); }
.more { height: 40px; margin-right: -6px; padding: 0 4px 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--red); font-size: 14px; font-weight: 600; }

/* ---------- หมวดหมู่: การ์ดขาว ไอคอนเส้นสีแดง ---------- */
.cats { gap: 14px; }
.cat {
  min-height: 116px; gap: 10px; padding: 18px 4px 14px; border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--sh-1); font-size: 14px; font-weight: 600; color: var(--ink);
}
.cat__icon { width: 46px; height: 46px; border-radius: 0; background: none; }
.cat__icon .ms { font-size: 38px; color: var(--red); --fill: 0; --wght: 400; --opsz: 40; }
.cat[aria-pressed="true"] { border-color: var(--red); background: var(--red-50); color: var(--red-700); }
.cat[aria-pressed="true"] .cat__icon { background: none; }
.cat[aria-pressed="true"] .cat__icon .ms { color: var(--red); --fill: 1; }

/* ---------- แผนที่ + รายชื่อร้านใกล้คุณเป็นการ์ด ---------- */
#mapSection { padding: 0; background: none; border: 0; }
.mapbox { border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.map-btn, .map-zoom { border-radius: var(--r-sm); }
.near-panel { padding: 0; background: none; border: 0; box-shadow: none; }
.near-panel__head { padding: 0 0 12px; }
.near-panel__head h3 { font-size: 19px; }
.near-list { gap: 12px; }
.row.row--compact { padding: 10px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: var(--sh-1); }
.row--compact .row__thumb { border-radius: var(--r-sm); }
.view-switch { background: #F3EAD6; border-radius: var(--r-sm); }
.view-switch button { border-radius: 8px; }
.view-switch button[aria-pressed="true"] { background: #fff; color: var(--red-700); }

/* ---------- การ์ดร้าน: รูป · ชื่อ · สถานะ+คะแนน · ที่ตั้ง · ประเภท · ระยะทาง ---------- */
.cards { gap: 18px; }
.card { border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-1); }
.card__media { aspect-ratio: 16 / 10; }
.card__media::after { background: none; }
/* การ์ดที่มีรูปจริง: ไล่เงาด้านล่าง + ป้ายจังหวัดบนรูป (สไตล์ featured image) */
.card__media--feat::after { background: linear-gradient(180deg, transparent 50%, rgba(20, 10, 0, .55) 100%); }
.card__place {
  position: absolute; left: 10px; bottom: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 3px; height: 26px; padding: 0 10px 0 6px;
  border-radius: 999px; background: var(--yellow); color: var(--red-700); font-size: 12.5px; font-weight: 700; box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.card__place .ms { font-size: 16px; }
.card__body { gap: 4px; padding: 12px 14px 14px; }
.card__title { font-size: 17px; line-height: 1.45; }
.card__status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 2px 0 2px; font-size: 13.5px; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-xs); background: #F2EEE6; color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip--open { background: var(--green-50); color: var(--green); }
.card__line { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__line .ms { font-size: 17px; color: #A8998A; }
.card__dist { margin-top: 2px; color: var(--ink); font-weight: 500; }
.card__dist .ms { color: var(--red); --fill: 1; }
.badge { height: 24px; padding: 0 10px; border-radius: var(--r-xs); font-size: 12px; }
.badge--feat { background: var(--yellow); color: var(--ink); }
.badge--new { background: var(--red); color: #fff; }
.fav { width: 36px; height: 36px; top: 8px; right: 8px; background: rgba(255, 255, 255, .96); }
.fav .ms { font-size: 20px; }
.row .fav { background: var(--yellow-50); }
.rating .ms { color: var(--star); }
.dist .ms { color: var(--red); }

/* ---------- แบนเนอร์: 3 ใบเท่ากัน ข้อความซ้าย ภาพประกอบขวา ---------- */
.banners { gap: 18px; }
.banner { min-height: 210px; padding: 24px; border: 0; border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.banner__text { position: relative; z-index: 1; max-width: 60%; }
.banner .eyebrow { display: inline-flex; padding: 3px 10px; border-radius: 999px; background: var(--b-tag-bg); color: var(--b-tag-fg); font-size: 12px; }
.banner .eyebrow::before { content: none; }
.banner h3 { margin: 10px 0 6px; font-size: 21px; line-height: 1.35; }
.banner p { font-size: 13.5px; line-height: 1.6; }
.banner__cta { height: 40px; margin-top: 14px; padding: 0 10px 0 16px; border-radius: 999px; font-size: 14px; }
.banner__art { position: absolute; z-index: 0; right: 6px; bottom: 6px; width: 46%; max-width: 200px; height: auto; }
.banner__img { width: 52%; -webkit-mask-image: linear-gradient(90deg, transparent 0, rgba(0, 0, 0, .45) 30%, #000 70%); mask-image: linear-gradient(90deg, transparent 0, rgba(0, 0, 0, .45) 30%, #000 70%); }
.banner__lanterns { position: absolute; z-index: 0; top: 0; right: 10px; width: 34%; max-width: 130px; height: auto; filter: drop-shadow(0 6px 8px rgba(80, 20, 0, .25)); }
.banner--owner { --b-bg: linear-gradient(135deg, #FFE27A, #FFC93C); --b-fg: var(--ink); --b-tag-bg: var(--red); --b-tag-fg: #fff; --b-cta-bg: var(--ink); --b-cta-fg: #fff; }
.banner--festival { --b-bg: linear-gradient(135deg, #FFF4DC, #FBE3B5); --b-fg: var(--ink); --b-tag-bg: var(--red); --b-tag-fg: #fff; --b-cta-bg: var(--ink); --b-cta-fg: #fff; }
.banner--recommend { --b-bg: linear-gradient(135deg, #D33A2C, #A81E22); --b-fg: #fff; --b-tag-bg: #FFE08A; --b-tag-fg: var(--red-700); --b-cta-bg: #FFD54F; --b-cta-fg: var(--ink); }

/* ---------- จังหวัด ---------- */
.provs { gap: 18px; }
.prov { border-radius: var(--r-md); box-shadow: var(--sh-1); }
.prov::before { background: linear-gradient(0deg, rgba(20, 10, 2, .78) 0%, rgba(20, 10, 2, .2) 45%, transparent 70%); }
.prov strong { font-size: 21px; }
.prov small { padding: 0; border-radius: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; font-size: 13px; }

/* ---------- รายการร้านเปิดใหม่ ---------- */
.list { gap: 14px 18px; }
.row { padding: 12px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-1); }
.row__thumb { width: 104px; height: 88px; border-radius: var(--r-sm); }
.row__title { font-size: 16.5px; }
.row__approved { border-radius: var(--r-xs); background: var(--green-50); color: var(--green); }

/* ---------- เจ้าของร้าน: แผงแดงเลือดหมู รูปร้านพร้อมธงเจด้านซ้าย ---------- */
.owner { border-radius: var(--r-lg); background: radial-gradient(circle at 100% 0, rgba(255, 120, 60, .25), transparent 55%), linear-gradient(120deg, #5A1414, #7A1C1C 55%, #8E2420); box-shadow: 0 18px 40px rgba(90, 20, 20, .25); }
.owner__photo { position: relative; }
.owner__photo::after { background: linear-gradient(180deg, transparent 35%, #5E1616 100%); }
.owner__deco { position: absolute; z-index: 1; top: 0; left: 6%; width: 88%; height: auto; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .3)); }
.owner .eyebrow { display: inline-flex; padding: 3px 12px; border-radius: 999px; background: var(--yellow); color: var(--red-700); }
.owner .eyebrow::before { content: none; }
.owner h2 em { color: #FFD54F; }
.step { border-radius: var(--r-md); background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .14); }
.step__num { border-radius: 50%; background: #FFD54F; color: var(--red-700); }
.owner .btn--yellow { border-radius: var(--r-sm); background: #FFD54F; color: var(--ink); }

/* ---------- Footer สีอ่อน ---------- */
.footer { background: #FFF8E8; border-top: 1px solid var(--line); }
.footer .fb-follow { border-radius: var(--r-sm); }
.footer__col a:hover { color: var(--red); }

/* ---------- ส่วนประกอบอื่น ---------- */
.tabbar { background: rgba(255, 255, 255, .97); border-color: var(--line); }
.tab.is-active { color: var(--red); }
.tab.is-active > .ms { background: var(--red-50); }
.tab__plus { background: var(--red); border-radius: var(--r-sm); box-shadow: 0 6px 14px rgba(200, 40, 43, .3); }
.clear-btn { border-radius: 999px; }
.empty { border-radius: var(--r-md); }
.toast { border-radius: var(--r-sm); }

@media (hover: hover) {
  .topnav a:hover { background: rgba(255, 255, 255, .55); color: var(--ink); }
  .appbar .btn--red:hover { background: var(--red-700); }
  .more:hover { background: var(--red-50); }
  .cat:hover { border-color: #F2C9C3; box-shadow: var(--sh-2); }
  .card:hover, .row:hover, .prov:hover, .banner:hover { box-shadow: var(--sh-2); }
  .row--compact:hover { transform: translateY(-2px); background: var(--surface); }
}

/* ---------- แท็บเล็ตขึ้นไป ---------- */
@media (min-width: 768px) {
  .banners { grid-auto-columns: 46%; }
}
/* ---------- จอคอม ---------- */
@media (min-width: 1024px) {
  .cats { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .map-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
  .mapbox { height: 520px; }
  .near-list { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
  .banners { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .banner { min-height: 220px; }
  .owner__photo { -webkit-mask-image: linear-gradient(90deg, #000 62%, transparent); mask-image: linear-gradient(90deg, #000 62%, transparent); }
  .owner h2 { font-size: 32px; }
}

/* ---------- มือถือ ---------- */
@media (max-width: 767px) {
  .section { margin-top: 44px; }
  .section-kicker { font-size: 11px; }
  .section__head { margin-bottom: 14px; }
  .section__head h2 { font-size: 22px; }
  .section__note { font-size: 13.5px; }
  .more { font-size: 13px; }
  .cats { gap: 10px 8px; }
  .cat { min-height: 96px; gap: 6px; padding: 12px 2px; font-size: 13px; }
  .cat__icon { width: 38px; height: 38px; }
  .cat__icon .ms { font-size: 32px; }
  .mapbox { height: 300px; }
  .near-list { gap: 10px; }
  .card__title { font-size: 16.5px; }
  .banner { min-height: 200px; padding: 20px; }
  .banner h3 { font-size: 20px; }
  .banner__text { max-width: 62%; }
  .provs { gap: 12px; }
  .row__thumb { width: 88px; height: 88px; }
  .owner__photo { height: 200px; }
  .owner h2 { font-size: 26px; }
}

/* =====================================================================
   แผนที่รายจังหวัด: เลือกจังหวัด → หมุดเฉพาะจังหวัด + รายชื่อร้าน (เลขตรงกับหมุด)
   มือถือ: แผนที่บน รายชื่อเลื่อนซ้ายขวาด้านล่าง · จอใหญ่: รายชื่อซ้าย แผนที่ขวา
   ===================================================================== */
.mp-pick { display: flex; gap: 8px; }
.mp-select { position: relative; flex: 1; min-width: 0; }
.mp-select > .ms { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 21px; color: var(--red); pointer-events: none; }
.mp-select .mp-select__arrow { left: auto; right: 12px; color: var(--ink-2); }
.mp-select select {
  width: 100%; height: 50px; padding: 0 40px 0 42px; appearance: none; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: #fff; font: 600 16px/1 var(--font-body); color: var(--ink); cursor: pointer;
}
.mp-select select:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.mp-near {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 50px; padding: 0 16px 0 12px; border-radius: var(--r-sm);
  background: var(--yellow); color: var(--ink); font: 700 15px/1 var(--font-head); box-shadow: 0 4px 12px rgba(200, 140, 0, .25);
}
.mp-near .ms { font-size: 20px; color: var(--red-700); }
.mp-chips { display: flex; gap: 8px; overflow-x: auto; margin: 10px calc(var(--gutter) * -1) 14px; padding: 2px var(--gutter) 4px; scrollbar-width: none; }
.mp-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 8px 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; transition: background-color .2s, color .2s, border-color .2s;
}
.mp-chip small { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; background: var(--yellow-100); color: var(--red-700); font-size: 12px; font-weight: 700; }
.mp-chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.mp-chip[aria-pressed="true"] small { background: rgba(255, 255, 255, .22); color: #fff; }

#mapSection .map-layout { display: flex; flex-direction: column; gap: 14px; }
#mapSection .mapbox { height: 320px; }
#mapSection .near-panel { display: block; }
#mapSection .near-panel__head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 0 10px; }
.mp-count { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
/* มือถือ: การ์ดร้านเลื่อนซ้ายขวา */
#mapSection .near-list {
  display: grid; grid-auto-flow: column; grid-auto-columns: 86%; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px; scrollbar-width: none;
}
.mrow {
  scroll-snap-align: center; display: flex; flex-direction: column; border: 1.5px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--sh-1); transition: border-color .2s, box-shadow .2s;
}
.mrow.is-active { border-color: var(--red); box-shadow: 0 6px 18px rgba(200, 40, 43, .16); }
.mrow__main { display: grid; grid-template-columns: 26px 64px minmax(0, 1fr); gap: 10px; align-items: center; width: 100%; padding: 10px 10px 6px; text-align: left; }
.mrow__num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; font: 700 13px/1 var(--font-head); }
.mrow__thumb { position: relative; width: 64px; height: 64px; overflow: hidden; border-radius: 12px; background: #F3EDE2; }
.mrow__thumb img { width: 100%; height: 100%; object-fit: cover; }
.mrow__thumb .ph .ms { font-size: 28px; }
.mrow__body { display: grid; gap: 1px; min-width: 0; }
.mrow__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 15px/1.45 var(--font-head); }
.mrow__meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ink-2); }
.mrow__foot { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.mrow__go { display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px; min-height: 36px; padding: 0 12px 6px; margin-left: auto; font-size: 13.5px; font-weight: 700; color: var(--red); }
.mrow__go .ms { font-size: 18px; }
.pin__num { font: 800 14px/1 var(--font-head); color: var(--red); }
.pin--closed .pin__num { color: var(--pin-closed); }

@media (min-width: 960px) {
  .mp-pick { max-width: 560px; }
  .mp-chips { flex-wrap: wrap; overflow: visible; margin: 12px 0 18px; padding: 0; }
  #mapSection .map-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; }
  #mapSection .mapbox { height: 560px; }
  #mapSection .near-panel { order: -1; display: flex; flex-direction: column; height: 560px; }
  #mapSection .near-list { grid-auto-flow: row; grid-auto-columns: auto; align-content: start; overflow-y: auto; overflow-x: hidden; scroll-snap-type: none; margin: 0; padding: 2px 6px 2px 0; scrollbar-width: thin; }
  .mrow:hover { border-color: var(--line); }
}
