/*
 * Responsive Breakpoints Stylesheet
 * DongGuan QingTong PhotoElectric Technology CO.,LTD
 * Standardized across 1920px (FHD), 1440px (Desktop), 1024px (Tablet Landscape), 768px (Tablet Portrait), and 375px~480px (Mobile)
 * Strictly prevents horizontal overflow, element clipping, and layout misalignment (错版).
 */

/* ==========================================================================
   0. Global Anti-Overflow Foundations
   ========================================================================== */
html, body {
  max-width: 100vw;
  overflow-x: clip !important;
  position: relative;
}

.qt-container,
.qt-container-wide,
.qt-hero-grid,
.qt-hero-content,
.qt-hero-visual {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.qt-grid-2,
.qt-grid-3,
.qt-grid-4,
.qt-grid-5,
.qt-facility-grid,
.qt-pipeline-grid {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.qt-grid-2 > *,
.qt-grid-3 > *,
.qt-grid-4 > *,
.qt-grid-5 > *,
.qt-facility-grid > *,
.qt-pipeline-grid > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* ==========================================================================
   1. Large Laptops & Small Desktops (<= 1200px)
   ========================================================================== */
@media (max-width: 1200px) {
  .qt-container, .qt-container-wide {
    padding-left: 20px;
    padding-right: 20px;
  }

  .qt-grid-5 {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .qt-pipeline-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .qt-footer-grid {
    grid-template-columns: 1.2fr 1fr 1fr 1fr;
    gap: 32px;
  }

  .qt-global-showcase {
    gap: 32px;
    padding: 36px;
  }

  .qt-float-badge.pos-top-right {
    right: 0%;
  }

  .qt-float-badge.pos-mid-left {
    left: 0%;
  }
}

/* ==========================================================================
   2. Tablets & Landscape Handhelds (<= 992px)
   ========================================================================== */
@media (max-width: 992px) {
  /* Header & Navigation Drawer */
  .qt-header-actions .qt-btn-rfq {
    display: none;
  }

  .qt-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .qt-nav-menu {
    position: fixed;
    top: var(--qt-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--qt-bg-primary);
    border-top: 1px solid var(--qt-border);
    flex-direction: column;
    align-items: stretch;
    padding: 24px 20px;
    gap: 12px;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    overflow-y: auto;
    z-index: 999;
    transition: all var(--qt-transition-base);
  }

  .qt-nav-menu.is-active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .qt-nav-menu > li > a {
    font-size: 1.05rem;
    padding: 12px 14px;
    border-radius: var(--qt-radius-md);
    background: rgba(255, 255, 255, 0.02);
    display: block;
  }

  .qt-dropdown-menu {
    position: static;
    min-width: 0;
    width: 100%;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--qt-border);
    border-radius: var(--qt-radius-md);
    padding: 8px 12px;
    margin: 6px 0 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  /* Hero Section Grid */
  .qt-hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }

  .qt-hero-desc {
    margin-left: auto;
    margin-right: auto;
  }

  .qt-hero-actions {
    justify-content: center;
  }

  .qt-trust-row {
    justify-content: center;
  }

  .qt-hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .qt-advantage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .qt-esp32-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .qt-hero-showcase-wrap {
    margin-top: 24px;
  }

  .qt-hero-remote-img {
    max-height: 380px;
  }

  .qt-float-badge.pos-top-right {
    top: 10%;
    right: 5%;
  }

  .qt-float-badge.pos-mid-left {
    top: 50%;
    left: 5%;
  }

  .qt-float-badge.pos-bottom-right {
    bottom: 8%;
    right: 5%;
  }

  /* Product & Category Grids */
  .qt-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
  }

  .qt-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .qt-facility-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .qt-cmf-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .qt-related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .qt-milestone-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  /* Global Supply Chain Box */
  .qt-global-showcase {
    grid-template-columns: 1fr;
    padding: 36px 28px;
    text-align: center;
    gap: 36px;
  }

  .qt-global-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  /* Single Product Detail Page */
  .qt-single-product-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .qt-gallery-main {
    min-height: 380px;
    padding: 24px;
  }

  /* Footer */
  .qt-footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 36px;
  }
}

