/* ============================================================
   responsive.css — Tablet & Mobile Breakpoints
   浙江网邦科技有限公司 Corporate Website
   Breakpoints: 1199 | 1023 | 767 | 639 | 479 | 359
   ============================================================ */

/* ── Tablet landscape: max-width 1199px ─────────────────────── */
@media (max-width: 1199px) {

  :root {
    --section-py: 64px;
  }

  .container {
    padding-inline: 20px;
  }

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

  .header-phone { display: none; }

  .hero        { padding-block: 72px 60px; }
  .hero__inner { gap: 40px; }

  .stats-bar__grid { grid-template-columns: repeat(4, 1fr); }

  /* Footer */
  .footer__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
  }
  .footer__brand {
    grid-column: span 3;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 32px;
    align-items: start;
  }
  .footer__brand > :nth-child(1),
  .footer__brand > :nth-child(2) { grid-column: 1; }
  .footer__brand > :nth-child(3) {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .timeline         { max-width: 600px; margin-inline: auto; }
  .contact-layout   { grid-template-columns: 1fr; gap: 32px; }
  .product-detail__overview { gap: 40px; }
  .cert-grid        { grid-template-columns: repeat(3, 1fr); }
  .partners-grid    { grid-template-columns: repeat(4, 1fr); }
  .contact-form     { padding: 36px; }
}

/* ── Tablet portrait: max-width 1023px ──────────────────────── */
@media (max-width: 1023px) {

  /* Header: switch to mobile nav, reflow right-side controls ─── */
  .nav,
  .header .lang-switch { display: none; }

  .header__inner      { gap: 10px; }
  .menu-toggle        { display: flex; margin-left: 0; }
  /* mobile-nav stays display:none until .is-open */
  .mobile-nav.is-open { display: block; }
  .mobile-overlay.is-visible { display: block; }
  .mobile-lang-toggle { display: inline-flex; margin-left: auto; }
  .mobile-lang-toggle svg { opacity: 0.7; }

  /* Hero slightly smaller */
  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .hero__label,
  .hero__actions { justify-content: center; }
  .hero__desc    { margin-inline: auto; }
  .hero__visual  { order: -1; }
  .hero__visual > img { max-width: 320px; margin-inline: auto; }

  /* Tables / pre blocks should scroll horizontally, not burst viewport */
  table, pre { display: block; overflow-x: auto; }

  /* Product detail overview stack */
  .product-detail__overview { grid-template-columns: 1fr; }
}

