/* ============================================================
   Stacking Cards Section Styles
   Native Window Scroll Pattern:
   - Wrapper: height = totalCards × 100vh (scroll space)
   - Sticky Area: position:sticky; top:0; height:100vh
   - Cards: position:absolute; inset:0; stacked with z-index
   - Transform on INNER wrapper (.sc-card-inner)
   - NO overflow:auto, NO separate scroll container
   ============================================================ */

.sc-section {
  padding: 80px 0 0 0;
  background: #fff;
  overflow: visible;
  margin-bottom: -15rem;
}

.sc-header {
  text-align: center;
  margin-bottom: 60px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.sc-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  color: #1a262e;
  margin-bottom: 16px;
  line-height: 1.2;
}

.sc-subtitle {
  font-size: clamp(16px, 2vw, 20px);
  color: #6b7280;
  line-height: 1.6;
}

/* Wrapper: provides scroll space in window = totalCards × 100vh */
.sc-wrapper {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
  /* Mobile padding to prevent edge touching */
  box-sizing: border-box;
}

/* Sticky area: sticks to viewport during scroll through wrapper */
.sc-sticky-area {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  border-radius: 24px;
}

/* Individual card: ABSOLUTE, centered in sticky area, stacked via z-index */
.sc-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 100%;
  /* Fit within sticky-area (respects wrapper padding) */
  height: 60vh;
  border-radius: 24px;
  overflow: hidden;
  background: transparent;
  will-change: opacity;
  opacity: 0;
}

.sc-card[data-sc-index="0"] {
  opacity: 1;
}

/* Inner wrapper: receives ALL transforms (scale, translateY) */
.sc-card-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  /* Required for transform */
  /* transform-origin set inline: top center */
  will-change: transform;
}

/* RTL: media on right, content on left */
[dir="rtl"] .sc-card-inner {
  flex-direction: row-reverse;
}

.sc-card-media {
  flex: 0 0 50%;
  min-width: 0;
  overflow: hidden;
}

.sc-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.sc-card:hover .sc-card-media img {
  transform: scale(1.03);
}

/* ============================================================
   Cover mode: desktop/mobile images replace card content
   Full-bleed cover filling the whole card
   ============================================================ */
.sc-card-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
}

.sc-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 35px;
}

/* Desktop (default): show desktop image, hide mobile */
.sc-img-desktop,
.sc-img-both {
  display: block;
}

.sc-img-mobile {
  display: none;
}

.sc-card-content-only {
  flex: 0 0 100%;
  width: 100%;
}

.sc-card-content {
  flex: 1;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #fff;
}

.sc-card-title {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
  color: #fff;
  max-width: 100%;
}

.sc-card-desc {
  font-size: clamp(14px, 1.8vw, 18px);
  line-height: 1.7;
  opacity: 0.9;
  color: #fff;
  max-width: 100%;
}

.sc-empty {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
  font-size: 18px;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Footer with "fancy" text - after wrapper, normal flow */
.sc-footer {
  position: relative;
  height: 300px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 60px;
  max-width: 900px;
  margin: 0 auto;
}

.sc-footer-text {
  font-size: clamp(48px, 8vw, 160px);
  font-weight: 700;
  color: #ff5941;
  font-family: 'Vazirmatn', sans-serif;
  opacity: 0;
  transform: translateY(50px);
  text-align: center;
  line-height: 1;
  white-space: nowrap;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .sc-section {
    padding: 60px 0 0;
  }

  .sc-wrapper {
    padding: 0 12px;
    /* Slightly less padding on tablet */
  }

  .sc-sticky-area {
    border-radius: 20px;
  }

  .sc-card {
    border-radius: 20px;
    height: 65vh;
    /* Slightly taller on tablet */
  }

  .sc-card-inner {
    flex-direction: column;
    border-radius: 20px;
  }

  [dir="rtl"] .sc-card-inner {
    flex-direction: column;
  }

  /* Cover mode: mobile breakpoint — show mobile image, hide desktop */
  .sc-img-mobile,
  .sc-img-both {
    display: block;
  }

  .sc-img-desktop {
    display: none;
  }

  /* Fallback single-image inside cover always visible */
  .sc-card-cover .sc-img-both {
    display: block !important;
  }

  .sc-card-media {
    flex: 0 0 40%;
    min-height: 180px;
  }

  .sc-card-content {
    padding: 32px 24px;
  }

  .sc-card-title {
    font-size: clamp(20px, 4vw, 28px);
  }

  .sc-card-desc {
    font-size: clamp(13px, 3vw, 16px);
  }

  .sc-footer {
    height: 200px;
    padding-bottom: 40px;
  }
}

@media (min-width: 769px) {
  .sc-wrapper {
    max-width: 1200px;
  }

  .sc-card {
    height: auto;
    min-height: 300px;
    aspect-ratio: 16 / 9;
  }
}

.sc-sticky-area {
  border-radius: 16px;
}

.sc-card {
  border-radius: 16px;
  height: 70vh;
  /* Taller on mobile for better readability */
}

.sc-card-inner {
  border-radius: 16px;
}

.sc-card-media {
  min-height: 150px;
}

.sc-card-content {
  padding: 24px 20px;
}


/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .sc-wrapper {
    height: auto !important;
    min-height: 100vh;
  }

  .sc-sticky-area {
    position: relative;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sc-card {
    position: relative;
    transform: none !important;
    opacity: 1 !important;
    margin-bottom: 30px;
    height: auto;
    min-height: 620px;
  }

  .sc-card-inner {
    transform: none !important;
  }

  .sc-footer {
    height: auto;
    padding: 40px 0;
  }
}

/* Print styles */
@media print {
  .sc-wrapper {
    height: auto !important;
  }

  .sc-sticky-area {
    position: relative;
    height: auto;
    overflow: visible;
  }

  .sc-card {
    position: relative;
    transform: none !important;
    opacity: 1 !important;
    margin-bottom: 30px;
    page-break-inside: avoid;
    height: auto;
  }

  .sc-card-inner {
    transform: none !important;
  }
}