/* ========================================
   ARTICLE HUB — STYLESHEET
   ======================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --navy:        #1b2a6b;
  --navy-light:  #243480;
  --gold:        #f5a623;
  --gold-2:      #e8931a;
  --red:         #d0021b;
  --bg:          #fcfcfc;
  --white:       #ffffff;
  --text:        #2c2c2c;
  --text-2:      #555;
  --text-3:      #888;
  --border:      #e0e6ed;
  --card-shadow: 0 2px 12px rgba(27,42,107,0.08);
}

/* ─── PAGE WRAPPER ─── */
.page-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

/* ─── PAGE TITLE BAR ─── */
.page-title-bar {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.page-title-bar h1 {
  font-family: var(--font);
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  background: var(--navy);
  padding: 8px 28px;
  letter-spacing: 0.04em;
}

/* ─── MAIN LAYOUT ─── */
.main-layout {
  display: block;
}

/* ─── FEATURED SECTION ─── */
.featured-area {
  background: var(--white);
  border-radius: 15px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  margin-bottom: 0;
}

/* featured ใช้ grid 2 คอลัมน์: รูปซ้าย | เนื้อหาขวา */
.featured-inner {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  align-items: start;   /* stretch รูปยืดเต็มความสูง , start */
}

.featured-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 👈 สำคัญ */
}
/* รูปใน featured ใช้ card-thumb-wrap + cthumb เหมือน card ปกติ
   แต่ override aspect-ratio ให้ยืดเต็ม featured-inner แทน */
.featured-inner > .card-thumb-wrap {
  overflow: hidden;
  position: relative;
}

.featured-inner > .card-thumb-wrap .cthumb {
  width: 100%;
  height: 100%;            /* ยืดเต็มความสูงเนื้อหาด้านขวา */
  aspect-ratio: unset;     /* ยกเลิก 16/9 เฉพาะตรงนี้ */
  object-fit: cover;
  /*object-position: center;*/
  object-position: left center;
  display: block;
}


.featured-body {
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}



.featured-title {
  font-family: var(--font);
  font-size: 20px;
  font-weight: 300;
  color: var(--navy);
  line-height: 1.35;
  margin-bottom: 14px;
}

.featured-excerpt {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: 20px;
}

/* ─── BUTTONS ─── */
.btn-read {
  display: inline-block;
  background: var(--navy);
  color: white;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 22px;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.2s;
  cursor: pointer;
  border: none;
  font-family: var(--font);
}

.btn-read:hover { background: var(--navy-light); }

.btn-read-sm {
  display: inline-block;
  align-self: flex-start;
  background: var(--navy);
  color: white;
  font-size: 11.5px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
  font-family: var(--font);
}

.btn-read-sm:hover { background: var(--gold-2); }

/* ─── CARD GRID ─── */
.cards-section {
  margin-top: 24px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 35px;
}

.article-card {
  background: var(--white);
  border-radius: 15px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.article-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(27,42,107,0.13);
}

.card-thumb-wrap {
  position: relative;
  overflow: hidden;
}

/* รูปทุกใบใช้ class เดียวกัน: cthumb */
.cthumb {
  width: 100%;
  aspect-ratio: 16/9;      /* สัดส่วนมาตรฐาน 16:9 */
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.35s ease;
}

.article-card:hover .cthumb { transform: scale(1.06); }

/* placeholder สีเทา ใช้ก่อนมีรูปจริง */
.img-placeholder {
  background-color: #d9dee6;
}

.card-body {
  padding: 14px 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-category {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--gold);
}

.card-title {
  font-size: 17px;
  font-weight: 200;
  line-height: 1.45;
  margin-bottom: 0;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4px;
}

.card-title + .card-excerpt {
  margin-top: 8px;
}

.card-excerpt:empty {
  display: none;
}
.card-excerpt {
  font-size: 15px;
  color: var(--text-3);
  line-height: 1.65;
  margin-bottom: 12px;

  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;

  min-height: 6px;
}


/* ─── PAGINATION ─── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 32px;
}

.page-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  background: white;
  transition: all 0.2s;
  font-family: var(--font);
}

.page-btn.active {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.page-btn:hover:not(.active) {
  background: #e8edff;
  border-color: var(--navy);
  color: var(--navy);
}

/* ========================================
   RESPONSIVE — TABLET (max 1024px)
   ======================================== */
@media (max-width: 1024px) {
  .page-body { padding: 0px 16px 40px; }

  .featured-inner {
    grid-template-columns: 240px 1fr;
  }

  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ========================================
   RESPONSIVE — MOBILE LANDSCAPE (max 768px)
   ======================================== */
@media (max-width: 768px) {
  .page-body { padding: 12px 10px 28px; }

  .page-title-bar h1 { font-size: 16px; padding: 7px 18px; }

  /* featured: รูปบน เนื้อหาล่าง */
  .featured-inner {
    grid-template-columns: 1fr;
  }

   .featured-inner > .card-thumb-wrap {
    width: 100%;
  }

  .featured-inner > .card-thumb-wrap .cthumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
  }

  .featured-body { padding: 16px 18px 20px; }
  .featured-title { font-size: 17px; }
  .featured-excerpt { font-size: 15px; }

  /* card: 1 คอลัมน์ แนวนอน */
  .card-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .article-card { flex-direction: row; }

  .card-thumb-wrap { 
  width: 140px; 
  flex-shrink: 0; 
}

.article-card .card-thumb-wrap .cthumb {
  width: 140px;
  height: 140px;       /* สี่เหลี่ยมจัตุรัสให้รูปไม่ขาด */
  aspect-ratio: unset;
  object-fit: cover;
}

  .card-body { padding: 10px 12px 12px; }
  .card-title { font-size: 13px; }
  .card-excerpt { display: none; }

  .cards-section { margin-top: 16px; }
  .section-divider { margin: 14px 0; }
}

/* ========================================
   RESPONSIVE — MOBILE PORTRAIT (max 480px)
   ======================================== */
@media (max-width: 780px) {
  .page-body { padding: 10px 8px 24px; }

  .page-title-bar { margin-bottom: 12px; }
  .page-title-bar h1 { font-size: 14px; padding: 6px 14px; }

  /* featured: รูปบน เนื้อหาล่าง */
  .featured-inner {
    grid-template-columns: 1fr;
  }

  .featured-inner > .card-thumb-wrap {
    width: 100%;
  }

  .featured-inner > .card-thumb-wrap .cthumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
  }

  .featured-body { padding: 12px 12px 14px; }
  .featured-title { font-size: 15px; margin-bottom: 8px; }
  .featured-excerpt { font-size: 12.5px; margin-bottom: 12px; }

  /* card: 1 คอลัมน์ แนวนอน รูปเล็กลงนิดหน่อย */
  @media (max-width: 768px) {

  /* card: 2 คอลัมน์ แนวตั้ง รูปอยู่บน */
  .card-grid {
    grid-template-columns: repeat(2, 1fr);  /* 2 คอลัมน์ */
    gap: 10px;
  }

  .article-card { 
    flex-direction: column;  /* แนวตั้ง */
  }

  .card-thumb-wrap { 
    width: 100%;             /* รูปเต็มความกว้าง */
  }

  .article-card .card-thumb-wrap .cthumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;      /* 16/9 ครบ */
  }

  .card-excerpt { display: none; }
}

  .card-body { padding: 8px 10px 10px; }
  .card-title { font-size: 12.5px; }
  .card-category { font-size: 10px; }
  .card-excerpt { display: none; }

  .btn-read-sm { font-size: 11px; padding: 5px 12px; }

  .page-btn { width: 28px; height: 28px; font-size: 11px; }
}