/* ==========================================================
   Property archive (archive-property.php)
   Modeled on trowbridgecm.com/property: pill search bar, map, horizontal property cards.
   ========================================================== */

.tb-prop-archive {
    --tbp-navy: #24285f;
    --tbp-navy-dark: #181b44;
    --tbp-panel: #f1efeb;
    --tbp-text: #333333;
    --tbp-muted: #666666;
    --tbp-radius: 15px;
    --tbp-sans: 'Raleway', 'Helvetica Neue', Arial, sans-serif;

    background: #ffffff;
}

/* Typography + resets apply to the listing UI only, so the hero block
   pulled into .tb-prop-archive__intro keeps the theme's own styling. */
.tb-prop-map,
.tb-prop-list {
    color: var(--tbp-text);
    font-family: var(--tbp-sans);
    font-size: 16px;
    line-height: 1.5;
}
.tb-prop-list *,
.tb-prop-list *::before,
.tb-prop-list *::after {
    box-sizing: border-box;
}

/* Undo the theme's global heading/link colors and fonts */
.tb-prop-card__name {
    font-family: var(--tbp-sans);
    letter-spacing: 0;
}
.tb-prop-list a {
    color: inherit;
}

/* Visually hidden page heading (used when there is no hero block) */
.tb-prop-archive .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Component display rules below would otherwise beat the [hidden] attribute */
.tb-prop-archive [hidden] {
    display: none !important;
}

/* ---------- "Our Communities" banner ----------
   The Trowbridge Page Banner block (blocks/tb-page-banner) or the default
   one from archive-property.php. Shown only on page 1 of the List view:
   property-archive.js adds .is-banner-on (updateHero()). */
.tb-prop-archive:not(.is-banner-on) .tb-page-banner {
    display: none;
}

