/* assets/listings.css — Find Housing cards, Doorway carousel and detail view (shared by several pages) */
.find-page { padding: 100px 16px 48px; max-width: 1200px; margin: 0 auto; }
.find-page h1 { font-size: 1.9rem; margin-bottom: .35rem; }
.lead { color: #555; max-width: 720px; line-height: 1.5; margin-bottom: 1.2rem; }

/* Search bar */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .6rem; }
.filters input[type=text], .filters select {
    padding: .7rem .85rem; border: 1px solid #ccc; border-radius: 8px; font-size: 1rem; background: #fff;
}
.filters input[type=text] { flex: 1 1 280px; }
.filters label { display: flex; align-items: center; gap: .35rem; font-size: .95rem; }
.filters .go { padding: .7rem 1.3rem; border: 0; border-radius: 8px; cursor: pointer; font-size: 1rem;
               background: #4400ff; color: #fff; }
.clear-link { font-size: .9rem; }

/* Section headings */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
                flex-wrap: wrap; margin: 2rem 0 .8rem; border-bottom: 1px solid #e6e6e6; padding-bottom: .5rem; }
.section-head h2 { font-size: 1.35rem; }
.section-head .count { color: #666; font-size: .95rem; }
.empty { color: #555; padding: .5rem 0 1rem; }

/* Rent cap explainer */
.rent-caps { background: #f7f8fc; border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1.2rem; font-size: .92rem; }
.rent-caps p { color: #444; line-height: 1.5; }
.rent-caps table { border-collapse: collapse; margin-top: .6rem; width: 100%; max-width: 560px; }
.rent-caps th, .rent-caps td { padding: .35rem .5rem; text-align: right; border-bottom: 1px solid #e2e4ee; }
.rent-caps th:first-child, .rent-caps td:first-child { text-align: left; }
.table-scroll { overflow-x: auto; }

/* Building cards */
.building-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.building-card { border: 1px solid #e3e3e3; border-radius: 12px; padding: 1.1rem; background: #fff;
                 display: flex; flex-direction: column; gap: .5rem; }
.building-card { padding: 0; overflow: hidden; }
.card-body { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.card-photo { position: relative; aspect-ratio: 16 / 9; background: var(--c); overflow: hidden; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: .3rem; color: #fff;
    background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000)); }
.placeholder svg { width: 46px; height: 46px; opacity: .9; }
.placeholder span { color: #fff !important; font-weight: 600; font-size: 1.05rem; letter-spacing: .02em; }
.card-photo:not(.has-img) .photo-credit { display: none; }
.card-photo.has-img .placeholder { display: none; }
.card-photo .county-tag { position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.6); color: #fff;
    font-size: .75rem; padding: .2rem .55rem; border-radius: 999px; }
.photo-credit { position: absolute; right: 8px; bottom: 6px; color: rgba(255,255,255,.85) !important; font-size: .65rem; }
.card-photo .county-tag { color: #fff !important; }
.building-card h3 { font-size: 1.12rem; line-height: 1.3; }
.meta { color: #555; font-size: .93rem; line-height: 1.4; }
.badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.badge { font-size: .78rem; padding: .2rem .55rem; border-radius: 999px; background: #eef3ff; color: #2a4a9a; }
.badge.soon { background: #fff4e0; color: #8a5a00; }
.badge.senior { background: #eaf7ee; color: #1f6b3a; }
.rents { margin: .1rem 0; }
.rents div { display: flex; justify-content: space-between; font-size: .95rem; padding: .15rem 0; }
.rents strong { font-weight: 600; }
.rent-note { color: #5f5f6e; font-size: .8rem; }
.card-links { display: flex; gap: 1rem; margin-top: auto; padding-top: .4rem; flex-wrap: wrap; }
.card-links a { font-weight: 600; color: #4400ff; }

.pager { display: flex; gap: .5rem; justify-content: center; align-items: center; margin: 1.5rem 0; flex-wrap: wrap; }
.pager a, .pager span { padding: .45rem .8rem; border-radius: 8px; border: 1px solid #ddd; font-size: .95rem; }
.pager span.current { background: #4400ff; color: #fff; border-color: #4400ff; }
/* Card photo carousel */
.doorway-card { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.doorway-card:hover, .doorway-card:focus-visible { box-shadow: 0 6px 22px rgba(0,0,0,.12); transform: translateY(-2px); outline: none; }
.carousel { position: absolute; inset: 0; }
.carousel img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.carousel img.active { opacity: 1; }
.car-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%;
    border: 0; background: rgba(255,255,255,.9); color: #222; font-size: 1.5rem; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.25); z-index: 3; }
.car-btn.prev { left: 8px; } .car-btn.next { right: 8px; }
.car-dots { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 5px; z-index: 3; }
.car-dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.55); }
.car-dots span.on { background: #fff; }
.photo-count { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff !important;
    font-size: .75rem; padding: .15rem .5rem; border-radius: 999px; z-index: 3; }
.photo-count span { color: #fff !important; }
.card-photo .county-tag, .card-photo .photo-credit { z-index: 3; }
@media (hover: hover) { .card-photo .car-btn { opacity: 0; transition: opacity .15s; }
                        .card-photo:hover .car-btn { opacity: 1; } }

/* Detail view */
body.dw-open { overflow: hidden; }
.dw-modal { position: fixed; inset: 0; background: rgba(15,15,30,.65); z-index: 3000; overflow-y: auto;
    padding: 4vh 16px; }
.dw-modal[hidden], .dw-viewer[hidden] { display: none; }
.dw-panel { position: relative; background: #fff; max-width: 1000px; margin: 0 auto; border-radius: 16px; overflow: hidden; }
.dw-close { position: absolute; top: 12px; right: 12px; z-index: 5; width: 40px; height: 40px; border-radius: 50%;
    border: 0; background: rgba(255,255,255,.95); font-size: 1.6rem; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.dw-info { padding: 1.4rem 1.6rem 1.8rem; display: flex; flex-direction: column; gap: .7rem; }
.dw-info h2 { font-size: 1.8rem; line-height: 1.2; }
.dw-address { font-size: 1.1rem; color: #555; }
.dw-src { align-self: flex-start; }
.dw-rents { border-top: 1px solid #eee; border-bottom: 1px solid #eee; padding: .6rem 0; }
.dw-rents div { display: flex; justify-content: space-between; font-size: 1.1rem; padding: .35rem 0; }
.dw-rents strong { color: #4400ff; }
.dw-credit { color: #555; font-size: .95rem; }
.dw-actions { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.dw-apply { background: #4400ff; color: #fff !important; padding: .8rem 1.4rem; border-radius: 10px; font-weight: 600; font-size: 1.05rem; }
.dw-map { font-weight: 600; color: #4400ff; }
.dw-disclosure { background: #fff8e6; border: 1px solid #f0d58a; border-radius: 10px; padding: .7rem .9rem;
    font-size: .88rem; color: #4a3b00; line-height: 1.5; }
.dw-disclosure a { color: #4400ff; font-weight: 600; }

/* Gallery: layout adapts to the number of photos */
.dw-gallery-wrap { position: relative; }
.dw-gcount { position: absolute; bottom: 12px; right: 12px; background: rgba(0,0,0,.65); color: #fff !important;
    font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; pointer-events: none; }
.dw-gcount[hidden] { display: none; }
.dw-gallery { display: grid; gap: 4px; background: #eee; }
.dw-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.dw-gallery .cell { position: relative; overflow: hidden; background: #ddd; min-height: 0; }
.dw-gallery .more { position: absolute; inset: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 1.4rem;
    font-weight: 700; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.dw-gallery.n0 { display: none; }
.dw-gallery.n1 { grid-template-columns: 1fr; height: 460px; }
.dw-gallery.n2 { grid-template-columns: 1fr 1fr; height: 400px; }
.dw-gallery.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; height: 440px; }
.dw-gallery.n3 .cell:first-child { grid-row: span 2; }
.dw-gallery.n4 { grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; height: 440px; }
.dw-gallery.n4 .cell:first-child { grid-row: span 2; }
.dw-gallery.n4 .cell:nth-child(2) { grid-column: span 2; }
.dw-gallery.n5 { grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; height: 440px; }
.dw-gallery.n5 .cell:first-child { grid-row: span 2; }

/* Full-screen photo viewer */
.dw-viewer { position: fixed; inset: 0; background: rgba(0,0,0,.94); z-index: 3100; display: flex;
    align-items: center; justify-content: center; }
.dw-viewer img { max-width: 92vw; max-height: 86vh; object-fit: contain; }
.dw-viewer button { position: absolute; border: 0; background: rgba(255,255,255,.15); color: #fff; cursor: pointer;
    width: 48px; height: 48px; border-radius: 50%; font-size: 2rem; line-height: 1; }
.dw-vclose { top: 16px; right: 16px; } .dw-vprev { left: 16px; } .dw-vnext { right: 16px; }
.dw-vcount { position: absolute; bottom: 18px; color: #fff !important; font-size: .95rem; }

@media (max-width: 700px) {
    .dw-modal { padding: 0; }
    .dw-panel { border-radius: 0; min-height: 100%; }
    .dw-info { padding: 1.1rem 1rem 2rem; }
    .dw-info h2 { font-size: 1.45rem; }
    /* On phones every layout becomes one swipeable row of photos */
    .dw-gallery[class*="n"] { display: flex; height: 280px; overflow-x: auto; scroll-snap-type: x mandatory; gap: 0; }
    .dw-gallery.n0 { display: none; }
    .dw-gallery .cell { flex: 0 0 100%; scroll-snap-align: start; }
    .dw-gallery .more { display: none; }
    .dw-apply { width: 100%; text-align: center; }
}

.disclosure { background: #fff8e6; border: 1px solid #f0d58a; border-radius: 10px; padding: .8rem 1rem;
    font-size: .9rem; line-height: 1.5; color: #4a3b00; margin-bottom: 1rem; }
.disclosure a { color: #4400ff; font-weight: 600; }
.source-note { color: #666; font-size: .84rem; line-height: 1.55; margin-top: 1rem; }

/* Favorites (from apartmentsnew.php) */
.posting { position: relative; }
.favorite-btn { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.9); border: none;
    border-radius: 50%; width: 40px; height: 40px; cursor: pointer; z-index: 100; display: flex;
    align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.favorite-btn i { font-size: 24px; color: #ddd; }
.favorite-btn.favorited i { color: #ff4757; }

/* Contact form pop-up: hidden until a Contact button opens it */
#contactFormModal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 2000; overflow-y: auto; padding: 0 16px; }
#contactFormModal .contact-box { background: #fff; max-width: 440px; margin: 10vh auto; padding: 1.4rem;
    border-radius: 12px; display: flex; flex-direction: column; gap: .6rem; }
#contactFormModal input, #contactFormModal textarea { padding: .6rem; border: 1px solid #ccc; border-radius: 8px; font-size: 1rem; }
#contactFormModal button { padding: .7rem; border: 0; border-radius: 8px; background: #4400ff; color: #fff; font-size: 1rem; cursor: pointer; }

@media (max-width: 600px) {
    .find-page { padding-top: 88px; }
    .find-page h1 { font-size: 1.5rem; }
    .filters select { flex: 1 1 45%; }
    .filters .go { width: 100%; }
    .building-grid { grid-template-columns: 1fr; }
}

/* v10 additions */
.favorite-btn span { font-size: 22px; color: #ccc; line-height: 1; }
.favorite-btn.favorited span { color: #ff4757; }
.dw-actions .save-btn { position: static; box-shadow: none; border: 1px solid var(--line, #e4e4ee); }
.filter-extras { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; align-items: center; margin-bottom: .4rem; font-size: .93rem; }
.filter-extras a { color: #4400ff; font-weight: 600; }
.find-page .lead a { color: #4400ff; font-weight: 600; }
.building-card.is-closed { opacity: .75; }
.building-card.is-closed .card-photo img { filter: grayscale(1); }
.mt-note { font-weight: 400; }

.building-card { position: relative; }
.saved-posts li { padding: .5rem 0; border-bottom: 1px solid #eee; }
.crumbs { font-size: .9rem; color: #666; margin-bottom: .4rem; }
.crumbs a { color: #4400ff; }
.city-columns { columns: 3 260px; column-gap: 2rem; }
.city-columns section { break-inside: avoid; margin-bottom: 1.4rem; }
.city-columns h2 { font-size: 1.15rem; margin-bottom: .4rem; }
.city-columns li { padding: .2rem 0; }
.city-columns a { color: #4400ff; }
.hint { color: #666; font-size: .88rem; }


/* Map view */
.view-toggle { display: inline-flex; border: 1px solid #e4e4ee; border-radius: 999px; padding: 3px; margin: .4rem 0 1rem; background: #fff; }
.view-toggle button { border: 0; background: transparent; padding: 7px 16px; border-radius: 999px; font-weight: 600; color: #02234f; cursor: pointer; font-size: .92rem; }
.view-toggle button[aria-selected="true"] { background: #4105f5; color: #fff; }
.view-toggle button[aria-selected="true"] .hint { color: #e0d9ff; }
#map { height: 560px; border-radius: 16px; border: 1px solid #e4e4ee; z-index: 1; }
.map-legend { font-size: .85rem; color: #555; margin-top: .5rem; }
.map-legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px; border: 2px solid #fff; box-shadow: 0 0 0 1px #ccc; }
.map-legend .dot.d { background: #4105f5; } .map-legend .dot.b { background: #f59e0b; }
@media (max-width: 600px) { #map { height: 440px; } }
#mapView { padding: 0; margin: 0; }
/* building cards without an open listing */
.not-open { font-size: .85rem; color: #5b6170; background: #f6f7fb; border-radius: 10px; padding: 8px 11px; margin-top: .6rem; line-height: 1.45; }
.card-links { gap: .5rem 1rem; }
.card-links a.subtle { font-weight: 500; color: #5b6170; }

/* Map picture for buildings without a photo */
.map-thumb-link { position: absolute; inset: 0; z-index: 1; display: block; }
.map-thumb { position: absolute; inset: 0; overflow: hidden; background: #e9e6dd; }
.map-tiles { position: absolute; width: 768px; height: 512px; display: grid; grid-template-columns: repeat(3, 256px); filter: saturate(.8); }
.map-tiles img { width: 256px; height: 256px; display: block; max-width: none; }
.map-pin { position: absolute; left: 50%; top: 50%; width: 30px; height: 40px; transform: translate(-50%, -100%); filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.map-credit { position: absolute; right: 6px; top: 6px; font-size: .6rem; color: #333 !important; background: rgba(255,255,255,.8); padding: 1px 5px; border-radius: 4px; }
.card-photo .save-btn { z-index: 3; }
.card-title-link { color: inherit !important; text-decoration: none; }
.card-title-link:hover { color: #4105f5 !important; text-decoration: underline; }
