/* ==========================================================================
   pages/listings.css — property search, My listings and the listing page (docs/DESIGN.md §4).
   1 search head + filter bar · 2 results bar, tags, map · 3 search alert · 4 listing detail · 5 lightbox ·
   6 mobile bar · 7 print (the property sheet)
   ========================================================================== */

/* ---------- 1. Search head and filter bar ---------- */
.results-top{ padding-top:clamp(40px,5vw,72px); padding-bottom:clamp(28px,3vw,40px); }
.results-head .eyebrow{ margin-bottom:16px; }
.results-head__title{ font-size:clamp(36px,4.2vw,60px); max-width:22ch; }

.filter-bar{ position:relative; display:flex; flex-wrap:wrap; align-items:stretch; margin-top:32px; border-top:1px solid var(--ink); border-bottom:1px solid var(--line); }
.filter-bar__search{
  flex:1 1 260px; min-width:0; height:56px; padding:0 4px; border:0; border-radius:0; background:transparent;
  font:300 16px/1 var(--sans); color:var(--ink); -webkit-appearance:none; appearance:none;
}
.filter-bar__search::placeholder{ color:var(--taupe); opacity:1; }
.filter-bar__search:focus{ outline:none; box-shadow:inset 0 -2px 0 var(--ink); }
.filter-bar__pill{ position:relative; }
.filter-bar__summary,.filter-sheet__trigger{
  display:flex; align-items:center; gap:10px; height:56px; padding:0 20px; list-style:none; cursor:pointer; border-left:1px solid var(--line);
  font:500 11px/1 var(--sans); letter-spacing:.18em; text-transform:uppercase; color:var(--ink-2); white-space:nowrap;
}
.filter-bar__summary::-webkit-details-marker,.filter-sheet__trigger::-webkit-details-marker{ display:none; }
.filter-bar__summary::after{ content:""; width:7px; height:7px; margin-top:-4px; border-right:1px solid currentColor; border-bottom:1px solid currentColor; transform:rotate(45deg); transition:transform .3s var(--ease); }
.filter-bar__pill[open] > .filter-bar__summary::after{ transform:rotate(-135deg); margin-top:4px; }
.filter-bar__summary:hover,.filter-sheet__trigger:hover{ color:var(--ink); }
.filter-bar__summary.is-active{ color:var(--ink); }
.filter-bar__summary.is-active span{ box-shadow:inset 0 -1px 0 var(--red); padding-bottom:2px; }
.filter-sheet__trigger .icon{ width:16px; height:16px; }
.filter-sheet__count{ color:var(--taupe); }
.filter-bar__panel{
  position:absolute; top:calc(100% + 1px); right:0; z-index:30; display:grid; gap:18px; width:max(300px,100%); min-width:300px; padding:24px;
  background:var(--ivory); border:1px solid var(--line); box-shadow:0 18px 40px rgba(17,17,17,.06);
}
.filter-sheet__options{ display:grid; gap:10px; }
.filter-sheet__options .field--check{ align-items:center; }
.filter-sheet__options input{ margin:0; }
.filter-sheet__row{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.filter-sheet__legend{ margin-bottom:12px; font:500 var(--fs-eyebrow)/1.4 var(--sans); letter-spacing:.2em; text-transform:uppercase; color:var(--ink-2); padding:0; }
.filter-bar__panel .field__label{ margin-top:4px; }

.filter-sheet__panel{
  position:fixed; top:0; right:0; bottom:0; z-index:80; display:flex; flex-direction:column; width:min(460px,100%);
  background:var(--ivory); box-shadow:0 0 0 100vmax rgba(17,17,17,.35);
}
.filter-sheet__header{ display:flex; align-items:center; justify-content:space-between; gap:16px; padding:20px 28px; border-bottom:1px solid var(--line); }
.filter-sheet__header h2{ font-size:30px; margin-right:auto; }
.dialog__close{ display:inline-flex; padding:8px; border:0; background:none; color:var(--ink); }
.filter-sheet__body{ flex:1 1 auto; overflow-y:auto; padding:8px 28px 28px; }
.filter-sheet__section{ padding:24px 0; margin:0; border:0; border-bottom:1px solid var(--line); min-inline-size:0; }
.filter-sheet__section .field__hint{ margin-top:10px; }
.filter-sheet__footer{ padding:20px 28px; border-top:1px solid var(--line); }
@media (max-width:899px){
  .filter-bar__pill{ display:none; }
  .filter-sheet{ flex:1 1 100%; }
  .filter-sheet__trigger{ width:100%; border-left:0; border-top:1px solid var(--line); padding-inline:4px; }
}

/* ---------- 2. Results bar, filter tags, list / map ---------- */
.results-bar{ margin-bottom:40px; }
.results-head__bar{ display:flex; flex-wrap:wrap; align-items:center; gap:14px 28px; }
.results-head__meta{ margin-right:auto; font-size:13px; color:var(--taupe); }
.results-head__meta strong{ color:var(--ink); font-weight:500; }
.results-head__sort{ display:inline-flex; align-items:center; gap:10px; font:500 11px/1 var(--sans); letter-spacing:.18em; text-transform:uppercase; color:var(--taupe); }
.results-head__sort select{
  height:36px; padding:0 22px 0 0; border:0; border-bottom:1px solid var(--line-strong); border-radius:0; background:transparent;
  font:400 14px/1 var(--sans); letter-spacing:0; text-transform:none; color:var(--ink); -webkit-appearance:none; appearance:none;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23111' stroke-width='1.2'/%3E%3C/svg%3E") right 2px center / 10px 7px no-repeat;
}
.view-toggle{ display:inline-flex; gap:20px; }
.view-toggle__option{ padding:6px 0; border:0; background:none; font:500 11px/1 var(--sans); letter-spacing:.18em; text-transform:uppercase; color:var(--taupe); }
.view-toggle__option[aria-pressed="true"]{ color:var(--ink); box-shadow:inset 0 -1px 0 var(--ink); }
.chip-row{ display:flex; flex-wrap:wrap; align-items:center; gap:10px 12px; margin-bottom:32px; }
.chip-row__label{ font-size:12.5px; color:var(--taupe); margin-right:4px; }
.chip-row__clear{ margin-left:8px; }
.filter-tag{ display:inline-flex; align-items:center; gap:8px; padding:7px 12px; border:1px solid var(--line-strong); font-size:13px; text-decoration:none; color:var(--ink-2); }
.filter-tag:hover{ border-color:var(--ink); color:var(--ink); }
.filter-tag__x{ width:13px; height:13px; }

.results-body,.results-body__list{ display:grid; grid-template-columns:minmax(0,1fr); gap:48px; min-width:0; }
.results-map{ display:grid; gap:12px; min-width:0; }
.results-map__canvas{ height:min(70vh,560px); background:var(--sand); border:1px solid var(--line); }
@media (min-width:1100px){
  .results-body[data-view="map"]{ grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); align-items:start; }
  .results-body[data-view="map"] > .results-body__list{ grid-column:1; grid-row:1; }
  .results-body[data-view="map"] > .results-map{ grid-column:2; grid-row:1; position:sticky; top:calc(var(--header-h) + 16px); }
  .results-body[data-view="map"] .results-map__canvas{ height:calc(100vh - var(--header-h) - 96px); min-height:360px; }
  .results-body[data-view="map"] .listing-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); }
}
.results-map__note{ font-size:12px; line-height:1.5; color:var(--taupe); }
.results-map__error{ display:grid; place-items:center; height:100%; padding:24px; text-align:center; font-size:14px; color:var(--ink-2); }
.results-map .leaflet-container{ font:400 14px/1.45 var(--sans); background:var(--sand); }
.results-map .leaflet-container:focus-visible{ box-shadow:inset 0 0 0 2px var(--ink); }
.results-map .leaflet-control-attribution{ font-size:10.5px; }
.results-map .leaflet-bar{ border:1px solid var(--line-strong); border-radius:0; box-shadow:none; }
.results-map .leaflet-bar a{ width:40px; height:40px; line-height:38px; font-size:20px; color:var(--ink); background:var(--ivory); border-radius:0 !important; }
.map-pin{ display:inline-block; padding:5px 10px; background:var(--ivory); border:1px solid var(--ink); font:500 12px/1 var(--sans); color:var(--ink); white-space:nowrap; }
.map-pin.is-active{ background:var(--ink); color:var(--ivory); }
.results-map__marker{ background:none; border:0; }
.results-map__marker:focus-visible{ box-shadow:none; outline:0; }
.results-map__marker > .map-pin{ position:absolute; left:0; bottom:7px; transform:translateX(-50%); cursor:pointer; }
.results-map__marker > .map-pin::after{ content:""; position:absolute; left:50%; top:100%; width:0; height:0; margin-left:-5px; border:5px solid transparent; border-top-color:var(--ink); }
.results-map__marker:hover > .map-pin{ background:var(--ink); color:var(--ivory); }
.results-map__marker:focus-visible > .map-pin{ box-shadow:var(--focus); }
.results-map__marker > .results-map__anchor{ display:grid; place-items:center; width:28px; height:28px; padding:0; border-radius:50%; background:var(--taupe); border-color:var(--taupe); color:#fff; transform:translate(-50%,50%); bottom:0; }
.results-map__marker > .results-map__anchor::after{ content:none; }
.results-map__anchor .icon{ width:15px; height:15px; }
.results-map .leaflet-popup-content-wrapper{ padding:0; overflow:hidden; border-radius:0; background:var(--ivory); color:var(--ink); box-shadow:0 18px 40px rgba(17,17,17,.12); }
.results-map .leaflet-popup-content{ margin:0; font-size:14px; line-height:1.45; }
.results-map .leaflet-popup-content p{ margin:0; }
.results-map .leaflet-popup-tip{ background:var(--ivory); }
.results-map .leaflet-container a.leaflet-popup-close-button{ top:6px; right:6px; width:30px; height:30px; background:var(--ivory); color:var(--ink); font:400 22px/30px var(--sans); }
.map-card{ display:grid; }
.map-card__img{ display:block; width:100%; height:130px; object-fit:cover; background:var(--sand); }
.map-card__body{ display:grid; gap:4px; padding:14px 16px 16px; }
.map-card--anchor .map-card__body{ padding-right:44px; }
.map-card__type{ font:500 10px/1.3 var(--sans); letter-spacing:.2em; text-transform:uppercase; color:var(--taupe); }
.map-card__price{ font:400 24px/1.15 var(--serif); }
.map-card__unit{ font:400 13px/1 var(--sans); color:var(--taupe); }
.map-card__facts{ color:var(--ink-2); font-size:13px; }
.map-card__address{ font-size:14px; }
.results-map .map-card__link{ justify-self:start; margin-top:8px; min-height:38px; padding:0 16px; font-size:10.5px; background:var(--ink); color:var(--ivory); }
.results-map .map-card__more{ justify-self:start; font-weight:500; text-decoration:underline; }
.map-card__credit{ margin-top:6px; font-size:11px; }

.pagination{ display:grid; justify-items:center; gap:16px; margin-top:24px; }
.pagination__summary{ font-size:13px; color:var(--taupe); }
.pagination__list{ display:flex; flex-wrap:wrap; justify-content:center; gap:4px; list-style:none; margin:0; padding:0; }
.pagination__link{ display:inline-flex; align-items:center; justify-content:center; gap:6px; min-width:44px; height:44px; padding:0 12px; font-size:14px; text-decoration:none; color:var(--ink-2); border:1px solid transparent; }
a.pagination__link:hover{ border-color:var(--line-strong); color:var(--ink); }
.pagination__link[aria-current]{ border-color:var(--ink); color:var(--ink); }
.pagination__link[aria-disabled]{ color:var(--line-strong); }
.pagination__ellipsis{ display:inline-flex; align-items:center; height:44px; color:var(--taupe); }

.listing-group + .listing-group{ margin-top:clamp(72px,8vw,112px); }
.listing-group__title{ display:flex; align-items:baseline; gap:14px; margin-bottom:40px; padding-bottom:16px; border-bottom:1px solid var(--line); font-size:var(--fs-h3); }
.listing-group__count{ font:400 13px/1 var(--sans); color:var(--taupe); }
.listing-more{ margin-top:64px; text-align:center; }

/* ---------- 3. "New listings like these" ---------- */
.search-alert{ display:grid; grid-template-columns:minmax(0,1fr); gap:40px; margin-top:clamp(72px,8vw,112px); padding:clamp(32px,4vw,56px); background:var(--sand); }
.search-alert__title{ font-size:clamp(30px,3vw,42px); }
.search-alert__text{ margin-top:14px; max-width:44ch; color:var(--ink-2); }
.search-alert__search{ margin-top:20px; font-size:13.5px; color:var(--ink-2); }
.search-alert__label{ display:block; margin-bottom:4px; font:500 10.5px/1.4 var(--sans); letter-spacing:.2em; text-transform:uppercase; color:var(--taupe); }
@media (min-width:1024px){ .search-alert{ grid-template-columns:5fr 6fr; gap:64px; } }

/* ---------- 4. Listing detail ---------- */
.listing__print-head,.listing__print-contact{ display:none; }
.listing__gallery{ position:relative; padding-top:clamp(16px,2vw,32px); }
.gallery{ display:flex; gap:8px; overflow-x:auto; scroll-snap-type:x mandatory; scrollbar-width:none; margin-inline:calc(var(--gutter) * -1); padding-inline:var(--gutter); }
.gallery::-webkit-scrollbar{ display:none; }
.gallery img{ flex:0 0 calc(100% - 40px); aspect-ratio:4 / 3; height:auto; object-fit:cover; scroll-snap-align:center; background:var(--sand); }
.gallery--single img{ flex-basis:100%; }
.gallery[data-zoom] img{ cursor:zoom-in; }
.gallery__count{
  position:absolute; right:calc(var(--gutter) + 16px); bottom:16px; padding:12px 18px; border:0; background:var(--ivory); color:var(--ink);
  font:500 10.5px/1 var(--sans); letter-spacing:.2em; text-transform:uppercase;
}
.gallery__count:hover{ background:var(--ink); color:var(--ivory); }
@media (min-width:980px){
  .gallery{ display:grid; overflow:visible; margin:0; padding:0; }
  .gallery--trio{ grid-template-columns:minmax(0,2fr) minmax(0,1fr); grid-template-rows:repeat(2,minmax(0,1fr)); height:min(68vh,640px); overflow:hidden; }
  .gallery--trio img{ width:100%; height:100%; min-height:0; aspect-ratio:auto; }
  .gallery--trio .gallery__main{ grid-row:1 / span 2; }
  .gallery--trio img:nth-child(n+4){ display:none; }
  .gallery--single{ grid-template-columns:1fr; }
  .gallery--single img{ aspect-ratio:16 / 9; max-height:640px; width:100%; }
  .gallery--single img:nth-child(n+2){ display:none; }
}

.detail{ display:grid; gap:64px; padding-block:clamp(40px,5vw,72px) clamp(64px,8vw,112px); }
@media (min-width:1024px){
  .detail{ grid-template-columns:minmax(0,1fr) 400px; gap:clamp(56px,7vw,112px); align-items:start; }
  .detail__rail{ position:sticky; top:calc(var(--header-h) + 24px); }
}
.price-block .eyebrow{ margin-bottom:18px; }
.price-block__address{ font-size:clamp(32px,3.2vw,48px); max-width:24ch; }
.price-block__price{ margin-top:14px; font:400 clamp(28px,2.6vw,38px)/1.1 var(--serif); }
.price-block__note{ margin-top:10px; font-size:14px; color:var(--ink-2); max-width:60ch; }
.price-block__stats{ display:flex; flex-wrap:wrap; gap:16px clamp(28px,4vw,56px); margin:32px 0 20px; padding:22px 0; border-block:1px solid var(--line); }
.price-block__stats > div{ display:flex; flex-direction:column-reverse; gap:6px; }
.price-block__stats dd{ font:400 30px/1 var(--serif); }
.price-block__stats dt{ font:500 10.5px/1.2 var(--sans); letter-spacing:.2em; text-transform:uppercase; color:var(--taupe); }
.listing-tools{ display:flex; flex-wrap:wrap; align-items:center; gap:16px 32px; margin-top:24px; }
.share{ display:flex; flex-wrap:wrap; align-items:center; gap:8px 20px; }
.share__label{ font:500 10.5px/1 var(--sans); letter-spacing:.2em; text-transform:uppercase; color:var(--taupe); }
.share__list{ display:flex; flex-wrap:wrap; gap:8px 20px; list-style:none; margin:0; padding:0; }
.share__btn{ padding:4px 0; border:0; background:none; font:500 11px/1 var(--sans); letter-spacing:.16em; text-transform:uppercase; color:var(--ink); text-decoration:underline; text-underline-offset:.4em; }
.share__manual input{ min-width:260px; }
.share__status{ font-size:12.5px; color:var(--taupe); }
.listing__section{ margin-top:56px; padding-top:48px; border-top:1px solid var(--line); }
.listing__heading{ margin-bottom:24px; font-size:var(--fs-h3); }
.listing__note{ margin-bottom:12px; font-size:13.5px; color:var(--taupe); }
.listing__section .prose{ color:var(--ink-2); }
.listing__place{ display:flex; flex-wrap:wrap; align-items:center; gap:12px 28px; }
.facts{ display:grid; grid-template-columns:minmax(0,1fr); column-gap:48px; }
@media (min-width:700px){ .facts{ grid-template-columns:repeat(2,minmax(0,1fr)); } }
.facts__row{ display:flex; justify-content:space-between; gap:16px; padding:13px 0; border-bottom:1px solid var(--line); font-size:15px; }
.facts__row dt{ color:var(--taupe); }
.facts__row dd{ text-align:right; color:var(--ink); }

.agent-panel{ display:grid; gap:24px; padding:32px; border:1px solid var(--line); background:var(--ivory); }
.agent-panel__head{ display:flex; align-items:center; gap:18px; }
.agent-panel__photo{ width:72px; height:72px; object-fit:cover; }
.agent-panel__name{ font-size:30px; }
.agent-panel__meta{ margin-top:4px; font-size:12.5px; line-height:1.6; color:var(--taupe); }
.agent-panel__phone{ padding-bottom:20px; border-bottom:1px solid var(--line); font:400 26px/1 var(--serif); }
.agent-panel__phone a{ text-decoration:none; }
.agent-panel .lead-form__grid{ grid-template-columns:minmax(0,1fr); }
.agent-panel .lead-form__heading{ font-size:26px; }
.agent-panel .lead-form__actions .btn{ width:100%; }
.agent-panel .field--full{ grid-column:auto; }

.listing__legal{ font-size:12.5px; line-height:1.65; color:var(--taupe); }
.idx-attribution--block{ display:grid; gap:4px; }
.idx-attribution__line{ color:var(--ink-2); }
.idx-attribution--block a{ color:var(--ink-2); }
.listing__legal .notice--mls{ margin-top:24px; }

/* ---------- 5. Lightbox ---------- */
.lightbox{ width:100vw; max-width:none; height:100vh; max-height:none; margin:0; padding:0; border:0; background:var(--ink); color:var(--on-dark); }
.lightbox::backdrop{ background:var(--ink); }
.lightbox[open]{ display:flex; flex-direction:column; }
.lightbox__bar{ display:flex; justify-content:space-between; align-items:center; padding:16px var(--gutter); }
.lightbox__counter{ font:500 11px/1 var(--sans); letter-spacing:.2em; }
.lightbox__close{ display:inline-flex; padding:8px; border:0; background:none; color:var(--on-dark); }
.lightbox__close .icon{ width:24px; height:24px; }
.lightbox__stage{ position:relative; flex:1 1 auto; display:grid; place-items:center; min-height:0; padding:0 64px; }
.lightbox__img{ max-width:100%; max-height:calc(100vh - 140px); width:auto; height:auto; object-fit:contain; }
.lightbox__prev,.lightbox__next{ position:absolute; top:50%; transform:translateY(-50%); display:grid; place-items:center; width:48px; height:48px; border:1px solid var(--line-dark); background:transparent; color:var(--on-dark); }
.lightbox__prev{ left:12px; }
.lightbox__next{ right:12px; }
.lightbox__prev:hover,.lightbox__next:hover{ background:var(--on-dark); color:var(--ink); }
.lightbox__caption{ padding:14px var(--gutter) 20px; font-size:13px; color:var(--on-dark-2); text-align:center; }

/* ---------- 6. Mobile bar (listing page, below 1024px) ---------- */
.mobile-cta{ display:none; }
@media (max-width:1023px){
  .page-listing .mobile-cta{
    position:fixed; left:0; right:0; bottom:0; z-index:40; display:flex; align-items:center; justify-content:space-between; gap:16px;
    padding:10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background:var(--ivory); border-top:1px solid var(--line);
  }
  .page-listing .site-footer{ padding-bottom:72px; }
  .mobile-cta__price{ display:grid; line-height:1.2; }
  .mobile-cta__price b{ font:400 22px/1.1 var(--serif); }
  .mobile-cta__price span{ font-size:11px; color:var(--taupe); }
}

/* Lining figures for the serif numbers (Cormorant defaults to old-style). */
.price-block__price,.price-block__stats dd,.agent-panel__phone,.map-card__price,.mobile-cta__price b{ font-variant-numeric:lining-nums; }

/* ---------- 7. Print: the property sheet ---------- */
@media print{
  .listing__print-head,.listing__print-contact{ display:block; }
  .listing__print-head{ margin-bottom:12px; font-size:10pt; }
  .gallery{ display:block !important; height:auto !important; }
  .gallery img{ display:none !important; }
  .gallery .gallery__main{ display:block !important; width:100%; max-height:9cm; object-fit:cover; }
  .gallery__count,.listing-tools,.lead-form,.listing__related,.results-map,.view-toggle,.filter-bar,.filter-sheet,.search-alert,.lightbox{ display:none !important; }
  .detail{ display:block; padding:12px 0; }
  .detail__rail{ position:static; margin-top:16px; }
  .agent-panel{ border:1px solid #999; padding:12px; }
  .listing__print-contact div{ display:flex; gap:8px; }
  .listing__section{ margin-top:16px; padding-top:12px; }
}
