/* Full-card click target — overlay receives clicks; content passes through */
.zillow-card,
.project-card,
.popular-listing-card--clickable,
.featured-project-card--clickable {
    position: relative;
}

.listing-card-hitarea {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.listing-card-hitarea::after {
    position: absolute;
    inset: 0;
    content: "";
}

.zillow-card-image-wrap,
.zillow-card-body,
.project-card__media-wrap,
.project-card__body,
.popular-listing-card--clickable .popular-listing-card__image,
.popular-listing-card--clickable .popular-listing-card__body,
.featured-project-card--clickable .featured-project-card__image,
.featured-project-card--clickable .featured-project-card__body {
    pointer-events: none;
}

/* Image areas sit above the full-card hitarea so gallery nav/dots remain interactive */
.zillow-card-image-wrap,
.popular-listing-card .popular-listing-card__image,
.featured-project-card__image {
    position: relative;
    z-index: 2;
}

.card-image-gallery__footer,
.card-image-gallery__map-pin,
.card-favorite-btn,
.zillow-card-menu,
.popular-listing-card__footer,
.featured-project-card__footer,
.featured-project-card__footer .featured-project-card__btn {
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

.card-image-gallery__nav {
    pointer-events: auto;
}

/* Listing card image gallery (slider + map pin) */
.card-image-gallery {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #e8e8e8;
    pointer-events: none;
    direction: ltr;
    z-index: 2;
}

.card-image-gallery__viewport {
    position: relative;
    width: 100%;
    height: 100%;
}

.card-image-gallery__slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.card-image-gallery__slide.is-active {
    opacity: 1;
    z-index: 1;
}

.card-image-gallery__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(42, 42, 51, 0.85);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    z-index: 4;
    max-width: calc(100% - 20px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-image-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(42, 42, 51, 0.78);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.88;
    transition: opacity 0.2s ease, background 0.2s ease;
    padding: 0;
    font-size: 13px;
    direction: ltr;
}

.card-image-gallery__nav svg {
    display: block;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    pointer-events: none;
}

.card-image-gallery__nav:hover {
    background: rgba(26, 26, 31, 0.92);
    opacity: 1;
}

/* Multi-image galleries: keep arrows visible (dots are always shown) */
.card-image-gallery[data-slides] .card-image-gallery__nav {
    opacity: 0.88;
}

/* Subtle fade on desktop until card/image hover */
@media (hover: hover) and (pointer: fine) {
    .card-image-gallery[data-slides] .card-image-gallery__nav {
        opacity: 0;
    }

    :is(
        .zillow-card,
        .project-card,
        .popular-listing-card,
        .popular-listing-card--clickable,
        .featured-project-card,
        .featured-project-card--clickable
    ):hover .card-image-gallery[data-slides] .card-image-gallery__nav,
    .popular-listing-card .popular-listing-card__image:hover .card-image-gallery[data-slides] .card-image-gallery__nav,
    .card-image-gallery[data-slides]:focus-within .card-image-gallery__nav {
        opacity: 0.88;
    }

    :is(
        .zillow-card,
        .project-card,
        .popular-listing-card,
        .popular-listing-card--clickable,
        .featured-project-card,
        .featured-project-card--clickable
    ):hover .card-image-gallery[data-slides] .card-image-gallery__nav:hover,
    .popular-listing-card .popular-listing-card__image:hover .card-image-gallery[data-slides] .card-image-gallery__nav:hover,
    .card-image-gallery[data-slides]:focus-within .card-image-gallery__nav:hover {
        opacity: 1;
    }
}

.card-image-gallery__nav--prev {
    left: 10px;
    right: auto;
}

.card-image-gallery__nav--next {
    right: 10px;
    left: auto;
}

.card-image-gallery__dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    z-index: 6;
    pointer-events: none;
}

.card-image-gallery__dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: background 0.2s ease;
}

.card-image-gallery__dots span.is-active {
    background: #fff;
}

.card-image-gallery__footer {
    position: absolute;
    bottom: 10px;
    right: 10px;
    left: auto;
    z-index: 4;
    pointer-events: none;
}

.card-image-gallery__map-pin {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3d3d46;
    color: #fff;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s ease;
    font-size: 18px;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.card-image-gallery__map-pin:hover {
    background: #2a2a33;
    color: #fff;
}

/* Zillow / listing cards */
.zillow-card-image {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #e8e8e8;
}

.zillow-card-image-wrap {
    position: relative;
}

.zillow-card-image .card-image-gallery__slide.is-active {
    transition: opacity 0.25s ease;
}

.zillow-card-image .card-image-gallery,
.project-card__media .card-image-gallery,
.popular-listing-card__image .card-image-gallery,
.featured-project-card__image .card-image-gallery {
    position: absolute;
    inset: 0;
    min-height: 100%;
}

[dir="rtl"] .card-image-gallery__badge {
    left: auto;
    right: 10px;
}

[dir="rtl"] .card-image-gallery__footer {
    right: auto;
    left: 10px;
}

/* Project cards: overlay must not block gallery controls */
.project-card__overlay {
    pointer-events: none;
    z-index: 1;
}

/* Touch / coarse pointer: always show arrows when multiple images */
@media (hover: none), (pointer: coarse) {
    .card-image-gallery[data-slides] .card-image-gallery__nav {
        opacity: 0.88;
    }
}

/* Home — Popular in Erbil: match properties page (arrows/dots always visible) */
.popular-listings-section .card-image-gallery[data-slides] .card-image-gallery__nav {
    opacity: 0.88;
}

.popular-listings-section .card-image-gallery[data-slides] .card-image-gallery__dots {
    opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
    .popular-listings-section .card-image-gallery[data-slides] .card-image-gallery__nav {
        opacity: 0.88;
    }

    .popular-listings-section .popular-listing-card:hover .card-image-gallery[data-slides] .card-image-gallery__nav,
    .popular-listings-section .popular-listing-card__image:hover .card-image-gallery[data-slides] .card-image-gallery__nav,
    .popular-listings-section .card-image-gallery[data-slides]:focus-within .card-image-gallery__nav {
        opacity: 1;
    }
}
