/* 移动端适配第一阶段高优先级改进 */

/* ===== 1. 导航菜单的移动端适配 ===== */

/* 增大移动端菜单切换按钮的点击区域 */
@media (max-width: 992px) {
  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px !important; /* 增大点击区域 */
    height: 60px !important; /* 增大点击区域 */
    font-size: 1.8rem; /* 增大图标尺寸 */
    position: absolute;
    right: 15px;
    top: 15px;
    color: rgba(255, 255, 255, 0.9);
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    transition: all 0.3s ease;
    z-index: 1001;
  }
  
  .mobile-toggle:hover {
    background-color: rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
  }
  
  .mobile-toggle:active {
    transform: scale(0.95);
  }
}

/* 改进下拉菜单在移动端的交互处理 */
@media (max-width: 992px) {
  .nav-list {
    flex-direction: column;
    background-color: rgba(0, 0, 0, 0.9);
    padding: 20px 0;
    border-radius: 12px;
    backdrop-filter: blur(15px);
    width: 90%;
    max-width: 320px;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  }
  
  .nav-item {
    margin: 8px 0;
    text-align: center;
    position: relative;
  }
  
  .nav-link {
    display: block;
    padding: 16px 20px; /* 增大点击区域 */
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    margin: 0 10px;
    transition: all 0.3s ease;
  }
  
  .nav-link:hover, .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(5px);
  }
  
  /* 下拉菜单移动端优化 */
  .dropdown-menu {
    position: static;
    transform: none;
    background: rgba(0, 0, 0, 0.95);
    margin-top: 10px;
    border-radius: 8px;
    min-width: auto;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  }
  
  .dropdown.active .dropdown-menu {
    opacity: 1;
    max-height: 500px;
    transform: none;
  }
  
  .dropdown-menu a {
    padding: 14px 20px; /* 增大点击区域 */
    font-size: 1rem;
    border-left: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
  }
  
  .dropdown-menu a:hover {
    padding-left: 25px;
    background: rgba(76, 175, 80, 0.2);
    color: #ffffff;
  }
  
  .dropdown-arrow {
    font-size: 0.8rem;
    margin-left: 8px;
    transition: transform 0.3s ease;
  }
  
  .dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
  }
}

/* ===== 2. 表单元素在移动端的可用性优化 ===== */

/* 增大输入框的触摸区域 */
@media (max-width: 768px) {
  .form-input, .form-textarea {
    width: 100%;
    padding: 16px 18px; /* 增大触摸区域 */
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px; /* 防止iOS缩放 */
    transition: var(--transition);
    font-family: inherit;
    min-height: 50px; /* 确保最小触摸目标 */
  }
  
  .form-textarea {
    min-height: 120px;
    resize: vertical;
  }
  
  .form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.15); /* 增大焦点区域 */
  }
  
  /* 改进标签与输入框的关联 */
  .form-label {
    display: block;
    margin-bottom: 10px;
    margin-top: 20px;
    font-weight: 500;
    color: var(--dark-gray);
    font-size: 16px; /* 增大标签字体 */
  }
  
  /* 表单行布局优化 */
  .form-row {
    display: flex;
    flex-direction: column; /* 移动端改为垂直布局 */
    gap: 15px;
  }
  
  /* 提交按钮优化 */
  .submit-btn {
    width: 100%;
    padding: 18px 24px; /* 增大触摸区域 */
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 16px; /* 防止iOS缩放 */
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 20px;
    min-height: 54px; /* 确保最小触摸目标 */
  }
  
  .submit-btn:hover {
    background-color: #3d8b40;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
  }
  
  .submit-btn:active {
    transform: translateY(0);
  }
}

/* ===== 3. 扩大按钮和链接的点击区域 ===== */

