/* 响应式设计 - 移动端优化 */

/* ================================
   桌面端 (≥1280px)
================================ */

@media (min-width: 1280px) {
  .section-container {
    padding: 0 var(--space-8);
  }
  
  .hero-title {
    font-size: var(--text-6xl);
  }
  
  .photo-gallery-3d {
    gap: var(--space-12);
  }
  
  .details-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ================================
   平板横屏 (1024px - 1279px)
================================ */

@media (min-width: 1024px) and (max-width: 1279px) {
  .hero-title {
    font-size: var(--text-5xl);
  }
  
  .couple-cards {
    gap: var(--space-8);
  }
  
  .photo-gallery-3d {
    gap: var(--space-6);
  }
  
  .photo-card {
    width: 240px;
    height: 320px;
  }
}

/* ================================
   平板竖屏 (768px - 1023px)
================================ */

@media (min-width: 768px) and (max-width: 1023px) {
  .hero-title {
    font-size: var(--text-4xl);
  }
  
  .hero-date-container {
    margin-bottom: var(--space-8);
  }
  
  .couple-cards {
    grid-template-columns: 1fr;
    gap: var(--space-8);
    max-width: 500px;
  }
  
  .couple-connection {
    order: 2;
    margin: var(--space-6) 0;
  }
  
  .groom-card {
    order: 1;
  }
  
  .bride-card {
    order: 3;
  }
  
  .connection-line {
    width: 60px;
    height: 2px;
  }
  
  .timeline-content {
    width: calc(100% - 80px);
    margin-left: 80px !important;
    margin-right: 0 !important;
  }
  
  .timeline-marker {
    left: 30px;
    transform: translateX(0);
  }
  
  .timeline-line {
    left: 30px;
    transform: translateX(0);
  }
  
  .photo-gallery-3d {
    flex-direction: column;
    gap: var(--space-6);
  }
  
  .photo-card {
    width: 100%;
    max-width: 400px;
    height: 300px;
    margin: 0 auto;
  }
  
  .photo-card:nth-child(2) {
    transform: none;
    order: -1;
  }
  
  .details-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .contact-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ================================
   大屏手机 (480px - 767px)
================================ */

@media (min-width: 480px) and (max-width: 767px) {
  /* 隐藏导航栏 */
  .navigation {
    display: none !important;
  }
  
  /* 音乐控制器移动到右上角 */
  .audio-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    bottom: auto;
    left: auto;
    z-index: 1000;
    flex-direction: row;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 8px 16px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  }
  
  .audio-controls .audio-button {
    width: 40px;
    height: 40px;
    margin: 0;
    margin-right: 10px;
    font-size: 18px;
  }
  
  .audio-controls .volume-slider {
    width: 60px;
    margin: 0;
  }
  section {
    padding: var(--space-24) 0;
  }
  
  .section-container {
    padding: 0 var(--space-3);
  }
  
  .hero-title {
    font-size: var(--text-3xl);
  }
  
  .hero-content {
    padding: 0 var(--space-3);
  }
  
  .typewriter-text {
    font-size: var(--text-lg);
  }
  
  .save-date-badge {
    padding: var(--space-4) var(--space-6);
  }
  
  .wedding-date {
    font-size: var(--text-xl);
  }
  
  .couple-cards {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  
  .card-3d-container {
    height: 350px;
  }
  
  .card-image {
    width: 120px;
    height: 120px;
  }
  
  .card-name {
    font-size: var(--text-xl);
  }
  
  .timeline-content {
    width: calc(100% - 70px);
    margin-left: 70px !important;
    padding: var(--space-4);
  }
  
  .timeline-marker {
    left: 20px;
    width: 50px;
    height: 50px;
  }
  
  .timeline-line {
    left: 20px;
  }
  
  .marker-icon {
    font-size: var(--text-lg);
  }
  
  .photo-gallery-3d {
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-8) 0;
  }
  
  .photo-card {
    width: 100%;
    height: 280px;
    transform: none !important;
  }
  
  .details-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  
  .countdown-timer {
    flex-wrap: wrap;
    gap: var(--space-3);
  }
  
  .countdown-item {
    min-width: 45px;
  }
  
  .countdown-number {
    font-size: var(--text-lg);
    padding: var(--space-1) var(--space-2);
    min-width: 45px;
  }
  
  .location-actions {
    flex-direction: column;
  }
  
  .contact-grid {
    grid-template-columns: 1fr;
  }
  
  .action-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .action-btn {
    width: 200px;
  }
}

/* ================================
   小屏手机 (≤479px)
================================ */

@media (max-width: 479px) {
  :root {
    --space-unit: 0.2rem; /* 减少基础间距 */
  }
  
  section {
    padding: var(--space-20) 0;
  }
  
  .section-container {
    padding: 0 var(--space-3); /* 增加左右边距，避免内容贴边 */
  }
  
  .section-title {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-3);
  }
  
  .section-subtitle {
    font-size: var(--text-base);
    margin-bottom: var(--space-4);
  }
  
  .section-header {
    margin-bottom: var(--space-12);
  }
  
  /* 英雄区移动端优化 */
  .hero-title {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-4);
  }
  
  .heart-symbol {
    margin: 0 var(--space-2);
    font-size: var(--text-2xl);
  }
  
  .typewriter-text {
    font-size: var(--text-base);
  }
  
  .save-date-badge {
    padding: var(--space-3) var(--space-4);
  }
  
  .save-the-date {
    font-size: var(--text-base);
  }
  
  .wedding-date {
    font-size: var(--text-lg);
  }
  
  .wedding-time {
    font-size: var(--text-sm);
  }
  
  .scroll-indicator {
    bottom: 20px;
  }
  
  .scroll-text {
    font-size: var(--text-base);
  }
  
  /* 导航移动端 - 隐藏 */
  .navigation {
    display: none !important;
  }
  
  /* 主内容区域上移，填补隐藏导航栏的空间 */
  .main-container {
    margin-top: 0;
    padding-top: 0;
  }
  
  /* 音乐控制器移动到右上角 */
  .audio-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    bottom: auto;
    left: auto;
    z-index: 1000;
    flex-direction: row;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 8px 16px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  }
  
  .audio-controls .audio-button {
    width: 40px;
    height: 40px;
    margin: 0;
    margin-right: 10px;
    font-size: 18px;
  }
  
  .audio-controls .volume-slider {
    width: 60px;
    margin: 0;
  }
  
  /* 原有导航样式注释掉 */
  /* .navigation {
    height: 70px; /* 增加导航栏高度，提升触摸体验 */
  }
  
  .nav-container {
    height: 70px;
    padding: 0 var(--space-3);
  }
  
  .nav-logo {
    font-size: var(--text-xl);
  }
  
  /* 确保移动端菜单项有足够的触摸目标大小 */
  .nav-link {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-lg);
  }
  
  .nav-menu {
    position: fixed;
    top: 70px; /* 匹配新的导航栏高度 */
    left: -100%;
    width: 100%;
    height: calc(100vh - 70px);
    background: var(--surface);
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: var(--space-8);
    gap: var(--space-4); /* 减少间距，确保所有菜单项可见 */
    transition: left var(--duration-normal) var(--ease-elegant);
    z-index: var(--z-modal);
    box-shadow: var(--shadow-lg);
    overflow-y: auto; /* 防止菜单项过多时显示不全 */
  }
  
  .nav-menu.active {
    left: 0;
  }
  
  .nav-toggle {
    display: flex;
  }
  
  /* 增大导航切换按钮的触摸目标 */
  .nav-toggle {
    width: 48px;
    height: 48px;
    padding: var(--space-2);
    justify-content: center;
    align-items: center;
  }
  
  .nav-toggle span {
    width: 24px;
    height: 2px;
    margin: 3px 0;
  }
  
  .nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }
  
  /* 新人介绍移动端 */
  .couple-cards {
    gap: var(--space-4);
  }
  
  .card-3d-container {
    height: 300px;
  }
  
  .card-image {
    width: 100px;
    height: 100px;
    margin-bottom: var(--space-3);
  }
  
  .card-name {
    font-size: var(--text-lg);
  }
  
  .card-name-en {
    font-size: var(--text-sm);
  }
  
  .card-decoration {
    font-size: var(--text-2xl);
  }
  
  .card-content h4 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-3);
  }
  
  .card-content p {
    font-size: var(--text-sm);
    margin-bottom: var(--space-1);
  }
  
  .hobby-tag {
    font-size: var(--text-base);
    padding: 2px var(--space-2);
  }
  
  /* 时间轴移动端 */
  .timeline-content {
    width: calc(100% - 60px);
    margin-left: 60px !important;
    padding: var(--space-3);
  }
  
  .timeline-marker {
    left: 15px;
    width: 40px;
    height: 40px;
  }
  
  .timeline-line {
    left: 15px;
  }
  
  .marker-icon {
    font-size: var(--text-base);
  }
  
  .timeline-date {
    font-size: var(--text-base);
  }
  
  .timeline-title {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
  }
  
  .timeline-description {
    font-size: var(--text-sm);
    margin-bottom: var(--space-3);
  }
  
  .timeline-image img {
    height: 150px;
  }
  
  /* 详情卡片移动端 */
  .detail-card {
    border-radius: var(--radius-lg);
  }
  
  .card-header {
    padding: var(--space-4);
  }
  
  .card-content {
    padding: var(--space-4);
  }
  
  .card-icon {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-2);
  }
  
  .card-header h3 {
    font-size: var(--text-lg);
  }
  
  .detail-date {
    font-size: var(--text-lg);
  }
  
  .detail-time {
    font-size: var(--text-base);
  }
  
  .countdown-timer {
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  
  .countdown-item {
    min-width: 40px;
  }
  
  .countdown-number {
    font-size: var(--text-base);
    padding: var(--space-1);
    min-width: 40px;
  }
  
  .countdown-label {
    font-size: var(--text-base);
  }
  
  .countdown-separator {
    font-size: var(--text-lg);
    display: none; /* 移动端隐藏分隔符 */
  }
  
  .venue-name {
    font-size: var(--text-base);
  }
  
  .venue-address {
    font-size: var(--text-sm);
  }
  
  .location-actions {
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .navigation-btn,
  .phone-btn {
    width: 100%;
    justify-content: center;
  }
  
  .color-swatches {
    gap: var(--space-1);
  }
  
  .color-item {
    width: 25px;
    height: 25px;
  }
  
  /* 照片画廊移动端 */
  .photo-gallery-3d {
    padding: var(--space-6) 0;
    gap: var(--space-3);
  }
  
  .photo-card {
    height: 250px;
  }
  
  .carousel-container {
    margin: 0 var(--space-2);
  }
  
  .carousel-slide img {
    height: 300px;
  }
  
    .carousel-btn,
  .carousel-prev,
  .carousel-next {
    display: none !important;
  }
  
  .carousel-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-6);
  }
  
  /* 邀请函移动端 */
  .invitation-card {
    margin: 0 var(--space-2);
    padding: var(--space-8);
  }
  
  .invitation-title {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-3);
  }
  
  .invitation-greeting {
    font-size: var(--text-base);
  }
  
  .invitation-text {
    font-size: var(--text-sm);
    margin-bottom: var(--space-3);
  }
  
  .signature-name {
    font-size: var(--text-lg);
  }
  
  .invitation-stamp {
    width: 50px;
    height: 50px;
    top: var(--space-6);
    right: var(--space-6);
  }
  
  .stamp-content {
    font-size: var(--text-lg);
  }
  
  /* 联系信息移动端 */
  .contact-avatar {
    width: 60px;
    height: 60px;
  }
  
  .contact-name {
    font-size: var(--text-lg);
  }
  
  .contact-method {
    padding: var(--space-2);
    gap: var(--space-2);
  }
  
  .method-icon {
    font-size: var(--text-base);
  }
  
  .method-text {
    font-size: var(--text-sm);
  }
  
  .qr-placeholder {
    padding: var(--space-4);
  }
  
  .qr-icon {
    font-size: var(--text-2xl);
  }
  
  /* 感谢页面移动端 */
  .thank-you-title {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-6);
  }
  
  .thank-you-text {
    font-size: var(--text-base);
    margin-bottom: var(--space-3);
  }
  
  .main-message {
    font-size: var(--text-lg);
  }
  
  .heart-beat-animation {
    font-size: var(--text-4xl);
  }
  
  .action-buttons {
    flex-direction: column;
    gap: var(--space-3);
  }
  
  .action-btn {
    width: 100%;
    max-width: 250px;
  }
  
  .blessing-text {
    font-size: var(--text-lg);
  }
  
  /* 模态框移动端 */
  .modal-content {
    max-width: 95vw;
    max-height: 95vh;
    margin: var(--space-2);
  }
  
  .modal-close {
    top: 10px;
    right: 15px;
    font-size: 30px;
  }
  
  .modal-image-container img {
    max-height: 70vh;
  }
  
  .modal-nav-btn {
    width: 40px;
    height: 40px;
    font-size: var(--text-base);
  }
  
  .modal-navigation {
    padding: 0 10px;
  }
  
  /* 加载动画移动端 */
  .loading-rings {
    width: 100px;
    height: 100px;
  }
  
  .ring-1 {
    width: 100px;
    height: 100px;
  }
  
  .ring-2 {
    width: 75px;
    height: 75px;
    top: 12.5px;
    left: 12.5px;
  }
  
  .ring-3 {
    width: 50px;
    height: 50px;
    top: 25px;
    left: 25px;
  }
  
  .loading-text {
    font-size: var(--text-base);
    margin-bottom: 1.5rem;
  }
  
  .loading-progress {
    width: 200px;
  }
}

