.hanis-products-grid {
  --hanis-grid-columns: 4;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(var(--hanis-grid-columns), minmax(0, 1fr));
  align-items: stretch;
  column-gap: 20px;
  row-gap: 24px;
}

.hanis-product-card {
  position: relative;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e6e0f0;
  border-radius: 20px;
  box-shadow: 0 12px 34px rgba(43, 36, 68, .06);
  transition:
    transform .24s ease,
    border-color .24s ease,
    box-shadow .24s ease;
}

.hanis-product-card__image-wrap {
  position: relative;
  height: 280px;
  margin: 14px 14px 0;
  overflow: hidden;
  background: #faf8ff;
  border-radius: 16px;
}

.hanis-product-card__image-link {
  width: 100%;
  height: 100%;
  display: block;
}

.hanis-product-card__image {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  display: block !important;
  object-fit: contain;
  transition: transform .38s cubic-bezier(.2, .72, .2, 1);
}

.hanis-product-card__badge {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: 12px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #8b67d8;
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .01em;
}

.hanis-product-card__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
}

.hanis-product-card__title {
  --hanis-title-lines: 2;
  min-height: calc(1.42em * var(--hanis-title-lines));
  margin: 0 0 14px;
  display: -webkit-box;
  overflow: hidden;
  color: #171821;
  font-size: 15px;
  line-height: 1.42;
  font-weight: 700;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--hanis-title-lines);
}

.hanis-product-card__title a {
  color: inherit;
  text-decoration: none;
}

.hanis-product-card__rating {
  position: relative;
  width: max-content;
  margin: 0 0 12px;
  display: inline-block;
  overflow: hidden;
  font-size: 14px;
  line-height: 1;
  letter-spacing: .08em;
  white-space: nowrap;
}

.hanis-product-card__rating-base {
  display: block;
  color: #d9d9df;
}

.hanis-product-card__rating-fill {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  overflow: hidden;
  color: #f4b544;
  white-space: nowrap;
}

.hanis-product-card__price {
  margin: 0 0 16px;
  color: #171821;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
}

.hanis-product-card__price del {
  margin-right: 7px;
  color: #f04f58;
  opacity: 1;
  font-weight: 500;
}

.hanis-product-card__price ins {
  color: inherit;
  text-decoration: none;
  font-weight: 800;
}

.hanis-product-card__button-wrap {
  margin-top: auto;
}

.hanis-product-card__button,
.hanis-product-card__button.button {
  width: 100%;
  min-height: 48px;
  margin: 0 !important;
  padding: 8px 14px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: #202437;
  color: #fff;
  border: 1px solid #202437;
  border-radius: 12px;
  box-shadow: none;
  text-align: center;
  text-decoration: none !important;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  transition:
    background-color .22s ease,
    border-color .22s ease,
    color .22s ease,
    transform .22s ease;
}

.hanis-product-card__button:hover,
.hanis-product-card__button.button:hover {
  background: #8b67d8;
  color: #fff;
  border-color: #8b67d8;
  transform: translateY(-1px);
}

.hanis-product-card__button.added::after {
  margin-left: 8px;
}

.hanis-products-empty {
  padding: 22px;
  background: #fff8dd;
  color: #5e4e13;
  border: 1px solid #eadca0;
  border-radius: 10px;
  font-size: 14px;
}

@media (max-width: 1024px) {
  .hanis-products-grid {
    --hanis-grid-columns: 2;
  }

  .hanis-product-card__image-wrap {
    height: 260px;
  }
}

@media (max-width: 767px) {
  .hanis-products-grid {
    --hanis-grid-columns: 1;
  }

  .hanis-product-card__image-wrap {
    height: 300px;
  }
}


/* =========================================================
   V1.1 — responsive sizing and theme-style isolation
   ========================================================= */

.hanis-products-grid {
  --hanis-min-card-width: 250px;
  --hanis-grid-column-gap: 20px;
  --hanis-title-font-size: 15px;
  --hanis-title-line-height: 1.42;
  --hanis-title-font-weight: 700;
  box-sizing: border-box;
}

.hanis-products-grid *,
.hanis-products-grid *::before,
.hanis-products-grid *::after {
  box-sizing: border-box;
}

/*
 * Automatically changes 4 → 3 → 2 → 1 columns according to the actual
 * Elementor widget width, not only the browser viewport.
 */
