/**
 * WattSwap public site — cross-device layout (phone, tablet, laptop, desktop)
 */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

/* Safe horizontal padding on small viewports */
.max-w-7xl {
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
}

/* Nav: prevent brand overflow */
.nav-bar .flex.items-center h-8,
.nav-bar img {
  max-width: min(120px, 40vw);
}

/* Mobile menu panel */
#mobileMenu {
  max-height: min(70vh, 480px);
  overflow-y: auto;
}

#mobileMenu:not(.hidden) {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Ecosystem diagram — stack on narrow screens */
@media (max-width: 1024px) {
  #ecosystemContainer {
    height: auto !important;
    min-height: 0 !important;
    padding: 1.25rem 1rem 1.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  #ecosystemContainer > div[style*="position: absolute"],
  #ecosystemContainer .absolute {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    transform: none !important;
  }

  #ecosystemContainer svg {
    display: none;
  }
}

/* Stations map */
@media (max-width: 768px) {
  #stationsMap,
  .leaflet-container {
    height: min(55vh, 420px) !important;
    min-height: 280px !important;
  }

  .stations-hero {
    padding-top: 6rem !important;
    padding-bottom: 2.5rem !important;
  }
}

/* Checkout */
@media (max-width: 900px) {
  .checkout-container {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
}

/* Store / product grids */
@media (max-width: 768px) {
  .store-header,
  .partner-hero {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .product-grid {
    grid-template-columns: 1fr !important;
  }

  .specification-table {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .nav-bar .text-xl {
    font-size: 1rem;
  }

  section[class*="min-h-screen"] {
    min-height: auto;
    padding-top: 5rem;
    padding-bottom: 3rem;
  }
}
