/* ==========================================================================
   Listing cards (used on the home page now; search and rent/buy pages later)
   ========================================================================== */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 28px;
}

.card {
    --drawer-h: 70px;
    position: relative;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow .25s, transform .25s;
}
.card:hover, .card:focus-within { box-shadow: var(--shadow-lg); transform: translateY(-3px); }

.card__link { display: block; color: inherit; text-decoration: none; }
.card__link:focus-visible { outline-offset: -3px; border-radius: var(--radius); }

/* ---- Photo ---- */
.card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--pale) url("../img/mark-white.png") center / 34% no-repeat;
}
.card__img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .6s ease;
}
.card__img.is-missing { visibility: hidden; }
.card:hover .card__img, .card:focus-within .card__img { transform: scale(1.05); }

/* Gradient so the price stays readable on any photo */
.card__media::after {
    content: ""; position: absolute; inset: 45% 0 0 0;
    background: linear-gradient(to top, rgba(30, 26, 40, .72), rgba(30, 26, 40, 0));
    pointer-events: none;
    transition: top .35s ease;
}
/* Darken further up while the price is lifted above the spec drawer */
.card:hover .card__media::after, .card:focus-within .card__media::after { top: 15%; }

.card__badges { position: absolute; top: 12px; left: 12px; right: 64px; display: flex; flex-wrap: wrap; gap: 6px; z-index: 2; }
.badge {
    display: inline-block; padding: 5px 10px 3px; border-radius: 999px;
    font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
    background: rgba(255, 255, 255, .92); color: var(--mauve-dark);
}
.badge--sale { background: var(--slate); color: #fff; }
.badge--rent { background: var(--peach); color: var(--ink); }
.badge--status { background: var(--mauve-dark); color: #fff; }
.badge--reduced { background: var(--sage); color: var(--ink); }
.badge--new { background: #fff; color: var(--slate); }

.card__price {
    position: absolute; left: 16px; bottom: 14px; z-index: 2; margin: 0;
    font-family: var(--font-display); font-size: 1.45rem; color: #fff;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .35);
    transition: transform .35s ease;
}
.card__price small { font-family: var(--font-body); font-size: .8rem; letter-spacing: .04em; opacity: .9; }

/* ---- Spec drawer: hidden below the photo, slides up on hover/focus ---- */
.card__specs {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: var(--drawer-h); margin: 0; padding: 0 6px; list-style: none;
    background: rgba(62, 63, 107, .9);
    backdrop-filter: blur(6px);
    color: #fff;
    transform: translateY(100%);
    transition: transform .35s ease;
}
/* Each spec: icon, value and label stacked, so four fit side by side on narrow cards */
.card__specs li {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    min-width: 0; text-align: center; line-height: 1.1;
    border-left: 1px solid rgba(255, 255, 255, .15);
}
.card__specs li:first-child { border-left: 0; }
.card__specs .icon { width: 20px; height: 20px; margin-bottom: 2px; color: var(--peach); }
.card__specs strong { font-size: .95rem; white-space: nowrap; }
.card__specs span { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; opacity: .8; white-space: nowrap; }

.card:hover .card__specs, .card:focus-within .card__specs { transform: translateY(0); }
.card:hover .card__price, .card:focus-within .card__price { transform: translateY(calc(-1 * var(--drawer-h))); }

/* Touch screens have no hover: show the specs as a normal row under the photo */
@media (hover: none) {
    .card__media { overflow: visible; aspect-ratio: auto; }
    .card__media > .card__img { height: auto; aspect-ratio: 4 / 3; }
    .card__media::after { inset: auto 0 var(--drawer-h) 0; height: 40%; }
    .card__price { bottom: calc(var(--drawer-h) + 14px); }
    .card__specs {
        position: static; transform: none; backdrop-filter: none;
        background: var(--pale-soft); color: var(--ink);
    }
    .card__specs .icon { color: var(--slate); }
    .card__specs li { border-color: var(--line); }
    .card:hover .card__price, .card:focus-within .card__price { transform: none; }
    .card:hover .card__media::after, .card:focus-within .card__media::after { top: auto; }
    .card:hover, .card:focus-within { transform: none; }
}

/* ---- Text ---- */
.card__body { padding: 16px 18px 18px; }
.card__title {
    font-size: 1.15rem; margin: 0 0 6px; color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__location { display: flex; gap: 6px; align-items: flex-start; margin: 0; color: var(--muted); font-size: .95rem; }
.card__location .icon { color: var(--peach-dark); margin-top: 2px; }
.card__type { margin: 8px 0 0; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--mauve); }
.card__type:empty { display: none; }

/* Sold / rented listings stay visible, clearly marked: muted photo + a band across it */
.card.is-closed .card__img, .mini-card.is-closed .mini-card__img { filter: grayscale(.65) brightness(.92); }
.card__stamp, .mini-card__stamp {
    position: absolute; z-index: 2; left: -12%; right: -12%; top: 40%;
    transform: translateY(-50%) rotate(-8deg);
    padding: 9px 0 6px; text-align: center; pointer-events: none;
    font-family: var(--font-display); font-size: 1.35rem; letter-spacing: .35em; text-transform: uppercase;
    color: #fff; background: rgba(91, 74, 79, .9);
    box-shadow: 0 4px 14px rgba(30, 26, 40, .3);
}
.card__stamp { transition: opacity .25s; }
/* While the spec drawer is open the band steps aside (the "Sold"/"Rented" badge stays) */
.card:hover .card__stamp, .card:focus-within .card__stamp { opacity: 0; }
@media (hover: none) {
    .card:hover .card__stamp, .card:focus-within .card__stamp { opacity: 1; }
}
.mini-card__media { position: relative; overflow: hidden; }
.mini-card__stamp { font-size: .95rem; padding: 6px 0 4px; top: 48%; }

/* ---- Loading placeholders ---- */
.card--skeleton { pointer-events: none; }
.card--skeleton .card__media { background: var(--pale-soft); }
.card--skeleton .card__media::after { display: none; }
.skeleton-line { height: 14px; border-radius: 6px; background: var(--pale-soft); margin-bottom: 10px; }
.skeleton-line--short { width: 55%; }
.card--skeleton .card__media, .skeleton-line {
    background-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent);
    background-size: 200% 100%; background-repeat: no-repeat;
    animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* ==========================================================================
   Mini cards (recently viewed)
   ========================================================================== */
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.mini-grid:empty { display: none; }

.mini-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: box-shadow .2s, border-color .2s; }
.mini-card:hover, .mini-card:focus-within { box-shadow: var(--shadow); border-color: transparent; }
.mini-card__link { display: block; color: inherit; text-decoration: none; }
.mini-card__img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--pale) url("../img/mark-white.png") center / 28% no-repeat; }
.mini-card__body { padding: 12px 14px 14px; }
.mini-card__price { margin: 0 0 2px; font-family: var(--font-display); font-size: 1.1rem; color: var(--slate); }
.mini-card__title { font-family: var(--font-body); font-size: .95rem; font-weight: 600; margin: 0 0 4px; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card__meta { margin: 0; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================
   Favourite (heart) button - top-right of the photo on full and mini cards
   ========================================================================== */
.card, .mini-card { position: relative; }

.fav-btn {
    position: absolute; top: 10px; right: 10px; z-index: 4;
    display: grid; place-items: center;
    width: 42px; height: 42px; padding: 0;
    border: 0; border-radius: 50%; cursor: pointer;
    background: rgba(255, 255, 255, .92);
    color: var(--mauve-dark);
    box-shadow: 0 2px 10px rgba(30, 26, 40, .18);
    transition: transform .2s, background-color .2s, color .2s;
}
.fav-btn .icon { width: 22px; height: 22px; fill: none; stroke: currentColor; transition: fill .2s; }
.fav-btn:hover { transform: scale(1.08); color: var(--peach-dark); }
.fav-btn[aria-pressed="true"] { color: #d9665a; }
.fav-btn[aria-pressed="true"] .icon { fill: currentColor; }
.fav-btn--small { top: 8px; right: 8px; width: 34px; height: 34px; }
.fav-btn--small .icon { width: 18px; height: 18px; }

.fav-btn.is-popping { animation: heart-pop .45s ease; }
@keyframes heart-pop {
    0% { transform: scale(1); }
    35% { transform: scale(1.3); }
    65% { transform: scale(.92); }
    100% { transform: scale(1); }
}
