/* ==========================================================================
   Listings — Rentals grid page
   Page head · filter toolbar + phone filter sheet · active-filter chips ·
   results bar · gallery / list / map · help band

   Breakpoints used on this page:
     <= 860px   phones/tablets-portrait: filters collapse behind a button and
                open as a bottom sheet; floating Map/List pill appears
                (860px is also the site header's mobile breakpoint)
     <= 640px   ledger rows stack; shorter map
     <= 560px   results bar stacks; Gallery/List/Map switch goes full width
     >= 1180px  all seven filter controls fit on one row
     >= 1500px  content widens to 1440px and the gallery gets a fourth column
   ========================================================================== */

/* Content width — align with the site chrome (1200px inner)
   ---------------------------------------------------------------------- */

.rentals-wrap {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

/* Elements that carry the `hidden` attribute but also get a display value
   below must still disappear. */
.filter-chips[hidden],
.filter-chips__note[hidden],
.rentals-bar__summary[hidden] {
  display: none;
}

/* The count in the page head and the "Showing N homes" line are written by the script once the
   feed arrives. While the grid is still marked as loading (aria-busy), each holds the room its
   words will take (an invisible stand-in), so the page does not move down under the reader when
   they appear. Once the feed has arrived or failed, or with scripts off, nothing is held. */
html.js main:has(#listings-grid[aria-busy="true"]) #listings-count:empty::before {
  content: "00 homes available today.";
  visibility: hidden;
}

html.js main:has(#listings-grid[aria-busy="true"]) .rentals-bar__summary:empty::before {
  content: "Showing 00 homes";
  visibility: hidden;
}

/* Cards the server drew (js/listings.js, "Cards the server drew"). The page is served with the
   gallery already in it (the grid then carries data-ssr-sig). The placeholder cards are still in
   the page, hidden, for one visitor: the one who comes back with saved filters (html.rentals-wait,
   set by the page's inline script). They see the placeholders, not every home, until the script
   has drawn the homes their filters leave. With scripts off the cards simply show, so the
   "needs JavaScript" message is not shown either. */
#listings-grid[data-ssr-sig] > .listing-skeleton,
#listings-grid[data-ssr-sig] > [role="status"] {
  display: none;
}

html.rentals-wait #listings-grid[data-ssr-sig] > .listing-skeleton {
  display: block;
}

html.rentals-wait #listings-grid[data-ssr-sig] > .listing-card {
  display: none;
}

main:has(#listings-grid[data-ssr-sig]) .listings-empty--noscript {
  display: none;
}

/* Page head
   ---------------------------------------------------------------------- */

.rentals-head {
  padding: var(--space-2xl) 0 var(--space-lg);
}

.rentals-head__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.9rem, 4.4vw, 2.625rem);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  max-width: 24ch;
  margin: 0 0 var(--space-sm);
}

.rentals-head__sub {
  font-size: var(--text-md);
  color: var(--color-stone);
  margin: 0;
  max-width: 60ch;
}

/* Filter toolbar
   ---------------------------------------------------------------------- */

.rentals-toolbar {
  background: var(--color-cream);
  border-top: 1px solid var(--color-pebble);
  border-bottom: 1px solid var(--color-pebble);
}

.rentals-toolbar__inner {
  padding-top: 16px;
  padding-bottom: 16px;
}

/* The controls: a grid, never a ragged flex-wrap.
   861–1179px: two even rows (3 sliders, then 4 selects) on a 12-column grid.
   >= 1180px:  one row of seven. */
.filters-panel {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px 18px;
  align-items: start;
}

/* The body wrapper only matters in the phone sheet; inline, its fields
   take part in the grid directly. */
.filters-panel__body {
  display: contents;
}

.filters-panel__head,
.filters-panel__foot {
  display: none;
}

.filters-panel .filter-field {
  grid-column: span 3;
}

.filters-panel .filter-field--range {
  grid-column: span 4;
}

