/*
 * IDX pages — styles scoped to /listings/ routes.
 * Reuses melissachandler-theme tokens + .property-card / .search-field classes.
 *
 * 18.2.7/18.2.12 median-typeface rule, made computable:
 *   ALL listing data on IDX routes renders at --idx-data-size (prices larger),
 *   so the median listing-data size IS --idx-data-size.
 *   ALL attribution/mandated text renders at --idx-attr-size >= --idx-data-size.
 *   verify-pages.py asserts this relationship from the served CSS.
 */

:root {
  --idx-data-size: 0.88rem;
  --idx-attr-size: 0.95rem;
}

/* ===== Hero + filter bar ===== */
.idx-hero {
  background: linear-gradient(rgba(43, 0, 24, 0.88), rgba(43, 0, 24, 0.88)), var(--dark-bg);
  padding: 80px 0 60px;
  text-align: center;
}
.idx-hero h1 {
  color: var(--white);
  font-size: 2.6rem;
  margin-bottom: 32px;
}
.idx-filters {
  background: var(--white);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  padding: 20px 24px;
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 1000px;
  margin: 0 auto;
  text-align: left;
}
.idx-filters .search-field { min-width: 130px; flex: 1; }
.idx-search-btn { width: auto; padding: 13px 34px; flex: 0 0 auto; }

/* ===== Results grid ===== */
.idx-results { padding: 60px 0 90px; background: var(--white); }
.idx-result-meta {
  font-size: var(--idx-data-size);
  color: var(--text-dark);
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}
.idx-result-meta .section-tagline { display: block; margin-bottom: 6px; }
.idx-result-meta-pages { color: var(--text-muted); }
.idx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 24px;
}

/* Card data uniformly at --idx-data-size (overrides theme's 0.78rem specs
   inside IDX routes so the median stays computable). */
.idx-card .idx-card-specs { font-size: var(--idx-data-size); }
.idx-card .property-card-address { font-size: var(--idx-data-size); }
.idx-card-office {
  font-size: var(--idx-data-size);
  color: var(--text-dark);
  border-top: 1px solid var(--border-light);
  margin-top: 10px;
  padding-top: 8px;
}

.idx-pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 48px 0 0; flex-wrap: wrap; }
.idx-pager a {
  padding: 10px 16px;
  border: 1px solid var(--border-light);
  color: var(--text-dark);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  transition: border-color 0.2s, color 0.2s;
}
.idx-pager a:hover { border-color: var(--brand); color: var(--brand); }
.idx-pager a.idx-pager-current { background: var(--brand); border-color: var(--brand); color: var(--white); }
.idx-pager .idx-pager-step { text-transform: uppercase; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.1em; }
.idx-pager-gap { color: var(--text-muted); padding: 0 2px; }

/* ===== Detail page ===== */
.idx-detail-page { padding: 60px 0 90px; background: var(--white); }
.idx-detail { border: 1px solid var(--border-light); padding: 32px; }
.idx-gallery {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  grid-auto-rows: 170px;
  gap: 8px;
  margin-bottom: 28px;
}
.idx-gallery-item { overflow: hidden; background: var(--near-black); }
.idx-gallery-item:first-child { grid-row: span 2; }
.idx-gallery-item img { width: 100%; height: 100%; object-fit: cover; }

.idx-detail-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 18px;
  margin-bottom: 18px;
}
.idx-detail-price {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--brand);
}
.idx-detail-address { font-size: var(--idx-data-size); color: var(--text-dark); margin-top: 6px; }
.idx-detail-mls { text-align: right; font-size: var(--idx-data-size); color: var(--text-muted); }
.idx-detail-status {
  display: inline-block;
  background: var(--brand);
  color: var(--white);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  margin-top: 6px;
}
.idx-detail-facts { display: flex; gap: 26px; font-size: var(--idx-data-size); margin: 14px 0 20px; color: var(--text-dark); }
.idx-remarks { margin-bottom: 26px; }
.idx-remarks p { font-size: var(--idx-data-size); line-height: 1.8; color: var(--text-dark); }

