/* ==========================================================================
   MASA EXPORTS – COMPLETE RESPONSIVE STYLESHEET
   Mobile, Tablet, Laptop, and Large Desktop Fluid Optimization
   Tested across: 1920x1080, 1440x900, 1280x800, 1024x768, 834x1194,
                  768x1024, 430x932, 390x844, 375x812, 360x800, 320x700
   ========================================================================== */

/* --------------------------------------------------------------------------
   DESKTOP & LARGE SCREENS (Min 1025px)
   -------------------------------------------------------------------------- */
@media (min-width: 1025px) {
  .mobile-nav-toggle,
  .mobile-nav-drawer,
  .mobile-nav-overlay {
    display: none !important;
  }

  .desktop-nav {
    display: flex !important;
  }

  .hero-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    gap: 3rem;
  }
}

/* --------------------------------------------------------------------------
   MEDIUM DESKTOP / LAPTOPS (1025px to 1280px)
   -------------------------------------------------------------------------- */
@media (min-width: 1025px) and (max-width: 1280px) {
  :root {
    --nav-height: 76px;
  }

  .nav-menu {
    gap: 1.25rem;
  }

  .nav-link {
    font-size: 0.88rem;
  }

  .btn-nav-rfq {
    padding: 0.55rem 1.15rem;
    font-size: 0.8rem;
  }

  .footer-grid {
    grid-template-columns: 1.6fr 1fr 1fr 1fr 1.2fr;
    gap: 1.75rem;
  }
}

/* --------------------------------------------------------------------------
   TABLET & MOBILE BREAKPOINT (Max 1024px)
   Switches cleanly to the dedicated touch-optimized drawer
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  :root {
    --nav-height: 72px;
  }

  /* Hide desktop menu, show hamburger */
  .desktop-nav,
  .nav-actions {
    display: none !important;
  }

  .mobile-nav-toggle {
    display: flex !important;
  }

  /* Grid adaptations */
  .division-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
  }

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

  .trust-item:nth-child(2) {
    border-right: none;
  }

  .trust-item:nth-child(1),
  .trust-item:nth-child(2) {
    border-bottom: 1px solid var(--color-border-light);
  }

  .compliance-workflow {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }

  .supply-chain-flow {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.25rem;
  }

  .footer-brand {
    grid-column: span 3;
    max-width: 100%;
  }

  .incoterms-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .hero-grid {
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 2.5rem;
  }

  .hero-content {
    max-width: 780px;
    margin: 0 auto;
    padding-top: calc(var(--nav-height) + 2rem);
  }

  .hero-cta-group {
    justify-content: center;
  }

  .globe-container {
    height: clamp(380px, 50vh, 500px) !important;
    width: 100%;
    max-width: 550px;
    margin: 0 auto;
  }
}

/* --------------------------------------------------------------------------
   TABLET PORTRAIT & COMPACT TABLETS (Max 868px)
   -------------------------------------------------------------------------- */
@media (max-width: 868px) {
  .section {
    padding: clamp(3.5rem, 6vw, 5rem) 0;
  }

  .trust-bar {
    margin-top: -2rem;
  }

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

  .wizard-progress-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
    gap: 0;
  }

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

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

  .footer-brand {
    grid-column: span 2;
  }

  .footer-bottom-inner {
    flex-direction: column;
    text-align: center;
    gap: 1.25rem;
  }

  .footer-legal-links {
    justify-content: center;
  }

  .canadian-compliance-pill {
    justify-content: center;
  }

  /* Two Column Feature Sections Stacking */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1.25fr"],
  [style*="grid-template-columns: 1.2fr 0.8fr"] {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
  }
}

/* --------------------------------------------------------------------------
   PHONES & SMALL TABLETS (Max 640px)
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  :root {
    --nav-height: 68px;
  }

  .brand-logo-img {
    height: 38px;
  }

  .mobile-nav-drawer {
    width: 92%;
    max-width: 360px;
  }

  .division-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .supply-chain-flow {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .product-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

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

  .trust-item {
    border-right: none;
    border-bottom: 1px solid var(--color-border-light);
    padding: 1.75rem 1.25rem;
  }

  .trust-item:last-child {
    border-bottom: none;
  }

  .compliance-workflow {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-brand {
    grid-column: span 1;
  }

  .globe-container {
    height: 360px !important;
  }

  .globe-overlay-pin {
    display: none; /* Hide floating text overlays on small mobile to prevent text clash */
  }

  .wizard-body {
    padding: 2rem 1.25rem;
  }

  .wizard-steps-header {
    padding: 1.5rem 1.25rem;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem 1.25rem;
  }

  .search-box {
    min-width: 100%;
  }

  .filter-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .filter-tab {
    flex-shrink: 0;
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
  }

  /* Touch Ergonomics on Small Screens */
  .form-input, .form-select, .form-textarea {
    font-size: 16px !important; /* Critical to prevent iOS auto-zoom */
    padding: 0.85rem 1rem;
    min-height: 48px;
  }

  .floating-contact-widget {
    left: 1rem;
    bottom: 1.25rem;
  }

  .btn-back-to-top {
    right: 1rem;
    bottom: 1.25rem;
    width: 42px;
    height: 42px;
  }

  .contact-widget-trigger {
    width: 48px;
    height: 48px;
  }

  .contact-widget-menu {
    width: 250px;
    bottom: 58px;
  }

  .modal-container {
    max-height: 85vh;
  }

  .modal-header {
    padding: 1.25rem 1.5rem;
  }

  .modal-body {
    padding: 1.5rem 1.25rem;
  }
}

/* --------------------------------------------------------------------------
   SMALL PHONES (Max 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .hero-cta-group {
    flex-direction: column;
    width: 100%;
  }

  .hero-cta-group .btn {
    width: 100%;
  }

  .incoterms-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .incoterm-chip-label {
    padding: 0.85rem 0.4rem;
    font-size: 0.85rem;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Compact Wizard Progress Bar for Tiny Viewports */
  .wizard-progress-bar {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
  }

  .step-indicator {
    flex-direction: column;
    text-align: center;
    gap: 0.3rem;
  }

  .step-label {
    font-size: 0.68rem;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .step-badge-num {
    width: 28px;
    height: 28px;
    font-size: 0.78rem;
  }

  .wizard-footer {
    flex-direction: column;
    gap: 1rem;
  }

  .wizard-footer .btn {
    width: 100%;
  }

  .wizard-footer div {
    width: 100%;
    margin-left: 0 !important;
  }

  .product-card-actions {
    flex-direction: column;
  }

  .product-card-actions .btn {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   ULTRA-COMPACT PHONES (Max 360px)
   Tested for 320x700 and 360x800 viewport widths
   -------------------------------------------------------------------------- */
@media (max-width: 360px) {
  :root {
    --nav-height: 64px;
  }

  .container,
  .container-wide {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .brand-logo-img {
    height: 32px;
  }

  .mobile-nav-drawer {
    width: 100%;
    max-width: 100%;
  }

  h1 {
    font-size: 1.85rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .step-label {
    display: none; /* Only show numbered badge on 320px screens */
  }

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