/*
 * Case study overlay card (carousel Loop Item).
 *
 * Full-bleed photo, dark scrim, type on top — matches React
 * WebsiteCardGridSection cardLayout="overlay".
 */

.rq-case-study-card {
  --flex-direction: column;
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-end !important;
  min-width: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--rq-radius-brand);
  /* Fallback only when there is no photo — do not show as a solid text panel. */
  background-color: var(--rq-surface-inverse);
  scroll-margin-top: 8rem;
}

/* Do NOT include __media here — it must stay position:absolute (full-bleed). */
.rq-case-study-card > .e-con:not(.rq-case-study-card__media),
.rq-case-study-card__body {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  max-width: 100% !important;
}

/*
 * Photo plane — full card bleed. Critical for overlay: text sits ON the image
 * with only the gradient scrim, never a solid black panel.
 */
.rq-case-study-card__media,
.rq-case-study-card > .rq-case-study-card__media.e-con {
  --flex-direction: column;
  --flex-grow: 0;
  --flex-shrink: 0;
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  z-index: 0 !important;
  display: block !important;
  overflow: hidden !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  background-color: transparent !important;
  background-image: none !important;
}

.rq-case-study-card__media::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  z-index: 2;
  height: 4px;
  background-image: linear-gradient(
    135deg,
    var(--rq-logo-blue-light),
    var(--rq-logo-blue-mid) 52%,
    var(--rq-logo-blue-deep)
  );
  pointer-events: none;
}

.rq-case-study-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  /*
   * React: bg-gradient-to-t from-ink-strong/90 via-ink-strong/50 to-ink-strong/10
   * Tailwind resolves /90 /50 /10 as true alpha over the photo — same here.
   */
  background-image: linear-gradient(
    to top,
    rgb(0 0 0 / 0.9) 0%,
    rgb(0 0 0 / 0.5) 50%,
    rgb(0 0 0 / 0.1) 100%
  );
  pointer-events: none;
}

.rq-case-study-card__photo,
.rq-case-study-card__photo > .elementor-widget-container,
.rq-case-study-card__photo > .elementor-widget-container > a,
.rq-case-study-card__photo > .elementor-widget-container > figure,
.rq-case-study-card__media > .elementor-element,
.rq-case-study-card__media > .elementor-widget-image,
.rq-case-study-card__media a,
.rq-case-study-card__media figure {
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  z-index: 0;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

.rq-case-study-card__photo img,
.rq-case-study-card__media img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover !important;
  object-position: center !important;
  transition: transform 700ms ease;
}

.rq-case-study-card:hover .rq-case-study-card__photo img,
.rq-case-study-card:hover .rq-case-study-card__media img {
  transform: scale(1.04);
}

.rq-case-study-card__body {
  --flex-direction: column;
  position: relative !important;
  z-index: 2;
  display: flex !important;
  flex-direction: column !important;
  flex: 0 0 auto !important;
  margin-block-start: auto !important;
  padding: 1.5rem !important;
  /* Must stay transparent so the photo + scrim show through (React overlay). */
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

.rq-case-study-card__body.e-con,
.rq-case-study-card__body > .e-con,
.rq-case-study-card__body .elementor-element,
.rq-case-study-card__body .elementor-widget-container {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

@media (min-width: 768px) {
  .rq-case-study-card__body {
    padding: 1.75rem !important;
  }
}

.rq-case-study-card__eyebrow,
.rq-case-study-card__eyebrow > .elementor-widget-container,
.rq-case-study-card__eyebrow p {
  margin: 0 !important;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--rq-primary-foreground) 85%, transparent);
}

.rq-case-study-card__title,
.rq-case-study-card__title .elementor-heading-title {
  margin: 0.75rem 0 0 !important;
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
  color: var(--rq-primary-foreground) !important;
}

@media (min-width: 768px) {
  .rq-case-study-card__title,
  .rq-case-study-card__title .elementor-heading-title {
    font-size: 1.5rem !important;
  }
}

/*
 * Description — clamp on the widget itself (the node DevTools shows with
 * .rq-case-study-card__desc). Nested .elementor-widget-container often gets
 * Elementor display:flex and ignores -webkit-line-clamp; the widget shell
 * is the reliable target. Button clearance uses margin, not padding, so it
 * stays outside the clamp box.
 */
.rq-page .rq-case-study-card__desc,
.rq-case-study-card__desc.elementor-widget,
.rq-case-study-card__desc {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  line-clamp: 2 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin: 0.75rem 0 3rem 0 !important;
  max-width: 28rem;
  max-height: 3.25em !important; /* 2 × line-height 1.625 */
  height: 3.25em !important;
  padding: 0 !important;
  font-size: 0.875rem;
  line-height: 1.625 !important;
  color: color-mix(in oklab, var(--rq-primary-foreground) 80%, transparent);
  white-space: normal !important;
}

