:root {
  --bp-sm: 640px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1280px;
}

/* Tablet & Smaller Desktop (<= 1024px) */
@media (max-width: 1024px) {
  .header .nav-links {
    display: none;
  }
  
  .header .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(197, 160, 89, 0.3);
    border-radius: var(--radius-md);
    cursor: pointer;
    z-index: 101;
    padding: 10px;
    color: var(--color-white);
  }

  .mobile-nav-header .mobile-close-btn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  
  .mobile-nav .nav-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    text-align: center;
  }
  
  .mobile-nav .nav-link {
    font-size: var(--font-size-xl);
  }
}

/* Universal Container & Typography Auto-Adjustment */
@media (max-width: 768px) {
  :root {
    --container-padding: clamp(0.875rem, 3.5vw, 1.25rem);
  }

  .container {
    width: 100% !important;
    max-width: 100% !important;
    padding-inline: var(--container-padding) !important;
    box-sizing: border-box !important;
  }

  .section-padding {
    padding-block: clamp(2.75rem, 6vw, 4.5rem) !important;
  }

  h1, .h1 {
    font-size: clamp(1.85rem, 7vw, 2.75rem) !important;
    line-height: 1.18 !important;
  }

  h2, .h2, .section-title {
    font-size: clamp(1.5rem, 5.5vw, 2.2rem) !important;
    line-height: 1.22 !important;
  }

  .section-subtitle, .subtitle {
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
  }

  /* Prevent iOS Auto-Zoom on form focus */
  input, select, textarea, .form-input, .form-textarea, .ai-input {
    font-size: 16px !important;
    box-sizing: border-box !important;
  }

  /* Header Optimization: hide desktop consultation and phone pill to prevent wrapping */
  .header-inner {
    height: 62px !important;
    padding-inline: 0.75rem !important;
  }

  .header-actions #header-cta,
  .header-actions .btn.btn-primary,
  .header-actions .btn-phone-header {
    display: none !important;
  }

  .header .logo-mark img {
    height: 38px !important;
  }

  .header .logo-name {
    font-size: 1.1rem !important;
  }

  .header .logo-tagline {
    font-size: 0.65rem !important;
    letter-spacing: 1px !important;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Full-width ergonomic forms on mobile */
  .contact-form-wrapper {
    padding: 1.5rem 1.125rem !important;
    margin: 1.5rem auto 0 !important;
    border-radius: var(--radius-lg) !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .form-group {
    margin-bottom: 1rem !important;
  }

  .form-input, .form-textarea {
    width: 100% !important;
    min-height: 48px !important;
    padding: 12px 14px !important;
  }

  .form-textarea {
    min-height: 100px !important;
  }
  
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .services-grid, .testimonials-grid {
    grid-template-columns: 1fr;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  .article-grid,
  .why-grid,
  .value-cards {
    grid-template-columns: 1fr;
  }

  .update-card {
    flex-direction: column;
  }

  .page-hero {
    padding-block: clamp(3.5rem, 8vw, 6rem);
  }

  #horizontal-testimonial-slider {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: var(--radius-lg) !important;
  }

  .testimonial-slide {
    padding: 1.5rem 1.125rem !important;
  }

  /* Regulatory Ticker Mobile */
  .regulatory-ticker-inner {
    flex-direction: column !important;
    text-align: center !important;
    gap: 1rem !important;
  }

  .regulatory-ticker-items {
    justify-content: center !important;
    gap: 0.75rem !important;
  }

  .regulatory-ticker-item {
    padding: 5px 12px !important;
  }

  /* About Photo Card Mobile */
  .about-photo-card img {
    height: clamp(230px, 55vw, 340px) !important;
  }

  .about-photo-badge {
    padding: 0.75rem 1rem !important;
    bottom: 0.75rem !important;
    left: 0.75rem !important;
    right: 0.75rem !important;
  }

  /* Service Card With Img Mobile */
  .service-card-img-wrapper {
    height: 140px !important;
  }

  .service-card-body {
    padding: 1.25rem 1rem 1.5rem !important;
  }
}

/* Mobile Devices (<= 640px) */
@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .hero-card {
    padding: 1.5rem 1.25rem !important;
  }

  .hero-trust-metrics {
    gap: 1.25rem !important;
    justify-content: space-between;
  }
  
  /* AI Assistant mobile panel ergonomics */
  .ai-panel {
    width: calc(100vw - 24px) !important;
    max-height: 75vh !important;
    bottom: 80px !important;
    right: 12px !important;
    left: 12px !important;
  }
  
  .ai-launcher {
    bottom: 16px !important;
    right: 16px !important;
    width: 50px !important;
    height: 50px !important;
  }

  /* Floating Quick Connect Dock: Compact circular icons to prevent blocking content */
  .quick-connect-dock {
    bottom: 16px !important;
    left: 16px !important;
    gap: 8px !important;
  }

  .quick-connect-dock .whatsapp-float-btn,
  .quick-connect-dock .call-float-btn {
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
  }

  .quick-connect-dock .whatsapp-float-btn span,
  .quick-connect-dock .call-float-btn span {
    display: none !important;
  }
  
  /* Tables Touch Scroll Container */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
  }
  
  table {
    min-width: 540px;
  }

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

  .two-column {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
}

/* Small Handset Screens (<= 480px) */
@media (max-width: 480px) {
  .header-inner {
    padding-inline: 0.5rem !important;
    height: 56px !important;
  }

  .header .logo-link {
    gap: 0.35rem !important;
  }

  .header .logo-text .logo-tagline {
    display: none !important;
  }

  .header .logo-name {
    font-size: 0.95rem !important;
    letter-spacing: 0px !important;
  }

  .header .logo-mark img {
    height: 34px !important;
  }

  /* In header, turn whatsapp button into icon-only pill to keep navbar clean */
  .header-actions .btn-whatsapp-header {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    justify-content: center !important;
    border-radius: 50% !important;
  }

  .header-actions .btn-whatsapp-header span {
    display: none !important;
  }

  .header .mobile-menu-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    padding: 8px !important;
  }

  /* Footer Contact Cards Mobile Ergonomics */
  .footer-contact-card {
    padding: 0.5rem 0.75rem !important;
    gap: 0.6rem !important;
  }

  .footer-contact-icon {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
  }

  .footer-contact-val {
    font-size: 0.775rem !important;
  }
}

