/* Property workspace layout. The selected home is a large print on the left, the inventory an index
   beside it, and filters live in a drawer. Components and tokens come from kit.css. */

.workspace { grid-template-columns: minmax(0, 1.3fr) minmax(400px, 1fr); gap: 0; padding: 0; background: var(--ground); }
.workspace > .detail-pane { grid-column: 1; grid-row: 1; }
.workspace > .listing-pane { grid-column: 2; grid-row: 1; }
.workspace.is-empty { grid-template-columns: minmax(0, 1fr); }
.workspace.is-empty > .listing-pane { grid-column: 1; width: 100%; max-width: 960px; margin-inline: auto; }

/* ===== The stage ===== */
.detail-pane {
    top: var(--header-h); height: calc(100dvh - var(--header-h));
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; column-gap: 24px;
    padding: 16px 16px 48px; border: 0; border-radius: 0; background: #fff; box-shadow: none;
}
.detail-gallery { grid-column: 1 / -1; grid-row: 1; height: clamp(400px, calc(100dvh - var(--header-h) - 120px), 880px); margin: 0; overflow: hidden; border-radius: var(--radius-panel); background: var(--n-100); }
.detail-gallery > img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; outline: 0; }
.detail-gallery::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, rgba(10, 16, 32, .84) 0%, rgba(10, 16, 32, .62) 28%, rgba(10, 16, 32, .24) 48%, rgba(10, 16, 32, 0) 66%); pointer-events: none; }
.detail-summary { grid-column: 1 / -1; grid-row: 1; align-self: end; z-index: 2; padding: 32px 128px 32px 32px; color: #fff; pointer-events: none; }
.detail-summary strong { display: block; font-size: clamp(40px, 3.6vw, 64px); font-weight: 500; line-height: 1.05; letter-spacing: var(--track-display); }
.detail-summary strong small, #detail-price small { color: rgba(255, 255, 255, .72); font-size: 14px; font-weight: 400; letter-spacing: 0; }
.detail-summary h2 { margin: 12px 0 0; font-size: 20px; font-weight: 500; line-height: 28px; }
.detail-summary p { margin: 2px 0 0; color: rgba(255, 255, 255, .8); font-size: 14px; }
.photo-open { right: 24px; bottom: 32px; }
.detail-save { position: absolute; z-index: 3; top: 16px; right: 16px; }

.detail-actions { grid-column: 1; grid-row: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 24px 16px; }
.stat-row { grid-column: 2; grid-row: 2; align-self: center; display: flex; gap: 32px; margin: 0; padding: 24px 16px; border: 0; }
.stat-row > div { display: grid; gap: 4px; padding: 0; border: 0; text-align: right; }
.stat-row strong { font-size: 28px; font-weight: 500; line-height: 1; letter-spacing: var(--track-display); }
.stat-row small { color: var(--muted); font-size: 12px; line-height: 16px; }

.ledger { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 32px; margin: 0 16px; padding: 24px 0 24px; border-top: 1px solid var(--rule); }
.ledger > div { min-height: 0; display: grid; justify-content: start; align-content: start; gap: 4px; border: 0; }
.ledger dt { color: var(--muted); font-size: 12px; }
.ledger dd { margin: 0; font-size: 16px; font-weight: 500; text-align: left; }

/* Each block: a label on the left, its content on the right. */
.detail-block { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 8px 32px; margin: 0 16px; padding: 32px 0; border-top: 1px solid var(--rule); }
.detail-block > h3 { grid-column: 1; grid-row: 1 / span 4; margin: 0; font-size: 20px; font-weight: 500; line-height: 28px; }
.detail-block > :not(h3) { grid-column: 2; }
.detail-block p { max-width: 62ch; margin: 0; font-size: 15px; line-height: 24px; }
/* Location: the place and its link on the label's row, the map across the full block below. */
#map-block > h3 { grid-row: 1; }
#map-block .map-meta { grid-column: 2; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
#map-place { font-size: 16px; font-weight: 500; line-height: 28px; }
#map-block .map-preview { grid-column: 1 / -1; height: 320px; margin-top: 16px; }
.detail-amenities { gap: 8px 24px; }
.detail-amenities li { display: flex; align-items: center; gap: 12px; }
.detail-amenities li::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--gold); }

