/**
 * Carousel Component CSS
 */

/* Carousel Container */
.carousel-container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  margin-bottom: 3rem;
  overflow: hidden;
  top: -5rem;
  z-index: 1;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
  width: 100%;
}

/* Carousel Cards */
.card {
  flex: 0 0 100%;
  position: relative;
  transition: opacity 0.3s ease;
  cursor: pointer;
  display: none;
}

.card.active {
  display: block;
}

.card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Enforce fixed aspect ratios for desktop and mobile */
.card {
  aspect-ratio: 1240 / 500; /* Desktop default ratio */
}

@media (max-width: 900px) {
  .card {
    aspect-ratio: 540 / 740; /* Mobile ratio */
  }
}

/* Carousel Dots Navigation */
.dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  margin-bottom: 2rem;
  padding: 0 20px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--inbonis-color-grey02, #b9bcbe);
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  outline: none;
}

.dot:hover {
  background: var(--inbonis-color-grey02, #b9bcbe);
  transform: scale(1.1);
}

.dot.active {
  background: var(--inbonis-color-blue02, #015480);
  transform: scale(1.2);
}

/* Carousel Hover Effects */
.card:hover {
  opacity: 0.8 !important;
}

.card.show-details {
  opacity: 0.8;
}

/* Dynamic Hover Text Overlay (only when data-hover-text exists) */

.card[data-hover-text]::after {
  content: attr(data-hover-text);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--inbonis-color-blue00, #001924);
  color: var(--inbonis-color-white, #ffffff);
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
  pointer-events: none;
  width: 100%;
  text-align: center;
  border: none;
  box-sizing: border-box;
}

.card[data-hover-text]:hover::after {
  opacity: 1;
}

.card[data-hover-text].show-details::after {
  opacity: 1;
}

/* Carousel Fallback Message */
.carousel-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  background: var(--inbonis-color-grey01, #eaebec);
  border: 2px dashed var(--inbonis-color-grey02, #b9bcbe);
  border-radius: 8px;
  text-align: center;
  padding: 40px 20px;
  width: 100%;
}

.carousel-fallback p {
  color: var(--inbonis-color-grey03, #344750);
  font-size: 16px;
  margin: 0;
  font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
  .dots {
    margin-top: 15px;
    gap: 8px;
  }

  .dot {
    width: 10px;
    height: 10px;
  }

  .card[data-hover-text]::after {
    font-size: 14px;
    padding: 10px 16px;
  }

  .carousel-fallback {
    min-height: 200px;
    padding: 20px 15px;
  }

  .carousel-fallback p {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .dots {
    margin-top: 10px;
    gap: 6px;
  }

  .dot {
    width: 8px;
    height: 8px;
  }

  .card[data-hover-text]::after {
    font-size: 12px;
    padding: 8px 12px;
  }
}

/* Accessibility */
.card:focus {
  outline: 2px solid var(--inbonis-color-blue02, #015480);
  outline-offset: 2px;
}

.dot:focus {
  outline: 2px solid var(--inbonis-color-blue02, #015480);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .dot {
    border: 1px solid var(--inbonis-color-black, #000000);
  }

  .dot.active {
    background: var(--inbonis-color-black, #000000);
  }

  .card::after {
    background: var(--inbonis-color-black, #000000);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .card,
  .dot,
  .card::after {
    transition: none;
  }

  .carousel-track {
    transition: none;
  }
}

/* Print Styles */
@media print {
  .carousel-container {
    display: none;
  }
}
