/*
 * GC Flip Card — grid of 3D flip cards, styled to match the GC Card Grid widgets.
 * Root: .gc-fc. Driven by the --fc-* custom property contract.
 * Front: brand gradient + frosted icon chip. Back: light card with blue copy.
 * Proper preserve-3d flip: perspective on the card, preserve-3d on the flipper,
 * backface-visibility hidden on both faces — no mirrored text.
 */

.gc-fc {
  --fc-cols: 4; --fc-gap: 28px; --fc-ratio: 2.15; --fc-radius: 20px; --fc-speed: 0.7s;
  --fc-card-bg: #0E1B25;
  --fc-heading: #0E1B25; --fc-eyebrow: #3D82B3; --fc-subtext: #5A6B75;
  --fc-front-bg: #5BA7DB; --fc-front-title: #FFFFFF;
  --fc-back-bg: #16232F; --fc-back-title: #FFFFFF; --fc-back-text: #C7D6E0;
  --fc-back-link: #5BA7DB; --fc-border: rgba(255, 255, 255, 0.14);
  font-family: var(--gc-font-body, "Inter", system-ui, sans-serif);
  line-height: 1.6; padding: 88px 0;
  -webkit-font-smoothing: antialiased;
}
.gc-fc *, .gc-fc *::before, .gc-fc *::after { box-sizing: border-box; }
.gc-fc-inner-wrap { width: 100%; max-width: var(--fc-max, none); margin-inline: auto; padding-inline: var(--fc-pad, 48px); }

/* ---- Header ---- */
.gc-fc-header { max-width: 640px; margin: 0 auto 48px; text-align: center; }
.gc-fc-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px;
  padding: 7px 16px; border-radius: var(--gc-radius-pill, 999px);
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-style: normal;
  background: color-mix(in srgb, var(--fc-eyebrow) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--fc-eyebrow) 30%, transparent);
  color: var(--fc-eyebrow);
}
.gc-fc-header h2 {
  font-family: var(--gc-font-heading, "Manrope", system-ui, sans-serif);
  font-weight: 800; line-height: 1.15; margin: 0 0 0.35em;
  font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.9rem);
  color: var(--fc-heading);
}
.gc-fc-header p { margin: 0; color: var(--fc-subtext); font-size: 16px; font-style: italic; }

/* ---- Grid (flex-wrap so incomplete rows centre) ---- */
.gc-fc-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--fc-gap);
}

/* Card = perspective host. Lift happens here (2D, independent of the 3D flip). */
.gc-fc-card {
  flex: 0 0 calc((100% - (var(--fc-cols) - 1) * var(--fc-gap)) / var(--fc-cols));
  perspective: 1800px;
  border-radius: var(--fc-radius);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Flipper = the rotating element */
.gc-fc-flip {
  position: relative;
  width: 100%;
  aspect-ratio: var(--fc-ratio);
  transform-style: preserve-3d;
  transform-origin: center center;
  transition: transform var(--fc-speed) cubic-bezier(0.4, 0.15, 0.2, 1);
  border-radius: var(--fc-radius);
  outline: none;
  will-change: transform;
}
.gc-fc-flip:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--fc-front-bg) 55%, transparent); }

/* Faces */
.gc-fc-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-radius: var(--fc-radius);
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* ---- Front ---- */
.gc-fc-front {
  flex-direction: column;
  gap: 16px;
  text-align: center;
  color: var(--fc-front-title);
  background:
    radial-gradient(120% 130% at 50% -10%, color-mix(in srgb, var(--fc-front-bg) 26%, transparent), transparent 62%),
    var(--fc-card-bg);
  border: 1px solid var(--fc-border);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.28), 0 0 22px color-mix(in srgb, var(--fc-front-bg) 15%, transparent);
}
.gc-fc-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px; border-radius: 50%;
  background: color-mix(in srgb, var(--fc-front-bg) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--fc-front-bg) 48%, transparent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--fc-front-bg) 30%, transparent);
  color: var(--fc-front-icon, color-mix(in srgb, var(--fc-front-bg) 72%, #ffffff));
  font-size: 1.5rem; line-height: 1;
  transition: transform 0.4s cubic-bezier(0.34, 1.4, 0.5, 1);
}
.gc-fc-icon svg { width: 1.5rem; height: 1.5rem; fill: currentColor; }
.gc-fc-front-title {
  font-family: var(--gc-font-heading, "Manrope", system-ui, sans-serif);
  font-weight: 800; font-size: 1.2rem; letter-spacing: -0.01em; color: var(--fc-front-title);
}

/* ---- Back ---- */
.gc-fc-back {
  background:
    radial-gradient(120% 130% at 50% -10%, color-mix(in srgb, var(--fc-front-bg) 20%, transparent), transparent 62%),
    var(--fc-back-bg);
  border: 1px solid var(--fc-border);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.28), 0 0 22px color-mix(in srgb, var(--fc-front-bg) 15%, transparent);
}
.gc-fc-back-inner { display: flex; flex-direction: column; gap: 10px; text-align: center; }
.gc-fc-back-title { font-family: var(--gc-font-heading, "Manrope", system-ui, sans-serif); font-weight: 800; font-size: 1.1rem; color: var(--fc-back-title); }
.gc-fc-back-text { margin: 0; color: var(--fc-back-text); font-size: 0.95rem; line-height: 1.55; }
.gc-fc-back-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: 4px; font-weight: 700; font-size: 0.9rem; text-decoration: none;
  color: var(--fc-back-link);
}
.gc-fc-back-link svg { width: 15px; height: 15px; transition: transform 0.3s ease; }
.gc-fc-back-link:hover svg { transform: translateX(4px); }

