/* =====================================================================
   AfricaChemist – mobile optimisation layer
   Loaded at the END of <body> (base.html) so it wins over page <style> blocks.
   Breakpoints: ≤767.98px = phones/small tablets, ≤575.98px = phones.
   ===================================================================== */

/* Images whose height comes from the HTML attribute should scale with their width */
.am-pcard img, .pd-rel-card img { height: auto; }

/* Shipping/policy tables never push the page sideways */
.policy-page table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Comfortable tap targets everywhere */
@media (pointer: coarse) {
  .btn-qty1, .pd-tab, .faq-question { min-height: 44px; }
}

@media (max-width: 767.98px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }

  /* ---------- Header ---------- */
  .am-topbar { font-size: .72rem; }
  .am-topbar .container { padding-top: 5px; padding-bottom: 5px; }
  .navbar-brand img { max-width: 190px !important; height: auto !important; }

  /* ---------- Mobile menu (offcanvas) ---------- */
  #mobileMenu { width: min(86vw, 340px); }
  #mobileMenu .offcanvas-header { border-bottom: 1px solid #EADFD0; padding: 14px 18px; }
  #mobileMenu .offcanvas-title { font-weight: 700; color: #0B4D44; font-size: 1.05rem; }
  #mobileMenu .offcanvas-body { padding: 10px 14px 24px; display: flex; flex-direction: column; }
  #mobileMenu .navbar-nav > .nav-item > .nav-link { display: flex; align-items: center; min-height: 50px; padding: 0 10px;
      border-radius: 12px; font-weight: 600; color: #17302C; font-size: 1rem; }
  #mobileMenu .navbar-nav > .nav-item > .nav-link:active,
  #mobileMenu .navbar-nav > .nav-item > .nav-link:hover { background: #FBF7F1; color: #0B4D44; }
  #mobileMenu .navbar-nav > .nav-item + .nav-item { border-top: 1px solid #f1ebe1; }
  #mobileMenu .am-mcats { margin: 2px 0 10px; }
  #mobileMenu .am-mcats a { min-height: 46px; }
  #mobileMenu .mobile-cta { margin-top: auto !important; padding-top: 18px; }
  #mobileMenu .cta-button { min-height: 50px; display: flex; align-items: center; justify-content: center; font-size: 1rem; }

  /* ---------- Chat launcher: smaller so it covers less content ---------- */
  .tbc-launcher { width: 50px !important; height: 50px !important; }
  .tbc-launcher svg, .tbc-launcher i { transform: scale(.85); }
  .tbc-hint { display: none !important; }

  /* ---------- Footer ---------- */
  .amf-main { padding: 40px 0 26px; }
  .amf-col h2 { margin-bottom: 12px; }
  .amf-col ul { gap: 2px; }
  .amf-col li a { min-height: 36px; }
  .amf .amf-note p { font-size: .76rem; }
  .amf-bottom { font-size: .76rem; }

  /* ---------- Shop / category pages ---------- */
  .shop-hero { padding: 18px 16px !important; margin-bottom: 14px !important; }
  .shop-hero h1 { font-size: 1.35rem !important; }
  .shop-hero p { font-size: .85rem !important; }
  .shop-perks { display: none !important; }
  .shop-cats { margin-bottom: 8px !important; margin-left: -14px; margin-right: -14px; padding-left: 14px !important; padding-right: 14px !important;
      scrollbar-width: none; }
  .shop-cats::-webkit-scrollbar { display: none; }
  .shop-cats a { height: 38px !important; padding: 0 13px !important; font-size: .8rem !important; }
  .shop-bar { gap: 8px !important; margin-bottom: 12px !important; }
  .shop-count { order: 2; font-size: .8rem !important; }
  .shop-tools { grid-template-columns: 1fr 132px !important; gap: 8px !important; }
  .shop-search input, .shop-sort select { height: 42px !important; font-size: .85rem !important; }

  /* product grid: 2 compact cards per row */
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  .shop-grid .prod-box { border-radius: 14px !important; }
  .shop-grid .prod-img { aspect-ratio: 1 / 1 !important; padding: 6px !important; }
  .shop-badge { top: 8px !important; left: 8px !important; font-size: .6rem !important; padding: 3px 7px !important; }
  .shop-grid .prod-desc { padding: 10px 10px 12px !important; }
  .shop-cat-tag { font-size: .62rem !important; }
  .shop-grid .prod-desc h2 { font-size: .86rem !important; line-height: 1.3 !important; }
  .shop-from { font-size: .72rem !important; margin-bottom: 6px !important; }
  .shop-grid .quantity { display: none !important; }            /* first pack is pre-selected; choose others on the product page */
  .shop-grid .prod-price { padding: 4px 0 10px !important; }
  .shop-grid .prod-price p { font-size: 0 !important; }
  .shop-grid .price-value { font-size: 1.02rem !important; }
  .shop-grid .prod-order-btn { grid-template-columns: 1fr !important; }
  .shop-grid .btn-details { display: none !important; }
  .shop-grid .btn-order-now { min-height: 40px !important; font-size: .8rem !important; }
  .shop-content { margin-top: 26px !important; font-size: .92rem; }

  /* ---------- Product page ---------- */
  .pd-crumbs { padding-top: 12px !important; font-size: 12px !important; }
  .pd h1.pd-title { font-size: 1.6rem !important; }
  .pd-related { padding-bottom: 30px !important; }
  .pd-rel-grid { gap: 10px !important; }
  .pd-rel-body strong { font-size: 13.5px !important; }

  /* sticky "add to cart" bar (product_detail.html adds .pd-sticky) */
  .pd-sticky { position: fixed; left: 0; right: 0; bottom: var(--mbn-h, 0px); z-index: 1035; display: flex; align-items: center; gap: 12px;
      padding: 10px 14px; background: #fff; border-top: 1px solid #EADFD0; box-shadow: 0 -6px 20px rgba(6,35,31,.1);
      transform: translateY(120%); transition: transform .25s ease; font-family: "Lexend", sans-serif; }
  .pd-sticky.show { transform: none; }
  .pd-sticky-info { min-width: 0; flex: 1; line-height: 1.2; }
  .pd-sticky-info small { display: block; font-size: .72rem; color: #5F716D; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pd-sticky-info strong { font-size: 1.15rem; color: #0B4D44; }
  .pd-sticky button { flex: 0 0 auto; height: 46px; padding: 0 20px; border: 0; border-radius: 99px; background: #0B4D44; color: #FFF3E3;
      font-weight: 700; font-family: inherit; font-size: .92rem; }
  .pd-sticky button:active { background: #146B5F; }
  body.has-pd-sticky .tbc { bottom: calc(80px + var(--mbn-h, 0px)) !important; }

  /* ---------- Blog ---------- */
  .blog_banner { min-height: 0 !important; height: auto !important; padding: 34px 0 !important; }
  .blog_banner h1 { font-size: 1.6rem !important; margin: 0 !important; }

  /* ---------- Generic inner-page banners ---------- */
  .page_banner { padding: 34px 16px !important; min-height: 0 !important; height: auto !important; }
  .page_banner h1 { font-size: 1.6rem !important; }
  .section_padding { padding-top: 22px !important; padding-bottom: 22px !important; }
  .policy-page { font-size: .93rem; }
  .policy-page h2 { font-size: 1.2rem; }
}

@media (max-width: 575.98px) {
  /* ---------- Home: hero ---------- */
  .am-hero { padding: 26px 0 60px !important; }
  .am-hero .am-eyebrow { font-size: .66rem; }
  .am-hero h1 { font-size: 1.9rem !important; margin-bottom: 12px !important; }
  .am-hero p.lead { font-size: .94rem !important; margin-bottom: 20px !important; }
  .am-hero-grid { gap: 0 !important; }
  .am-hero-tiles { display: none !important; }                  /* same categories appear right below */
  .am-cta { gap: 10px !important; }
  .am-btn { height: 48px !important; }
  .am-stats { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 0 !important; margin-top: 22px !important;
      padding-top: 16px; border-top: 1px solid rgba(255,255,255,.15); }
  .am-stats > div + div { border-left: 1px solid rgba(255,255,255,.15); padding-left: 12px; }
  .am-stats strong { font-size: 1.15rem !important; }
  .am-stats span { font-size: .68rem !important; }

  /* ---------- Home: sections ---------- */
  .am-sec { padding: 34px 0 !important; }
  .am-sec-head { margin-bottom: 16px !important; gap: 8px !important; }
  .am h2.am-h { font-size: 1.35rem !important; }
  .am .am-sub { font-size: .86rem; }
  .am .am-eyebrow { font-size: .66rem; margin-bottom: 4px; }

  /* categories: 2 x 2 compact tiles */
  .am-cat-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .am-cat { padding: 16px 14px 14px !important; border-radius: 16px !important; }
  .am-cat::before { width: 80px !important; height: 80px !important; right: -30px !important; top: -30px !important; }
  .am-cat-ic { width: 42px !important; height: 42px !important; font-size: 1.1rem !important; border-radius: 12px !important; margin-bottom: 10px !important; }
  .am-cat h3 { font-size: .98rem !important; }
  .am-cat p { display: none !important; }
  .am-cat-foot { font-size: .74rem !important; margin-top: 4px; }

  /* why us: 2 x 2 */
  .am-why-grid { grid-template-columns: 1fr 1fr !important; gap: 20px 14px !important; }
  .am-why-item i { width: 40px !important; height: 40px !important; font-size: 1.05rem !important; margin-bottom: 10px !important; }
  .am-why-item h3 { font-size: .9rem !important; }
  .am-why-item p { font-size: .76rem !important; line-height: 1.5 !important; }

  /* top picks per category */
  .am-row { margin-bottom: 28px !important; }
  .am-row-head { margin-bottom: 12px !important; flex-wrap: nowrap !important; }
  .am-row-head h3 { font-size: 1.08rem !important; gap: 10px !important; }
  .am-row-head h3 i { width: 34px !important; height: 34px !important; font-size: .9rem !important; }
  .am-row-head .am-link { font-size: .8rem; }
  .am-pgrid { gap: 10px !important; }
  .am-pcard { border-radius: 14px !important; }
  .am-pcard img { padding: 6px !important; }
  .am-pcard-b { padding: 10px 12px 12px !important; }
  .am-pcard-b strong { font-size: .86rem !important; }
  .am-pcard-b small { display: none !important; }
  .am-pcard-b .am-price { font-size: .88rem; }
  .am-pcard-b .am-price em { display: none !important; }

  /* featured carousel */
  .fp-section { padding-top: 34px !important; padding-bottom: 34px !important; }
  .fp-section .heading-2-main { font-size: 1.35rem !important; }
  .fp-sub { font-size: .85rem !important; }

  /* delivery countries: show 8 + "many more" */
  .geo-section { padding-top: 40px !important; padding-bottom: 40px !important; }
  .geo-section h2 { font-size: 1.4rem !important; }
  .geo-grid { gap: 8px !important; }
  .geo-grid .geo-item:nth-child(n+9):not(:last-child) { display: none !important; }
  .geo-item { font-size: .8rem !important; padding: 7px 12px !important; }

  /* reviews */
  .testimonial-section .heading-2-main { font-size: 1.4rem !important; }

  /* how to order: number left, text right */
  .order-section { padding-top: 40px !important; padding-bottom: 40px !important; }
  .order-section h2 { font-size: 1.4rem !important; }
  .order-section .steps { margin-top: 24px !important; gap: 18px !important; }
  .order-section .step { display: grid; grid-template-columns: 48px 1fr; column-gap: 14px; text-align: left; align-items: start; }
  .order-section .step-num { grid-row: span 2; width: 48px !important; height: 48px !important; font-size: 1.15rem !important; margin: 0 !important; }
  .order-section .step-title { margin: 2px 0 4px !important; }
  .order-section .payment-icons { gap: 8px !important; margin-top: 26px !important; }
  .order-section .pay-icon { padding: 6px 12px !important; font-size: .75rem !important; }

  /* FAQ */
  .faq-section .heading-2-main { font-size: 1.4rem !important; }
  .faq-question { font-size: .95rem !important; padding-right: 34px !important; }

  /* disclaimer box */
  .am-note { padding: 14px 16px !important; }
  .am-note p { font-size: .78rem !important; line-height: 1.55 !important; }

  /* ---------- Footer ---------- */
  .amf-trust-item { padding: 12px 2px !important; }
  .amf-trust-ic { flex-basis: 40px !important; width: 40px !important; height: 40px !important; font-size: 1rem !important; border-radius: 12px !important; }
  .amf-main > .amf-col:last-of-type ul { grid-template-columns: 1fr 1fr; column-gap: 20px; }
  .amf-news { padding: 18px !important; }
}

@media (max-width: 359.98px) {
  .shop-grid, .am-pgrid { gap: 8px !important; }
  .am-hero h1 { font-size: 1.7rem !important; }
  .shop-tools { grid-template-columns: 1fr !important; }
}