@media (min-width: 1180px) {
  .filters-panel {
    grid-template-columns:
      repeat(3, minmax(0, 1fr))
      minmax(0, 1.3fr)
      minmax(0, 1.15fr)
      repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
  }

  .filters-panel .filter-field,
  .filters-panel .filter-field--range {
    grid-column: auto;
  }
}

/* A single labelled control (slider or select) */
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.filter-field__label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-stone);
}

/* Toolbar select */
.filter-select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 2.25rem 0 10px;
  font-family: var(--font-body);
  font-size: 0.84rem;
  color: var(--color-charcoal);
  background-color: var(--color-cream);
  border: 1px solid var(--color-pebble);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-overflow: ellipsis;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%236B6560' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.filter-select:focus {
  outline: none;
  border-color: var(--color-brass);
  box-shadow: 0 0 0 2px rgba(140, 123, 102, 0.15);
}

/* Underlined text buttons: the sheet's "Clear" and the chips row's "Clear all" */
.rentals-toolbar__clear,
.filter-chips__clear {
  min-height: 32px;
  padding: 0 2px;
  background: transparent;
  border: 0;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-stone);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

.rentals-toolbar__clear:hover,
.filter-chips__clear:hover {
  color: var(--color-brass);
}

.rentals-toolbar__clear:focus-visible,
.filter-chips__clear:focus-visible,
.filter-chip:focus-visible,
.filters-panel__close:focus-visible,
.filters-toggle:focus-visible,
.map-fab:focus-visible {
  outline: 2px solid var(--color-brass);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Phone-only pieces are off by default (switched on at <= 860px below) */
.filters-toggle,
.filters-scrim,
.map-fab {
  display: none;
}

/* Active-filter chips
   ---------------------------------------------------------------------- */

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 14px;
}

.filter-chips__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px 0 12px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  color: var(--color-charcoal);
  background: var(--color-linen);
  border: 1px solid var(--color-pebble);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast);
}

.filter-chip:hover {
  border-color: var(--color-brass);
  background: var(--color-cream);
}

.filter-chip__x {
  flex-shrink: 0;
  color: var(--color-stone);
  transition: color var(--transition-fast);
}

.filter-chip:hover .filter-chip__x {
  color: var(--color-charcoal);
}

/* The quiet "restored from your last visit" note */
.filter-chips__note {
  font-size: 0.8125rem;
  color: var(--color-stone);
}

/* Range sliders (beds, baths, price) — kept per design brief
   ---------------------------------------------------------------------- */

.range-slider {
  position: relative;
  height: 24px;
}

.range-slider input[type="range"] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 24px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  pointer-events: none;
  z-index: 1;
}

.range-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--color-pebble);
  border-radius: 2px;
}

.range-slider input[type="range"]:first-child::-webkit-slider-runnable-track {
  background: transparent;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-charcoal);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  pointer-events: auto;
  margin-top: -7px;
}

.range-slider input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--color-pebble);
  border-radius: 2px;
  border: none;
}

.range-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-charcoal);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  pointer-events: auto;
}

.range-slider input[type="range"]:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--color-brass);
  outline-offset: 2px;
}

.range-slider input[type="range"]:focus-visible::-moz-range-thumb {
  outline: 2px solid var(--color-brass);
  outline-offset: 2px;
}

.range-slider__values {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-stone);
  font-variant-numeric: tabular-nums lining-nums;
}

/* Results bar — "Showing N homes" + the Gallery / List / Map switch
   ---------------------------------------------------------------------- */

.rentals-results {
  padding: var(--space-lg) 0 var(--space-3xl);
}

.rentals-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 0 0 var(--space-lg);
  /* leave room for the sticky site header when scrolled into view */
  scroll-margin-top: calc(var(--header-h-desktop) + 12px);
}

.rentals-bar__summary {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-stone);
  font-variant-numeric: tabular-nums lining-nums;
}

/* Segmented control (Gallery / List / Map) */
.seg {
  display: flex;
  flex-shrink: 0;
  margin-left: auto;
  border: 1px solid var(--color-pebble);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-cream);
}

.seg__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  min-height: 44px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-charcoal);
  background: var(--color-cream);
  border: 0;
  border-left: 1px solid var(--color-pebble);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.seg__btn svg {
  flex-shrink: 0;
}

