/**
 * Shared mobile + layout fixes for folder-based internal pages
 * (oakville, helena, rutherford, homes-for-sale, why-new-construction)
 */

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

body {
  overflow-x: hidden;
}

#root {
  overflow-x: hidden;
  max-width: 100vw;
}

/* ----- Header: mobile menu (matches 404 pattern; works with nav buttons) ----- */
@media (max-width: 47.9375rem) {
  #mobileMenu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-height: min(70vh, 28rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
    padding: 0.75rem 1rem 1.5rem;
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.12);
    flex-direction: column;
    gap: 0.25rem;
    z-index: 50;
    border-bottom: 1px solid #e5e7eb;
  }

  #mobileMenu.hidden {
    display: none !important;
  }

  #mobileMenu:not(.hidden) {
    display: flex !important;
  }

  #mobileMenu a,
  #mobileMenu button.nav-btn {
    width: 100%;
    text-align: left;
    padding: 0.75rem 0.625rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    border-radius: 0.375rem;
  }

  #mobileMenu button.bg-primary,
  #mobileMenu .bg-primary {
    justify-content: center;
    text-align: center;
  }
}

/* Menu icon must be mobile-only */
@media (max-width: 47.9375rem) {
  #menuBtn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
  }
}

@media (min-width: 48rem) {
  #menuBtn {
    display: none !important;
  }
}

/* ----- Hero band on internal pages ----- */
@media (max-width: 768px) {
  section#home.hero-overlay {
    min-height: 50vh !important;
    margin-top: 4.5rem !important;
  }

  section#home .text-4xl {
    font-size: 1.75rem !important;
    line-height: 1.2 !important;
  }

  section#home .md\:text-6xl {
    font-size: 1.75rem !important;
  }
}

/* ----- Model page: spec cards 2-col → 1 col on narrow phones ----- */
@media (max-width: 480px) {
  .min-h-screen .container ul.grid.grid-cols-2 {
    grid-template-columns: 1fr;
  }
}

/* ----- Article pages: media & tables ----- */
.internal-article-body img,
.min-h-screen .container img {
  max-width: 100%;
  height: auto;
}

.min-h-screen .container {
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

/* ----- Footer readability on small screens ----- */
@media (max-width: 640px) {
  footer .grid {
    gap: 1.5rem;
  }
}
