.carousel {
  width: 100%;
  aspect-ratio: 9/6;
}

.carousel-item,
.carousel-inner {
  width: 100%;
  height: 100%;
}

.carousel-inner {
  padding-bottom: 24px;
}

.carousel-item > img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.carousel-control-prev,
.carousel-control-next {
  /* there's artefacts on the carousel controls if the prev/next has a text colour */
  color: transparent;
}

.carousel-control-prev > i,
.carousel-control-next > i {
  /* unfortunately there's no 'intensity' param for drop shadow... */
  /* thus the shadow is made more intense by duping it */
  filter: drop-shadow(0 0 0.37px black) drop-shadow(0 0 0.37px black)
    drop-shadow(0 0 0.37px black) drop-shadow(0 0 0.37px black)
    drop-shadow(0 0 0.37px black) drop-shadow(0 0 0.37px black)
    drop-shadow(0 0 0.37px black) drop-shadow(0 0 0.37px black)
    drop-shadow(0 0 0.37px black);
  color: white;
}

.carousel-indicators {
  display: flex;
  flex-direction: row;
  justify-content: center;
}

.carousel-indicators > button {
  width: var(--gap-small);
  height: var(--gap-micro);
  margin: 0 var(--gap-micro);
  background-color: var(--black);
  opacity: 0.2;
}

.carousel-caption {
  width: 100%;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background-color: rgba(0, 0, 0, 0.6);
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 25%;
  min-height: 4rem;
  padding: 0;
}

.carousel-caption > h5,
.carousel-caption > p {
  padding: var(--gap-micro) 0;
  margin: 0 !important;
}

.carousel-caption > h5 {
  font-size: 1.25rem;
}

.carousel-caption > p {
  font-size: 0.75rem;
}
/* Flagship Carousel Section */
.flagship-carousel-section {
  padding: 0.5rem 1rem;
  margin-bottom: 12px;
  background: linear-gradient(
    135deg,
    rgba(74, 74, 74, 0.02) 0%,
    rgba(122, 122, 122, 0.02) 100%
  );
  border-radius: 8px;
}

.flagship-carousel-section h2 {
  font-size: 1.75rem;
  color: #4a4a4a;
  margin-bottom: 1.5rem;
  text-align: center;
}

.flagship-carousel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Center last item if odd number of cards */
.flagship-carousel > .carousel-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  max-width: calc(50% - 0.75rem);
  margin: 0 auto;
}

/* Carousel Card */
.carousel-card {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.carousel-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.carousel-card-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1rem;
}

.carousel-main {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
  flex: 1 1 auto; /* allow main area to grow so footer actions can sit at bottom */
}

.carousel-content {
  flex: 1 1 auto;
}

/* Carousel Image Section */
.carousel-image-section {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 340px; /* increased width for larger image */
}

/* Carousel Image */
.carousel-image-wrapper {
  overflow: hidden;
  flex-shrink: 0;
  border-radius: 4px;
  display: block;
}

.carousel-thumbnail {
  width: 100%;
  height: 240px; /* larger height to better match card area */
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.carousel-card:hover .carousel-thumbnail {
  transform: scale(1.05);
}

/* Carousel Content */
.carousel-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.carousel-content h3 {
  font-size: 1.4rem;
  color: #4a4a4a;
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.carousel-content .short-desc {
  font-size: 0.95rem;
  color: #6a6a6a;
  line-height: 1.5;
  margin: 0 0 1rem 0;
}

/* Carousel Tags */
.carousel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.carousel-tag {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.carousel-tag:hover {
  opacity: 0.8;
}

.carousel-tag.primary-tag {
  background-color: rgba(74, 144, 226, 0.14);
  color: #4a90e2;
}

.carousel-tag.secondary-tag {
  background-color: rgba(156, 39, 176, 0.14);
  color: #9c27b0;
}

.carousel-tag.tertiary-tag {
  background-color: rgba(102, 187, 106, 0.14);
  color: #66bb6a;
}

/* Carousel Actions */
.carousel-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
}

/* Footer actions that span full width */
.footer-actions {
  border-top: 1px solid rgba(0,0,0,0.04);
  padding-top: 1rem;
  margin-top: auto; /* push footer to bottom */
  justify-content: flex-start;
  display: flex;
  gap: 0.75rem;
}

.carousel-actions .button {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  text-align: center;
  border-radius: 4px;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.carousel-actions .button.core-primary {
  background-color: #3ba9cd;
  color: white;
  text-decoration: none;
  border: none;
  cursor: pointer;
  display: inline-block;
}

.carousel-actions .button.core-primary:hover {
  background-color: #00b2ba;
}

.carousel-actions .button.core-secondary {
  background-color: #194b86;
  color: white;
  text-decoration: none;
  border: none;
  cursor: pointer;
  display: inline-block;
}

.carousel-actions .button.core-secondary:hover {
  background-color: #20293b;
}

.carousel-actions .button.disabled {
  background-color: #d0d0d0;
  color: #7a7a7a;
  cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 992px) {
  .flagship-carousel {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Remove centering on single column layout */
  .flagship-carousel > .carousel-card:last-child:nth-child(odd) {
    grid-column: 1;
    max-width: none;
    margin: 0;
  }

  .flagship-carousel-section {
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
  }

  .carousel-card-inner {
    gap: 1rem;
  }

  .carousel-main {
    flex-direction: column;
  }

  .carousel-image-section {
    width: 100%;
    order: -1;
  }

  .carousel-thumbnail {
    height: 200px;
  }

  .carousel-content h3 {
    font-size: 1.1rem;
  }
}

@media (max-width: 576px) {
  .flagship-carousel {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .flagship-carousel-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  .carousel-card-inner {
    flex-direction: column;
    gap: 1rem;
  }

  .carousel-image-section {
    width: 100%;
    order: -1;
  }

  .carousel-thumbnail {
    height: 180px;
  }

  .carousel-actions {
    flex-direction: column;
  }

  .carousel-actions .button {
    width: 100%;
  }

  .carousel-content h3 {
    font-size: 1rem;
  }
}