.seg__btn:first-child {
  border-left: 0;
}

.seg__btn:hover:not(.is-active) {
  background: var(--color-linen);
}

.seg__btn:focus-visible {
  outline: 2px solid var(--color-brass);
  outline-offset: -4px;
}

.seg__btn.is-active {
  background: var(--color-charcoal);
  color: var(--color-cream);
}

/* Gallery view — photo-forward cards
   ---------------------------------------------------------------------- */

.listings-grid {
  display: grid;
  /* min(310px, 100%) so a 320px phone never gets a column wider than itself */
  grid-template-columns: repeat(auto-fill, minmax(min(310px, 100%), 1fr));
  gap: 28px;
}

/* Gallery card refinements (rentals page only; homepage card untouched) */
.page-rentals .listing-card {
  border-radius: var(--radius-lg);
}

.page-rentals .listing-card__photo {
  aspect-ratio: 4 / 3;
  border-bottom: 1px solid var(--color-pebble);
}

.page-rentals .listing-card:hover .listing-card__photo {
  border-bottom-color: var(--color-brass);
}

.page-rentals .listing-card__content {
  padding: 18px 20px 20px;
}

.page-rentals .listing-card__address {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: var(--text-md);
  line-height: var(--leading-snug);
  margin: 0;
}

.page-rentals .listing-card__city {
  font-size: 0.8125rem;
  color: var(--color-stone);
  margin-top: 2px;
}

.page-rentals .listing-card__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.page-rentals .listing-card__price {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1;
  margin: 0;
  font-variant-numeric: tabular-nums lining-nums;
}

.page-rentals .listing-card__price .per {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--color-stone);
}

.page-rentals .listing-card__meta {
  display: block;
  text-align: right;
  gap: 0;
  font-size: 0.8125rem;
  color: var(--color-stone);
  font-variant-numeric: tabular-nums lining-nums;
}

.page-rentals .listing-card__avail {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--color-stone);
}

.page-rentals .listing-card__avail--now {
  color: var(--color-sage);
}

/* One quiet facts line (laundry · pets) — only present when something
   positive is known, so there is never an empty gap. */
.page-rentals .listing-card__facts {
  margin-top: 6px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--color-stone);
}

/* Loading placeholder — calm, quiet cards until the feed arrives */
.listing-skeleton {
  border: 1px solid var(--color-pebble);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-cream);
  animation: listing-skeleton-breathe 2.4s ease-in-out infinite;
}

.listing-skeleton__photo {
  aspect-ratio: 4 / 3;
  background: var(--color-linen);
  border-bottom: 1px solid var(--color-pebble);
}

.listing-skeleton__body {
  display: grid;
  gap: 10px;
  padding: 18px 20px 22px;
}

.listing-skeleton__bar {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: var(--color-linen);
}

.listing-skeleton__bar--wide { width: 70%; }
.listing-skeleton__bar--mid { width: 45%; }
.listing-skeleton__bar--short { width: 30%; }

@keyframes listing-skeleton-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Without JavaScript nothing fills the page: drop the inert pieces so the
   <noscript> message (and the help band) stand alone. */
html:not(.js) .rentals-toolbar,
html:not(.js) .rentals-bar,
html:not(.js) .listing-skeleton,
html:not(.js) .listings-map {
  display: none;
}

/* List view — typography-led ledger
   ---------------------------------------------------------------------- */

.listings-grid--list {
  display: block;
  border-bottom: 1px solid var(--color-pebble);
}

.ledger-row {
  display: grid;
  grid-template-columns: 1fr 210px;
  gap: 32px;
  align-items: start;
  padding: 26px 12px;
  border-top: 1px solid var(--color-pebble);
  text-decoration: none;
  color: inherit;
  transition: background-color var(--transition-base);
}

.ledger-row:hover {
  background-color: var(--color-linen);
  text-decoration: none;
  color: inherit;
}

.ledger-row__address {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  color: var(--color-charcoal);
}

