/* Responsive Carousel Enhancements */
/* This file provides additional responsive optimizations for the homepage carousel */

/* 16:9 Fixed Aspect Ratio Carousel */
.carousel-container {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  position: relative;
  height: 60vh; /* Fixed height of 60vh */
  max-height: 60vh; /* Maximum height set to 60vh */
}

/* Ensure carousel maintains 16:9 ratio on all devices */
@media (max-width: 640px) {
  .carousel-container {
    min-height: 200px; /* Fallback for older browsers */
  }
}

/* Extra small devices (phones, 320px and up) */
@media (min-width: 320px) and (max-width: 479px) {
  .carousel-slide h1 {
    font-size: 1.125rem; /* 18px */
    line-height: 1.3;
  }
  
  .carousel-slide p {
    font-size: 0.75rem; /* 12px */
    line-height: 1.4;
    margin-bottom: 0.75rem;
  }
  
  .carousel-slide .inline-flex {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
  }
  
  .carousel-nav {
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  }
  
  .carousel-dot {
    width: 0.875rem;
    height: 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
  }
  
  .carousel-dots {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 1.5rem;
  }
}

/* Small devices (landscape phones, 480px and up) */
@media (min-width: 480px) and (max-width: 639px) {
  .carousel-slide h1 {
    font-size: 1.25rem; /* 20px */
    line-height: 1.3;
  }
  
  .carousel-slide p {
    font-size: 0.875rem; /* 14px */
    line-height: 1.4;
    margin-bottom: 1rem;
  }
  
  .carousel-slide .inline-flex {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
}

/* Medium devices (tablets, 640px and up) */
@media (min-width: 640px) and (max-width: 767px) {
  .carousel-slide h1 {
    font-size: 1.5rem; /* 24px */
    line-height: 1.3;
  }
  
  .carousel-slide p {
    font-size: 1rem; /* 16px */
    line-height: 1.5;
    margin-bottom: 1.25rem;
  }
}

/* Large devices (desktops, 768px and up) */
@media (min-width: 768px) and (max-width: 1023px) {
  .carousel-slide h1 {
    font-size: 2rem; /* 32px */
    line-height: 1.2;
  }
  
  .carousel-slide p {
    font-size: 1.125rem; /* 18px */
    line-height: 1.5;
    margin-bottom: 1.5rem;
  }
}

/* Extra large devices (large desktops, 1024px and up) */
@media (min-width: 1024px) and (max-width: 1279px) {
  .carousel-slide h1 {
    font-size: 2.5rem; /* 40px */
    line-height: 1.2;
  }
  
  .carousel-slide p {
    font-size: 1.25rem; /* 20px */
    line-height: 1.5;
    margin-bottom: 2rem;
  }
}

/* 2XL devices (extra large desktops, 1280px and up) */
@media (min-width: 1280px) {
  .carousel-slide h1 {
    font-size: 3rem; /* 48px */
    line-height: 1.1;
  }
  
  .carousel-slide p {
    font-size: 1.5rem; /* 24px */
    line-height: 1.4;
    margin-bottom: 2.5rem;
  }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
  .carousel-slide h1 {
    font-size: 1.5rem !important;
  }
  
  .carousel-slide p {
    font-size: 1rem !important;
    margin-bottom: 0.75rem !important;
  }
  
  .carousel-slide .inline-flex {
    padding: 0.375rem 0.75rem !important;
    font-size: 0.875rem !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .carousel-nav {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }
  
  .carousel-dot {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid white;
  }
  
  .carousel-dots {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid white;
  }
  
  .carousel-slide .inline-flex {
    border: 2px solid white;
    background: rgba(0, 0, 0, 0.6);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .carousel-slide,
  .carousel-slide *,
  .carousel-nav,
  .carousel-dot {
    transition: none !important;
    animation: none !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .carousel-slide .bg-gradient-to-br {
    background: linear-gradient(to bottom right, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.6));
  }
}

/* Print styles */
@media print {
  .carousel-nav,
  .carousel-dot {
    display: none !important;
  }
  
  .carousel-slide {
    opacity: 1 !important;
    page-break-inside: avoid;
  }
}

/* Enhanced Focus styles for accessibility */
.carousel-nav:focus {
  outline: 3px solid #3b82f6;
  outline-offset: 3px;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
  background: rgba(0, 0, 0, 0.9);
  border-color: #3b82f6;
}

/* Remove focus outline for dots to avoid blue circle effect */
.carousel-dot:focus {
  outline: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.7);
}

/* Loading state */
.carousel-slide.loading {
  opacity: 0.7;
}

.carousel-slide.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2rem;
  height: 2rem;
  margin: -1rem 0 0 -1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .carousel-nav {
    background: rgba(0, 0, 0, 0.4);
    border-width: 2px;
    min-width: 3rem;
    min-height: 3rem;
  }
  
  .carousel-dot {
    border-width: 2px;
    min-width: 1rem;
    min-height: 1rem;
  }
  
  .carousel-dots {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
  }
}

/* Enhanced hover effects for devices that support hover */
@media (hover: hover) {
  .carousel-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
  }
  
  .carousel-dot:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.2);
  }
}

/* 隐藏轮播图左右导航按钮，只保留中间切换按钮 */
.carousel-nav {
  display: none !important;
}

/* 确保中间切换按钮（dots）保持可见 */
.carousel-dots {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.carousel-dot {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}
