/* app/static/css/components/carousel.css */
/* Styles for the reusable carousel component using base CSS variables */

.carousel-component {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(
    --card-image-aspect-ratio
  ); /* Use card aspect ratio by default */
  border-radius: var(--border-radius-lg); /* Default large radius */
  background-color: var(--color-gray-200); /* Placeholder background */
}

.carousel__slides {
  position: relative;
  width: 100%;
  height: 100%;
}

/* --- Carousel Slide Specific Overrides --- */
/* These rules ensure slides behave correctly within the carousel context */
.carousel-component .carousel__slide {
  position: absolute !important; /* Needs to be absolute for stacking/transitions */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  z-index: 1;
  transition:
    opacity 0.6s ease-in-out,
    visibility 0s 0.6s;
  display: flex; /* Using flex for internal layout */
  flex-direction: column;
  color: var(--card-color); /* Inherit default card text color */
}

.carousel-component .carousel__slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 10;
  transition-delay: 0s;
}
/* --- End Slide Specific Overrides --- */

/* Ensure the image container and image within the slide fill the space */
.carousel-component .carousel__slide .card__image-container {
  flex-grow: 1;
  height: 100%;
  background-color: transparent;
  aspect-ratio: unset;
  margin: 0;
  padding: 0;
  line-height: 0;
  position: relative;
  z-index: 1;
}

.carousel-component .carousel__slide .card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
}

/* Style the text content container within the slide */
.carousel-component .carousel__slide .card__content {
  /* Default: Content overlays image */
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 2;
  background: linear-gradient(rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.7) 100%);
  padding: var(--card-padding); /* Use card padding variable */
  color: var(--color-white); /* Default to white text on overlay */
  box-sizing: border-box;
  margin: 0;
  height: auto;
  flex-grow: 0;
}

/* Adjust text colors within the overlaying content */
.carousel-component .carousel__slide .card__content .card__category,
.carousel-component .carousel__slide .card__content .card__title,
.carousel-component .carousel__slide .card__content .card__title a,
.carousel-component .carousel__slide .card__content .card__description,
.carousel-component .carousel__slide .card__content .card__meta {
  color: var(--color-white);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
.carousel-component .carousel__slide .card__content .card__title a:hover {
  color: var(--color-white);
  text-decoration: underline;
}

/* --- Navigation Buttons --- */
.carousel__navigation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: var(--z-index-popover, 1060); /* Ensure buttons are high enough */
  visibility: hidden;
  opacity: 0;
  transition:
    visibility 0s 0.3s,
    opacity 0.3s ease-in-out;
}

/* Style to show navigation (can be applied by variants) */
.carousel-component--show-nav .carousel__navigation {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

.carousel__button {
  pointer-events: auto;
  background-color: rgba(0, 0, 0, 0.3);
  color: var(--color-white);
  border: none;
  border-radius: var(--border-radius-pill); /* Use pill radius */
  cursor: pointer;
  padding: var(--spacing-xs);
  margin: 0 var(--spacing-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-duration-default) ease;
  width: 40px; /* Fixed size */
  height: 40px;
}

.carousel__button:hover,
.carousel__button:focus {
  background-color: rgba(0, 0, 0, 0.6);
  outline: none;
}

.carousel__button svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Hide buttons if only one slide exists */
.carousel-component[data-slide-count="1"] .carousel__navigation {
  display: none !important;
}
