/* ==========================================================
   หน้าแรก — ThaiBoiler
   ใช้ตัวแปรสีจาก layout.css (--tb-red, --tb-black ฯลฯ)
   ========================================================== */

.hp-hero,
.hp-facts,
.hp-about,
.hp-services,
.hp-course,
.hp-news,
.hp-cta {
  font-family: "Prompt", sans-serif;
  color: var(--tb-ink);
}

.hp-hero svg,
.hp-facts svg,
.hp-about svg,
.hp-services svg,
.hp-course svg,
.hp-news svg,
.hp-cta svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: none;
}

/* ---------- ส่วนประกอบร่วม ---------- */

.hp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--tb-red);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 1px;
}

.hp-eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: currentColor;
}

.hp-eyebrow-light {
  color: #ff8a8a;
}

.hp-title {
  margin: 0 0 20px;
  color: var(--tb-black);
  font-family: "Prompt", sans-serif;
  font-size: clamp(24px, 2.6vw, 36px);
  font-weight: 600;
  line-height: 1.35;
}

.hp-title-light {
  color: var(--tb-white);
}

.hp-head {
  margin-bottom: 44px;
}

.hp-head-center {
  text-align: center;
}

.hp-head-center .hp-eyebrow::after {
  content: "";
  width: 28px;
  height: 2px;
  background: currentColor;
}

.hp-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.hp-head-row .hp-title {
  margin-bottom: 0;
}

.hp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 28px;
  border: 1px solid transparent;
  border-radius: var(--tb-radius);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  transition: background .2s, color .2s, border-color .2s, transform .2s var(--tb-ease);
}

.hp-btn:hover {
  transform: translateY(-2px);
}

.hp-btn-red {
  background: var(--tb-red);
  color: var(--tb-white);
}

.hp-btn-red:hover {
  background: var(--tb-red-dark);
  color: var(--tb-white);
}

.hp-btn-line {
  border-color: #cfcfcf;
  color: var(--tb-black);
}

.hp-btn-line:hover {
  border-color: var(--tb-black);
  color: var(--tb-black);
}

.hp-btn-ghost {
  border-color: rgba(255, 255, 255, .3);
  color: var(--tb-white);
}

.hp-btn-ghost:hover {
  border-color: var(--tb-white);
  color: var(--tb-white);
}

.hp-btn-white {
  background: var(--tb-white);
  color: var(--tb-red);
}

.hp-btn-white:hover {
  background: var(--tb-black);
  color: var(--tb-white);
}

.hp-btn-outline-white {
  border-color: rgba(255, 255, 255, .55);
  color: var(--tb-white);
}

.hp-btn-outline-white:hover {
  border-color: var(--tb-white);
  background: rgba(255, 255, 255, .1);
  color: var(--tb-white);
}

.hp-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--tb-red);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.hp-link svg {
  transition: transform .2s var(--tb-ease);
}

.hp-link:hover {
  color: var(--tb-red-dark);
}

.hp-link:hover svg {
  transform: translateX(4px);
}

/* ---------- Hero (แบนเนอร์) ---------- */

.hp-hero {
  background: var(--tb-black);
}

.hp-hero .flexslider {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--tb-black);
}

.hp-hero .flexslider img {
  display: block;
  width: 100%;
}

.hp-hero .flex-control-nav {
  bottom: 20px;
}

.hp-hero .flex-control-paging li {
  margin: 0 4px;
}

.hp-hero .flex-control-paging li a {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .5);
  box-shadow: none;
  text-indent: -9999px;
  transition: background .2s, width .2s;
}

.hp-hero .flex-control-paging li a.flex-active {
  width: 44px;
  background: var(--tb-white);
}

/* ---------- ข้อเท็จจริงสำคัญ ---------- */

/* วางใต้แบนเนอร์ (ไม่ทับ) เพราะแบนเนอร์อาจมีข้อความที่ขอบล่าง */
.hp-facts {
  position: relative;
  z-index: 5;
  padding-top: 40px;
  background: var(--tb-white);
}

