/* =========================================================
   NOVA X — Responsive (mobile-first overrides)
   ========================================================= */

/* ---------- Menú móvil ---------- */
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-toggle-bars {
  position: relative;
  width: 19px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--color-text);
  transition: background var(--dur-fast) var(--ease-out);
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 19px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--color-text);
  transition: transform var(--dur-med) var(--ease-out), top var(--dur-med) var(--ease-out);
}

.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }

.nav-toggle[aria-expanded="true"] .nav-toggle-bars {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
  top: 0;
  transform: rotate(-45deg);
}

.nav-panel-close {
  display: none;
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 16, 32, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: calc(var(--z-nav-mobile) - 1);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-med) var(--ease-out), visibility var(--dur-med) var(--ease-out);
}

.nav-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 1080px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

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

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

@media (max-width: 1024px) {
  /* El nav pasa a position:fixed y sale del flujo del grid;
     sin este ajuste, header-actions cae en la columna central
     (1fr) y los iconos aparecen flotando en el centro. */
  .header-inner {
    grid-template-columns: auto 1fr;
  }

  .header-actions {
    justify-content: flex-end;
  }

  .main-nav {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(320px, 85vw);
    background: var(--color-bg-elevated);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-6) var(--space-5);
    gap: var(--space-1);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform var(--dur-med) var(--ease-out);
    z-index: var(--z-nav-mobile);
    box-shadow: var(--shadow-lg);
  }

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

  .main-nav a {
    font-size: 1.05rem;
    padding-block: var(--space-3);
    border-bottom: 1px solid var(--color-border);
    width: 100%;
  }

  .nav-panel-close {
    display: flex;
    align-self: flex-end;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-surface);
    margin-bottom: var(--space-4);
    font-size: 1rem;
    flex-shrink: 0;
  }

  .nav-toggle {
    display: flex;
  }

  .search-box {
    width: 180px;
  }

  .search-box:focus-within {
    width: 220px;
  }

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

  .modal-box {
    grid-template-columns: 1fr;
  }

  .modal-media {
    aspect-ratio: 1/1;
  }
}

@media (max-width: 720px) {
  .search-wrap {
    display: none;
  }

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

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

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

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

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

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

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

  .hero {
    min-height: 78vh;
  }

  .hero-title {
    max-width: 100%;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .products-grid,
  .products-grid.cols-3 {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

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

  section {
    padding-block: var(--space-7);
  }

  .drawer {
    width: 100vw;
  }

  .payment-methods {
    grid-template-columns: 1fr;
  }

  .main-nav {
    width: 100vw;
    max-width: 100vw;
  }

  .header-inner {
    padding-inline: var(--space-4);
    gap: var(--space-3);
  }

  .header-actions {
    gap: var(--space-2);
  }

  .icon-btn,
  .nav-toggle {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .logo {
    font-size: 1.25rem;
  }
}
