/* =========================================================
   GLOBAL RESET
   Purpose:
   - Make width / padding calculations easier
   - Prevent layout issues across browsers
========================================================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  background: #f3f3f3;
  color: #222;
  overflow-x: hidden; /* stop horizontal scroll caused by slider */
}

/* =========================================================
   PAGE TITLE
   Purpose:
   - Blue heading section at top of page
========================================================= */
.section-title {
  background: #001176;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  padding: 24px 18px;
  margin: 0 0 25px;
}

/* =========================================================
   FILTER BAR
   Purpose:
   - Search, category, month, sort controls
========================================================= */
.filter-bar {
  max-width: 1200px;
  margin: 0 auto 30px;
  padding: 0 20px;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.filter-form input,
.filter-form select,
.filter-form button,
.reset-btn {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.filter-form input {
  min-width: 240px;
}

.filter-form button {
  background: #001176;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.reset-btn {
  background: #ffe8e8;
  color: #222;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* =========================================================
   SLIDER LAYOUT
   Structure:
   .slider-container
      .slider-btn
      .slider-window
         .news-track
            .news-page
               .news-card
      .slider-btn

   Purpose:
   - slider-window hides overflow
   - news-track moves left / right
   - each news-page is ONE full slide
========================================================= */
.slider-container {
  width: 95%;
  margin: 0 auto 40px;
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.slider-window {
  overflow: hidden;
  width: 100%;
  cursor: grab;
  user-select: none;
}

.slider-window.dragging {
  cursor: grabbing;
}

/* This is the sliding strip */
.news-track {
  display: flex;
  transition: transform 0.4s ease;
  width: 100%;
}

/* Each page fills the full visible slider width */
.news-page {
  min-width: 100%;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* desktop: 3 columns */
  gap: 20px;
  align-items: stretch;
  box-sizing: border-box;
  flex-shrink: 0; /* very important for correct sliding */
}

/* =========================================================
   CARD DESIGN
========================================================= */
.news-card {
  min-width: 0;
  background: #fff;
  border: 1px solid #ddd;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
}

.news-card a {
  text-decoration: none;
}

.news-card img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  object-position: center;
  display: block;
  margin: 0 auto 12px;
}

.meta {
  font-size: 12px;
  font-weight: 600;
  color: #1f5fd1;
  margin-bottom: 10px;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: break-word;
}

.news-title {
  margin-bottom: 5px;
  min-height: 52px;
}

.news-title a {
  color: #111;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;

  /* keep title height more consistent */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-title a:hover {
  color: #011776;
}

.desc {
  font-size: 13px;
  line-height: 1.7;
  color: #444;
  margin-bottom: 16px;
  text-align: justify;
  word-break: break-word;
  overflow-wrap: break-word;

  /* keep card heights closer to same */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;

  flex-grow: 1; /* push button to bottom */
}

.btn {
  display: inline-block;
  align-self: flex-start;
  background: #000;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  line-height: 1;
  margin-top: auto;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  background: #011776;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* =========================================================
   SLIDER BUTTONS
========================================================= */
.slider-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #000;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
  align-self: center;
}

.slider-btn:hover {
  background: #011776;
}

/* =========================================================
   MOBILE FILTER TOGGLE BUTTON
========================================================= */
.filter-toggle {
  display: none;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: #001176;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
}

#no-news{
  height: 50vh;
}

/* =========================================================
   TABLET DESIGN
   Purpose:
   - Change 3-column page to 2-column page
   - ensure img align
========================================================= */
@media (max-width: 992px) {
  .news-page {
    grid-template-columns: repeat(2, 1fr);
  }

  .news-card img {
    width: 295px !important;
    height: 220px !important;
    object-fit: cover;
    object-position: center;
    display: block;
    margin-bottom: 12px;
  }

  .news-title a {
    font-size: 22px;
  }

  .reset-btn {
    height: 43.6px;
  }
}

/* =========================================================
   MOBILE DESIGN
   Purpose:
   - 1 column layout
   - stable card height
========================================================= */
@media (max-width: 600px) {

  /* 1 column layout */
  .news-page {
    grid-template-columns: repeat(1, 1fr);
    gap: 20px;
    min-height: calc((500px * 6) + (20px * 5));
    align-content: start;
  }

  .news-card {
    height: 500px;
  }

  .news-card img {
    width: 100% !important;
    height: 220px !important;
    object-fit: cover;
    object-position: center;
    display: block;
    margin-bottom: 12px;
  }

  .section-title {
    font-size: 20px;
    padding: 18px 14px;
  }

  .filter-toggle {
    display: block;
  }

  .filter-form {
    display: none;
    flex-direction: column;
    width: 100%;
    background: #fff;
    padding: 14px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }

  .filter-form.show {
    display: flex;
  }

  .filter-form input,
  .filter-form select,
  .filter-form button,
  .reset-btn {
    width: 100%;
  }
}