/* =========================================================
   CAFÉZIA — MODERN BENEFIT ICON CARDS
   v1.4.1: dynamický počet kariet
   Desktop max 5 / tablet max 3 / mobil max 2.
   Posledný neúplný riadok sa centruje cez flex-wrap.
========================================================= */

.caf-shop-benefits {
  --caf-black: #171512;
  --caf-muted: #6f675c;
  --caf-green: #BBCE8E;
  --caf-bg: #E2DBCE;
  --caf-roast: #B7A997;
  --caf-white: #ffffff;

  width: 100%;
  padding: 12px 0;
  font-family: inherit;
}

.caf-shop-benefits,
.caf-shop-benefits * {
  box-sizing: border-box;
}

/*
 * Flexbox namiesto fixného 4-stĺpcového gridu.
 * Basis sa vypočíta server-side podľa reálneho počtu repeater položiek.
 * justify-content:center zároveň centruje posledný neúplný riadok.
 */
.caf-shop-benefits__grid {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 18px;

  width: 100%;
  max-width: min(100%, var(--caf-benefit-grid-max-desktop, 1294px));
  margin-inline: auto;
}

.caf-shop-benefits__card {
  position: relative;
  isolation: isolate;
  overflow: hidden;

  flex: 0 0 var(--caf-benefit-basis-desktop, calc(25% - 13.5px));
  width: var(--caf-benefit-basis-desktop, calc(25% - 13.5px));
  max-width: var(--caf-benefit-basis-desktop, calc(25% - 13.5px));
  min-width: 0;
  min-height: 210px;
  padding: 25px 24px 23px;

  display: flex;
  flex-direction: column;
  align-items: flex-start;

  border-radius: 26px;
  color: var(--caf-black);
  text-decoration: none !important;

  background:
    radial-gradient(circle at 18% 10%, rgba(187, 206, 142, 0.22), transparent 36%),
    radial-gradient(circle at 100% 100%, rgba(226, 219, 206, 0.62), transparent 45%),
    linear-gradient(145deg, #ffffff 0%, #fbfaf7 58%, rgba(226, 219, 206, 0.42) 100%);

  border: 1px solid rgba(183, 169, 151, 0.22);

  box-shadow:
    0 16px 42px rgba(23, 21, 18, 0.055),
    inset 0 1px 0 rgba(255,255,255,0.92);

  opacity: 0;
  transform: translateY(18px);

  transition:
    opacity 0.5s ease,
    transform 0.4s cubic-bezier(.22,.75,.2,1),
    border-color 0.32s ease,
    box-shadow 0.32s ease,
    background 0.32s ease;
}

.caf-shop-benefits__card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;

  background-image:
    linear-gradient(rgba(23,21,18,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23,21,18,0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.38;

  mask-image: linear-gradient(140deg, rgba(0,0,0,0.8), transparent 75%);
  -webkit-mask-image: linear-gradient(140deg, rgba(0,0,0,0.8), transparent 75%);
}

.caf-shop-benefits__card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;

  background:
    linear-gradient(115deg, transparent 0%, transparent 36%, rgba(255,255,255,0.72) 48%, transparent 60%, transparent 100%);

  transform: translateX(-130%);
  transition: transform 0.8s ease;
}

.caf-shop-benefits.is-visible .caf-shop-benefits__card {
  opacity: 1;
  transform: translateY(0);
}

.caf-shop-benefits.is-visible .caf-shop-benefits__card:nth-child(1) { transition-delay: 0.04s; }
.caf-shop-benefits.is-visible .caf-shop-benefits__card:nth-child(2) { transition-delay: 0.10s; }
.caf-shop-benefits.is-visible .caf-shop-benefits__card:nth-child(3) { transition-delay: 0.16s; }
.caf-shop-benefits.is-visible .caf-shop-benefits__card:nth-child(4) { transition-delay: 0.22s; }
.caf-shop-benefits.is-visible .caf-shop-benefits__card:nth-child(5) { transition-delay: 0.28s; }
.caf-shop-benefits.is-visible .caf-shop-benefits__card:nth-child(n+6) { transition-delay: 0.34s; }

.caf-shop-benefits__icon {
  position: relative;

  width: 58px;
  height: 58px;
  min-width: 58px;
  min-height: 58px;
  margin-bottom: 25px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 19px;
  color: var(--caf-black);

  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.96), transparent 54%),
    linear-gradient(145deg, rgba(187,206,142,0.32), rgba(226,219,206,0.58));

  border: 1px solid rgba(187, 206, 142, 0.44);

  box-shadow:
    0 11px 26px rgba(187, 206, 142, 0.16),
    inset 0 1px 0 rgba(255,255,255,0.9);

  transition:
    transform 0.35s cubic-bezier(.22,.75,.2,1),
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.caf-shop-benefits__icon::before {
  content: "";
  position: absolute;
  inset: -5px;

  border-radius: 23px;
  border: 1px solid rgba(187, 206, 142, 0.18);

  transition:
    transform 0.35s ease,
    opacity 0.35s ease;
}

