/* Shared compact housing cards for the landing rail and map panels. */
/* Compact card: the media size drives the card width, so the slider and each
   slide always stay equal (the slider pages by slider.offsetWidth). */
.listing.housing-gallery-card {
    --hg-media-w: 198px;
    --hg-media-h: 150px;
    box-sizing: content-box;
    min-width: 0;
    min-height: 0;
    height: auto;
    flex: 0 0 auto;
    position: relative;
    width: var(--hg-media-w);
    max-width: var(--hg-media-w);
    padding: 4px;
    display: flex;
    flex-direction: column;
    margin: 0;
    background-color: #ffffff;
    border: 1px solid var(--hl-border, #dfe4e6);
    border-radius: 12px;
    box-shadow: var(--hl-shadow, 0 1px 4px rgba(39, 51, 59, 0.08));
    overflow-wrap: break-word;
    white-space: normal;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.listing.housing-gallery-card:hover {
    cursor: pointer;
    border-color: var(--hl-border-hover, #b9cad4);
    box-shadow: var(--hl-shadow-hover, 0 2px 6px rgba(39, 51, 59, 0.1));
}

.housing-gallery-card .housing-gallery-card__watchlist-form {
    margin: 0;
}

.housing-gallery-card .watchlist-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1.5px solid rgb(213, 213, 213);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    background-color: #ffffff;
    color: inherit;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    padding: 5px 6px 4px;
}

.housing-gallery-card .watchlist-button:hover {
    background-color: #d2d2d2;
}

.housing-gallery-card .watchlist-button.is-in-watchlist {
    border-color: #d95c5c;
    background-color: #fff1f1;
    color: #b42318;
}

.housing-gallery-card .watchlist-button.is-in-watchlist:hover {
    background-color: #ffdede;
}

/* Same photo-overlay heart as the homepage gallery cards
   (css/root/styles.css), scoped to this page's cards. */
.listing.housing-gallery-card .button-container {
    top: 5px;
    right: 5px;
}

.listing.housing-gallery-card .watchlist-button--gallery {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    color: #ffffff;
    font-size: 22px;
    line-height: 1;
    transition: transform 150ms ease;
}

.listing.housing-gallery-card .watchlist-button--gallery:hover {
    transform: scale(1.08);
}

.listing.housing-gallery-card .watchlist-button--gallery:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Layer a solid heart under the idle outline and over the saved coral fill. */
.listing.housing-gallery-card .watchlist-button--gallery i {
    position: relative;
    display: inline-block;
    isolation: isolate;
}

.listing.housing-gallery-card .watchlist-button--gallery i::before {
    position: relative;
}

.listing.housing-gallery-card .watchlist-button--gallery i::after {
    content: "";
    position: absolute;
    inset: 0;
    font-family: "Font Awesome 6 Free";
    font-size: inherit;
    font-style: normal;
    line-height: inherit;
}

.listing.housing-gallery-card .watchlist-button--gallery.is-in-watchlist {
    color: #ff385c;
}

.listing.housing-gallery-card .watchlist-button--gallery:not(.is-in-watchlist) i::after {
    color: rgba(0, 0, 0, 0.45);
    font-weight: 900;
}

.listing.housing-gallery-card .watchlist-button--gallery.is-in-watchlist i::after {
    color: #ffffff;
    font-weight: 400;
}

.listing.housing-gallery-card .watchlist-button--gallery:not(.is-in-watchlist) i::before,
.listing.housing-gallery-card .watchlist-button--gallery.is-in-watchlist i::after {
    z-index: 1;
}

.listing.housing-gallery-card .watchlist-button--gallery:not(.is-in-watchlist) i::after,
.listing.housing-gallery-card .watchlist-button--gallery.is-in-watchlist i::before {
    z-index: 0;
}


.housing-gallery-card .media-slider {
    position: relative;
    width: var(--hg-media-w, 250px);
    height: var(--hg-media-h, 200px);
    flex: 0 0 auto;
    overflow: hidden;
    display: flex;
    border: 0;
    border-radius: 9px;
    box-shadow: none;
    /* Keeps the rounded clip in Safari while slides are transformed. */
    isolation: isolate;
}

.housing-gallery-card .media {
    display: flex;
}

.housing-gallery-card .slider-media {
    position: relative;
    width: var(--hg-media-w, 250px);
    min-width: var(--hg-media-w, 250px);
    max-width: var(--hg-media-w, 250px);
    height: var(--hg-media-h, 200px);
    flex: 0 0 var(--hg-media-w, 250px);
    object-fit: cover;
    border-radius: 0;
    display: block;
    margin: 0;
}

.housing-gallery-card .slider-media--contain {
    object-fit: contain;
    background: #ffffff;
}

.housing-gallery-card .external-media-frame {
    position: relative;
    overflow: hidden;
    background: #111;
}

.housing-gallery-card .external-media-frame__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.housing-gallery-card .external-media-attribution {
    position: absolute;
    right: 6px;
    bottom: 6px;
    z-index: 2;
    pointer-events: none;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.58);
    color: #ffffff;
    font-size: 10.5px;
    line-height: 1.1;
}

.housing-gallery-card .media-top-left-label {
    margin: 0;
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.94);
    color: #222222;
    border-radius: 999px;
    padding: 2px 7px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    max-width: calc(100% - 48px);
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.housing-gallery-card .media-pagination {
    --media-pagination-dot-size: 4px;
    --media-pagination-dot-gap: 4px;
    position: absolute;
    left: 50%;
    bottom: 5px;
    z-index: 3;
    display: flex;
    align-items: center;
    height: 11px;
    line-height: 0;
    padding: 0 1px;
    overflow: hidden;
    transform: translateX(-50%);
    pointer-events: none;
    opacity: 0.9;
}

.housing-gallery-card .media-pagination[hidden] {
    display: none;
}

.housing-gallery-card .media-slider.media-slider--swipe-ready {
    touch-action: pan-y;
}

.housing-gallery-card .media-pagination-track {
    display: flex;
    align-items: center;
    gap: var(--media-pagination-dot-gap);
    height: 100%;
    transition: transform 0.2s ease;
    will-change: transform;
}

.housing-gallery-card .media-pagination-dot {
    width: var(--media-pagination-dot-size);
    height: var(--media-pagination-dot-size);
    flex: 0 0 var(--media-pagination-dot-size);
    padding: 0;
    border: 0;
    appearance: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.2);
    transition:
        background-color 0.2s ease,
        opacity 0.2s ease,
        transform 0.2s ease;
}

