:root{
  --bg:#f9fafb; --text:#1f2937; --sub:#6b7280; --muted:#9ca3af;
  --card:#ffffff; --border:#e5e7eb; --primary:#3b82f6; --accent:#10b981;
}

body{background:var(--bg); color:var(--text); font-family:"Inter","Sarabun",system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;}

/* HERO */
.bd-hero{background:linear-gradient(135deg,#e0f2fe,#f0fdf4); border-bottom:1px solid var(--border);}
.bd-hero__inner{max-width:1100px;margin:0 auto; padding:36px 16px;}
.bd-breadcrumb{font-size:.9rem;color:var(--sub); display:flex;gap:8px;align-items:center; margin-bottom:10px;}
.bd-breadcrumb a{color:#2563eb;text-decoration:none;}
.bd-heading .bd-chips{display:flex; gap:6px; flex-wrap:wrap; margin-bottom:10px;}
.chip{background:#eef2ff; color:#374151; border:1px solid var(--border); padding:4px 10px; border-radius:999px; font-size:.85rem;}
.chip--category{background:#dcfce7; border-color:#bbf7d0; color:#14532d;}

.bd-title{margin:0 0 8px; font-size:clamp(1.6rem,3.5vw,2.3rem); line-height:1.2; font-weight:800;}
.bd-meta{display:flex; flex-wrap:wrap; align-items:center; gap:10px; color:var(--sub);}
.bd-meta .dot{opacity:.6}
.bd-share{margin-left:auto; display:flex; gap:6px;}
.share-btn{display:inline-flex; align-items:center; justify-content:center; width:34px;height:34px; border-radius:10px; border:1px solid var(--border); background:#fff; cursor:pointer; font-size:.85rem; transition:box-shadow .2s, transform .08s;}
.share-btn:hover{box-shadow:0 2px 10px rgba(0,0,0,.08); transform:translateY(-1px);}

.bd-cover {
  margin: 20px auto;
  text-align: center;
}
.bd-cover img {
  max-width: 700px;
  width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
}

/* LAYOUT */
.bd-container{max-width:1100px;margin:0 auto; padding:24px 16px; display:grid; grid-template-columns: 1fr; gap:24px;}
@media (min-width: 960px){ .bd-container{ grid-template-columns: minmax(0,1fr) 300px; } }

/* CONTENT */
.bd-content{min-width:0;}
.bd-prose{font-size:1.02rem; line-height:1.85;}
.bd-prose h2{margin:1.6em 0 .4em; font-size:1.4rem;}
.bd-prose p{margin:.9em 0; color:#374151;}
.bd-prose ul, .bd-prose ol{margin:.9em 0 .9em 1.2em;}
.bd-prose blockquote{border-left:4px solid var(--primary); padding:.4em .9em; background:#f5faff; color:#1f2937; border-radius:8px;}
.bd-md{white-space:pre-wrap; font-family: inherit;}

.bd-section{margin:28px 0;}
.bd-figure{margin:12px 0;}
.bd-figure img{width:100%; height:auto; border-radius:12px; border:1px solid var(--border);}
.bd-figure figcaption{font-size:.88rem; color:var(--sub); margin-top:6px;}

/* GALLERY */
.bd-gallery h3{margin:8px 0 12px;}
.bd-gallery__grid{display:grid; grid-template-columns: repeat(2,1fr); gap:12px;}
@media (min-width: 720px){ .bd-gallery__grid{ grid-template-columns: repeat(3,1fr);} }
.bd-gallery__grid a{display:block;}
.bd-gallery__grid img {
  width: 100%;
  aspect-ratio: 16 / 9;   /* บังคับสัดส่วนแนวนอน */
  object-fit: cover;      /* ครอบภาพพอดีกรอบ */
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* SOURCES & DISCLAIMER */
.bd-sources ol{padding-left:1.2rem;}
.bd-sources a{color:#2563eb;}
.bd-disclaimer{margin:18px 0; background:#fff7ed; border:1px solid #fed7aa; color:#7c2d12; padding:12px 14px; border-radius:12px;}

/* ASIDE */
.bd-aside{display:flex; flex-direction:column; gap:16px;}
.bd-card{background:var(--card); border:1px solid var(--border); border-radius:14px; padding:14px;}
.bd-card h4{margin:0 0 10px; font-size:1.05rem;}
.bd-tags{display:flex; gap:8px; flex-wrap:wrap;}
.bd-cta{display:block; text-align:center; background:var(--primary); color:#fff; padding:12px 14px; border-radius:12px; text-decoration:none; font-weight:600; border:1px solid transparent;}
.bd-cta:hover{background:#2563eb;}
.bd-small{font-size:.92rem; color:var(--sub);}
.bd-small__row{display:flex; justify-content:space-between; padding:6px 0; border-top:1px dashed var(--border);}
.bd-small__row:first-child{border-top:0}

/* PRODUCTS */
.bd-products{background:#f3f4f6; border-top:1px solid var(--border); border-bottom:1px solid var(--border); margin:10px 0 24px;}
.bd-products .bd-container{padding:24px 16px;}
.bd-products h3{margin:0 0 12px;}
.bd-products__grid{display:grid; grid-template-columns: repeat(1, minmax(0,1fr)); gap:12px;}
@media (min-width: 720px){ .bd-products__grid{grid-template-columns: repeat(2,1fr);} }
.bd-prod{display:block; background:#fff; border:1px solid var(--border); border-radius:12px; padding:12px 14px; text-decoration:none;}
.bd-prod__title{font-weight:700; color:#111827; margin-bottom:4px;}
.bd-prod__desc{color:var(--sub);}

/* RELATED */
.bd-related{padding:10px 0 28px;}
.bd-related__head{display:flex; justify-content:space-between; align-items:center; gap:10px;}
.bd-link{color:#2563eb; text-decoration:none;}
.bd-related__grid{display:grid; grid-template-columns: repeat(1,1fr); gap:14px; margin-top:12px;}
@media (min-width: 720px){ .bd-related__grid{grid-template-columns: repeat(3,1fr);} }
.bd-relcard{background:#fff; border:1px solid var(--border); border-radius:12px; overflow:hidden;}
.bd-relcard__img{display:block; aspect-ratio:16/9; background:#f3f4f6;}
.bd-relcard__img img{width:100%; height:100%; object-fit:cover;}
.bd-relcard__title{font-size:1rem; margin:.7rem .9rem 1rem;}
.bd-relcard__title a{color:var(--text); text-decoration:none;}
.bd-relcard__title a:hover{color:#2563eb;}

/* LIGHTBOX (เบาๆ) */
.bd-lightbox__modal{position:fixed; inset:0; background:rgba(0,0,0,.8); display:grid; place-items:center; z-index:99;}
.bd-lightbox__modal img{max-width:90vw; max-height:85vh; border-radius:12px;}
.bd-lightbox__close {
  position: absolute;
  top: 60px;   /* หรือปรับตามที่คุณต้องการ */
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 24px;   /* ขนาดตัว X */
  cursor: pointer;

  /* เคล็ดลับ: ใช้ flex จัดให้อยู่กึ่งกลาง */
  display: flex;
  align-items: center;
  justify-content: center;

  /* reset line-height ไม่ให้ดัน */
  line-height: 1;
  padding: 0;
}
.bd-lightbox__close:hover {
  background: rgba(0,0,0,0.8);
}
/* ซ่อนไว้เมื่อมี attribute hidden */
.bd-lightbox__modal[hidden] { 
  display: none !important; 
}

/* กันสไตล์อื่นไปทับฟอนต์ของไอคอนแบรนด์ */
.share-btn .fa-brands {
  font-family: "Font Awesome 6 Brands" !important;
  font-weight: 400 !important;
}

/* (ทางเลือก) ให้ไอคอน solid ชัดขึ้นด้วย */
.share-btn .fa-solid {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
}