/* Story Cards Section Component Styles */

.story-cards-section {
  position: relative;
  width: 100%;
  min-height: 100vh;
  background: var(--Tertiary-40, #FBF3F2);
  overflow: hidden;
  padding: 4rem 2rem;
}

.story-cards-section::before {
  content: "";
  position: absolute;
  inset: 0;
  /* background: radial-gradient(70% 70% at 50% 30%, rgba(104, 1, 68, 0.07), rgba(251, 243, 242, 0) 70%); */
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 1s ease, transform 1s ease;
  pointer-events: none;
}

.story-cards-section.is-visible::before {
  opacity: 1;
  transform: scale(1);
}

.story-cards-section-container {
  position: relative;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  min-height: calc(100vh - 8rem);
}

/* Card Base Styles */
.story-card {
  position: relative;
  margin-bottom: 4rem;
  opacity: 0;
  transform: translateY(calc(var(--card-reveal-y, 50px) + var(--card-parallax-y, 0px))) scale(var(--card-scale, 0.95));
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

.story-card.visible {
  opacity: 1;
  --card-reveal-y: 0px;
  --card-scale: 1;
}

.story-card-content {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 2.5rem;
  width: 100%;
}

/* Card 1: Left side */
.story-card-1 {
  width: 100%;
  max-width: 684px;
  margin-left: 0;
  margin-right: auto;
}

/* Card 2: Right side */
.story-card-2 {
  width: 100%;
  max-width: 513px;
  margin-left: auto;
  margin-right: 0;
  margin-top: -30%;
}

/* Card 3: Center-left */
.story-card-3 {
  width: 100%;
  max-width: 513px;
  margin-left: 0;
  margin-right: auto;
  margin-top: -25%;
}

/* Image Wrapper – bg matches section so no white shows during reveal */
.story-card-image-wrapper {
  width: 100%;
  max-width: 513px;
  height: 684px;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
  /* background-color: var(--Tertiary-40, #FBF3F2); */
}

/* Same reveal as card 3: section-colored curtain slides up */
.story-card-image-wrapper::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  /* background: var(--Tertiary-40, #FBF3F2); */
  transform: translateY(0);
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.story-card-image-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(104, 1, 68, 0.18), rgba(104, 1, 68, 0));
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.story-card-image-wrapper.revealed {
  opacity: 1;
  transform: scale(1);
}

.story-card-image-wrapper.revealed::after {
  transform: translateY(-100%);
}

.story-card-image-wrapper.revealed::before {
  opacity: 0.2;
}

/* Ensure picture/img children also use section bg (no white during load/reveal) */
/* .story-card-image-wrapper picture,
.story-card-image-wrapper img {
  background-color: var(--Tertiary-40, #FBF3F2);
} */

/* Card 1 specific image dimensions */
.story-card-1 .story-card-image-wrapper {
  max-width: 684px;
  height: 513px;
}

.story-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  /* background-color: var(--Tertiary-40, #FBF3F2); */
  filter: blur(6px) saturate(0.95);
  transform: scale(var(--image-scale, 1.02));
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.9s ease;
  will-change: transform;
}

.story-card-image.revealed {
  filter: blur(0) saturate(1);
}

.story-card-image-wrapper.revealed .story-card-image {
  animation: story-card-float 10s ease-in-out infinite;
}

@keyframes story-card-float {
  0% {
    transform: scale(var(--image-scale, 1.02)) translateY(0);
  }
  50% {
    transform: scale(var(--image-scale, 1.02)) translateY(-8px);
  }
  100% {
    transform: scale(var(--image-scale, 1.02)) translateY(0);
  }
}

