/* ===============================
   INTERACTIVE CARDS SECTION
================================= */
.interactive-cards {
  text-align: center;
  padding: var(--section-spacing-desktop) 5%;
  position: relative;
  z-index: 2;
  max-width: 100%;
  overflow: visible;
}

.interactive-cards::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0));
  z-index: -1;
}

.interactive-cards h2 {
  margin-bottom: 12px;
}

.interactive-cards h4 {
  max-width: 900px;
  margin: 0 auto;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
}

/* ===============================
   SHARED CARD VISUALS
================================= */
.interactive-cards .card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at top center,
    rgba(212, 175, 55, 0.12),
    transparent 42%
  );
  z-index: 1;
}

.interactive-cards .card img {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
  transition: transform 0.3s ease;
}

.interactive-cards .card .overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 34%;
  padding: 18px 20px 18px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.86),
    rgba(0, 0, 0, 0.62)
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: center;
  color: #fff;
  z-index: 2;
}

.interactive-cards .card h3 {
  font-size: 1.5rem;
  margin: 0;
  line-height: 1.15;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

/* legacy hidden desc support if any old markup remains */
.interactive-cards .card .hidden-desc {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin: 0;
  line-height: 1.35;
  transition: opacity 0.3s ease, max-height 0.3s ease;
  color: rgba(255, 255, 255, 0.92);
}

/* ===============================
   DESKTOP GRID
================================= */
.interactive-cards .card:not(.stack-card) {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  cursor: pointer;
  text-decoration: none;
  max-width: 100%;
  display: block;
  border: 1px solid rgba(212, 175, 55, 0.18);
  background: #000;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  isolation: isolate;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease,
    opacity 0.25s ease;
}

.feature-cards-desktop {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  justify-content: center;
  align-items: stretch;
  margin-top: 30px;
  max-width: 100%;
  overflow: visible;
}

/* ===============================
   STACK SCENE
================================= */
.feature-cards-stack-scene {
  display: none;
  position: relative;
}

.stack-scene-pin {
  position: relative;
  width: 100%;
}

.stack-scene-shell {
  position: relative;
  width: 100%;
  min-height: auto;
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: start;
  padding-top: clamp(12px, 2.5vh, 24px);
  padding-bottom: clamp(10px, 2vh, 18px);
}

.stack-scene-copy {
  width: min(100%, 920px);
  margin: 0 auto;
  position: relative;
  z-index: 50;
}

.scroll-stack-title {
  margin: 0 0 10px 0;
}

.scroll-stack-subtitle {
  margin: 0 auto;
  max-width: 900px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
}

.stack-card-stage {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 14px auto 0;
  min-height: 420px;
  z-index: 1;
}

/* ===============================
   STACK CARDS
================================= */
.interactive-cards.is-stack-active-layout .stack-card {
  position: absolute;
  inset: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 16px;
  cursor: pointer;
  text-decoration: none;
  display: block;
  max-width: 100%;
  border: 1px solid rgba(212, 175, 55, 0.18);
  background: #000;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transform-origin: center top;
  will-change: transform, opacity;
  backface-visibility: hidden;
  pointer-events: auto;
}

.interactive-cards.is-stack-active-layout .stack-card.is-active {
  border-color: rgba(212, 175, 55, 0.36);
  box-shadow:
    0 0 24px 5px rgba(212, 175, 55, 0.18),
    0 22px 48px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.interactive-cards.is-stack-active-layout .stack-card img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.interactive-cards.is-stack-active-layout .stack-card .overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  min-height: 34%;
  padding: 20px 20px 20px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.92),
    rgba(0, 0, 0, 0.62)
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: center;
}

/* ===============================
   CARD CTA
================================= */
.card-cta {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d4af37;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  pointer-events: none;
}

/* Desktop / hover devices:
   CTA hidden by default, revealed on hover.
   No overlay height expansion. */
