/* ==========================================================================
   GrabDealls — Responsive rules
   Breakpoints: 1024 (tablet/laptop), 768 (tablet), 560 (mobile), 380 (small)
   Mobile-first refinements, header collapse, bottom nav, grids.
   ========================================================================== */

/* ---------- <= 1024px : laptop / tablet ---------- */
@media (max-width: 1024px) {
  :root { --header-h: 64px; }

  .hero h1 { font-size: 2.25rem; }
  .hero__inner { gap: var(--sp-6); }

  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1.2fr; }
  .footer-col--service { display: none; } /* fold into other menus on tablet */
}

/* ---------- <= 900px : nav collapses to burger ---------- */
@media (max-width: 900px) {
  /* Hide desktop nav + inline search, show burger + mobile icons */
  .header-nav,
  .header-search { display: none; }
  .header-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    border-radius: var(--r-md);
    color: var(--c-ink);
    flex-shrink: 0;
  }
  .header-burger:hover { background: var(--c-bg-alt); }
  .header-burger svg { width: 26px; height: 26px; }

  .header-main { gap: var(--sp-3); justify-content: space-between; }
  .brand { margin-inline: auto; }        /* center the logo */

  .header-actions { display: none; }      /* desktop actions hidden */
  .header-mobile-icons {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    flex-shrink: 0;
  }

  /* A compact search row appears below the top bar on mobile */
  .header-mobile-search {
    display: block;
    padding: 0 var(--sp-4) var(--sp-3);
    border-top: 1px solid var(--c-line-soft);
  }
  .header-mobile-search .header-search {
    display: flex;
    max-width: none;
    margin-top: var(--sp-3);
  }

  /* Bottom navigation on mobile */
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    inset: auto 0 0 0;
    background: #fff;
    border-top: 1px solid var(--c-line);
    z-index: var(--z-header);
    box-shadow: 0 -4px 16px rgba(19,26,43,.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--sp-2) 0;
    font-size: 10px;
    font-weight: var(--fw-medium);
    color: var(--c-muted);
    position: relative;
  }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a[aria-current="page"] { color: var(--c-primary); }
  .bottom-nav a .badge-count {
    position: absolute;
    top: 2px; right: 50%; margin-right: -22px;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: var(--c-accent); color: #fff;
    font-size: 10px; line-height: 16px; text-align: center;
    border-radius: var(--r-pill);
  }
  /* Reserve space so bottom nav never covers content */
  body { padding-bottom: 64px; }
}

/* Desktop keeps the mobile-only search row hidden */
@media (min-width: 901px) {
  .header-mobile-search { display: none; }
}

/* ---------- <= 768px : tablet portrait ---------- */
@media (max-width: 768px) {
  .section { padding-block: var(--sp-7); }

  .hero__inner {
    grid-template-columns: 1fr;
    text-align: center;
    padding-block: var(--sp-7);
  }
  .hero__text { margin-inline: auto; }
  .hero__cta { justify-content: center; }
  .hero__stats { justify-content: center; }
  .hero__visual { max-width: 340px; margin: var(--sp-5) auto 0; }
  .hero__chip--tl { left: 2%; }
  .hero__chip--br { right: 2%; }

  .promo-grid { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .trust-strip { grid-template-columns: 1fr 1fr; }
  .feature-grid { grid-template-columns: 1fr 1fr; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-about { grid-column: 1 / -1; }
  .footer-col--service { display: block; }

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

  .deals-band__top { flex-direction: column; align-items: flex-start; }
}

/* ---------- <= 560px : mobile ---------- */
@media (max-width: 560px) {
  :root { --fs-2xl: 1.6rem; --fs-3xl: 2.1rem; }

  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .newsletter form { flex-direction: column; }
  .newsletter .btn { width: 100%; }

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

  /* Product card actions stack on very small screens */
  .product-card__actions { grid-template-columns: 1fr; }
  .product-card__body { padding: var(--sp-3); }

  .footer-bottom { flex-direction: column; align-items: flex-start; }

  .deals-band { padding: var(--sp-4); }
  .trust-strip { padding: var(--sp-4); }
}

/* ---------- <= 380px : small mobile ---------- */
@media (max-width: 380px) {
  .grid-products { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
  .price-now { font-size: var(--fs-base); }
  .brand { font-size: var(--fs-md); }
  .hero__stats { gap: var(--sp-4); }
}

/* ---------- Sticky mobile CTA (product page) ---------- */
@media (max-width: 768px) {
  .sticky-cta.is-active {
    display: flex;
    position: fixed;
    inset: auto 0 64px 0;      /* sits above the bottom nav */
    background: #fff;
    border-top: 1px solid var(--c-line);
    padding: var(--sp-3) var(--sp-4);
    gap: var(--sp-2);
    z-index: var(--z-header);
    box-shadow: 0 -6px 18px rgba(19,26,43,.08);
  }
  .sticky-cta.is-active .btn { flex: 1; }
}
