/* listings.css: page-scoped styles for /listings and /listing, loaded after
   styles.css by those two pages only. Everything shared (cards, ribbons,
   tabs, the gallery basics, .facts, .price) lives in styles.css; this file
   adds the toolbar, the count line, the detail layout, the gallery controls
   and the CTA box. Tokens come from styles.css. No hover-only information:
   Jas's visitors arrive from Instagram on a phone (Trevor's rule,
   2026-07-10, kb/site-quality/phone-tool-standard.md). */

/* ============ /listings: toolbar ============ */
.listings-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 24px;
  margin-bottom: 22px;
}
.listings-toolbar .tabs { margin-bottom: 0; flex: 1 1 auto; }
/* Tabs are real buttons; 44px tall for a thumb. */
.tab { min-height: 44px; }

.filter { display: flex; align-items: center; gap: 10px; }
.filter__label { font-size: 14px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.filter__select {
  min-height: 44px;
  padding: 8px 40px 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230F1B33' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  color: var(--ink);
  font-size: 15px;
  appearance: none;
  -webkit-appearance: none;
  max-width: 100%;
}
.filter__select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(59, 89, 152, 0.25); }
.filter__select:disabled { opacity: 0.6; cursor: not-allowed; }

/* The count line: "11 sold homes in Calgary". Large enough for --ink-soft
   to be avoided; it stays --ink-2. */
.listings-count { font-size: 14px; color: var(--ink-2); margin: 0 0 18px; min-height: 1.5em; }

/* Tab panels: the hidden attribute does the switching; this only keeps
   the grid from jumping while rows arrive. */
.listings-panel { min-height: 120px; }
.listings-panel:focus { outline: none; }
.listing-grid[aria-busy="true"] { opacity: 0.6; }

/* ============ /listing: states ============ */
.listing-status {
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 26px 28px;
  background: var(--surface);
  color: var(--ink-2);
  margin: 0 0 32px;
}
.listing-status p { margin: 0; }
.listing-status noscript p { margin-top: 10px; }

/* Not found, or the API is down: the 404 look, a size down. */
.listing-missing { text-align: center; padding: clamp(40px, 7vw, 80px) 0 clamp(52px, 8vw, 96px); }
.listing-missing__mark { width: 64px; height: auto; margin: 0 auto 18px; opacity: 0.55; }
.listing-missing h1 { font-size: clamp(28px, 4vw, 40px); }
.listing-missing p { max-width: 52ch; margin-left: auto; margin-right: auto; }
.listing-missing__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 22px; }

/* ============ /listing: layout ============ */
.listing-detail { display: grid; gap: clamp(28px, 4vw, 48px); margin-bottom: clamp(48px, 7vw, 80px); }
@media (min-width: 900px) {
  .listing-detail { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
  .listing-detail__gallery { position: sticky; top: calc(var(--bar-h) + 20px); }
}
.listing-detail__head { display: grid; gap: 8px; margin-bottom: 18px; }
.listing-detail__head .ribbon { justify-self: start; }
.listing-detail__title { font-size: clamp(30px, 3.8vw, 44px); margin: 4px 0 0; }
.listing-detail__place { font-size: 16px; color: var(--ink-2); margin: 0; }
.listing-detail__headline {
  font-family: var(--font-display);
  font-size: clamp(19px, 2vw, 23px);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin: 8px 0 0;
}
.listing-detail__price { margin-top: 6px; }
.listing-detail__price-note { font-size: 14px; color: var(--ink-2); margin: -2px 0 14px; }

/* Listed / sold dates and the MLS number: a quiet definition list. */
.listing-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 1.4em; padding: 0; font-size: 14px; color: var(--ink-2); }
.listing-meta div { display: inline-flex; gap: 6px; }
.listing-meta dt { font-weight: 500; color: var(--ink); }
.listing-meta dt::after { content: ':'; }
.listing-meta dd { margin: 0; }

.listing-desc { margin: 0 0 1.6em; }
.listing-desc h2 { font-size: clamp(22px, 2.4vw, 26px); margin-bottom: 10px; }
.listing-desc p { margin-bottom: 1em; }
.listing-desc p:last-child { margin-bottom: 0; }

/* ============ /listing: gallery ============ */
/* pan-y: a horizontal swipe changes the photo (pointer events in
   listing-detail.js); a vertical one still scrolls the page. */
.gallery__stage { touch-action: pan-y; }
.gallery__stage img { transition: opacity 0.18s ease; }
.gallery__stage.is-swapping img { opacity: 0.4; }
.gallery__stage img.gallery__img--placeholder { object-fit: contain; padding: 22%; opacity: 0.35; }
/* Square and portrait photos sit whole on the grey rather than being cropped
   to 4:3 (set by listing-detail.js from the photo's own dimensions). */
.gallery__stage img.gallery__img--contain { object-fit: contain; }

/* Previous / Next: always visible, 44px, bottom right of the stage, so a
   thumb reaches them and nothing depends on a hover. */
.gallery__nav {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
  z-index: 2;
}
.gallery__btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  background: rgba(15, 27, 51, 0.72);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.18s ease, transform 0.18s var(--ease);
}
.gallery__btn svg { width: 20px; height: 20px; }
.gallery__btn:hover { background: var(--navy); transform: translateY(-1px); }
.gallery__btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.gallery__btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* "Photo 2 of 6" and the photo's own caption, printed, never hovered. */
.gallery__count {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 4px;
  background: rgba(15, 27, 51, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  margin: 0;
}
.gallery__caption { font-size: 14px; color: var(--ink-2); margin: 0; min-height: 1.4em; }

/* Thumbnails: 84x64 tiles from styles.css; here only the touch spacing
   and the keyboard focus ring inside the scroller. */
.gallery__thumbs { padding: 6px 4px; gap: 10px; scroll-snap-type: x proximity; }
.gallery__thumb { scroll-snap-align: start; cursor: pointer; }
.gallery__thumb:focus-visible { outline: 3px solid var(--sky-hover); outline-offset: 2px; opacity: 1; }
.gallery__thumb img.gallery__img--placeholder { object-fit: contain; padding: 18%; opacity: 0.5; }
.gallery--single .gallery__nav, .gallery--single .gallery__thumbs { display: none; }

/* ============ /listing: CTA box ============ */
.listing-cta {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 28px);
  box-shadow: var(--shadow-1);
}
.listing-cta h2 { font-size: clamp(22px, 2.4vw, 26px); margin-bottom: 6px; }
.listing-cta p { margin-bottom: 14px; }
.listing-cta .contact-list { margin-bottom: 16px; }
.listing-cta__actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 599px) { .listing-cta__actions .btn { width: 100%; } }

.listing-back { margin: 0 0 12px; }

@media print {
  .gallery__nav, .gallery__thumbs, .listing-cta__actions { display: none !important; }
  .listing-detail { grid-template-columns: 1fr; }
  .listing-detail__gallery { position: static; }
}
