/* ===================================================================
   KU Dairy Website Stylesheet
    =================================================================== */

    
/* --- 0. การตั้งค่าตัวแปรหลักและสไตล์พื้นฐาน (Variables & Base) --- */
:root {
  --primary-color: #3d81ff; /* สีเขียวเกษตร */
  --secondary-color: #f39c12; /* สีเหลืองส้มเสริม */
  --light-gray: #f8f9fa; /* สีพื้นหลังอ่อน */
  --dark-text: #333; /* สีตัวหนังสือหลัก */
  --light-text: #6c757d; /* สีตัวหนังสือรอง */
  --border-radius: 13px; /* ความโค้งของขอบ */
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* เงา */
  --transition-speed: 0.3s;
}

/* ทำให้การเลื่อนหน้าเว็บนุ่มนวล */
html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}
.itim-regular {
  font-family: "Itim", cursive;
  font-weight: 400;
  font-style: normal;
}
#preloader {
  position: fixed;
  inset: 0;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.preloader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preloader-image {
  max-height: 40vh; /* ไม่เกิน 40% ความสูงหน้าจอ */
  max-width: 80vw;
  margin-bottom: 20px;
  object-fit: contain;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ccc;
  border-top: 4px solid #4F46E5; /* สี indigo */
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

body {
  color: var(--dark-text);
  background-color: #ffffff;
  margin: 0;
  padding: 0;
  line-height: 1.7;
  overflow-x: hidden;
  font-family: "Itim", cursive;
}
  /* Image gallery grid styling */
        .image-gallery-grid {
            display: grid;
            gap: 4px; /* Reduced gap for a tighter grid */
        }

        .image-gallery-grid img, .image-gallery-grid > div {
            width: 100%;
            height: 100%;
            object-fit: cover;
            cursor: pointer;
            transition: transform 0.2s ease-in-out, filter 0.2s ease-in-out;
            border-radius: 4px; /* Slightly rounded corners for images in grid */
        }

        .image-gallery-grid img:hover {
            transform: scale(1.03);
            filter: brightness(1.1);
        }

        /* Styles for different image counts */
        .gallery-2-items { grid-template-columns: repeat(2, 1fr); }
        .gallery-3-items { grid-template-columns: repeat(2, 1fr); }
        .gallery-3-items > div:first-child, .gallery-3-items > img:first-child { grid-row: span 2; }
        .gallery-4-items { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
        .gallery-5-plus-items { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }

        /* Truncate text with ellipsis */
        .truncate-text {
            overflow: hidden;
            display: -webkit-box;
            -webkit-line-clamp: 3; /* Show 3 lines */
            -webkit-box-orient: vertical;
        }
        .truncate-text.expanded {
            -webkit-line-clamp: unset;
        }

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Itim", cursive;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Custom scrollbar for carousel (optional, for better visual) */
.carousel-container::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Webkit browsers */
}
.carousel-container {
  -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
  scrollbar-width: none; /* Hide scrollbar for Firefox */
  scroll-snap-type: x mandatory; /* Enable scroll snapping */
}
.carousel-item {
  scroll-snap-align: start; /* Snap to the start of each item */
  flex-shrink: 0; /* Prevent items from shrinking */
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 15px;
}

.section {
  padding: 80px 0;
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 15px;
  color: var(--primary-color);
}

.section-description {
  text-align: center;
  font-size: 1.5rem;
  color: var(--light-text);
  max-width: 600px;
  margin: 0 auto 50px auto;
}

.img-fluid {
  max-width: 100%;
  height: auto;
}

/* --- 1. แถบนำทาง (Navbar) --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 15px 0;
  z-index: 1000;
  transition: background-color var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease,
    padding var(--transition-speed) ease;
}
.navbar a,
.navbar .nav-link,
.navbar .nav-item {
  font-size: 1.2rem; /* หรือ 18px ตามต้องการ */
  font-weight: 500; /* เพิ่มความชัดเจน */
}

