/* ==========================================================================
   A2E AND I TRADERS - Responsive & Adaptive Layouts
   ========================================================================== */

/* Large Desktops */
@media (max-width: 1200px) {
  h1 { font-size: 3rem; }
  h2 { font-size: 2.25rem; }
  
  .hero-headline { font-size: 3.4rem; }
  .section-padding { padding: 80px 0; }
  .footer-container { gap: 30px; }
}

/* Tablets (Portrait & Landscape) */
@media (max-width: 992px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  @supports (overflow: clip) {
    html,
    body {
      overflow-x: clip;
    }
  }

  h1 { font-size: 2.75rem; }
  h2 { font-size: 2rem; }
  
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }
  
  .hero-content {
    text-align: center;
    order: 1;
  }

  .hero-section {
    min-height: auto;
    padding: 96px 0;
  }

  .hero-section .hero-subheadline {
    margin-right: auto;
    margin-left: auto;
    text-align: center;
  }

  .hero-eyebrow,
  .hero-badges-group,
  .hero-section .btn-group {
    justify-content: center;
  }

  .hero-capabilities {
    max-width: 620px;
    margin-right: auto;
    margin-left: auto;
  }
  
  .hero-image-wrapper {
    order: 2;
    max-width: 600px;
    margin: 0 auto;
  }

  .hero-headline {
    font-size: 3rem;
  }
  
  .split-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  
  .split-image-wrapper {
    order: 2;
    max-width: 600px;
    margin: 0 auto;
  }
  
  .split-content {
    order: 1;
  }

  /* Footer responsive grid */
  .footer-container {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }

  /* Header & Navigation changes for mobile drawer */
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 10001;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: calc(100vh - var(--header-height, 104px));
    height: calc(100dvh - var(--header-height, 104px));
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 30px 24px;
    gap: 0;
    transform: none;
    clip-path: inset(0 0 0 100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: top 0.38s cubic-bezier(0.22, 1, 0.36, 1), height 0.38s cubic-bezier(0.22, 1, 0.36, 1), clip-path 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.25s ease, visibility 0s linear 0.4s;
    z-index: 10002 !important; /* Forces drawer on absolute top layer */
    display: flex !important;   /* Guarantees viewport-relative rendering */
    box-shadow: 0 15px 30px rgba(0,0,0,0.08);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .nav-menu.active {
    transform: none;
    clip-path: inset(0 0 0 0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .nav-dropdown {
    width: 100%;
    display: block;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  .nav-dropdown-toggle {
    width: 100%;
    border-bottom: 0 !important;
  }

  .nav-dropdown-toggle::after {
    display: none;
  }

  .nav-dropdown-chevron {
    width: 20px;
    height: 20px;
    margin-left: auto;
  }

  .nav-submenu {
    position: static;
    width: 100%;
    max-height: 0;
    padding: 0 10px;
    overflow: hidden;
    border: 0;
    border-radius: 12px;
    background: rgba(6, 81, 123, 0.045);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: none;
    transition: max-height 0.35s cubic-bezier(0.22,1,0.36,1), padding 0.3s ease, opacity 0.22s ease, visibility 0s linear 0.35s;
  }

  .nav-submenu::before {
    display: none;
  }

  .nav-dropdown:hover .nav-submenu,
  .nav-dropdown:focus-within .nav-submenu {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .nav-dropdown.open .nav-submenu {
    max-height: 190px;
    padding-top: 8px;
    padding-bottom: 8px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .nav-submenu-item {
    padding: 11px 13px;
  }

  .nav-submenu-item span {
    font-size: 0.94rem;
  }

  .nav-item {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--neutral-dark) !important;
    padding: 16px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-fast);
  }

  .nav-item::after {
    content: '→';
    font-size: 1.1rem;
    color: var(--neutral-mid);
    transition: transform var(--transition-fast);
  }

  .nav-item:hover::after {
    transform: translateX(4px);
    color: var(--primary-color);
  }

  .nav-item.active {
    color: var(--primary-color) !important;
    font-weight: 600;
  }

  .nav-item.active::after {
    color: var(--primary-color);
  }

  .nav-menu .cta-button {
    margin-top: 30px;
    width: 100% !important;
    text-align: center;
    padding: 14px;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
    box-sizing: border-box;
  }

  /* Mobile menu burger animation */
  .mobile-menu-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .mobile-menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }
  
  body.menu-open {
    overflow-x: hidden;
  }

  @supports (overflow: clip) {
    body.menu-open {
      overflow-x: clip;
    }
  }

  /* Contact page */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  
  .contact-info-card {
    order: 2;
  }
  
  .contact-form-card {
    order: 1;
    padding: 30px;
  }
}

/* Mobile Screens */
@media (max-width: 768px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.4rem; }
  
  .hero-headline {
    font-size: clamp(2.35rem, 10vw, 3rem);
  }

  .hero-section {
    padding: 72px 0 76px;
  }
  
  .hero-subheadline {
    font-size: 1.02rem;
    margin-bottom: 24px;
  }
  
  .inner-hero {
    padding: 60px 0;
  }
  
  .inner-hero-title {
    font-size: 2.25rem;
  }

  .section-padding {
    padding: 60px 0;
  }
  
  .footer-container {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .footer-brand, 
  .footer-links, 
  .footer-products, 
  .footer-contact {
    text-align: center;
  }

  .badges-container {
    justify-content: center;
  }

  .footer-bottom-container {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  /* Contact form details */
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  /* Lightbox buttons responsive */
  .lightbox-prev,
  .lightbox-next {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .lightbox-prev { left: 16px; }
  .lightbox-next { right: 16px; }
  .lightbox-close { top: 20px; right: 20px; font-size: 32px; }

  /* One viewport-anchored layer prevents wide page content moving actions off-screen. */
  body > .floating-actions {
    position: fixed !important;
    right: calc(16px + env(safe-area-inset-right, 0px)) !important;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    left: auto !important;
    top: auto !important;
    width: 46px;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 14px;
    margin: 0 !important;
    visibility: visible !important;
    pointer-events: none;
    z-index: 2147483000 !important;
  }

  .floating-actions > .go-to-top-btn,
  .floating-actions > .whatsapp-float-btn,
  .floating-actions > .whatsapp-float-btn.shifted {
    position: static !important;
    inset: auto !important;
    flex: 0 0 46px;
    width: 46px !important;
    min-width: 46px;
    max-width: 46px;
    height: 46px !important;
    margin: 0 !important;
    box-sizing: border-box;
    visibility: visible !important;
    pointer-events: auto;
    z-index: auto !important;
  }

  .floating-actions > .go-to-top-btn {
    display: none;
  }

  .floating-actions > .go-to-top-btn.show {
    display: flex;
  }

  .floating-actions .go-to-top-btn svg,
  .floating-actions .whatsapp-float-btn svg {
    flex: 0 0 auto;
  }
}

/* Smaller Mobiles */
@media (max-width: 480px) {
  .logo-text {
    display: none; /* Keep header neat */
  }

  .hero-badge {
    font-size: 0.72rem;
    padding: 6px 10px;
  }

  .hero-eyebrow {
    justify-content: flex-start;
    font-size: 0.64rem;
    letter-spacing: 0.1em;
  }

  .hero-badges-group {
    justify-content: flex-start;
  }

  .hero-content,
  .hero-section .hero-subheadline {
    text-align: left;
  }

  .hero-capabilities {
    gap: 14px;
  }

  .hero-capabilities > div {
    padding: 0 8px;
  }

  .hero-capabilities strong {
    font-size: 0.75rem;
  }

  .hero-capabilities span {
    font-size: 0.62rem;
  }

  .hero-image-caption {
    left: 14px;
    bottom: 14px;
  }

  .hero-dots {
    right: 14px;
    bottom: 18px;
  }

  .btn {
    width: 100%;
  }

  .btn-group {
    flex-direction: column;
  }
  
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .map-wrapper {
    height: 300px;
  }
}
