/* =====================================================================
   หน้ารายละเอียดร้าน (restaurant.html)
   ใช้สี มุมโค้ง และตัวอักษรจาก styles.css + theme-festival.css
   มือถือ : รูปหน้าร้านเต็มจอ → ชื่อร้าน → เมนู → ข้อมูลร้าน → ร้านใกล้เคียง + ปุ่มโทร/นำทางติดขอบล่าง
   จอคอม  : รูปหน้าร้าน + รูปเมนู 2 รูป → เนื้อหาซ้าย | การ์ดข้อมูลร้านติดด้านขวา
   ===================================================================== */
.page-shop { --tab-h: 76px; }
.shop { padding-top: 68px; }

/* ---------- ปุ่มเส้นขอบ ใช้คู่กับ btn--red ---------- */
.btn--ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn--ghost .ms { color: var(--red); }
.btn--ghost[aria-pressed="true"] .ms { --fill: 1; }

/* ---------- เส้นทางหน้า (จอใหญ่) ---------- */
.crumbs { display: none; align-items: center; gap: 4px; padding: 20px 0 16px; font-size: 14px; color: var(--ink-2); }
.crumbs .ms { font-size: 18px; color: #B9AB98; }
.crumbs a { color: var(--red-700); font-weight: 600; }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }

/* ---------- รูปร้าน ---------- */
.shop-gallery { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); margin: 0 calc(var(--gutter) * -1); }
.shop-gallery__cover, .shop-gallery__thumb { position: relative; overflow: hidden; display: block; background: #EDE3D2; }
.shop-gallery__cover { aspect-ratio: 4 / 3; max-height: 340px; width: 100%; }
.shop-gallery img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.shop-gallery__thumb { display: none; }
.shop-gallery__tag {
  position: absolute; left: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px 0 9px;
  border-radius: 999px; background: rgba(255, 255, 255, .94); color: var(--ink); font-size: 13px; font-weight: 600;
}
.shop-gallery__tag .ms { font-size: 18px; color: var(--red); }
.shop-gallery__all {
  position: absolute; right: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 10px;
  border-radius: 999px; background: rgba(30, 20, 10, .72); color: #fff; font-size: 13px; font-weight: 600;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.shop-gallery__all .ms { font-size: 18px; }
/* ปุ่มลอยบนรูป (มือถือ) */
.shop-fab {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .94); color: var(--ink); box-shadow: 0 2px 10px rgba(0, 0, 0, .14);
}
.shop-fab .ms { font-size: 22px; }
.shop-fab--back { position: absolute; top: 14px; left: 14px; }
.shop-fab-group { position: absolute; top: 14px; right: 14px; display: flex; gap: 8px; }
.shop-fab-group .fav { position: static; width: 40px; height: 40px; }

/* ปกแบบ featured image: ไล่เงาด้านล่าง + ป้ายแบรนด์ + พื้นที่ร้าน */
.shop-gallery--feat .shop-gallery__cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(20, 10, 0, .28) 0, transparent 26%, transparent 52%, rgba(20, 10, 0, .62) 100%);
}
.shop-gallery--feat .shop-gallery__tag, .shop-gallery__brand { z-index: 1; }
.shop-gallery__brand {
  position: absolute; left: 14px; bottom: 52px; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 4px;
  border-radius: 999px; background: var(--yellow); color: var(--red-700); font-size: 13px; font-weight: 700; box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}
