/* โหลดฟ้อนต์ Kanit */
@import url('https://fonts.googleapis.com/css2?family=Kanit&display=swap');

/* SDGs tag styles */
.sdg-tag {
  padding: 3px 7px;
  border-radius: 4px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  margin-right: 5px;
  display: inline-block;
}

.sdg-lightred { background-color: #e53935; }
.sdg-lightyellow { background-color: #fb8c00; }
.sdg-green { background-color: #43a047; }
.sdg-red { background-color: #ff0000; }
.sdg-darkorange { background-color: #fa3403; }
.sdg-lightsky { background-color: #33cbe6; }
.sdg-yellow { background-color: #ffd000; }
.sdg-darkpurple { background-color: #a3034e; }
.sdg-orange { background-color: #ec571c; }
.sdg-pink { background-color: #f70576; }
.sdg-darkyellow { background-color: #ffaf02; }
.sdg-gold { background-color: #d48712; }
.sdg-olive { background-color: #827717; }
.sdg-darkgreen { background-color: #2b8039; }
.sdg-sky { background-color: #00acc1; }
.sdg-lightgreen { background-color: #6de91a; }
.sdg-blue { background-color: #005eda; }
.sdg-navy { background-color: #023b86; }

/* หน้าเพจ */
.cesm-featured-news-page {
  font-family: 'Kanit', sans-serif;
  margin: 0;
  padding: 0;
  color: #222;
  background: #fff;
}

/* พื้นหลังไล่สี */
.cesm-featured-news-background {
  background: url('../images/1.jpg') no-repeat center center;
  background-size: cover;
  padding: 40px 0;
  box-sizing: border-box;
}

/* หัวข้อเรื่องเด่น */
.cesm-featured-news-section {
  width: 100%; /* เต็มความกว้าง container */
  max-width: none; /* ยกเลิก max-width */
  margin: 0 0 40px 0;
  padding: 0 20px; /* เพิ่ม padding ซ้ายขวาเล็กน้อย */
  text-align: center;
  color: #fff;
  position: relative;
}

.cesm-featured-news-section h2 {
  font-weight: 700;
  font-size: 28px;
  margin-bottom: 10px;
  display: inline-block;
  position: relative;
  padding-bottom: 10px;
  letter-spacing: 0.05cm;
}

.cesm-featured-news-section h2::after {
  content: "";
  width: 60px;
  height: 3px;
  background: #a68dff;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 2px;
}

.cesm-featured-news-section h2 a {
  font-weight: 400;
  font-size: 18px;
  color: #d1c5ff;
  margin-left: 10px;
  text-decoration: none;
  border-left: 1px solid #d1c5ff;
  padding-left: 12px;
  transition: color 0.3s ease;
}

.cesm-featured-news-section h2 a:hover {
  color: #fff;
}

/* กริดการ์ดข่าวแบบ flex */
.cesm-featured-news-grid {
  display: flex;
  flex-wrap: nowrap; /* ห้ามบรรทัดใหม่ */
  justify-content: space-between;
  gap: 10px; /* ช่องว่างระหว่างการ์ด */
  padding: 0 20px 10px 20px; /* เพิ่ม padding ซ้ายขวาให้ชิดขอบ */
  margin-top: 20px; /* เพิ่มระยะห่างจากหัวข้อ */
  width: 100%;
  box-sizing: border-box;
}

/* ลิงก์ครอบทั้งการ์ด */
.cesm-featured-news-card-link {
  flex: 0 0 calc(25% - 7.5px); /* กว้างประมาณ 1 ใน 4 ลบครึ่งช่องว่าง */
  max-width: calc(25% - 7.5px);
  box-sizing: border-box;
  text-decoration: none;
  color: inherit;
}

/* **NEW**: Wrapper ใหม่สำหรับ Card ที่จะจัดการเงาและ Transform */
.cesm-card-outer-wrapper {
  position: relative; 
  width: 100%; 
  height: 100%; 
  border-radius: 18px; 
  box-shadow: 0 10px 20px rgb(0 0 0 / 0.15); 
  transition: box-shadow 0.3s ease, transform 0.3s ease; 
  z-index: 0; 
}

.cesm-featured-news-card-link:hover .cesm-card-outer-wrapper {
  transform: translateY(-8px); 
  box-shadow: 0 15px 30px rgb(0 0 0 / 0.25); 
  z-index: 2;
}

/* การ์ดข่าว */
.cesm-featured-news-card {
  width: 100%;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  color: #222;
  padding-bottom: 20px;
  transition: none;
  box-sizing: border-box;
  height: 100%;
}

/* รูปภาพขยายตอน hover */
.cesm-featured-news-card img {
  width: calc(100% - 30px);
  height: 380px;
  object-fit: cover;
  object-position: center center;
  margin: 10px 15px 0;
  display: block;
  transition: transform 0.3s ease;
  border-radius: 10px;
}



/* ป้าย category สีเหลืองส้ม */
.cesm-category-tag {
  background-color: #ecb638;
  color: #422d00;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  display: inline-block;
  margin: 12px 15px 0;
  max-width: max-content;
  box-shadow: 0 3px 6px rgb(236 182 56 / 0.5);
}

/* เนื้อหา */
.cesm-news-content {
  flex-grow: 1;
  padding: 0 15px 0 15px;
  display: flex;
  flex-direction: column;
}

/* วันที่ */
.cesm-date {
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
}

/* ชื่อข่าว */
.cesm-news-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 10px;
  line-height: 1.3;
}

/* สรุปข่าว */
.cesm-news-summary {
  font-size: 14px;
  color: #444;
  flex-grow: 1;
  margin-bottom: 10px;
  line-height: 1.4;
}

/* ปุ่มอ่านเพิ่มเติม (ซ่อนเพราะทั้งการ์ดคลิกได้) */
.cesm-read-more {
  display: none;
}

/* ช่องเลขมุมล่างซ้าย (ซ่อน) */
.cesm-count-box {
  display: none;
}

/* ซ่อน .cesm-views และ .cesm-counts */
.cesm-views, .cesm-counts {
  display: none;
}

/* Responsive */

/* มือถือ */
@media (max-width: 480px) {
  body.cesm-body {
    padding: 20px 10px;
  }

  .cesm-featured-news-section h2 {
    font-size: 22px;
  }

  .cesm-featured-news-section h2 a {
    font-size: 14px;
    margin-left: 6px;
    border-left: none;
    padding-left: 6px;
  }

  .cesm-featured-news-grid {
    flex-wrap: wrap; /* อนุญาตให้ขึ้นบรรทัดใหม่ */
    gap: 10px;
    padding: 0 10px;
  }

  .cesm-featured-news-card-link {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .cesm-featured-news-card img {
    height: 140px;
  }

  .cesm-news-title {
    font-size: 16px;
  }

  .cesm-news-summary {
    font-size: 13px;
  }
}

/* แท็บเล็ต */
@media (min-width: 481px) and (max-width: 768px) {
  .cesm-featured-news-grid {
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 15px;
  }

  .cesm-featured-news-card-link {
    flex: 1 1 45%;
    max-width: 45%;
  }

  .cesm-featured-news-card img {
    height: 160px;
  }

  .cesm-news-title {
    font-size: 17px;
  }

  .cesm-news-summary {
    font-size: 14px;
  }
}

/* เดสก์ท็อป */
@media (min-width: 769px) {
  .cesm-featured-news-grid {
    flex-wrap: nowrap;
    gap: 10px;
    padding: 0 20px;
  }

  .cesm-featured-news-card-link {
    flex: 0 0 calc(25% - 7.5px);
    max-width: calc(25% - 7.5px);
  }

  .cesm-featured-news-card img {
    height: 220px;
  }

  .cesm-news-title {
    font-size: 18px;
  }

  .cesm-news-summary {
    font-size: 14px;
  }
}
