/* =========================================================================
   Mobile polish for the storefront
   -------------------------------------------------------------------------
   Loaded last in core/templates/core/base.html so it can correct the theme
   and the page styles without editing each of them. Rules found by walking
   every customer page at 390px wide; each one says what it fixes.
   ========================================================================= */

/* ---- Everywhere --------------------------------------------------------- */

/* A card header painted with .bg-primary.text-white had its heading turned
   back to the site's dark heading colour - "Order #ORD-..." dark on blue. */
.card-header.text-white h1, .card-header.text-white h2, .card-header.text-white h3,
.card-header.text-white h4, .card-header.text-white h5, .card-header.text-white h6 {
  color: #ffffff !important;
}

/* The drawer menu's 50px shadow is drawn while it is parked off-screen too,
   which left a grey smear down the left edge of every page. Only an open
   drawer casts one. */
.bb-mobile-menu:not(.bb-menu-open),
.dark-mode .bb-mobile-menu:not(.bb-menu-open) {
  box-shadow: none !important;
}

@media (max-width: 767px) {

  /* ---- Scroll animations ------------------------------------------------
     AOS fades and slides each block in as it scrolls into view. On a phone
     that left cards half-faded, product grids out of line while the second
     column was still sliding, and the cart and checkout washed out until the
     visitor stopped scrolling. Content simply shows. */
  [data-aos],
  [data-aos].aos-animate {
    opacity: 1 !important;
    transform: none !important;
    transition-property: none !important;
  }

  /* ---- Footer -------------------------------------------------------------
     Its rows hang 15px outside a container that only pads 12px, so the
     footer was 3px wider than the screen and its text sat 8px from the edge. */
  .bb-footer .container { padding-left: 16px; padding-right: 16px; }
  .bb-footer .row { margin-left: -16px; margin-right: -16px; }
  .bb-footer .row > [class*="col-"],
  .bb-footer .bb-bottom-info { padding-left: 16px; padding-right: 16px; }

  /* ---- Floating help button ----------------------------------------------
     54px over the bottom navigation covered the end of whatever line it sat
     on. A little smaller and tucked into the corner. */
  #geLauncher.ge-launcher {
    width: 46px !important;
    height: 46px !important;
    padding: 0 !important;
    right: 12px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  /* ---- Wide tables inside .table-responsive -------------------------------
     They still scroll sideways, but with tighter cells a phone shows most of
     a row, and a product name no longer breaks one word per line. */
  .table-responsive > .table > :not(caption) > * > * {
    padding: .55rem .6rem;
    font-size: 13px;
  }
  .table-responsive > .table td strong { display: inline-block; min-width: 130px; }

  /* ---- Home ---------------------------------------------------------------- */

  /* "Trusted by top companies": the line under it ran edge to edge. */
  .koko-marquee-section .koko-marquee-title-wrap { padding-left: 16px; padding-right: 16px; }

  /* Category tiles: short cards with the name over the brightest part of the
     photo. Taller, and darkened enough for the words to read. */
  /* (Prefixed with .klh-cats: home.html's own styles sit in the body, after
     this file, and win any tie.) */
  .klh-cats .klh-cat { min-width: 150px; aspect-ratio: 4 / 3; }
  .klh-cats .klh-cat__veil {
    background: linear-gradient(to top, rgba(6, 12, 24, .9) 0%, rgba(6, 12, 24, .45) 100%);
  }
  .klh-cats .klh-cat__label { left: 12px; right: 12px; bottom: 10px; }
  .klh-cats .klh-cat__name { font-size: .95rem; }
  .klh-cats .klh-cat__note { font-size: .7rem; color: rgba(255, 255, 255, .85); }

  /* ---- Product listing ------------------------------------------------------
     Below 992px the "Big deal" box turned into a single flex row, so the pill,
     the title, the line under it and the photo were squeezed side by side and
     the words broke one per line. Words stacked on the left, photo right. */
  .kk-banners .kk-promo {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "pill img" "title img" "sub img";
    align-items: center;
    justify-items: start;
    column-gap: 14px;
    text-align: left;
    padding: 16px 18px;
  }
  .kk-banners .kk-promo-pill { grid-area: pill; margin-bottom: 6px; }
  .kk-banners .kk-promo-title { grid-area: title; }
  .kk-banners .kk-promo-sub { grid-area: sub; margin: 4px 0 0; }
  .kk-banners .kk-promo-img {
    grid-area: img;
    width: 96px;
    height: 96px;
    margin: 0;
    object-position: center;
  }
}

@media (max-width: 767px) {
  /* ---- Cart ------------------------------------------------------------------
     The cart already stacks its two buttons full width on a phone, but Clear
     Cart's form stayed as wide as its label, and the summary ran to within
     6px of the screen edge. */
  .section-cart .container { padding-left: 16px; padding-right: 16px; }
  .cart-summary .cart-actions > form { width: 100%; }
}

@media (max-width: 767px) {
  /* ---- Home product cards ----------------------------------------------------
     home.html shrinks them to 8-9px on a phone - the product name 8.5px, Add
     to Cart and Buy Now 8.5px side by side in a 160px card. Readable sizes,
     and the two buttons stacked so each label has room. (body-prefixed to
     outrank the page's own !important rules.) */
  body .koko-pro-card .koko-card-discount-badge { font-size: 10px !important; padding: 3px 8px !important; }
  body .koko-pro-card .koko-card-brand { font-size: 10.5px !important; }
  body .koko-pro-card .koko-pro-name,
  body .koko-pro-card .koko-pro-name a { font-size: 12.5px !important; line-height: 1.3 !important; }
  body .koko-pro-card .koko-card-status-row,
  body .koko-pro-card .koko-card-stock { font-size: 10.5px !important; }
  body .koko-pro-card .koko-price-unit-label { font-size: 10.5px !important; }
  body .koko-pro-card .koko-card-actions { flex-direction: column !important; gap: 6px !important; }
  body .koko-pro-card .koko-btn-enquire,
  body .koko-pro-card .koko-btn-buynow {
    flex: none !important;
    width: 100% !important;
    height: 34px !important;
    font-size: 12px !important;
    letter-spacing: 0 !important;
  }

  /* The lines around the grid and the About block. */
  body .koko-na-subtext { font-size: 11.5px !important; }
  body .koko-na-count-badge { font-size: 10.5px !important; padding: 3px 10px !important; }
  body .koko-about-tag-badge { font-size: 10.5px !important; }
  body .koko-about-feature-chip { font-size: 11px !important; }
  body .koko-about-desc,
  body .koko-about-desc strong { font-size: 12.5px !important; line-height: 1.55 !important; }
  body .koko-about-subtitle { font-size: 11.5px !important; }

  /* Home search's filter sheet. */
  body .koko-fm-hint,
  body .koko-fm-tag,
  body .koko-fm-active-title { font-size: 11px !important; }
}