.shop-gallery__brand b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: var(--yellow); font: 900 14px/1 var(--font-logo); }
.shop-gallery--feat .shop-gallery__tag { background: transparent; color: #fff; padding: 0; height: auto; font-size: 14.5px; text-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
.shop-gallery--feat .shop-gallery__tag .ms { color: var(--yellow); }
.shop-credit { display: flex; align-items: center; gap: 5px; margin: 8px 0 0; font-size: 12.5px; color: var(--ink-2); }
.shop-credit .ms { font-size: 16px; }

/* ร้านที่ยังไม่มีรูป: รูปแทนเต็มกรอบ + ปุ่มดูรูปบน Google Maps / ชวนเจ้าของร้านส่งรูป */
.shop-gallery--empty .shop-gallery__cover { aspect-ratio: auto; height: auto; }
.shop-gallery--empty .ph { position: relative; inset: auto; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 56px 16px 20px; text-align: center; }
.shop-gallery--empty .ph > .ms { font-size: 64px; }
.ph__text { font: 600 15px/1.5 var(--font-head); color: var(--ph-fg); }
.ph__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ph__actions .btn { height: 40px; padding: 0 14px 0 10px; font-size: 14px; }
.shop-subline { margin: -2px 0 6px; font-size: 15px; font-weight: 600; color: var(--red-700); }

/* ยังไม่มีรูปเมนู */
.menu-empty { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border: 1.5px dashed var(--line); border-radius: var(--r-md); background: var(--surface); }
.menu-empty p { flex: 1 1 220px; font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }
.menu-empty .btn { height: 40px; padding: 0 14px 0 10px; font-size: 14px; }

/* ชวนเจ้าของร้านยืนยันร้าน */
.claim {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: center; margin-top: 28px; padding: 18px;
  border-radius: var(--r-lg); background: linear-gradient(135deg, #FFF4D1, #FFE9A6); scroll-margin-top: 90px;
}
.claim__icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--red); color: #fff; }
.claim__icon .ms { font-size: 26px; }
.claim h2 { font-size: 18px; }
.claim p { margin-top: 2px; font-size: 14.5px; line-height: 1.65; color: #5E4620; }
.claim .btn { grid-column: 1 / -1; margin-top: 10px; }

/* ---------- เลย์เอาต์เนื้อหา ---------- */
.shop-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; margin-top: 20px; }
.shop-main { min-width: 0; }

/* ---------- ชื่อร้าน ---------- */
.shop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.shop-head__text { min-width: 0; }
.shop-head__actions { display: none; flex: none; gap: 8px; }
.shop-head__actions .btn { height: 44px; padding: 0 16px 0 12px; font-size: 15px; }
.shop-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.shop-chips .chip { height: 28px; gap: 4px; padding: 0 10px 0 8px; font-size: 12.5px; }
.chip .ms { font-size: 17px; }
.chip--cat { background: var(--red-50); color: var(--red-700); }
.chip--verified { background: var(--green-50); color: var(--green); }
.chip--verified .ms { --fill: 1; }
.shop-name { margin: 10px 0 6px; font-size: 28px; line-height: 1.35; }
.shop-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 15px; color: var(--ink-2); }
.shop-meta .rating small { font-size: 14px; }
.shop-status { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14.5px; }
.shop-status .chip { height: 26px; font-size: 13px; }
.shop-status__note { color: var(--ink-2); }
.shop-desc { margin-top: 14px; padding: 12px 14px; border-left: 3px solid var(--yellow); border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--yellow-50); font-size: 15px; line-height: 1.7; color: var(--ink); }

