.crfxl-cards-widget {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 5%;
  width: 100%;
  margin: 50px auto;
  box-sizing: border-box;
  position: relative;
  -webkit-font-smoothing: antialiased;
  align-items: center;

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease-out, visibility 0s linear 0.4s;
}

.crfxl-cards-widget.is-loaded {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease-out;
}

.crfxl-cards-image-stack {
  flex: 0 1 40%;
  max-width: 500px;
  position: relative;
  order: 1;
  padding-left: 40px;
}

.crfxl-cards-content-area {
  flex: 1 1 55%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  order: 2;
  min-height: 300px;
}

.crfxl-cards-image {
  position: absolute;
  top: 0;
  left: 40px;
  width: calc(100% - 40px);
  height: 100%;
  border-radius: 8px;
  border: 4px solid transparent; 
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background-color: #eee;
  opacity: 0;
  transform-origin: center center;

  transform: translateX(100px) scale(0.8) rotate(15deg) translateZ(0);

  z-index: 1;
  backface-visibility: hidden;

  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease-out,
    box-shadow 0.5s ease-out, border-color 0.5s ease-out; /* Added border-color transition */
}
.crfxl-cards-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- NEW: Image Border Styles --- */
.crfxl-cards-border-light .crfxl-cards-image {
  border-color: #fff;
}
.crfxl-cards-border-dark .crfxl-cards-image {
  border-color: #000;
}
.crfxl-cards-border-metallic .crfxl-cards-image {
  border-color: #AEB9C4;
}
.crfxl-cards-border-natural .crfxl-cards-image {
  border-color: #eee;
}
.crfxl-cards-border-none .crfxl-cards-image {
  border-width: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); /* Softer shadow if no border */
}
/* --- END: New Styles --- */


.crfxl-cards-image.is-active {
  opacity: 1;

  transform: translateY(0) translateX(0) scale(0.92) rotate(0deg) translateZ(0);
  z-index: 8; 
  transition: transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1),
    opacity 0.6s ease-out, box-shadow 0.6s ease-out;
  transition-delay: 0.1s;
  animation: settle 0.7s ease-out forwards;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* --- UPDATED: Also change shadow for 'none' on active --- */
.crfxl-cards-border-none .crfxl-cards-image.is-active {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); /* Softer shadow if no border */
}


@keyframes settle {
  0% {
    transform: translateY(4px) translateX(4px) scale(0.88) rotate(1deg) translateZ(0);
  }
  100% {
    transform: translateY(0) translateX(0) scale(0.92) rotate(0deg) translateZ(0);
  }
}

.crfxl-cards-text-content {
  position: relative;
  min-height: 150px;
}

/* --- UPDATED: Pointed transition to the new wrapper --- */
.crfxl-cards-title-wrapper {
  margin: 0 0 1rem 0;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.4s ease-out 0.2s, transform 0.4s ease-out 0.2s;
}
/* --- NEW: Added style for the h tag inside the wrapper --- */
.crfxl-cards-title-wrapper .crfxl-cards-title {
    margin: 0; /* Remove default heading margin */
}

.crfxl-cards-description {
  margin: 0 0 1.5rem 0;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.4s ease-out 0.3s, transform 0.4s ease-out 0.3s;
}
.crfxl-cards-description p {
    margin-bottom: 1em;
}
.crfxl-cards-description p:last-child {
    margin-bottom: 0;
}
.crfxl-cards-description ul,
.crfxl-cards-description ol {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}
.crfxl-cards-description li {
  margin-bottom: 0.3em;
}

.crfxl-cards-link-wrapper {
  margin: 0;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.4s ease-out 0.4s, transform 0.4s ease-out 0.4s;
}
.crfxl-cards-link-wrapper a {
  display: inline-block;
  text-decoration: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  background: #001534;
  color: #fff;
  transition: background 0.3s ease;
}
.crfxl-cards-link-wrapper a:hover {
  background: #000e24;
}

.crfxl-cards-widget.content-active .crfxl-cards-title-wrapper,
.crfxl-cards-widget.content-active .crfxl-cards-description,
.crfxl-cards-widget.content-active .crfxl-cards-link-wrapper {
  opacity: 1;
  transform: translateY(0);
}

.crfxl-cards-count {
  color: #777;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  min-height: 1.2em;
}

.crfxl-cards-navigation {
  margin-top: 1.5rem;
  user-select: none;
  display: flex;
  gap: 0.5rem;
}

.crfxl-cards-dots {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
}

@media (max-width: 768px) {
  .crfxl-cards-widget {
    gap: 1.5rem;
    margin: 20px auto;
    padding: 0.5rem;
  }
  .crfxl-cards-image-stack,
  .crfxl-cards-content-area {
    flex-basis: 100%;
    width: 100%;
    max-width: none;
  }
  .crfxl-cards-image-stack {
    order: 1;
    min-height: 250px;
    margin-bottom: 40px;
	padding-left: 0;
  }

  .crfxl-cards-image {
    transform: translateX(50px) scale(0.8) rotate(10deg) translateZ(0);
	left: 0;
    width: 100%;
  }

  .crfxl-cards-image.is-active {
    transform: translateY(0) scale(0.95) rotate(0deg) translateZ(0);
    animation: none;
  }

  .crfxl-cards-content-area {
    order: 2;
    text-align: center;
    min-height: auto;
    padding: 0 1rem;
  }
  .crfxl-cards-navigation {
    justify-content: center;
  }
  .crfxl-cards-count {
    text-align: center;
  }

  .crfxl-cards-dots {
    bottom: -45px;
  }
}