/* Global font */
html, body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #1f2937; /* เทาเข้มอ่านง่าย */
}

/* Headings */
h1, h2, h3, h4, h5, h6,
.section-title, .page-title, .card-title, .modal-title {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* น้ำหนักมาตรฐานที่อ่านดี */
strong, b { font-weight: 600; }

/*** Button ***/
.btn-square{width:38px;height:38px}
.btn-xxxl-square{width:258px;height:38px}
.btn-sm-square{width:32px;height:32px}
.btn-lg-square{width:48px;height:48px}
.btn-square,.btn-sm-square,.btn-lg-square{
  padding:0; display:flex; align-items:center; justify-content:center; font-weight:normal;
}

/*** Navbar ***/
.fixed-top{transition:.5s}
.top-bar{height:45px;border-bottom:1px solid rgba(53,94,252,.07)}
.navbar .dropdown-toggle::after{
  border:none; content:"\f107"; font-family:"Font Awesome 5 Free"; font-weight:900; vertical-align:middle; margin-left:8px;
}
.navbar .navbar-nav .nav-link{padding:25px 15px;color:#fff;font-weight:500;outline:none}
.navbar .navbar-nav .nav-link:hover,.navbar .navbar-nav .nav-link.active{color:#000!important}

@media (max-width:991.98px){
  .navbar .navbar-nav{margin-top:10px;border-top:1px solid rgba(0,0,0,.07)}
  .navbar .navbar-nav .nav-link{padding:10px 0}
}
@media (min-width:992px){
  .navbar .nav-item .dropdown-menu{
    display:block; visibility:hidden; top:100%;
    transform:rotateX(-75deg); transform-origin:0 0; transition:.5s; opacity:0;
  }
  .navbar .nav-item:hover .dropdown-menu{
    transform:rotateX(0); visibility:visible; transition:.5s; opacity:1;
  }
}

/*** Header / Hero ***/
.carousel-caption{
  top:0;left:0;right:0;bottom:0; display:flex; align-items:center; justify-content:center;
  text-align:start; background:rgba(0,0,0,.08); z-index:1;
}
.carousel-control-prev,.carousel-control-next{width:3rem}
.carousel-control-prev-icon,.carousel-control-next-icon{
  width:3rem;height:3rem;background-color:rgb(0,112,116);border:10px solid rgb(0,112,116)
}
.carousel-control-prev-icon{border-radius:0 3rem 3rem 0}
.carousel-control-next-icon{border-radius:3rem 0 0 3rem}

/* ทำให้วิดีโอ/รูปใน .ratio เต็มกรอบ ไม่ถูกเลื่อนขึ้น */
.ratio>*{ position:absolute; top:0; left:0; width:100%; height:100% }
.ratio>iframe{ position:absolute; top:0; left:0; width:100%; height:100% }
.ratio-1x1{ --bs-aspect-ratio:56.25% }

/* ป้องกันไอคอน 4 ช่องทับวิดีโอ */
.top-feature2{ position:static!important; margin-top:0!important; z-index:auto!important }

/*** breadcrumb / page header ***/
.page-header .breadcrumb-item,
.page-header .breadcrumb-item a{font-weight:500}
.page-header .breadcrumb-item+.breadcrumb-item::before{color:#fff;font-weight:900}
.breadcrumb-item.active{color:rgb(0,112,116)}
.breadcrumb-item a{color:#fff}
.breadcrumb-item a:hover{color:rgb(0,112,116)}

.border-box{text-align:center}
.border-box img{
  border:1px solid #2d6a4f; border-radius:10px; padding:1rem; margin-bottom:1rem; transition:.3s;
}
.border-box img:hover{ box-shadow:0 0 10px #2d6a4f }
.border-box a{ text-decoration:none; color:#0f0099; transition:.3s }
.border-box a:hover{ color:#2d6a4f; font-weight:900 }
.border-box h4{ color:#2d6a4f; margin-bottom:1rem }

.modal-bg{ background:linear-gradient(0deg,#028090,#00a896,#02c39a) }

.page-header{
  margin-top:4rem; padding-top:12rem; padding-bottom:6rem;
  background:linear-gradient(rgba(0,29,35,0),rgba(0,29,35,.8)),url(../images/header/page1.jpg) top left no-repeat;
  background-size:cover;
}
.page-about{margin-top:0;padding-top:12rem;padding-bottom:6rem;background:linear-gradient(rgba(0,29,35,0),rgba(0,29,35,.8)),url(../images/header/about.png) top left no-repeat;background-size:cover}
.page-personnel{margin-top:0;padding-top:12rem;padding-bottom:6rem;background:linear-gradient(rgba(0,29,35,0),rgba(0,29,35,.8)),url(../images/header/personnel1.jpg) top left no-repeat;background-size:cover}
.page-blog{margin-top:0;padding-top:12rem;padding-bottom:6rem;background:linear-gradient(rgba(0,29,35,0),rgba(0,29,35,.8)),url(../images/header/blog2.jpg) top left no-repeat;background-size:cover}
.page-lab{margin-top:0;padding-top:12rem;padding-bottom:6rem;background:linear-gradient(rgba(0,29,35,0),rgba(0,29,35,.8)),url(../images/header/lap1.png) top left no-repeat;background-size:cover}
.page-staff{margin-top:0;padding-top:12rem;padding-bottom:6rem;background:linear-gradient(rgba(0,29,35,0),rgba(0,29,35,.8)),url(../images/header/page3.png) top left no-repeat;background-size:cover}
.box-header{border:1px solid #fff;padding:2rem;border-radius:20px;background:linear-gradient(0deg,#028090,#00a896,#02c39a)}

@media (min-width:991.98px){ .top-feature{position:relative;margin-top:-80px;z-index:1} }

/*** Project / general carousels ***/
.project-carousel{position:relative}
.project-item{position:relative;display:block}
.project-item img{border-radius:10px;margin:1rem 0;transition:.3s}
.project-item img:hover{box-shadow:0 0 15px 5px #028090;border-radius:10px}
.project-carousel .owl-nav{
  position:absolute;width:100%;height:45px;top:50%;left:0;transform:translateY(-50%);
  display:flex;justify-content:space-between;transition:.5s;opacity:0;z-index:1;
}
.project-carousel:hover .owl-nav{opacity:1}
.project-carousel .owl-nav .owl-prev,
.project-carousel .owl-nav .owl-next{
  margin:0 30px;width:70px;height:70px;box-shadow:1px 1px 10px #028090;border:1px solid #fff;
  display:flex;align-items:center;justify-content:center;color:#fff;background:linear-gradient(45deg,#028090,#00a896,#02c39a);
  border-radius:45px;font-size:40px;transition:.5s;
}

/*** Video carousels (legacy) ***/
.card-video .ratio iframe{border-radius:10px 10px 0 0}
.video-carousel{position:relative}
.video-carousel a{ text-decoration:none; text-align:center; color:#003b21; transition:.3s }
.video-carousel a:hover{ color:#fff; background:linear-gradient(0deg,#028090,#00a896,#02c39a); box-shadow:0 0 1px 5px #028090; border-radius:10px }
.video-item{position:relative;display:block}
.video-item h5{padding:1rem}
.video-item img{border-radius:10px 10px 0 0; margin:1rem 0}
.video-carousel .owl-nav{
  position:absolute;width:100%;height:45px;top:50%;left:0;transform:translateY(-50%);
  display:flex;justify-content:space-between;transition:.5s;opacity:0;z-index:1;
}
.video-carousel:hover .owl-nav{opacity:1}
.video-carousel .owl-nav .owl-prev,.video-carousel .owl-nav .owl-next{
  margin:0 30px;width:70px;height:70px;box-shadow:1px 1px 10px #028090;border:1px solid #fff;display:flex;align-items:center;justify-content:center;
  color:#fff;background:linear-gradient(45deg,#028090,#00a896,#02c39a);border-radius:45px;font-size:40px;transition:.5s;
}

/*** Staff / Community carousels (legacy) ***/
.v-community-carousel,.staff-carousel{position:relative}
.v-community-carousel a,.staff-carousel a{ text-decoration:none; text-align:center; color:#003b21; transition:.3s }
.v-community-carousel a:hover,.staff-carousel a:hover{ color:#fff; background:linear-gradient(45deg,#028090,#00a896,#02c39a); box-shadow:0 0 1px 10px #028090; border-radius:10px }
.v-community-item,.staff-item{position:relative;display:block}
.v-community-item h5{padding:1rem}
.staff-item h6{padding:.5rem}
.v-community-item img,.staff-item img{border-radius:10px;margin:1rem 0}
.v-community-carousel .owl-nav,.staff-carousel .owl-nav{
  position:absolute;width:100%;height:45px;top:50%;left:0;transform:translateY(-50%);
  display:flex;justify-content:space-between;transition:.5s;opacity:0;z-index:1;
}
.v-community-carousel:hover .owl-nav,.staff-carousel:hover .owl-nav{opacity:1}
.v-community-carousel .owl-nav .owl-prev,.v-community-carousel .owl-nav .owl-next,
.staff-carousel .owl-nav .owl-prev,.staff-carousel .owl-nav .owl-next{
  margin:0 30px;width:70px;height:70px;box-shadow:1px 1px 10px #028090;border:1px solid #fff;display:flex;align-items:center;justify-content:center;
  color:#fff;background:linear-gradient(45deg,#028090,#00a896,#02c39a);border-radius:45px;font-size:40px;transition:.5ส;
}

/*** Cards / misc ***/
.shadow-box{box-shadow:0 0 0 2px #028090}
.card-box-img{position:relative;overflow:hidden;border-radius:10px;box-shadow:0 0 10px #028090}
.card-box-img::after{content:"";padding-top:70.25%;display:block;height:0}
.card-box-img img{position:absolute;top:0;width:100%;height:100%;transition:1s}
.card-box-img img:hover{transform:scale(1.09)}
.card-box{margin-top:1rem;padding:.5rem}

.thesis-card{border:1px solid #028090;box-shadow:0 0 5px #028090;border-radius:30px;padding:1rem;margin:1rem;height:100%}
.thesis-card:hover{box-shadow:0 0 10px 5px #028090}
.thesis-card a{text-decoration:none}
.thesis-card .thesis-icon{text-align:center;font-size:60px}
.thesis-card .thesis-icon i{
  border:1px solid #028090;border-radius:20px;padding:1rem;margin:1rem 0;background:linear-gradient(45deg,#028090,#00a896,#02c39a);color:#fff;transition:.5s;
}
.thesis-card .thesis-icon i:hover{background:#fff;color:#028090}
.thesis-card .text-item-thesis{text-align:center}
.thesis-card .text-item-thesis h4{color:#028090;font-weight:500}

.button-group,.button-group-lab{display:block;text-align:center}
.button-group a,.button-group-lab a{text-decoration:none}
.button-group button{width:60px;margin:.5rem}
.button-group-lab button{width:300px}

.box-lab{display:flex;align-items:center}
.box-lab img{border-radius:50%;margin-right:1rem}
.box-lab h1{margin-top:1rem}
.lab-card{box-shadow:.5px .5px 1px 1px #028090;height:100%}
.lab-box-img{position:relative;overflow:hidden}
.lab-box-img::after{content:"";padding-top:70.25%;display:block;height:0}
.lab-box-img img{position:absolute;top:0;width:100%;height:100%;transition:1s}
.lab-box-img img:hover{transform:scale(1.09)}
.lab-box{margin-top:1rem;padding:.5rem}
.list-lab li{text-align:center}
.list-lab li>a{ text-decoration:none; color:#028090; transition:.3s }
.list-lab li>a:hover{ color:#000 }
.detail-lab{padding:0 2rem}

/*** About ***/
.ratio-iframe iframe{border-radius:20px;border:5px solid #028090}
.about-edit p{color:#6c757d!important}
.about-img img{width:100%;height:auto;border-radius:20px;margin-bottom:1rem}
.about-padding{margin-left:20px}
.about-padding li{color:#6c757d!important}

/*** staff login ***/
.gradient-custom{background:linear-gradient(0deg,#0280903f,#00a8971c,#02c3996b)}
.padding-login{padding:12rem 2rem}
.padding-login .card{
  border-radius:1rem; box-shadow:0 0 10px 5px #00a896;
  background:linear-gradient(0deg,#028090,#00a896,#02c39a);
}
.img-logo-login img{display:inline-block;width:50%;height:50%}
.personnel-text-item{background:yellow;text-align:center}
.personnel-text-item h6{margin-top:20px}

/* Contact header override */
.page-contact{
  background-image:url('../images/header/contact-bg.jpg')!important;
  background-position:center; background-size:cover; background-repeat:no-repeat;
}

/* ===================================================================== */
/*                           Home Slides (DB)                            */
/* ===================================================================== */
#home-slides .carousel-item{padding:6px}
#home-slides .slide-frame{
  border-radius:24px; overflow:hidden; background:#000;
  box-shadow:0 8px 24px rgba(0,0,0,.22);
  transition:transform .28s ease, box-shadow .28s ease;
}
#home-slides .slide-frame:hover{transform:translateY(-3px) scale(1.01); box-shadow:0 18px 48px rgba(0,0,0,.38)}
#home-slides .slide-frame img{width:100%; height:auto; display:block}
#home-slides .carousel-control-prev,#home-slides .carousel-control-next{
  width:3rem;height:3rem; top:50%; transform:translateY(-50%); opacity:.95;
}
#home-slides .carousel-control-prev-icon,#home-slides .carousel-control-next-icon{
  filter:drop-shadow(0 2px 6px rgba(0,0,0,.45));
}
#home-slides .carousel-indicators{margin-bottom:.75rem}
#home-slides .carousel-indicators [data-bs-target]{
  width:34px;height:4px;border-radius:2px;background:#fff;opacity:.45;
}
#home-slides .carousel-indicators .active{opacity:1}

/* ===================================================================== */
/*                         VPHCAP Channel (YouTube)                      */
/* ===================================================================== */

/* ระยะห่างรอบ ๆ สไลด์ */
.channel-carousel .owl-item{ padding:10px 14px }

/* ลิงก์ทั้งใบเป็นการ์ด */
.channel-item{ display:block; text-decoration:none }

/* ตัวการ์ด */
.channel-card{
  border:0; border-radius:18px; overflow:hidden; background:#fff;
  box-shadow:0 10px 28px rgba(0,0,0,.20);
  transition:transform .22s ease, box-shadow .22s ease;
  height:100%; display:flex; flex-direction:column;
}
.channel-card:hover{ transform:translateY(-2px); box-shadow:0 18px 42px rgba(0,0,0,.28) }

/* กล่องรูป 16:9 */
.channel-thumb{
  position:relative; overflow:hidden; border-radius:18px 18px 0 0; background:#f5f5f5;
}
.channel-thumb::after{ content:""; display:block; aspect-ratio:16/9 }
.channel-thumb img{
  position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; transition:transform .35s ease;
}
.channel-item:hover .channel-thumb img{ transform:scale(1.035) }

/* ชื่อวิดีโอ 2 บรรทัด แล้วตัด … */
.channel-title{
  padding:10px 14px 16px; color:#1f2f25; text-align:center; font-weight:600; line-height:1.35;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  min-height:calc(1.35em * 2);
}

/* ปุ่มช่องเด้งนิด ๆ */
a.btn.btn-success.mb-3{
  border-radius:10px; box-shadow:0 4px 14px rgba(2,195,154,.25);
  transition:transform .2s ease, box-shadow .2s ease;
}
a.btn.btn-success.mb-3:hover{
  transform:translateY(-2px); box-shadow:0 10px 24px rgba(2,195,154,.35);
}

/* Hero Video */
.home-hero .ratio { aspect-ratio:16/9; max-height:80vh; overflow:hidden; }
.home-hero video { width:100%; height:100%; object-fit:cover; }
.home-hero { margin-bottom:2rem; }

/* ================= HERO VIDEO overlay ================= */
.home-hero{ margin:0; }
.home-hero .ratio{ background:#000; }
.home-hero .ratio-16x9{ max-height:68vh; }
@media (max-width: 991.98px){ .home-hero .ratio-16x9{ max-height:52vh; } }
.home-hero .ratio video{ object-fit:cover; width:100%; height:100%; }
.home-hero .carousel-caption{
  top:0; left:0; right:0; bottom:0;
  display:flex; align-items:flex-end; justify-content:center;
  padding:0 3vw 2.8vw;
  background:linear-gradient(180deg,rgba(0,0,0,0) 55%, rgba(0,0,0,.35) 100%);
}
.home-hero .hero-title{
  color:#fff;
  background:rgba(20,20,20,.35);
  border:1px solid rgba(255,255,255,.55);
  backdrop-filter:saturate(140%) blur(2px);
  border-radius:14px;
}
.top-feature2{ margin-top: 0 !important; }

/* ====================== Owl: spacing + allow shadow overflow ====================== */
.news-carousel .owl-item,
.channel-carousel .owl-item { padding: 10px 14px; }

.news-carousel .owl-stage-outer,
.channel-carousel .owl-stage-outer { overflow: visible; }

/* ====================== Card wrappers (no box-shadow; use drop-shadow outside) ====================== */
/* ตัวการ์ดด้านในพื้นขาว + มุมโค้ง (ไม่ให้เกิดเงาซ้ำ) */
.news-card,
.channel-item,
.channel-item .card {
  background:#fff;
  border-radius:18px;
  overflow:hidden;
  box-shadow:none;
}

/* ====================== Drop-shadow “โค้งตามมุม” ใส่ที่ตัวลิงก์ภายนอก ====================== */
/* ข่าว: <a class="news-item">…<div class="news-card">… */
#news-carousel .owl-item > a {
  display:block;
  filter: drop-shadow(0 10px 28px rgba(0,0,0,.18));
  transition: transform .22s ease, filter .22s ease;
  max-width: 520px;              /* กันยืดเต็มช่องเกินไป */
  margin: 0 auto;
}
#news-carousel .owl-item > a:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 18px 42px rgba(0,0,0,.26));
}

/* วิดีโอ: <a class="channel-item">… (บางธีมอาจมี .card ด้านในก็ครอบได้เหมือนกัน) */
#yt-carousel .owl-item > a,
.channel-item {
  display:block;
  filter: drop-shadow(0 10px 28px rgba(0,0,0,.18));
  transition: transform .22s ease, filter .22s ease;
  max-width: 520px;
  margin: 0 auto;
}
#yt-carousel .owl-item > a:hover,
.channel-item:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 18px 42px rgba(0,0,0,.26));
}

/* ====================== Thumbs: 16:9 + crop + round top ====================== */
.news-thumb,
.yt-thumb {
  position: relative;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  background: #f3f3f3;
}
.news-thumb::before,
.yt-thumb::before { content:""; display:block; padding-top:56.25%; } /* 16:9 */
.news-thumb > img,
.yt-thumb   > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
}
.news-card:hover .news-thumb > img { transform: scale(1.035); transition: transform .35s ease; }
.channel-item:hover .yt-thumb > img { transform: scale(1.03);  transition: transform .25s ease; }

/* ====================== Titles: 2 บรรทัดเท่ากันหมด (ข่าว + วิดีโอ) ====================== */
.news-title,
.yt-title {
  margin-top: .6rem;
  padding: 0 .75rem .9rem;
  color: #20352a;
  font-weight: 700;                 /* ใช้ 700 ให้ดูชัด; วิดีโอใช้ค่านี้ได้เช่นกัน */
  text-align: center;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;            /* แสดงสูงสุด 2 บรรทัด */
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.35em * 2);     /* บังคับให้สูงเท่ากันทุกใบ */
}

/* ====================== News meta ====================== */
.news-meta { color:#64748b; font-size:.95rem; }

/* ====================== Spacing under HERO (ถ้ามีใช้อยู่) ====================== */
.home-hero { margin-bottom: 56px; }
@media (max-width: 768px){ .home-hero { margin-bottom: 36px; } }


/* ===== Owl Carousel stage: ปล่อย overflow แต่ไม่ให้ยืดเต็มจอ ===== */
.news-carousel .owl-stage-outer,
.channel-carousel .owl-stage-outer {
  overflow: visible;
}

/* ===== การ์ดข่าว ===== */
.news-card {
  background:#fff;
  border-radius:18px;
  overflow:hidden;
  box-shadow:none;
  filter: drop-shadow(0 10px 28px rgba(0,0,0,.18));
  transition: transform .22s ease, filter .22s ease;
  display:flex;
  flex-direction:column;
  height:100%;
}
.news-card:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 18px 42px rgba(0,0,0,.26));
}

/* ===== การ์ด Channel ===== */
.channel-item {
  display:flex;                 /* <<< ดันเนื้อหาภายใน */
  flex-direction:column;
  justify-content:space-between;
  background:#fff;
  border-radius:18px;
  overflow:hidden;
  box-shadow:none;
  filter: drop-shadow(0 10px 28px rgba(0,0,0,.18));
  transition: transform .22s ease, filter .22s ease;
  height:100%;
}
.channel-item:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 18px 42px rgba(0,0,0,.26));
}

/* ===== Thumb 16:9 ครอป ===== */
.news-thumb,
.yt-thumb {
  position:relative;
  border-radius:18px 18px 0 0;
  overflow:hidden;
  background:#f3f3f3;
}
.news-thumb::before,
.yt-thumb::before {
  content:"";
  display:block;
  padding-top:56.25%;
}
.news-thumb > img,
.yt-thumb > img {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
  display:block;
}

/* ===== Title (2 บรรทัดเท่ากันทุกใบ) ===== */
.news-title,
.yt-title {
  margin-top:.6rem;
  padding:0 .75rem .9rem;
  color:#20352a;
  font-weight:700;
  text-align:center;
  line-height:1.35;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  min-height:calc(1.35em * 2);
}

/* ===================== Owl helpers (ใช้ร่วมกัน) ===================== */
.news-carousel .owl-item,
.channel-carousel .owl-item {
  padding: 10px 14px;
}

.news-carousel .owl-stage-outer,
.channel-carousel .owl-stage-outer {
  overflow: visible; /* ให้เงาไม่ถูกตัด */
}

/* เว้นช่องว่างระหว่าง News กับหัวข้อ Channel */
.news-carousel {
  margin-bottom: 44px !important;
}

/* ——— ช่องว่างก่อน footer (ใช้ class .home-bottom-gap ที่ section สุดท้ายของหน้าแรก) ——— */
.home-bottom-gap { margin-bottom: 96px !important; }
@media (max-width: 576px) { .home-bottom-gap { margin-bottom: 64px !important; } }

/* ===================== News ===================== */
.news-item { display: block; text-decoration: none; color: inherit; }

/* ลิงก์ครอบการ์ดถือเงา + ล็อกความกว้างต่อใบ (กันยืดเต็มจอ) */
#news-carousel .owl-item > a {
  display: block; width: 100%; height: 100%;
  max-width: 520px !important;
  margin: 0 auto !important;
  filter: drop-shadow(0 10px 28px rgba(0,0,0,.18));
  transition: transform .22s ease, filter .22s ease;
}
#news-carousel .owl-item > a:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 18px 42px rgba(0,0,0,.26));
}

/* การ์ด news equal-height */
.news-card {
  border: 0; border-radius: 18px; overflow: hidden; background: #fff; box-shadow: none;
  display: flex; flex-direction: column; height: 100%;
}

/* รูป 16:9 + ครอป */
.news-thumb { position: relative; border-radius: 18px 18px 0 0; overflow: hidden; background: #f3f3f3; }
.news-thumb::before { content: ""; display: block; padding-top: 56.25%; }
.news-thumb > img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center; display: block; transition: transform .35s ease;
}
.news-card:hover .news-thumb > img { transform: scale(1.035); }

/* Title 2 บรรทัดเท่ากันทุกใบ */
.news-title{
  font-weight: 700; line-height: 1.35; text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: calc(1.35em * 2);
  padding: 0 .75rem .9rem;
}
.news-meta { color: #64748b; font-size: .95rem; margin-top: auto; }

/* ===================== VPHCAP Channel (YouTube) ===================== */
/* ลิงก์เป็นการ์ดทั้งใบ + เงา + ล็อกความกว้างต่อใบ */
#yt-carousel .owl-item > a{
  display: flex; width: 100%; height: 100%;
  max-width: 520px !important;
  margin: 0 auto !important;
  filter: drop-shadow(0 10px 28px rgba(0,0,0,.18));
  transition: transform .22s ease, filter .22s ease;
}
#yt-carousel .owl-item > a:hover{
  transform: translateY(-2px);
  filter: drop-shadow(0 18px 42px rgba(0,0,0,.26));
}

/* การ์ด channel equal-height */
.channel-item{
  text-decoration: none; color: inherit; background: #fff;
  border-radius: 18px; overflow: hidden; box-shadow: none;
  display: flex; flex-direction: column; height: 100%; width: 100%;
}

/* รูป 16:9 + ครอป */
.yt-thumb{
  position: relative; overflow: hidden; background: #f3f3f3;
  border-radius: 18px 18px 0 0;
}
.yt-thumb::before{ content: ""; display: block; padding-top: 56.25%; }
.yt-thumb img{
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center; display: block; transition: transform .25s ease;
}
.channel-item:hover .yt-thumb img{ transform: scale(1.03); }

/* Title 2 บรรทัดเท่ากันทุกใบ */
.yt-title{
  padding: 10px 14px 16px; color: #20352a; font-weight: 700; text-align: center;
  line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: calc(1.35em * 2);
}

/* =============================================================
/* ======= VPHCAP home carousels (News + Channel) ======= */
:root{
  /* ปรับขนาดการ์ดสูงสุดต่อใบได้ที่นี่ ถ้าอยากเล็ก/ใหญ่ขึ้น */
  --card-max: 420px;
}

/* ให้เงาแสดงเลยกรอบ stage ได้ */
#news-carousel .owl-stage-outer,
#yt-carousel   .owl-stage-outer{
  overflow: visible;
}

/* ทำ stage และ item เป็น flex เพื่อ “equal height” */
#news-carousel .owl-stage,
#yt-carousel   .owl-stage{
  display: flex;
}
#news-carousel .owl-item,
#yt-carousel   .owl-item{
  display: flex;
  align-items: stretch;
  padding: 10px 14px;                 /* ระยะห่างระหว่างใบ */
}

/* ลิงก์ที่หุ้มการ์ด = กล่องการ์ดภายนอก (ถือเงา, จำกัดความกว้าง, ยืดสูงเต็มช่อง) */
#news-carousel .owl-item > a,
#yt-carousel   .owl-item > a{
  display: flex;
  flex: 1 1 auto;
  height: 100%;
  max-width: var(--card-max);         /* กันการ์ดยืดเกินไปบนจอใหญ่ */
  margin: 0 auto;                     /* จัดให้อยู่กลางช่อง */
  filter: drop-shadow(0 10px 28px rgba(0,0,0,.18));
  transition: transform .22s ease, filter .22s ease;
}
#news-carousel .owl-item > a:hover,
#yt-carousel   .owl-item > a:hover{
  transform: translateY(-2px);
  filter: drop-shadow(0 18px 42px rgba(0,0,0,.26));
}

/* ตัว “การ์ดจริง” ด้านใน ต้องยืดเต็มเพื่อให้สูงเท่ากัน */
.news-card,
.channel-item{
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* รูป 16:9 ครอปเต็มกรอบ */
.news-thumb,
.yt-thumb{
  position: relative;
  overflow: hidden;
  background: #f3f3f3;
  border-radius: 18px 18px 0 0;
}
.news-thumb::before,
.yt-thumb::before{
  content:"";
  display:block;
  padding-top:56.25%;
}
.news-thumb > img,
.yt-thumb   > img{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:cover; object-position:center;
}

/* ชื่อ 2 บรรทัด “สูงเท่ากันทุกใบ” */
.news-title,
.yt-title{
  font-weight:700;
  line-height:1.35;
  text-align:center;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  min-height:calc(1.35em * 2);
  padding:10px 14px 16px;
}

/* meta ของข่าววางล่างได้สวยขึ้น */
.news-card .card-body{
  display: flex;
  flex-direction: column;
}
.news-meta{ color:#64748b; font-size:.95rem; margin-top:auto; }

/* เว้นระยะระหว่าง News กับ Channel ให้หายอึดอัด */
.news-carousel{ margin-bottom: 44px !important; }

/* เว้นก่อน footer เฉพาะหน้า Home */
.home-bottom-gap{ margin-bottom: 96px; }
@media (max-width: 576px){
  :root{ --card-max: 360px; }          /* มือถือให้การ์ดเล็กลงนิด */
  .home-bottom-gap{ margin-bottom: 64px; }
}

/* ===== Fix: News items width ให้เท่ากันทุกใบ (3 ใบบนเดสก์ท็อป) ===== */
#news-carousel .owl-item{
  /* บังคับความกว้างไอเท็มตามจำนวน items ของ JS (margin 24px) */
  width: calc((100% - 2 * 24px) / 3) !important;  /* desktop: 3 */
}
@media (max-width: 991.98px){
  #news-carousel .owl-item{
    width: calc((100% - 24px) / 2) !important;    /* tablet: 2 */
  }
}
@media (max-width: 575.98px){
  #news-carousel .owl-item{
    width: 100% !important;                      /* mobile: 1 */
  }
}

/* ทำ anchor + การ์ดข่าวยืดเต็มช่อง (เหมือน Channel) */
#news-carousel .owl-item > a{
  display:flex;
  flex:1 1 auto;
  height:100%;
  max-width: var(--card-max);
  margin:0 auto;
}
.news-item{ display:flex; }          /* ให้ลิงก์เป็น flex container */
.news-card{ width:100%; height:100%; }/* การ์ดยืดเต็มช่อง */


/* กรอบรูปการ์ด (อัตราส่วน 16:9) */
.card-box-img{
  position:relative;
  width:100%;
  overflow:hidden;
  border-radius:12px;
  background:#f3f3f3;
}
.card-box-img::after{
  content:"";
  display:block;
  padding-top:56.25%; /* 16:9  (ถ้าอยากเป็น 3:2 ใช้ 66.6667%) */
}

/* รูปภาพ: เติมกรอบให้เต็มและครอปกลาง ไม่ยืดสัดส่วน */
.card-box-img img{
  position:absolute; inset:0;
  width:100% !important;
  height:100% !important;
  object-fit:cover;          /* ครอปให้พอดีกรอบ */
  object-position:center;    /* จัดครอปจากกึ่งกลาง */
  display:block;
}

