/* ========== Mobile panel: hidden everywhere by default ========== */
.nav__mobile-panel { display: none; }
.nav__toggle       { display: none; }

/* ========== Tablet ========== */
@media (max-width: 1024px) {
  :root { --section-pad: 72px; }

  .hero__inner {
    grid-template-columns: 1fr;
    gap: 48px;
    text-align: center;
  }

  .hero__desc { margin-left: auto; margin-right: auto; }

  .hero__actions { justify-content: center; }

  .hero__visual { max-width: 480px; margin: 0 auto; }

  /* 4-col product grid -> 2-col on tablet */
  .products-grid[style*="repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }

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

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

  .footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; }

  .stats-bar__inner { grid-template-columns: repeat(2, 1fr); gap: 24px; }

  .stat-item + .stat-item::before { display: none; }

  .cart-layout { grid-template-columns: 1fr; }

  .summary-card { position: static; }

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

  /* Nav: hide cart button text on tablet to save space */
  .nav__actions .btn-ghost .btn-text { display: none; }
}

/* ========== Mobile ========== */
@media (max-width: 768px) {
  :root { --section-pad: 56px; }

  /* Nav - top bar stays fixed height, dropdown slides below */
  .nav__inner {
    height: var(--nav-h);
    position: relative;
  }

  /* Hide desktop links and actions by default */
  .nav__links { display: none; }
  .nav__toggle { display: flex; }

  /* When open: the nav grows to show dropdown panel */
  .nav.mobile-open {
    border-bottom-color: transparent;
  }

  /* Mobile dropdown panel - absolutely positioned below the nav bar */
  .nav__mobile-panel {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: rgba(255,255,255,.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    z-index: 999;
    padding: 8px 0 20px;
  }

  .nav__mobile-panel.open {
    display: block;
  }

  /* Nav links inside mobile panel - left aligned, generous spacing */
  .nav__mobile-panel .nav__links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 20px 0;
    align-items: flex-start;
  }

  .nav__mobile-panel .nav__links li {
    width: 100%;
  }

  .nav__mobile-panel .nav__link {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: .95rem;
    font-weight: 500;
  }

  /* Mobile action buttons (cart + login) */
  .nav__mobile-actions {
    display: flex;
    flex-direction: row;
    gap: 10px;
    padding: 16px 20px 0;
    margin-top: 12px;
    border-top: 1px solid var(--color-border);
  }

  .nav__mobile-actions .btn {
    flex: 1;
    justify-content: center;
  }

  /* Hide pc-only action buttons on mobile */
  .nav__actions .btn-ghost { display: none; }
  .nav__actions .btn-primary { display: none; }
  .nav__actions .nav__user-menu { display: none; }

  /* 4-col -> 1-col on mobile */
  .products-grid[style*="repeat(4"] { grid-template-columns: 1fr !important; }
  .products-grid[style*="repeat(2"] { grid-template-columns: 1fr !important; }

  /* Hero */
  .hero { padding: 64px 0 56px; }

  /* Products */
  .products-grid { grid-template-columns: 1fr; }

  /* Features */
  .features-grid { grid-template-columns: 1fr; }

  /* CTA */
  .cta-banner { padding: 44px 28px; }
  .cta-banner__inner { flex-direction: column; text-align: center; }

  /* Footer */
  .footer__grid { grid-template-columns: 1fr; gap: 28px; }
  .footer__bottom { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* Auth */
  .auth-card { padding: 32px 24px; }

  /* Contact form */
  .form-row-2 { grid-template-columns: 1fr; }

  /* Stats */
  .stats-bar__inner { grid-template-columns: repeat(2, 1fr); }

  /* Tables */
  .prose table { font-size: .8rem; }

  /* Open animation for the mobile panel */
  .nav__mobile-panel.open {
    animation: slideDown 0.22s ease;
  }

  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* ========== Small Mobile ========== */
@media (max-width: 480px) {
  :root { --section-pad: 48px; }

  .container { padding: 0 16px; }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.6rem; }

  .btn-lg { font-size: .9rem; padding: 12px 22px; }

  .hero__actions { flex-direction: column; width: 100%; }
  .hero__actions .btn { width: 100%; justify-content: center; }

  .cta-banner { padding: 36px 20px; }
  .cta-banner__inner { gap: 24px; }

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

  .stats-bar__inner { grid-template-columns: 1fr 1fr; }

  .footer__social { flex-wrap: wrap; }

  .auth-card { padding: 28px 18px; }

  .contact-form { padding: 24px 20px; }

  /* Mobile panel slide-down animation */
  .nav__mobile-panel.open {
    animation: mobileNavSlide 0.22s ease;
  }
  @keyframes mobileNavSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