/* Mobile Landscape (Short Viewports <= 500px Height) */
@media (max-height: 500px) and (orientation: landscape) {
  .header-inner {
    height: 52px !important;
  }

  .header .logo-mark img {
    height: 32px !important;
  }

  .header .logo-name {
    font-size: 1rem !important;
  }

  .header .logo-tagline {
    display: none !important;
  }
}

/* Touch Separation for Footer Links */
.footer-nav-link {
  display: inline-block;
  padding: 6px 0;
  min-height: 32px;
}

.footer-legal-links a {
  display: inline-block;
  padding: 6px 12px;
  min-height: 36px;
}

/* Safe Area Insets for Modern Handsets (iPhone Notch / Android Gesture Bar) */
.quick-connect-dock {
  bottom: max(16px, env(safe-area-inset-bottom, 16px)) !important;
  left: max(16px, env(safe-area-inset-left, 16px)) !important;
}

.ai-launcher {
  bottom: max(16px, env(safe-area-inset-bottom, 16px)) !important;
  right: max(16px, env(safe-area-inset-right, 16px)) !important;
}

.ai-panel {
  bottom: max(80px, calc(env(safe-area-inset-bottom, 16px) + 64px)) !important;
}

/* Foldable / Ultra-Narrow Handsets (<= 360px) */
@media (max-width: 360px) {
  .container {
    padding-inline: 0.75rem !important;
  }

  .section-padding {
    padding-block: 2.75rem !important;
  }

  .card, .update-card, .testimonial-slide {
    padding: 1.25rem 1rem !important;
  }
}


