/* ==========================================================================
   Hughston Homes — Listing Cards & Sticky Nav
   Merged from production WPCode + new card component
   ========================================================================== */

/* ── CSS vars (set by JS, defined here as fallback) ──────────────────────── */
:root {
    --hh-hot-homes-offset:     0px;
    --hh-hot-homes-nav-height: 58px;
}

/* ── Sticky nav ───────────────────────────────────────────────────────────── */
.hh-hot-homes-sticky-nav {
    position: sticky;
    top: var(--hh-hot-homes-offset);
    z-index: 95;
    background: #f6f7eb;
    border-top: 1px solid rgba(29,52,44,0.10);
    border-bottom: 1px solid rgba(29,52,44,0.10);
    box-shadow: 0 1px 0 rgba(29,52,44,0.05);
    margin: 0;
}

.hh-hot-homes-sticky-nav__inner {
    max-width: 1245px;
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.hh-hot-homes-sticky-nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid #d8dbcf;
    background: #f3f4ee;
    color: #5f675f;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.hh-hot-homes-sticky-nav__link:hover  { background: #e7eadf; color: #1d342c; border-color: #cfd5c6; }
.hh-hot-homes-sticky-nav__link.is-active { background: #3f7d52; border-color: #3f7d52; color: #fff; }

h2.vc_custom_heading[id^="hh-market-"],
h2.hh-region__heading[id^="hh-market-"] {
    scroll-margin-top: calc(var(--hh-hot-homes-offset) + var(--hh-hot-homes-nav-height) + 24px);
}

/* ── Back to top ──────────────────────────────────────────────────────────── */
.hh-back-to-top {
    position: fixed;
    bottom: 32px;
    left: 32px;
    z-index: 999;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(29,52,44,0.20);
    background: #fff;
    color: #3f7d52;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s, background-color 0.2s, color 0.2s;
}
.hh-back-to-top.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.hh-back-to-top:hover { background: #3f7d52; color: #fff; border-color: #3f7d52; }

/* ── Grid wrapper ─────────────────────────────────────────────────────────── */
.hh-listings-grid-wrap {
    max-width: 1245px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

/* ── Region section ───────────────────────────────────────────────────────── */
.hh-region { margin-bottom: 64px; }

.hh-region h2.vc_custom_heading,
.hh-region__heading {
    margin-bottom: 16px;
}

/* ── Filter pills ─────────────────────────────────────────────────────────── */
.hh-region__filters,
.hh-region-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.hh-region__filter,
.hh-region-filter {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid #d8dbcf;
    background: #f3f4ee;
    color: #5f675f;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.hh-region__filter:hover,
.hh-region-filter:hover     { background: #e7eadf; color: #1d342c; border-color: #cfd5c6; }
.hh-region__filter.is-active,
.hh-region-filter.is-active { background: #3f7d52; border-color: #3f7d52; color: #fff; }

/* ── Card grid ────────────────────────────────────────────────────────────── */
.hh-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.hh-card--hidden { display: none !important; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.hh-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e4e7db;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.2s;
}
.hh-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.10); transform: translateY(-2px); }

/* ── Card media ───────────────────────────────────────────────────────────── */
.hh-card__media {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #e8ebe0;
    overflow: hidden;
    flex-shrink: 0;
}

.hh-card__img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    transition: opacity 0.25s;
}

.hh-card__img-placeholder { width: 100%; height: 100%; background: #d8dbcf; }

/* Prev / Next */
.hh-card__prev,
.hh-card__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.85);
    color: #1d342c;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
    padding: 0;
}
.hh-card__prev { left: 8px; }
.hh-card__next { right: 8px; }
.hh-card:hover .hh-card__prev,
.hh-card:hover .hh-card__next { opacity: 1; }
.hh-card__prev:hover,
.hh-card__next:hover { background: #fff; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.hh-card__badges {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.hh-card__badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.4;
}

.hh-card__badge--hot         { background: #C17A2A; color: #fff; }
.hh-card__badge--featured    { background: #f59e0b; color: #fff; }
.hh-card__badge--available   { background: #3f7d52; color: #fff; }
.hh-card__badge--coming-soon { background: #f6a623; color: #fff; }
.hh-card__badge--complete    { background: #1d342c; color: #fff; }
.hh-card__badge--progress    { background: rgba(255,255,255,0.95); color: #1d342c; border: 1px solid rgba(29,52,44,0.15); }

/* Legacy badge classes — keep for backwards compat */
.hh-card__completion { padding: 4px 10px; border-radius: 999px; font-family: 'Nunito Sans', sans-serif; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.2; }
.hh-completion--done     { background: #1d342c; color: #fff; }
.hh-completion--progress { background: rgba(255,255,255,0.95); color: #1d342c; border: 1px solid rgba(29,52,44,0.15); }
.hh-card__status         { padding: 4px 10px; border-radius: 999px; font-family: 'Nunito Sans', sans-serif; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; line-height: 1.2; }
.hh-status--available    { background: #3f7d52; color: #fff; }
.hh-status--coming-soon  { background: #f6a623; color: #fff; }

/* ── Incentive strip ──────────────────────────────────────────────────────── */
.hh-card__incentive {
    background: linear-gradient(135deg, #0C2340 0%, #1B4F8A 100%);
    padding: 8px 16px;
    text-align: center;
}
.hh-card__incentive-text {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #fff;
    text-transform: uppercase;
}

/* ── Card body ────────────────────────────────────────────────────────────── */
.hh-card__body {
    flex: 1;
    padding: 14px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hh-card__plan {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    font-weight: 500;
    color: #1d342c;
    margin: 0 0 2px;
    line-height: 1.25;
}

.hh-card__subdivision {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 11px;
    font-weight: 800;
    color: #3f7d52;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

/* Legacy meta-top */
.hh-card__meta-top { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0; }

.hh-card__address {
    margin: 0;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 13px;
    color: #5f675f;
    line-height: 1.4;
}

.hh-card__specs {
    list-style: none;
    margin: 3px 0 0;
    padding: 0;
    padding-left: 1vw;
    display: flex;
    gap: 24px;
}
.hh-card__specs li  { font-family: 'Nunito Sans', sans-serif; font-size: 12px; color: #5f675f; }
.hh-card__spec-val  { font-weight: 700; color: #1d342c; }

.hh-card__price {
    margin: 6px 0 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 20px;
    font-weight: 500;
    color: #1d342c;
}

/* ── Card footer ──────────────────────────────────────────────────────────── */
.hh-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 14px;
    border-top: 1px solid #f2efe8;
    gap: 10px;
}

.hh-card__btn {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 9px 16px;
    border-radius: 999px;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.hh-card__btn--primary       { background: #3f7d52; color: #fff; border: 2px solid #3f7d52; }
.hh-card__btn--primary:hover { background: #1d342c; border-color: #1d342c; color: #fff; }
.hh-card__btn--map           { background: transparent; color: #3f7d52; border: 2px solid #3f7d52; }
.hh-card__btn--map:hover     { background: #3f7d52; color: #fff; }

/* Legacy single CTA */
.hh-card__cta {
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px 16px;
    border-radius: 999px;
    border: 2px solid #3f7d52;
    background: transparent;
    color: #3f7d52;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.hh-card__cta:hover { background: #3f7d52; color: #fff; }

/* ── See More button ──────────────────────────────────────────────────────── */
.hh-region__expand-wrap { margin-top: 20px; display: flex; justify-content: center; }
.hh-region__expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border-radius: 999px;
    border: 1px solid #d8dbcf;
    background: #f3f4ee;
    color: #3f7d52;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.hh-region__expand-btn:hover { background: #e7eadf; border-color: #cfd5c6; }
.hh-expand-icon { transition: transform 0.25s; flex-shrink: 0; }
.hh-region__expand-btn.is-expanded .hh-expand-icon { transform: rotate(180deg); }

/* ── No listings fallback ─────────────────────────────────────────────────── */
.hh-no-listings { text-align: center; padding: 40px 0; color: #5f675f; font-family: 'Nunito Sans', sans-serif; }

/* ── Featured strip (MIR page) ───────────────────────────────────────────── */
.hh-featured-strip { margin-bottom: 8px; }

.hh-featured-strip__label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #b45309;
    margin-bottom: 12px;
}

.hh-featured-strip__star { color: #f59e0b; }

/* ── Featured card ────────────────────────────────────────────────────────── */
.hh-card--featured {
    border: 2px solid #f59e0b;
    box-shadow: 0 4px 16px rgba(245,158,11,0.12);
}
.hh-card--featured:hover {
    box-shadow: 0 8px 24px rgba(245,158,11,0.20);
}

/* ── Homepage featured grid ───────────────────────────────────────────────── */
.hh-cards-grid--homepage {
    max-width: 1245px;
    margin: 0 auto;
    padding: 0 24px;
    gap: 32px;
    /* Always one row — 1, 2, or 3 cards fill evenly, never wrap */
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

.hh-cards-grid--homepage .hh-card__media {
    aspect-ratio: 16 / 10;
}

/* ── Tablet ───────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .hh-cards-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
    /* Homepage stays single row on tablet */
    .hh-cards-grid--homepage { gap: 16px; }
}

@media (max-width: 999px) {
    .hh-hot-homes-sticky-nav { position: static; overflow: hidden; }
    .hh-hot-homes-sticky-nav__inner {
        width: 100%; max-width: none; margin: 0; padding: 10px 14px;
        justify-content: flex-start; gap: 10px;
        overflow-x: auto; overflow-y: hidden;
        -webkit-overflow-scrolling: touch; touch-action: pan-x;
        scrollbar-width: none;
    }
    .hh-hot-homes-sticky-nav__inner::-webkit-scrollbar { display: none; }
    .hh-hot-homes-sticky-nav__link { flex: 0 0 auto; min-height: 40px; padding: 10px 16px; font-size: 12px; }
    .hh-back-to-top { bottom: 20px; left: 16px; padding: 9px 14px; font-size: 11px; }
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .hh-listings-grid-wrap { padding: 0 14px 40px; }

    /* MIR grid — single column */
    .hh-cards-grid { grid-template-columns: 1fr; gap: 16px; }

    /* Homepage featured — single column, full card */
    .hh-cards-grid--homepage {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0 14px;
    }
    .hh-cards-grid--homepage .hh-card__media {
        aspect-ratio: 4 / 3;
    }

    /* Always show carousel arrows on touch */
    .hh-card__prev,
    .hh-card__next { opacity: 1; }

    .hh-card__footer { flex-direction: column; gap: 8px; }
    .hh-card__btn { width: 100%; justify-content: center; }
}