/**
 * Text List Hover Image — front-end styles
 * Desktop: floating hover image follows cursor.
 * Mobile: inline thumbnails, no hover effect.
 */

/* ==========================================================================
   Block wrapper
   ========================================================================== */

.wp-block-nextora-text-list-hover-image {
  position: relative;
  width: 100%;
  max-width: var(--wp--style--global--content-size, 40rem);
  margin-inline: auto;
}

/* ==========================================================================
   Items container
   ========================================================================== */

.nextora-text-list-hover-image__items {
  display: flex;
  flex-direction: column;
  counter-reset: thli-item;
}

/* ==========================================================================
   Item
   ========================================================================== */

.nextora-text-list-hover-image__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 0;
  text-decoration: none;
  cursor: default;
  transition: opacity 0.3s ease;
  counter-increment: thli-item;
}

.nextora-text-list-hover-image__item[href] {
  cursor: pointer;
  text-decoration: none;
}

/* ==========================================================================
   Border separator (hidden on first item)
   ========================================================================== */

.nextora-text-list-hover-image__item-border {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--wp--preset--color--contrast, #0a0a0a);
  opacity: 0.08;
}

.nextora-text-list-hover-image__item:first-child .nextora-text-list-hover-image__item-border {
  display: none;
}

/* ==========================================================================
   Number (01, 02, 03…)
   ========================================================================== */

.nextora-text-list-hover-image__item-number::before {
  content: counter(thli-item, decimal-leading-zero);
  display: block;
  flex-shrink: 0;
  width: auto;
  text-align: right;
  font-size: var(--wp--preset--font-size--medium, 0.875rem);
  font-weight: 700;
  color: var(--nextora-thli-number-color, var(--wp--preset--color--primary));
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Item thumbnail (hidden on desktop)
   ========================================================================== */

.nextora-text-list-hover-image__item-thumb {
  display: none;
  flex-shrink: 0;
  width: 80px;
  height: 56px;
  border-radius: 0.375rem;
  overflow: hidden;
}

.nextora-text-list-hover-image__item-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==========================================================================
   Item content
   ========================================================================== */

.nextora-text-list-hover-image__item-content {
  flex: 1;
  min-width: 0;
}

.nextora-text-list-hover-image__item-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================================================
   Title
   ========================================================================== */

.nextora-text-list-hover-image__item-title {
  margin: 0;
  font-size: var(--nextora-thli-title-size, inherit);
  color: var(--nextora-thli-title-color, var(--wp--preset--color--contrast));
  letter-spacing: -0.01em;
  text-decoration: none;
}

.nextora-text-list-hover-image__item:hover .nextora-text-list-hover-image__item-title,
.nextora-text-list-hover-image__item.nextora-thli--hover .nextora-text-list-hover-image__item-title {
  text-decoration: none;
}

/* ==========================================================================
   Arrow action (always visible, bordered circle)
   ========================================================================== */

.nextora-text-list-hover-image__item-action {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid;
  border-color: var(--nextora-thli-title-color, var(--wp--preset--color--contrast));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
}

.nextora-text-list-hover-image__item-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nextora-thli-title-color, var(--wp--preset--color--contrast));

  transition: opacity 0.3s ease;
}

.nextora-text-list-hover-image__item:hover .nextora-text-list-hover-image__item-action,
.nextora-text-list-hover-image__item.nextora-thli--hover .nextora-text-list-hover-image__item-action {
  opacity: 1;
}

/* ==========================================================================
   Description
   ========================================================================== */

.nextora-text-list-hover-image__item-description {
  margin: 0.25rem 0 0;
  font-size: var(--nextora-thli-description-size, inherit);
  color: var(--nextora-thli-description-color, var(--wp--preset--color--paragraph));
  line-height: 1.6;
  transition: color 0.3s ease;
}

/* ==========================================================================
   Hover highlight (desktop)
   ========================================================================== */

.nextora-text-list-hover-image__item::before {
  content: '';
  position: absolute;
  inset: 0 -1rem;
  background-color: var(--nextora-thli-hover-bg, transparent);
  border-radius: 0.5rem;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  z-index: -1;
}

.nextora-text-list-hover-image__item:hover::before,
.nextora-text-list-hover-image__item.nextora-thli--hover::before {
  opacity: 1;
  transform: scale(1);
}