/* ---------- Sort + view toolbar ---------- */
.tb-prop-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding-top: 28px;
    padding-bottom: 20px;
    font-family: var(--tbp-sans);
}
.tb-prop-toolbar__count {
    margin: 0;
    color: var(--tbp-muted);
    font-size: 14px;
}
.tb-prop-toolbar__right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}
.tb-prop-toolbar__label {
    margin: 0 4px 0 0;
    color: #777777;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.tb-prop-toolbar__sort {
    height: 40px;
    min-width: 150px;
    margin: 0;
    padding: 0 36px 0 12px;
    border: 1px solid #dddddd;
    border-radius: 0;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.4 0 6 4.6 10.6 0 12 1.4l-6 6-6-6z' fill='%23161719'/%3E%3C/svg%3E") no-repeat right 12px center;
    color: #161719;
    font-family: var(--tbp-sans);
    font-size: 14px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.tb-prop-toolbar__views {
    display: flex;
}
.tb-prop-toolbar__view {
    height: 40px;
    margin: 0 0 0 -1px;
    padding: 0 18px;
    border: 1px solid #dddddd;
    border-radius: 0;
    background: #ffffff;
    color: #161719;
    font-family: var(--tbp-sans);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
}
.tb-prop-toolbar__view:first-child {
    margin-left: 0;
}
.tb-prop-toolbar__view:hover {
    background: #f3f3f4;
}
.tb-prop-toolbar__view.is-active {
    position: relative;
    border-color: #161719;
    background: #161719;
    color: #ffffff;
}
.tb-prop-toolbar__sort:focus-visible,
.tb-prop-toolbar__view:focus-visible {
    outline: 2px solid #c4943f;
    outline-offset: 2px;
}

/* View modes (class set on .tb-prop-archive by the script) */
.tb-prop-archive.is-view-list .tb-prop-map,
.tb-prop-archive.is-view-map .tb-prop-list {
    display: none !important;
}
.tb-prop-archive.is-view-map .tb-prop-map__canvas {
    height: 70vh;
    min-height: 420px;
}

/* ---------- Map ---------- */
/* MapLibre GL vector map, recolored with the site palette in
   property-archive.js (MAP_COLORS). Colors below come from tb-base.css. */
.tb-prop-map {
    --tbp-map-land: #f7f5f1;
    --tbp-map-gold: var(--tb-gold, #c99a3e);
    --tbp-map-gold-dark: var(--tb-gold-dark, #b0832c);
    --tbp-map-gold-text: var(--tb-gold-text, #7f5f22);
    --tbp-map-ink: var(--tb-ink, #1d1d1f);
    --tbp-map-text: var(--tb-text, #5b5b5b);
    --tbp-map-line: var(--tb-line, #d9d5ce);
    --tbp-map-white: #ffffff;
}
.tb-prop-map__canvas {
    position: relative;
    z-index: 0; /* keep the map's layers under the site header/menus */
    height: 500px;
    width: 100%;
    background: var(--tbp-map-land);
    border: 1px solid var(--tbp-map-line);
    overflow: hidden;
}
/* Hidden until the site colors are applied, so the default gray map never flashes */
.tb-prop-map__canvas .maplibregl-canvas-container {
    transition: opacity .3s ease;
}
.tb-prop-map__canvas.is-loading .maplibregl-canvas-container {
    opacity: 0;
}

/* Map pin: gold square with an ink "T"; ink with gold "T" on hover/focus */
.tb-prop-pin {
    display: block;
    padding: 0;
    margin: 0;
    background: none;
    border: 0;
    cursor: pointer;
}
.tb-prop-pin span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--tbp-map-gold);
    color: var(--tbp-map-ink);
    border: 2px solid var(--tbp-map-white);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(29, 29, 31, .35);
    font-family: var(--tb-serif, 'Cormorant Garamond', Georgia, serif);
    font-size: 17px;
    font-weight: 600;
    line-height: 1;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.tb-prop-pin:hover span,
.tb-prop-pin:focus-visible span {
    background: var(--tbp-map-ink);
    color: var(--tbp-map-gold);
    transform: translateY(-2px);
}
.tb-prop-pin:focus-visible {
    outline: none;
}
.tb-prop-pin:focus-visible span {
    box-shadow: 0 0 0 3px var(--tbp-map-white), 0 0 0 5px var(--tbp-map-gold-dark);
}

/* Popup: white card, ink text, gold accent */
.tb-prop-map .maplibregl-popup-content {
    padding: 14px 18px 14px 16px;
    background: var(--tbp-map-white);
    border-top: 3px solid var(--tbp-map-gold);
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(29, 29, 31, .18);
}
.tb-prop-map .maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.tb-prop-map .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.tb-prop-map .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
    border-top-color: var(--tbp-map-white);
}
.tb-prop-map .maplibregl-popup-anchor-top .maplibregl-popup-tip,
.tb-prop-map .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.tb-prop-map .maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
    border-bottom-color: var(--tbp-map-gold);
}
.tb-prop-map .maplibregl-popup-close-button {
    width: 28px;
    height: 28px;
    font-size: 20px;
    line-height: 1;
    color: var(--tbp-map-text);
    background: none;
    border: 0;
}
.tb-prop-map .maplibregl-popup-close-button:hover,
.tb-prop-map .maplibregl-popup-close-button:focus-visible {
    color: var(--tbp-map-ink);
    background: none;
}

.tb-prop-map__info {
    font-family: var(--tbp-sans);
    color: var(--tbp-map-ink);
    max-width: 240px;
    padding-right: 12px; /* room for the close button */
}
.tb-prop-map__photo {
    display: block;
    width: 100%;
    height: 120px;
    object-fit: cover;
    margin: 0 0 10px;
    border-radius: 2px;
}
.tb-prop-map__info strong {
    display: block;
    color: var(--tbp-map-ink);
    font-family: var(--tb-serif, 'Cormorant Garamond', Georgia, serif);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.15;
    margin-bottom: 4px;
}
.tb-prop-map__info p {
    margin: 0 0 8px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--tbp-map-text);
}
.tb-prop-map .tb-prop-map__info a {
    color: var(--tbp-map-gold-text);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-decoration: none;
}
.tb-prop-map .tb-prop-map__info a:hover,
.tb-prop-map .tb-prop-map__info a:focus-visible {
    color: var(--tbp-map-ink);
    text-decoration: underline;
}

/* Zoom buttons */
.tb-prop-map .maplibregl-ctrl-group {
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(29, 29, 31, .15);
    border: 1px solid var(--tbp-map-line);
}
.tb-prop-map .maplibregl-ctrl-group button {
    width: 34px;
    height: 34px;
    background-color: var(--tbp-map-white);
}
.tb-prop-map .maplibregl-ctrl-group button + button {
    border-top-color: var(--tbp-map-line);
}
.tb-prop-map .maplibregl-ctrl-group button:hover {
    background-color: var(--tb-cream, #ece8e1);
}

/* Attribution */
.tb-prop-map .maplibregl-ctrl-attrib {
    background: rgba(255, 255, 255, .85);
    color: var(--tbp-map-text);
    font-size: 11px;
}
.tb-prop-map .maplibregl-ctrl-attrib a {
    color: var(--tbp-map-text);
}

/* ---------- Listing ---------- */
.tb-prop-list {
    padding-top: 32px;
    padding-bottom: 48px;
}
.tb-prop-list__empty {
    text-align: center;
    padding: 40px 0;
    color: var(--tbp-muted);
}
.tb-prop-archive .tb-prop-list__empty .tb-prop-card__button {
    margin: 8px 0 0;
    border: 0;
    cursor: pointer;
    font-family: var(--tbp-sans);
}

/* ---------- Property card ---------- */
.tb-prop-card {
    display: flex;
    margin: 0 0 32px;
    scroll-margin-top: 120px;
}

.tb-prop-card__media {
    width: 40%;
    display: flex;
    flex-direction: column;
}
.tb-prop-card__image {
    position: relative;
    height: 200px;
    border-radius: var(--tbp-radius) 0 0 0;
    overflow: hidden;
    background: var(--tbp-panel);
}
.tb-prop-card__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Photo links to the property; hover zooms the photo under a navy wash */
.tb-prop-card__image-link {
    position: relative;
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
}
.tb-prop-card__image-link > img,
.tb-prop-card__image-link > .tb-prop-card__placeholder {
    transition: transform .5s ease;
}
.tb-prop-card__image-link::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(220, 220, 220, .45); /* light gray wash */
    opacity: 0;
    transition: opacity .3s ease;
}
.tb-prop-card__image-link:hover > img,
.tb-prop-card__image-link:hover > .tb-prop-card__placeholder {
    transform: scale(1.05);
}
.tb-prop-card__image-link:hover::after {
    opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
    .tb-prop-card__image-link > img,
    .tb-prop-card__image-link > .tb-prop-card__placeholder {
        transition: none;
        transform: none !important;
    }
}
.tb-prop-card__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    height: 100%;
    padding: 24px;
    background: linear-gradient(160deg, #f7f5f0 0%, #e6e2d8 100%); /* light tile so the black logo reads */
    text-align: center;
}
.tb-prop-card__image img.tb-prop-card__placeholder-logo {
    width: auto;
    height: auto;
    max-width: 70%;
    max-height: 48px;
    object-fit: contain;
}
.tb-prop-card__placeholder-text {
    color: rgba(29, 29, 31, .7);
    font-family: var(--tbp-sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}
/* "Specials" announcement, top left of the photo (shown when the Website Special UDF has a value) */
.tb-prop-card__flag {
    position: absolute;
    top: 14px;
    left: 0;
    z-index: 2; /* above the photo's hover wash */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px 5px 12px;
    background: #c99a3e;
    color: #ffffff;
    font-family: var(--tbp-sans);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 0 20px 20px 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    pointer-events: none; /* clicks fall through to the photo link */
}
.tb-prop-card__flag .fa-tag {
    font-size: 10px;
}

.tb-prop-card__banner {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 16px;
    background: black;
    color: #ffffff;
    text-align: center;
    border-top: 3pt solid var(--tb-gold, #c99a3e);
    border-radius: 0 0 0 var(--tbp-radius);
}
.tb-prop-card__name {
    margin: 0 0 2px;
    font-size: 22px;
    font-weight: 500;
    line-height: 1.25;
    text-transform: uppercase !important;
    color: #ffffff;
}
.tb-prop-card__name a,
.tb-prop-card__name a:hover {
    color: #ffffff;
    text-decoration: none;
}
.tb-prop-card__address {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, .85);
}

.tb-prop-card__details {
    width: 60%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 28px;
    padding: 2em 3.75em;
    background: var(--tbp-panel);
    border-radius: 0 var(--tbp-radius) var(--tbp-radius) 0;
    color: var(--tb-ink, #1d1d1f);
    font-family: var(--tb-sans, 'Raleway', 'Helvetica Neue', Arial, sans-serif);
}

.tb-prop-card__specs {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.tb-prop-card__spec {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 0;
    min-width: 84px;
    margin: .4em 0;
    color: var(--tb-ink, #1d1d1f);
    text-align: center;
}
.tb-prop-card__spec .fa-solid {
    font-size: 22px;
    line-height: 1;
    color: var(--tb-ink, #1d1d1f);
}
/* Label style matches the site's small uppercase labels (.tb-eyebrow) */
.tb-prop-card__spec-title {
    margin: 10px 0 4px;
    font-family: var(--tb-sans, 'Raleway', 'Helvetica Neue', Arial, sans-serif);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: .2em;
    color: var(--tb-ink, #1d1d1f);
}
.tb-prop-card__spec-value {
    font-family: var(--tb-sans, 'Raleway', 'Helvetica Neue', Arial, sans-serif);
    font-size: 14px;
    line-height: 1.35;
    color: var(--tb-ink, #1d1d1f);
}
/* Value directly under the icon (no title, e.g. Available/Waitlist): keep the title's gap */
.tb-prop-card__spec .fa-solid + .tb-prop-card__spec-value {
    margin-top: 10px;
}
/* "3 units available" under the Available date */
.tb-prop-card__spec-note {
    margin-top: 2px;
    font-family: var(--tb-sans, 'Raleway', 'Helvetica Neue', Arial, sans-serif);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--tb-ink, #1d1d1f);
}
.tb-prop-card__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, .08);
}
.tb-prop-card__map-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--tb-ink, #1d1d1f);
    font-family: var(--tb-sans, 'Raleway', 'Helvetica Neue', Arial, sans-serif);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.tb-prop-card__map-link .fa-solid {
    font-size: 20px;
    color: var(--tb-ink, #1d1d1f);
}
.tb-prop-card__map-link:hover,
.tb-prop-card__map-link:hover .fa-solid {
    color: var(--tb-gold-dark, #b0832c);
    text-decoration: underline;
}
/* Scoped under .tb-prop-archive so it beats ".tb-prop-list a { color: inherit }" */
/* Matches the site's gold .tb-btn (tb-base.css): gold, square, small spaced caps */
.tb-prop-archive .tb-prop-card__button,
.tb-prop-archive .tb-prop-card__button:link,
.tb-prop-archive .tb-prop-card__button:visited {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    padding: 16px 26px;
    border: 0;
    border-radius: 0;
    background: var(--tb-gold, #c99a3e);
    color: var(--tb-ink, #1d1d1f);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .12);
    font-family: var(--tb-sans, 'Raleway', 'Helvetica Neue', Arial, sans-serif);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .18em;
    line-height: 1;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s ease, transform .2s ease;
}
.tb-prop-archive .tb-prop-card__button:hover,
.tb-prop-archive .tb-prop-card__button:focus {
    background: var(--tb-gold-dark, #b0832c);
    color: var(--tb-ink, #1d1d1f);
    text-decoration: none;
    transform: translateY(-1px);
}
.tb-prop-archive .tb-prop-card__button:focus-visible {
    outline: 2px solid var(--tb-ink, #1d1d1f);
    outline-offset: 2px;
}

/* Admin-only list of properties missing from the map */
.tb-prop-geo-report {
    margin: 0 0 32px;
    padding: 16px 20px;
    border: 1px dashed #c4943f;
    border-radius: 8px;
    background: #fbf7ef;
    font-size: 14px;
}
.tb-prop-geo-report ul {
    margin: 8px 0 12px 18px;
}
.tb-prop-geo-report a {
    color: var(--tbp-navy);
    text-decoration: underline;
}

/* Pagination (built by property-archive.js) */
.tb-prop-pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 8px 0 48px;
}
.tb-prop-pager__btn {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #dcdce0;
    border-radius: 19px;
    background: #ffffff;
    color: var(--tb-ink, #1d1d1f);
    font-family: var(--tb-sans, 'Raleway', 'Helvetica Neue', Arial, sans-serif);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.tb-prop-pager__btn:hover:not(:disabled):not(.is-current) {
    border-color: var(--tb-ink, #1d1d1f);
}
.tb-prop-pager__btn:focus-visible {
    outline: 2px solid var(--tb-ink, #1d1d1f);
    outline-offset: 2px;
}
.tb-prop-pager__btn.is-current {
    background: var(--tb-ink, #1d1d1f);
    border-color: var(--tb-ink, #1d1d1f);
    color: #ffffff;
    cursor: default;
}
.tb-prop-pager__btn:disabled {
    opacity: .4;
    cursor: default;
}
.tb-prop-pager__step {
    padding: 0 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 12px;
}
.tb-prop-pager__gap {
    padding: 0 4px;
    color: var(--tbp-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .tb-prop-card__details {
        padding: 1.5em 2em;
    }
}

@media (max-width: 800px) {
    .tb-prop-toolbar__right {
        margin-left: 0;
        width: 100%;
    }
    .tb-prop-toolbar {
        padding-top: 24px;
    }
    .tb-prop-toolbar__right {
        gap: 14px 18px;
    }
    .tb-prop-toolbar__label {
        font-size: 12px;
    }
    .tb-prop-toolbar__sort {
        flex: 1 1 auto;
        max-width: 240px;
        height: 46px;
        padding-left: 16px;
        font-size: 16px; /* 16px+ stops iPhone zooming in on tap */
    }
    .tb-prop-toolbar__views {
        width: 100%;
    }
    .tb-prop-toolbar__view {
        flex: 1 1 auto;
        height: 46px;
        padding: 0 12px;
        font-size: 12px;
    }
    .tb-prop-toolbar__view:first-child {
        flex-grow: 1.4; /* "Map & List" is the longest label */
    }
    .tb-prop-map__canvas {
        height: 360px;
    }
    .tb-prop-card {
        flex-direction: column;
    }
    .tb-prop-card__media,
    .tb-prop-card__details {
        width: auto;
    }
    .tb-prop-card__image {
        border-radius: var(--tbp-radius) var(--tbp-radius) 0 0;
    }
    .tb-prop-card__banner {
        border-radius: 0;
    }
    .tb-prop-card__details {
        padding: 1em;
        border-radius: 0 0 var(--tbp-radius) var(--tbp-radius);
    }
    .tb-prop-card__spec {
        flex-basis: 40%;
    }
}
