/* ============================================================
   Apex Global Projects — mobile fix sheet
   Loaded AFTER each page's inline <style> so it wins the cascade.
   Targets phones/tablets only; desktop layout is untouched.
   ============================================================ */

/* ============================================================
   NAV — canonical rules (apply at ALL widths so every page's
   header is identical, fixed, and has a working hamburger).
   Added 2026-10-08 to fix: menu missing on pages with no
   hamburger, and blog.html header not staying fixed.
   ============================================================ */
nav { position: fixed !important; top: 0 !important; width: 100% !important; z-index: 1000 !important; background: rgba(10,22,40,.95) !important; -webkit-backdrop-filter: blur(20px) !important; backdrop-filter: blur(20px) !important; box-shadow: 0 1px 3px rgba(0,0,0,.2) !important; }
.nav-container { max-width: 1400px !important; margin: 0 auto !important; display: flex !important; justify-content: space-between !important; align-items: center !important; padding: 0 40px !important; height: 70px !important; }
.nav-logo { display: flex !important; align-items: center !important; gap: 12px !important; text-decoration: none !important; margin-right: 24px !important; }
.nav-logo img, .nav-logo svg { width: 40px !important; height: 40px !important; flex: 0 0 auto !important; }
.nav-logo span { color: #fff !important; font-size: 19px !important; font-weight: 700 !important; font-family: Cinzel, serif !important; white-space: nowrap !important; }
.nav-links { display: flex !important; gap: 17px !important; list-style: none !important; align-items: center !important; margin: 0 !important; padding: 0 !important; }
.nav-links li { list-style: none !important; }
.nav-links a { color: #94a3b8 !important; text-decoration: none !important; font-size: 13px !important; font-weight: 500 !important; white-space: nowrap !important; transition: color .3s !important; }
.nav-links a:hover { color: #fff !important; }
.nav-links a.nav-cta { background: #0ba9eb !important; color: #fff !important; padding: 9px 20px !important; border-radius: 8px !important; font-size: 13px !important; font-weight: 600 !important; }
.hamburger { display: none !important; flex-direction: column !important; gap: 5px !important; cursor: pointer !important; }
.hamburger span { width: 25px !important; height: 3px !important; background: #fff !important; border-radius: 2px !important; transition: .3s !important; }

/* Collapse to a hamburger menu on tablets + phones (<=1024px) */
@media (max-width: 1024px) {
  .hamburger { display: flex !important; flex: 0 0 auto !important; margin-left: auto !important; padding: 8px !important; }
  .nav-links { display: none !important; position: absolute !important; top: 70px !important; left: 0 !important; right: 0 !important; width: 100% !important; background: rgba(10,22,40,.98) !important; flex-direction: column !important; padding: 20px !important; gap: 12px !important; }
  .nav-links.active { display: flex !important; }
}

/* ---------- global safety net ---------- */
html, body { max-width: 100%; overflow-x: hidden; }
img, video, iframe, embed, object, table { max-width: 100%; }
* { min-width: 0; }                 /* stops flex/grid children forcing overflow */
h1, h2, h3, h4, p, li, a { overflow-wrap: break-word; word-wrap: break-word; }

/* ============================================================
   TABLET  <= 1024px
   ============================================================ */
@media (max-width: 1024px) {
  .nav-container { padding: 0 24px !important; }
  .hero-content  { padding: 0 24px !important; gap: 40px !important; }
  .section       { padding: 70px 24px !important; }
  .stats-bar .max-width { padding: 0 24px !important; }
  .footer-container { padding: 0 24px !important; }
}

/* ============================================================
   PHONE  <= 768px
   ============================================================ */
@media (max-width: 768px) {

  /* ---------- NAV ---------- */
  .nav-container {
    padding: 0 14px !important;
    height: 62px !important;
    gap: 8px !important;
  }
  .nav-logo {
    margin-right: 0 !important;
    gap: 9px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }
  .nav-logo img, .nav-logo svg {
    width: 30px !important; height: 30px !important; flex: 0 0 auto !important;
  }
  .nav-logo span {
    font-size: 14px !important;
    white-space: normal !important;
    line-height: 1.15 !important;
    display: block !important;
  }
  /* hide the long "Power · Infrastructure · Energy" tagline — it eats the bar */
  .nav-logo small { display: none !important; }
  .nav-logo br    { display: none !important; }

  .hamburger {
    display: flex !important;
    flex: 0 0 auto !important;
    margin-left: auto !important;
    padding: 8px !important;
    z-index: 1100 !important;
  }
  .nav-links {
    top: 62px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: calc(100vh - 62px) !important;
    overflow-y: auto !important;
    padding: 18px 16px 24px !important;
    gap: 4px !important;
    border-top: 1px solid rgba(255,255,255,.08) !important;
  }
  .nav-links li { width: 100% !important; }
  .nav-links a {
    display: block !important;
    padding: 12px 4px !important;
    font-size: 16px !important;
    border-bottom: 1px solid rgba(255,255,255,.06) !important;
  }
  .nav-links .nav-cta {
    text-align: center !important;
    margin-top: 12px !important;
    border-bottom: none !important;
  }

  /* ---------- HERO ---------- */
  .hero {
    min-height: auto !important;
    padding: 92px 0 48px !important;
    display: block !important;
  }
  .hero-content {
    grid-template-columns: 1fr !important;
    gap: 26px !important;
    padding: 0 16px !important;
    width: 100% !important;
  }
  .hero-badge { margin-bottom: 20px !important; padding: 6px 16px !important; }
  .hero-badge span { font-size: 12px !important; }
  .hero h1 {
    font-size: 29px !important;
    line-height: 1.18 !important;
    margin-bottom: 16px !important;
  }
  .hero p {
    font-size: 15px !important;
    line-height: 1.65 !important;
    margin-bottom: 24px !important;
    max-width: 100% !important;
  }
  /* buttons: stack full-width instead of sitting side by side */
  .hero-buttons {
    flex-direction: column !important;
    gap: 11px !important;
    width: 100% !important;
  }
  .hero-buttons a,
  .btn-primary, .btn-outline {
    width: 100% !important;
    display: block !important;
    text-align: center !important;
    padding: 14px 18px !important;
    font-size: 15px !important;
    box-sizing: border-box !important;
  }
  .hero-image-wrapper img { height: 220px !important; width: 100% !important; }
  .hero-image-wrapper { border-radius: 14px !important; }

  .hero-stats {
    position: static !important;
    width: 100% !important;
    margin: 18px 0 0 0 !important;
    padding: 16px 12px !important;
    gap: 10px !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    box-shadow: 0 10px 30px rgba(0,0,0,.25) !important;
  }
  .hero-stats > div { flex: 1 1 0 !important; text-align: center !important; }
  .hero-stat-number { font-size: 22px !important; }
  .hero-stat-label  { font-size: 11px !important; }

  /* ---------- SECTIONS ---------- */
  .section, .service-content, .service-hero,
  .cta-box, .form-box, .detail, .content, .container {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .section { padding-top: 52px !important; padding-bottom: 52px !important; }
  .section-title, .cta-box h2, .service-hero h1 { font-size: 23px !important; line-height: 1.25 !important; }
  .section-desc { font-size: 15px !important; margin-bottom: 34px !important; }

  /* ---------- GRIDS -> single column ---------- */
  .services-grid, .about-grid, .blog-grid, .features-grid, .testimonial-grid,
  .project-grid, .contact-grid, .footer-container, .leadership-grid,
  .gallery-grid, .team-grid, .pricing-grid, .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  .detail { flex-direction: column !important; }

  /* ---------- STATS BAR (was touching the screen edges) ---------- */
  .stats-bar { padding: 34px 0 !important; }
  .stats-bar .max-width {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 22px 14px !important;
    padding: 0 16px !important;
  }
  .stats-bar .stat-num { font-size: 30px !important; }
  .stats-bar .stat-label { font-size: 12px !important; }

  /* ---------- TABLES: let them scroll instead of blowing out the page ---------- */
  table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* ---------- FOOTER ---------- */
  .footer { padding: 36px 16px 18px !important; }
  .footer-container { grid-template-columns: 1fr !important; gap: 26px !important; padding: 0 16px !important; }
  .footer-bottom { font-size: 12px !important; margin-top: 30px !important; }

  /* ---------- FLOATING BITS ---------- */
  .back-to-top { bottom: 16px !important; right: 16px !important; width: 42px !important; height: 42px !important; font-size: 17px !important; }
  #cookie-consent { padding: 12px 14px !important; font-size: 13px !important; }
  #cookie-consent button { width: 100% !important; padding: 10px !important; }
}

/* ============================================================
   SMALL PHONE  <= 420px
   ============================================================ */
@media (max-width: 420px) {
  .hero h1 { font-size: 25px !important; }
  .hero p  { font-size: 14px !important; }
  .section-title, .cta-box h2, .service-hero h1 { font-size: 21px !important; }
  .hero-stats { flex-direction: column !important; }
  .hero-stats > div { text-align: left !important; }
  .hero-image-wrapper img { height: 180px !important; }
  .stats-bar .max-width { grid-template-columns: 1fr !important; }
  .nav-logo span { font-size: 13px !important; }
}