.hp-facts-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--tb-white);
  border-radius: var(--tb-radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .12);
  overflow: hidden;
}

.hp-fact {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 28px 32px;
  border-top: 3px solid transparent;
  transition: border-color .25s;
}

.hp-fact + .hp-fact {
  border-left: 1px solid var(--tb-line);
}

.hp-fact:hover {
  border-top-color: var(--tb-red);
}

.hp-fact-num {
  color: var(--tb-red);
  font-size: 38px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.5px;
}

.hp-fact-text {
  display: flex;
  flex-direction: column;
  line-height: 1.45;
}

.hp-fact-text strong {
  color: var(--tb-black);
  font-size: 15px;
  font-weight: 500;
}

.hp-fact-text span {
  color: var(--tb-muted);
  font-size: 13px;
  font-weight: 300;
}

/* ---------- เกี่ยวกับสมาคม ---------- */

.hp-about {
  padding: 88px 0 104px;
  background: var(--tb-white);
}

.hp-about-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 72px;
}

.hp-about-text p {
  margin: 0 0 24px;
  color: #4a4a4a;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.85;
}

.hp-quote {
  position: relative;
  margin: 0 0 32px;
  padding: 4px 0 4px 24px;
  border-left: 3px solid var(--tb-red);
  color: var(--tb-black);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.7;
}

.hp-about-media {
  position: relative;
  padding: 0 0 28px 28px;
}

.hp-about-media::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 62%;
  height: 72%;
  background: var(--tb-red);
  border-radius: var(--tb-radius);
}

.hp-about-media::after {
  content: "";
  position: absolute;
  right: -14px;
  top: -14px;
  width: 96px;
  height: 96px;
  background-image: radial-gradient(#cfcfcf 1.5px, transparent 1.5px);
  background-size: 12px 12px;
  z-index: 0;
}

.hp-cert {
  position: relative;
  z-index: 1;
  margin: 0;
  background: var(--tb-white);
  border-radius: var(--tb-radius);
  box-shadow: 0 24px 50px rgba(0, 0, 0, .14);
  overflow: hidden;
}

.hp-cert img {
  display: block;
  width: 100%;
  height: auto;
}

.hp-cert figcaption {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--tb-black);
  color: #bdbdbd;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.45;
}

.hp-cert figcaption strong {
  display: block;
  color: var(--tb-white);
  font-size: 14px;
  font-weight: 500;
}

.hp-cert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--tb-red);
  color: var(--tb-white);
  flex: none;
}

.hp-cert-badge svg {
  width: 20px;
  height: 20px;
}

/* ---------- บริการของเรา ---------- */

.hp-services {
  padding: 96px 0;
  background: #f5f5f4;
}

.hp-services-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
}

.hp-service {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 32px 24px 28px;
  background: var(--tb-white);
  border-radius: var(--tb-radius);
  color: var(--tb-ink);
  text-decoration: none;
  overflow: hidden;
  transition: transform .3s var(--tb-ease), box-shadow .3s;
}

.hp-service::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--tb-red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--tb-ease);
}

a.hp-service:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .1);
  color: var(--tb-ink);
}

a.hp-service:hover::after {
  transform: scaleX(1);
}

.hp-service-no {
  position: absolute;
  right: 20px;
  top: 18px;
  color: #ececec;
  font-size: 34px;
  font-weight: 600;
  line-height: 1;
  transition: color .3s;
}

a.hp-service:hover .hp-service-no {
  color: var(--tb-red-soft);
}

.hp-service-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 22px;
  border-radius: 50%;
  background: var(--tb-red-soft);
  transition: background .3s;
}

.hp-service-icon img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  transition: filter .3s;
}

a.hp-service:hover .hp-service-icon {
  background: var(--tb-red);
}

a.hp-service:hover .hp-service-icon img {
  filter: brightness(0) invert(1);
}

.hp-service h3 {
  margin: 0 0 6px;
  color: var(--tb-black);
  font-family: "Prompt", sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
}

.hp-service p {
  margin: 0;
  color: var(--tb-muted);
  font-size: 13.5px;
  font-weight: 300;
  line-height: 1.6;
}