/* ---- Face orientation per axis (back pre-rotated so it reads correctly once flipped) ---- */
.gc-fc[data-axis="y"] .gc-fc-back { transform: rotateY(180deg); }
.gc-fc[data-axis="x"] .gc-fc-back { transform: rotateX(180deg); }

/* ---- Flip triggers ---- */
@media (hover: hover) {
  .gc-fc[data-trigger="hover"] .gc-fc-card:hover { transform: translateY(-6px); }
  .gc-fc[data-trigger="hover"] .gc-fc-card:hover .gc-fc-icon { transform: scale(1.08); }
  .gc-fc[data-trigger="hover"] .gc-fc-card:hover .gc-fc-face {
    border-color: color-mix(in srgb, var(--fc-front-bg) 45%, transparent);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.34), 0 0 34px color-mix(in srgb, var(--fc-front-bg) 30%, transparent);
  }
  .gc-fc[data-trigger="hover"][data-axis="y"] .gc-fc-card:hover .gc-fc-flip,
  .gc-fc[data-trigger="hover"][data-axis="y"] .gc-fc-flip:focus-visible { transform: rotateY(180deg); }
  .gc-fc[data-trigger="hover"][data-axis="x"] .gc-fc-card:hover .gc-fc-flip,
  .gc-fc[data-trigger="hover"][data-axis="x"] .gc-fc-flip:focus-visible { transform: rotateX(180deg); }
}
/* Click / tap (JS toggles .is-flipped) — also the touch fallback for hover mode */
.gc-fc[data-axis="y"] .gc-fc-flip.is-flipped { transform: rotateY(180deg); }
.gc-fc[data-axis="x"] .gc-fc-flip.is-flipped { transform: rotateX(180deg); }

/* ---- Elementor editor: unfold both faces so the card is visible + editable ---- */
.gc-fc--editor .gc-fc-flip { transform: none !important; transform-style: flat; aspect-ratio: auto; transition: none; }
.gc-fc--editor .gc-fc-face { position: relative; inset: auto; transform: none !important; -webkit-backface-visibility: visible; backface-visibility: visible; min-height: 130px; }
.gc-fc--editor .gc-fc-back { margin-top: 12px; }

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .gc-fc-card { flex-basis: calc((100% - var(--fc-gap)) / 2); }
}
@media (max-width: 640px) {
  .gc-fc { padding: 56px 0; --fc-gap: 14px; }
  .gc-fc-header { margin-bottom: 32px; }
  .gc-fc-header h2 { font-size: 1.6rem; }
  .gc-fc-header p { font-size: 15px; line-height: 1.5; }
  .gc-fc-eyebrow { margin-bottom: 12px; padding: 4px 10px; font-size: 11px; letter-spacing: 0.04em; }
  .gc-fc-inner-wrap { padding-inline: 20px; }
  .gc-fc-card { flex-basis: 100%; }
  .gc-fc-flip { aspect-ratio: 2.5; }
  .gc-fc-face { padding: 18px; }
  .gc-fc-front { gap: 12px; }
  .gc-fc-icon { width: 44px; height: 44px; font-size: 1.25rem; box-shadow: none; }
  .gc-fc-icon svg { width: 1.25rem; height: 1.25rem; }
  .gc-fc-front-title { font-size: 1.05rem; }
  .gc-fc-back-inner { gap: 8px; }
  .gc-fc-back-title { font-size: 1.05rem; }
  .gc-fc-back-text { font-size: 0.9rem; line-height: 1.5; }
}
@media (max-width: 480px) {
  .gc-fc { padding: 48px 0; }
  .gc-fc-inner-wrap { padding-inline: 16px; }
  .gc-fc-header h2 { font-size: 1.45rem; }
  .gc-fc-flip { aspect-ratio: 1.9; }
  .gc-fc-face { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .gc-fc-card, .gc-fc-flip, .gc-fc-icon { transition: none; }
}