/* 确保所有按钮和链接符合44px×44px的最小触摸目标要求 */
@media (max-width: 768px) {
  /* 通用按钮增强 */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
    font-size: 16px; /* 防止iOS缩放 */
    border-radius: 8px;
    position: relative;
    transition: all 0.3s ease;
  }
  
  /* 导航链接增强 */
  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* 下拉菜单链接增强 */
  .dropdown-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  /* 获取报价按钮增强 */
  .get-quote {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    font-size: 14px;
  }
  
  /* 搜索图标增强 */
  .search-icon-global {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* 轮播控制按钮增强 */
  .carousel-prev,
  .carousel-next {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
  }
  
  /* 轮播指示器增强 */
  .indicator {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
  }
  
  /* 卡片链接增强 */
  .service-card, .case-card, .news-card {
    cursor: pointer;
    transition: all 0.3s ease;
  }
  
  .service-card:hover, .case-card:hover, .news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  }
  
  /* 查看详情按钮增强 */
  .view-profile-btn, .service-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    font-size: 16px;
  }
  
  /* 模态框关闭按钮增强 */
  .modal-close, .profile-close {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
  }
  
  /* 画廊控制按钮增强 */
  .gallery-close, .gallery-prev, .gallery-next {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ===== 4. 表单验证反馈优化 ===== */

@media (max-width: 768px) {
  /* 表单验证样式 */
  .form-input.error, .form-textarea.error {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
  }
  
  .form-input.success, .form-textarea.success {
    border-color: #38a169;
    box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.1);
  }
  
  /* 错误消息样式 */
  .error-message {
    color: #e53e3e;
    font-size: 14px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
  }
  
  /* 成功消息样式 */
  .success-message {
    color: #38a169;
    font-size: 14px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
  }
  
  /* 表单提交状态反馈 */
  .form-feedback {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  
  .form-feedback.success {
    background-color: rgba(56, 161, 105, 0.1);
    color: #38a169;
    border: 1px solid rgba(56, 161, 105, 0.2);
  }
  
  .form-feedback.error {
    background-color: rgba(229, 62, 62, 0.1);
    color: #e53e3e;
    border: 1px solid rgba(229, 62, 62, 0.2);
  }
}

/* ===== 5. 其他移动端优化 ===== */

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  /* 移除悬停效果，改为点击效果 */
  .nav-link:hover, .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
  }
  
  .dropdown-menu a:hover {
    background: rgba(76, 175, 80, 0.2);
    color: #ffffff;
  }
  
  /* 按钮点击效果 */
  .btn:active, .submit-btn:active {
    transform: scale(0.98);
  }
  
  /* 卡片点击效果 */
  .service-card:active, .case-card:active, .news-card:active {
    transform: scale(0.98);
  }
}

/* 小屏幕设备特别优化 */
@media (max-width: 480px) {
  /* 导航菜单进一步优化 */
  .nav-list {
    width: 95%;
    padding: 15px 0;
  }
  
  .nav-link {
    padding: 14px 16px;
    font-size: 1rem;
  }
  
  .dropdown-menu a {
    padding: 12px 16px;
    font-size: 0.95rem;
  }
  
  /* 表单元素进一步优化 */
  .form-input, .form-textarea {
    padding: 14px 16px;
    font-size: 16px;
  }
  
  .submit-btn {
    padding: 16px 20px;
    font-size: 16px;
  }
  
  /* 按钮进一步优化 */
  .btn {
    padding: 10px 16px;
    font-size: 16px;
  }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
  .nav-list {
    max-height: 70vh;
    overflow-y: auto;
  }
  
  .dropdown-menu {
    max-height: 200px;
    overflow-y: auto;
  }
}

/* ===== 移动端适配第二阶段高优先级改进 ===== */

/* ===== 1. 调整字体大小和间距，提高内容可读性 ===== */

@media (max-width: 768px) {
  /* 确保移动端文字大小不小于16px */
  body {
    font-size: 16px;
    line-height: 1.6; /* 增加行高到1.6倍，提高阅读体验 */
  }
  
  /* 段落文字优化 */
  p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 1.2rem;
  }
  
  /* 标题和段落之间的间距调整 */
  h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1.2rem;
    margin-top: 1.8rem;
  }
  
  /* 小屏幕标题字体调整 */
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.6rem;
  }
  
  h3 {
    font-size: 1.4rem;
  }
  
  h4 {
    font-size: 1.2rem;
  }
  
  /* 优化容器内边距，适应小屏幕 */
  .container {
    padding: 0 15px;
  }
  
  .section {
    padding: 40px 0;
  }
  
  /* 列表项间距优化 */
  li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
  }
  
  /* 表单标签和输入框间距优化 */
  .form-label {
    margin-bottom: 8px;
    margin-top: 16px;
  }
  
  /* 卡片内容间距优化 */
  .card-content, .service-card, .case-card, .news-card {
    padding: 20px;
  }
  
  /* 按钮内部文字间距 */
  .btn {
    padding: 12px 18px;
    font-size: 16px;
  }
}

/* ===== 2. 改进弹窗和模态框的响应式设计 ===== */