.hanis-products-grid--auto {
  grid-template-columns:
    repeat(
      auto-fit,
      minmax(
        min(100%, var(--hanis-min-card-width, 250px)),
        1fr
      )
    ) !important;
}

/* Square image panels prevent narrow cards from cropping the artwork. */
.hanis-products-grid--square-images .hanis-product-card__image-wrap {
  width: auto !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
}

.hanis-products-grid--square-images .hanis-product-card__image,
.hanis-products-grid--square-images .hanis-product-card__image-link {
  width: 100% !important;
  height: 100% !important;
}

/* Stop Astra/Elementor global H3 and link rules from enlarging/underlining titles. */
.hanis-products-grid .hanis-product-card__title {
  min-height:
    calc(
      var(--hanis-title-line-height, 1.42em) *
      1em *
      var(--hanis-title-lines, 2)
    ) !important;
  margin-top: 0 !important;
  padding: 0 !important;
  color: #171821;
  font-size: var(--hanis-title-font-size, 15px) !important;
  line-height: var(--hanis-title-line-height, 1.42) !important;
  font-weight: var(--hanis-title-font-weight, 700) !important;
  letter-spacing: normal !important;
  text-decoration: none !important;
  text-transform: none !important;
}

.hanis-products-grid .hanis-product-card__title a,
.hanis-products-grid .hanis-product-card__title a:link,
.hanis-products-grid .hanis-product-card__title a:visited,
.hanis-products-grid .hanis-product-card__title a:hover,
.hanis-products-grid .hanis-product-card__title a:focus {
  color: inherit !important;
  font: inherit !important;
  line-height: inherit !important;
  letter-spacing: inherit !important;
  text-decoration: none !important;
  text-transform: none !important;
}

/* Keep price and button styling consistent even with aggressive theme CSS. */
.hanis-products-grid .hanis-product-card__price,
.hanis-products-grid .hanis-product-card__price * {
  line-height: 1.4 !important;
  text-decoration-thickness: 1px;
}

.hanis-products-grid .hanis-product-card__button,
.hanis-products-grid .hanis-product-card__button.button {
  box-sizing: border-box !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  white-space: normal !important;
}

/*
 * Fixed media queries are retained only as fallbacks. Auto mode uses the
 * available widget width and therefore responds correctly inside Elementor.
 */
@media (max-width: 1024px) {
  .hanis-products-grid--auto {
    --hanis-min-card-width: 230px;
  }
}

@media (max-width: 767px) {
  .hanis-products-grid--auto {
    --hanis-min-card-width: 220px;
  }
}


/* =========================================================
   V1.2 — proper mobile column control and compact card system
   ========================================================= */

