/*
 * APUF Theme - Optimized Hero Slider Styles
 * 高性能轮播图样式 - 使用GPU加速
 */

/* ============================================
   Hero Slider Container
   ============================================ */

.hero-slider {
  position: relative;
  width: 100%;
  overflow: hidden;
  background-color: #f5f5f5;
  /* 添加固定高度，防止跳动 */
  height: 500px;
}

.hero-slides {
  position: relative;
  width: 100%;
  height: 100%; /* 改为100%继承父容器高度 */
  overflow: hidden;
  
  /* 启用GPU加速 */
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* ============================================
   Individual Slides
   ============================================ */

.hero-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%; /* 改为100%固定高度 */
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  
  /* 性能优化 */
  opacity: 0;
  transform: translateX(0);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  
  /* 防止动画卡顿 */
  -webkit-transform: translateZ(0);
  -moz-transform: translateZ(0);
  -ms-transform: translateZ(0);
  -o-transform: translateZ(0);
  transform: translateZ(0);
}

.hero-slide.active {
  opacity: 1;
  z-index: 2;
}

/* 渐变遮罩层 */
.hero-slide::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.1) 100%);
  z-index: 1;
  pointer-events: none;
}

/* ============================================
   Slide Content
   ============================================ */

.hero-content {
  position: relative;
  z-index: 3;
  color: #fff;
  max-width: 600px;
  padding: 40px;
  
  /* 内容动画 */
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

.hero-title {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 20px 0;
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
  
  /* 文本渲染优化 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hero-description {
  font-size: 18px;
  line-height: 1.6;
  margin: 0 0 30px 0;
  color: #fff;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
  opacity: 0.95;
}

.hero-content .btn {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ============================================
   Navigation Dots
   ============================================ */

.hero-dots {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background-color: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 50px;
}

.hero-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background-color: transparent;
  cursor: pointer;
  padding: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  
  /* 增大点击区域 */
  outline: none;
}

.hero-dot::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
}

.hero-dot:hover {
  border-color: #fff;
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.2);
}

.hero-dot.active {
  width: 28px;
  border-radius: 50px;
  background-color: #fff;
  border-color: #fff;
}

.hero-dot:focus {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 3px;
}

/* ============================================
   Navigation Arrows
   ============================================ */

.hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 50px;
  height: 50px;
  background-color: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  color: #333;
}

.hero-slider:hover .hero-arrow {
  opacity: 1;
  visibility: visible;
}

.hero-arrow-prev {
  left: 30px;
}

.hero-arrow-next {
  right: 30px;
}

.hero-arrow:hover {
  background-color: #fff;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.hero-arrow:active {
  transform: translateY(-50%) scale(0.95);
}

.hero-arrow svg {
  width: 24px;
  height: 24px;
  display: block;
}

.hero-arrow:focus {
  outline: 2px solid rgba(41, 187, 157, 0.8);
  outline-offset: 3px;
}

/* ============================================
   Loading State
   ============================================ */

.hero-slides.loading {
  background: linear-gradient(
    90deg,
    #f5f5f5 25%,
    #e8e8e8 50%,
    #f5f5f5 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ============================================
   Animations
   ============================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
  .hero-slider {
    height: 450px; /* 平板端稍微降低高度 */
  }
  
  .hero-arrow {
    width: 44px;
    height: 44px;
  }
  
  .hero-arrow-prev {
    left: 20px;
  }
  
  .hero-arrow-next {
    right: 20px;
  }
  
  .hero-content {
    padding: 30px;
  }
  
  .hero-title {
    font-size: 32px;
  }
  
  .hero-description {
    font-size: 16px;
  }
}

@media (max-width: 768px) {
  .hero-slider {
    height: 350px; /* 手机端固定高度 */
  }
  
  .hero-content {
    padding: 20px;
    max-width: 100%;
  }
  
  .hero-title {
    font-size: 28px;
    margin-bottom: 15px;
  }
  
  .hero-description {
    font-size: 15px;
    margin-bottom: 20px;
  }
  
  .hero-dots {
    bottom: 20px;
    padding: 8px 16px;
    gap: 10px;
  }
  
  .hero-dot {
    width: 8px;
    height: 8px;
  }
  
  .hero-dot.active {
    width: 24px;
  }
  
  /* 移动端隐藏箭头，使用触摸滑动 */
  .hero-arrow {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-slider {
    height: 280px; /* 超小屏幕固定高度 */
  }
  
  .hero-title {
    font-size: 24px;
  }
  
  .hero-description {
    font-size: 14px;
  }
  
  .hero-dots {
    bottom: 15px;
    padding: 6px 12px;
    gap: 8px;
  }
  
  .hero-dot {
    width: 6px;
    height: 6px;
  }
  
  .hero-dot.active {
    width: 20px;
  }
}

/* ============================================
   Accessibility
   ============================================ */

/* 为屏幕阅读器隐藏装饰性元素 */
.hero-slide::before {
  speak: none;
}

/* 跳过链接 */
.skip-slider {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 100;
  padding: 10px 20px;
  background-color: #29BB9D;
  color: #fff;
  text-decoration: none;
}

.skip-slider:focus {
  top: 0;
}

/* 暗黑模式支持 */
@media (prefers-color-scheme: dark) {
  .hero-dots {
    background-color: rgba(0, 0, 0, 0.5);
  }
  
  .hero-arrow {
    background-color: rgba(30, 30, 30, 0.9);
    color: #fff;
  }
  
  .hero-arrow:hover {
    background-color: rgba(30, 30, 30, 1);
  }
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
  .hero-slide,
  .hero-content,
  .hero-dot,
  .hero-arrow {
    animation: none;
    transition: none;
  }
  
  .hero-slide {
    transition: opacity 0.3s ease;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .hero-slide::before {
    background: linear-gradient(135deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.3) 100%);
  }
  
  .hero-dots {
    background-color: rgba(0, 0, 0, 0.8);
  }
  
  .hero-dot {
    border-width: 3px;
  }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  .hero-dots,
  .hero-arrow {
    display: none;
  }
  
  .hero-slide {
    position: static;
    page-break-inside: avoid;
  }
  
  .hero-slide::before {
    display: none;
  }
}