@media (max-width: 768px) {
  /* 图片查看器模态框优化 */
  .image-modal {
    padding-top: 40px;
  }
  
  .modal-content {
    max-width: 95%;
    max-height: 75vh;
    margin: 10px auto;
  }
  
  #imageCaption {
    width: 90%;
    font-size: 1rem;
    padding: 8px 0;
  }
  
  /* 关闭按钮优化 */
  .close-modal {
    top: 10px;
    right: 15px;
    font-size: 32px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* 操作提示优化 */
  .image-controls-hint {
    bottom: 15px;
    font-size: 0.8rem;
    padding: 6px 12px;
  }
  
  /* 腾讯风格模态框优化 */
  .tencent-modal .modal-content {
    width: 95%;
    height: auto;
    max-height: 85vh;
    margin: 20px auto;
    overflow-y: auto;
  }
  
  .modal-header {
    flex-direction: column;
    padding: 20px;
    height: auto;
  }
  
  .modal-photo {
    width: 150px;
    height: 150px;
    margin: 0 auto 15px;
    position: static;
  }
  
  .modal-info {
    margin-left: 0;
    padding: 0;
    text-align: center;
  }
  
  .modal-info h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }
  
  .modal-info p {
    font-size: 1rem;
  }
  
  .modal-divider {
    position: static;
    margin: 15px 0;
    height: 1px;
  }
  
  .modal-bio {
    padding: 20px;
    margin-top: 0;
    position: static;
  }
  
  .modal-bio p {
    font-size: 0.95rem;
    line-height: 1.6;
  }
  
  /* 个人简介模态框优化 */
  .profile-modal .profile-container {
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .profile-header {
    flex-direction: column;
    padding: 20px;
    text-align: center;
  }
  
  .profile-photo {
    width: 100px;
    height: 100px;
    margin: 0 auto 15px;
  }
  
  .profile-name {
    font-size: 1.4rem;
  }
  
  .profile-position {
    font-size: 1rem;
  }
  
  .profile-close {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
  }
  
  .profile-content {
    padding: 20px;
  }
  
  .bio-title {
    font-size: 1.2rem;
  }
  
  .bio-content {
    font-size: 0.95rem;
    line-height: 1.6;
  }
  
  /* 全屏画廊优化 */
  .fullscreen-gallery {
    padding: 0;
  }
  
  .gallery-image {
    max-width: 95vw;
    max-height: 80vh;
  }
  
  .gallery-close {
    top: 15px;
    right: 15px;
    font-size: 36px;
    width: 40px;
    height: 40px;
  }
  
  .gallery-prev, .gallery-next {
    font-size: 28px;
    width: 36px;
    height: 36px;
  }
  
  .gallery-prev {
    left: 10px;
  }
  
  .gallery-next {
    right: 10px;
  }
}

/* ===== 3. 优化图片的响应式显示 ===== */

@media (max-width: 768px) {
  /* 确保所有图片在小屏幕上正确缩放 */
  img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
  }
  
  /* 调整图片容器的高度和宽度 */
  .qual-image {
    height: 200px;
  }
  
  .member-photo {
    height: 200px;
  }
  
  .moment-cover {
    height: 200px;
  }
  
  /* 优化轮播图在移动端的显示 */
  .carousel-slide {
    padding: 0 15px;
  }
  
  .slide-content {
    padding: 0 10px;
  }
  
  .slide-title {
    font-size: 2.2rem;
    margin-bottom: 15px;
  }
  
  .slide-subtitle {
    font-size: 1rem;
    margin-bottom: 15px;
  }
  
  .slide-description {
    font-size: 0.9rem;
  }
  
  /* 轮播控制按钮优化 */
  .carousel-prev, .carousel-next {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  
  .carousel-controls {
    padding: 0 10px;
  }
  
  /* 轮播指示器优化 */
  .carousel-indicators {
    bottom: 20px;
  }
  
  .indicator {
    width: 10px;
    height: 10px;
  }
  
  /* 确保图片不会导致页面溢出 */
  .image-container, .photo-container, .gallery-container {
    overflow: hidden;
    width: 100%;
  }
  
  /* 团队成员卡片图片优化 */
  .team-member.tencent-style .member-photo {
    width: 90px;
    height: 110px;
  }
  
  /* 资质证书图片优化 */
  .qual-item {
    margin-bottom: 15px;
  }
  
  .qual-image img {
    object-fit: contain;
  }
  
  /* 卡片悬停效果优化 */
  .moment-card:hover .moment-cover img {
    transform: scale(1.03);
  }
  
  .qual-item:hover .qual-image img {
    transform: scale(1.03);
  }
}

