/**
 * Custom Category Hero Image Styles
 *
 * @package Custom_Category_Hero_Image
 * @version 1.0.0
 */

.tax-product_cat h1.woocommerce-products-header__title {
  display: none !important;
}

.tax-product_cat .woocommerce-products-header {
  margin-bottom: 16px;
}

.category-hero-image-container {
  position: relative;
  max-height: 350px;
  overflow: hidden;
}

/* Category name overlay */
.category-hero-name {
  position: absolute;
  top: 50%;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 2px;
  font-family: inherit;
  color: var(--category-hero-name-color, #40484f);
  z-index: 2;
  pointer-events: none;
  word-wrap: break-word;
  /* Desktop: center positioning */
  right: 10%;
  text-transform: uppercase;
  transform: translate(-50%, -50%);
  text-align: center;
  max-width: 80%;
}

.category-hero-image {
  width: 100%;
  height: 350px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

@media (min-width: 768px) {
  .category-hero-image {
    max-height: 212px;
  }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .category-hero-content .category-title {
    font-size: 2rem !important;
  }

  .category-hero-content .category-description {
    font-size: 1rem !important;
  }

  .category-hero-image-wrapper {
    min-height: 250px !important;
  }

  .category-hero-image {
    max-height: 100px !important;
  }

  .category-hero-image-container {
    max-height: 250px;
  }

  img.category-hero-image {
    border-radius: 0;
  }

  .category-hero-image {
    height: 250px;
  }

  .woocommerce-products-header .category-hero-image-container {
    margin-left: -20px;
    margin-right: -20px;
  }

  /* Mobile: position category name on the right */
  .category-hero-name {
    left: auto;
    right: 24px;
    transform: translateY(-50%);
    text-align: right;
    font-size: 16px;
    line-height: 140%;
    letter-spacing: 0.25px;
    max-width: 60%;
  }
}

/* Extra small mobile screens */
@media (max-width: 480px) {
  .category-hero-name {
    font-size: 18px;
    font-weight: 900;
    right: 24px;
    max-width: 50%;
  }
}

/* Loading animation */
.category-hero-image-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

/* Optional gradient overlay for better text readability if needed */
.category-hero-image-container.with-overlay::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.3));
  pointer-events: none;
}

/* Loading state for images */
.category-hero-image-container.loading {
  background: #f5f5f5;
  background-image: linear-gradient(
    90deg,
    #f5f5f5 25%,
    #e8e8e8 50%,
    #f5f5f5 75%
  );
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Focus states for accessibility */
.category-hero-image-container:focus-within {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}