.navbar.scrolled {
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  padding: 10px 0;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo-small {
  height: 52px;
}
.logo-large {
  height: 52px;
}

.nav-links a {
  color: #0f76bd;
  text-decoration: none;
  margin: 0 15px;
  font-weight: 500;
  position: relative;
  transition: color var(--transition-speed) ease;
  font-family: "Itim", cursive;
  font-size: 22px;
}

.nav-links a:hover {
  color: #8cc5eb;
}

.nav-links a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--primary-color);
  transition: width var(--transition-speed) ease;
}

.nav-links a:hover::after {
  width: 100%;
}

/* Hamburger Menu */
.menu-toggle {
  display: none;
  font-size: 1.5rem;
  cursor: pointer;
}

/* --- 2. ส่วนแนะนำพร้อมวิดีโอ (Video Intro Section) --- */

.hero-video-section {
  position: relative;
  width: 100%;
  padding-top: 750px; /* อัตราส่วน 4:3 */
  overflow: hidden;
}

.video-content-layout {
  position: absolute;
  top: 110px;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

.background-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.hero-content {
  position: absolute;
  top: 220px; /* เว้นช่องว่างจากบน */
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 700px;
  color: white;
  text-align: center;
  z-index: 3;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.intro-logo {
  width: 280px;
  height: auto;
  margin-bottom: 16px;
}

.headline {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

.lead-text {
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.primary-btn,

.secondary-btn {
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: all 0.3s ease;
}

.primary-btn {
  background-color: #2e7d32;
  color: white;
}

.primary-btn:hover {
  background-color: #1b5e20;
}

.secondary-btn {
  border: 2px solid #ffffff;
  color: #ffffff;
}

.secondary-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .intro-logo {
    width: 200px;
  }

  .headline {
    font-size: 1.5rem;
  }

  .lead-text {
    font-size: 1rem;
  }
}

.headline {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.lead-text {
  font-size: 1.2rem;
  max-width: 600px;
  margin-bottom: 24px;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.primary-btn,
.secondary-btn {
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: all 0.3s ease;
}

.primary-btn {
  background-color: #2e7d32;
  color: white;
}

.primary-btn:hover {
  background-color: #1b5e20;
}

.secondary-btn {
  border: 2px solid #ffffff;
  color: #ffffff;
}

.secondary-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .headline {
    font-size: 1.5rem;
  }

  .lead-text {
    font-size: 1rem;
  }

  .intro-logo {
    width: 200px;
  }
}

.video-content-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 40px;
}

.video-wrapper {
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.video-element {
  width: 100%;
  display: block;
}

.intro-text-content h1 {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 20px;
  color: #00acc1;
}

.intro-text-content .lead-text {
  font-size: 1.25rem;
  color: var(--light-text);
  margin-bottom: 20px;
}
.text-muted-small {
  font-size: 0.9rem;
  color: #999;
  margin-bottom: 30px;
}

.hero-buttons .btn {
  text-decoration: none;
  padding: 12px 30px;
  border-radius: 50px;
  font-weight: 600;
  margin-right: 15px;
  transition: all var(--transition-speed) ease;
}

.primary-btn {
  background-color: #0f76bd;
  color: #fff;
}
.primary-btn:hover {
  background-color: #3371e4; /* เขียวเข้มขึ้น */
  transform: translateY(-2px);
}

.secondary-btn {
  background-color: #e9ecef;
  color: var(--dark-text);
}
.secondary-btn:hover {
  background-color: #dee2e6;
  transform: translateY(-2px);
}

/* --- 3. ส่วนเวลาจำหน่าย (Open Hours Section) --- */
.openhours-section {
  background-color: var(--light-gray);
  padding: 50px 20px;
}

.section-title i {
  margin-right: 10px;
}

.openhours-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 50px;
}

.hour-card {
  background: #fff;
  padding: 30px 25px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  text-align: center;
  border-top: 5px solid var(--primary-color);
  transition: transform var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  min-height: 280px; /* ทำให้กล่องสูงเท่ากัน */
}

.hour-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.open-bill {
  font-weight: 600;
  color: #2e7d32; /* สีเขียวเข้ม */
  font-size: 1.25rem;
  margin-bottom: 0;
}

.hour-card .day {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.hour-card .time {
  font-size: 1.5rem; /* ลดลงหน่อยให้พอดี */
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
}

.hour-card .status {
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 50px;
  display: inline-block;
  font-size: 1rem;
  margin-top: auto; /* ดันสถานะไปล่างสุด */
}

.hour-card .status.open {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1.5px solid #2e7d32;
}

.hour-card .status.alert {
  background-color: #fff3e0;
  color: #f57c00;
  border: 1.5px solid #f57c00;
}

/* Responsive */
@media (max-width: 768px) {
  .openhours-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 30px;
  }
  .hour-card {
    min-height: auto;
    padding: 25px 20px;
  }
}

/* --- 4. ส่วนแสดงผลิตภัณฑ์ (Products Section) --- */
.product-filter {
  text-align: center;
  margin-bottom: 50px;
}

.filter-btn {
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 50px;
  padding: 10px 25px;
  margin: 5px;
  cursor: pointer;
  font-family: "Kanit", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  transition: all var(--transition-speed) ease;
}

.filter-btn:hover {
  background-color: var(--light-gray);
  border-color: #ccc;
}

.filter-btn.active {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 30px;
}

.product-card {
  background-color: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
  text-align: center;
}

.product-card:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.product-image {
  width: 100%;
  height: 250px;
  object-fit: cover;
}

.product-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 15px 15px 5px 15px;
}

.product-description {
  font-size: 0.9rem;
  color: var(--light-text);
  padding: 0 15px 20px 15px;
}

/* Animation สำหรับการกรอง */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.product-card {
  animation: fadeIn 0.5s;
}
.product-card.hide {
  display: none;
}

/* --- 5. ส่วนติดต่อเรา (Contact Section) --- */
.contact-section {
  margin-top: 2px; /* ลบระยะห่างด้านบน */
  padding-top: 2px; /* ลบระยะห่างด้านในด้านบน */
  background-color: var(--light-gray);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: center;
}

.map-wrapper {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.map-wrapper iframe {
  width: 100%;
  height: 320px;
  border: 0;
  display: block;
  border-radius: 12px;
}

@media (max-width: 768px) {
  .map-wrapper iframe {
    height: 240px;
  }
}

.contact-info h2 {
  font-size: 1.5rem;
  margin-top: 0;
}

.contact-info p {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
}
.contact-info p i {
  color: var(--primary-color);
  font-size: 1.2rem;
  width: 20px;
  text-align: center;
}
.contact-info a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.social-links {
  margin-top: 30px;
  color: #fff !important; /* สีขาว */
}
.social-btn {
  text-decoration: none;
  color: #30c50a; /* สีขาวตลอด */
  padding: 10px 20px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: 10px;
  transition: opacity 0.3s ease;
}

.social-btn:hover {
  opacity: 0.9;
  color: #fff; /* ยืนยันสีขาวตอน hover */
}

.social-btn:hover,
.social-btn:focus {
  opacity: 0.9;
  color: #fff; /* สีตัวอักษรตอน hover */
}
.social-links .social-btn {
  color: #fff !important;
}

.social-links .social-btn:hover {
  color: #fff !important;
}

.facebook-btn {
  background-color: #1877f2;
}

.line-btn {
  background-color: #06c755;
}

/* --- 6. ส่วนท้ายเว็บ (Footer) --- */
footer {
  background-color: var(--dark-text);
  color: #f1f1f1;
  text-align: center;
  padding: 20px 0;
  font-size: 0.9rem;
}

/* --- 7. Modal แสดงรูปภาพ --- */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.modal-content {
  margin: auto;
  display: block;
  max-width: 80%;
  max-height: 80%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#modalCaption {
  text-align: center;
  color: #ccc;
  padding: 20px;
  font-size: 1.2rem;
  position: absolute;
  bottom: 20px;
  width: 100%;
}

.close-button {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
}

/* --- 8. ปุ่มกลับสู่ด้านบน (Back to Top) --- */
.back-to-top-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 50px;
  height: 50px;
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.4s, visibility 0.4s, transform 0.4s,
    background-color 0.3s;
  z-index: 1000;
}

.back-to-top-btn:hover {
  background-color: #004d28; /* เขียวเข้มขึ้น */
}

.back-to-top-btn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* --- 9. Scroll Reveal Animation --- */
.reveal {
  position: relative;
  transform: translateY(50px);
  opacity: 0;
  transition: all 1s ease;
}

.reveal.active {
  transform: translateY(0);
  opacity: 1;
}

/* --- 10. Responsive Design (สำหรับมือถือ) --- */
@media (max-width: 992px) {
  .video-content-layout,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .intro-text-content {
    order: 2;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .section {
    padding: 60px 0;
  }

  .section-title {
    font-size: 2rem;
  }

  .intro-text-content h1 {
    font-size: 2.2rem;
  }

  .menu-toggle {
    display: block;
  }

  /* --- 10. Responsive Design (สำหรับมือถือ) --- */

  /* Breakpoint 1: สำหรับจอที่เล็กกว่า 992px (แท็บเล็ตแนวตั้งและมือถือ) */
  @media (max-width: 992px) {
    /* * เปลี่ยน Layout หลักจาก 2 คอลัมน์ให้เหลือ 1 คอลัมน์
     * เพื่อให้เนื้อหาเรียงต่อกันในแนวตั้ง ไม่เบียดกัน
    */
    .video-content-layout,
    .contact-grid {
      grid-template-columns: 1fr;
    }

    /* สลับลำดับให้รูป/วิดีโอไปอยู่ด้านล่างข้อความในหน้าจอเล็ก */

    .intro-text-content {
      order: 2;
      text-align: center; /* จัดข้อความให้อยู่ตรงกลาง */
    }
  }

  /* Breakpoint 2: สำหรับจอที่เล็กกว่า 768px (มือถือส่วนใหญ่) */
  @media (max-width: 768px) {
    .section {
      padding: 60px 0; /* ลดระยะห่างของแต่ละส่วนลง */
    }

    .section-title {
      font-size: 2rem; /* ลดขนาดฟอนต์หัวข้อหลัก */
    }

    .intro-text-content h1 {
      font-size: 2.2rem; /* ลดขนาดฟอนต์หัวข้อใหญ่ */
    }

    /* * ส่วนที่สำคัญที่สุดสำหรับเมนูบนมือถือ 
    */
    .nav-links {
      display: none; /* ซ่อนเมนูปกติ (หน้าหลัก, เกี่ยวกับเรา, ...) */
      position: absolute;
      top: 100%;
      left: 0;
      width: 100%;
      background-color: #fff;
      flex-direction: column;
      text-align: center;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }
    /* เมื่อเมนูถูกกด จะให้แสดงผลออกมา */
    .nav-links.active {
      display: flex;
    }
    .nav-links a {
      padding: 15px;
      border-bottom: 1px solid #f1f1f1;
    }

    /* แสดงปุ่ม Hamburger (ไอคอน 3 ขีด) แทนเมนูปกติ */
    .menu-toggle {
      display: block;
    }
  }
  @media (max-width: 768px) {
    .video-intro-section {
      padding-top: 110px; /* เพิ่มจาก 120px เป็น 140px เพื่อเว้นระยะจาก Navbar */
    }

    .video-wrapper {
      margin-top: 10px; /* เพิ่มระยะห่างระหว่างข้อความกับวิดีโอ */
    }
  }

  .section-bg-1 {
    background-color: #f5f9ff;
    padding: 80px 15px;
  }

  .section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #006837; /* สีเขียวเกษตร */
    text-align: center;
    margin-bottom: 1rem;
  }

  .section-description {
    text-align: center;
    font-size: 1.1rem;
    color: #6c757d; /* สีตัวหนังสือรอง */
    margin-bottom: 3rem;
    line-height: 2;
  }

  .history-box {
    background-color: #fff;
    padding: 2rem 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-left: 12px solid rgba(47, 127, 219, 0.6);
    color: #333;
  }

  .history-box .row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
  }

  .history-box .col-md-3 {
    display: flex;
    flex-direction: column;
    justify-content: center; /* จัดให้อยู่กึ่งกลางแนวตั้ง */
    align-items: center; /* จัดให้อยู่กึ่งกลางแนวนอน */
    text-align: center;
  }

  .history-box .col-md-3 img {
    width: 210px;
    height: 215px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  }

  .history-box .col-md-3 p {
    margin-top: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
  }

  .history-box .col-md-9 {
    line-height: 1.6;
    font-size: 1.05rem;
    text-align: justify;
  }

  .history-box .col-md-9 p {
    margin-bottom: 1rem;
  }

  #moreContent {
    display: none;
    margin-top: 1rem;
  }

  #moreContent img {
    max-width: 920px;
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    margin-top: 1.5rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
  }

  #readMoreBtn {
    cursor: pointer;
    font-weight: 600;
    color: #0d47a1;
    background: none;
    border: none;
    padding: 0;
    text-align: left;
  }

  #readMoreBtn:hover {
    color: #084298;
  }

  /* Responsive */
  @media (max-width: 992px) {
    .history-box .row {
      flex-direction: column;
    }

    .history-box .col-md-3,
    .history-box .col-md-9 {
      max-width: 100%;
      flex: 1 0 100%;
      text-align: center;
    }

    .history-box .col-md-9 {
      text-align: justify;
    }
  }

  @media (max-width: 576px) {
    .history-box .col-md-3 img {
      width: 160px;
      height: 165px;
    }

    .history-box .col-md-9 {
      font-size: 1rem;
    }
  }
}
/* --------- กล่องข่าวสาร --------- */