/* 小屏幕设备特别优化 */
@media (max-width: 480px) {
  /* 进一步减小字体和间距 */
  .slide-title {
    font-size: 1.8rem;
  }
  
  .slide-subtitle {
    font-size: 0.9rem;
  }
  
  .slide-description {
    font-size: 0.85rem;
  }
  
  /* 模态框进一步优化 */
  .modal-photo {
    width: 120px;
    height: 120px;
  }
  
  .profile-photo {
    width: 80px;
    height: 80px;
  }
  
  /* 图片容器进一步优化 */
  .qual-image {
    height: 160px;
  }
  
  .member-photo {
    height: 160px;
  }
  
  .moment-cover {
    height: 160px;
  }
  
  /* 按钮进一步优化 */
  .gallery-close, .gallery-prev, .gallery-next {
    font-size: 24px;
    width: 32px;
    height: 32px;
  }
}

/* ===== 移动端适配第三阶段低优先级改进 ===== */

/* ===== 1. 使用现代CSS技术（Flexbox和Grid）重构布局 ===== */

/* 使用Flexbox重构导航布局 */
@media (max-width: 992px) {
  .header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 15px;
  }
  
  .nav-container {
    position: static;
    width: 100%;
    padding: 0;
  }
  
  .nav-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    overflow-y: auto;
  }
  
  .nav-menu.active {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  
  .nav-list {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
    margin: 80px auto 20px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    backdrop-filter: blur(15px);
  }
}

/* 使用Grid重构复杂布局结构 */
@media (max-width: 768px) {
  /* 服务卡片网格布局 */
  .services-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 0 15px;
  }
  
  /* 案例卡片网格布局 */
  .cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 0 15px;
  }
  
  /* 新闻卡片网格布局 */
  .news-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 0 15px;
  }
  
  /* 团队成员网格布局 */
  .team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 0 15px;
  }
  
  /* 表单网格布局 */
  .form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  /* 页脚网格布局 */
  .footer-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 0 15px;
  }
}

/* 优化容器和项目的对齐方式 */
@media (max-width: 768px) {
  .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    padding: 0 15px;
  }
  
  .section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 40px 0;
  }
  
  .card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
  }
  
  .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  }
}

/* 简化响应式断点处理 */
@media (max-width: 1200px) {
  .container {
    max-width: 960px;
  }
}

@media (max-width: 992px) {
  .container {
    max-width: 720px;
  }
}

@media (max-width: 768px) {
  .container {
    max-width: 540px;
  }
}

@media (max-width: 576px) {
  .container {
    max-width: 100%;
  }
}

/* ===== 2. 添加触摸手势支持 ===== */

/* 轮播图滑动切换功能 */
@media (max-width: 768px) {
  .hero-carousel {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
  }
  
  .carousel-container {
    display: flex;
    transition: transform 0.3s ease;
    will-change: transform;
  }
  
  .carousel-slide {
    flex: 0 0 100%;
    width: 100%;
  }
  
  /* 添加触摸滑动指示器 */
  .carousel-swipe-hint {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    opacity: 0.7;
    pointer-events: none;
    z-index: 10;
  }
}

/* 图片画廊捏合缩放功能 */
@media (max-width: 768px) {
  .fullscreen-gallery {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }
  
  .fullscreen-gallery.active {
    opacity: 1;
    visibility: visible;
  }
  
  .gallery-image-container {
    position: relative;
    width: 90%;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
  }
  
  .gallery-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.3s ease;
  }
  
  /* 捏合缩放提示 */
  .gallery-zoom-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    opacity: 0.7;
    pointer-events: none;
    z-index: 10;
  }
}

/* 确保AI聊天按钮在移动设备上正常工作 */
@media (max-width: 768px) {
  .ai-chat-float {
    z-index: 10000 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
  }
  
  /* 确保没有其他元素覆盖AI聊天按钮 */
  .ai-chat-float::before,
  .ai-chat-float::after {
    content: none;
  }
  
  /* 优化AI聊天按钮的触摸体验 */
  .ai-chat-float:active {
    transform: scale(0.95);
  }
}

/* 优化触摸滚动体验 */
@media (max-width: 768px) {
  /* 平滑滚动 */
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
  
  /* 优化滚动容器 */
  .scroll-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* 防止滚动链 */
  .modal-content,
  .dropdown-menu,
  .nav-menu {
    overscroll-behavior: contain;
  }
}

