/* SX Case Studies Cards — evidence-driven section that closes the
   narrative from Testimonials (qualitative) to WWWU (why us).
   - 3-card grid on desktop, stack on tablet/mobile.
   - Rotating brand top-border per card (green → yellow → red → blue).
   - Prominent metrics (KPIs) in the accent color of the card.
   - Client name/logo optional (NDA-safe with anonymized labels). */


.sx-cases {
  padding: 80px 0 90px;
}


/* ============================================================
   Grid — 3 cols desktop → 1 col below 992px
   ============================================================ */
.sx-cases__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  max-width: 1200px;
  margin: 44px auto 0;
}
@media (max-width: 991px) {
  .sx-cases__grid { grid-template-columns: 1fr; gap: 22px; }
}


/* ============================================================
   Card shell
   ============================================================ */
.sx-cases__card {
  --sx-cases-accent: #376CB4;

  position: relative;
  display: flex;
  flex-direction: column;
  /* Subtle top-tinted gradient (~5% of accent color) fades to white
     within 40% of the card height. Adds visual depth without stealing
     attention from the content. Fallback to solid white on browsers
     without color-mix support. */
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--sx-cases-accent) 5%, #ffffff) 0%,
    #ffffff 42%
  );
  border-radius: 16px;
  padding: 32px 28px 28px;
  box-shadow: 0 6px 22px rgba(15, 30, 60, 0.06);
  border: 1px solid rgba(15, 30, 60, 0.06);
  transition: transform 300ms ease, box-shadow 300ms ease,
              border-color 300ms ease;
  overflow: hidden;
}
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  .sx-cases__card { background: #ffffff; }
}

/* On hover the shadow tints with the accent color — each card "floats
   with its own brand light" (green / yellow / red / blue). Border also
   picks up a touch of the accent for a coordinated micro-interaction. */
.sx-cases__card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 38px color-mix(in srgb, var(--sx-cases-accent) 30%, rgba(15, 30, 60, 0.15));
  border-color: color-mix(in srgb, var(--sx-cases-accent) 25%, transparent);
}
@supports not (box-shadow: 0 0 0 color-mix(in srgb, red 10%, transparent)) {
  .sx-cases__card:hover {
    box-shadow: 0 16px 38px rgba(15, 30, 60, 0.16);
    border-color: rgba(15, 30, 60, 0.14);
  }
}

/* Top-border accent — 4px full-width stripe in the card's accent color. */
.sx-cases__card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background-color: var(--sx-cases-accent);
  z-index: 1;
}

/* Corner-fold accent — optional. Only rendered when the module's
   `show_corner_accent` field is on (adds .sx-cases--corner-on to the
   section). Diagonal-cut triangle at the top-right corner, tinted in
   the card's accent color. Default OFF for a cleaner look. */
.sx-cases--corner-on .sx-cases__card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 42px;
  height: 42px;
  background: linear-gradient(-135deg,
    var(--sx-cases-accent) 0%,
    var(--sx-cases-accent) 50%,
    transparent 50%
  );
  opacity: 0.16;
  z-index: 2;
  pointer-events: none;
  transition: opacity 300ms ease;
}
.sx-cases--corner-on .sx-cases__card:hover::after {
  opacity: 0.28;
}