@media (min-width: 768px) {
  .rq-page .rq-case-study-card__desc,
  .rq-case-study-card__desc.elementor-widget,
  .rq-case-study-card__desc {
    font-size: 1rem;
  }
}

/* Flatten Elementor wrappers so text participates in the widget's line-clamp. */
.rq-case-study-card__desc > .elementor-widget-container,
.rq-case-study-card__desc .elementor-widget-container {
  display: contents !important;
  margin: 0 !important;
  padding: 0 !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

.rq-case-study-card__desc p,
.rq-case-study-card__desc .elementor-widget-container > * {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  -webkit-line-clamp: unset !important;
  line-clamp: unset !important;
}

.rq-case-study-card__tick-wrap {
  display: block;
  margin-block-start: 1.25rem;
}

.rq-case-study-card__tick {
  display: block;
  width: 2rem;
  height: 2px;
  background-image: linear-gradient(
    135deg,
    var(--rq-logo-blue-light),
    var(--rq-logo-blue-mid) 52%,
    var(--rq-logo-blue-deep)
  );
  transition: width 500ms ease;
}

.rq-case-study-card:hover .rq-case-study-card__tick {
  width: 3.5rem;
}

.rq-case-study-card__cta-wrap,
.rq-case-study-card__cta {
  position: absolute !important;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 3;
  margin: 0 !important;
  width: auto !important;
}

@media (min-width: 768px) {
  .rq-case-study-card__cta-wrap,
  .rq-case-study-card__cta {
    right: 1.75rem;
    bottom: 1.75rem;
  }
}

/* Text-editor <a> and Elementor Button widget — same white pill as React. */
.rq-case-study-card__cta a,
.rq-case-study-card__cta .elementor-button,
.rq-case-study-card__cta .elementor-button-link,
.rq-case-study-card__cta-wrap .elementor-button,
.rq-case-study-card__cta-wrap .elementor-button-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  width: auto !important;
  min-width: 0 !important;
  height: 2.25rem !important;
  min-height: 2.25rem !important;
  margin: 0 !important;
  padding: 0 1rem !important;
  border: 0 !important;
  border-radius: var(--rq-radius-brand) !important;
  background-color: var(--rq-primary-foreground) !important;
  background-image: none !important;
  box-shadow: none !important;
  color: var(--rq-ink-strong) !important;
  fill: var(--rq-ink-strong) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  letter-spacing: normal !important;
  text-decoration: none !important;
  text-transform: none !important;
  white-space: nowrap !important;
  transition: background-color 300ms ease;
}

.rq-case-study-card__cta a:hover,
.rq-case-study-card__cta .elementor-button:hover,
.rq-case-study-card__cta .elementor-button-link:hover,
.rq-case-study-card__cta-wrap .elementor-button:hover,
.rq-case-study-card__cta-wrap .elementor-button-link:hover {
  background-color: var(--rq-background) !important;
  background-image: none !important;
  color: var(--rq-ink-strong) !important;
  fill: var(--rq-ink-strong) !important;
}

.rq-case-study-card__cta .elementor-button-wrapper,
.rq-case-study-card__cta-wrap .elementor-button-wrapper {
  display: flex !important;
  width: auto !important;
  margin: 0 !important;
}

.rq-case-study-card__cta .elementor-button-content-wrapper,
.rq-case-study-card__cta-wrap .elementor-button-content-wrapper {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

.rq-case-study-card__cta .elementor-button-text,
.rq-case-study-card__cta-wrap .elementor-button-text {
  flex: none !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  color: inherit !important;
}

.rq-case-study-card__cta .elementor-button-icon,
.rq-case-study-card__cta-wrap .elementor-button-icon {
  display: inline-flex !important;
  align-items: center !important;
  margin: 0 !important;
}

.rq-case-study-card__cta i,
.rq-case-study-card__cta svg,
.rq-case-study-card__cta .elementor-button-icon i,
.rq-case-study-card__cta .elementor-button-icon svg,
.rq-case-study-card__cta-wrap .elementor-button-icon i,
.rq-case-study-card__cta-wrap .elementor-button-icon svg {
  display: block;
  width: 1rem !important;
  height: 1rem !important;
  margin: 0 !important;
  font-size: 1rem !important;
  line-height: 1 !important;
  flex-shrink: 0;
  color: inherit !important;
  fill: currentColor !important;
}