/* ---------- เมนู ---------- */
.shop-sec { margin-top: 28px; }
.shop-sec__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.shop-sec__head h2 { display: inline-flex; align-items: center; gap: 8px; font-size: 20px; }
.shop-sec__head h2 .ms { font-size: 24px; color: var(--red); }
.shop-sec__count { font-size: 14px; color: var(--ink-2); }
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.menu-grid__item { position: relative; overflow: hidden; aspect-ratio: 1; border-radius: var(--r-md); background: #EDE3D2; }
.menu-grid__item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.shop-sec__hint { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.shop-sec__hint .ms { font-size: 17px; }

/* ---------- การ์ดข้อมูลร้าน ---------- */
.shop-card { overflow: hidden; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sh-1); align-self: start; }
/* isolation: กันชั้นของ Leaflet (z-index 400+) ไม่ให้ลอยทับแถบบนและหน้าดูรูป */
.shop-card__map { position: relative; z-index: 0; isolation: isolate; height: 170px; cursor: pointer; background: #F2EFE9; }
.shop-card__map .leaflet-container { background: #F2EFE9; }
#miniMap { position: absolute; inset: 0; }
/* ลิงก์โปร่งใสทับแผนที่ทั้งกรอบ กดแล้วเปิด Google Maps */
.shop-card__maplink { position: absolute; inset: 0; z-index: 2; }
.shop-card__body { padding: 18px 18px 8px; }
.shop-card__title { margin-bottom: 4px; font-size: 18px; }
.info-list { display: grid; }
.info-row {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 60px; padding: 8px 0; color: var(--ink); font-size: 15px; line-height: 1.45;
}
.info-row + .info-row { border-top: 1px solid var(--line-2); }
.info-row > .ms, .info-row > .brand-ico { font-size: 22px; color: var(--red); }
.brand-ico { width: 22px; height: 22px; fill: #0866FF; }
.info-row small { display: block; font-size: 12.5px; color: var(--ink-2); }
.info-row span { min-width: 0; overflow-wrap: anywhere; }
.info-row__go { font-size: 20px; color: #B9AB98; }
.shop-card__actions { display: none; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 0 12px; }
.shop-card__actions .btn { height: 48px; padding: 0 12px; font-size: 15px; }
.shop-card__foot { padding: 12px 18px 16px; border-top: 1px solid var(--line-2); background: #FFFBF1; font-size: 13px; color: var(--ink-2); }
.shop-card__foot p { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.shop-card__foot p + p { margin-top: 4px; }
.shop-card__foot .ms { font-size: 17px; color: var(--green); --fill: 1; }
.shop-card__foot a { color: var(--red-700); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- ปุ่มติดขอบล่าง (มือถือ) ---------- */
.shop-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: 48px 1fr 1.3fr; gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .97); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(110, 70, 0, .08);
}
.shop-bar[hidden] { display: none; }
.shop-bar .btn { height: 48px; padding: 0 10px; font-size: 15px; }
.shop-bar .fav { position: static; width: 48px; height: 48px; border-radius: var(--r-sm); background: var(--yellow-50); box-shadow: none; }
body:has(.lightbox:not([hidden])) .shop-bar { display: none; }

/* ---------- ไม่พบร้าน ---------- */
.shop-empty { display: grid; justify-items: center; gap: 8px; padding: 80px var(--gutter); text-align: center; color: var(--ink-2); }
.shop-empty > .ms { font-size: 56px; color: var(--red); --opsz: 48; }
.shop-empty h1 { font-size: 24px; }
.shop-empty .btn { margin-top: 12px; }

/* ---------- ดูรูปเต็มจอ ---------- */
.lightbox { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; background: rgba(18, 12, 6, .95); color: #fff; }
.lightbox[hidden] { display: none; }
.lightbox__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px 18px; }
.lightbox__count { font-size: 14px; font-weight: 600; }
.lightbox__btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .12); color: #fff; }
.lightbox__btn .ms { font-size: 26px; }
.lightbox__btn:disabled { opacity: .3; cursor: default; }
.lightbox__track { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior: contain; }
.lightbox__slide { scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 0; margin: 0; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
.lightbox__slide img { max-width: 100%; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); border-radius: var(--r-md); object-fit: contain; }
.lightbox__slide figcaption { font-size: 14px; color: rgba(255, 255, 255, .8); }
.lightbox__nav { position: absolute; top: 50%; display: none; transform: translateY(-50%); }
.lightbox__nav--prev { left: 20px; }
.lightbox__nav--next { right: 20px; }

@media (hover: hover) {
  .shop-gallery__cover:hover img, .shop-gallery__thumb:hover img, .menu-grid__item:hover img { transform: scale(1.05); }
  .info-row:is(a):hover { color: var(--red-700); }
  .btn--ghost:hover { border-color: #E2C9A2; background: var(--yellow-50); }
  .lightbox__btn:not(:disabled):hover { background: rgba(255, 255, 255, .22); }
}

/* ---------- แท็บเล็ตขึ้นไป ---------- */
@media (min-width: 768px) {
  .page-shop { --tab-h: 0px; }
  .shop { padding-top: 76px; }
  .shop-bar { display: none !important; }
  .crumbs { display: flex; }
  /* รูปหน้าร้านใหญ่ + รูปเมนู 2 รูปซ้อนด้านขวา */
  .shop-gallery { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); grid-template-rows: 1fr 1fr; gap: 10px; height: 420px; margin: 0; }
  .shop-gallery__cover { grid-row: 1 / 3; aspect-ratio: auto; max-height: none; height: 100%; border-radius: var(--r-lg); }
  .shop-gallery__thumb { display: block; border-radius: var(--r-lg); }
  .shop-gallery__tag { left: 18px; bottom: 18px; }
  .shop-gallery__all { right: 16px; bottom: 16px; height: 40px; padding: 0 16px 0 12px; background: #fff; color: var(--ink); box-shadow: 0 4px 14px rgba(0, 0, 0, .18); font-size: 14px; }
  .shop-gallery__all .ms { color: var(--red); }
  .shop-fab--back, .shop-fab-group { display: none; }
  .shop-gallery--two .shop-gallery__thumb { grid-row: 1 / 3; }
  .shop-gallery__brand { left: 20px; bottom: 54px; }
  .shop-gallery.shop-gallery--empty { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; height: auto; }
  .shop-gallery--empty .shop-gallery__cover { grid-row: auto; }
  .shop-gallery--empty .ph { min-height: 300px; }
  .claim { grid-template-columns: auto minmax(0, 1fr) auto; padding: 20px 24px; }
  .claim .btn { grid-column: auto; margin-top: 0; }
  .shop-layout { margin-top: 28px; }
  .shop-head__actions { display: flex; }
  .shop-name { font-size: 36px; }
  /* ร้านส่วนใหญ่มีรูปเมนู 2–4 รูป: 4 คอลัมน์ไม่เหลือรูปตกแถว */
  .menu-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .shop-card__actions { display: grid; }
  .lightbox__nav { display: grid; }
}
/* ---------- จอคอม: เนื้อหาซ้าย การ์ดข้อมูลติดด้านขวา ---------- */
@media (min-width: 1024px) {
  .shop-gallery { height: 460px; }
  .shop-layout { grid-template-columns: minmax(0, 1fr) 380px; gap: 48px; }
  .shop-card { position: sticky; top: 96px; }
  .shop-sec { margin-top: 36px; }
}

/* เนื้อหาร้านแบบข้อความในหน้า URL SEO (ให้ Facebook / AI ที่ไม่รัน JS อ่านได้) JS จะวาดหน้าเต็มทับทันที */
.shop-static { padding: 16px 0 32px; line-height: 1.8; }
.shop-static img { display: block; width: 100%; max-width: 800px; height: auto; border-radius: var(--r-lg); margin: 12px 0; }
.shop-static ul { padding-left: 20px; list-style: disc; }

/* สั่งเดลิเวอรี่: LINE MAN / GrabFood / ShopeeFood */
.dl-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dl {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px 12px; position: relative;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: center;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
a.dl:hover { transform: translateY(-2px); box-shadow: var(--sh-1); }
.dl-mark { width: 44px; height: 44px; flex: none; }
.dl__text { display: flex; flex-direction: column; line-height: 1.35; }
.dl__text b { font-size: 14px; color: var(--ink); }
.dl__text small { font-size: 12.5px; color: var(--red); font-weight: 600; }
.dl__go { position: absolute; top: 8px; right: 8px; font-size: 16px; color: var(--ink-2); }
.dl.is-off { background: transparent; border-style: dashed; }
.dl.is-off .dl-mark { filter: grayscale(1); opacity: .45; }
.dl.is-off .dl__text small { color: var(--ink-2); font-weight: 500; }
.shop-sec__hint a { color: var(--red); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 600px) {
  .dl { flex-direction: row; text-align: left; padding: 12px 14px; gap: 10px; }
}
