/* CardStack Component Styles */

/* 
  BREAKPOINT SYSTEM (Reference Only)
  ----------------------------------
  Standard CSS media queries do not support CSS variables.
  These values are hardcoded below for consistency.
  
  Tablet:      768px
  Desktop:     1024px
  Desktop LG:  1280px
*/

:host {
  /* Spacing Variables */
  --card-spacing-mobile: 1rem;
  --card-spacing-tablet: 1.5rem;
  --card-spacing-desktop: 2rem;
}

/* Reset styles to isolate from Webflow's global styles */
.card-stack-section *,
.card-stack-section *::before,
.card-stack-section *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.card-stack-section {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #ffffff;
  padding: 4rem 0;
}

.card-stack-bg-text-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.1;
  pointer-events: none;
  z-index: -1;
}

.card-stack-bg-text {
  font-size: 20vw;
  font-weight: 900;
  text-transform: uppercase;
  color: #1a1a1a;
  line-height: 1;
  white-space: nowrap;
  filter: blur(4px);
}

.card-stack-container {
  position: relative;
  width: 100%;
  /* Explicit heights for card positioning (cards are position: absolute) */
  height: 120vw; /* Mobile: 2-column grid needs vertical space */
  max-height: 700px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
  z-index: 1;

  @media (min-width: 480px) {
    height: 100vw;
    max-height: 650px;
  }

  @media (min-width: 768px) {
    height: 90vw;
    max-height: 800px;
  }

  /* Desktop: single row layout needs less height */
  @media (min-width: 1024px) {
    height: 40vw;
    max-height: 700px;
  }
}

.card-stack-scroll-indicator {
  position: relative;
  animation: bounce 1s infinite;
  color: rgba(0, 0, 0, 0.3);
  font-size: 0.75rem;
  font-family: monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  z-index: 2;
  margin-top:7vw;

  @media (min-width: 480px) {
    margin-top:9vw;
  }

  @media (min-width: 768px) {
    margin-top:1rem;
  }

  @media (min-width: 970px) {
    margin-top:2.5rem;
  }

  /* Desktop: single row layout needs less height */
  @media (min-width: 1024px) {
    margin-top:0;
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

/* Card Component Wrapper & Flip Logic */

.card-wrapper {
  position: absolute;
  inset: 0;
  margin: auto;

  /* Mobile (Default < 768px) */
  width: 45vw;
  max-width: 360px;
  aspect-ratio: 3/4;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  will-change: transform;
  transform-origin: center center;

  /* 3D Context for Flip */
  perspective: 1000px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent; /* Removes tap highlight on mobile */
  user-select: none; /* Prevents text selection highlight */

  @media (min-width: 480px) {
    width: 38vw;
    max-width: 320px;
  }

  /* Tablet (>= 768px) */
  @media (min-width: 768px) {
    width: 30vw;
    max-width: 320px;
  }

  /* Desktop (>= 1024px) */
  @media (min-width: 1024px) {
    width: 20vw;
    max-width: 360px;
  }
}

.card-flipper {
  position: relative;
  width: 100% !important;
  height: 100% !important;
  min-width: 0;
  min-height: 0;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;

  &:focus {
    outline: none;
  }
}

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

/* Card Faces (Common Styles) */
.card-face {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  border-radius: 0.75rem;
  background-color: #f5f5f5;
  color: #1a1a1a;
  /* border: 1px solid rgba(0, 0, 0, 0.08); */

  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: .75rem;

  @media (min-width: 480px) {
    padding: 1.5rem;
    border-radius: 1rem;
  }

  @media (min-width: 768px) {
    padding: 1.5rem;
    border-radius: 1rem;
  }
}

/* Front Face */
.card-front {
  z-index: 2;
  transform: rotateY(0deg);
  justify-content: space-between;
  align-items: center;
}

/* Back Face */
.card-back {
  transform: rotateY(180deg);
  justify-content: space-between;
  align-items: center;
  text-align: center;
}

/* ===== FRONT CARD STYLES ===== */

/* Header - Centered Title */
.card-header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  background-color:#fff;
  width:fit-content;
  padding:0.5rem 1rem;
  border-radius: 100px;
}

.card-label-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
}

.card-title-label {
  font-size: .75rem;
  font-weight: 500;
  color: #666;
  @media (min-width: 480px) {
  font-size: .85rem;
  }
}

/* Stat Center */
.card-stat-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100%;
}

.card-stat-value {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #111;
  margin: 0;

  @media (min-width: 768px) {
    font-size: clamp(3rem, 5vw, 5rem);
  }

  @media (min-width: 1280px) {
    font-size: 5rem;
  }
}

.card-stat-subtext {
  font-size: 0.85rem;
  color: #888;
  margin-top: 0.5rem;
  font-weight: 400;

  @media (min-width: 480px) {
    margin-top: 0.75rem;
    font-size: 0.95rem;
  }
}

/* Footer - Action Button */
.card-footer-center {
  display: flex;
  justify-content: center;
  width: 100%;
}

.card-action-btn {
  border-radius: 100px;
  /* border: 1px solid rgba(0, 0, 0, 0.15); */
  border:0;
  background-color: #fff;
  color: #333;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
  padding:0.5rem .75rem;
}

.card-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.561);
  /* border-color: rgba(0, 0, 0, 0.25); */
}

/* ===== BACK CARD STYLES ===== */

/* Back Header */
.card-back-header {
  width: 100%;
}

.card-title-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #fff;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  /* border: 1px solid rgba(0, 0, 0, 0.08); */
}

/* Back Body */
.card-back-body {
  flex: 1;
  display: flex;
  align-items: center;
  width: 100%;
}

.card-description-text {
  font-size: .75rem;
  line-height: 1.5;
  color: #1a1a1a;
  font-weight: 600;
  margin: 0;

  @media (min-width: 480px) {
    font-size: 1rem;
    line-height: 1.45;
  }

  @media (min-width: 768px) {
    font-size: 1.15rem;
  }
}

/* Back Footer */
.card-back-footer {
  width: 100%;
  display: flex;
  justify-content: center;
}

.card-close-btn {
  font-size: 1rem;
  font-weight: 400;
}

