/* Latest case studies carousel (custom WPBakery element) */

.cs-latest {
  --cs-latest-gap: 24px;
  --cs-latest-nav-size: 44px;
  --cs-latest-radius: 15px;
  width: 100%;
}

/* Header: heading left / link right */

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

.cs-latest__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);
}

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

/* Override Impreza's global .no-touch a:hover link color. */
.no-touch .cs-latest__more:hover,
.cs-latest__more:hover {
  color: var(--color-content-primary, #4460aa);
}

.cs-latest__more-arrow {
  display: inline-block;
  margin-left: 6px;
  transition: transform 0.2s ease;
}

.cs-latest__more:hover .cs-latest__more-arrow {
  transform: translateX(3px);
}

/* Viewport + nav buttons */

.cs-latest__viewport {
  position: relative;
}

.cs-latest__nav {
  position: absolute;
  /* Vertically centered on the card via JS (--cs-latest-nav-top), fallback 160px. */
  top: var(--cs-latest-nav-top, 160px);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--cs-latest-nav-size);
  height: var(--cs-latest-nav-size);
  margin-top: calc(var(--cs-latest-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;
}

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

.cs-latest__nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.cs-latest__nav--prev {
  left: calc(var(--cs-latest-nav-size) / -2);
}

.cs-latest__nav--next {
  right: calc(var(--cs-latest-nav-size) / -2);
}

/* Track: horizontal scroll-snap */

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

.cs-latest__track::-webkit-scrollbar {
  display: none;
}

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

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

.cs-latest--cols-2 {
  --cs-latest-cols: 2;
}

.cs-latest--cols-3 {
  --cs-latest-cols: 3;
}

.cs-latest--cols-4 {
  --cs-latest-cols: 4;
}

/* Card: photo fills the tile; white panel same height on every card, bottom-left */

.cs-latest__link {
  display: block;
  position: relative;
  aspect-ratio: 4 / 5;
  height: auto;
  overflow: hidden;
  border-radius: var(--cs-latest-radius);
  text-decoration: none;
  color: inherit;
  /* White so the rounded-clip antialias is the panel color, not the photo. */
  background: #fff;
}

.cs-latest__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  /* Same radius as the card; mask forces transformed imgs to clip to it. */
  border-radius: inherit;
  -webkit-mask-image: radial-gradient(#fff, #fff);
  mask-image: radial-gradient(#fff, #fff);
}

.cs-latest__media img,
.cs-latest__media .bialty-container,
.cs-latest__media .bialty-container img {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

.cs-latest__media img {
  transition: transform 0.4s ease;
}

.cs-latest__link:hover .cs-latest__media img {
  transform: scale(1.04);
}

.cs-latest__panel {
  position: absolute;
  z-index: 2;
  left: 0;
  bottom: 0;
  width: 72%;
  height: 55%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.05rem 1.05rem;
  overflow: hidden;
  background: #fff;
  border-top-left-radius: var(--cs-latest-radius);
  border-top-right-radius: var(--cs-latest-radius);
  border-bottom-right-radius: var(--cs-latest-radius);
  border-bottom-left-radius: 0;
  text-align: left;
}

.cs-latest__industry,
.cs-latest__title,
.cs-latest__excerpt,
.cs-latest__tag {
  text-align: left;
}

.cs-latest__industry {
  display: block;
  flex-shrink: 0;
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e31c79;
}

.cs-latest__title {
  margin: 0 0 0.4rem;
  flex-shrink: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  color: #1a1a1a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cs-latest__excerpt {
  margin: 0;
  flex: 0 0 auto;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #555;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-latest__tag {
  display: block;
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 0.65rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tablet: 2 visible */

@media (max-width: 1024px) {

  .cs-latest--cols-3,
  .cs-latest--cols-4 {
    --cs-latest-cols: 2;
  }
}

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

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

  .cs-latest--cols-2,
  .cs-latest--cols-3,
  .cs-latest--cols-4 {
    --cs-latest-cols: 1;
  }

  .cs-latest__nav--prev {
    left: 8px;
  }

  .cs-latest__nav--next {
    right: 8px;
  }

  .cs-latest__nav {
    background: rgba(255, 255, 255, 0.92);
  }
}
