/* =====================================================================================
   A building's page on Rentals (templates/marketplace/rentals/building.html). Built on the
   apartment page's layout (pages/listing.css: gallery, header, sections, side card) and
   the search's card grid (pages/rentals.css); only what is the building's own lives here.
   Colours are the site's tokens, so the dark theme follows.
   ===================================================================================== */

.bd-units { scroll-margin-top: calc(var(--header-h, 64px) + 16px); }

/* ---- The availability table (owner-approved sketch, 2026-10-20; static/site/building-units.js) ---- */
.bd-units-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bd-units-head .ld-h2 { margin-bottom: 0; }
.bd-units-count { font-size: 0.9rem; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bd-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin: 16px 0 14px; }
.bd-toolbar[hidden] { display: none; }
.bd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bd-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: var(--pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer; transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease); }
.bd-chip:hover { border-color: var(--ink-4); color: var(--ink); }
.bd-chip:focus-visible { outline: none; box-shadow: var(--ring); }
.bd-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.bd-chip-n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--pill); background: var(--bg-soft); color: var(--ink-2); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.bd-chip[aria-pressed="true"] .bd-chip-n { background: color-mix(in oklab, var(--bg) 22%, transparent); color: var(--bg); }
.bd-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 700; color: var(--ink-3); }
.bd-sort-select { min-height: 36px; padding: 0 32px 0 12px; border-radius: 10px; border: 1px solid var(--line); background-color: var(--surface); color: var(--ink); font: inherit; font-size: 0.88rem; font-weight: 600; }

.bd-table-wrap { container-type: inline-size; border: 1px solid var(--line); border-radius: var(--r-lg); overflow-x: auto; background: var(--surface); }
.bd-table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.bd-table thead th { padding: 11px 14px; background: var(--bg-soft); color: var(--ink-3); font-size: 0.74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.bd-row { position: relative; transition: background .15s var(--ease); }
.bd-row + .bd-row td { border-top: 1px solid var(--line); }
.bd-row:hover { background: var(--bg-soft); }
.bd-row[hidden] { display: none !important; }
.bd-table td { padding: 12px 14px; vertical-align: middle; color: var(--ink-2); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bd-col-photo { width: 104px; min-width: 104px; }
.bd-col-photo img, .bd-nophoto { display: block; width: 88px; height: 66px; max-width: none; border-radius: 10px; object-fit: cover; background: var(--bg-sunk); }
.bd-nophoto { display: grid; place-items: center; color: var(--ink-4); }
.bd-nophoto .s-ic { width: 22px; height: 22px; }
.bd-link { color: var(--ink); font-weight: 800; text-decoration: none !important; }
.bd-link::after { content: ""; position: absolute; inset: 0; }
.bd-link:focus-visible { outline: none; }
.bd-row:focus-within { box-shadow: inset 0 0 0 2px var(--primary); }
.bd-col-rent strong { font-size: 1.02rem; font-weight: 800; color: var(--ink); letter-spacing: -0.01em; }
.bd-per { margin-left: 1px; font-size: 0.8rem; font-weight: 600; color: var(--ink-3); }
.bd-col-avail .s-avail { font-size: 0.85rem; }
.bd-col-go { width: 40px; text-align: right; color: var(--ink-4); }
.bd-col-go .s-ic { width: 18px; height: 18px; transition: transform .2s var(--ease), color .2s var(--ease); }
.bd-row:hover .bd-col-go .s-ic { transform: translateX(3px); color: var(--primary); }
.bd-table-empty { margin: 0; padding: 28px 16px; text-align: center; color: var(--ink-3); font-weight: 600; }
.bd-table-empty[hidden] { display: none; }

/* A narrow table (a phone, or the main column beside the side card): each row is a compact card - the
   photo, then rent and availability, the unit, the facts. The table's own width decides (container query). */
@container (max-width: 640px) {
  .bd-table, .bd-table tbody { display: block; }
  .bd-table thead { display: none; }
  .bd-row { display: grid; grid-template-columns: 84px auto auto 1fr auto; grid-template-areas: "photo rent rent rent avail" "photo unit unit unit unit" "photo beds baths size size"; column-gap: 12px; row-gap: 3px; align-items: center; padding: 12px 14px; }
  .bd-row + .bd-row { border-top: 1px solid var(--line); }
  .bd-row + .bd-row td { border-top: 0; }
  .bd-table td { padding: 0; white-space: normal; }
  .bd-col-photo { grid-area: photo; width: auto; align-self: start; }
  .bd-col-photo img, .bd-nophoto { width: 84px; height: 66px; }
  .bd-col-rent { grid-area: rent; }
  .bd-col-avail { grid-area: avail; justify-self: end; }
  .bd-col-unit { grid-area: unit; font-size: 0.9rem; }
  .bd-col-beds { grid-area: beds; font-size: 0.84rem; color: var(--ink-3); }
  .bd-col-baths { grid-area: baths; font-size: 0.84rem; color: var(--ink-3); }
  .bd-col-size { grid-area: size; font-size: 0.84rem; color: var(--ink-3); }
  .bd-col-beds::after, .bd-col-baths::after { content: "·"; margin-left: 8px; color: var(--ink-4); }
  .bd-col-go { display: none; }
}

@media (max-width: 720px) {
  .bd-toolbar { align-items: stretch; }
  .bd-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter); scrollbar-width: none; }
  .bd-chips::-webkit-scrollbar { display: none; }
  .bd-chip { flex: none; }
}
.bd-empty { padding: 44px 24px; }
.bd-empty p { margin: 8px auto 18px; max-width: 46ch; color: var(--ink-3); }

.bd-side .ld-contact-top .s-badge { flex: none; }
.bd-side > .s-btn { margin-top: 16px; }
.bd-lister { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); min-width: 0; }
.bd-lister .ld-lister-logo, .bd-lister .ld-lister-mono { width: 44px; height: 44px; border-radius: 12px; font-size: 1.1rem; }
.bd-lister .ld-lister-name { font-size: 0.95rem; }
.bd-lister > div { min-width: 0; }
.bd-lister-mail { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 0.86rem; font-weight: 600; color: var(--link); max-width: 100%; }
.bd-lister-mail span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-lister-mail .s-ic { width: 15px; height: 15px; flex: none; }

.ld-tags .s-badge--flat .s-ic { width: 13px; height: 13px; }

/* One column (pages/listing.css, 960px): the side card follows the apartments, so its jump
   back up to them is left out. */
@media (max-width: 960px) {
  .bd-side .bd-jump { display: none; }
  .bd-side .bd-lister { margin-top: 4px; }
}
