/* firstpage.css | เฉพาะหน้า firstpage.html (หน้าแรก) */

/* ส่วนคลิปวีดีโอเริ่มต้นหน้าแรก */
.hero-video video,
.hero-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

/* ===== วิดีโอ + สไลด์หน้าแรก ===== */
.hero-wrap { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.hero-video {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 560px;
  width: 100%;
  border-radius: 1.25rem;
  overflow: hidden;
  background: #000;
  box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .2);
}
.hero-carousel .carousel-item img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 6;
  object-fit: cover;
  object-position: center;
}
.hero-carousel {
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .2);
}
.slide-wrap { margin-bottom: 1.5rem; }

/* ===== หัวข้อแต่ละส่วน ===== */
.section { margin-top: 3rem; }
.section-title {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: 1.6rem;
  font-weight: 600;
  color: #800000;
  margin-bottom: 1.25rem;
}
.section-title::before {
  content: "";
  width: 6px;
  height: 1.9rem;
  background: #ffd966;
  border-radius: 3px;
}
.section-sub { color: #6c757d; margin: -.75rem 0 1.25rem; }

/* ===== การ์ดเมนูลัด ===== */
.menu-card {
  display: block;
  height: 100%;
  text-align: center;
  text-decoration: none;
  color: #800000;
  background: #fff;
  border: 1px solid #e6dcdc;
  border-radius: 1rem;
  padding: 1.5rem 1rem;
  transition: box-shadow .2s, transform .2s, background .2s;
}
.menu-card:hover {
  box-shadow: 0 .5rem 1.25rem rgba(128, 0, 0, .15);
  transform: translateY(-4px);
  background: #fffafa;
  color: #800000;
}
.menu-card .bi { font-size: 2.4rem; display: block; margin-bottom: .6rem; }
.menu-card span { font-weight: 600; }

/* ===== การ์ดหลักสูตร ===== */
.course-card {
  display: block;
  height: 100%;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #5c0a0a, #9a1515);
  border-radius: 1rem;
  padding: 2rem 1.5rem;
  transition: transform .2s, box-shadow .2s;
}
.course-card:hover { transform: translateY(-4px); box-shadow: 0 .75rem 1.5rem rgba(128, 0, 0, .3); color: #fff; }
.course-card h3 { font-weight: 700; font-size: 1.5rem; }
.course-card p { margin-bottom: 1rem; opacity: .9; }
.course-card .more { color: #ffd966; font-weight: 600; }

/* ===== การ์ดข้อมูล (ภาพ/วิดีโอ/ประกาศ) ===== */
.info-card {
  height: 100%;
  border: 1px solid #e6dcdc;
  border-radius: 1rem;
  overflow: hidden;
  background: #fff;
  transition: box-shadow .2s, transform .2s;
}
.info-card:hover { box-shadow: 0 .5rem 1.25rem rgba(128, 0, 0, .15); transform: translateY(-3px); }
.info-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1.1rem;
  background: #f6eaea;
  border-bottom: 1px solid #ead7d7;
  color: #800000;
  font-weight: 600;
}
.info-head .bi { font-size: 1.3rem; }
.info-head .head-date { margin-left: auto; font-size: .82rem; font-weight: 500; color: #6c757d; }
.info-body { padding: 1rem 1.1rem 1.15rem; }
.info-body h3 { font-size: 1.05rem; font-weight: 600; color: #800000; margin-bottom: .35rem; }
.info-body p { color: #555; line-height: 1.7; font-size: .95rem; margin-bottom: 0; }

.notice-tag {
  display: inline-block;
  background: #800000;
  color: #fff;
  border-radius: .4rem;
  padding: .05rem .6rem;
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: .4rem;
}

/* การ์ดประกาศที่คลิกไปโพสต์ Facebook */
.notice-card { position: relative; cursor: pointer; }
.notice-card .card-slide { z-index: 2; }   /* ให้ภาพและลูกศรอยู่เหนือลิงก์ */
.notice-card h3 a { color: inherit; text-decoration: none; }
.notice-card:hover h3 a { text-decoration: underline; }
.read-more {
display: inline-block;
margin-top: .6rem;
color: #1565c0;
font-weight: 600;
font-size: .9rem;
}

/* สไลด์ในการ์ด (กดที่ภาพเพื่อขยาย) */
.card-slide { position: relative; background: #efe6e6; }
.card-slide .carousel-item img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  cursor: zoom-in;
}
.zoom-hint {
  position: absolute;
  top: .6rem;
  right: .6rem;
  z-index: 3;
  background: rgba(0, 0, 0, .65);
  color: #fff;
  border-radius: 2rem;
  padding: .15rem .7rem;
  font-size: .8rem;
  pointer-events: none;
}

/* ===== บริการนักเรียน-นักศึกษา ===== */
.svc-tile {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 1.1rem;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  box-shadow: 0 .25rem .75rem rgba(60, 20, 20, .15);
  transition: transform .25s, box-shadow .25s;
}
.svc-tile:hover { transform: translateY(-5px); box-shadow: 0 .8rem 1.5rem rgba(60, 20, 20, .25); color: #fff; }
.svc-tile:focus-visible { outline: 3px solid #ffd966; outline-offset: 3px; }
.svc-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* ตัวสำรอง: แสดงตอนยังไม่มีไฟล์ภาพ */
.svc-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 1rem;
  text-align: center;
  font-weight: 600;
  line-height: 1.4;
  background: linear-gradient(135deg, #4a0808, #800000);
}
.svc-fallback .bi { font-size: 3rem; color: #ffd966; }
.svc-col:nth-child(3n+2) .svc-fallback { background: linear-gradient(135deg, #0b2f63, #1565c0); }
.svc-col:nth-child(3n+3) .svc-fallback { background: linear-gradient(135deg, #7a5b00, #d6a000); }

/* ===== บทเพลงประจำสถาบัน ===== */
.song-card {
  display: grid;
  grid-template-columns: 1fr;
  border-radius: 1.25rem;
  overflow: hidden;
  background: #000;
  box-shadow: 0 .5rem 1.25rem rgba(60, 20, 20, .2);
}
@media (min-width: 992px) { .song-card { grid-template-columns: 420px 1fr; } }
.song-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  padding: 2rem 1.5rem;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, #4a0808, #800000 55%, #d6a000);
}
.song-logo {
  width: 110px;
  height: 110px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: .5rem;
  border: 4px solid #ffd966;
}
.song-title { font-size: 1.6rem; font-weight: 700; margin: 0; }
.song-sub { margin: 0; color: #f6dede; font-size: .95rem; }
.play-btn {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #ffd966;
  color: #4a0808;
  font-size: 2.6rem;
  box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .3);
  transition: transform .2s, background .2s;
}
.play-btn:hover { transform: scale(1.08); background: #ffe58f; }
.play-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.play-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.eq { display: flex; align-items: flex-end; gap: 4px; height: 38px; }
.eq span { width: 5px; height: 20%; background: #ffd966; border-radius: 3px; }
.song-card.playing .eq span { animation: eq 1s ease-in-out infinite; }
.eq span:nth-child(2) { animation-delay: .15s; }
.eq span:nth-child(3) { animation-delay: .3s; }
.eq span:nth-child(4) { animation-delay: .45s; }
.eq span:nth-child(5) { animation-delay: .6s; }
.eq span:nth-child(6) { animation-delay: .2s; }
.eq span:nth-child(7) { animation-delay: .4s; }
@keyframes eq { 0%, 100% { height: 20%; } 50% { height: 100%; } }
.song-video { position: relative; aspect-ratio: 16 / 9; background: #000; }
.song-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ===== สถาบันเครือข่าย ===== */
.partner-card {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  height: 100%;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #e6f0fb, #fff);
  border: 1px solid #d9cbc4;
  border-left: 8px solid #1565c0;
  border-radius: 1.1rem;
  box-shadow: 0 .25rem .75rem rgba(60, 20, 20, .08);
}
.partner-logo {
  position: relative;
  flex: 0 0 auto;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: .8rem;
  overflow: hidden;
}
.partner-logo .bi { font-size: 2.4rem; color: #1565c0; }
.partner-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: .4rem; background: #fff; }
.partner-card h3 { font-size: 1.1rem; font-weight: 600; color: #0b2f63; margin: 0; }
.partner-card .en { font-weight: 600; color: #444; margin: 0 0 .25rem; font-size: .95rem; }
.partner-card p.desc { margin: 0 0 .6rem; color: #555; font-size: .93rem; line-height: 1.6; }

/* =====================================================
   RESPONSIVE เฉพาะหน้าแรก (ส่วนที่ใช้ร่วมกันอยู่ใน css/style.css)
   ===================================================== */

.song-card { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .song-card { grid-template-columns: 420px minmax(0, 1fr); } }
/* ข้อความไทยยาวๆ ให้ตัดบรรทัดได้ */
.info-body h3, .info-head, .svc-fallback span, .partner-card h3, .partner-card .en,
.section-title, .menu-card span, .course-card h3 { overflow-wrap: anywhere; }

/* มือถือ */
@media (max-width: 575.98px) {
  .hero-wrap { margin-top: 1rem; margin-bottom: 1rem; }
  .hero-video, .hero-carousel { border-radius: .9rem; }
  /* ภาพสไลด์ใต้วิดีโอ: อย่าให้เตี้ยจนภาพโดนตัดมาก */
  .hero-carousel .carousel-item img { aspect-ratio: 16 / 9; }

  .section { margin-top: 2.25rem; }
  .section-title { font-size: 1.3rem; gap: .55rem; margin-bottom: 1rem; }
  .section-title::before { height: 1.5rem; flex: 0 0 6px; }

  .menu-card { padding: 1.1rem .5rem; }
  .menu-card .bi { font-size: 2rem; }
  .menu-card span { font-size: .92rem; }
  .course-card { padding: 1.4rem 1.2rem; }
  .course-card h3 { font-size: 1.3rem; }

  .info-head { flex-wrap: wrap; row-gap: .15rem; }
  .info-body { padding: .85rem .95rem 1rem; }
  .zoom-hint { font-size: .72rem; padding: .1rem .55rem; }

  /* ปุ่มบริการ: ย่อไอคอนและตัวอักษรให้ชื่อยาวๆ ไม่โดนตัด */
  .svc-tile { border-radius: .9rem; }
  .svc-fallback { gap: .3rem; padding: .5rem; font-size: .78rem; line-height: 1.3; }
  .svc-fallback .bi { font-size: 1.9rem; }

  .song-panel { padding: 1.5rem 1rem; }
  .song-title { font-size: 1.3rem; }
  .play-btn { width: 72px; height: 72px; font-size: 2.2rem; }

  .partner-card { flex-direction: column; text-align: center; padding: 1.1rem 1rem; border-left-width: 6px; }
  .partner-logo { width: 84px; height: 84px; }

}
