/* ==========================================================================
   gallery.css — แกลเลอรีรูป + Modal Zoom (Lightbox) เขียนเอง
   • แทนที่ unitegallery ทั้งหมด
   • รูปเป็น <img src> จริง + <a href> ที่ Google crawl ได้ (SEO-friendly)
   • โหลดทุกหน้า (เรียกจาก _header.php), คู่กับ js/lightbox.js
   ========================================================================== */

:root {
  --hm-red: #e80002; --hm-red-2: #b10501; --hm-red-3: #960701;
  --hm-grad: linear-gradient(120deg, #e80002 0%, #960701 100%);
  --hm-grad-soft: linear-gradient(120deg, #fff5f5 0%, #fdeeee 100%);
  --hm-ink: #1f2328; --hm-line: rgba(17, 17, 17, .08);
  --hm-shadow-sm: 0 10px 24px -16px rgba(31, 12, 12, .40);
}

/* ---------- กริดรูป ---------- */
.hm-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.hm-gallery-sm { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 6px; }

.hm-gallery-item {
  position: relative; display: block; overflow: hidden;
  border-radius: 12px; aspect-ratio: 1 / 1;
  background: #f0ecea; cursor: zoom-in;
  box-shadow: 0 10px 24px -18px rgba(31, 12, 12, .5);
  text-decoration: none;
}
.hm-gallery-sm .hm-gallery-item { border-radius: 8px; }
.hm-gallery-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .4s ease;
}
.hm-gallery-item:hover img { transform: scale(1.07); }

.hm-gallery-zoom {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px;
  background: linear-gradient(180deg, rgba(150, 7, 1, 0) 40%, rgba(150, 7, 1, .55) 100%);
  opacity: 0; transition: opacity .3s ease;
}
.hm-gallery-item:hover .hm-gallery-zoom,
.hm-gallery-item:focus-visible .hm-gallery-zoom { opacity: 1; }
.hm-gallery-item:focus-visible { outline: 3px solid var(--hm-red, #e80002); outline-offset: 2px; }
.hm-gallery-sm .hm-gallery-zoom { font-size: 15px; }

/* ---------- Lightbox (modal zoom) ---------- */
.hm-lightbox {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(12, 4, 4, .92);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s ease, visibility .25s ease;
  -webkit-tap-highlight-color: transparent;
}
.hm-lightbox.is-open { opacity: 1; visibility: visible; pointer-events: auto; }

.hm-lb-stage {
  margin: 0; max-width: 92vw; max-height: 86vh;
  display: flex; flex-direction: column; align-items: center;
  transform: scale(.96); transition: transform .25s ease;
}
.hm-lightbox.is-open .hm-lb-stage { transform: scale(1); }
.hm-lb-img {
  max-width: 92vw; max-height: 78vh; width: auto; height: auto;
  object-fit: contain; border-radius: 12px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9);
  background: #1a1110; opacity: 0; transition: opacity .25s ease;
}
.hm-lb-img.is-loaded { opacity: 1; }
.hm-lb-caption {
  color: #f4eded; font-family: 'Noto Sans Thai', sans-serif;
  font-size: 16px; line-height: 1.5; text-align: center;
  margin-top: 14px; max-width: 80vw; padding: 0 10px;
}

/* ปุ่มควบคุม */
.hm-lb-btn {
  position: absolute; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  width: 50px; height: 50px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 20px;
  cursor: pointer; transition: background .2s ease, transform .2s ease;
  backdrop-filter: blur(2px);
}
.hm-lb-btn:hover { background: linear-gradient(120deg, #e80002, #960701); transform: scale(1.06); }
.hm-lb-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.hm-lb-close { top: 18px; right: 18px; }
.hm-lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.hm-lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.hm-lb-prev:hover, .hm-lb-next:hover { transform: translateY(-50%) scale(1.06); }
.hm-lb-counter {
  position: absolute; top: 22px; left: 22px; z-index: 2;
  color: #fff; font-family: 'Noto Sans Thai', sans-serif; font-size: 15px;
  background: rgba(0, 0, 0, .35); padding: 5px 14px; border-radius: 40px;
}
.hm-lb-single .hm-lb-prev, .hm-lb-single .hm-lb-next, .hm-lb-single .hm-lb-counter { display: none; }

@media (max-width: 767px) {
  .hm-lb-btn { width: 42px; height: 42px; font-size: 17px; }
  .hm-lb-close { top: 12px; right: 12px; }
  .hm-lb-prev { left: 8px; } .hm-lb-next { right: 8px; }
  .hm-lb-caption { font-size: 14px; }
}

/* ==========================================================================
   หน้านโยบาย (Privacy / Cookie) — .hm-legal
   ========================================================================== */
.hm-legal-hero { background: var(--hm-grad); color: #fff; padding: 48px 16px; text-align: center; }
.hm-legal-hero h1 { font-family: 'Noto Sans Thai', sans-serif; font-weight: 700; font-size: 30px; margin: 0 0 8px; color: #fff; }
.hm-legal-hero p { font-family: 'Noto Sans Thai', sans-serif; opacity: .92; margin: 0; font-size: 16px; }
.hm-legal { max-width: 920px; margin: 0 auto; padding: 40px 18px 64px; font-family: 'Noto Sans Thai', sans-serif; color: #3a3f45; }
.hm-legal h2 { font-size: 21px; font-weight: 700; color: var(--hm-red-3); margin: 36px 0 12px; padding-left: 14px; border-left: 4px solid var(--hm-red); line-height: 1.45; }
.hm-legal h3 { font-size: 17px; font-weight: 700; color: var(--hm-ink); margin: 18px 0 8px; }
.hm-legal p { font-size: 16px; line-height: 1.95; margin: 0 0 12px; }
.hm-legal ul { margin: 0 0 14px; padding-left: 22px; }
.hm-legal li { font-size: 16px; line-height: 1.9; margin-bottom: 6px; }
.hm-legal a { color: var(--hm-red); text-decoration: underline; }
.hm-legal-note { background: var(--hm-grad-soft); border: 1px solid rgba(232, 0, 2, .14); border-radius: 12px; padding: 16px 18px; font-size: 14px; line-height: 1.8; color: #8a3a2a; margin: 0 0 28px; }
.hm-legal-toc { background: #fff; border: 1px solid var(--hm-line); border-radius: 12px; padding: 16px 22px; margin: 0 0 28px; box-shadow: var(--hm-shadow-sm); }
.hm-legal-toc strong { display: block; color: var(--hm-red-3); margin-bottom: 8px; }
.hm-legal-toc a { display: block; padding: 4px 0; text-decoration: none; }
.hm-legal-toc a:hover { text-decoration: underline; }
.hm-legal-table { width: 100%; border-collapse: collapse; margin: 6px 0 18px; font-size: 15px; }
.hm-legal-table th, .hm-legal-table td { border: 1px solid var(--hm-line); padding: 10px 12px; text-align: left; vertical-align: top; line-height: 1.7; }
.hm-legal-table th { background: #faf3f2; color: var(--hm-red-3); font-weight: 700; }
.hm-legal-updated { color: #8a8f95; font-size: 14px; margin-top: 32px; border-top: 1px solid var(--hm-line); padding-top: 16px; }
@media (max-width: 767px) { .hm-legal-hero h1 { font-size: 24px; } .hm-legal h2 { font-size: 19px; } .hm-legal-table { font-size: 13px; } .hm-legal-table th, .hm-legal-table td { padding: 8px; } }

/* ==========================================================================
   Footer (modern) — .hm-footer
   ========================================================================== */
#footer.hm-footer { background: #161618; color: #a7a7ad; box-shadow: none; margin-top: 0; }
.hm-footer-accent { height: 4px; background: var(--hm-grad); }
.hm-footer-main { padding: 52px 0 36px; }
.hm-footer-col { margin-bottom: 26px; }
.hm-footer-h { font-family: 'Noto Sans Thai', sans-serif; color: #fff; font-size: 19px; font-weight: 700; margin: 0 0 20px; padding-bottom: 12px; position: relative; }
.hm-footer-h::after { content: ""; position: absolute; left: 0; bottom: 0; width: 46px; height: 3px; border-radius: 3px; background: var(--hm-grad); }
.hm-footer-contact { list-style: none; padding: 0; margin: 0 0 22px; }
.hm-footer-contact li { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.hm-footer-ico { flex: none; width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--hm-grad); color: #fff; font-size: 16px; }
.hm-footer-ico-line { background: #06c755; }
.hm-footer-lbl { display: block; color: #fff; font-weight: 600; font-size: 14px; margin-bottom: 1px; }
.hm-footer-contact a { color: #c9c9cf; text-decoration: none; font-size: 15px; }
.hm-footer-contact a:hover { color: #ff5b5b; }
.hm-footer-qr { display: flex; gap: 14px; }
.hm-footer-qr img { width: 100%; max-width: 138px; border-radius: 12px; border: 3px solid #fff; background: #fff; transition: transform .25s ease; }
.hm-footer-qr a:hover img { transform: translateY(-3px); }
.hm-footer-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.hm-footer-tags a.badge { background: rgba(255, 255, 255, .06) !important; color: #c2c2c8 !important; border: 1px solid rgba(255, 255, 255, .12); font-weight: 500 !important; padding: 7px 12px; font-size: 13px; margin: 0 !important; transition: all .2s ease; }
.hm-footer-tags a.badge:hover { background: var(--hm-grad) !important; color: #fff !important; border-color: transparent; }
.hm-footer-stat { font-family: 'Noto Sans Thai', sans-serif; }
.hm-footer-stat > div { color: inherit !important; margin: 0 !important; }
.hm-footer-stat table { width: 100%; }
.hm-footer-stat td { padding: 9px 0 !important; border-bottom: 1px solid rgba(255, 255, 255, .07); font-size: 14.5px; color: #a7a7ad; }
.hm-footer-stat tr td:last-child { text-align: right; color: #fff; font-weight: 600; }
.hm-footer-stat tr:last-child td { border-bottom: 0; }
.hm-footer-stat tr:last-child td:last-child { color: #ff5b5b; }
.hm-footer-bottom { background: var(--hm-grad); color: #fff; text-align: center; padding: 16px 12px; font-size: 14px; line-height: 1.9; }
.hm-footer-bottom a { color: #fff; text-decoration: underline; }
.hm-footer-policy { display: inline-block; opacity: .92; }
.hm-footer-policy a { margin: 0 6px; white-space: nowrap; }
@media (max-width: 991px) { .hm-footer-main { padding: 40px 0 24px; } .hm-footer-qr img { max-width: 130px; } }
