/* Detail page styles (CSP-safe) — focus on responsive only */
/* ===== Utilities ===== */
.mt-18{ margin-top:18px; }
.mb-14{ margin-bottom:14px; }
.m-0{ margin:0; }

/* ===== Desktop Grid ===== */
.obj-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
@media (min-width:1200px){
  .obj-grid{ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
.obj-frame{
  position:relative; width:100%;
  aspect-ratio: 1 / 1;  /* เปลี่ยนเป็น 4/3 ได้ */
  border:1px solid #e5e7eb; border-radius:12px;
  background:#fff; overflow:hidden;
  display:flex; align-items:center; justify-content:center;
}
.obj-img{
  width:100%; height:100%;
  display:block; object-fit:cover;
  cursor:zoom-in;
}
.no-media-note{
  grid-column: 1 / -1;
  padding:12px; border:1px dashed #e5e7eb; border-radius:10px; color:#6b7280;
}

/* ===== Mobile: Horizontal slider (scroll-snap) ===== */
@media (max-width:768px){
  .no-gutter-xs { padding-left:0 !important; padding-right:0 !important; }
  .hidden-xs{ display:none !important; }

  /* ใช้แนวนอนแบบสไลด์จริง ๆ */
  .obj-grid{
    display:grid;
    grid-auto-flow: column;
    grid-auto-columns: 88vw;         /* ความกว้างของแต่ละภาพบนมือถือ */
    overflow-x: auto;                 /* ให้เลื่อนในแนวนอน */
    overflow-y: visible;
    gap: 10px;
    padding: 0 6vw;                   /* เว้นขอบซ้ายขวา */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .obj-grid::-webkit-scrollbar{ display:none; }
  .obj-grid-item{ scroll-snap-align: center; }
  .obj-frame{ aspect-ratio: 4 / 3; border-radius:10px; }

  .mob-bar{
    display:flex; align-items:center; justify-content:center;
    gap:14px; margin: 0 0 10px; user-select:none;
  }
  .mob-counter{ font-weight:600; color:#374151; }
  .mob-btn{
    width:38px; height:38px; border-radius:999px; border:1px solid #e5e7eb;
    background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.05); cursor:pointer;
    font-size:20px; line-height:38px; text-align:center;
  }
}
/* ซ่อนแถบมือถือบน Desktop */
@media (min-width:769px){
  .mob-bar{ display:none; }
}

/* ===== Card ===== */
.card{ border:1px solid #e5e7eb; border-radius:14px; background:#fff; }
.card-head{ padding:12px 14px; border-bottom:1px solid #e5e7eb; }
.card-head h3{ margin:0; font-size:1.2rem; }
.hero-card{ border:0; }
.hero-card .hero-title{ margin:0; }

/* ===== Basic Info Table (Responsive) ===== */
.styled-table{
  width:100%;
  border-collapse:separate;           /* ป้องกันมุม/เงาหายตอน responsive */
  border-spacing:0;
  border:1px solid #e5e7eb;
  border-radius:14px;
  overflow:hidden;
  background:#fff;

}
.styled-table td{
  padding:12px 14px;
  border-bottom:1px solid #e5e7eb;    /* ใช้สีตรง ๆ (ไม่พึ่งตัวแปร) */
  vertical-align:top;
  background:#fff;
  font-size: 1.05rem;
  line-height: 1.6;

  /* ป้องกันข้อความ/URL ยาวล้นจอมือถือ */
  word-break: break-word;
  overflow-wrap: anywhere;
}
.styled-table tr:last-child td{border-bottom:none}

/* Desktop ≥769px: 2 คอลัมน์ 40% / 60% */
@media (min-width:769px){
  .styled-table{ table-layout:fixed; }
  .styled-table tbody tr{ display:table-row; }
  .styled-table tbody td{ display:table-cell; }

  .styled-table tbody td:first-child{
    width:40%;
    white-space:normal;
    text-align:left;
    padding-right:14px;
    background-color: #ffc4d9;
color:#7f2545;
font-weight:700;
  }
  .styled-table tbody td:nth-child(2){ width:60%; }
}

/* Mobile ≤768px: แยกเป็น 2 บรรทัดจริง ๆ */
@media (max-width:768px){
  .styled-table{ display:block; }     /* ป้องกันเบราว์เซอร์บางตัวไม่แยกบล็อก */
  .styled-table tbody{ display:block; }
  .styled-table tbody tr{
    display:block;
    padding:10px 10px;
    border-bottom:1px solid #e5e7eb;
    margin:0;                         /* กัน margin collapse แปลก ๆ */
  }
  .styled-table tbody tr:last-child{ border-bottom:0; }
  .styled-table tbody td{
    display:block;
    width:100%;
    padding:6px 0;
    border-bottom:0;
  }
  .styled-table tbody td:first-child{
    order:1;
    font-weight:700;
color:#7f2545;
    margin:0 0 4px 0;
background-color: #ffc4d9;
  }
  .styled-table tbody td:nth-child(2){
    order:2;
    margin:0;
  }

  /* รูป/สื่อในตารางให้ย่ออัตโนมัติ */
  .styled-table img,
  .styled-table video,
  .styled-table iframe{
    max-width:100%;
    height:auto;
  }
}

/* ===== Lightbox ===== */
.lb-backdrop{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.8);
  display:none; z-index: 10000;
}
.lb-dialog{
  position: fixed; inset: 0;
  display:none; z-index: 10001;
  align-items: center; justify-content: center;
  padding: 16px;
}
.lb-dialog.open, .lb-backdrop.open{ display:flex; }
.lb-content{
  position: relative; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column; gap: 8px;
}
.lb-img-wrap{
  padding: 8px; background: #000; border-radius: 10px;
  display:flex; align-items:center; justify-content:center;
  max-height: 85vh;
}
.lb-img{
  max-width: 96vw; max-height: 85vh; width:auto; height:auto; object-fit: contain;
}
.lb-caption{
  color:#f3f4f6; font-size:.95rem; line-height:1.35; text-align:center;
  word-break: break-word;
}
.lb-btn{
  position:absolute; top:50%; transform:translateY(-50%);
  background: rgba(0,0,0,.5); color:#fff; border:none;
  width:42px; height:42px; border-radius:999px; cursor:pointer;
}
.lb-prev{ left:-54px; }
.lb-next{ right:-54px; }
.lb-close{
  position:absolute; top:-10px; right:-10px;
  background: rgba(0,0,0,.6); width:38px; height:38px;
  border:none; border-radius:999px; color:#fff; cursor:pointer;
}
@media (max-width:768px){
  .lb-prev{ left:8px; }
  .lb-next{ right:8px; }
  .lb-close{ top:6px; right:6px; }
}