/* ── Mobile: max-width 767px ────────────────────────────────── */
@media (max-width: 767px) {

  :root {
    --section-py: 48px;
    --gap: 16px;
    --header-height: 60px;
  }

  .container           { padding-inline: 16px; }
  .section-header      { margin-bottom: 32px; }
  .section-header h2   { font-size: 24px !important; }
  .section-top {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Grid */
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }

  /* Header height/padding for more room */
  .header__inner { min-height: var(--header-height); }
  .logo span     { font-size: 16px; }

  /* Hero */
  .hero {
    padding-block: 40px 36px;
  }
  .hero__inner { gap: 28px; }

  /* Hero product-preview on mobile: keep compact & centered */
  .hero-preview        { max-width: 420px; }
  .hero-preview .product-preview__caption { font-size: 13px; }
  .hero-preview .product-preview__dots    { margin-top: 12px; }
  .hero-preview .product-preview__browser-bar { height: 24px; }
  .hero__title,
  .hero h1 {
    font-size: clamp(24px, 6.5vw, 32px) !important;
    line-height: 1.3;
  }
  .hero__desc {
    font-size: 15px !important;
    line-height: 1.7;
  }
  .hero__visual > img { max-width: 260px; }
  .hero__actions {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }
  .hero__actions .btn { width: 100%; }

  /* Stats */
  .stats-bar      { padding-block: 32px; }
  .stats-bar__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: rgba(255,255,255,.15);
  }
  .stats-bar__item {
    background: var(--color-primary);
    border-right: none;
    padding: 20px 12px;
  }
  .stats-bar__num   { font-size: 28px; }
  .stats-bar__label { font-size: 12px; }

  /* Cards unify */
  .product-card,
  .solution-card,
  .case-card,
  .news-card {
    border-radius: 12px;
  }
  .case-card__title,
  .product-card__title,
  .solution-card__title,
  .news-card__title { font-size: 16px; line-height: 1.4; }

  /* News list */
  .news-list-item {
    flex-direction: column;
    gap: 14px;
  }
  .news-list-item__img {
    width: 100%;
    height: 200px;
  }

  /* Partners */
  .partners-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }

  /* Footer — Brand full-width, Products+QuickLinks side-by-side, rest stacked */
  .footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px 20px;
    text-align: left;
  }
  .footer__brand {
    grid-column: 1 / -1;   /* full width */
    display: block;
  }
  .footer__brand .footer__tagline { display: block; font-size: 14px; }
  /* Products (col 2 in source) and Quick Links (col 3) share one row */
  .footer__col:nth-of-type(2),
  .footer__col:nth-of-type(3) {
    grid-column: span 1;
  }
  /* Contact and QR take full width on their own rows */
  .footer__col:nth-of-type(4),
  .footer__col:nth-of-type(5) {
    grid-column: 1 / -1;
  }
  .footer__bottom {
    flex-direction: column;
    text-align: center;
    gap: 8px;
    font-size: 12px;
  }
  .footer__socials { gap: 10px; }
  .footer__social  { width: 40px; height: 40px; } /* tap-friendly */

  /* Page hero */
  .page-hero         { padding-block: 52px 44px; }
  .page-hero h1      { font-size: 28px !important; }
  .page-hero__desc   { font-size: 14px; }

  /* Section titles inline-styled via clamp override */
  [style*="font-size:clamp(24px,3vw,36px)"],
  [style*="font-size:clamp(28px"],
  [style*="font-size: clamp(24px, 3vw, 36px)"] {
    font-size: 24px !important;
  }
  [style*="font-size:clamp(30px"],
  [style*="font-size:clamp(32px"],
  [style*="font-size:clamp(36px"],
  [style*="font-size:clamp(40px"],
  [style*="font-size:clamp(42px"],
  [style*="font-size:clamp(48px"] {
    font-size: 28px !important;
    line-height: 1.3 !important;
  }

  /* Inline margin overrides for dense blocks */
  [style*="margin-bottom:36px"],
  [style*="margin-bottom: 36px"] { margin-bottom: 24px !important; }
  [style*="margin-bottom:48px"]  { margin-bottom: 28px !important; }
  [style*="padding:48px"]        { padding: 28px 20px !important; }
  [style*="padding:40px"]        { padding: 24px 18px !important; }
  [style*="gap:36px"]            { gap: 20px !important; }
  [style*="gap:48px"]            { gap: 24px !important; }

  /* Timeline */
  .timeline      { padding-left: 28px; }
  .timeline__dot { left: -22px; width: 12px; height: 12px; }

  /* Tabs */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { padding: 10px 16px; font-size: 14px; white-space: nowrap; flex-shrink: 0; }

  /* Filter bar — horizontal scroll instead of wrap chaos */
  .filter-bar {
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-inline: -16px;
    padding-inline: 16px;
    padding-bottom: 4px;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-tag {
    padding: 8px 16px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  /* Contact form */
  .contact-form { padding: 24px 20px; }
  .form-row     { grid-template-columns: 1fr; }
  .form-control { font-size: 16px; padding: 12px 14px; }

  /* Pagination */
  .pagination { gap: 4px; }
  .pagination__item {
    width: 38px;
    height: 38px;
    font-size: 13px;
    min-width: 38px;
  }
  .pagination__item--prev span,
  .pagination__item--next span { display: none; }
  .pagination__item--prev,
  .pagination__item--next { padding-inline: 10px; width: 38px; }

  /* Jobs */
  .job-card {
    flex-direction: column;
    gap: 16px;
    padding: 18px;
  }
  .job-card__actions { flex-direction: row; width: 100%; }
  .job-card__actions .btn { flex: 1; }
  .job-card__salary { font-size: 20px; }

  /* Downloads */
  .download-item          { flex-wrap: wrap; gap: 12px; }
  .download-item__actions { width: 100%; justify-content: flex-end; }

  /* Cert */
  .cert-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* CTA */
  .cta-banner { padding-block: 52px; }
  .cta-banner__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .cta-banner__actions .btn { width: 100%; }

  /* Contact */
  .contact-layout { grid-template-columns: 1fr; }
  .map-embed      { height: 260px; }

  /* Buttons */
  .btn     { padding: 12px 20px; }
  .btn--lg { padding: 14px 24px; font-size: 15px; min-height: 48px; }
  .btn--sm { min-height: 36px; }

  /* Breadcrumb wrap */
  .page-hero__breadcrumb { flex-wrap: wrap; font-size: 12px; }

  /* Prevent long English words from breaking layout */
  h1, h2, h3, h4,
  .case-card__title,
  .product-card__title,
  .news-card__title {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Mobile nav polish */
  .mobile-nav           { width: min(380px, 94vw); }
  .mobile-nav__link     { padding: 14px 20px; font-size: 16px; }

  /* Mobile nav — language switch (keep visible inside menu) */
  .mobile-nav .lang-switch {
    display: flex;
    justify-content: center;
    align-self: center;
    width: 100%;
    padding: 6px;
    border: 1px solid var(--color-border);
    border-radius: 24px;
    background: var(--color-bg-alt);
  }
  .mobile-nav .lang-switch a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 20px;
    color: var(--color-text-secondary);
    transition: all var(--transition);
  }
  .mobile-nav .lang-switch a.is-active {
    background: var(--color-primary);
    color: #fff;
  }

  /* Case-card image ratio consistency */
  .case-card__img {
    aspect-ratio: 4 / 3;
    overflow: hidden;
  }
  .case-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* All card images */
  .product-card__img img,
  .solution-card__img img,
  .news-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* ── Small mobile: max-width 639px ──────────────────────────── */
@media (max-width: 639px) {
  .partners-grid { grid-template-columns: repeat(2, 1fr); }

  .stats-bar__num   { font-size: 26px; }
  .stats-bar__item  { padding: 18px 10px; }
}

/* ── Extra small: max-width 479px ───────────────────────────── */
@media (max-width: 479px) {

  :root {
    --section-py: 40px;
  }

  .container { padding-inline: 14px; }

  .section-header    { margin-bottom: 24px; }
  .section-header h2 { font-size: 22px !important; }

  .hero         { padding-block: 40px 32px; }
  .hero__visual > img { max-width: 220px; }

  .page-hero    { padding-block: 44px 36px; }
  .page-hero h1 { font-size: 24px !important; }

  /* Even tighter inline clamp override */
  [style*="font-size:clamp(30px"],
  [style*="font-size:clamp(32px"],
  [style*="font-size:clamp(36px"],
  [style*="font-size:clamp(40px"],
  [style*="font-size:clamp(42px"],
  [style*="font-size:clamp(48px"] {
    font-size: 24px !important;
  }

  .cert-grid     { grid-template-columns: 1fr 1fr; }
  .contact-form  { padding: 20px 14px; }
  .btn--lg       { padding: 13px 20px; font-size: 15px; }

  /* Logo wording shrink */
  .logo span { font-size: 15px; }

  /* CTA text */
  [class*="cta"] h2 { font-size: 22px !important; }

  /* News list image shorter */
  .news-list-item__img { height: 170px; }
}

/* ── Tiny devices: max-width 359px ──────────────────────────── */
@media (max-width: 359px) {
  .container        { padding-inline: 12px; }
  .hero__visual > img { max-width: 180px; }
  .btn              { padding: 11px 16px; font-size: 14px; }
  .section-header h2{ font-size: 20px !important; }
  .stats-bar__num   { font-size: 24px; }
  .page-hero h1     { font-size: 22px !important; }
}

/* ── Landscape phones: avoid oversized hero ─────────────────── */
@media (orientation: landscape) and (max-height: 500px) {
  .hero, .page-hero {
    padding-block: 32px;
  }
  .mobile-nav { overflow-y: auto; }
}

/* ── Touch devices: remove hover transforms ─────────────────── */
@media (hover: none) and (pointer: coarse) {
  .btn:hover,
  .product-card:hover,
  .solution-card:hover,
  .case-card:hover,
  .news-card:hover {
    transform: none !important;
    box-shadow: var(--shadow-card);
  }
}

/* ── Reduced motion ─────────────────────────────────────────── */
@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;
  }
}
