/* Maxmart redesign — home page (boards 01, 02, 10). */

.mm-home { display: flex; flex-direction: column; gap: var(--mm-section-gap); padding-bottom: 16px; }
.mm-section__title { display: flex; align-items: center; gap: 12px; }
.mm-section__link.mm-link-btn { font-weight: 600; color: var(--mm-brand); }
@media (max-width: 767.98px) {
  .mm-home .mm-section__head { flex-wrap: nowrap; align-items: center; }
  .mm-home .mm-h2 { font-size: 22px; }
  .mm-home .mm-section__link { font-size: var(--mm-fs-sm); }
}

/* ---------- Hero row ---------- */
/* Flex, not grid: a grid sizes the auto row from the banner's height at the full container width
   (before the 2fr/1fr split), which left the row ~140px too tall. Flex resolves widths first. */
.mm-hero { display: flex; align-items: stretch; gap: 16px; }
.mm-hero__main { flex: 2 1 0; min-width: 0; }
.mm-hero__side { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.mm-hero--tiles-only .mm-hero__side { flex-direction: row; }

.mm-carousel-wrap.carousel-container { margin: 0; padding: 0; background: none; }
.mm-carousel {
  position: relative; overflow: hidden;
  border-radius: var(--mm-r-xl); background: var(--mm-brand-dark);
}
/* Legacy: .carousel-inner absolute with padding-top 65px, and a fixed carousel height on phones. */
.mm-carousel.carousel { height: auto; min-height: 0; }
.mm-carousel .carousel-inner { position: relative; height: auto; padding: 0; margin: 0; } /* legacy: padding-top 65px */
/* The banner sets the row height through its own proportions; the promo tiles stretch to match. */
.mm-slide__link { display: block; }
.mm-slide__img { display: block; width: 100%; height: auto; aspect-ratio: 1110 / 400; object-fit: cover; }

/* A slide written in HTML (has a Caption) */
.mm-slide--text.carousel-item.active, .mm-slide--text.carousel-item-next, .mm-slide--text.carousel-item-prev {
  display: flex;
}
.mm-slide--text {
  position: relative; align-items: center; gap: 24px; min-height: 400px;
  padding: 48px; box-sizing: border-box; color: #fff; overflow: hidden;
}
.mm-slide--text::before {
  content: ""; position: absolute; right: -80px; top: -80px;
  width: 420px; height: 420px; border-radius: 50%; background: var(--mm-brand);
}
.mm-slide__text { position: relative; flex: 1 1 300px; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.mm-slide__title {
  margin: 0; font-family: var(--mm-font-display); font-size: var(--mm-fs-hero); line-height: 1.02;
  font-weight: 800; letter-spacing: -0.02em; color: #fff;
}
.mm-slide__sub { margin: 0; max-width: 380px; font-size: var(--mm-fs-lg); color: var(--mm-brand-ink); }
.mm-slide__media { position: relative; flex: 0 0 240px; display: flex; align-items: center; justify-content: center; }
.mm-slide__media img { max-width: 100%; max-height: 300px; object-fit: contain; }

.mm-carousel__dots.carousel-indicators {
  left: 48px; right: auto; bottom: 20px; margin: 0; justify-content: flex-start; gap: 6px;
}
.mm-carousel__dots li {
  width: 6px; height: 6px; margin: 0; border: 0; border-radius: 3px;
  background: rgba(255, 255, 255, .45); opacity: 1; transition: width .2s ease, background .2s ease;
}
.mm-carousel__dots li.active { width: 22px; background: var(--mm-accent); }
.mm-carousel__nav.carousel-control-prev, .mm-carousel__nav.carousel-control-next {
  top: 50%; bottom: auto; width: 44px; height: 44px; margin-top: -22px;
  border-radius: 50%; background: rgba(255, 255, 255, .9); color: var(--mm-ink); opacity: 0;
  transition: opacity .2s ease;
}
.mm-carousel__nav--prev { left: 16px; }
.mm-carousel__nav--next { right: 16px; }
.mm-carousel:hover .mm-carousel__nav, .mm-carousel__nav:focus-visible { opacity: 1; }
.mm-carousel__nav:hover { color: var(--mm-brand); }

.mm-promo-tile {
  /* No min-height: the row is as tall as the banner (1110×400), and the two tiles share it. */
  flex: 1; min-height: 0; padding: 20px 24px; box-sizing: border-box;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  border-radius: var(--mm-r-xl); background: #fff; border: 1px solid var(--mm-border); color: var(--mm-ink);
  transition: box-shadow .15s ease, transform .15s ease;
}
.mm-promo-tile:hover { color: var(--mm-ink); text-decoration: none; box-shadow: var(--mm-shadow-md); transform: translateY(-2px); }
.mm-promo-tile__eyebrow { font-size: var(--mm-fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--mm-brand); }
.mm-promo-tile__title { font-family: var(--mm-font-display); font-size: 24px; font-weight: 800; line-height: 1.1; }
.mm-promo-tile__link { font-weight: 600; color: var(--mm-brand); }
.mm-promo-tile--accent { background: var(--mm-accent); border-color: var(--mm-accent); }
.mm-promo-tile--accent .mm-promo-tile__eyebrow, .mm-promo-tile--accent .mm-promo-tile__link { color: var(--mm-ink); }
.mm-promo-tile--accent .mm-promo-tile__title { font-size: 28px; line-height: 1.05; }

/* ---------- Advantages ---------- */
.mm-advantages { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.mm-advantage {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  background: #fff; border: 1px solid var(--mm-border); border-radius: var(--mm-r-tile);
}
.mm-advantage__icon {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: var(--mm-r-lg); background: var(--mm-brand-soft); color: var(--mm-brand);
  font-size: 20px;
}
.mm-advantage__icon img { max-width: 28px; max-height: 28px; }
.mm-advantage__title { display: block; font-size: var(--mm-fs-base); color: var(--mm-ink); }
.mm-advantage__sub { font-size: var(--mm-fs-sm); color: var(--mm-muted); }

/* ---------- Category tiles ---------- */
.mm-cat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.mm-cat-tile {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 12px;
  background: #fff; border: 1px solid var(--mm-border); border-radius: var(--mm-r-card);
  color: var(--mm-text); font-weight: 600; font-size: var(--mm-fs-md); text-align: center; line-height: 1.3;
}
.mm-cat-tile:hover { color: var(--mm-brand); border-color: var(--mm-brand); text-decoration: none; }
.mm-cat-tile__icon {
  display: flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%; background: var(--mm-accent-soft); color: var(--mm-ink);
}

/* ---------- Credit banner ---------- */
.mm-credit-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 24px;
  padding: 32px 40px; border-radius: var(--mm-r-xl); background: var(--mm-ink); color: #fff;
}
.mm-credit-banner__text { flex: 1 1 360px; display: flex; flex-direction: column; gap: 8px; }
.mm-credit-banner p { margin: 0; color: var(--mm-on-dark-2); }

/* ---------- Brands ---------- */
.mm-home-brands { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.mm-home-brands__item {
  display: flex; align-items: center; justify-content: center; height: 72px; padding: 0 12px;
  background: #fff; border: 1px solid var(--mm-border); border-radius: var(--mm-r-tile);
  color: var(--mm-text-2); font-family: var(--mm-font-display); font-weight: 700; font-size: var(--mm-fs-lg);
  text-align: center;
}
.mm-home-brands__item:hover { color: var(--mm-brand); border-color: var(--mm-brand); text-decoration: none; }

/* ---------- Seasonal offers ---------- */
.mm-seasonal__row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.mm-seasonal__card {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 12px;
  background: #fff; border: 1px solid var(--mm-border); border-radius: var(--mm-r-card);
  color: var(--mm-text); text-align: center;
}
.mm-seasonal__card:hover { color: var(--mm-brand); border-color: var(--mm-brand); text-decoration: none; }
.mm-seasonal__img { display: flex; align-items: center; justify-content: center; width: 100%; height: 120px; }
.mm-seasonal__img img { max-width: 100%; max-height: 120px; object-fit: contain; }
.mm-seasonal__title { font-weight: 600; font-size: var(--mm-fs-md); }

/* ---------- How to buy ---------- */
.mm-howto {
  display: flex; flex-direction: column; gap: 20px; padding: 40px;
  background: #fff; border: 1px solid var(--mm-border); border-radius: var(--mm-r-xl);
}
.mm-howto__steps {
  margin: 0; padding: 0; list-style: none;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px;
}
.mm-howto__step { display: flex; flex-direction: column; gap: 8px; }
.mm-howto__step strong { font-size: var(--mm-fs-base); color: var(--mm-ink); }
.mm-howto__num {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 50%; background: var(--mm-brand); color: #fff;
  font-family: var(--mm-font-display); font-weight: 800; font-size: var(--mm-fs-lg);
}
.mm-howto__text { font-size: var(--mm-fs-md); color: var(--mm-muted); }

/* ---------- Mobile callback card ---------- */
.mm-callback-card {
  display: flex; flex-direction: column; gap: 8px; padding: 20px;
  border-radius: var(--mm-r-xl); background: #fff; border: 1px solid var(--mm-border);
}
.mm-callback-card__icon {
  display: flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: 50%; background: var(--mm-accent-soft); color: var(--mm-ink);
}
.mm-callback-card__title { font-family: var(--mm-font-display); font-size: var(--mm-fs-lg); font-weight: 800; color: var(--mm-ink); }
.mm-callback-card__text { font-size: var(--mm-fs-md); color: var(--mm-muted); margin-bottom: 8px; }

/* ---------- Tablet ---------- */
/* Desktop: the row takes the banner's proportions (two thirds of the width at 1110:400), and the
   banner and the tiles fill it. Sizing the row from the image itself made browsers measure the
   image at the full row width and leave the row ~140px too tall. */
@media (min-width: 1024px) {
  .mm-hero:not(.mm-hero--tiles-only) { aspect-ratio: 3330 / 800; }
  .mm-hero__main .mm-carousel-wrap, .mm-hero__main .mm-carousel, .mm-hero__main .carousel-inner,
  .mm-hero__main .carousel-item, .mm-hero__main .mm-slide__link, .mm-hero__main .mm-slide__img { height: 100%; }
  .mm-hero__main .mm-slide--text { min-height: 0; }
}
@media (min-width: 1280px) {
  .mm-promo-tile { padding: 24px 28px; }
  .mm-promo-tile__title { font-size: 26px; }
  .mm-promo-tile--accent .mm-promo-tile__title { font-size: 32px; }
}
@media (max-width: 1023.98px) {
  .mm-hero { flex-direction: column; }
  .mm-hero__side { flex-direction: row; }
  .mm-promo-tile { min-height: 150px; }
}

/* ---------- Mobile (board 02) ---------- */
@media (max-width: 767.98px) {
  .mm-home { gap: 28px; }
  .mm-carousel { border-radius: 18px; }
  .mm-slide--text { min-height: 0; padding: 24px; flex-direction: column; align-items: stretch; }
  .mm-slide--text::before { width: 220px; height: 220px; right: -70px; top: -70px; }
  .mm-slide__title { font-size: 32px; line-height: 1.05; }
  .mm-slide__sub { font-size: var(--mm-fs-md); }
  .mm-slide__media { flex: none; height: 170px; }
  .mm-carousel__dots.carousel-indicators { left: 24px; bottom: 12px; }
  .mm-carousel__nav { display: none; }

  .mm-advantages { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mm-advantage { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
  .mm-advantage__icon { width: 36px; height: 36px; border-radius: var(--mm-r-btn); }
  .mm-advantage__title { font-size: var(--mm-fs-md); }
  .mm-advantage__sub { font-size: var(--mm-fs-xs); }

  /* Category circles scroll sideways */
  .mm-cat-tiles {
    display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none;
    margin: 0 calc(-1 * var(--mm-gutter)); padding: 0 var(--mm-gutter);
  }
  .mm-cat-tiles::-webkit-scrollbar { display: none; }
  .mm-cat-tile {
    flex: 0 0 72px; padding: 0; gap: 6px; background: none; border: 0;
    font-size: var(--mm-fs-xs); font-weight: 600;
  }
  .mm-cat-tile__icon { width: 64px; height: 64px; background: #fff; border: 1px solid var(--mm-border); color: var(--mm-brand); }

  .mm-credit-banner { padding: 24px; gap: 16px; }
  .mm-credit-banner .mm-btn { width: 100%; }
  .mm-home-brands { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mm-home-brands__item { height: 56px; font-size: var(--mm-fs-base); }
  .mm-howto { padding: 24px; }
  .mm-howto__steps { grid-template-columns: 1fr; gap: 16px; }
}
