/* ================================================
   Flipable AI Cards Block
   ─────────────────────────────────────────────────
   Three cards with an ihub-card style hover effect:
   image zooms out + shrinks to top half, revealing
   a dark panel below with tags, label, desc, CTA.
   Desktop: CSS hover. Touch: JS toggles .is-flipped.
   ================================================ */

/* ════════════════════════════════
   SOLUTION CARDS ROW (top row)
   ════════════════════════════════ */

.fac-solution-card {
  position: relative;
  background: #181a20;
  border: 1px solid #8c92a6;
  border-radius: 4px;
  padding: 30px 25px 30px 30px; /* extra left padding for accent bar */
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow: hidden;
}

/* Left accent bar */
.fac-solution-card__accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--fac-sol-accent, #2ba3ff);
}

/* Icon */
.fac-solution-card__icon {
  color: #ffffff;
  flex-shrink: 0;
  line-height: 0;
}

/* Body section */
.fac-solution-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

/* Service label */
.fac-solution-card__label {
  margin: 0;
  font-family: 'TWK Lausanne', sans-serif;
  font-size: 14px;
  font-weight: 450;
  color: #ffffff;
  line-height: normal;
}

/* Headline */
.fac-solution-card__title {
  margin: 0;
  font-family: 'TWK Lausanne', sans-serif !important;
  font-size: 25px !important;
  font-weight: 450 !important;
  color: #ffffff !important;
  line-height: 1.2 !important;
}

/* Body copy */
.fac-solution-card__desc {
  flex-grow: 1;
}

.fac-solution-card__desc p {
  margin: 0 0 8px;
  font-family: 'TWK Lausanne', sans-serif;
  font-size: 18px;
  font-weight: 200;
  line-height: 27px;
  color: #ffffff;
}

.fac-solution-card__desc p:last-child {
  margin-bottom: 0;
}

.fac-solution-card__desc p + p {
  margin-top: 18px;
}

.fac-solution-card__desc strong {
  font-weight: 750;
  color: #ffffff;
}

/* CTA — solid blue (Decode / Activate) */
/* CTA — all cards use the sliding gradient (solid blue at rest, full gradient on hover) */
.fac-solution-card__cta {
  display: inline-block;
  font-family: 'TWK Lausanne', sans-serif;
  font-size: 18px;
  font-weight: 450;
  line-height: 27px;
  text-decoration: none;
  margin-top: 2px;
  background: linear-gradient(
    90deg,
    #2BA3FF  0%,
    #40DDFF 20%,
    #44EB25 40%,
    #44EB25 50%,
    #2BA3FF 50%,
    #2BA3FF 100%
  );
  background-size: 200% 100%;
  background-position: 100% center;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  transition: background-position 0.4s ease;
}

.fac-solution-card__cta:hover {
  background-position: 0% center;
}

/* ── Combined grid ordering ──
   Mobile (< 768px): natural interleaved order — sol1, flip1, sol2, flip2, sol3, flip3.
   Tablet (768px+): sol cards in row 1, flip cards in row 2, aligned by column. */

/* 3-column (1024px+): sol row 1, flip row 2 */
@media (min-width: 1024px) {
  .fac-sol-1  { order: 1; }
  .fac-flip-1 { order: 4; }
  .fac-sol-2  { order: 2; }
  .fac-flip-2 { order: 5; }
  .fac-sol-3  { order: 3; }
  .fac-flip-3 { order: 6; }

  /* Extra row gap between the two rows on desktop */
  .fac-combined-grid {
    row-gap: 20px;
  }
}

/* 2-column tablet (768–1023px): sol1+sol2 row 1, flip1+flip2 row 2, sol3+flip3 row 3 */
@media (min-width: 768px) and (max-width: 1023px) {
  .fac-sol-1  { order: 1; }
  .fac-flip-1 { order: 3; }
  .fac-sol-2  { order: 2; }
  .fac-flip-2 { order: 4; }
  .fac-sol-3  { order: 5; }
  .fac-flip-3 { order: 6; }

  .fac-combined-grid {
    row-gap: 32px;
  }

  .fac-solution-card__title {
    font-size: 22px !important;
  }

  .fac-solution-card__desc p {
    font-size: 16px;
    line-height: 24px;
  }

  .fac-solution-card__cta {
    font-size: 16px;
  }
}

/* Responsive — small tablet 600–767px (1 col) */
@media (min-width: 600px) and (max-width: 767px) {
  .fac-solution-card__title {
    font-size: 22px !important;
  }
}

