/**
 * 尘渊文化 - 移动端响应式样式
 * Mobile-First 设计
 * @version 2.0.0
 */

/* ========== 基础响应式设置 ========== */
html {
  font-size: 16px;
}

@media (max-width: 375px) {
  html { font-size: 14px; }
}

@media (min-width: 376px) and (max-width: 414px) {
  html { font-size: 15px; }
}

/* ========== 移动端导航 ========== */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 32px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1100;
}

.mobile-menu-toggle span {
  width: 100%;
  height: 2px;
  background: var(--dark);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* ========== 移动端断点 ========== */
@media (max-width: 768px) {
  /* 导航菜单 */
  .mobile-menu-toggle {
    display: flex;
  }
  
  .navbar-nav {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 1rem;
    gap: 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
  }
  
  .navbar-nav.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  .navbar-nav a {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
  }
  
  /* Hero区域 */
  .hero-title {
    font-size: 2rem !important;
    line-height: 1.2;
  }
  
  .hero-subtitle {
    font-size: 1rem !important;
  }
  
  .hero-visual {
    display: none !important;
  }
  
  /* 统计卡片 */
  .stat-item {
    padding: 1rem 0.5rem;
  }
  
  .stat-number {
    font-size: 1.75rem !important;
  }
  
  /* 卡片布局 */
  .about-card,
  .service-card,
  .case-card {
    margin-bottom: 1.5rem;
  }
  
  .service-card {
    flex-direction: column;
  }
  
  .service-icon {
    margin-bottom: 1rem;
  }
  
  /* 案例卡片 */
  .case-image {
    height: 160px;
  }
  
  /* CTA区域 */
  .cta-box {
    padding: 2rem 1.5rem !important;
  }
  
  .cta-box h2 {
    font-size: 1.5rem !important;
  }
  
  /* 联系卡片 */
  .contact-card-item {
    margin-bottom: 1rem;
  }
  
  /* Footer */
  .footer .row > div {
    margin-bottom: 2rem;
  }
  
  /* 返回顶部按钮 */
  .back-to-top {
    width: 44px;
    height: 44px;
    bottom: 20px;
    right: 20px;
  }
  
  /* 流程步骤 */
  .workflow-steps::before {
    display: none;
  }
  
  .workflow-step {
    margin-bottom: 2rem;
  }
  
  .workflow-step .step-number {
    width: 60px;
    height: 60px;
    font-size: 1.25rem;
  }
  
  /* 客户评价 */
  .testimonial-card {
    padding: 1.5rem !important;
  }
  
  /* 技术雷达 */
  .tech-radar-item {
    padding: 1.5rem !important;
  }
  
  /* 订阅表单 */
  .subscribe-form {
    flex-direction: column !important;
  }
  
  .subscribe-form input,
  .subscribe-form button {
    width: 100%;
  }
  
  /* 页面标题 */
  .page-title {
    font-size: 2rem !important;
  }
  
  .page-header {
    padding: 100px 0 60px !important;
  }
  
  /* 团队卡片 */
  .team-card {
    margin-bottom: 1.5rem;
  }
  
  .team-avatar {
    height: 220px;
  }
  
  /* 时间线 */
  .timeline::before {
    left: 20px !important;
  }
  
  .timeline-item {
    flex-direction: column !important;
  }
  
  .timeline-content {
    padding-left: 60px !important;
    padding-right: 0 !important;
  }
  
  .timeline-dot {
    left: 20px !important;
    transform: none !important;
  }
  
  /* 按钮 */
  .btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }
  
  /* 表格 */
  .data-table {
    font-size: 0.875rem;
  }
  
  .data-table th,
  .data-table td {
    padding: 0.75rem;
  }
  
  /* 模态框 */
  .modal-content {
    margin: 1rem;
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* ========== 平板断点 ========== */
@media (min-width: 769px) and (max-width: 1024px) {
  .hero-title {
    font-size: 3rem !important;
  }
  
  .section-title {
    font-size: 2.25rem;
  }
  
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========== 触摸优化 ========== */
@media (hover: none) {
  /* 移除悬停效果，改为点击状态 */
  .card:hover,
  .about-card:hover,
  .service-card:hover,
  .case-card:hover {
    transform: none;
  }
  
  .card:active,
  .about-card:active,
  .service-card:active,
  .case-card:active {
    transform: scale(0.98);
  }
  
  /* 增大触摸目标 */
  .nav-link,
  .btn,
  .case-link,
  .footer-links a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  /* 禁用长按菜单 */
  img,
  a {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
}

/* ========== iOS 优化 ========== */
@supports (-webkit-touch-callout: none) {
  /* 修复iOS滚动问题 */
  body {
    -webkit-overflow-scrolling: touch;
  }
  
  /* 修复iOS输入框缩放 */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  textarea {
    font-size: 16px;
  }
  
  /* 修复iOS固定定位问题 */
  .navbar {
    transform: translateZ(0);
  }
}

/* ========== Android 优化 ========== */
@supports not (-webkit-touch-callout: none) {
  /* Android 特定优化 */
  .btn {
    transform: translateZ(0);
  }
}

/* ========== 横向模式 ========== */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-section {
    min-height: auto;
    padding: 100px 0 60px;
  }
  
  .hero-visual {
    display: none;
  }
  
  .navbar-nav {
    max-height: 80vh;
    overflow-y: auto;
  }
}

/* ========== 安全区域（刘海屏） ========== */
@supports (padding: max(0px)) {
  .navbar {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-top: max(1rem, env(safe-area-inset-top));
  }
  
  .back-to-top {
    right: max(20px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
  }
}

/* ========== 打印优化 ========== */
@media print {
  .navbar,
  .back-to-top,
  .mobile-menu-toggle,
  .hero-visual,
  .scroll-indicator {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  .section {
    padding: 2rem 0;
    page-break-inside: avoid;
  }
  
  a {
    text-decoration: underline;
    color: #000;
  }
  
  .card,
  .about-card,
  .service-card,
  .case-card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}

/* ========== 暗色模式支持 ========== */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

/* ========== 高对比度模式 ========== */
@media (prefers-contrast: high) {
  .card,
  .about-card,
  .service-card,
  .case-card {
    border-width: 2px;
  }
  
  .btn {
    border: 2px solid currentColor;
  }
}

/* ========== 防止滚动穿透 ========== */
body.menu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ========== 减少动画 ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .mobile-menu-toggle span {
    transition: none;
  }
}