/* 添加触摸反馈效果 */
@media (hover: none) and (pointer: coarse) {
  /* 按钮触摸反馈 */
  .btn, .nav-link, .submit-btn, .carousel-prev, .carousel-next {
    position: relative;
    overflow: hidden;
  }
  
  .btn:active, .nav-link:active, .submit-btn:active,
  .carousel-prev:active, .carousel-next:active {
    transform: scale(0.98);
  }
  
  /* 卡片触摸反馈 */
  .service-card, .case-card, .news-card, .team-member {
    position: relative;
    overflow: hidden;
  }
  
  .service-card:active, .case-card:active, .news-card:active, .team-member:active {
    transform: scale(0.98);
  }
  
  /* 添加涟漪效果 */
  .ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
  }
  
  @keyframes ripple {
    to {
      transform: scale(4);
      opacity: 0;
    }
  }
}

/* ===== 3. 性能优化 ===== */

/* 优化CSS选择器 */
@media (max-width: 768px) {
  /* 使用更高效的选择器 */
  .header { }
  .nav { }
  .nav-list { }
  .nav-item { }
  .nav-link { }
  
  /* 避免深层嵌套 */
  .service-card { }
  .case-card { }
  .news-card { }
  .team-member { }
  
  /* 使用类选择器代替标签选择器 */
  .btn { }
  .form-input { }
  .form-textarea { }
  .submit-btn { }
}

/* 减少重绘和回流 */
@media (max-width: 768px) {
  /* 使用transform代替top/left */
  .mobile-toggle {
    transform: translate3d(0, 0, 0);
  }
  
  .nav-menu {
    transform: translate3d(-100%, 0, 0);
    transition: transform 0.3s ease;
  }
  
  .nav-menu.active {
    transform: translate3d(0, 0, 0);
  }
  
  /* 使用will-change提示浏览器优化 */
  .carousel-slide {
    will-change: transform;
  }
  
  .gallery-image {
    will-change: transform;
  }
  
  /* 避免不必要的重绘 */
  .card {
    backface-visibility: hidden;
    perspective: 1000px;
  }
}

/* 优化图片加载 */
@media (max-width: 768px) {
  /* 懒加载图片 */
  .lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .lazy-load.loaded {
    opacity: 1;
  }
  
  /* 响应式图片 */
  img {
    max-width: 100%;
    height: auto;
    content-visibility: auto;
    contain-intrinsic-size: 800px 600px;
  }
  
  /* 图片容器优化 */
  .image-container {
    position: relative;
    overflow: hidden;
    background-color: #f5f5f5;
  }
  
  .image-container::before {
    content: "";
    display: block;
    padding-top: 56.25%; /* 16:9 宽高比 */
  }
  
  .image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* 添加适当的过渡和动画效果 */
@media (max-width: 768px) {
  /* 使用硬件加速的动画 */
  .fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  
  .fade-in.visible {
    opacity: 1;
    transform: translateY(0);
  }
  
  /* 优化动画性能 */
  .slide-up {
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }
  
  .slide-up.active {
    transform: translateY(0);
  }
  
  /* 使用transform和opacity实现动画 */
  .scale-in {
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  
  .scale-in.active {
    transform: scale(1);
    opacity: 1;
  }
  
  /* 减少动画复杂度 */
  .rotate {
    transform: rotate(0deg);
    transition: transform 0.3s ease;
  }
  
  .rotate.active {
    transform: rotate(180deg);
  }
}

/* ===== 4. 触摸手势JavaScript支持 ===== */

/* 这些样式需要与JavaScript配合使用 */
@media (max-width: 768px) {
  /* 轮播图滑动支持 */
  .carousel-container.swiping {
    transition: none;
  }
  
  /* 图片画廊缩放支持 */
  .gallery-image.zooming {
    transition: transform 0.1s ease;
  }
  
  /* 触摸滑动指示器 */
  .swipe-indicator {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .swipe-indicator.active {
    opacity: 1;
  }
}

/* ===== 5. 兼容性和回退方案 ===== */

/* 为不支持新特性的浏览器提供回退方案 */
@supports not (display: grid) {
  .services-grid,
  .cases-grid,
  .news-grid,
  .team-grid {
    display: flex;
    flex-wrap: wrap;
  }
  
  .services-grid > *,
  .cases-grid > *,
  .news-grid > *,
  .team-grid > * {
    flex: 1 1 300px;
    margin: 10px;
  }
}

/* 为不支持touch-action的浏览器提供回退方案 */
@supports not (touch-action: pan-y) {
  .hero-carousel {
    overflow-x: hidden;
  }
}

/* 为不支持will-change的浏览器提供回退方案 */
@supports not (will-change: transform) {
  .carousel-slide,
  .gallery-image {
    transform: translateZ(0);
  }
}