/* =========================================================
   BH Elementor Hover Card Effect
   Version 1.2.0

   Elementor setup:
   1) Add class to main/outer card container:
      bh-hover-card

   2) Add class to the white content container inside the card:
      bh-hover-card-content

   Effect:
   - Before hover: image is visible + small left-aligned content box with title only.
   - Hover: image zooms + content box expands and reveals text/button.
   - Mobile: full content shows by default because hover is not reliable on touch devices.
========================================================= */

.bh-hover-card {
  position: relative !important;
  overflow: hidden !important;
  min-height: 560px;
  border-radius: 28px;
  isolation: isolate;
  cursor: pointer;
  background: #111111;
}

/* Works when using Elementor Image widget inside the card */
.bh-hover-card > .elementor-widget-image,
.bh-hover-card .elementor-widget-image:first-child {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 0 !important;
  margin: 0 !important;
}

.bh-hover-card > .elementor-widget-image img,
.bh-hover-card .elementor-widget-image:first-child img,
.bh-hover-card > img,
.bh-hover-card img.bh-hover-card-image {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  z-index: 0 !important;
  transition: transform 0.75s ease, opacity 0.75s ease, filter 0.75s ease;
}

/* Works when using Elementor background image on the card container */
.bh-hover-card.elementor-element,
.bh-hover-card.e-con,
.bh-hover-card.e-container {
  background-size: cover !important;
  background-position: center !important;
  transition: background-size 0.75s ease;
}

/* Soft overlay for better readability */
.bh-hover-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.02) 0%,
    rgba(0, 0, 0, 0.05) 45%,
    rgba(0, 0, 0, 0.18) 100%
  );
  transition: background 0.45s ease;
}

/* White content reveal box */
.bh-hover-card .bh-hover-card-content {
  position: absolute !important;
  left: 32px !important;
  right: auto !important;
  bottom: 32px !important;
  z-index: 2 !important;

  width: calc(100% - 64px) !important;
  max-width: 620px !important;

  min-height: 115px;
  max-height: 115px;
  overflow: hidden !important;

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

  background: #ffffff;
  color: #111111;
  border-radius: 28px;
  padding: 34px 40px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.12);

  transition:
    min-height 0.55s ease,
    max-height 0.55s ease,
    transform 0.55s ease,
    box-shadow 0.55s ease;
}

/* Keep Elementor widgets inside the content box clean */
.bh-hover-card .bh-hover-card-content > .elementor-widget:not(:last-child),
.bh-hover-card .bh-hover-card-content > .e-con-inner > .elementor-widget:not(:last-child) {
  margin-bottom: 14px;
}

.bh-hover-card .bh-hover-card-content .elementor-widget-text-editor {
  margin-top: 22px;
  margin-bottom: 28px;
}

/* Title */
.bh-hover-card .bh-hover-card-content .elementor-heading-title,
.bh-hover-card .bh-hover-card-content h1,
.bh-hover-card .bh-hover-card-content h2,
.bh-hover-card .bh-hover-card-content h3,
.bh-hover-card .bh-hover-card-content h4,
.bh-hover-card .bh-hover-card-content h5,
.bh-hover-card .bh-hover-card-content h6 {
  color: #050505 !important;
  margin: 0 !important;
}

/* Hide text/button before hover */
.bh-hover-card .bh-hover-card-content .elementor-widget-text-editor,
.bh-hover-card .bh-hover-card-content p,
.bh-hover-card .bh-hover-card-content .elementor-widget-button,
.bh-hover-card .bh-hover-card-content .elementor-button-wrapper,
.bh-hover-card .bh-hover-card-content .elementor-icon-list-items {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.38s ease, transform 0.38s ease;
}

/* Hover: image zoom */
.bh-hover-card:hover > .elementor-widget-image img,
.bh-hover-card:focus-within > .elementor-widget-image img,
.bh-hover-card:hover .elementor-widget-image:first-child img,
.bh-hover-card:focus-within .elementor-widget-image:first-child img,
.bh-hover-card:hover > img,
.bh-hover-card:focus-within > img,
.bh-hover-card:hover img.bh-hover-card-image,
.bh-hover-card:focus-within img.bh-hover-card-image {
  transform: scale(1.08);
  opacity: 0.96;
  filter: saturate(1.05);
}