/* ===== Robin's per-listing block ===== */
.idx-listed-by {
  background: var(--cream);
  border: 1px solid var(--border-light);
  padding: 20px 24px;
  font-size: var(--idx-attr-size);
  line-height: 1.7;
  color: var(--text-dark);
}
.idx-listed-by-updated { margin-bottom: 8px; }
.idx-listed-by-title { font-weight: 600; }
.idx-listed-by-source { margin-top: 8px; }
.idx-mls-logo {
  height: 34px;
  width: auto;
  vertical-align: middle;
  margin-left: 10px;
  background: var(--white);
  padding: 2px 6px;
  border: 1px solid var(--border-light);
  display: inline-block;
}

/* ===== Attribution footer (18.3.7 + 18.3.8 + 18.2.9) ===== */
.idx-attribution {
  border-top: 3px solid var(--brand);
  margin-top: 28px;
  padding-top: 18px;
  font-size: var(--idx-attr-size);
  line-height: 1.7;
  color: var(--text-dark);
}
.idx-attribution p { font-size: var(--idx-attr-size); margin-bottom: 10px; }
.idx-mls-logo-footer { float: right; height: 38px; margin-left: 14px; }
.idx-attribution-accuracy a { color: var(--brand); text-decoration: underline; }

/* ===== Empty / degraded state ===== */
.idx-unavailable {
  text-align: center;
  padding: 70px 40px;
  background: var(--cream);
  border: 1px dashed rgba(0, 0, 0, 0.15);
}
.idx-unavailable h2 { font-size: 1.6rem; color: var(--text-dark); margin-bottom: 12px; }
.idx-unavailable p { font-size: var(--idx-data-size); color: var(--text-muted); }
.idx-unavailable a { color: var(--brand); text-decoration: underline; }

.idx-back-link { margin-top: 24px; }
.idx-back-link a { font-size: var(--idx-data-size); color: var(--brand); }

@media (max-width: 768px) {
  .idx-hero h1 { font-size: 1.9rem; }
  .idx-gallery { grid-template-columns: 1fr 1fr; }
  .idx-gallery-item:first-child { grid-column: span 2; }
  .idx-detail { padding: 20px; }
}

/* ===== Site-wide integration (2026-08-12): featured section + community links ===== */
.idx-featured { padding: var(--section-pad); background: var(--cream); }
.idx-featured .idx-grid { margin-top: 8px; }
.idx-featured-cta { text-align: center; margin-top: 36px; }
.idx-featured-teaser {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 300;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.8;
}
.idx-featured .idx-attribution { margin-top: 40px; }
.community-listings-link {
  display: inline-block;
  margin-top: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  border-bottom: 1px solid var(--brand);
  padding-bottom: 2px;
}
.community-listings-link:hover { color: var(--brand-dark); border-color: var(--brand-dark); }

/* ===== Hero quick-search: keep the original panel's compact rhythm (2026-08-12) ===== */
.hero-search-col .search-panel-header h3 { margin-bottom: 14px; }
.hero-idx-search .search-field { gap: 3px; }
.hero-idx-search .search-field label { font-size: 0.64rem; }
.hero-idx-search .search-field input,
.hero-idx-search .search-field select { padding: 10px 12px; font-size: 0.84rem; }
.hero-idx-search .search-btn { padding: 13px; }
.hero-search-col .theme_button_dark { padding: 12px 30px; font-size: 0.74rem; }
.main-nav .nav-links a { white-space: nowrap; }

/* Hero panel aligns with the site's 1200px content column — visibly centered
   on wide screens instead of hugging the window edge (2026-08-12). */
@media (min-width: 1340px) {
  .hero-search-col { right: calc((100% - 1200px) / 2 + 40px); }
}
@media (min-width: 1025px) and (max-width: 1339px) {
  .hero-search-col { right: 70px; }
}

/* Hero composition centered (2026-08-12): background image stays FULL-BLEED.
   Only inner content is inset — headline block, dots, and search panel all align
   to the site 1200px content column, equal distance from both window edges. */
@media (min-width: 1025px) {
  .hero-slide-content {
    padding-left: max(60px, calc((100% - 1200px) / 2 + 40px));
    padding-right: calc(max(60px, calc((100% - 1200px) / 2 + 40px)) + 420px);
  }
  .hero-owl-carousel .owl-dots { left: max(60px, calc((100% - 1200px) / 2 + 40px)); }
  .hero-search-col { right: max(60px, calc((100% - 1200px) / 2 + 40px)); }
}
