/**
 * Elementor Stack Cards Animation
 * 60fps GPU-accelerated scroll-stacking styles
 */

:root {
  --stack-card-default-radius: 24px;
  --stack-card-default-shadow: 0 20px 45px -12px rgba(0, 0, 0, 0.22), 0 0 1px 1px rgba(255, 255, 255, 0.1) inset;
}

/* ==========================================================================
   1. PARENT STACK WRAPPER / CONTAINER
   ========================================================================== */

/* The parent container must have overflow: visible for CSS sticky to work in Elementor */
.stack-cards-wrapper,
.elementor-element.stack-cards-wrapper,
.elementor-element[data-stack-cards="true"],
.card-stack-section {
  position: relative !important;
  width: 100% !important;
  overflow: visible !important;
  box-sizing: border-box;
}

/* Flex layout spacing between cards before they stack */
.stack-cards-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--stack-cards-gap, 30px);
}

/* Ensure Elementor inner column wrappers don't clip */
.stack-cards-wrapper > .elementor-element,
.stack-cards-wrapper > .e-con,
.stack-cards-wrapper > .e-con-inner,
.stack-cards-wrapper > .elementor-widget-wrap {
  overflow: visible !important;
}

/* ==========================================================================
   2. STACK CARD ITEM (CONTAINER & WIDGET MODES)
   ========================================================================== */

/* Targets child containers inside an Elementor Stacking Container OR standalone widget items */
.stack-cards-wrapper > .stack-card-item,
.stack-cards-wrapper > .e-con,
.stack-cards-wrapper > .e-child,
.stack-cards-wrapper > .elementor-element-wrap > .elementor-element,
.card-stack-card {
  position: sticky !important;
  top: var(--stack-top, 90px);
  width: 100%;
  box-sizing: border-box;
  transform-origin: center top;
  will-change: transform, filter, opacity;
  transition: box-shadow 0.3s ease, filter 0.2s ease;
  margin-left: auto;
  margin-right: auto;
}

/* Default styling for standalone widget cards (if not overridden by Elementor style tab) */
.stack-card-item {
  background: #ffffff;
  border-radius: var(--stack-card-default-radius);
  box-shadow: var(--stack-card-default-shadow);
  padding: 36px;
  color: #1e293b;
  overflow: hidden;
}

/* Header bar for standalone widget card */
.stack-card-top-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.stack-card-badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.08);
  color: #0f172a;
}

.stack-card-header-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
}

.stack-card-body {
  width: 100%;
  position: relative;
}

/* ==========================================================================
   3. ACCORDION & NESTED WIDGETS INTEGRATION
   ========================================================================== */

/* Ensure Elementor Accordion widget inside card container has clean borders and padding */
.stack-card-item .elementor-accordion,
.stack-cards-wrapper .elementor-accordion,
.stack-cards-wrapper .e-con .elementor-accordion {
  width: 100%;
  overflow: visible;
}

.stack-cards-wrapper .elementor-accordion .elementor-accordion-item {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.stack-cards-wrapper .elementor-accordion .elementor-tab-title {
  padding: 16px 20px;
  font-weight: 600;
}

.stack-cards-wrapper .elementor-accordion .elementor-tab-content {
  padding: 16px 20px;
  line-height: 1.6;
}

/* ==========================================================================
   4. RESPONSIVE & MOBILE BEHAVIOR
   ========================================================================== */

@media (max-width: 767px) {
  /* When disable on mobile is active */
  .stack-cards-wrapper[data-disable-mobile="true"] > .stack-card-item,
  .stack-cards-wrapper[data-disable-mobile="true"] > .e-con,
  .stack-cards-wrapper[data-disable-mobile="true"] > .e-child,
  .stack-cards-wrapper.stack-cards-mobile-disabled > .stack-card-item,
  .stack-cards-wrapper.stack-cards-mobile-disabled > .e-con {
    position: relative !important;
    top: auto !important;
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
    margin-bottom: 24px !important;
  }

  .stack-card-item {
    padding: 24px 20px;
    border-radius: 18px;
  }
}