.bh-hover-card:hover,
.bh-hover-card:focus-within {
  background-size: 110% !important;
}

/* Hover: overlay */
.bh-hover-card:hover::before,
.bh-hover-card:focus-within::before {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.06) 0%,
    rgba(0, 0, 0, 0.14) 45%,
    rgba(0, 0, 0, 0.34) 100%
  );
}

/* Hover: content box expands */
.bh-hover-card:hover .bh-hover-card-content,
.bh-hover-card:focus-within .bh-hover-card-content {
  min-height: 300px;
  max-height: 420px;
  transform: translateY(0);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.16);
}

/* Hover: reveal text/button */
.bh-hover-card:hover .bh-hover-card-content .elementor-widget-text-editor,
.bh-hover-card:hover .bh-hover-card-content p,
.bh-hover-card:hover .bh-hover-card-content .elementor-widget-button,
.bh-hover-card:hover .bh-hover-card-content .elementor-button-wrapper,
.bh-hover-card:hover .bh-hover-card-content .elementor-icon-list-items,
.bh-hover-card:focus-within .bh-hover-card-content .elementor-widget-text-editor,
.bh-hover-card:focus-within .bh-hover-card-content p,
.bh-hover-card:focus-within .bh-hover-card-content .elementor-widget-button,
.bh-hover-card:focus-within .bh-hover-card-content .elementor-button-wrapper,
.bh-hover-card:focus-within .bh-hover-card-content .elementor-icon-list-items {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.12s;
}

/* CTA button: clean outline style */
.bh-hover-card .bh-hover-card-content .elementor-button {
  background: transparent !important;
  color: #111111 !important;
  border: 1px solid #111111 !important;
  border-radius: 999px !important;
  padding: 12px 22px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  text-decoration: none !important;
  box-shadow: none !important;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.bh-hover-card .bh-hover-card-content .elementor-button:hover,
.bh-hover-card .bh-hover-card-content .elementor-button:focus {
  background: #111111 !important;
  color: #ffffff !important;
  border-color: #111111 !important;
}

.bh-hover-card .bh-hover-card-content .elementor-button .elementor-button-text,
.bh-hover-card .bh-hover-card-content .elementor-button .elementor-button-icon {
  color: inherit !important;
}

/* Tablet */
@media screen and (max-width: 1024px) {
  .bh-hover-card {
    min-height: 500px;
  }

  .bh-hover-card .bh-hover-card-content {
    left: 24px !important;
    bottom: 24px !important;
    width: calc(100% - 48px) !important;
    max-width: 560px !important;
    padding: 28px 32px;
  }
}

/* Mobile: show full content because hover is not reliable on touch devices */
@media screen and (max-width: 767px) {
  .bh-hover-card {
    min-height: 520px;
    border-radius: 22px;
  }

  .bh-hover-card .bh-hover-card-content {
    left: 20px !important;
    right: 20px !important;
    bottom: 20px !important;
    width: auto !important;
    max-width: none !important;
    min-height: auto;
    max-height: none;
    padding: 26px 28px;
    border-radius: 22px;
  }

  .bh-hover-card .bh-hover-card-content .elementor-widget-text-editor,
  .bh-hover-card .bh-hover-card-content p,
  .bh-hover-card .bh-hover-card-content .elementor-widget-button,
  .bh-hover-card .bh-hover-card-content .elementor-button-wrapper,
  .bh-hover-card .bh-hover-card-content .elementor-icon-list-items {
    opacity: 1;
    transform: translateY(0);
  }

  .bh-hover-card .bh-hover-card-content .elementor-widget-text-editor {
    margin-top: 18px;
    margin-bottom: 22px;
  }

  .bh-hover-card .bh-hover-card-content .elementor-button {
    padding: 11px 20px !important;
    font-size: 14px !important;
  }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .bh-hover-card,
  .bh-hover-card img,
  .bh-hover-card::before,
  .bh-hover-card .bh-hover-card-content,
  .bh-hover-card .bh-hover-card-content * {
    transition: none !important;
  }
}
