/* Apex: Local case studies carousel
   Colours and shapes match the current site: navy #16215d, pink #ff5599,
   mint #00f5be, grey #eeeeee, 70px pill buttons, Apertura via Typekit. */

.apex-cs {
  background: #eeeeee;
  padding: 56px 0 48px;
  font-family: apertura, "Nunito Sans", sans-serif;
  color: #16215d;
}
.apex-cs__inner {
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.apex-cs__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}
.apex-cs__titles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.apex-cs__eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ff5599;
}
.apex-cs__heading {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
  color: #16215d;
}
.apex-cs__intro {
  margin: 4px 0 0;
  font-size: 17px;
  line-height: 1.6;
  color: #5f5f5f;
  max-width: 640px;
}
.apex-cs__nav {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.apex-cs__arrow {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #16215d;
  background: #ffffff;
  color: #16215d;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.apex-cs__arrow--next {
  background: #16215d;
  color: #ffffff;
}
.apex-cs__arrow:hover:not([disabled]) {
  background: #ff5599;
  border-color: #ff5599;
  color: #ffffff;
}
.apex-cs__arrow:focus-visible {
  outline: 3px solid #00f5be;
  outline-offset: 2px;
}
.apex-cs__arrow[disabled] {
  opacity: 0.35;
  cursor: default;
}

/* Track: a horizontal grid. Every card shares the same rows, so the
   tag, headline, summary and button line up across cards. */
.apex-cs__viewport {
  overflow: hidden;
}
.apex-cs__track {
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 368px;
  grid-template-rows: auto auto auto 1fr auto; /* media, meta, headline, summary, button */
  column-gap: 24px;
  row-gap: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.apex-cs__track::-webkit-scrollbar {
  display: none;
}
.apex-cs__card {
  grid-row: span 5;
  display: grid;
  grid-template-rows: subgrid;
  row-gap: 0;
  scroll-snap-align: start;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  margin: 0;
  padding: 0;
}
.apex-cs__body {
  display: contents;
}

/* Media */
.apex-cs__media {
  height: 180px;
  background: #16215d;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.apex-cs__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.apex-cs__media-fallback {
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  padding: 0 24px;
  text-align: center;
}

/* Card content rows */
.apex-cs__meta,
.apex-cs__headline,
.apex-cs__text,
.apex-cs__cta-wrap {
  padding-left: 28px;
  padding-right: 28px;
}
.apex-cs__meta {
  padding-top: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.apex-cs__company {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #16215d;
  line-height: 25px;
}
.apex-cs__tag {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #16215d;
  background: #00f5be;
  padding: 5px 10px;
  border-radius: 70px;
  white-space: nowrap;
}
.apex-cs__tag--fallback {
  background: #e0e0e0;
}
.apex-cs__headline {
  margin: 0;
  padding-top: 14px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: #16215d;
}
.apex-cs__headline--empty {
  padding-top: 0;
}
.apex-cs__text {
  margin: 0;
  padding-top: 12px;
  font-size: 15px;
  line-height: 1.6;
  color: #4a4a4a;
}
.apex-cs__cta-wrap {
  padding-top: 20px;
  padding-bottom: 28px;
}
.apex-cs__cta {
  display: inline-block;
  background: #ff5599;
  color: #ffffff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  padding: 11px 22px;
  border-radius: 70px;
  transition: background 0.15s;
}
.apex-cs__cta:hover,
.apex-cs__cta:focus-visible {
  background: #16215d;
  color: #ffffff;
}

/* Footer */
.apex-cs__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}
.apex-cs__dots {
  display: flex;
  gap: 8px;
}
.apex-cs__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c4c4c4;
}
.apex-cs__dot.is-active {
  background: #16215d;
}
.apex-cs__all {
  margin-left: auto;
  font-size: 15px;
  font-weight: 700;
  color: #16215d;
  text-decoration: underline;
}
.apex-cs__all:hover {
  color: #ff5599;
}

/* Visually hidden text for screen readers */
.apex-cs .apex-cs__sr {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Fallback for browsers without subgrid: cards stack their content */
@supports not (grid-template-rows: subgrid) {
  .apex-cs__track {
    grid-template-rows: auto;
  }
  .apex-cs__card {
    grid-row: auto;
    display: flex;
    flex-direction: column;
  }
  .apex-cs__body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
  }
  .apex-cs__text {
    flex-grow: 1;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .apex-cs {
    padding: 40px 0;
  }
  .apex-cs__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
  }
  .apex-cs__heading {
    font-size: 26px;
  }
  .apex-cs__inner {
    padding-right: 0;
  }
  .apex-cs__track {
    grid-auto-columns: 300px;
    column-gap: 16px;
    padding-right: 24px;
  }
  .apex-cs__media {
    height: 150px;
  }
  .apex-cs__meta,
  .apex-cs__headline,
  .apex-cs__text,
  .apex-cs__cta-wrap {
    padding-left: 22px;
    padding-right: 22px;
  }
  .apex-cs__meta {
    padding-top: 20px;
  }
  .apex-cs__cta-wrap {
    padding-bottom: 24px;
  }
  .apex-cs__company {
    font-size: 19px;
  }
  .apex-cs__foot {
    padding-right: 24px;
  }
  .apex-cs__nav .apex-cs__arrow {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .apex-cs__track {
    scroll-behavior: auto;
  }
}