/* Responsive — mobile < 600px */
@media (max-width: 599px) {
  .fac-solution-card {
    padding: 24px 20px 24px 28px;
    gap: 12px;
  }

  .fac-solution-card__icon svg {
    width: 32px;
    height: 32px;
  }

  .fac-solution-card__title {
    font-size: 20px !important;
  }

  .fac-solution-card__desc p {
    font-size: 16px;
    line-height: 24px;
  }

  .fac-solution-card__cta {
    font-size: 16px;
  }
}

/* ── Section heading ── */
.praxent_flipable-ai-cards .fac-heading {
  margin: 0;
  color: #fff;
  text-align: center;
  font-family: 'TWK Lausanne', sans-serif;
  font-size: clamp(1.75rem, 4.5vw, 3.25rem);
  font-style: normal;
  font-weight: 350;
  line-height: normal;
}

/* ── Card outer container ── */
.ai-flip-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: auto;
  aspect-ratio: 380 / 375;
  border-radius: 10px;
  cursor: pointer;
  background-color: #181a20;
  isolation: isolate;
  box-shadow: 0 0 0 1px #4e4e4e;
  transition: box-shadow 0.4s ease;
}

/* Glow activates only when the back CTA is hovered (desktop) */
.ai-flip-card:has(.ai-flip-card__back-cta:hover) {
  box-shadow:
    0 0 0 1px transparent,
    0 0 22px rgba(0, 226, 249, 0.45),
    0 0 55px rgba(43, 151, 255, 0.22);
}

/* ── Gradient border overlay (mask technique) ── */
.ai-flip-card__border {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  padding: 1px;
  background: linear-gradient(
    135deg,
    #4fec00 0%,
    #00e2f9 45%,
    #2b97ff 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 5;
}

.ai-flip-card:has(.ai-flip-card__back-cta:hover) .ai-flip-card__border {
  opacity: 1;
}

/* ── Inner — pass-through wrapper (no longer a 3D stage) ── */
.ai-flip-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ── Front face ── */
.ai-flip-card__front {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
}

/* Desktop hover: front no longer intercepts clicks revealing the back panel */
@media (hover: hover) {
  .ai-flip-card:hover .ai-flip-card__front {
    pointer-events: none;
  }
}

/* All devices: when JS has flipped the card, front must not block touches to back panel */
.ai-flip-card.is-flipped .ai-flip-card__front {
  pointer-events: none;
}

/* Image: starts zoomed-in, shrinks to top 50% on hover/flip */
.ai-flip-card__front-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.12);
  transition: transform 600ms ease-in-out, height 600ms ease-in-out;
  /* Fade the image's bottom edge so the dark card bg beneath blends in */
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}

.ai-flip-card:hover .ai-flip-card__front-img,
.ai-flip-card.is-flipped .ai-flip-card__front-img {
  transform: scale(1);
  height: 40%;
}

/* Gradient overlay — hides on hover so the dark bg behind is clean */
.ai-flip-card__front-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    -10.267deg,
    rgb(0, 0, 0) 14.699%,
    rgba(0, 0, 0, 0) 76.564%
  );
  pointer-events: none;
  transition: opacity 400ms ease;
}

.ai-flip-card:hover .ai-flip-card__front-overlay,
.ai-flip-card.is-flipped .ai-flip-card__front-overlay {
  opacity: 0;
}

/* Front stat caption — slides down and fades out on hover/flip */
.ai-flip-card__front-text {
  position: absolute;
  bottom: 28px;
  left: 28px;
  right: 28px;
  z-index: 1;
  margin: 0;
  color: #f3f3f3;
  font-family: 'TWK Lausanne', sans-serif;
  font-size: 28px;
  font-weight: 450;
  line-height: 30px;
  transition: opacity 300ms ease-in-out, transform 300ms ease-in-out;
}