.ledger-row__meta {
  font-size: var(--text-sm);
  color: var(--color-stone);
  margin-top: 6px;
  font-variant-numeric: tabular-nums lining-nums;
}

.ledger-row__blurb {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: var(--text-base);
  color: var(--color-stone);
  margin-top: 10px;
  max-width: 62ch;
  line-height: var(--leading-normal);
}

.ledger-row__aside {
  text-align: right;
}

.ledger-row__price {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-lg);
  line-height: 1;
  color: var(--color-charcoal);
  font-variant-numeric: tabular-nums lining-nums;
}

.ledger-row__price .per {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--text-sm);
  color: var(--color-stone);
}

.ledger-row__avail {
  margin-top: 6px;
  font-size: var(--text-sm);
  color: var(--color-stone);
}

.ledger-row__avail--now {
  color: var(--color-sage);
}

.ledger-row__link {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--color-charcoal);
  transition: color var(--transition-fast);
}

.ledger-row:hover .ledger-row__link {
  color: var(--color-brass);
}

/* Map view
   ---------------------------------------------------------------------- */

.listings-map {
  width: 100%;
  height: 600px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-pebble);
}

/* Empty / no-match / error states
   ---------------------------------------------------------------------- */

.listings-empty {
  text-align: center;
  padding: var(--space-4xl) var(--space-lg);
  color: var(--color-stone);
}

.listings-empty__title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: var(--text-xl);
  color: var(--color-charcoal);
  margin-bottom: var(--space-md);
}

.listings-empty__description {
  max-width: 46ch;
  margin: 0 auto var(--space-lg);
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
}

/* Help band
   ---------------------------------------------------------------------- */

.rentals-help {
  background: var(--color-linen);
}

.rentals-help__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

.rentals-help__title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: var(--text-lg);
  color: var(--color-charcoal);
}

.rentals-help__text {
  font-size: 0.9rem;
  color: var(--color-stone);
  margin-top: 6px;
}

.rentals-help__text a {
  color: var(--color-charcoal);
  font-weight: 500;
}

.rentals-help__text a:hover {
  color: var(--color-brass);
}

/* Wide screens: a fourth column of cards
   ---------------------------------------------------------------------- */