.news-card {
  transition: transform 0.3s ease;
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.news-card h5 {
  font-size: 1.2rem;
  color: #0d47a1;
  margin-bottom: 0.5rem;
}
.news-card h3 {
  font-size: 1.2rem;
  color: #0d47a1;
  margin-bottom: 0.5rem;
}

.news-card small {
  color: #607d8b;
  font-style: italic;
  display: block;
  margin-bottom: 0.5rem;
}
.news-horizontal-scroll {
  display: flex;
  overflow-x: auto;
  gap: 20px;
  padding-bottom: 10px;
  scroll-snap-type: x mandatory;
}

.news-horizontal-scroll::-webkit-scrollbar {
  height: 8px;
}
.news-horizontal-scroll::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.news-card {
  flex: 0 0 340px; /* ลดความกว้างกล่องเหลือ 240px */
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  scroll-snap-align: start;
  transition: transform 0.3s ease;
}

.news-card:hover {
  transform: translateY(-4px);
}

.news-card img {
  width: 100%;
  height: 470px; /* ลดความสูงรูปให้พอดี */
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 10px;
}

.news-card h5 {
  font-size: 1rem;
  margin-bottom: 8px;
}
.news-card small {
  color: #666;
}
.news-card p {
  font-size: 0.95rem;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .news-card {
    flex: none;
    width: 100%; /* เต็มความกว้าง container */
    margin-bottom: 20px; /* เว้นระยะห่างระหว่างข่าวแต่ละกล่อง */
  }

  .news-card:last-child {
    margin-bottom: 0; /* ไม่ต้องเว้นด้านล่างกล่องสุดท้าย */
  }

  /* ปรับความสูงรูปภาพบนมือถือ */
  .news-card img {
    height: 540px; /* ปรับเป็นความสูงที่ต้องการ */
    width: 380px;
    object-fit: cover;
  }
}