/* ================================
   性能优化 - 移动端
================================ */

@media (max-width: 767px) {
  /* 简化动画 */
  .particle-container .particle:nth-child(n+6) {
    display: none;
  }
  
  /* 禁用复杂3D效果 */
  .card-3d-container {
    perspective: none;
  }
  
  .card-3d {
    transform-style: flat;
  }
  
  .card-3d:hover {
    transform: scale(1.02);
  }
  
  .photo-card:hover {
    transform: translateY(-5px) scale(1.02);
  }
  
  /* 简化视差效果 */
  .parallax-bg {
    transform: none !important;
  }
  
  /* 简化霓虹灯效果 */
  .neon-text {
    animation: none;
    text-shadow: 0 0 10px var(--primary);
  }
  
  .neon-text::before {
    display: none;
  }
}

/* ================================
   触摸设备优化
================================ */

@media (hover: none) and (pointer: coarse) {
  /* 移除悬停效果，改为点击触发 */
  .card-3d:hover {
    transform: none;
  }
  
  .photo-card:hover {
    transform: none;
  }
  
  .photo-overlay {
    opacity: 0;
    background: transparent;
  }
  
  .detail-card:hover,
  .contact-card:hover {
    transform: none;
  }
  
  /* 增大触摸目标 - 确保至少48x48px */
  .nav-link {
    min-width: 48px;
    min-height: 48px;
    padding: var(--space-3) var(--space-4);
  }
  
  .carousel-btn,
  .modal-nav-btn {
    min-width: 48px;
    min-height: 48px;
  }
  
  .action-btn,
  .cta-button,
  .navigation-btn,
  .phone-btn,
  .rsvp-btn {
    min-height: 48px;
    min-width: 48px;
    padding: var(--space-3) var(--space-6);
  }
  
  /* 增大联系方式按钮的触摸目标 */
  .contact-method {
    min-height: 48px;
    padding: var(--space-3) var(--space-4);
  }
  
  /* 倒计时数字区域增大触摸面积 */
  .countdown-item {
    min-width: 48px;
    min-height: 48px;
    padding: var(--space-2);
  }
}

