/* CarLAB ui-v2 — header responsive rules.
   Tiers: desktop (no query) → 1024px (tighten spacing) → 768px (nav becomes
   a toggled panel) → 480px (compact search/logo). */

@media (max-width: 1024px) {
  .cl2-header-inner {
    gap: var(--cl2-space-md);
    padding: 0 var(--cl2-space-lg);
  }

  .cl2-header-search {
    flex-basis: 220px;
  }

  .cl2-header-nav {
    gap: var(--cl2-space-lg);
  }
}

@media (max-width: 768px) {
  .cl2-header {
    min-height: var(--cl2-header-h-compact);
  }

  .cl2-header-inner {
    height: var(--cl2-header-h-compact);
    padding: 0 var(--cl2-space-md);
    gap: var(--cl2-space-sm);
  }

  .cl2-header-search {
    /* Was flex:1 1 auto, which let the box grow to fill all leftover space in
       the header row (~68% of a 390px viewport) once the nav collapses to
       the hamburger toggle. Capped so it stays a compact field balanced
       against the logo/toggle instead of dominating the row; still shrinks
       (flex-shrink:1) if the viewport is narrower still. Shared header — this
       change applies to every page, not just model.php. */
    flex: 0 1 170px;
  }

  .cl2-header-nav-toggle {
    display: flex;
  }

  .cl2-header-nav {
    margin-inline-start: 0;
    display: none;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    z-index: 50;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    gap: 0;
    background: var(--cl2-white);
    border-top: 1px solid var(--cl2-border);
    box-shadow: var(--cl2-shadow-md);
    padding: var(--cl2-space-sm) var(--cl2-space-lg) var(--cl2-space-lg);
  }

  .cl2-header-nav.is-open {
    display: flex;
  }

  .cl2-header-nav a {
    height: auto;
    width: 100%;
    padding: var(--cl2-space-md) var(--cl2-space-xs);
    border-bottom: 1px solid var(--cl2-border);
  }

  .cl2-header-nav a.is-active {
    border-bottom-color: var(--cl2-border);
  }

  .cl2-header-nav a:last-child {
    border-bottom: none;
  }
}

@media (max-width: 480px) {
  .cl2-header-inner {
    padding: 0 var(--cl2-space-sm);
  }

  .cl2-header-logo {
    font-size: var(--cl2-fs-lg);
  }

  .cl2-header-logo-lab {
    font-size: 17px;
  }

  .cl2-header-search {
    height: 34px;
  }
}

/* ── Footer — desktop compact multi-column → tablet 2-col → mobile 1-col ── */
@media (max-width: 1024px) {
  .cl2-footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: var(--cl2-space-2xl) var(--cl2-space-2xl);
    padding: var(--cl2-space-2xl) var(--cl2-space-lg) var(--cl2-space-xl);
  }

  .cl2-footer-brand {
    grid-column: 1 / -1;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .cl2-footer-inner {
    grid-template-columns: 1fr;
    gap: var(--cl2-space-xl);
    padding: var(--cl2-space-xl) var(--cl2-space-md) var(--cl2-space-lg);
  }
}
