/* Responsive fixes - grupodamiani.com.br */

/* Universal overflow prevention */
html, body {
  overflow-x: hidden !important;
}

/* Hero glow overflow fix */
.hero-glow {
  max-width: 100vw !important;
  overflow: hidden !important;
}

@media (max-width: 768px) {
  /* == NAVBAR FIX - Keep logo + hamburger visible == */
  .navbar-inner {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  .logo {
    flex-shrink: 1 !important;
    min-width: 0 !important;
    max-width: calc(100vw - 100px) !important;
    overflow: hidden !important;
  }

  .logo img {
    height: 46px !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
  }

  .menu-toggle {
    display: block !important;
    flex-shrink: 0 !important;
    z-index: 1002 !important;
    min-width: 40px !important;
    position: relative !important;
  }

  /* == MOBILE MENU PANEL == */
  .nav-links {
    display: none !important;
  }

  .nav-links.mobile-open {
    display: flex !important;
    flex: none !important;
    position: fixed !important;
    top: 73px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: calc(100vh - 73px) !important;
    background: rgba(255, 255, 255, 0.98) !important;
    z-index: 1001 !important;
    flex-direction: column !important;
    padding: 20px 0 !important;
    margin: 0 !important;
    list-style: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .nav-links > li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    list-style: none !important;
  }

  .nav-links > li > a {
    display: block !important;
    padding: 16px 24px !important;
    font-size: 17px !important;
    color: #00446e !important;
    text-decoration: none !important;
    font-weight: 500 !important;
  }

  .nav-links > li > a:hover,
  .nav-links > li > a:active {
    background: rgba(0, 68, 110, 0.08) !important;
  }

  /* Submenu (Mais) - hidden by default */
  .nav-links li ul {
    display: none !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: rgba(0, 68, 110, 0.04) !important;
  }

  /* Submenu open state */
  .nav-links li.submenu-open > ul {
    display: block !important;
  }

  .nav-links li ul li a {
    display: block !important;
    padding: 13px 24px 13px 40px !important;
    font-size: 15px !important;
    color: #00446e !important;
    text-decoration: none !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
  }

  /* Arrow indicator for submenu parent */
  .nav-links > li:last-child > a::after {
    content: '▼' !important;
    font-size: 10px !important;
    margin-left: 8px !important;
    transition: transform 0.3s !important;
    display: inline-block !important;
  }

  .nav-links > li.submenu-open:last-child > a::after {
    transform: rotate(180deg) !important;
  }

  /* Force ALL inline-styled grids in depoimentos to single column */
  #depoimentos div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }

  /* Force ALL inline-styled grids in valores to single column */
  #valores div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }

  /* Force quem-somos inline grids to single column */
  #quem-somos div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }

  /* Named grid classes */
  .pontos-grid, .servicos-grid, .insta-grid {
    grid-template-columns: 1fr !important;
  }

  .valores-grid, .form-row, .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Ensure images don't overflow - EXCEPT logo */
  img:not(.logo img) {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Section images only */
  section img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Prevent any fixed-width elements from overflowing */
  section {
    overflow-x: hidden !important;
  }

  /* Ensure cards and content blocks fit */
  #depoimentos div[style*="grid"] > div {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 480px) {
  /* Typography scaling */
  h1 { font-size: 1.8rem !important; }
  h2 { font-size: 1.5rem !important; }
  h3 { font-size: 1.2rem !important; }

  /* Section padding */
  section { padding: 36px 0 !important; }

  /* Hero stats stack */
  .hero-stats {
    flex-direction: column !important;
    align-items: center !important;
    gap: 16px !important;
  }

  /* All grids single column at small screens */
  .pontos-grid, .servicos-grid, .insta-grid {
    grid-template-columns: 1fr !important;
  }
}