/* ===== The index ===== */
.listing-pane { padding: 32px 32px 64px; }
.results-bar { align-items: flex-end; margin-bottom: 24px; }
.results-bar h1 { margin: 0; font-size: 40px; font-weight: 500; line-height: 48px; letter-spacing: var(--track-display); }
.results-finding { margin: 4px 0 0; color: var(--body); font-size: 14px; }
.sort-control { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.index-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.index-tools .type-counts { flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.index-tools .type-counts::-webkit-scrollbar { display: none; }
.mobile-filter-trigger { order: 2; flex: none; width: auto; height: auto; margin-left: auto; }

.listing-grid { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.listing-grid > .property-card { display: grid; grid-template-columns: 168px minmax(0, 1fr); align-items: stretch; gap: 24px; padding: 12px; border-radius: 20px; background: transparent; box-shadow: none; transition: background-color var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.listing-grid > .property-card .card-photo, .listing-grid > .property-card:first-child:nth-last-child(odd):not(:only-child) .card-photo { align-self: start; width: 100%; min-width: 0; aspect-ratio: 4 / 3; border-radius: 14px; }
.listing-grid > .property-card .card-photo::after { content: none; }
/* One text group with an even rhythm, centred against the photo. */
.listing-grid > .property-card .card-body { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 0; }
.listing-grid .card-title-row { display: flex; flex-direction: column-reverse; gap: 2px; }
.listing-grid .card-title-row > * { flex: none; }
.listing-grid .card-body h3 { overflow: hidden; margin: 0; font-size: 16px; font-weight: 500; line-height: 24px; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.listing-grid .card-price { font-size: 22px; font-weight: 500; line-height: 28px; letter-spacing: var(--track-head); white-space: nowrap; }
.listing-grid .card-meta { color: var(--muted); font-size: 14px; }
.listing-grid .card-facts { display: flex; flex-wrap: wrap; gap: 0 12px; margin: 8px 0 0; padding: 0; color: var(--muted); font-size: 13px; }
.listing-grid .card-facts b { color: var(--ink); font-weight: 500; }
.listing-grid > .property-card .card-tag { top: 8px; left: 8px; min-height: 24px; padding: 0 8px 0 4px; font-size: 11px; }
.listing-grid > .property-card .save-card { top: 8px; right: 8px; width: 32px; height: 32px; }
.listing-grid > .property-card.is-selected { background: #fff; box-shadow: var(--shadow-2); }
@media (hover: hover) and (pointer: fine) {
    .listing-grid > .property-card:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .72); box-shadow: none; }
    .listing-grid > .property-card.is-selected:hover { background: #fff; box-shadow: var(--shadow-2); }
    .listing-grid > .property-card:hover .card-photo img { transform: scale(1.03); }
}

/* ===== Filters: a drawer at every width ===== */
.filter-rail { position: fixed; z-index: 70; top: 0; left: 0; width: min(400px, 92vw); height: 100dvh; display: flex; flex-direction: column; overflow-y: auto; border: 0; border-radius: 0 var(--radius-panel) var(--radius-panel) 0; background: #fff; box-shadow: none; transform: translateX(-102%); transition: transform .3s var(--ease-drawer, cubic-bezier(.32, .72, 0, 1)); }
.filter-rail.is-open { box-shadow: var(--shadow-float); transform: none; }
.filter-heading { min-height: 72px; padding: 0 16px 0 24px; }
.filter-heading .drawer-close { display: inline-grid; }
.filter-heading #clear-filters { min-height: 36px; margin-left: auto; padding: 0 12px; border-radius: var(--radius-pill); color: var(--ink); font-size: 13px; font-weight: 500; text-decoration: underline; text-decoration-color: var(--n-300); text-underline-offset: 4px; }
.filter-section { flex: 0 0 auto; padding: 24px 24px; border-top: 1px solid var(--rule); }
.filter-label { margin-bottom: 12px; font-size: 14px; font-weight: 500; }
.filter-hint { color: var(--muted); font-size: 13px; }
.filter-apply-bar { position: sticky; bottom: 0; z-index: 6; display: block; margin-top: auto; padding: 16px 24px calc(16px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--rule); }
.filter-apply .action-spinner { display: none; }
.filter-apply.is-counting .action-spinner { display: inline-block; }
.filter-apply b { font-weight: 500; }
.drawer-backdrop { position: fixed; z-index: 65; inset: 0; display: block; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .25s var(--ease), visibility .25s; }
.drawer-backdrop.is-visible { opacity: 1; visibility: visible; pointer-events: auto; }

/* Empty results */
.empty-state h3 { margin: 0 0 8px; }

@media (max-width: 1240px) {
    .workspace { grid-template-columns: minmax(0, 1.15fr) minmax(360px, 1fr); }
    .listing-pane { padding: 24px 24px 64px; }
    .detail-pane { grid-template-columns: minmax(0, 1fr); }
    .detail-actions, .stat-row { grid-column: 1; }
    .stat-row { grid-row: 3; padding-top: 0; }
    .stat-row > div { text-align: left; }
    .detail-block { grid-template-columns: minmax(0, 1fr); }
    .detail-block > h3 { grid-row: auto; }
    .detail-block > :not(h3) { grid-column: 1; }
    #map-block .map-meta { grid-column: 1; }
    #map-block .map-preview { height: 240px; margin-top: 8px; }
    .listing-grid > .property-card { grid-template-columns: 132px minmax(0, 1fr); gap: 16px; }
}

/* Phones and small tablets: the stage becomes a sheet, the index a stream of photographs. */
@media (max-width: 1100px) {
    .workspace { display: block; }
    .detail-pane { position: fixed; z-index: 80; inset: 0; width: 100%; height: 100dvh; padding: 8px 8px 0; overflow-y: auto; }
    .detail-close { position: absolute; z-index: 9; top: 20px; left: 20px; margin: 0; }
    .detail-gallery { height: 62dvh; }
    .detail-summary { padding: 24px; }
    .photo-open { top: 20px; right: 76px; bottom: auto; }
    .detail-actions { position: sticky; z-index: 5; bottom: 0; grid-row: auto; margin: 0 -8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--rule); }
    .detail-actions > * { flex: 1 1 0; }
    .stat-row { grid-row: 2; padding-top: 24px; }
    .listing-pane { padding: 24px 16px 48px; }
    .results-bar h1 { font-size: 32px; line-height: 40px; }
    .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 24px; }
    .listing-grid > .property-card { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 0; }
    .listing-grid > .property-card .card-photo { border-radius: var(--radius-panel); }
    .listing-grid > .property-card .card-tag { top: 12px; left: 12px; min-height: 24px; padding: 0 12px 0 8px; font-size: 12px; }
    .listing-grid > .property-card .save-card { top: 12px; right: 12px; width: 44px; height: 44px; }
    /* Every state, the selected card's hover included, stays a plain photo card; hover only lifts it. */
    .listing-grid > .property-card, .listing-grid > .property-card:is(.is-selected, :hover, .is-selected:hover) { transform: none; background: transparent; box-shadow: none; }
}
@media (max-width: 1100px) and (hover: hover) and (pointer: fine) {
    .listing-grid > .property-card:is(:hover, .is-selected:hover) { transform: translateY(-2px); }
}

@media (max-width: 620px) {
    .index-tools { flex-wrap: wrap; }
    .index-tools .type-counts { order: 2; flex-basis: 100%; max-width: 100%; }
    .mobile-filter-trigger { margin-left: 0; }
    .listing-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    .stat-row { gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .listing-grid > .property-card:hover, .listing-grid > .property-card:hover .card-photo img { transform: none; }
}
