/* ==========================================================================
   Responsive Scaling & Breakpoints
   ========================================================================== */

/* --------------------------------------------------------------------------
   Intermediate Desktop / Large Tablet (Max 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .container {
    width: min(100% - 3rem, 960px);
  }

  .hero-grid {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }
  
  .hero-visual {
    min-height: 320px;
  }

  .trust-grid {
    gap: 2rem;
  }

  /* Reduce grids from 4/3 columns to 2 columns */
  .benefits-grid, 
  .products-grid,
  .steps-layout {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2rem;
  }

  /* Make sure steps don't look completely disjointed when wrapped to 2x2 */
  .step-connector {
    display: none;
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 3rem 2rem;
  }
}

/* --------------------------------------------------------------------------
   Small Tablet / Mobile Landscape (Max 900px)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .container {
    width: min(100% - 2.5rem, 768px);
  }

  .desktop-nav, .header-actions .button-ghost, .header-actions .button-primary {
    display: none;
  }

  .menu-button {
    display: grid;
    place-items: center;
  }

  .mobile-drawer {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--color-surface-dark);
    color: var(--color-text-light);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-drawer.open {
    transform: translateX(0);
  }

  .drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(246, 242, 233, 0.18);
  }

  .drawer-close {
    display: grid;
    place-items: center;
    padding: 0.5rem;
    border: 1px solid rgba(246, 242, 233, 0.24);
    background: transparent;
    color: inherit;
    min-height: 44px; /* Accessible touch target */
    min-width: 44px;
    border-radius: 4px;
  }

  .drawer-close svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
  }

  .drawer-links {
    display: grid;
    gap: 1.1rem;
    padding: 2rem 0;
  }

  .drawer-links a {
    color: rgba(246, 242, 233, 0.76);
    font: 600 1.6rem / 0.95 var(--font-sans);
    letter-spacing: -0.05em;
    padding: 0.5rem 0; /* Enhance touch target */
  }

  .drawer-links a:hover {
    color: var(--color-accent-primary);
  }

  /* Contact layout stack */
  .contact-layout, .capabilities-layout, .industry-layout {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
}

/* --------------------------------------------------------------------------
   Mobile Portrait (Max 767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .container {
    width: min(100% - 2rem, 100%);
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  
  .hero-body {
    font-size: 1.05rem;
  }

  .hero-cta {
    flex-direction: column;
    width: 100%;
  }

  .hero-cta .button-primary,
  .hero-cta .button-secondary {
    width: 100%;
    justify-content: center;
  }

  .hero-visual {
    min-height: auto;
    padding: 2rem 0;
  }

  /* Scale down the glass cards natively */
  .visual-card {
    position: relative;
    transform: scale(0.9);
  }
  
  .card-back {
    position: absolute;
    right: -10px;
    bottom: -20px;
  }

  .trust-grid {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }

  /* Stack all grids to 1 column */
  .benefits-grid,
  .products-grid,
  .steps-layout {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }

  .benefit-card, 
  .product-card, 
  .step-item {
    padding: 1.5rem;
  }

  .earnings-layout > div {
    padding: 2.5rem 1.5rem;
  }
  .earnings-metrics {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .ec-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

/* --------------------------------------------------------------------------
   Small Mobile (Max 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .visual-card {
    transform: scale(0.75); /* Ensure it fits on very narrow screens */
    margin-left: -1rem; /* Center offset compensation */
  }

  .hero {
    padding-top: calc(88px + 3rem); /* Safe offset under header */
  }

  .faq-item summary {
    padding: 1.25rem 1rem;
    font-size: 1rem;
  }

  .faq-content {
    padding: 0 1rem 1.25rem;
  }
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}