/* ================================
   横屏模式优化
================================ */

@media (orientation: landscape) and (max-height: 500px) {
  .hero-section {
    min-height: auto;
    padding: var(--space-8) 0;
  }
  
  .hero-title {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-3);
  }
  
  .hero-date-container {
    margin-bottom: var(--space-6);
  }
  
  .scroll-indicator {
    display: none;
  }
  
  section {
    padding: var(--space-16) 0;
  }
}

/* ================================
   高分辨率屏幕优化
================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .invitation-border,
  .timeline-line {
    transform: translateZ(0); /* 防止模糊 */
  }
}

/* ================================
   移动端特殊情况处理
================================ */

/* 紧凑横屏模式 */
.compact-landscape .hero-section {
  min-height: auto;
  padding: var(--space-4) 0;
}

.compact-landscape .scroll-indicator {
  display: none;
}

.compact-landscape section {
  padding: var(--space-12) 0;
}

/* 低性能模式 */
.low-performance * {
  animation-duration: 0.1s !important;
  transition-duration: 0.1s !important;
}

.low-performance .particle-container {
  display: none;
}

.low-performance .parallax-bg {
  transform: none !important;
}

/* 安全区域支持 */
.has-safe-area {
  --safe-area-top: env(safe-area-inset-top);
  --safe-area-bottom: env(safe-area-inset-bottom);
  --safe-area-left: env(safe-area-inset-left);
  --safe-area-right: env(safe-area-inset-right);
}

/* 使用CSS变量设置视口高度 */
.hero-section {
  min-height: calc(var(--vh, 1vh) * 100);
}

/* 触摸反馈样式 */
.touch-feedback {
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

/* 懒加载图片样式 */
img.lazy {
  opacity: 0;
  transition: opacity 0.3s ease;
}

img.lazy.loaded {
  opacity: 1;
}

/* ================================
   打印样式
================================ */

@media print {
  .loading-screen,
  .particle-container,
  .navigation,
  .scroll-indicator,
  .carousel-btn,
  .modal-nav-btn,
  .action-buttons {
    display: none !important;
  }
  
  .hero-section,
  section {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  
  .invitation-card {
    box-shadow: none;
    border: 2px solid var(--neutral-400);
  }
  
  body {
    background: white;
    color: black;
  }
  
  .hero-title,
  .section-title {
    color: black;
  }
}