.ai-flip-card:hover .ai-flip-card__front-text,
.ai-flip-card.is-flipped .ai-flip-card__front-text {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.ai-flip-card__front-text p {
  margin: 0;
  font-weight: 450;
  line-height: 30px;
}

.ai-flip-card__front-text em,
.ai-flip-card__front-text i {
  font-family: 'Tiempos Headline', serif;
  font-style: italic;
  font-weight: 400;
  color: #f3f3f3;
  line-height: 30px;
}

/* Mobile tap hint — visible only on touch devices */
.ai-flip-card__tap-hint {
  display: none;
}

/* ── Back face — panel that fades up from the bottom ── */
.ai-flip-card__back {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  /* transparent — card's #181a20 background shows through */
  background: transparent;
  padding: 16px 30px 28px 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 450ms ease-out, transform 450ms ease-out;
  z-index: 4;
  pointer-events: none;
}

.ai-flip-card:hover .ai-flip-card__back,
.ai-flip-card.is-flipped .ai-flip-card__back {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Tag pills row ── */
.ai-flip-card__tags {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.ai-flip-card__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 29px;
  padding: 6px 10px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(140, 146, 166, 0.28);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: #f3f3f3;
  font-family: 'TWK Lausanne', sans-serif;
  font-size: 15px;
  font-weight: 450;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
}

/* ── Body section (label + desc + cta) ── */
.ai-flip-card__back-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-flip-card__back-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Case study eyebrow label */
.ai-flip-card__back-label {
  margin: 0;
  color: #fff;
  font-family: 'TWK Lausanne', sans-serif;
  font-size: 14px;
  font-weight: 450;
  line-height: normal;
}

/* Body paragraph */
.ai-flip-card__back-desc {
  color: #fff;
  font-family: 'TWK Lausanne', sans-serif;
  font-size: 18px;
  font-weight: 200;
  line-height: 27px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ai-flip-card__back-desc::-webkit-scrollbar {
  display: none;
}

.ai-flip-card__back-desc p {
  margin: 0;
  color: #fff;
  font-family: 'TWK Lausanne', sans-serif;
  font-size: 18px;
  font-style: normal;
  font-weight: 200;
  line-height: 27px;
}

/* ── "Learn more" CTA ── */
.ai-flip-card__back-cta {
  display: inline-block;
  flex-shrink: 0;
  white-space: nowrap;
  font-family: 'TWK Lausanne', sans-serif;
  font-size: 18px;
  font-weight: 350;
  line-height: 1.4;
  background: linear-gradient(
    90deg,
    #2BA3FF  0%,
    #40DDFF 20%,
    #44EB25 40%,
    #44EB25 50%,
    #2BA3FF 50%,
    #2BA3FF 100%
  );
  background-size: 200% 100%;
  background-position: 100% center;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-decoration: underline;
  -webkit-text-decoration-color: rgba(43, 151, 255, 0.5);
  text-decoration-color: rgba(43, 151, 255, 0.5);
  text-underline-offset: 3px;
  transition: background-position 0.4s ease;
}

.ai-flip-card__back-cta:hover {
  background-position: 0% center;
}

/* ────────────────────────────────
   RESPONSIVE
   ──────────────────────────────── */

/* Desktop (1280px+) */
@media (min-width: 1280px) {
  .fac-solution-card {
    min-height: auto;
  }

  .ai-flip-card {
    max-height: 400px;
  }

  .ai-flip-card__back-desc,
  .ai-flip-card__back-desc p {
    font-size: 18px;
    line-height: 27px;
  }

  .ai-flip-card__back-cta {
    font-size: 18px;
  }
}

/* iPad Pro landscape (1024px – 1279px) — 3 columns, fluid */
@media (min-width: 1024px) and (max-width: 1279px) {
  .fac-solution-card {
    min-height: 260px;
    height: auto;
  }

  .ai-flip-card {
    min-height: 240px;
    max-height: 300px;
  }

  .ai-flip-card__front-text {
    font-size: clamp(20px, 2.2vw, 26px);
    line-height: 1.2;
  }

  .ai-flip-card__front-text p {
    font-size: clamp(20px, 2.2vw, 26px);
    line-height: 1.2;
  }

  .ai-flip-card__back {
    padding: 14px 22px 22px 22px;
    gap: 12px;
  }

  .ai-flip-card__back-body {
    gap: 10px;
  }

  .ai-flip-card__back-text {
    gap: 10px;
  }

  .ai-flip-card__back-label {
    font-size: 13px;
  }

  .ai-flip-card__back-desc,
  .ai-flip-card__back-desc p {
    font-size: 15px;
    line-height: 22px;
  }

  .ai-flip-card__back-cta {
    font-size: 15px;
  }
}

/* iPad Mini landscape / iPad Pro portrait (768px – 1023px) — 2 columns */
@media (min-width: 768px) and (max-width: 1023px) {
  .fac-combined-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ai-flip-card {
    /* columns are ~350–477px wide; cap height so tall viewports don't oversize */
    min-height: 340px;
    max-height: 450px;
  }

  .ai-flip-card__front-text {
    font-size: clamp(22px, 2.8vw, 28px);
    line-height: 1.25;
  }

  .ai-flip-card__front-text p {
    font-size: clamp(22px, 2.8vw, 28px);
    line-height: 1.25;
  }

  .ai-flip-card__back {
    padding: 16px 24px 24px 24px;
    gap: 14px;
  }

  .ai-flip-card__back-body {
    gap: 12px;
  }

  .ai-flip-card__back-text {
    gap: 12px;
  }

  .ai-flip-card__back-desc,
  .ai-flip-card__back-desc p {
    font-size: 16px;
    line-height: 24px;
  }

  .ai-flip-card__back-cta {
    font-size: 16px;
  }
}

/* Small tablet (600px – 767px) — 1 column */
@media (min-width: 600px) and (max-width: 767px) {
  .fac-combined-grid {
    grid-template-columns: 1fr;
  }

  .ai-flip-card {
    /* 1 column = full width → aspect-ratio makes card too tall; use fixed height */
    aspect-ratio: auto;
    height: 400px;
  }

  .ai-flip-card__front-text {
    font-size: clamp(20px, 3vw, 26px);
    line-height: 1.2;
  }

  .ai-flip-card__front-text p {
    font-size: clamp(20px, 3vw, 26px);
    line-height: 1.2;
  }

  .ai-flip-card__back {
    padding: 16px 24px 24px 24px;
    gap: 14px;
  }

  .ai-flip-card__back-body {
    gap: 12px;
  }

  .ai-flip-card__back-text {
    gap: 12px;
  }

  .ai-flip-card__back-desc,
  .ai-flip-card__back-desc p {
    font-size: 16px;
    line-height: 24px;
  }

  .ai-flip-card__back-cta {
    font-size: 16px;
  }
}

/* Mobile base (< 600px) */
@media (max-width: 599px) {
  .fac-combined-grid {
    gap: 40px;
  }

  .ai-flip-card {
    width: 100%;
    height: 80vw;
    min-height: 380px;
    max-height: 500px;
  }

  .ai-flip-card__front-text {
    font-size: clamp(18px, 5vw, 22px);
    line-height: 1.2;
    bottom: 20px;
    left: 20px;
    right: 20px;
  }

  .ai-flip-card__front-text p {
    font-size: clamp(18px, 5vw, 22px);
    line-height: 1.2;
  }

  .ai-flip-card__back {
    padding: 12px 18px 20px 18px;
    gap: 10px;
  }

  .ai-flip-card__back-body {
    gap: 8px;
  }

  .ai-flip-card__back-text {
    gap: 8px;
  }

  .ai-flip-card__back-label {
    font-size: 13px;
  }
}

/* iPhone SE / very small (< 390px) */
@media (max-width: 389px) {
  .ai-flip-card {
    height: 80vw;
    min-height: 360px;
  }
}

/* Standard / large phones (390px – 599px) */
@media (min-width: 390px) and (max-width: 599px) {
  .ai-flip-card {
    height: 80vw;
    min-height: 380px;
  }
}

/* ── Touch devices: disable CSS hover; JS handles tap via .is-flipped ── */
@media (hover: none), (pointer: coarse) {
  /* Cancel hover-triggered transitions only when NOT flipped by JS */
  .ai-flip-card:not(.is-flipped):hover .ai-flip-card__front-img {
    transform: scale(1.12);
    height: 100%;
  }

  .ai-flip-card:not(.is-flipped):hover .ai-flip-card__front-overlay {
    opacity: 1;
  }

  .ai-flip-card:not(.is-flipped):hover .ai-flip-card__front-text {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .ai-flip-card:not(.is-flipped):hover .ai-flip-card__back {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
  }

  .ai-flip-card:not(.is-flipped):hover .ai-flip-card__border {
    opacity: 0;
  }

  .ai-flip-card:not(.is-flipped):hover {
    box-shadow: 0 0 0 1px #4e4e4e;
  }

  /* Show "Tap to learn more" hint on front face */
  .ai-flip-card__tap-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    color: rgba(255, 255, 255, 0.65);
    font-family: 'TWK Lausanne', sans-serif;
    font-size: 12px;
    font-weight: 350;
    letter-spacing: 0.04em;
    pointer-events: none;
    transition: opacity 300ms ease;
  }

  .ai-flip-card__tap-hint svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.65;
  }

  /* Pulse the hint to draw attention on first load */
  @keyframes fac-hint-pulse {
    0%, 100% { opacity: 0.65; }
    50%       { opacity: 1; }
  }

  .ai-flip-card__tap-hint {
    animation: fac-hint-pulse 2s ease-in-out 3;
  }

  /* Once flipped, hide the hint */
  .ai-flip-card.is-flipped .ai-flip-card__tap-hint {
    opacity: 0;
    pointer-events: none;
  }
}
