/* ==========================================================================
   responsive.css
   Mobile-first: base styles are mobile; these rules adapt up and add the
   mobile navigation drawer. Loaded LAST so it can override component defaults.
   ========================================================================== */

/* ==========================================================================
   Mobile navigation drawer (< 900px)
   ========================================================================== */
@media (max-width: 899px) {
  .nav__toggle {
    display: flex;
  }

  /* No header CTA while the hamburger is showing — it lives in the drawer. */
  .nav__actions > .nav__cta {
    display: none;
  }

  /* Keep the theme toggle and hamburger tappable above the open drawer. */
  .nav__actions {
    position: relative;
    z-index: calc(var(--z-menu) + 1);
  }

  /* The logo must never be squeezed by the actions row. */
  .brand,
  .brand-logo {
    flex: 0 0 auto;
  }

  /* In-drawer CTA (hidden on desktop, where the header keeps its own). */
  .nav__cta--drawer {
    display: inline-flex;
    margin-top: var(--space-4);
    width: 100%;
    justify-content: center;
  }

  .nav__menu {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(78vw, 340px);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--space-2);
    padding: calc(var(--header-h) + var(--space-5)) var(--space-5) var(--space-6);
    background: var(--bg-elevated);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform var(--t-base) var(--ease-out);
    z-index: var(--z-menu);
    overflow-y: auto;
  }

  .nav__menu.is-open {
    transform: translateX(0);
  }

  .nav__link {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--fs-md);
  }
  .nav__link::after {
    display: none;
  }
  .nav__link.is-active {
    background: color-mix(in srgb, var(--brand-500) 12%, transparent);
    color: var(--brand-500);
  }

  /* Backdrop behind drawer */
  .nav__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 15, 0.5);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--t-base), visibility var(--t-base);
    /* Sits under the drawer — it comes later in the DOM, so an equal
       z-index would paint the overlay on top of the open menu. */
    z-index: calc(var(--z-menu) - 1);
  }
  .nav__backdrop.is-open {
    opacity: 1;
    visibility: visible;
  }

  /* Lock scroll behind open drawer */
  body.nav-open {
    overflow: hidden;
  }
  /* Back-to-top (z 150) out-ranks the header (z 100) that holds the drawer,
     so it would float over the open menu. */
  body.nav-open .to-top {
    visibility: hidden;
  }

  /* Grouped dropdowns become in-drawer accordions */
  .nav__group {
    display: block;
  }
  .nav__group::after {
    display: none; /* no hover bridge on touch */
  }
  .nav__trigger {
    width: 100%;
    justify-content: space-between;
    padding: var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--fs-md);
    color: var(--text-muted);
  }
  .nav__trigger .nav__chev {
    width: 18px;
    height: 18px;
  }

  /* Collapsed by default; expands when its group is open */
  .mega {
    position: static;
    transform: none;
    min-width: 0;
    padding: 0 0 0 var(--space-2);
    margin: 0;
    display: block;
    gap: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    overflow: hidden;
    max-height: 0;
    transition: max-height var(--t-base) var(--ease-out);
  }
  .nav__group.is-open > .mega {
    max-height: 520px;
    transform: none; /* cancel the desktop centering transform on mobile */
  }
  .mega__item {
    padding: var(--space-3);
  }
  .mega__ic {
    width: 34px;
    height: 34px;
  }
}

/* Desktop: hide the mobile-only backdrop and in-drawer CTA entirely */
@media (min-width: 900px) {
  .nav__backdrop,
  .nav__cta--drawer {
    display: none;
  }
}

/* ==========================================================================
   Small phones
   ========================================================================== */
@media (max-width: 599px) {
  .nav__actions {
    gap: var(--space-2);
  }
  .container {
    padding-inline: var(--space-4);
  }
  /* Page intro (3rem bottom) + next section (4rem top) left a ~112px hole
     between the intro text and the content on phones. */
  .page-hero + .section {
    padding-top: var(--space-4);
  }
  /* The testimonial card already has padding; the slide's own 3rem on top
     of it squeezed quotes into a ~170px column on phones. */
  .slide {
    padding: var(--space-4) var(--space-2);
  }
}

@media (max-width: 420px) {
  :root {
    --header-h: 64px;
  }
  .brand-logo {
    height: 26px;
  }
  .hero__stats {
    gap: var(--space-5);
  }
  .to-top {
    right: var(--space-4);
    bottom: var(--space-4);
  }
  .newsletter__form {
    flex-direction: column;
  }
  /* In a column, the desktop "flex: 1 1 220px" becomes a 220px HEIGHT. */
  .newsletter__form input {
    flex: 0 0 auto;
  }
  .newsletter__form .btn {
    width: 100%;
  }
}

/* ==========================================================================
   Tablet and up
   ========================================================================== */
@media (min-width: 600px) {
  .container {
    padding-inline: var(--space-6);
  }
}

/* ==========================================================================
   Desktop refinements
   ========================================================================== */
@media (min-width: 1024px) {
  .hero__title {
    max-width: 14ch;
  }
  .footer__bottom {
    padding-block: var(--space-6);
  }
}

/* ==========================================================================
   Centered stacking on phones & tablets
   Once the hero / split rows collapse to one column, their text sits above a
   centered mockup — center the copy and actions to match.
   ========================================================================== */
@media (max-width: 899px) {
  .hero__content {
    text-align: center;
  }
  .hero__desc {
    margin-inline: auto;
  }
  .hero__cta,
  .hero-badges {
    justify-content: center;
  }
}

@media (max-width: 859px) {
  .split__content {
    text-align: center;
  }
  /* Feature pages set text-align:left inline on these headings. */
  .split__content .section-title,
  .split__content .section-subtitle {
    text-align: center !important;
    margin-inline: auto;
  }
  /* Keep checklist rows left-aligned, but center the list as a block. */
  .split__content .feature-list {
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
    text-align: left;
  }
}

/* ==========================================================================
   Large screens
   ========================================================================== */
@media (min-width: 1440px) {
  :root {
    --container: 1280px;
  }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
  .site-header,
  .to-top,
  .scroll-progress,
  .cta,
  .newsletter,
  .site-footer {
    display: none !important;
  }
  body::before,
  body::after {
    display: none;
  }
}
