/* 申璞工业 — 手机/平板适配（预览）。桌面 ≥920px 不改视觉。 */

/* 手机导航控件在桌面默认隐藏，避免影响现有顶栏 */
.sp-nav-toggle,
.sp-mobile-bar,
.sp-mobile-panel,
.sp-nav-backdrop {
  display: none;
}

/* 触控设备取消 Logo 2.5 倍放大（窄屏规则在下方媒体查询里也会覆盖） */
@media (hover: none) {
  .nav .logo:hover,
  nav img.logo:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
}

/* ------------------------------------------------------------------ */
/* 导航切换：平板与手机（<920px）。桌面顶栏保持原样。 */
/* ------------------------------------------------------------------ */
@media (max-width: 919px) {
  html,
  body {
    overflow-x: hidden;
    max-width: 100%;
  }

  body {
    padding-top: calc(48px + env(safe-area-inset-top, 0px));
  }

  /* 仅首页全屏 Hero 不用 body 留白，标题靠自身 padding 避开顶栏。
     行业/人形机器人等页也有 .hero，但不能取消 body 上边距。 */
  body:has(nav.nav) {
    padding-top: 0;
  }

  body:has(nav.nav) .hero {
    padding-top: calc(56px + env(safe-area-inset-top, 0px));
  }

  body:has(.sp-nav-toggle:checked) {
    overflow: hidden;
  }

  /* 隐藏原桌面导航（含胶囊栏和 sticky header） */
  body > nav:not(.sp-mobile-panel),
  nav.nav,
  header:has(nav) {
    display: none !important;
  }

  .sp-nav-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    display: block;
  }

  .sp-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1202;
    height: calc(48px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0 16px;
    box-sizing: border-box;
    background: rgba(10, 30, 46, 0.94);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(64, 201, 255, 0.15);
  }

  .sp-mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    min-height: 44px;
    min-width: 0;
  }

  .sp-mobile-logo {
    width: 32px;
    height: 32px;
    display: block;
    object-fit: contain;
    background: linear-gradient(135deg, #40C9FF 0%, #7FE6A0 50%, #FCD34D 100%);
    padding: 3px;
    border-radius: 50%;
    box-sizing: border-box;
    flex-shrink: 0;
  }

  .sp-mobile-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sp-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
  }

  .sp-nav-toggle:focus-visible + .sp-mobile-bar .sp-nav-btn {
    outline: 2px solid #4DD4AC;
    outline-offset: 2px;
  }

  .sp-nav-bars,
  .sp-nav-bars::before,
  .sp-nav-bars::after {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    position: relative;
    transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
  }

  .sp-nav-bars::before,
  .sp-nav-bars::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .sp-nav-bars::before {
    top: -6px;
  }

  .sp-nav-bars::after {
    top: 6px;
  }

  .sp-nav-toggle:checked ~ .sp-mobile-bar .sp-nav-bars {
    background: transparent;
  }

  .sp-nav-toggle:checked ~ .sp-mobile-bar .sp-nav-bars::before {
    top: 0;
    transform: rotate(45deg);
  }

  .sp-nav-toggle:checked ~ .sp-mobile-bar .sp-nav-bars::after {
    top: 0;
    transform: rotate(-45deg);
  }

  .sp-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  .sp-mobile-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: calc(48px + env(safe-area-inset-top, 0px));
    right: 0;
    bottom: 0;
    width: min(100%, 360px);
    z-index: 1201;
    background: #0A1E2E;
    border-left: 1px solid rgba(64, 201, 255, 0.15);
    padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.28s ease, visibility 0.28s ease;
  }

  .sp-nav-toggle:checked ~ .sp-nav-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .sp-nav-toggle:checked ~ .sp-mobile-panel {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .sp-mobile-panel a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 8px 16px;
    color: #fff;
    text-decoration: none;
    font-size: 17px;
    font-weight: 500;
    border-radius: 12px;
    box-sizing: border-box;
  }

  .sp-mobile-panel a + a {
    margin-top: 4px;
  }

  .sp-mobile-panel a:hover,
  .sp-mobile-panel a:focus-visible {
    background: rgba(77, 212, 172, 0.12);
    color: #4DD4AC;
    outline: none;
  }

  .sp-mobile-panel a.sp-mobile-cta {
    margin-top: 16px;
    justify-content: center;
    background: linear-gradient(135deg, #40C9FF 0%, #7FE6A0 50%, #FCD34D 100%);
    color: #000;
    font-weight: 700;
    border-radius: 100px;
  }

  .sp-mobile-panel a.sp-mobile-cta:hover,
  .sp-mobile-panel a.sp-mobile-cta:focus-visible {
    color: #000;
    background: linear-gradient(135deg, #40C9FF 0%, #7FE6A0 50%, #FCD34D 100%);
    box-shadow: 0 0 24px rgba(77, 212, 172, 0.35);
  }

  /* 取消窄屏下 Logo 的 2.5 倍放大 */
  .nav .logo:hover,
  nav img.logo:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  /* 避免装饰光斑撑出横向滚动 */
  .hero::before {
    width: min(70vw, 320px);
    height: min(70vw, 320px);
    right: -15%;
    top: -15%;
  }

  img {
    max-width: 100%;
  }

  /* 卡片内的图仍按原设计铺满，不改裁切策略 */
  .cat-photo-card img,
  .scene-card img {
    width: 100%;
    height: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sp-mobile-panel,
  .sp-nav-backdrop,
  .sp-nav-bars,
  .sp-nav-bars::before,
  .sp-nav-bars::after {
    transition: none;
  }
}

/* ------------------------------------------------------------------ */
/* 布局与排版：手机及小平板（≤768px） */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
  .hero {
    min-height: 100svh;
    padding: calc(56px + env(safe-area-inset-top, 0px)) 20px 48px;
  }

  .hero h1 {
    font-size: clamp(36px, 14vw, 56px);
    line-height: 1.05;
    margin-bottom: 20px;
  }

  .hero .subtitle {
    font-size: 15px;
    margin-bottom: 28px;
    padding: 0 4px;
  }

  .hero .stats {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px 28px;
    margin-top: 28px;
  }

  .stat-value,
  .stat-number {
    font-size: 32px;
  }

  .scroll-indicator {
    bottom: 24px;
  }

  h1,
  .page-header h1,
  .brand-header h1 {
    font-size: clamp(28px, 8vw, 36px);
    line-height: 1.2;
    word-break: break-word;
  }

  .section-title,
  .form-title,
  .faq-title,
  h2.section-title,
  .section h2 {
    font-size: clamp(22px, 6vw, 28px);
    line-height: 1.3;
  }

  .section-subtitle,
  .subtitle,
  .desc,
  .page-header p {
    font-size: 15px;
    margin-bottom: 28px;
  }

  .scene-title {
    font-size: 22px;
  }

  .cat-title {
    font-size: 20px;
  }

  .container {
    padding-left: 16px;
    padding-right: 16px;
    max-width: 100%;
  }

  body > .container {
    margin-top: 16px;
    margin-bottom: 32px;
    padding-top: 16px;
    padding-bottom: 32px;
  }

  /* 首页大区块上下留白收一收 */
  body:has(.hero) > .container {
    padding-top: 56px;
    padding-bottom: 56px;
  }

  .page-header,
  .brand-header {
    padding: 28px 16px 20px;
  }

  .section,
  .contact-card,
  .form-container,
  .stat-card,
  .card,
  .solution-card,
  .faq-item {
    padding-left: 20px;
    padding-right: 20px;
  }

  .form-container {
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .section {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .cta-section {
    margin: 40px 16px;
    padding: 20px 16px;
  }

  .brands-section {
    margin: 48px 0;
  }

  footer {
    padding: 40px 0 24px;
    margin-top: 48px;
  }

  /* 仍为多列的网格改成单列，避免手机横向溢出 */
  .category-photo-grid,
  .scene-grid,
  .footer-grid,
  .brands-grid,
  .product-grid,
  .products-grid,
  .bento-grid,
  .grid,
  .benefit-grid,
  .solution-grid,
  .project-grid,
  .cert-grid,
  .contact-grid,
  .faq-grid,
  .brand-grid,
  .form-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* 数字卡片两列更紧凑，不必单列拉很长 */
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .form-row {
    display: grid;
    gap: 16px;
  }

  .contact-item {
    flex-wrap: wrap;
  }

  .contact-item strong {
    min-width: 0;
  }

  .form-input,
  .form-select,
  .form-textarea,
  .form-button {
    width: 100%;
    max-width: 100%;
    font-size: 16px; /* 避免 iOS 聚焦时强制缩放 */
  }

  /* 宽表可在区块内横向滑动，不撑开整页 */
  .section:has(table),
  .container:has(table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table,
  .comparison-table {
    max-width: none;
    font-size: 13px;
  }

  table th,
  table td,
  .comparison-table th,
  .comparison-table td {
    padding: 8px 10px;
    word-break: break-word;
    width: auto !important;
  }

  table th:first-child,
  table td:first-child {
    white-space: nowrap;
    word-break: keep-all;
  }

  .cat-photo-card {
    aspect-ratio: 4 / 5;
  }

  .scene-overlay {
    padding: 20px;
  }

  .scene-card {
    aspect-ratio: 16 / 11;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .hero .stats {
    gap: 16px 20px;
  }

  .stat-value,
  .stat-number {
    font-size: 28px;
  }
}

/* ------------------------------------------------------------------ */
/* 桌面中宽布局修补（2026-11-18）：导航文字不折行；行业数字卡片两列 */
/* 仅补强 ≥920px 的桌面顶栏，不影响 ≤919px 的手机汉堡导航。 */
/* ------------------------------------------------------------------ */
@media (min-width: 920px) {
  nav.nav,
  body > nav {
    flex-wrap: nowrap;
  }

  nav.nav a,
  nav.nav .logo,
  nav.nav .cta,
  body > nav a {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* 焊装/电池等页 4 列 .stats 在约 920–1100 宽会横向溢出；关于页同类为 .stats-grid */
@media (max-width: 1100px) {
  .stats,
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