.hp-service-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 20px;
  color: var(--tb-red);
  font-size: 13.5px;
  font-weight: 500;
}

.hp-service-more svg {
  width: 16px;
  height: 16px;
  transition: transform .2s var(--tb-ease);
}

a.hp-service:hover .hp-service-more svg {
  transform: translateX(4px);
}

/* ---------- คอร์สอบรมล่าสุด ---------- */

/* โทนสว่าง: การ์ดเทาอ่อนบนพื้นขาว ให้เด่นเท่ากับส่วนอื่น */
.hp-course {
  padding: 96px 0 0;
  background: var(--tb-white);
  color: #4a4a4a;
}

.hp-course-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 56px;
  padding: 48px;
  background: #f5f5f4;
  border-radius: var(--tb-radius);
}

.hp-course-media a {
  display: block;
  border-radius: var(--tb-radius);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .1);
}

.hp-course-media img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform .5s var(--tb-ease);
}

.hp-course-media a:hover img {
  transform: scale(1.03);
}

.hp-course-info p {
  margin: 0 0 28px;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.8;
}

.hp-course-meta {
  display: grid;
  gap: 16px;
  margin: 0 0 32px;
  padding: 24px 0 0;
  border-top: 1px solid #e2e2e0;
  list-style: none;
}

.hp-course-meta li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  color: var(--tb-black);
  font-size: 15px;
  line-height: 1.5;
}

.hp-course-meta svg {
  margin-top: 2px;
  padding: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--tb-white);
  color: var(--tb-red);
  box-sizing: border-box;
}

.hp-course-meta small {
  display: block;
  color: var(--tb-muted);
  font-size: 12.5px;
  font-weight: 300;
}

/* ---------- ข่าวและกิจกรรม ---------- */

.hp-news {
  padding: 96px 0;
  background: var(--tb-white);
}

.hp-news-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  grid-template-rows: auto auto;
  gap: 24px;
}

.hp-news-card {
  display: flex;
  background: var(--tb-white);
  border: 1px solid var(--tb-line);
  border-radius: var(--tb-radius);
  color: var(--tb-ink);
  text-decoration: none;
  overflow: hidden;
  transition: box-shadow .3s, border-color .3s, transform .3s var(--tb-ease);
}

.hp-news-card:hover {
  border-color: transparent;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .1);
  transform: translateY(-4px);
  color: var(--tb-ink);
}

.hp-news-img {
  display: block;
  flex: 0 0 42%;
  overflow: hidden;
  background: #eee;
}

.hp-news-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s var(--tb-ease);
}

.hp-news-card:hover .hp-news-img img {
  transform: scale(1.05);
}

.hp-news-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 24px;
}

.hp-news-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--tb-red);
  font-size: 13px;
  font-weight: 500;
}

.hp-news-date svg {
  width: 14px;
  height: 14px;
}

.hp-news-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--tb-black);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.55;
  transition: color .2s;
}

.hp-news-card:hover .hp-news-title {
  color: var(--tb-red);
}

.hp-news-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  color: var(--tb-muted);
  font-size: 13.5px;
}

.hp-news-more svg {
  width: 15px;
  height: 15px;
  transition: transform .2s var(--tb-ease);
}

.hp-news-card:hover .hp-news-more {
  color: var(--tb-red);
}

.hp-news-card:hover .hp-news-more svg {
  transform: translateX(4px);
}

/* ข่าวแรกเป็นการ์ดใหญ่ */
.hp-news-card.is-featured {
  grid-row: span 2;
  flex-direction: column;
}

.hp-news-card.is-featured .hp-news-img {
  flex: none;
  aspect-ratio: 16 / 10;
}

.hp-news-card.is-featured .hp-news-body {
  padding: 26px 28px 28px;
  flex: 1;
}

.hp-news-card.is-featured .hp-news-title {
  font-size: 20px;
  line-height: 1.5;
}

/* ---------- ชวนสมัครสมาชิก ---------- */

.hp-cta {
  padding: 0 0 96px;
  background: var(--tb-white);
}