@media (max-width: 767px) {
  /*
   * Explicit mobile modes do not depend on Minimum Card Width. This avoids
   * the 165px-versus-120px auto-fit threshold problem.
   */
  .hanis-products-grid--mobile-one,
  .hanis-products-grid--mobile-one.hanis-products-grid--auto {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .hanis-products-grid--mobile-two,
  .hanis-products-grid--mobile-two.hanis-products-grid--auto {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: var(--hanis-grid-column-gap, 10px) !important;
  }

  /*
   * Dedicated compact styling for genuinely usable two-column phone cards.
   * Desktop and tablet card design are not changed.
   */
  .hanis-products-grid--mobile-compact .hanis-product-card {
    min-width: 0 !important;
    border-radius: 14px !important;
  }

  .hanis-products-grid--mobile-compact
  .hanis-product-card__image-wrap {
    margin: 7px 7px 0 !important;
    border-radius: 10px !important;
  }

  .hanis-products-grid--mobile-compact
  .hanis-product-card__image {
    padding: 2px !important;
  }

  .hanis-products-grid--mobile-compact
  .hanis-product-card__badge {
    top: 7px !important;
    left: 7px !important;
    padding: 4px 7px !important;
    font-size: 9px !important;
    line-height: 1 !important;
  }

  .hanis-products-grid--mobile-compact
  .hanis-product-card__body {
    padding: 10px 8px 8px !important;
  }

  .hanis-products-grid--mobile-compact
  .hanis-product-card__title {
    min-height:
      calc(
        1.28em *
        var(--hanis-title-lines, 3)
      ) !important;
    margin-bottom: 9px !important;
    font-size: 12px !important;
    line-height: 1.28 !important;
    font-weight: 700 !important;
    letter-spacing: -.01em !important;
    overflow-wrap: anywhere;
  }

  .hanis-products-grid--mobile-compact
  .hanis-product-card__rating {
    margin-bottom: 8px !important;
    font-size: 11px !important;
    letter-spacing: .04em !important;
  }

  .hanis-products-grid--mobile-compact
  .hanis-product-card__price {
    min-height: 34px;
    margin-bottom: 10px !important;
    display: flex;
    align-items: flex-start;
    align-content: flex-start;
    flex-wrap: wrap;
    gap: 2px 5px;
    font-size: 11.5px !important;
    line-height: 1.25 !important;
  }

  .hanis-products-grid--mobile-compact
  .hanis-product-card__price del {
    margin-right: 0 !important;
  }

  .hanis-products-grid--mobile-compact
  .hanis-product-card__button,
  .hanis-products-grid--mobile-compact
  .hanis-product-card__button.button {
    min-height: 39px !important;
    padding: 7px 5px !important;
    border-radius: 9px !important;
    font-size: 10.5px !important;
    line-height: 1.1 !important;
  }
}

/*
 * Extremely narrow phones cannot support two readable commerce cards.
 * Fall back to one column below 330px while preserving two columns on
 * common 360–430px devices.
 */
@media (max-width: 329px) {
  .hanis-products-grid--mobile-two,
  .hanis-products-grid--mobile-two.hanis-products-grid--auto {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}


/* =========================================================
   V1.3 — adaptive 4 desktop / 2 tablet / 2 mobile layout
   ========================================================= */

/*
 * This mode keeps the visually generous automatic-card proportions while
 * making the column count deterministic at each device breakpoint.
 */
.hanis-products-grid--adaptive-422,
.hanis-products-grid--adaptive-422.hanis-products-grid--auto {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  column-gap: clamp(14px, 1.7vw, 22px) !important;
  row-gap: clamp(18px, 2vw, 26px) !important;
}

/* Fluid desktop card dimensions. */
.hanis-products-grid--adaptive-422 .hanis-product-card {
  border-radius: clamp(16px, 1.5vw, 22px);
}

.hanis-products-grid--adaptive-422
.hanis-products-grid--square-images
.hanis-product-card__image-wrap {
  margin:
    clamp(9px, 1vw, 14px)
    clamp(9px, 1vw, 14px)
    0 !important;
  border-radius: clamp(12px, 1.2vw, 17px);
}

.hanis-products-grid--adaptive-422 .hanis-product-card__body {
  padding:
    clamp(12px, 1.25vw, 18px)
    clamp(10px, 1vw, 14px)
    clamp(10px, 1vw, 14px) !important;
}

.hanis-products-grid--adaptive-422 .hanis-product-card__title {
  font-size: clamp(13px, 1.05vw, 15px) !important;
  line-height: 1.38 !important;
}

.hanis-products-grid--adaptive-422 .hanis-product-card__price {
  font-size: clamp(12px, .95vw, 14px) !important;
}

.hanis-products-grid--adaptive-422
.hanis-product-card__button,
.hanis-products-grid--adaptive-422
.hanis-product-card__button.button {
  min-height: clamp(42px, 3.4vw, 48px) !important;
  padding-inline: clamp(8px, 1vw, 14px) !important;
  font-size: clamp(10.5px, .85vw, 12px) !important;
}

/* Tablet: exactly two cards, with comfortable larger cards. */
@media (min-width: 768px) and (max-width: 1024px) {
  .hanis-products-grid--adaptive-422,
  .hanis-products-grid--adaptive-422.hanis-products-grid--auto {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: clamp(14px, 2.2vw, 22px) !important;
    row-gap: clamp(18px, 2.4vw, 26px) !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__title {
    font-size: clamp(14px, 1.8vw, 16px) !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__price {
    font-size: clamp(13px, 1.6vw, 15px) !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__button,
  .hanis-products-grid--adaptive-422
  .hanis-product-card__button.button {
    min-height: 46px !important;
    font-size: 12px !important;
  }
}

/* Mobile: exactly two compact cards, matching the approved mobile look. */
@media (max-width: 767px) {
  .hanis-products-grid--adaptive-422,
  .hanis-products-grid--adaptive-422.hanis-products-grid--auto {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: clamp(8px, 2.5vw, 12px) !important;
    row-gap: clamp(12px, 3vw, 16px) !important;
  }

  .hanis-products-grid--adaptive-422 .hanis-product-card {
    border-radius: clamp(12px, 3vw, 15px) !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__image-wrap {
    margin:
      clamp(6px, 1.8vw, 8px)
      clamp(6px, 1.8vw, 8px)
      0 !important;
    border-radius: clamp(9px, 2.3vw, 11px) !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__badge {
    top: clamp(6px, 1.7vw, 8px) !important;
    left: clamp(6px, 1.7vw, 8px) !important;
    padding:
      clamp(3px, .8vw, 4px)
      clamp(6px, 1.5vw, 8px) !important;
    font-size: clamp(8px, 2.2vw, 9.5px) !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__body {
    padding:
      clamp(8px, 2.5vw, 11px)
      clamp(7px, 2vw, 9px)
      clamp(7px, 2vw, 9px) !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__title {
    min-height:
      calc(
        1.28em *
        var(--hanis-title-lines, 3)
      ) !important;
    margin-bottom: clamp(7px, 2vw, 9px) !important;
    font-size: clamp(11.5px, 3.2vw, 13px) !important;
    line-height: 1.28 !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__rating {
    margin-bottom: clamp(6px, 1.8vw, 8px) !important;
    font-size: clamp(10px, 2.7vw, 12px) !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__price {
    min-height: clamp(31px, 8vw, 36px);
    margin-bottom: clamp(8px, 2.4vw, 11px) !important;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 2px 5px;
    font-size: clamp(10.5px, 2.9vw, 12px) !important;
    line-height: 1.25 !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__price del {
    margin-right: 0 !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__button,
  .hanis-products-grid--adaptive-422
  .hanis-product-card__button.button {
    min-height: clamp(37px, 10vw, 41px) !important;
    padding:
      6px
      clamp(4px, 1.5vw, 7px) !important;
    border-radius: clamp(8px, 2.3vw, 10px) !important;
    font-size: clamp(9.5px, 2.7vw, 11px) !important;
    line-height: 1.1 !important;
  }
}

/* Only extremely narrow devices fall back to one card. */
@media (max-width: 329px) {
  .hanis-products-grid--adaptive-422,
  .hanis-products-grid--adaptive-422.hanis-products-grid--auto {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}


/* =========================================================
   V1.3.3 — keep four cards until the tablet breakpoint
   ========================================================= */

/*
 * Desktop: exactly four fixed-width cards from 1025px upward.
 *
 * 4 × 245px cards + 3 × 8px gaps = 1004px total.
 * This fits at the smallest desktop breakpoint without continuously
 * squeezing the cards. The grid is centered against the viewport so it
 * consumes outer whitespace before changing layout.
 */
@media (min-width: 1025px) {
  .hanis-products-grid--adaptive-422,
  .hanis-products-grid--adaptive-422.hanis-products-grid--auto {
    position: relative !important;
    left: 50% !important;
    width: 1004px !important;
    max-width: 1004px !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    transform: translateX(-50%) !important;

    grid-template-columns: repeat(4, 245px) !important;
    justify-content: center !important;
    column-gap: 8px !important;
    row-gap: 24px !important;
  }

  .hanis-products-grid--adaptive-422 .hanis-product-card {
    width: 245px !important;
    min-width: 245px !important;
    max-width: 245px !important;
    border-radius: 20px !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__image-wrap {
    margin: 12px 12px 0 !important;
    border-radius: 15px !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__body {
    padding: 16px 12px 12px !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__title {
    font-size: 14px !important;
    line-height: 1.4 !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__price {
    font-size: 13px !important;
    line-height: 1.4 !important;
  }

  .hanis-products-grid--adaptive-422
  .hanis-product-card__button,
  .hanis-products-grid--adaptive-422
  .hanis-product-card__button.button {
    min-height: 46px !important;
    padding-right: 12px !important;
    padding-left: 12px !important;
    font-size: 11.5px !important;
  }
}

/*
 * Existing V1.3 tablet behavior begins exactly at 1024px:
 * two responsive cards per row.
 *
 * Existing mobile behavior remains unchanged.
 */
