/* =============================================
   Hover Cards Widget — style.css  v7.0.0
   ============================================= */

/* ── Wrapper ── */
.hcw-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  font-family: 'Georgia', serif;
}

.elementor-widget-hover_cards_widget,
.elementor-widget-hover_cards_widget .elementor-widget-container {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* ── Cards Row ── */
.hcw-cards-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: 1100px;
  position: relative;
  height: 520px;
}

.hcw-wrapper.hcw-layout-boxed {
  width: 100%;
}

.hcw-wrapper.hcw-layout-fullwidth {
  width: 100vw;
  max-width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.hcw-wrapper.hcw-layout-fullwidth .hcw-cards-row {
  max-width: none;
  width: 100%;
}

/* ── Individual Card ── */
.hcw-card {
  position: relative;
  flex: 1;
  height: 460px;
  overflow: hidden;
  cursor: pointer;
  transition: flex 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  /* No border-radius */
  border-radius: 0;
  z-index: 1;
  /* Fix black border artefacts: use transparent background, not #000 */
  background: transparent;
  isolation: isolate;
  /* CSS custom props */
  --hcw-img-opacity: 100;
  --hcw-img-opacity-active: 100;
  --hcw-img-fit: cover;
  --hcw-img-position: center center;
  --hcw-img-repeat: no-repeat;
  --hcw-overlay-color: #000000;
  --hcw-overlay-opacity: 45;
  --hcw-overlay-color-active: #000000;
  --hcw-overlay-opacity-active: 20;
  /* Strip any browser outline that could appear as a border */
  outline: none;
}

/* ── Active card (JS-driven class) ── */
.hcw-card.hcw-active {
  flex: 1.6;
  height: 520px;
  z-index: 10;
}

/* CSS hover — keeps behaviour even without JS */
.hcw-card:hover {
  flex: 1.6 !important;
  height: 520px !important;
  z-index: 10 !important;
}

/* Push non-active back when row IS being hovered */
.hcw-cards-row.hcw-hovering .hcw-card:not(.hcw-active) {
  flex: 1;
  height: 460px;
  z-index: 1;
}

/* ── Background image ── */
.hcw-card-bg {
  /* Fill card exactly — no extra pixels that create dark seams */
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  min-width: 100%;
  min-height: 100%;
  max-width: none;
  background-image: none;
  /* Use the CSS custom properties set on the parent .hcw-card */
  background-size: var(--hcw-img-fit, cover) !important;
  background-position: var(--hcw-img-position, center center) !important;
  background-repeat: var(--hcw-img-repeat, no-repeat) !important;
  display: block;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform, opacity;
  /* Remove any default border / outline */
  border: none;
  outline: none;
  /* Opacity via CSS var */
  opacity: calc(var(--hcw-img-opacity) / 100);
}

.hcw-card.hcw-active .hcw-card-bg,
.hcw-card:hover .hcw-card-bg {
  opacity: calc(var(--hcw-img-opacity-active) / 100);
}

.hcw-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: var(--hcw-overlay-color);
  opacity: calc(var(--hcw-overlay-opacity) / 100);
  transition: opacity 0.4s ease, background-color 0.4s ease;
}

.hcw-card.hcw-active::before,
.hcw-card:hover::before {
  background: var(--hcw-overlay-color-active);
  opacity: calc(var(--hcw-overlay-opacity-active) / 100);
}

/* ── Content ── */
.hcw-card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px 28px;
  color: #ffffff;
  z-index: 4;
  /* Pointer events on content but links inside handle clicks */
  pointer-events: none;
}

/* ── Title ── */
.hcw-card-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 0;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: margin-bottom 0.4s ease, opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  /* When used as <a> */
  display: block;
  text-decoration: none;
  pointer-events: auto;
}

.hcw-card-title:hover,
.hcw-card-title:focus {
  text-decoration: underline;
  outline: none;
}

.hcw-card.hcw-active .hcw-card-title,
.hcw-card:hover .hcw-card-title {
  margin-bottom: 4px;
}