/* ==========================================================================
   Floating hover image (desktop)
   ========================================================================== */

.nextora-text-list-hover-image__hover-image {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  transform: scale(0.8);
  will-change: transform, opacity;
}

.nextora-text-list-hover-image__hover-image.nextora-thli--visible {
  opacity: 1;
  transform: scale(1);
}

.nextora-text-list-hover-image__hover-image-inner {
  position: relative;
  width: var(--nextora-thli-image-width, 280px);
  height: var(--nextora-thli-image-height, 180px);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.25);
  background-color: var(--wp--preset--color--surface, #f4f4f4);
}

.nextora-text-list-hover-image__hover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: blur(10px);
  transform: scale(1.1);
  transition: opacity 0.5s ease-out, filter 0.5s ease-out, transform 0.5s ease-out;
}

.nextora-text-list-hover-image__hover-img.nextora-thli--active {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

.nextora-text-list-hover-image__hover-image-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.2), transparent);
  pointer-events: none;
}

/* ==========================================================================
   Scroll animation
   ========================================================================== */

.wp-block-nextora-text-list-hover-image.has-scroll-animation .nextora-text-list-hover-image__item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.wp-block-nextora-text-list-hover-image.has-scroll-animation.is-visible .nextora-text-list-hover-image__item {
  opacity: 1;
  transform: translateY(0);
}

.wp-block-nextora-text-list-hover-image.has-scroll-animation.is-visible .nextora-text-list-hover-image__item:nth-child(1) { transition-delay: 0.1s; }
.wp-block-nextora-text-list-hover-image.has-scroll-animation.is-visible .nextora-text-list-hover-image__item:nth-child(2) { transition-delay: 0.2s; }
.wp-block-nextora-text-list-hover-image.has-scroll-animation.is-visible .nextora-text-list-hover-image__item:nth-child(3) { transition-delay: 0.3s; }
.wp-block-nextora-text-list-hover-image.has-scroll-animation.is-visible .nextora-text-list-hover-image__item:nth-child(4) { transition-delay: 0.4s; }
.wp-block-nextora-text-list-hover-image.has-scroll-animation.is-visible .nextora-text-list-hover-image__item:nth-child(5) { transition-delay: 0.5s; }
.wp-block-nextora-text-list-hover-image.has-scroll-animation.is-visible .nextora-text-list-hover-image__item:nth-child(n+6) { transition-delay: 0.6s; }

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .wp-block-nextora-text-list-hover-image.has-scroll-animation .nextora-text-list-hover-image__item {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .nextora-text-list-hover-image__hover-image {
    display: none !important;
  }
}

/* ==========================================================================
   RESPONSIVE — Touch devices & narrow screens
   Show inline thumbnails, hide floating hover image, always-show arrow.
   ========================================================================== */

@media (hover: none), (max-width: 767px) {

  .nextora-text-list-hover-image__hover-image {
    display: none !important;
  }

  .nextora-text-list-hover-image__item-thumb {
    display: block;
  }

  .nextora-text-list-hover-image__item {
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
  }

  .nextora-text-list-hover-image__item::before {
    display: none;
  }

  .nextora-text-list-hover-image__item-action {
    opacity: 0.6;
  }

  .nextora-text-list-hover-image__item:active .nextora-text-list-hover-image__item-action,
  .nextora-text-list-hover-image__item:focus-visible .nextora-text-list-hover-image__item-action {
    opacity: 1;
  }

  .nextora-text-list-hover-image__item-number::before {
    width: 1.75rem;
    font-size: var(--wp--preset--font-size--small, 0.75rem);
  }
}

/* Extra-small phones */
@media (max-width: 480px) {
  .nextora-text-list-hover-image__item {
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 1rem 0;
  }

  .nextora-text-list-hover-image__item-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    border-radius: 0.5rem;
    order: -1;
    margin-bottom: 0.25rem;
  }

  .nextora-text-list-hover-image__item-thumb-img {
    width: 100%;
    height: 100%;
  }

  .nextora-text-list-hover-image__item-number {
    display: none;
  }

  .nextora-text-list-hover-image__item-action {
    width: 2rem;
    height: 2rem;
  }
}
