/* === Carousel Container === */
.carousel-container {
  position: relative;
  width: 100%;             /* responsive width */
  max-width: 1140px;       /* cap at 1140px */
  margin: auto;
  overflow: hidden;
  padding: 10px;
}

/* === Track === */
.carousel-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
}

/* === Items (default desktop) === */
.carousel-item {
  flex: 0 0 calc(100% / 3); /* 3 items visible by default */
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  transform: scale(0.95);
  opacity: 0.8;
  display: flex;
  flex-direction: column; /* image + title */
}

/* Image wrapper */
.carousel-item .image-wrapper {
  height: 20vh;
  position: relative;
  overflow: hidden;
}

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Title */
.carousel-item .post-title {
  text-align: center;
  background: #fff;
  padding: 6px 10px;
  font-size: 20px;
  font-weight: 600;
  border-top: 1px solid #ddd;
}

.carousel-item .post-title a {
  text-decoration: none;
  color: #222;
}

/* Category label */
.carousel-item .category-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Arrows */
.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  padding: 15px;
  cursor: pointer;
  border-radius: 30%;
  z-index: 10;
}
.arrow.left { left: 10px; }
.arrow.right { right: 10px; }

/* === Tablet (2 posts visible) === */
@media (max-width: 1024px) {
  .carousel-item {
    flex: 0 0 50%;   /* 2 items visible */
    height: 30vh;    /* give the whole item a height */
  }
  .carousel-item .image-wrapper {
    flex: 1;         /* take all available height */
    height: 100%;    /* stretch full */
  }
  .carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* no black gaps, crop instead */
    display: block;
  }
  .carousel-item .post-title {
    font-size: 13px;
    padding: 6px 8px;
  }
}

@media (max-width: 768px) {
  .carousel-item {
    flex: 0 0 100%;  /* 1 item visible */
  }
  .carousel-item .image-wrapper {
    flex: 1;
    height: 100%;
  }
  .carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .carousel-item .post-title {
    font-size: 15px;
    padding: 6px 10px;
  }
  .arrow {
    padding: 8px 10px;
  }
}