@media (hover: hover) and (pointer: fine) {
  .feature-cards-desktop .card .card-cta {
    opacity: 0;
    transform: translateY(6px);
    max-height: 0;
    overflow: hidden;
    margin-top: 0;
  }

  .feature-cards-desktop .card:hover {
    transform: scale(1.05);
    box-shadow:
      0 0 18px 5px rgba(212, 175, 55, 0.42),
      0 16px 38px rgba(0, 0, 0, 0.4);
    border-color: rgba(212, 175, 55, 0.42);
  }

  .feature-cards-desktop .card:hover img {
    transform: scale(1.03);
  }

  .feature-cards-desktop .card:hover .overlay {
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, 0.9),
      rgba(0, 0, 0, 0.72)
    );
  }

  .feature-cards-desktop .card:hover .card-cta {
    opacity: 1;
    transform: translateY(0);
    max-height: 32px;
    margin-top: 10px;
  }
}

/* Stack / touch / mobile:
   CTA visible by default so tap affordance is always present */
.interactive-cards.is-stack-active-layout .stack-card .card-cta {
  opacity: 1;
  transform: none;
  max-height: 32px;
  margin-top: 10px;
}

/* ===============================
   STACK MODE ENABLED
================================= */
@media (max-width: 1264px) {
  .interactive-cards.is-stack-active-layout {
    padding: var(--section-spacing-tablet) 5%;
  }

  .interactive-cards.is-stack-active-layout > .interactive-cards-heading,
  .interactive-cards.is-stack-active-layout > .interactive-cards-subheading,
  .interactive-cards.is-stack-active-layout > .feature-cards-desktop {
    display: none;
  }

  .interactive-cards.is-stack-active-layout > .feature-cards-stack-scene {
    display: block;
  }
}

/* ===============================
   TABLET
================================= */
@media (min-width: 768px) and (max-width: 1264px) {
  .stack-card-stage {
    max-width: 560px;
  }

  .interactive-cards.is-stack-active-layout .stack-card {
    border-radius: 22px;
  }

  .stack-card .overlay {
    padding: 22px 22px 22px;
  }

  .stack-card h3 {
    font-size: 1.42rem;
  }

  .stack-card .card-cta {
    font-size: 0.82rem;
  }
}

/* ===============================
   MOBILE
================================= */
@media (max-width: 767px) {
  .interactive-cards {
    padding: var(--section-spacing-mobile) var(--mobile-page-gutter);
  }

  .interactive-cards h2 {
    margin-bottom: 10px;
  }

  .interactive-cards h4,
  .scroll-stack-subtitle {
    font-size: 1rem;
    line-height: 1.55;
  }

  .stack-scene-shell {
    padding-top: clamp(10px, 2.2vh, 18px);
    padding-bottom: clamp(8px, 1.4vh, 14px);
  }

  .stack-card-stage {
    max-width: 100%;
    min-height: 360px;
    margin-top: 12px;
  }

  .interactive-cards.is-stack-active-layout .stack-card {
    border-radius: 16px;
  }

  .stack-card .overlay {
    min-height: 36%;
    padding: 16px 16px 18px;
  }

  .stack-card h3 {
    font-size: 1.2rem;
    line-height: 1.2;
  }

  .card-cta {
    margin-top: 8px;
    font-size: 0.8rem;
    opacity: 1;
    transform: none;
    max-height: 32px;
  }
}

/* ===============================
   SHORT LANDSCAPE / REDUCED MOTION
================================= */
@media (max-width: 1264px) and (max-height: 759px) and (orientation: landscape) {
  .feature-cards-stack-scene {
    display: none !important;
  }

  .feature-cards-desktop {
    display: grid !important;
  }

  .interactive-cards-heading,
  .interactive-cards-subheading {
    display: block !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .interactive-cards .card,
  .interactive-cards .card img,
  .interactive-cards .card .overlay,
  .interactive-cards .card .hidden-desc,
  .card-cta {
    transition: none !important;
  }
}
