/* Latest posts carousel (custom WPBakery element) */

.bd-latest-posts {
  --bd-lp-gap: 24px;
  --bd-lp-nav-size: 44px;
  width: 100%;
}

/* Header: heading left / link right */

.bd-latest-posts__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-bottom: 28px;
}

.bd-latest-posts__heading {
  margin: 0;
  font-family: var(--h1-font-family, inherit);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-content-heading, #23282d);
}

.bd-latest-posts__more {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-content-primary, #4460aa);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.bd-latest-posts__more:hover {
  color: var(--color-content-heading, #23282d);
}

.bd-latest-posts__more-arrow {
  display: inline-block;
  margin-left: 6px;
  transition: transform 0.2s ease;
}

.bd-latest-posts__more:hover .bd-latest-posts__more-arrow {
  transform: translateX(3px);
}

/* Viewport + nav buttons */

.bd-latest-posts__viewport {
  position: relative;
}

.bd-latest-posts__nav {
  position: absolute;
  /* Vertically centered on the image via JS (--bd-lp-nav-top), fallback 120px. */
  top: var(--bd-lp-nav-top, 120px);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--bd-lp-nav-size);
  height: var(--bd-lp-nav-size);
  margin-top: calc(var(--bd-lp-nav-size) / -2);
  padding: 0;
  border: 1px solid var(--color-content-border, rgba(0, 0, 0, 0.1));
  border-radius: 50%;
  background: #fff;
  color: var(--color-content-heading, #23282d);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.bd-latest-posts__nav:hover:not(:disabled) {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  transform: scale(1.05);
}

.bd-latest-posts__nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.bd-latest-posts__nav--prev {
  left: calc(var(--bd-lp-nav-size) / -2);
}

.bd-latest-posts__nav--next {
  right: calc(var(--bd-lp-nav-size) / -2);
}

/* Track: horizontal scroll-snap */

.bd-latest-posts__track {
  display: flex;
  gap: var(--bd-lp-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-behavior: smooth;
  outline-offset: 4px;
}

.bd-latest-posts__track::-webkit-scrollbar {
  display: none;
}

/* Items: one "page" = columns visible cards */

.bd-latest-posts__item {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: calc((100% - (var(--bd-lp-gap) * (var(--bd-lp-cols, 3) - 1))) / var(--bd-lp-cols, 3));
}

.bd-latest-posts--cols-2 {
  --bd-lp-cols: 2;
}

.bd-latest-posts--cols-3 {
  --bd-lp-cols: 3;
}

.bd-latest-posts--cols-4 {
  --bd-lp-cols: 4;
}

/* Card */

.bd-latest-posts__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.bd-latest-posts__thumb {
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius, 8px);
  aspect-ratio: 4 / 3;
  background: var(--color-content-bg-alt, #f0f0f0);
}

.bd-latest-posts__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.bd-latest-posts__link:hover .bd-latest-posts__thumb img {
  transform: scale(1.04);
}

.bd-latest-posts__title {
  margin: 16px 0 8px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-content-heading, #23282d);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.4em * 2);
  transition: color 0.2s ease;
}

.bd-latest-posts__link:hover .bd-latest-posts__title {
  color: var(--color-content-primary, #4460aa);
}

.bd-latest-posts__date {
  margin-top: auto;
  font-size: 13px;
  color: var(--color-content-faded, #8a8f98);
}

/* Tablet: 2 visible */

@media (max-width: 1024px) {
  .bd-latest-posts--cols-3,
  .bd-latest-posts--cols-4 {
    --bd-lp-cols: 2;
  }
}

/* Mobile: 1 visible, nav inline at the edges */

@media (max-width: 767px) {
  .bd-latest-posts {
    --bd-lp-gap: 16px;
  }

  .bd-latest-posts--cols-2,
  .bd-latest-posts--cols-3,
  .bd-latest-posts--cols-4 {
    --bd-lp-cols: 1;
  }

  .bd-latest-posts__nav--prev {
    left: 8px;
  }

  .bd-latest-posts__nav--next {
    right: 8px;
  }

  .bd-latest-posts__nav {
    background: rgba(255, 255, 255, 0.92);
  }
}
