/* ============================================================
   响应式 + 自适应：手机 / 平板 / 电脑 / TV / 微信浏览器
   移动优先，渐进增强，适配全球各类智能终端
   ============================================================ */

/* 基础重置 */
* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a, button, .btn, select, input, textarea, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

img, svg, video {
  max-width: 100%;
  height: auto;
}

/* 安全区适配（刘海屏/全面屏） */
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.site-header {
  padding-top: env(safe-area-inset-top);
}

.site-footer {
  padding-bottom: env(safe-area-inset-bottom);
}

/* ===================== 手机（≤767px） ===================== */
@media (max-width: 767px) {
  .wrap {
    padding: 0 16px;
  }

  .site-header .header-inner {
    flex-wrap: wrap;
    gap: 8px;
  }

  .brand {
    font-size: 18px !important;
  }

  .site-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .site-nav a {
    white-space: nowrap;
    padding: 8px 12px !important;
    font-size: 14px;
  }

  .hero h1 {
    font-size: 28px !important;
    line-height: 1.3;
  }

  .hero p {
    font-size: 16px !important;
  }

  .hero-actions .btn {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    text-align: center;
  }

  .section {
    padding: 48px 0 !important;
  }

  .section-title h2 {
    font-size: 24px !important;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .card {
    padding: 20px !important;
  }

  .card h3 {
    font-size: 18px !important;
  }

  .btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px !important;
  }

  .banner-slider {
    height: 320px !important;
  }

  .banner-inner h1 {
    font-size: 24px !important;
  }

  .banner-inner p {
    font-size: 14px !important;
  }

  .banner-prev,
  .banner-next {
    width: 36px !important;
    height: 36px !important;
    font-size: 20px !important;
  }

  .banner-prev { left: 10px !important; }
  .banner-next { right: 10px !important; }

  .site-footer .footer-inner {
    flex-direction: column;
    gap: 24px;
  }

  .lang-switch select,
  .theme-switch select {
    min-height: 44px;
  }
}

/* ===================== 大屏手机 / 小平板（768-1023px） ===================== */
@media (min-width: 768px) and (max-width: 1023px) {
  .wrap {
    padding: 0 24px;
    max-width: 960px !important;
  }

  .hero h1 {
    font-size: 36px !important;
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .banner-slider {
    height: 400px !important;
  }

  .banner-inner h1 {
    font-size: 36px !important;
  }
}

/* ===================== 平板（1024-1279px） ===================== */
@media (min-width: 1024px) and (max-width: 1279px) {
  .wrap {
    max-width: 1100px !important;
  }

  .grid-4 {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* ===================== 桌面（1280-1919px） ===================== */
@media (min-width: 1280px) {
  .wrap {
    max-width: 1200px !important;
  }
}

/* ===================== 大屏桌面 / TV（1920+） ===================== */
@media (min-width: 1920px) {
  html {
    font-size: 18px;
  }

  .wrap {
    max-width: 1400px !important;
    padding: 0 48px;
  }

  .hero {
    padding: 100px 0 !important;
  }

  .hero h1 {
    font-size: 56px !important;
  }

  .hero p {
    font-size: 22px !important;
  }

  .section {
    padding: 96px 0 !important;
  }

  .section-title h2 {
    font-size: 36px !important;
  }

  .card {
    padding: 32px !important;
  }

  .card h3 {
    font-size: 22px !important;
  }

  .btn {
    padding: 16px 36px !important;
    font-size: 18px !important;
  }

  .banner-slider {
    height: 560px !important;
  }

  .banner-inner h1 {
    font-size: 48px !important;
  }

  .banner-inner p {
    font-size: 20px !important;
  }
}

/* ===================== 4K 超大屏（2560+） ===================== */
@media (min-width: 2560px) {
  html {
    font-size: 22px;
  }

  .wrap {
    max-width: 1800px !important;
    padding: 0 64px;
  }

  .hero h1 {
    font-size: 72px !important;
  }

  .banner-slider {
    height: 680px !important;
  }
}

/* ===================== 超小屏（≤360px） ===================== */
@media (max-width: 360px) {
  .wrap {
    padding: 0 12px;
  }

  .brand {
    font-size: 16px !important;
  }

  .site-nav a {
    padding: 6px 10px !important;
    font-size: 13px;
  }

  .hero h1 {
    font-size: 24px !important;
  }

  .section-title h2 {
    font-size: 20px !important;
  }
}

/* ===================== 微信浏览器专属优化 ===================== */
.ua-wechat {
  /* 微信内字体优化 */
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.ua-wechat .btn-primary {
  font-weight: 700;
}

.ua-wechat .site-nav a {
  font-size: 15px;
}

.ua-wechat .banner-slider {
  /* 微信内轮播高度优化 */
  height: 300px;
}

/* ===================== 触控设备优化 ===================== */
@media (pointer: coarse) {
  .site-nav a,
  .btn,
  .lang-switch select,
  .theme-switch select,
  .card {
    min-height: 44px;
  }

  .card-link:hover {
    transform: none !important;
  }
}

/* ===================== 减少动画偏好 ===================== */
@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;
  }
}

/* ===================== 打印优化 ===================== */
@media print {
  .site-header,
  .site-footer,
  .banner-slider,
  .btn,
  .lang-switch,
  .theme-switch {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .card {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}