.hp-cta-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 52px 56px;
  background: var(--tb-red);
  border-radius: var(--tb-radius);
  color: var(--tb-white);
  overflow: hidden;
}

.hp-cta-inner::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 50%;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .06) 0 2px, transparent 2px 16px);
  pointer-events: none;
}

.hp-cta-inner > * {
  position: relative;
}

.hp-cta h2 {
  margin: 0 0 8px;
  color: var(--tb-white);
  font-family: "Prompt", sans-serif;
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 600;
  line-height: 1.35;
}

.hp-cta p {
  margin: 0;
  color: rgba(255, 255, 255, .82);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.7;
}

.hp-cta .hp-actions {
  flex: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 1199.98px) {
  .hp-services-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .hp-about-grid,
  .hp-course-grid {
    gap: 48px;
  }
}

@media (max-width: 991.98px) {
  .hp-facts {
    padding-top: 28px;
  }

  .hp-fact {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 22px 20px;
  }

  .hp-fact-num {
    font-size: 30px;
  }

  .hp-about,
  .hp-services,
  .hp-course,
  .hp-news {
    padding: 72px 0;
  }

  .hp-about-grid,
  .hp-course-grid {
    grid-template-columns: 1fr;
  }

  .hp-course {
    padding-bottom: 0;
  }

  .hp-course-grid {
    gap: 36px;
    padding: 36px;
  }

  .hp-about-media {
    max-width: 560px;
  }

  .hp-news-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hp-news-card.is-featured {
    grid-column: span 2;
    grid-row: auto;
  }

  .hp-news-card:not(.is-featured) {
    flex-direction: column;
  }

  .hp-news-card:not(.is-featured) .hp-news-img {
    flex: none;
    aspect-ratio: 16 / 10;
  }

  .hp-cta-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 40px 36px;
  }

  .hp-cta {
    padding-bottom: 72px;
  }
}

@media (max-width: 767.98px) {
  .hp-facts {
    padding-top: 20px;
  }

  .hp-facts-panel {
    grid-template-columns: 1fr;
    box-shadow: none;
    border: 1px solid var(--tb-line);
  }

  .hp-fact {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-top: 0;
  }

  .hp-fact + .hp-fact {
    border-left: 0;
    border-top: 1px solid var(--tb-line);
  }

  .hp-fact-num {
    min-width: 76px;
    font-size: 28px;
  }

  .hp-hero .flex-control-nav {
    bottom: 12px;
  }

  .hp-about,
  .hp-services,
  .hp-course,
  .hp-news {
    padding: 56px 0;
  }

  .hp-head {
    margin-bottom: 32px;
  }

  .hp-course {
    padding-bottom: 0;
  }

  .hp-course-grid {
    gap: 28px;
    padding: 20px 20px 28px;
  }

  .hp-title br {
    display: none;
  }

  .hp-service h3 {
    font-size: 15px;
  }

  .hp-service .hp-service-more {
    font-size: 13px;
  }

  .hp-head-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .hp-about-media {
    padding: 0 0 18px 18px;
  }

  .hp-about-media::after {
    display: none;
  }

  .hp-services-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .hp-service {
    padding: 22px 18px;
  }

  .hp-service:last-child:nth-child(odd) {
    grid-column: span 2;
  }

  .hp-service-icon {
    width: 52px;
    height: 52px;
    margin-bottom: 16px;
  }

  .hp-service-icon img {
    width: 28px;
    height: 28px;
  }

  .hp-service-no {
    font-size: 26px;
  }

  .hp-news-grid {
    grid-template-columns: 1fr;
  }

  .hp-news-card.is-featured {
    grid-column: auto;
  }

  .hp-news-card.is-featured .hp-news-title {
    font-size: 17px;
  }

  .hp-cta {
    padding-bottom: 56px;
  }

  .hp-cta-inner {
    padding: 32px 24px;
  }

  .hp-cta .hp-actions,
  .hp-cta .hp-btn {
    width: 100%;
  }
}

@media (max-width: 359.98px) {
  .hp-services-grid {
    grid-template-columns: 1fr;
  }
}
