/* ============================================================
   AVIAGREENE — RESPONSIVE CSS (Full Overhaul)
   Mobile-first, thorough breakpoint coverage
   ============================================================ */

/* --- 1. GLOBAL SAFETY ---------------------------------------- */
*, *::before, *::after { max-width: 100%; }
html, body { overflow-x: hidden; width: 100%; }
img, video, iframe, svg { max-width: 100%; height: auto; }

/* --- 2. TABLET: max-width 1024px ----------------------------- */
@media (max-width: 1024px) {
  .container { padding: 0 1.5rem; }
  .site-nav   { display: none !important; }
  .header-btn { display: none !important; }
  .menu-toggle { display: flex !important; }
  .hero-content { padding: 8rem 0 3rem; }
  .hero-content h1 { font-size: clamp(2.4rem, 5vw, 3.5rem); }

  /* All two-column inline-style grids stack */
  .container[style*="grid-template-columns:1fr 1fr"][style*="gap:4rem"],
  .container[style*="grid-template-columns:5fr 7fr"],
  .container[style*="grid-template-columns:7fr 5fr"],
  .container[style*="grid-template-columns:7fr 3fr"],
  .container[style*="grid-template-columns:6fr 6fr"] {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
  }
  div.container[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
  }

  /* Services 3-col → 2-col */
  .stagger-children[style*="grid-template-columns:repeat(3,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Testimonials 3-col → 2-col */
  div[style*="grid-template-columns:repeat(3,1fr)"][style*="gap:1.5rem"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Stats wrap */
  .stats-row { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 1px !important; }
  .stat-item  { flex: unset !important; min-width: unset !important; }

  /* Service cards — stack at tablet */
  .service-card { grid-template-columns: 1fr !important; }
  .service-card:nth-child(even) .service-img { order: 0 !important; }
  .service-card:nth-child(even) .service-body { order: 1 !important; }
  .service-img { aspect-ratio: 16/9; }
  .service-body { padding: 2rem 2.5rem; }

  /* Admin */
  .admin-sidebar { width: 200px; }
  .admin-content { margin-left: 200px; }

  /* CTA band */
  .cta-band-inner { grid-template-columns: 1fr !important; gap: 1.5rem !important; text-align: center; }
  .cta-band-action { justify-content: center !important; }
  .cta-eyebrow { justify-content: center !important; }
}

/* --- 3. LARGE PHONE / SMALL TABLET: max-width 768px ---------- */
@media (max-width: 768px) {
  h1 { font-size: clamp(2rem, 7vw, 2.8rem) !important; }
  h2 { font-size: clamp(1.5rem, 5vw, 2.2rem) !important; }
  .container { padding: 0 1.25rem; }
  .section    { padding: 3.5rem 0 !important; }
  .section-lg { padding: 4rem 0 !important; }

  /* Header */
  .site-header { height: 68px !important; }

  /* Hero */
  .hero { min-height: 90svh; }
  .hero-content { padding: 6rem 0 2.5rem; }
  .hero-actions { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  .hero-actions .btn { width: 100%; justify-content: center; }

  /* Page hero */
  .page-hero { min-height: 340px; }
  .page-hero-content h1 { font-size: clamp(1.75rem, 6vw, 2.5rem) !important; }
  .page-hero-sub { font-size: 0.9rem !important; }

  /* Grid stacks */
  .container[style*="grid-template-columns:5fr 7fr"],
  .container[style*="grid-template-columns:7fr 5fr"],
  .container[style*="grid-template-columns:1fr 1fr"][style*="gap:4rem"],
  .container[style*="grid-template-columns:6fr 6fr"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  div.container[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  .detail-layout  { grid-template-columns: 1fr !important; gap: 2rem !important; }
  .contact-layout { grid-template-columns: 1fr !important; gap: 2rem !important; }

  /* Service cards */
  .service-card { grid-template-columns: 1fr !important; }
  .service-card:nth-child(even) .service-img { order: 0 !important; }
  .service-card:nth-child(even) .service-body { order: 1 !important; }
  .service-img { aspect-ratio: 16/9; }
  .service-body { padding: 2rem 1.5rem; }
  .service-highlights { grid-template-columns: 1fr !important; }
  .check-list ul { grid-template-columns: 1fr !important; }

  /* Services 3-col → 1-col */
  .stagger-children[style*="grid-template-columns:repeat(3,1fr)"] { grid-template-columns: 1fr !important; }

  /* Testimonials → 1-col */
  div[style*="grid-template-columns:repeat(3,1fr)"][style*="gap:1.5rem"],
  div[style*="minmax(420px,1fr)"] { grid-template-columns: 1fr !important; }

  /* About image */
  div[style*="aspect-ratio:3/4"],
  div[style*="aspect-ratio:4/5"] { aspect-ratio: 3/2 !important; }

  /* Stats */
  .stats-row { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 1px !important; }
  .stat-item  { flex: unset !important; min-width: unset !important; }

  /* Form inputs — prevent iOS zoom */
  .form-field input,
  .form-field select,
  .form-field textarea { font-size: 16px !important; padding: 0.625rem 0 !important; }
  .form-field select { height: 44px; }
  .form-row { grid-template-columns: 1fr !important; }

  /* Contact type buttons */
  #client-type-btns { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: 0.5rem !important; }
  .type-btn { padding: 0.75rem 0.5rem !important; font-size: 0.8rem !important; }

  /* Values */
  .values-grid { grid-template-columns: 1fr 1fr !important; }
  .value-item { padding: 2rem !important; }

  /* Regions */
  .regions-grid { grid-template-columns: 1fr 1fr !important; }

  /* Blog post sidebar hidden */
  .container[style*="grid-template-columns:7fr 3fr"] { grid-template-columns: 1fr !important; gap: 2rem !important; }
  .container[style*="grid-template-columns:7fr 3fr"] aside { display: none !important; }

  /* Detail sidebar unstick */
  .detail-layout aside [style*="position:sticky"] { position: static !important; top: auto !important; }

  /* Footer */
  .footer-main { grid-template-columns: 1fr 1fr !important; gap: 2rem !important; }
  .site-footer { padding-top: 3rem; }

  /* Data tables */
  .table-wrap, .data-table { overflow-x: auto !important; display: block !important; }

  /* FAQ */
  .faq-question { font-size: 0.875rem !important; }

  /* CTA band */
  .cta-band { padding: 3rem 0 !important; }
  .cta-band-inner { grid-template-columns: 1fr !important; gap: 1.5rem !important; text-align: center !important; }
  .cta-band-action { justify-content: center !important; }
  .cta-eyebrow { justify-content: center !important; }

  /* Admin */
  .admin-layout   { flex-direction: column; }
  .admin-sidebar  { display: none !important; }
  .admin-content  { margin-left: 0 !important; }
  .admin-stat-cards { grid-template-columns: 1fr 1fr !important; }
  .admin-header   { flex-direction: column; align-items: flex-start !important; gap: 1rem; }
  div[style*="grid-template-columns:1fr 1fr"][style*="max-width:900px"] { grid-template-columns: 1fr !important; }
  div[style*="grid-template-columns:2fr 1fr"][style*="gap:1.5rem"] { grid-template-columns: 1fr !important; }
}

/* --- 4. PHONE: max-width 640px ------------------------------- */
@media (max-width: 640px) {
  .container { padding: 0 1rem; }

  /* Header */
  .site-header { height: 64px !important; padding: 0.875rem 0 !important; }
  .logo img { height: 32px !important; }

  /* Hero */
  .hero { min-height: 85svh; }
  .hero-content h1 { font-size: clamp(1.85rem, 8vw, 2.6rem) !important; line-height: 1.15 !important; }
  .hero-sub { font-size: 0.9rem !important; margin-top: 1.25rem !important; }
  .hero-eyebrow { font-size: 0.7rem !important; }
  .hero-actions { margin-top: 1.75rem !important; }

  /* Page hero */
  .page-hero { min-height: 300px !important; }
  .page-hero-content { padding: 5rem 0 2rem !important; }
  .breadcrumb { display: none !important; }

  /* Stats */
  .stats-row { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 1px !important; background: hsl(40 30% 97% / 0.06) !important; }
  .stat-item.dark { padding: 1.5rem 1rem !important; text-align: center !important; }
  .stat-k { font-size: 2rem !important; }
  .stat-v { font-size: 0.72rem !important; letter-spacing: 0.08em !important; }

  /* Services */
  .service-body { padding: 1.75rem 1.25rem; }
  .service-body h2 { font-size: 1.5rem !important; }
  .stagger-children[style*="grid-template-columns:repeat(3,1fr)"],
  .stagger-children[style*="grid-template-columns:repeat(2,1fr)"] { grid-template-columns: 1fr !important; }
  .stagger-children a[style*="padding:2.5rem"] { padding: 1.5rem 1.25rem !important; }

  /* About image */
  div[style*="aspect-ratio:3/4"],
  div[style*="aspect-ratio:4/5"] { aspect-ratio: 16/9 !important; }

  /* Certifications 2-col */
  div[style*="minmax(180px,1fr)"] { grid-template-columns: repeat(2, 1fr) !important; gap: 1rem !important; }

  /* Values */
  .values-grid { grid-template-columns: 1fr !important; }

  /* Contact type buttons */
  #client-type-btns { grid-template-columns: repeat(3, 1fr) !important; gap: 0.4rem !important; }
  .type-btn { flex-direction: column !important; justify-content: center !important; padding: 0.6rem 0.3rem !important; font-size: 0.7rem !important; gap: 0.25rem !important; min-height: 56px; }
  .type-btn svg { width: 18px !important; height: 18px !important; }

  /* Quote form */
  .quote-form { padding: 1.75rem 1.25rem !important; }

  /* Footer */
  .footer-main { grid-template-columns: 1fr !important; gap: 2rem !important; }
  .footer-bottom { flex-direction: column !important; text-align: center !important; gap: 0.5rem !important; }
  .footer-bottom .container { flex-direction: column !important; text-align: center !important; gap: 0.4rem !important; }

  /* Blog */
  .blog-grid { grid-template-columns: 1fr !important; }
  .blog-card-body { padding: 1.5rem !important; }

  /* Buttons */
  .btn { font-size: 0.82rem !important; padding: 0.75rem 1.25rem !important; }

  /* CTA */
  .cta-band { padding: 2.5rem 0 !important; }
  .cta-band h2 { font-size: clamp(1.5rem, 6vw, 2rem) !important; }

  /* Regions */
  .regions-grid { grid-template-columns: 1fr !important; }
  .region-item { padding: 1.5rem !important; }
  div[style*="grid-template-columns:1fr 1fr"][style*="gap:1px"] { grid-template-columns: 1fr !important; }

  /* Testimonials */
  div[style*="grid-template-columns:repeat(3,1fr)"][style*="gap:1.5rem"],
  div[style*="minmax(420px,1fr)"] { grid-template-columns: 1fr !important; }
  div[style*="background:hsl(215 50% 18%)"][style*="padding:2.5rem"] { padding: 1.25rem !important; }

  /* Any 2-col repeat grid */
  div[style*="grid-template-columns:repeat(2"] { grid-template-columns: 1fr !important; }

  /* Admin */
  .admin-stat-cards { grid-template-columns: 1fr !important; }
  #period-btns { grid-template-columns: repeat(2, 1fr) !important; }

  /* WhatsApp */
  a[href*="wa.me"] { bottom: 16px !important; right: 16px !important; width: 50px !important; height: 50px !important; }
  a[href*="wa.me"] svg { width: 22px !important; height: 22px !important; }

  /* Cookie banner */
  #cookie-banner { flex-direction: column !important; align-items: stretch !important; padding: 1rem 1.25rem !important; gap: 1rem !important; }
  #cookie-banner > div:first-child { width: 100%; }
  #cookie-banner > div:last-child { display: flex; gap: 0.5rem; width: 100%; }
  #cookie-banner button { flex: 1 !important; }
}

/* --- 5. SMALL PHONES: max-width 480px ------------------------- */
@media (max-width: 480px) {
  .page-hero { min-height: 260px !important; }
  .page-hero-content h1 { font-size: 1.55rem !important; }
  #client-type-btns { grid-template-columns: 1fr 1fr 1fr !important; }
  .type-btn svg { display: none; }
  .values-grid { grid-template-columns: 1fr !important; }
}

/* --- 6. VERY SMALL PHONES: max-width 390px -------------------- */
@media (max-width: 390px) {
  .container { padding: 0 0.875rem; }
  .hero-content { padding: 4.5rem 0 2rem !important; }
  .hero-content h1 { font-size: 1.75rem !important; line-height: 1.15 !important; }
  .hero-sub { font-size: 0.85rem !important; line-height: 1.65 !important; }
  .hero-eyebrow { font-size: 0.65rem !important; letter-spacing: 0.15em !important; }
  .stat-k { font-size: 1.75rem !important; }
  .stat-v { font-size: 0.68rem !important; }
  .btn { padding: 0.7rem 1rem !important; font-size: 0.78rem !important; }
  .admin-stat-cards { grid-template-columns: 1fr !important; }
  div[style*="grid-template-columns:repeat(3,1fr)"] { grid-template-columns: 1fr !important; }
  .quote-form { padding: 1.25rem 1rem !important; }
  #client-type-btns { grid-template-columns: 1fr !important; }
  .type-btn { flex-direction: row !important; justify-content: center !important; }
  div[style*="minmax(180px,1fr)"] { grid-template-columns: 1fr !important; }
}

/* --- 7. LARGE SCREENS: min-width 1280px ----------------------- */
@media (min-width: 1280px) {
  .container { max-width: 1200px; }
  .hero-content h1 { font-size: 4rem; }
}

/* --- 8. TOUCH DEVICES — disable hover effects ----------------- */
@media (hover: none) {
  .btn:hover { transform: none !important; box-shadow: none !important; }
  section div[style*="hsl(215 50% 18%)"]:hover { transform: none !important; box-shadow: none !important; }
  .value-item:hover { transform: none !important; }
  .blog-card:hover { transform: none !important; }
  .service-card:hover .service-img img { transform: none !important; }
}

/* --- 9. PRINT ------------------------------------------------- */
@media print {
  .site-header, .site-footer, #page-loader,
  #cookie-banner, .hero-actions, .btn { display: none !important; }
  body { background: white; color: black; }
  .container { max-width: 100%; }
}

/* --- 10. MOBILE MENU — defined in style.css --- */
/* --- MOBILE MENU CLOSE BUTTON + CTA BUTTON inside menu ----------- */
.mobile-menu-close {
  align-self: flex-end;
  background: none;
  border: 1px solid hsl(40 30% 97% / 0.15);
  color: hsl(40 30% 97% / 0.7);
  cursor: pointer;
  padding: 0.5rem;
  margin-bottom: 1.25rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}
.mobile-menu-close:hover, .mobile-menu-close:focus {
  color: hsl(40 30% 97%);
  border-color: hsl(40 30% 97% / 0.4);
  outline: none;
}
.mobile-menu .btn {
  margin-top: 1.25rem;
  justify-content: center;
  min-height: 52px;
  width: 100%;
  text-align: center;
}


/* --- 11. MENU TOGGLE — 44px touch target --------------------- */
.menu-toggle {
  min-width: 44px;
  min-height: 44px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}
@media (min-width: 1024px) {
  .menu-toggle { display: none !important; }
}

/* --- 12. ADMIN mobile hamburger -------------------------------- */
.admin-mobile-toggle {
  display: none;
  position: fixed;
  top: 1rem; left: 1rem;
  z-index: 200;
  background: var(--navy);
  border: 1px solid hsl(40 30% 97% / 0.1);
  color: hsl(40 30% 97%);
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 4px;
  min-width: 44px;
  min-height: 44px;
}
@media (max-width: 768px) {
  .admin-mobile-toggle { display: flex; align-items: center; justify-content: center; }
  .admin-sidebar.mobile-open { display: flex !important; position: fixed; inset: 0; z-index: 199; }
}

/* --- 13. NAMED LAYOUT HELPERS -------------------------------- */
@media (max-width: 768px) {
  .detail-layout  { grid-template-columns: 1fr !important; gap: 2rem !important; }
  .contact-layout { grid-template-columns: 1fr !important; gap: 2rem !important; }
}