.housing-gallery-card .media-pagination-dot:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

@media (pointer: coarse) {
    .housing-gallery-card .media-pagination,
.housing-gallery-card .media-pagination-dot {
        pointer-events: auto;
    }

    .housing-gallery-card .media-pagination-dot {
        cursor: pointer;
    }
}

.housing-gallery-card .media-pagination-dot.is-active {
    background: #ffffff;
    transform: scale(1.2);
}

.housing-gallery-card .media-pagination-dot.is-window-edge:not(.is-active) {
    opacity: 0.85;
    transform: scale(0.8);
}

.housing-gallery-card .slide-arrow,
.housing-gallery-scroll-arrow.slide-arrow {
    --slide-arrow-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20fill='%23000'%20d='M8.47%204.47a1.25%201.25%200%200%201%201.77%200l6.47%206.47c.59.59.59%201.54%200%202.12l-6.47%206.47a1.25%201.25%200%201%201-1.77-1.77L14.23%2012%208.47%206.24a1.25%201.25%200%200%201%200-1.77z'/%3E%3C/svg%3E");
    --slide-arrow-size: 28px;
    --slide-arrow-icon-size: 14px;
    --slide-arrow-offset: 6px;
    width: var(--slide-arrow-size);
    height: var(--slide-arrow-size);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    appearance: none;
    font-size: 0;
    line-height: 0;
    position: absolute;
    z-index: 1;
    top: 50%;
    transform: translateY(-50%) scale(1);
    transform-origin: center;
    border-radius: 50%;
    background-color: #f5f5f5;
    color: #222;
    border: 1px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 0.2s ease,
        visibility 0s linear 0.2s,
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        color 0.2s ease,
        transform 0.18s ease;
}