/* ==========================================================================
   3. Tablet Portrait & Phablet Handhelds (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* Hide desktop topbar */
  .qt-topbar {
    display: none;
  }

  .qt-section {
    padding-top: 60px;
    padding-bottom: 60px;
  }

  .qt-section-sm {
    padding-top: 40px;
    padding-bottom: 40px;
  }

  /* Cinematic Hero Scaling */
  .qt-hero-cinematic {
    padding: 50px 0 60px;
  }

  .qt-title-hero {
    font-size: clamp(1.85rem, 5.5vw, 2.5rem);
    line-height: 1.25;
  }

  .qt-title-section {
    font-size: clamp(1.6rem, 4vw, 2.1rem);
  }

  .qt-hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .qt-advantage-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .qt-hero-remote-img {
    max-height: 300px;
  }

  /* Badges: prevent overlap and clipping by making them flex chips below remote */
  .qt-hero-showcase-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
  }

  .qt-float-badge {
    position: static;
    transform: none !important;
    animation: none;
    margin: 6px auto;
    width: 100%;
    max-width: 320px;
    justify-content: flex-start;
    font-size: 0.75rem;
    padding: 6px 14px;
    box-sizing: border-box;
  }

  /* Category Filter Tab Bar: Native App Touch-Scroll */
  .qt-tabs-bar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    padding: 6px 12px 14px;
    margin: 0 0 28px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

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

  .qt-tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.8125rem;
    padding: 8px 16px;
  }

  /* All Multi-Column Grids collapse to single or 2 columns */
  .qt-grid-2,
  .qt-grid-3,
  .qt-grid-4,
  .qt-grid-5 {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .qt-pipeline-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .qt-facility-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .qt-cmf-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .qt-related-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .qt-milestone-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .qt-oem-card,
  .qt-workshop-card {
    padding: 24px !important;
  }

  /* Configurator & Volume Tiers on Mobile */
  .qt-volume-tiers-wrap {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .qt-stage-view-switcher {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .qt-stage-view-switcher .qt-view-btn {
    white-space: nowrap;
  }

  .qt-cfg-summary-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .qt-facility-thumb {
    aspect-ratio: 16 / 9;
  }

  /* CTA Button Group Stack */
  .qt-cta-button-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    gap: 12px;
  }

  .qt-cta-button-group .qt-btn {
    width: 100%;
    justify-content: center;
    padding: 14px 18px;
    font-size: 0.9375rem;
    white-space: normal;
    text-align: center;
    box-sizing: border-box;
  }

  /* Forms & RFQ Modal */
  .qt-form-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .qt-qty-pills {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .qt-checkbox-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .qt-modal-dialog {
    max-height: 92vh;
    border-radius: var(--qt-radius-md);
  }

  .qt-modal-header {
    padding: 18px 20px;
  }

  .qt-modal-body {
    padding: 20px;
  }

  .qt-modal-footer {
    padding: 16px 20px;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .qt-modal-footer .qt-btn-primary {
    width: 100%;
  }

  /* Tables: responsive scrollable container */
  .qt-spec-table-full {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .qt-spec-table-full th,
  .qt-spec-table-full td {
    padding: 10px 14px;
    font-size: 0.8125rem;
  }

  /* Footer */
  .qt-footer {
    padding-top: 50px;
  }

  .qt-footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .qt-footer-bottom-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

/* ==========================================================================
   4. Compact Mobile Devices (<= 480px, iPhone SE / 12mini / Android)
   ========================================================================== */
@media (max-width: 480px) {
  .qt-container, .qt-container-wide {
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Header Branding & Mobile Toggle */
  .qt-navbar {
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .qt-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }

  .qt-logo img {
    height: 36px !important;
    width: auto !important;
    max-width: 210px;
    display: block;
  }

  .qt-mobile-toggle {
    flex-shrink: 0;
  }

  /* Typography */
  .qt-eyebrow {
    font-size: 0.6875rem;
    padding: 4px 10px;
  }

  .qt-title-hero {
    font-size: 1.75rem;
  }

  .qt-hero-desc {
    font-size: 0.875rem;
    line-height: 1.55;
  }

  /* Hero Actions */
  .qt-hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .qt-hero-actions .qt-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 18px;
    font-size: 0.875rem;
  }

  .qt-trust-row {
    gap: 6px;
  }

  .qt-trust-tag {
    font-size: 0.6875rem;
    padding: 3px 8px;
  }

  /* Global Showcase Stats */
  .qt-global-showcase {
    padding: 20px 14px;
  }

  .qt-global-stat-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .qt-global-stat-box {
    padding: 10px;
  }

  .qt-global-stat-num {
    font-size: 1.25rem;
  }

  /* Product Card on Small Screens */
  .qt-product-card-pro {
    border-radius: var(--qt-radius-md);
  }

  .qt-card-thumb-wrap {
    padding: 20px 14px;
  }

  .qt-card-thumb-wrap img {
    max-height: 180px;
  }

  .qt-card-body-pro {
    padding: 16px;
  }

  .qt-card-title-pro {
    font-size: 0.95rem;
  }

  .qt-card-spec-grid {
    grid-template-columns: 1fr 1fr;
    padding: 8px 10px;
    gap: 6px 8px;
  }

  .qt-card-spec-label {
    font-size: 0.625rem;
  }

  .qt-card-spec-val {
    font-size: 0.75rem;
  }

  .qt-card-actions-row {
    flex-direction: column;
    gap: 8px;
  }

  .qt-card-actions-row .qt-btn {
    width: 100%;
    justify-content: center;
  }

  /* Single PDP Specifics */
  .qt-single-title {
    font-size: 1.5rem;
  }

  .qt-quick-specs-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }

  /* RFQ Modal */
  .qt-modal-overlay {
    padding: 8px;
  }

  .qt-modal-title {
    font-size: 1.15rem;
  }

  .qt-modal-product-summary {
    padding: 10px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}