@media (min-width: 1500px) {
  .rentals-wrap {
    max-width: 1440px;
  }

  /* Keep the site header and footer on the same left and right edges as the
     wider content, on this page only (they stay 1200px everywhere else). */
  .page-rentals .chrome-switcher-inner,
  .page-rentals .chrome-logo-bar-inner,
  .page-rentals .chrome-nav-row-inner,
  .page-rentals .footer-container {
    max-width: 1440px;
  }

  .listings-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Responsive
   ---------------------------------------------------------------------- */

/* Phones (and tablets in portrait): filters collapse behind a button */
@media (max-width: 860px) {
  .rentals-head {
    padding: var(--space-xl) 0 var(--space-md);
  }

  .rentals-head__sub {
    font-size: var(--text-base);
  }

  .rentals-toolbar__inner {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .rentals-results {
    padding-top: var(--space-md);
  }

  .rentals-bar {
    scroll-margin-top: calc(var(--header-h-mobile) + 12px);
  }

  /* The "Filters · N" button */
  .filters-toggle {
    display: inline-flex;
    align-items: center;
    vertical-align: top;
    gap: 10px;
    min-height: 44px;
    padding: 0 16px;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-charcoal);
    background: var(--color-cream);
    border: 1px solid var(--color-charcoal);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--transition-fast);
  }

  .filters-toggle:hover,
  .filters-toggle.has-filters {
    background: var(--color-linen);
  }

  .filters-toggle__icon {
    flex-shrink: 0;
  }

  .filters-toggle__count {
    font-variant-numeric: tabular-nums lining-nums;
  }

  .filter-chips {
    margin-top: 12px;
  }

  /* While the sheet is open the page behind it doesn't scroll */
  html.filters-open {
    overflow: hidden;
  }

  .filters-scrim {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 55;
    background: rgba(30, 27, 24, 0.45);
    touch-action: none;
    opacity: 0;
    visibility: hidden;
    transition:
      opacity var(--transition-base),
      visibility 0s linear 250ms;
  }

  .filters-scrim.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-base);
  }

  /* The filter controls become a bottom sheet */
  .filters-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    max-height: 88vh;
    max-height: 88dvh;
    background: var(--color-cream);
    border: 1px solid var(--color-pebble);
    border-bottom: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    visibility: hidden;
    transform: translateY(100%);
    transition:
      transform var(--transition-base),
      visibility 0s linear 250ms;
  }

  .filters-panel.is-open {
    visibility: visible;
    transform: none;
    transition: transform var(--transition-base);
  }

  .filters-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 6px 12px 6px 20px;
    border-bottom: 1px solid var(--color-pebble);
  }

  .filters-panel__title {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: var(--text-lg);
    line-height: var(--leading-snug);
    outline: none;
  }

  .filters-panel__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--color-charcoal);
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
  }

  .filters-panel__close:hover {
    background: var(--color-linen);
  }

  .filters-panel__body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 14px;
    flex: 1 1 auto;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .filters-panel .filter-field,
  .filters-panel .filter-field--range {
    grid-column: auto;
  }

  .filters-panel .filter-field--range,
  .filters-panel .filter-field--wide {
    grid-column: 1 / -1;
  }

  .filter-select {
    height: 44px;
    font-size: 0.9375rem;
  }

  /* Bigger thumbs for fingers (same look, same sliders) */
  .range-slider {
    height: 28px;
  }

  .range-slider input[type="range"] {
    height: 28px;
  }

  .range-slider input[type="range"]::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -10px;
  }

  .range-slider input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }

  .filters-panel__foot {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--color-pebble);
    background: var(--color-cream);
  }

  /* Keep the primary button clear of the round feedback button (office
     browsers only) fixed at the bottom right. */
  body:has(#whp-fb-btn) .filters-panel__foot {
    padding-right: 84px;
  }

  .filters-panel__apply {
    flex: 1 1 auto;
    min-height: 48px;
  }

  /* Floating Map / List pill — bottom centre, well clear of the feedback
     button at bottom right (24px in, 48px wide). Fades in once the
     Gallery / List / Map switch has scrolled out of view. */
  .map-fab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    left: 50%;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    z-index: 40;
    min-height: 46px;
    padding: 0 22px 0 18px;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: var(--tracking-wide);
    color: var(--color-cream);
    background: var(--color-charcoal);
    border: 1px solid var(--color-charcoal);
    border-radius: 999px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 10px);
    transition:
      opacity var(--transition-base),
      transform var(--transition-base),
      background-color var(--transition-fast),
      visibility 0s linear 250ms;
  }

  .map-fab.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    transition:
      opacity var(--transition-base),
      transform var(--transition-base),
      background-color var(--transition-fast);
  }

  .map-fab:hover {
    background: var(--color-brass);
    border-color: var(--color-brass);
  }

  .map-fab:focus-visible {
    outline-offset: 3px;
    border-radius: 999px;
  }

  .map-fab[data-mode="map"] .map-fab__icon--list,
  .map-fab[data-mode="list"] .map-fab__icon--map {
    display: none;
  }

  /* Cards stay out from under the pill's footprint at the very end */
  .rentals-results {
    padding-bottom: var(--space-3xl);
  }
}

@media (max-width: 640px) {
  .ledger-row {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .ledger-row__aside {
    text-align: left;
  }

  .listings-map {
    height: 420px;
  }

  .rentals-head {
    padding: var(--space-lg) 0 var(--space-md);
  }

  /* Three placeholder cards are plenty on a phone */
  .listing-skeleton:nth-of-type(n + 3) {
    display: none;
  }
}

@media (max-width: 560px) {
  .filters-toggle {
    width: 100%;
    justify-content: center;
  }

  .rentals-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .seg {
    width: 100%;
    margin-left: 0;
  }

  .seg__btn {
    flex: 1;
    padding: 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .filters-panel,
  .filters-scrim,
  .map-fab {
    transition: none;
  }

  .listing-skeleton {
    animation: none;
  }
}
