/*
 * A-Medical homepage — mobile-first polish.
 *
 * Loaded only on index.php from includes/site_header.php.
 * The rules are scoped to .page-home and do not change homepage content,
 * product data, offers, or desktop presentation.
 */

@media (max-width: 767px) {
  .page-home {
    --mobile-page-gutter: 14px;
    --mobile-section-space: 46px;
    --mobile-card-radius: 16px;
    overflow-x: clip;
  }

  .page-home .container {
    width: 100%;
    max-width: 100%;
    padding-inline: var(--mobile-page-gutter);
  }

  .page-home .section {
    padding-block: var(--mobile-section-space);
  }

  .page-home .section-head {
    width: 100%;
    margin-bottom: 18px;
    text-align: start;
  }

  .page-home .section-head h2 {
    margin: 0;
    font-size: clamp(1.32rem, 5.6vw, 1.65rem);
    line-height: 1.35;
    letter-spacing: 0;
  }

  .page-home .section-head p {
    max-width: 34rem;
    margin: 6px 0 0;
    font-size: 0.88rem;
    line-height: 1.7;
  }

  .page-home .section-head--row {
    align-items: end;
    gap: 12px;
  }

  .page-home .section-head--row .text-link {
    flex: 0 0 auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Compact, stable mobile header with comfortable tap targets. */
  .page-home .top-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 18px rgba(33, 37, 41, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  /*
   * The cart is a modal surface and must always sit above the sticky header.
   * The previous mobile header value (1000) was higher than the base cart
   * layer, so the header covered the upper part of the cart.
   */
  .page-home .side-cart-backdrop {
    z-index: 1190 !important;
  }

  .page-home .side-cart {
    z-index: 1200 !important;
  }

  .page-home .header-shell {
    padding-inline: 10px;
  }

  .page-home .header-mobile-bar {
    min-height: 58px;
    gap: 8px;
  }

  .page-home .header-menu-toggle,
  .page-home .header-bar-cart {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .page-home .header-mobile-bar > .logo {
    min-width: 0;
    max-width: calc(100% - 104px);
  }

  .page-home .header-mobile-bar .logo-mark {
    flex: 0 0 auto;
  }

  .page-home .header-mobile-bar .logo-text {
    min-width: 0;
  }

  .page-home .header-mobile-bar .logo-name {
    overflow: hidden;
    font-size: 0.88rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-home .header-mobile-bar .logo-tag {
    display: block;
    overflow: hidden;
    margin-top: 1px;
    font-size: 0.62rem;
    line-height: 1.2;
    letter-spacing: 0.16em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-home .brand-strip--home {
    padding-block: 7px;
    overflow: hidden;
  }

  .page-home .brand-strip--home .brand-strip__row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    padding-inline: 9px;
  }

  .page-home .brand-strip--home .brand-strip__logo {
    min-width: 0;
    height: 42px;
    padding: 5px;
    border-radius: 10px;
  }

  .page-home .brand-strip--home .brand-strip__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* The first visual appears immediately even if reveal JS is delayed. */
  .page-home .hero {
    min-height: 0;
    padding-block: 10px 14px;
    overflow: hidden;
    background: #fff;
  }

  .page-home .hero > .container,
  .page-home .hero > .container.reveal {
    padding-inline: 10px;
    opacity: 1 !important;
    transform: none !important;
  }

  .page-home .hero-strip {
    min-height: 0;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(33, 37, 41, 0.09);
  }

  .page-home .hero-slide {
    aspect-ratio: 1400 / 760;
    min-height: 0;
    background: #f3f3f3;
  }

  /*
   * Added by the mobile-banner switcher only when this slide has its own
   * portrait artwork. Desktop-only slides keep their original wide ratio.
   */
  .page-home .hero-slide.is-mobile-hero {
    aspect-ratio: 4 / 5;
  }

  .page-home .hero-slide img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #f3f3f3;
  }

  .page-home .hero-discount {
    top: 9px;
    inset-inline-end: 9px;
    min-width: 48px;
    min-height: 48px;
    display: inline-grid;
    place-items: center;
    padding: 6px;
    font-size: 0.82rem;
  }

  /* Three fast entry points without a tall stack. */
  .page-home #categories .categories-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
  }

  .page-home #categories .cat-card {
    min-width: 0;
    min-height: 132px;
    padding: 12px 7px 10px;
    border-radius: 15px;
    text-align: center;
  }

  .page-home #categories .cat-icon {
    width: 58px;
    height: 58px;
    margin-inline: auto;
  }

  .page-home #categories .cat-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .page-home #categories .cat-card h3 {
    margin: 8px 0 0;
    font-size: clamp(0.76rem, 3.4vw, 0.9rem);
    line-height: 1.45;
  }

  .page-home #categories .cat-card p {
    display: none;
  }

  /* Products continue down the page in a familiar two-column store grid. */
  .page-home #bestsellers .products-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 12px;
    margin-inline: 0;
    padding: 2px 0;
    overflow: visible;
    scroll-snap-type: none;
  }

  .page-home #bestsellers .product-card {
    min-width: 0;
    overflow: hidden;
    border-radius: var(--mobile-card-radius);
  }

  .page-home #bestsellers .product-img {
    height: auto !important;
    aspect-ratio: 4 / 5;
    padding: 8px;
  }

  .page-home #bestsellers .product-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .page-home #bestsellers .product-name {
    min-height: 4.2em;
    margin-block: 8px 5px;
    overflow: hidden;
    display: -webkit-box;
    font-size: 0.82rem;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .page-home #bestsellers .product-meta {
    min-height: 24px;
  }

  .page-home #bestsellers .price-row {
    min-height: 38px;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 7px;
  }

  .page-home #bestsellers .price {
    font-size: 0.98rem;
  }

  .page-home #bestsellers .btn-cart {
    width: calc(100% - 16px);
    min-height: 44px;
    margin: 4px 8px 8px;
    padding-inline: 7px;
    font-size: 0.82rem;
  }

  .page-home #bestsellers .btn-fav {
    width: 38px;
    height: 38px;
  }

  /* The same products already appear above; avoid repeating eight cards. */
  .page-home #new {
    display: none !important;
  }

  /* Keep all offer copy—including the whitening cream—inside a compact rail. */
  .page-home #offers .offers-grid {
    display: grid;
    grid-template-columns: none !important;
    grid-auto-flow: column;
    grid-auto-columns: minmax(270px, 86vw);
    gap: 12px;
    margin-inline: calc(var(--mobile-page-gutter) * -1);
    padding: 2px var(--mobile-page-gutter) 12px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .page-home #offers .offers-grid::-webkit-scrollbar {
    display: none;
  }

  .page-home #offers .offer-banner {
    min-width: 0;
    min-height: 190px;
    padding: 20px;
    overflow: hidden;
    border-radius: var(--mobile-card-radius);
    scroll-snap-align: start;
  }

  .page-home #offers .offer-banner__text {
    position: relative;
    z-index: 2;
    max-width: 84%;
  }

  .page-home #offers .offer-banner strong {
    display: block;
    margin-block: 7px;
    font-size: 1.05rem;
    line-height: 1.55;
  }

  .page-home #offers .offer-note {
    overflow: hidden;
    display: -webkit-box;
    font-size: 0.84rem;
    line-height: 1.7;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .page-home #loyalty {
    padding-block: var(--mobile-section-space);
  }

  .page-home #loyalty .loyalty-card {
    display: block;
    min-height: 0;
    padding: 24px 20px;
    border-radius: var(--mobile-card-radius);
  }

  .page-home #loyalty .loyalty-content {
    max-width: none;
  }

  .page-home #loyalty .loyalty-content h2 {
    font-size: 1.35rem;
    line-height: 1.45;
  }

  .page-home #loyalty .loyalty-content ul {
    margin-block: 14px 18px;
    padding-inline-start: 19px;
    font-size: 0.88rem;
    line-height: 1.8;
  }

  .page-home #loyalty .loyalty-visual {
    display: none;
  }

  .page-home #loyalty .btn {
    width: 100%;
    min-height: 46px;
  }

  .page-home #faq .faq-home__list {
    gap: 8px;
  }

  .page-home #faq .faq-item {
    border-radius: 13px;
  }

  .page-home #faq .faq-item summary {
    min-height: 50px;
    padding: 13px 14px;
    font-size: 0.91rem;
    line-height: 1.6;
  }

  .page-home #faq .faq-item > :not(summary) {
    padding-inline: 14px;
    font-size: 0.86rem;
    line-height: 1.8;
  }

  .page-home #reviews .reviews-wrap {
    padding-inline: 0;
  }

  .page-home #reviews .review-card {
    min-height: 0;
    padding: 22px 18px;
    border-radius: var(--mobile-card-radius);
  }

  .page-home #reviews .review-card blockquote {
    margin-block: 10px 16px;
    font-size: 0.9rem;
    line-height: 1.85;
  }

  .page-home #reviews .slider-btn {
    width: 42px;
    height: 42px;
  }

  .page-home #features-strip {
    padding-block: 40px;
  }

  .page-home #features-strip .features-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .page-home #features-strip .feature-item {
    min-width: 0;
    align-items: center;
    gap: 9px;
    padding: 13px 10px;
    border-radius: 13px;
  }

  .page-home #features-strip .feature-icon {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
  }

  .page-home #features-strip .feature-item strong {
    display: block;
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .page-home #features-strip .feature-item p {
    margin: 2px 0 0;
    font-size: 0.7rem;
    line-height: 1.5;
  }

  .page-home #find-us {
    padding-block: 44px;
    overflow: hidden;
  }

  .page-home #find-us .section-head {
    margin-bottom: 14px;
  }

  .page-home .whatsapp-float,
  .page-home .site-whatsapp-button {
    inset-inline-end: 12px;
    bottom: 12px;
  }

  /* Delay below-the-fold layout work without hiding the first screen. */
  .page-home #offers,
  .page-home #loyalty,
  .page-home #faq,
  .page-home #reviews,
  .page-home #features-strip,
  .page-home #find-us {
    content-visibility: auto;
    contain-intrinsic-size: auto 520px;
  }
}

@media (max-width: 374px) {
  .page-home {
    --mobile-page-gutter: 11px;
  }

  .page-home #categories .cat-card {
    min-height: 122px;
    padding-inline: 5px;
  }

  .page-home #categories .cat-icon {
    width: 50px;
    height: 50px;
  }

  .page-home #offers .offers-grid {
    grid-auto-columns: minmax(258px, 89vw);
  }

  .page-home #categories .categories-grid {
    gap: 10px;
  }

  .page-home #features-strip .feature-item {
    display: block;
    text-align: center;
  }

  .page-home #features-strip .feature-icon {
    margin: 0 auto 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-home *,
  .page-home *::before,
  .page-home *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
