/* =============================================================
   午牛工具 WUNIU TOOLS — 平板与手机端适配层
   Responsive layer

   断点约定
     ≥ 1024px   桌面（由 base.css 负责）
     ≤ 1023px   平板 / 竖屏平板 / 横屏大手机
     ≤ 767px    手机
     ≤ 420px    小屏手机（iPhone SE / 老款安卓）

   设计原则
     1. 本文件只写「覆盖规则」，不改设计系统本身，改动集中在一处；
     2. 所有可点击元素在手机上不小于 44×44px（Apple HIG 下限）；
     3. 表单输入框在手机上统一 16px，避免 iOS Safari 聚焦时自动放大页面；
     4. 宽表格改为「一物一卡」堆叠，绝不出现横向滚动条；
     5. 底部固定操作条与刘海屏安全区（safe-area-inset）配合。
   ============================================================= */

/* ---------- 1. 全局：防溢出与断词 ---------- */
@media (max-width: 1023px) {
  /* 长英文单词、长 URL、连续数字不撑破容器 */
  p,
  li,
  h1,
  h2,
  h3,
  h4,
  td,
  th,
  dd,
  dt {
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  .container {
    padding: 0 20px;
  }

  .section {
    padding: 64px 0;
  }

  .section--tight {
    padding: 44px 0;
  }

  /* 手机端：任何元素都不应超出视口宽度 */
  iframe,
  video,
  table {
    max-width: 100%;
  }
}

/* ---------- 2. 流式字号：不再逐档跳变 ---------- */
@media (max-width: 1023px) {
  h1 {
    font-size: clamp(28px, 5.4vw, 36px);
  }

  h2 {
    font-size: clamp(22px, 4.2vw, 28px);
  }

  h3 {
    font-size: clamp(19px, 3.2vw, 22px);
  }

  .hero h1 {
    font-size: clamp(27px, 5.6vw, 38px);
  }

  .page-hero h1 {
    font-size: clamp(25px, 4.8vw, 34px);
  }

  .section-head h2 {
    font-size: clamp(22px, 4.2vw, 28px);
  }

  .cta-band h2 {
    font-size: 23px;
  }
}

@media (max-width: 767px) {
  h1 {
    font-size: clamp(24px, 6.8vw, 30px);
  }

  h2 {
    font-size: clamp(20px, 5.4vw, 25px);
  }

  h3 {
    font-size: 18px;
  }

  h4 {
    font-size: 16px;
  }

  .hero h1 {
    font-size: clamp(24px, 7.2vw, 31px);
    line-height: 1.34;
  }

  .page-hero h1 {
    font-size: clamp(22px, 6.4vw, 28px);
  }

  .page-hero--slim h1 {
    font-size: clamp(20px, 5.8vw, 26px);
  }

  .section-head p,
  .page-hero p,
  .page-hero__desc {
    font-size: 15px;
  }

  .cta-band h2 {
    font-size: 21px;
  }
}

/* ---------- 3. 顶部导航：切换为抽屉 ---------- */
@media (max-width: 1023px) {
  /* 顶栏下面的锚点跳转留白也跟着头部高度走 */
  .nav {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .header-actions {
    margin-left: auto;
    gap: 10px;
  }

  /* 桌面端顶部的「联系我们」按钮让位给底部固定操作条，避免顶栏拥挤 */
  .header-actions > .btn {
    display: none;
  }

  .site-header__inner {
    gap: 14px;
  }
}

@media (max-width: 767px) {
  /* 顶栏变矮：--header-h 同时驱动首屏留白与锚点 scroll-margin */
  :root {
    --header-h: 64px;
  }

  .site-header__inner {
    min-height: var(--header-h);
  }

  .brand {
    gap: 10px;
  }

  .brand__name {
    font-size: 17px;
  }

  .brand__sub {
    font-size: 9px;
    letter-spacing: 0.18em;
  }

  .lang-switch__item {
    min-width: 34px;
    height: 30px;
    font-size: 11px;
  }

  .nav-toggle {
    width: 42px;
    height: 42px;
  }
}

/* ---------- 4. 移动端抽屉 ---------- */
@media (max-width: 1023px) {
  .nav-drawer {
    width: min(86vw, 360px);
  }

  .nav-drawer__link {
    display: flex;
    align-items: center;
    min-height: 52px;
  }
}

@media (max-width: 767px) {
  /* 手机端抽屉占满整屏，避免右侧露出半个页面 */
  .nav-drawer {
    width: 100%;
    max-width: none;
    border-left: 0;
    /* 底部留出 iPhone home 指示条的安全区 */
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  .nav-drawer__link {
    min-height: 56px;
    font-size: 17px;
  }

  .nav-drawer__close {
    width: 44px;
    height: 44px;
  }

  .nav-drawer__cta {
    min-height: 50px;
  }
}

/* ---------- 5. 首屏 ---------- */
@media (max-width: 1023px) {
  .hero {
    min-height: auto;
    padding: calc(var(--header-h) + 56px) 0 72px;
  }

  .hero__facts {
    gap: 28px;
    margin-top: 48px;
  }
}

@media (max-width: 767px) {
  .hero {
    padding: calc(var(--header-h) + 36px) 0 52px;
  }

  .hero__badge {
    margin-bottom: 20px;
    padding: 6px 13px;
    font-size: 11px;
    letter-spacing: 0.06em;
  }

  .hero__sub {
    font-size: 15px;
    margin-bottom: 28px;
  }

  /* 手机上按钮整行铺满，比并排两个小按钮好点得多 */
  .hero__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .hero__actions .btn {
    width: 100%;
  }

  .hero__facts {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    margin-top: 36px;
    padding-top: 24px;
  }

  .hero__fact {
    min-width: 0;
    text-align: left;
  }

  .hero__fact strong {
    font-size: 19px;
  }
}

/* 横屏手机上首屏不再强行撑满一屏 */
@media (max-width: 1023px) and (orientation: landscape) {
  .hero {
    min-height: auto;
  }
}

/* ---------- 6. 网格布局 ---------- */
@media (max-width: 1023px) {
  .grid--4,
  .grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .advantages {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

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

  .contact-split,
  .split {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  /* 图文交替的区块在窄屏上统一「文在上、图在下」 */
  .split--reverse .split__media {
    order: 2;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 36px 24px;
  }

  .contact-cards {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .steps {
    grid-template-columns: 1fr;
  }

  .logo-wall__item {
    flex: 1 1 calc(33.333% - 18px);
  }
}

@media (max-width: 767px) {
  .grid {
    gap: 16px;
  }

  .grid--4,
  .grid--3,
  .grid--2,
  .metrics,
  .advantages,
  .form__grid,
  .footer-grid,
  .contact-cards,
  .cert-grid,
  .steps {
    grid-template-columns: 1fr;
  }

  .advantages {
    gap: 20px;
  }

  .logo-wall__item {
    flex: 1 1 calc(50% - 12px);
  }

  .contact-cards {
    gap: 16px;
  }

  .contact-card {
    padding: 22px 20px;
  }

  .contact-card__icon {
    width: 46px;
    height: 46px;
    margin-bottom: 14px;
  }

  .contact-card h3 {
    font-size: 17px;
  }
}

/* ---------- 7. 可点击尺寸：手机上一律不小于 44px ---------- */
@media (max-width: 1023px) {
  .btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 22px;
  }

  .btn--sm {
    min-height: 44px;
    padding: 0 16px;
  }

  .link-arrow {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .pagination .page-numbers {
    min-width: 44px;
    height: 44px;
  }

  .pill {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
  }
}

/* ---------- 8. 卡片：触摸设备去掉悬停位移 ---------- */
@media (max-width: 767px) {
  .card__body {
    padding: 18px;
    gap: 8px;
  }

  .card__body h3 {
    font-size: 18px;
  }

  .card__body p {
    font-size: 14px;
    line-height: 1.7;
  }

  .card__media,
  .product-card .card__media {
    aspect-ratio: 16 / 10;
  }

  .card:active {
    opacity: 0.88;
  }

  .advantage h3 {
    font-size: 17px;
  }

  .advantage__icon {
    width: 46px;
    height: 46px;
  }

  .advantage__icon--inline {
    margin-bottom: 12px;
  }

  .media-placeholder {
    gap: 8px;
    padding: 14px;
  }

  .media-placeholder svg {
    width: 26px;
    height: 26px;
  }

  .media-placeholder__label {
    font-size: 11px;
  }
}

/* 触摸设备（手机、平板）统一取消 :hover 造成的位移与缩放 */
@media (hover: none) {
  .card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: var(--c-border);
  }

  .card:hover .card__media img {
    transform: none;
  }

  .advantage:hover .advantage__icon {
    transform: none;
  }

  .contact-card:hover {
    transform: none;
    box-shadow: none;
  }

  .btn:hover,
  .fab:hover {
    transform: none;
  }
}

/* ---------- 9. 表单：手机上最重要的部分 ---------- */
@media (max-width: 767px) {
  .form {
    padding: 22px 18px;
  }

  .form__title {
    font-size: 19px;
  }

  .form__grid {
    gap: 16px;
  }

  .field {
    gap: 7px;
  }

  .field label {
    font-size: 15px;
  }

  /*
   * 16px 是 iOS Safari 的分界线：
   * 小于 16px 时输入框聚焦会触发页面整体放大，用户很难受。
   */
  .field input,
  .field select,
  .field textarea,
  .search-form input[type="search"] {
    font-size: 16px;
    min-height: 50px;
    padding: 12px 14px;
  }

  .field textarea {
    min-height: 124px;
  }

  .field select {
    /* 移动端下拉箭头位置与触控区更稳妥 */
    background-position: right 12px center;
  }

  .form__foot {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: 22px;
  }

  .form__foot .btn {
    width: 100%;
  }

  .form__note {
    font-size: 12px;
    line-height: 1.65;
  }

  .form-status {
    align-items: flex-start;
    font-size: 13px;
  }

  .contact-split__lead {
    font-size: 15px;
  }

  .info-item {
    gap: 12px;
  }

  .info-item__value {
    font-size: 15px;
  }
}

/* ---------- 10. 规格对照表 → 一物一卡 ---------- */
@media (max-width: 767px) {
  .spec-table-wrap {
    overflow: visible;
  }

  /* 桌面端为了让表格不挤压而设的最小宽度，在堆叠布局下必须取消，
     否则卡片会被撑到 520px 宽，在手机上产生横向滚动条 */
  .spec-table-wrap .spec-table {
    min-width: 0;
  }

  .spec-table {
    display: block;
    font-size: 14px;
  }

  .spec-table thead {
    /* 表头信息转移到每张卡片内部（见下方 td::before） */
    display: none;
  }

  .spec-table tbody,
  .spec-table tr,
  .spec-table th,
  .spec-table td {
    display: block;
    width: 100%;
  }

  .spec-table tr {
    margin-bottom: 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: #fff;
    overflow: hidden;
  }

  .spec-table th,
  .spec-table td {
    border: 0;
    padding: 11px 15px;
  }

  .spec-table th {
    white-space: normal;
  }

  .spec-table th[scope="row"] {
    background: var(--c-bg-soft);
    font-size: 15px;
  }

  .spec-table td {
    border-top: 1px solid var(--c-border);
  }

  /* 用 data-th 把表头补回每一项前面，避免看不出这列是什么 */
  .spec-table td::before {
    content: attr(data-th);
    display: block;
    margin-bottom: 3px;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--c-text-muted);
  }
}

/* 产品详情页的规格清单：标签与值上下排 */
@media (max-width: 767px) {
  .spec-list__row {
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 12px 14px;
  }

  .spec-list__label {
    font-size: 13px;
  }
}

/* ---------- 11. 产品页签 → 可横向滑动 ---------- */
@media (max-width: 1023px) {
  .tabs {
    flex-wrap: nowrap;
    gap: 22px;
    margin-bottom: 28px;
    padding-bottom: 2px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-height: 44px;
    padding: 11px 2px 14px;
    font-size: 15px;
    white-space: nowrap;
  }
}

@media (max-width: 767px) {
  /* 负边距让滑动区域延伸到屏幕边缘，手指可以从边上开始滑 */
  .tabs {
    gap: 18px;
    margin: 0 -16px 24px;
    padding: 0 16px 2px;
  }

  .product-panel__desc {
    font-size: 14px;
    margin-bottom: 18px;
  }
}

/* ---------- 12. 流程步骤 ---------- */
@media (max-width: 767px) {
  .step {
    gap: 14px;
    padding: 18px;
  }

  .step__no {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .step__title {
    font-size: 16px;
    margin-bottom: 6px;
  }

  .step p {
    font-size: 14px;
    line-height: 1.7;
  }

  .doc-card__body {
    padding: 18px;
  }

  .checklist li {
    font-size: 14px;
  }
}

/* ---------- 13. 产品详情 ---------- */
@media (max-width: 1023px) {
  .product-detail {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

@media (max-width: 767px) {
  .product-detail__actions {
    flex-direction: column;
    gap: 10px;
    margin: 22px 0 20px;
  }

  .product-detail__actions .btn {
    width: 100%;
  }

  .product-detail__meta {
    gap: 8px;
  }

  .product-detail__head h2 {
    font-size: 21px;
  }
}

/* ---------- 14. 页脚 ---------- */
@media (max-width: 767px) {
  .site-footer {
    padding-top: 48px;
  }

  .footer-grid {
    gap: 28px;
    padding-bottom: 32px;
  }

  .footer-brand {
    gap: 10px;
  }

  .footer-about {
    font-size: 13px;
  }

  .footer-title {
    margin-bottom: 12px;
    font-size: 15px;
  }

  /* 页脚链接加高，手指不容易点错 */
  .footer-links a,
  .footer-contact li {
    min-height: 38px;
    display: flex;
    align-items: center;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
  }
}

/* ---------- 15. 移动端底部固定操作条 ---------- */
@media (max-width: 767px) {
  /* 给固定条让出高度，否则会遮住页尾最后一行内容 */
  body {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }

  .floating-contact {
    left: 12px;
    right: 12px;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: stretch;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  }

  /* 「返回顶部」在手机上由手势完成，不占位置 */
  .floating-contact .fab--top {
    display: none;
  }

  .fab--call {
    display: inline-flex;
  }

  .floating-contact .fab {
    min-height: 52px;
    padding: 0 12px;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  }

  /* 只有「联系我们」一个按钮时占满整行，不留半截空位 */
  .floating-contact--single {
    grid-template-columns: 1fr;
  }

  /* 顶部提示条避开底部固定条 */
  .site-toast {
    left: 12px;
    right: 12px;
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    max-width: none;
    transform: translate(0, 12px);
  }

  .site-toast.is-visible {
    transform: translate(0, 0);
  }
}

/* ---------- 16. 其余组件在窄屏上的收口 ---------- */
@media (max-width: 767px) {
  .trustbar {
    padding: 30px 0;
  }

  .audience-band {
    padding: 20px;
  }

  .audience-band__lead {
    font-size: 15px;
  }

  .audience-band__note {
    font-size: 13px;
  }

  .cta-band {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 26px 20px;
  }

  .cta-band__actions {
    flex-direction: column;
    gap: 10px;
  }

  .cta-band__actions .btn {
    width: 100%;
  }

  .map-embed {
    height: 240px;
  }

  .notice {
    gap: 10px;
    padding: 15px 16px;
    font-size: 13px;
  }

  .empty-state {
    padding: 32px 18px;
  }

  .search-form {
    flex-direction: column;
  }

  .search-form .btn {
    width: 100%;
  }

  .prose h2 {
    font-size: 20px;
  }

  .prose h3 {
    font-size: 17px;
  }

  .prose li,
  .prose p {
    font-size: 15px;
  }

  /* 富文本里的宽表格同样允许自己滚动，而不是撑破页面 */
  .prose table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .page-hero {
    padding: calc(var(--header-h) + 44px) 0 40px;
  }

  .page-hero--slim {
    padding: calc(var(--header-h) + 28px) 0 30px;
  }

  .breadcrumb {
    margin-bottom: 12px;
    font-size: 12px;
  }
}

/* ---------- 17. 小屏手机 ---------- */
@media (max-width: 420px) {
  .container {
    padding: 0 14px;
  }

  .grid {
    gap: 14px;
  }

  .card__body {
    padding: 16px;
  }

  .hero__facts {
    gap: 15px;
  }

  .hero__fact strong {
    font-size: 18px;
  }

  .btn {
    padding: 0 18px;
    font-size: 15px;
  }

  .brand__name {
    font-size: 16px;
  }

  .brand__sub {
    letter-spacing: 0.14em;
  }

  .form {
    padding: 18px 15px;
  }

  .contact-card {
    padding: 20px 17px;
  }

  .step {
    padding: 16px;
  }

  .floating-contact .fab {
    font-size: 13px;
    padding: 0 8px;
  }
}

/* ---------- 18. 触摸反馈与降级 ---------- */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .fab,
  .tab,
  .pill,
  .nav-drawer__link,
  .lang-switch__item,
  .link-arrow {
    /* 去掉安卓上难看的灰色高亮方块，改用 :active 自己控制 */
    -webkit-tap-highlight-color: transparent;
  }

  .btn:active,
  .fab:active,
  .pill:active {
    opacity: 0.9;
  }
}

/* 用户开启「减弱动态效果」时，滚动动画与平滑滚动一并关闭 */
@media (prefers-reduced-motion: reduce) {
  .tabs {
    scroll-behavior: auto;
  }
}
