/* Maniac Elementor Widgets — Split Cards Scroll
   Ported from the CodeGrid "split-card scroll animation". The at-rest (no-JS / editor)
   state is the merged 3-card block; assets/js/split-cards.js drives the pin, split, and
   flip on scroll. JS-animated values (gap, radius, widths, fan) arrive as data-* attrs;
   the initial outer radius is exposed to CSS via the --mew-split-radius custom property. */

.mew-split,
.mew-split *,
.mew-split *::before,
.mew-split *::after {
  box-sizing: border-box;
}

.mew-split {
  position: relative;
  width: 100%;
}

.mew-split-section {
  position: relative;
  width: 100%;
  min-height: 100svh;
  padding: 2rem;
}

/* ---------------------------------------------------------------- Intro / Outro */
.mew-split-edge {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.mew-split-edge__heading {
  margin: 0 auto;
  max-width: 30%;
}

/* --------------------------------------------------------------------- Sticky */
.mew-split-sticky {
  display: flex;
  align-items: center;
  justify-content: center;
}

.mew-split-sticky__header {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  text-align: center;
  pointer-events: none;
}

.mew-split-sticky__heading {
  position: relative;
  margin: 0;
  text-align: center;
  will-change: transform, opacity;
}

/* ----------------------------------------------------------------- Card block */
.mew-split-cards {
  position: relative;
  display: flex;
  gap: 0;
  margin: 0 auto;
  perspective: 1000px;
  transform: translateY(40px);
  will-change: width;
}

.mew-split-card {
  position: relative;
  flex: 1;
  transform-style: preserve-3d;
  transform-origin: top;
  border-radius: 0;
}

/* Merged start state: only the outer corners of the end cards are rounded. */
.mew-split-card--1 {
  border-radius: var(--mew-split-radius, 20px) 0 0 var(--mew-split-radius, 20px);
}

.mew-split-card--3 {
  border-radius: 0 var(--mew-split-radius, 20px) var(--mew-split-radius, 20px) 0;
}

.mew-split-card__front,
.mew-split-card__back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: inherit;
  overflow: hidden;
}

.mew-split-card__front {
  background-color: #1a1a1a;
}

.mew-split-card__front img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mew-split-card__back {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background-color: #2f2f2f;
  transform: rotateY(180deg);
}

.mew-split-card__index {
  position: absolute;
  top: 2rem;
  left: 2rem;
  opacity: 0.4;
}

.mew-split-card__back-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Order on the back, top to bottom: description, title, button. */
.mew-split-card__description {
  margin: 0 0 0.75em;
  max-width: 90%;
}

.mew-split-card__label {
  margin: 0;
}

.mew-split-card__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.25em;
  padding: 0.75em 1.5em;
  border-radius: 6px;
  background-color: #000;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.mew-split-card__btn:hover,
.mew-split-card__btn:focus-visible {
  text-decoration: none;
}

.mew-split-card__btn-span {
  color: #fff;
  font-weight: 500;
}

/* Editor-only notice when the card count isn't exactly 3 (mirrors Flick Cards). */
.mew-split-notice {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: 8px 12px;
  background: #fff3cd;
  color: #664d03;
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

.elementor-editor-active .mew-split-notice {
  display: block;
}

/* ---------------------------------------------------------------- Stacked / mobile.
   The scroll animation is gated on the configurable breakpoint in JS; this visual
   fallback at the 767px default keeps the layout sane without JS and on phones. */
@media (max-width: 767px) {
  .mew-split-section {
    min-height: auto;
    padding: 4rem 2rem;
  }

  .mew-split-edge__heading {
    max-width: 100%;
  }

  .mew-split-sticky {
    flex-direction: column;
  }

  .mew-split-sticky__header {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    transform: none;
    margin-bottom: 4rem;
  }

  .mew-split-cards {
    width: 100% !important;
    flex-direction: column;
    gap: 2rem;
    transform: none;
  }

  .mew-split-card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-radius: var(--mew-split-radius, 20px) !important;
  }

  /* On phones, show the labelled back faces stacked (front images flip away). */
  .mew-split-card__back {
    transform: none;
  }
}