/* Rotating brand accent — auto repeats every 4 cards. */
.sx-cases__card--pos-1 { --sx-cases-accent: #62BEAC; }
.sx-cases__card--pos-2 { --sx-cases-accent: #FFD760; }
.sx-cases__card--pos-3 { --sx-cases-accent: #E9465C; }
.sx-cases__card--pos-4 { --sx-cases-accent: #376CB4; }


/* ============================================================
   Header — industry tag + logo
   ============================================================ */
.sx-cases__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  min-height: 32px;
}

.sx-cases__tag {
  display: inline-block;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--sx-cases-accent);
  background-color: color-mix(in srgb, var(--sx-cases-accent) 12%, transparent);
  border-radius: 999px;
  line-height: 1.2;
}
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  .sx-cases__tag { background-color: rgba(55, 108, 180, 0.10); }
}

.sx-cases__logo {
  flex-shrink: 0;
  max-width: 90px;
  max-height: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.sx-cases__logo img {
  max-width: 100%;
  max-height: 32px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  /* Grayscale by default, back to color on card hover — matches the
     Customers module treatment for logos, keeps the section visually
     "quiet" until interaction. */
  filter: grayscale(1) contrast(1.05);
  opacity: 0.85;
  transition: filter 300ms ease, opacity 300ms ease;
}
.sx-cases__card:hover .sx-cases__logo img {
  filter: none;
  opacity: 1;
}


/* ============================================================
   Client name + headline + description
   ============================================================ */
.sx-cases__client {
  font-size: 22px;
  font-weight: 800;
  color: #12314f;
  line-height: 1.2;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
/* Anonymized clients share the same visual weight as real client names.
   Editorial responsibility to keep the anonymized label SHORT (2-4
   words) — a long descriptor phrase is a content problem, not a
   design one. Previously styled tenue/italic; that penalized the
   card visually against name-bearing peers. Removed. */
.sx-cases__headline {
  font-size: 16.5px;
  font-weight: 700;
  color: #3a4658;
  line-height: 1.35;
  margin: 0 0 12px;
}
.sx-cases__desc {
  font-size: 14.5px;
  line-height: 1.6;
  color: #4b5563;
  margin: 0 0 20px;
}
.sx-cases__desc p { margin: 0 0 8px; }
.sx-cases__desc p:last-child { margin-bottom: 0; }


/* ============================================================
   Metrics — proof laid out as tinted chips (vertical stack).
   ============================================================
   Each metric sits inside a soft-tinted pill with a colored bar
   on the left (accent color). Value on top, label below in
   uppercase — reads like a "structured trophy card", not a big
   showy number. Vertical stack keeps chips narrow so two fit
   comfortably side-by-side on a 3-column grid without labels
   getting truncated. */
.sx-cases__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 0 4px;
  margin-top: auto;
}
.sx-cases__metric {
  flex: 1 1 calc(50% - 5px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background-color: color-mix(in srgb, var(--sx-cases-accent) 9%, transparent);
  border-radius: 10px;
  border-left: 3px solid var(--sx-cases-accent);
}
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  .sx-cases__metric { background-color: rgba(55, 108, 180, 0.08); }
}
/* If only one metric is present, it takes the full row. */
.sx-cases__metric:only-child { flex: 1 1 100%; }

.sx-cases__metric-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: var(--sx-cases-accent);
  letter-spacing: -0.01em;
}
.sx-cases__metric-label {
  font-size: 11px;
  font-weight: 700;
  color: #3a4658;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  overflow-wrap: break-word;
}
/* Yellow accent needs a darker text for legibility on white bg. */
.sx-cases__card--pos-2 .sx-cases__metric-value {
  color: #8a6a00;
}


/* ============================================================
   Per-card CTA (link with arrow)
   ============================================================ */
.sx-cases__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  color: #376CB4;
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  transition: color 200ms ease;
  align-self: flex-start;
}
.sx-cases__cta:hover { color: #285791; }
.sx-cases__cta-arrow {
  width: 14px;
  height: 14px;
  transition: transform 200ms ease;
}
.sx-cases__cta:hover .sx-cases__cta-arrow { transform: translateX(3px); }


/* ============================================================
   Section-level CTA (below the grid)
   ============================================================ */
.sx-cases__section-cta-wrap {
  display: flex;
  justify-content: center;
  margin-top: 40px;
}
.sx-cases__section-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 10px;
  text-decoration: none;
  line-height: 31px;
  background-color: #376CB4;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(55, 108, 180, 0.25);
  transition: background-color 200ms ease, transform 200ms ease,
              box-shadow 200ms ease;
}
.sx-cases__section-cta:hover {
  background-color: #285791;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(55, 108, 180, 0.35);
}
.sx-cases__section-cta:hover .sx-cases__cta-arrow {
  transform: translateX(3px);
}


