/**
 * Aidem Scroll Card Flipper — dedicated styles
 *
 * Scope: .ascf-* only. No global resets. No shared-runtime overrides.
 */

/* ── Section wrapper ─────────────────────────────────────────────────────── */
.ascf-section {
  width: 100%;
  min-height: 100svh;
  position: relative;
  overflow: hidden;
}

/* ── Stage: holds all cards centred ─────────────────────────────────────── */
.ascf-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100svh;
  padding: 2rem;
  position: relative;
}

.ascf-positioner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ascf-card-gap, 2rem);
  flex-wrap: wrap;
  max-width: 100%;
  position: relative;
  transform:
    translateX(var(--ascf-stage-offset-x, 0px))
    translateY(var(--ascf-stage-offset-y, 0px));
}

/* ── Card outer wrapper ───────────────────────────────────────────────────── */
.ascf-card-wrap {
  perspective: 1200px;
  isolation: isolate;
}

/* ── The flipping card ────────────────────────────────────────────────────── */
.ascf-card {
  position: relative;
  width: 400px;
  height: 560px;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition: transform var(--ascf-flip-duration, 600ms) cubic-bezier(0.45, 0.05, 0.55, 0.95);
  will-change: transform;
}

.ascf-card.is-flipped {
  transform: rotateY(-180deg);
}

/* ── Card faces (front / back) ───────────────────────────────────────────── */
.ascf-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  border-radius: 20px;
  background-color: var(--ascf-face-bg, #16213e);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Glass utility classes (true-glass-overlay, apple-liquid-glass, apple-liquid-glass-sharp)
   force position:relative !important which breaks the absolute face stacking.
   Restore it here with higher specificity. */
.ascf-card > .ascf-face {
  position: absolute !important;
}

.ascf-face--front {
  transform: translateZ(1px);
}

.ascf-face--back {
  --ascf-face-bg: #1a1a2e;
  transform: translateZ(-1px) rotateY(180deg);
}

/* ── Background image layer ──────────────────────────────────────────────── */
.ascf-face-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  border-radius: inherit;
  transition: opacity 500ms ease;
  pointer-events: none;
  z-index: 0;
  /* opacity is set by JS — no CSS default so front face images show immediately */
}

/* ── Content body ────────────────────────────────────────────────────────── */
.ascf-face-body {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.ascf-face-body * {
  pointer-events: auto;
}

/* ── Title zone — top of card by default ─────────────────────────────────── */
/* align-items / text-align / top offset written by Elementor selectors */
.ascf-title-wrap {
  position: absolute;
  top: 32px;
  left: 32px;
  right: 32px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

/* ── Text zone — bottom of card by default ───────────────────────────────── */
/* align-items / text-align / bottom offset written by Elementor selectors */
.ascf-text-wrap {
  position: absolute;
  bottom: 32px;
  left: 32px;
  right: 32px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

/* ── Title ───────────────────────────────────────────────────────────────── */
.ascf-title {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 2.2rem);
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
  /* opacity/transform set by JS only — no hidden default so front is always visible */
}

/* ── Short text ──────────────────────────────────────────────────────────── */
.ascf-text {
  margin: 0;
  font-size: clamp(0.85rem, 1.2vw, 1.05rem);
  color: #b0b0b0;
  line-height: 1.6;
  /* opacity/transform set by JS only — no hidden default so front is always visible */
}

/* ── CRT typed cursor ────────────────────────────────────────────────────── */
.ascf-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background-color: #00ff88;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: ascf-blink 0.7s step-end infinite;
}

.ascf-cursor--done {
  animation: none;
  opacity: 0;
}

@keyframes ascf-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Editor notice (shown when < 3 cards) ────────────────────────────────── */
.ascf-editor-notice {
  padding: 20px;
  background: rgba(255, 180, 0, 0.15);
  border: 1px solid rgba(255, 180, 0, 0.4);
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

/* Tablet — stack cards vertically, reduce size */
@media (max-width: 1024px) {
  .ascf-positioner {
    flex-direction: column;
    gap: var(--ascf-card-gap, 1.5rem);
  }

  .ascf-stage {
    padding: 1.5rem;
  }

  .ascf-card {
    width: min(400px, 85vw);
    height: 480px;
  }
}

/* Mobile — full width card, shorter */
@media (max-width: 736px) {
  .ascf-positioner {
    gap: var(--ascf-card-gap, 1rem);
  }

  .ascf-stage {
    padding: 1rem;
  }

  .ascf-card {
    width: 90vw;
    height: 420px;
  }
}
