/* ==========================================================================
   Vanavil Calibrations — Responsive rules
   Breakpoints checked: 375, 390, 430, 768, 1024, 1280, 1440+
   ========================================================================== */

/* ----- Large desktop refinement ----- */
@media (min-width: 1441px) {
  .container {
    max-width: 1320px;
  }
}

/* ----- Laptop / small desktop (<=1280px) ----- */
@media (max-width: 1280px) {
  :root {
    --container-width: 1080px;
  }

  .nav-list {
    gap: var(--space-3);
  }
}

/* ----- Tablet landscape (<=1024px) ----- */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  /* Hero stacks text -> CTAs -> image on narrow viewports (no order flip) */
  .hero-media {
    max-width: 520px;
    margin: var(--space-5) auto 0;
  }

  .hero-badge {
    left: 16px;
    bottom: -18px;
  }

  .two-col {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .two-col.reverse .media-frame {
    order: -1;
  }

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

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

  .trust-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-2);
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5) var(--space-4);
  }

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

/* ----- Tablet portrait / mobile nav breakpoint (<=900px) ----- */
@media (max-width: 900px) {
  /* The header's backdrop-filter makes it the containing block for
     position:fixed descendants, which collapsed the drawer to the header's
     own height instead of the viewport. Drop the filter below the mobile
     breakpoint so .main-nav resolves against the viewport again.
     Desktop keeps the frosted header. */
  .site-header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--white);
  }

  .main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100vw;
    background: var(--white);
    z-index: 400;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: var(--space-3) var(--space-3) var(--space-6);
    gap: var(--space-2);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .main-nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
  }

  .nav-list li {
    border-bottom: 1px solid var(--border-color);
  }

  .nav-list > li:last-child {
    border-bottom: none;
  }

  .nav-list a {
    display: block;
    padding: 15px 6px;
    font-size: 1rem;
  }

  .has-dropdown {
    width: 100%;
  }

  .has-dropdown > button {
    width: 100%;
    justify-content: space-between;
    padding: 15px 6px;
    font-size: 1rem;
  }

  .dropdown-menu {
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    display: none;
    min-width: 0;
    padding: 0 0 10px 14px;
    opacity: 1;
    visibility: visible;
    background: transparent;
  }

  /* The desktop open-state rule also sets translateX(-50%), which on this
     static mobile layout pushes the submenu half its width off-screen.
     Must be reset here or the links render outside the viewport. */
  .has-dropdown:hover .dropdown-menu,
  .has-dropdown[data-open="true"] .dropdown-menu {
    display: flex;
    flex-direction: column;
    transform: none;
  }

  .dropdown-menu a {
    padding: 12px 6px;
    font-size: 0.95rem;
    color: var(--body-color);
  }

  .header-cta {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }
}

/* ----- Mobile (<=768px) ----- */
@media (max-width: 768px) {
  :root {
    --header-height: 72px;
  }

  .section {
    padding: var(--space-6) 0;
  }

  .section--tight {
    padding: var(--space-5) 0;
  }

  .brand img {
    height: 42px;
  }

  .hero {
    padding: var(--space-5) 0 var(--space-8);
  }

  .hero-badge {
    position: static;
    margin-top: var(--space-3);
    max-width: none;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

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

  .trust-item {
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-2);
  }

  .trust-item:nth-child(1),
  .trust-item:nth-child(2) {
    border-top: none;
    padding-top: 0;
  }

  .process-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .cta-section {
    flex-direction: column;
    text-align: center;
    padding: var(--space-6) var(--space-3);
  }

  .cta-section .btn-group {
    justify-content: center;
    width: 100%;
  }

  .cta-section .btn {
    flex: 1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .industry-card {
    aspect-ratio: 16 / 10;
  }

  .page-hero {
    padding: var(--space-5) 0 var(--space-6);
  }
}

/* ----- Small mobile (<=430px, covers 375 / 390 / 430) ----- */
@media (max-width: 430px) {
  .container {
    padding: 0 var(--space-2);
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .btn {
    padding: 13px 20px;
    font-size: 0.9rem;
  }

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

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

  .hero-content p.lead {
    font-size: 1rem;
  }

  .stat-card strong {
    font-size: 1.6rem;
  }

  .equipment-card span {
    font-size: 0.8rem;
  }

  .footer-social {
    justify-content: center;
  }

  .footer-brand {
    text-align: center;
  }

  .footer-brand p {
    margin-left: auto;
    margin-right: auto;
  }
}

/* ----- Print ----- */
@media print {
  .site-header,
  .site-footer,
  .cta-section,
  .nav-toggle {
    display: none;
  }
}