/* ============================================================
   Responsive tweaks
   ============================================================ */
@media (max-width: 991px) {
  .sx-cases { padding: 65px 0 75px; }
  .sx-cases__card { padding: 26px 22px; }
}
@media (max-width: 599px) {
  .sx-cases { padding: 55px 0 65px; }
  .sx-cases__client { font-size: 20px; }
  .sx-cases__metric-value { font-size: 20px; }
  .sx-cases__metric-label { font-size: 11.5px; }
  .sx-cases__metric { padding: 10px 12px; gap: 10px; }
  .sx-cases__section-cta { padding: 11px 24px; font-size: 15px; }
}


/* ============================================================
   CAROUSEL LAYOUT — 3 visible at a time with prev/next navigation.
   ============================================================
   Same vanilla-JS slider pattern used in SX Testimonials, adapted
   for cases. Grid mode above stays unchanged. */

.sx-cases__slider {
  position: relative;
  max-width: 1240px;
  margin: 44px auto 0;
  padding: 0 48px;
}

.sx-cases__viewport {
  overflow: hidden;
  cursor: grab;
}
.sx-cases__viewport.is-dragging { cursor: grabbing; }

.sx-cases__track {
  display: flex;
  flex-wrap: nowrap;
  will-change: transform;
  align-items: stretch;
}

/* Each slide wraps one case card and controls the "3 per view" width
   dynamically via JS. Padding creates the gap between cards. */
.sx-cases__slide {
  flex: 0 0 33.333%;
  max-width: 33.333%;
  padding: 4px 14px;
  box-sizing: border-box;
  display: flex;
}
.sx-cases__slide > .sx-cases__card {
  width: 100%;
}

/* --- Nav arrows --- */
.sx-cases__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  background-color: #ffffff;
  color: #376CB4;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: transform 200ms ease, background-color 200ms ease, color 200ms ease;
}
.sx-cases__nav svg { width: 20px; height: 20px; display: block; }
.sx-cases__nav:hover {
  background-color: #376CB4;
  color: #ffffff;
  transform: translateY(-50%) scale(1.08);
}
.sx-cases__nav:focus-visible {
  outline: 2px solid rgba(55, 108, 180, 0.4);
  outline-offset: 2px;
}
.sx-cases__nav--prev { left: 0; }
.sx-cases__nav--next { right: 0; }

/* --- Dots --- */
.sx-cases__dots {
  text-align: center;
  margin-top: 30px;
  line-height: 0;
}
.sx-cases__dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin: 0 5px;
  padding: 0;
  border: 0;
  background-color: #94a3b8;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 200ms ease, transform 200ms ease;
  opacity: 0.65;
}
.sx-cases__dot:hover { background-color: #64748b; opacity: 1; }
.sx-cases__dot.is-active {
  background-color: #376CB4;
  transform: scale(1.25);
  opacity: 1;
}
.sx-cases__dot:focus-visible {
  outline: 2px solid rgba(55, 108, 180, 0.4);
  outline-offset: 2px;
}

/* Responsive: 2-per-view tablet, 1-per-view mobile. Handled by JS
   updating the flex-basis on the slides, so only the slider container
   and nav sizing need tweaks here. */
@media (max-width: 991px) {
  .sx-cases__slider { padding: 0 42px; }
  .sx-cases__nav { width: 38px; height: 38px; }
  .sx-cases__slide { padding: 4px 10px; }
}
@media (max-width: 599px) {
  .sx-cases__slider { padding: 0 10px; }
  .sx-cases__nav { width: 34px; height: 34px; }
  .sx-cases__nav svg { width: 16px; height: 16px; }
  .sx-cases__slide { padding: 4px 6px; }
}
