/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE LAYOUT RULES
   Pompano Leak Detection Pros (100% Pure CSS - Zero JavaScript)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tablet & Medium Screens (<= 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .grid-cols-4,
  .footer-grid,
  .site-footer .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-sidebar-right,
  .grid-sidebar-left {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Mobile & Small Tablet Screens (<= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --container-gutter: 1rem;
    --space-12: 2.25rem;
    --space-16: 3rem;
    --space-20: 3.5rem;
  }

  /* Grids collapse to single column */
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4,
  .footer-grid,
  .site-footer .grid-cols-4 {
    grid-template-columns: 1fr;
  }

  /* --- Pure CSS Mobile Navigation Menu Drawer --- */
  .mobile-menu-button {
    display: flex; /* Display hamburger button */
  }

  /* Hamburger to X transition */
  .mobile-menu-checkbox:checked + .mobile-menu-button span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .mobile-menu-checkbox:checked + .mobile-menu-button span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-checkbox:checked + .mobile-menu-button span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Mobile Nav Drawer Container */
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color-bg-surface);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-4);
    box-shadow: var(--shadow-xl);
    border-top: 1px solid var(--color-border-subtle);
    border-bottom: 2px solid var(--color-accent);
    gap: var(--space-1);
    z-index: 100;
  }

  /* Reveal drawer when checkbox is checked */
  .mobile-menu-checkbox:checked ~ .nav-menu {
    display: flex;
  }

  .nav-item {
    width: 100%;
    border-bottom: 1px solid var(--color-bg-alt);
    padding-bottom: var(--space-2);
  }

  .nav-link {
    width: 100%;
    padding: var(--space-2) 0;
    font-size: var(--font-size-base);
  }

  .nav-dropdown-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    cursor: pointer;
  }

  /* Mobile Dropdown Menu: Folded (Hidden) by Default */
  .nav-dropdown {
    display: none;
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    padding: var(--space-2) var(--space-3);
    background-color: var(--color-bg-subtle);
    border-radius: var(--radius-sm);
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
  }

  /* Unfold dropdown when checkbox is checked */
  .mobile-nav-toggle:checked ~ .nav-dropdown {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .mobile-nav-toggle:checked ~ .nav-dropdown-toggle .dropdown-caret {
    transform: rotate(180deg);
    color: var(--color-accent);
  }

  .dropdown-link {
    padding: var(--space-2) var(--space-3);
  }

  .nav-actions {
    display: none; /* Secondary header button hidden in compact nav, hero/top bar provides direct action */
  }

  /* Top Bar: Hide physical dispatch desk/address on mobile interface only, keep direct phone link centered */
  .top-bar-item:first-child {
    display: none !important;
  }

  .top-bar-inner {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 0;
  }

  .top-bar-inner .top-bar-item {
    justify-content: center;
    text-align: center;
    width: 100%;
  }

  /* Hero Section */
  .hero-section {
    padding: var(--space-4) 0 var(--space-10) 0;
  }

  .hero-cta-group {
    flex-direction: column;
    width: 100%;
  }

  .hero-cta-group .btn {
    width: 100%;
  }

  .hero-highlights {
    flex-direction: column;
    gap: var(--space-3);
  }

  /* Trust Bar */
  .trust-bar .grid-cols-4 {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  /* CTA Banners */
  .cta-banner {
    padding: var(--space-8) var(--space-4);
  }

  .cta-banner .cta-buttons {
    flex-direction: column;
    width: 100%;
  }

  .cta-banner .cta-buttons .btn {
    width: 100%;
  }

  /* Contact Form */
  .contact-form-card {
    padding: var(--space-4);
  }
}

/* --------------------------------------------------------------------------
   Small Handsets (<= 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .brand-name {
    font-size: var(--font-size-base);
  }

  .brand-tagline {
    display: none;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: var(--font-size-lg);
  }

  h1 {
    font-size: var(--font-size-2xl);
  }

  h2 {
    font-size: var(--font-size-xl);
  }
}

/* --------------------------------------------------------------------------
   Accessibility - Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   Print Stylesheet
   -------------------------------------------------------------------------- */
@media print {
  .site-header,
  .top-bar,
  .cta-banner,
  .site-footer,
  .mobile-menu-button {
    display: none !important;
  }

  body {
    background: #FFF;
    color: #000;
    font-size: 12pt;
  }

  a {
    text-decoration: underline;
    color: #000;
  }

  .card,
  .contact-form-card {
    border: 1px solid #CCC;
    box-shadow: none;
    page-break-inside: avoid;
  }
}