/* Placeholder – bg matches section so no white shows during reveal */
.story-card-placeholder {
  width: 100%;
  max-width: 513px;
  height: 513px;
  position: relative;
  /* background-color: var(--Tertiary-40, #FBF3F2); */
  overflow: hidden;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

.story-card-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  /* background: var(--Tertiary-40, #FBF3F2); */
  transform: translateY(0);
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.story-card-placeholder.revealed {
  opacity: 1;
  transform: scale(1);
}

.story-card-placeholder.revealed::after {
  transform: translateY(-100%);
}

.story-card-placeholder-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Text Styles */
.story-card-text {
  width: 100%;
  text-align: left;
  color: #BD93AE;
  font-family: "DM Sans", sans-serif;
  font-size: 18px;
  font-style: normal;
  font-weight: 400;
  line-height: 140%; /* 25.2px */
  letter-spacing: -0.36px;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  opacity: 1;
  transform: none;
}

.story-card-text .word {
  display: inline-block;
  white-space: nowrap;
  color: #BD93AE;
  transition: color 0.22s ease;
}

.story-card-text .word.animated {
  color: var(--Primary-100, #680144);
}

/* Parallax effect classes */
.story-card.parallax-slow {
  transition: transform 0.1s ease-out;
}

.story-card.parallax-medium {
  transition: transform 0.1s ease-out;
}

.story-card.parallax-fast {
  transition: transform 0.1s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .story-cards-section *,
  .story-cards-section *::before,
  .story-cards-section *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Large screens (monitors) – grid layout for correct card positioning */
@media (min-width: 1280px) {
  .story-cards-section-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 0;
    align-items: start;
    justify-items: stretch;
  }

  .story-card {
    margin-bottom: 0;
    min-width: 0;
  }

  .story-card-1 {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    max-width: 684px;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
  }

  .story-card-2 {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    max-width: 513px;
    margin-left: 0;
    margin-right: 0;
    margin-top: 8rem;
  }

  .story-card-3 {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    max-width: 513px;
    margin-left: 0;
    margin-right: 0;
    margin-top: -12rem;
  }
}

/* Small desktop / minimized: scale cards so they don't stay big when user shrinks the window */
@media (min-width: 1025px) and (max-width: 1279px) {
  .story-cards-section-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 0;
    align-items: start;
    justify-items: stretch;
  }

  .story-card {
    margin-bottom: 0;
    min-width: 0;
  }

  .story-card-1 {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    width: min(47.5vw, 684px);
    max-width: 684px;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
  }

  .story-card-2 {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: min(35.6vw, 513px);
    max-width: 513px;
    margin-left: 0;
    margin-right: 0;
    margin-top: 8rem;
  }

  .story-card-3 {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    width: min(35.6vw, 513px);
    max-width: 513px;
    margin-left: 0;
    margin-right: 0;
    margin-top: -12rem;
  }

  .story-card-image-wrapper {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 513 / 684;
  }

  .story-card-1 .story-card-image-wrapper {
    aspect-ratio: 684 / 513;
  }

  .story-card-placeholder {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
}

/* Responsive Styles */
@media (max-width: 1024px) {
  .story-cards-section-container {
    display: block;
  }
}

@media (max-width: 1024px) {
  .story-cards-section {
    padding: 3rem 1.5rem;
  }

  .story-card {
    margin-bottom: 4rem;
  }

  .story-card-1,
  .story-card-2,
  .story-card-3 {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0;
  }

  .story-card-image-wrapper {
    max-width: 100%;
    height: auto;
    aspect-ratio: 513 / 684;
  }

  .story-card-1 .story-card-image-wrapper {
    max-width: 100%;
    height: auto;
    aspect-ratio: 684 / 513;
  }

  .story-card-placeholder {
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .story-card-text {
    font-size: 17px;
    line-height: 140%; /* 23.8px */
    letter-spacing: -0.34px;
  }
}

@media (max-width: 768px) {
  .story-cards-section {
    padding: 2rem 1rem;
  }

  .story-cards-section-container {
    min-height: auto;
  }

  .story-card {
    margin-bottom: 3rem;
    width: 100%;
  }

  .story-card-1,
  .story-card-2,
  .story-card-3 {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .story-card-content {
    gap: 2rem;
    width: 100%;
  }

  .story-card-image-wrapper {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 3 / 4;
  }

  .story-card-1 .story-card-image-wrapper {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 4 / 3;
  }

  .story-card-placeholder {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
  }

  .story-card-text {
    font-size: 16px;
    line-height: 140%; /* 22.4px */
    letter-spacing: -0.32px;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .story-cards-section {
    padding: 1.5rem 1rem;
  }

  .story-card {
    margin-bottom: 2.5rem;
    width: 100%;
  }

  .story-card-1,
  .story-card-2,
  .story-card-3 {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .story-card-content {
    gap: 1.5rem;
    width: 100%;
  }

  .story-card-image-wrapper {
    width: 100%;
    max-width: 100%;
  }

  .story-card-1 .story-card-image-wrapper {
    width: 100%;
    max-width: 100%;
  }

  .story-card-placeholder {
    width: 100%;
    max-width: 100%;
  }

  .story-card-text {
    font-size: 15px;
    line-height: 140%; /* 21px */
    letter-spacing: -0.3px;
    width: 100%;
  }
}