/* ── Description ── */
.hcw-card-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.9);
  font-family: Arial, sans-serif;
  transition: opacity 0.4s ease 0.1s,
              max-height 0.4s ease,
              margin-top 0.3s ease,
              visibility 0.3s ease,
              transform 0.3s ease;
  margin-top: 0;
  /* When used as <a> */
  display: block;
  text-decoration: none;
  pointer-events: none;
}

.hcw-card-desc:hover,
.hcw-card-desc:focus {
  text-decoration: underline;
  outline: none;
}

.hcw-card.hcw-active .hcw-card-desc,
.hcw-card:hover .hcw-card-desc {
  opacity: 1;
  max-height: 120px;
  margin-top: 12px;
  pointer-events: auto;
}

.hcw-wrapper.hcw-hide-title-rest .hcw-card .hcw-card-title {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
}

.hcw-wrapper.hcw-hide-title-rest.hcw-show-title-hover .hcw-card:hover .hcw-card-title,
.hcw-wrapper.hcw-hide-title-rest.hcw-show-title-hover .hcw-card.hcw-active .hcw-card-title {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.hcw-wrapper.hcw-show-desc-rest .hcw-card .hcw-card-desc {
  opacity: 1;
  max-height: 120px;
  margin-top: 12px;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.hcw-wrapper.hcw-hide-desc-hover .hcw-card:hover .hcw-card-desc,
.hcw-wrapper.hcw-hide-desc-hover .hcw-card.hcw-active .hcw-card-desc {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
}

/* ── Pagination Dots ── */
.hcw-dots {
  display: flex;
  gap: 10px;
  margin-top: 28px;
}

.hcw-dot {
  appearance: none;
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #555;
  background: transparent;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease;
  display: inline-block;
}

.hcw-dot.hcw-dot-active {
  background: #555;
  border-color: #555;
}

.hcw-dot:hover,
.hcw-dot:focus {
  background: #555;
  border-color: #555;
}

.hcw-dot:focus-visible {
  outline: 2px solid #222;
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────
   RESPONSIVE — Tablet (769px – 1024px)
   Side-by-side flex, auto height
   ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hcw-cards-row {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 100%;
    height: auto !important;
    gap: 16px;
    padding: 0;
    align-items: unset;
    justify-content: unset;
  }

  .hcw-card,
  .hcw-card.hcw-active,
  .hcw-card:hover,
  .hcw-cards-row.hcw-hovering .hcw-card:not(.hcw-active) {
    flex: unset !important;
    width: 100% !important;
    min-height: 260px;
    height: 52vw !important;
    max-height: 460px;
    border-radius: 0 !important;
  }

  .hcw-card-title {
    font-size: 1.6rem;
  }

  .hcw-card-content {
    padding: 30px 24px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .hcw-card.hcw-active .hcw-card-desc,
  .hcw-card:hover .hcw-card-desc {
    max-height: none;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
  }
}

/* ─────────────────────────────────────────────
   RESPONSIVE — Mobile (≤ 767px)
   Single-column grid, decent gaps, no borders
   ───────────────────────────────────────────── */
@media (max-width: 767px) {
  .hcw-wrapper.hcw-layout-fullwidth {
    left: 0;
    right: 0;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
  }

  .hcw-cards-row {
    /* Switch to single-column grid */
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;           /* decent gap between stacked cards */
    height: auto !important;
    padding: 0;
    width: 100%;
    align-items: unset;
    justify-content: unset;
  }

  /* Reset all flex/height overrides — let grid take over */
  .hcw-card,
  .hcw-card.hcw-active,
  .hcw-card:hover,
  .hcw-cards-row.hcw-hovering .hcw-card:not(.hcw-active) {
    flex: unset !important;
    width: 100% !important;
    height: 62vw !important;
    min-height: 240px;
    max-height: 380px;
    border-radius: 0 !important;
    border: none !important;
    outline: none !important;
  }

  .hcw-card-content {
    padding: 20px 16px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .hcw-card-title {
    font-size: 1.25rem;
    margin-bottom: 4px;
  }

  .hcw-card-desc {
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .hcw-dots {
    margin-top: 20px;
  }
}