.housing-gallery-card .slide-arrow::before,
.housing-gallery-scroll-arrow.slide-arrow::before {
    content: "";
    width: var(--slide-arrow-icon-size);
    height: var(--slide-arrow-icon-size);
    background-color: currentColor;
    -webkit-mask-image: var(--slide-arrow-icon);
    mask-image: var(--slide-arrow-icon);
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
}

.housing-gallery-card .slide-arrow:hover,
.housing-gallery-scroll-arrow.slide-arrow:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.07);
    background-color: #ffffff;
    color: #111;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

@media (hover: hover) and (pointer: fine) {
    .housing-gallery-card .media-slider.slider-ready.has-multiple-media:hover .slide-arrow {
        opacity: 0.85;
        visibility: visible;
        pointer-events: auto;
        transition-delay: 0s;
    }

    .housing-gallery-card .media-slider.slider-ready.has-multiple-media:hover .slide-arrow:hover {
        opacity: 1;
    }
}

.housing-gallery-card .left-arrow,
.housing-gallery-scroll-arrow.left-arrow {
    left: var(--slide-arrow-offset);
}

.housing-gallery-card .left-arrow::before,
.housing-gallery-scroll-arrow.left-arrow::before {
    transform: rotate(180deg);
}

.housing-gallery-card .right-arrow,
.housing-gallery-scroll-arrow.right-arrow {
    right: var(--slide-arrow-offset);
}


/* Card text: title across the top; the price sits bottom-right beside
   age/distance. Stretched cards put the extra height in the middle row. */
.housing-gallery-card .listing-details {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    column-gap: 5px;
    width: 100%;
    min-width: 0;
    padding: 4px 2px 1px;
    box-sizing: border-box;
    overflow: hidden;
    overflow-wrap: break-word;
}

.housing-gallery-card .gal-details {
    width: 100%;
}

.housing-gallery-card .gal-heading {
    grid-row: 1;
    grid-column: 1 / -1;
    margin: 0 0 2px;
    color: #222222;
    font-size: 13.5px;
    line-height: 1.18;
    -webkit-text-stroke: 0.3px rgba(0, 0, 0, 0.45);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
}

.housing-gallery-card .job_p {
    margin: 0;
    color: var(--hl-muted, #5f6b73);
    font-size: 11.5px;
    line-height: 1.25;
}

.housing-gallery-card .timeframe {
    grid-row: 2;
    grid-column: 1;
    align-self: start;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.housing-gallery-card .gal-created-at {
    position: static;
    inset: auto;
    grid-row: 4;
    grid-column: 1;
    align-self: end;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 4px;
    min-width: 0;
    margin: 0 0 1px;
    color: #777777;
    font-size: 11px;
    line-height: 1.25;
}

.housing-gallery-card .gal-created-at > span {
    white-space: nowrap;
}

.housing-gallery-card .gal-created-dist-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.housing-gallery-card .small-distance-marker {
    width: 10px;
    height: 10px;
    margin: 0 -4px 0 -2px;
}

/* The price lines are placed individually so age/distance only shares its row
   with the last (narrowest) line; the Lease Total gets its own full-width row above
   the per-person price, which is the headline as on every lease card. */
.housing-gallery-card .buy-now-price {
    position: static;
    inset: auto;
    margin: 0;
    display: contents;
    color: #111;
    font-size: 14px;
    line-height: 1.2;
    text-align: right;
    white-space: nowrap;
    -webkit-text-stroke: 0.35px currentColor;
}

.housing-gallery-card .buy-now-price > .lease-price {
    grid-row: 4;
    grid-column: 2;
    justify-self: end;
    align-self: end;
}

.housing-gallery-card .buy-now-price > .total-lease-full,
.housing-gallery-card .buy-now-price > .total-lease-short {
    grid-row: 3;
    grid-column: 1 / -1;
}

.housing-gallery-card .lease-price--secondary {
    color: #444;
    font-size: 12.5px;
    -webkit-text-stroke: 0.2px currentColor;
}

.housing-gallery-card .per-person-short,
.housing-gallery-card .total-lease-short {
    display: none;
}


.housing-gallery-card .button-container {
    display: block;
    flex-grow: 0;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
}


@media (max-width: 480px) {
    .housing-gallery-card .total-lease-full {
        display: none;
    }

    .housing-gallery-card .total-lease-short {
        display: block;
    }
}