.caf-shop-benefits__icon i,
.caf-shop-benefits__icon svg {
  width: 27px;
  height: 27px;
  stroke-width: 1.75;
  pointer-events: none;
}

.caf-shop-benefits__icon-image {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.caf-shop-benefits__content {
  position: relative;
  z-index: 2;
  width: 100%;
  min-width: 0;
}

.caf-shop-benefits__content h3 {
  margin: 0 0 8px;
  width: 100%;
  color: var(--caf-black);
  font-size: clamp(19px, 1.35vw, 23px);
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: -0.04em;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.caf-shop-benefits__content p {
  margin: 0;
  width: 100%;
  max-width: 270px;
  color: var(--caf-muted);
  font-size: 13.5px;
  line-height: 1.55;
  font-weight: 400;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.caf-shop-benefits__accent {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 12px;

  height: 2px;
  border-radius: 999px;

  background:
    linear-gradient(90deg, var(--caf-green), rgba(183,169,151,0.42), transparent);

  transform-origin: left center;
  transform: scaleX(0.32);
  opacity: 0.48;

  transition:
    transform 0.45s cubic-bezier(.22,.75,.2,1),
    opacity 0.35s ease;
}

.caf-shop-benefits__card:hover,
.caf-shop-benefits__card.is-active {
  transform: translateY(-7px);
  border-color: rgba(187, 206, 142, 0.62);

  box-shadow:
    0 25px 58px rgba(23,21,18,0.09),
    0 0 0 4px rgba(187,206,142,0.085),
    inset 0 1px 0 rgba(255,255,255,0.94);
}

.caf-shop-benefits__card:hover::after,
.caf-shop-benefits__card.is-active::after {
  transform: translateX(130%);
}

.caf-shop-benefits__card:hover .caf-shop-benefits__icon,
.caf-shop-benefits__card.is-active .caf-shop-benefits__icon {
  transform: translateY(-3px) scale(1.06);

  background:
    linear-gradient(145deg, rgba(187,206,142,0.52), rgba(226,219,206,0.56));

  box-shadow:
    0 16px 32px rgba(187,206,142,0.25),
    inset 0 1px 0 rgba(255,255,255,0.95);
}

.caf-shop-benefits__card:hover .caf-shop-benefits__icon::before,
.caf-shop-benefits__card.is-active .caf-shop-benefits__icon::before {
  transform: scale(1.06);
  opacity: 0.9;
}

.caf-shop-benefits__card:hover .caf-shop-benefits__accent,
.caf-shop-benefits__card.is-active .caf-shop-benefits__accent {
  transform: scaleX(1);
  opacity: 0.95;
}

/* =========================================================
   TABLET — max. 3 v riadku
========================================================= */
@media (max-width: 1024px) {
  .caf-shop-benefits__grid {
    gap: 16px;
    max-width: min(100%, var(--caf-benefit-grid-max-tablet, 826px));
  }

  .caf-shop-benefits__card {
    flex-basis: var(--caf-benefit-basis-tablet, calc(33.333333% - 10.666667px));
    width: var(--caf-benefit-basis-tablet, calc(33.333333% - 10.666667px));
    max-width: var(--caf-benefit-basis-tablet, calc(33.333333% - 10.666667px));
    min-width: 0;
    min-height: 195px;
  }
}

/* =========================================================
   MOBILE — max. 2 v riadku
========================================================= */
@media (max-width: 767px) {
  .caf-shop-benefits {
    padding: 6px 0;
  }

  .caf-shop-benefits__grid {
    gap: 10px;
    max-width: min(100%, var(--caf-benefit-grid-max-mobile, 470px));
  }

  .caf-shop-benefits__card {
    flex-basis: var(--caf-benefit-basis-mobile, calc(50% - 5px));
    width: var(--caf-benefit-basis-mobile, calc(50% - 5px));
    max-width: var(--caf-benefit-basis-mobile, calc(50% - 5px));
    min-width: 0;
    min-height: 190px;
    padding: 16px 14px 18px;

    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;

    border-radius: 20px;
  }

  .caf-shop-benefits__icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    margin: 0 0 14px;
    border-radius: 15px;
  }

  .caf-shop-benefits__icon::before {
    border-radius: 19px;
  }

  .caf-shop-benefits__icon i,
  .caf-shop-benefits__icon svg {
    width: 23px;
    height: 23px;
  }

  .caf-shop-benefits__icon-image {
    width: 30px;
    height: 30px;
  }

  .caf-shop-benefits__content {
    width: 100%;
    min-width: 0;
  }

  .caf-shop-benefits__content h3 {
    margin-bottom: 6px;
    font-size: 16px;
    line-height: 1.15;
    font-weight: 500;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
  }

  .caf-shop-benefits__content p {
    width: 100%;
    max-width: none;
    font-size: 12px;
    line-height: 1.45;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
  }

  .caf-shop-benefits__accent {
    left: 14px;
    right: 14px;
    bottom: 8px;
  }

  .caf-shop-benefits__card:hover,
  .caf-shop-benefits__card.is-active {
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .caf-shop-benefits *,
  .caf-shop-benefits__card::after {
    animation: none !important;
    transition: none !important;
  }

  .caf-shop-benefits__card {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* =========================================================
   ELEMENTOR EDITOR — VŽDY VIDITEĽNÝ NÁHĽAD
========================================================= */
body.elementor-editor-active .caf-shop-benefits__card,
body.elementor-editor-preview .caf-shop-benefits__card,
body.elementor-edit-area-active .caf-shop-benefits__card,
.elementor-editor-active .caf-shop-benefits__card,
.elementor-editor-preview .caf-shop-benefits__card,
.elementor-edit-area-active .caf-shop-benefits__card,
.elementor-element-edit-mode .caf-shop-benefits__card {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

body.elementor-editor-active .caf-shop-benefits,
body.elementor-editor-preview .caf-shop-benefits,
body.elementor-edit-area-active .caf-shop-benefits,
.elementor-editor-active .caf-shop-benefits,
.elementor-editor-preview .caf-shop-benefits,
.elementor-edit-area-active .caf-shop-benefits,
.elementor-element-edit-mode .caf-shop-benefits {
  visibility: visible !important;
  opacity: 1 !important;
}

body.elementor-editor-active .caf-shop-benefits__card,
body.elementor-editor-preview .caf-shop-benefits__card,
.elementor-editor-active .caf-shop-benefits__card,
.elementor-editor-preview .caf-shop-benefits__card {
  transition-delay: 0s !important;
}
