/* Area map page (/apartment-search). Only loaded on that page. */

.am-intro { padding: 72px 0 32px; }
.am-intro .lede { max-width: 720px; }

.am-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}

/* Price bands */
.band-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
}
.band-row-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray);
  margin-right: 6px;
}
.band-chip,
.area-chip {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--hairline);
  background: var(--white);
  color: var(--dark);
  border-radius: 999px;
  transition: border-color .15s, background .15s, color .15s;
}
.band-chip {
  padding: 8px 16px;
  font-size: 0.9rem;
}
.band-chip:hover,
.area-chip:hover { border-color: var(--accent-text); }
.band-chip.is-selected {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

/* Map + area list */
.am-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(240px, 1fr);
  gap: 24px;
  align-items: start;
}
/* Let the scrolling chip rows shrink instead of widening the page. */
.am-layout > *,
#price-bands { min-width: 0; }

.map-card {
  position: relative;
  background: var(--off-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(23, 22, 38, 0.08);
  padding: 20px 20px 8px;
}
.map-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 40px;
}
.map-head h2 {
  font-size: 1.25rem;
  margin: 0;
}
.map-back {
  font: inherit;
  font-size: 0.9rem;
  background: none;
  border: 0;
  color: var(--accent-text);
  cursor: pointer;
  padding: 6px 0;
}
.map-back:hover { text-decoration: underline; }
.map-back[hidden] { display: none; }

#area-map {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(760px, 80vh);
}
#area-map [role="button"] { cursor: pointer; outline: none; }

/* Real geography from assets/map/*.svg (build-map-svg.py) */
.geo-water,
.geo-roads,
.geo-labels { pointer-events: none; }
.geo-labels text { letter-spacing: 0.04em; paint-order: stroke; stroke: var(--off-white); stroke-width: 4px; stroke-linejoin: round; }
.geo-city { cursor: pointer; transition: fill .15s; }
.geo-city:hover { fill: #e2e1d8; }
.geo-city-austin:hover { fill: #c9e7d9; }
.geo-city.is-selected { fill: #cfe3f2; }

/* Top-level pins */
.pin-halo { fill: var(--green); opacity: 0.14; transition: opacity .15s; }
.pin-dot {
  fill: var(--white);
  stroke: var(--green-text);
  stroke-width: 3;
  transition: fill .15s, stroke .15s;
}
.pin-count {
  fill: var(--green-text);
  font-size: 22px;
  font-weight: 700;
  text-anchor: middle;
}
.pin-austin .pin-count { font-size: 38px; font-family: "Playfair Display", serif; }
.pin-sub {
  fill: var(--green-text);
  font-size: 15px;
  font-weight: 600;
  text-anchor: middle;
  letter-spacing: 0.04em;
}
.pin-label {
  fill: var(--dark);
  font-size: 20px;
  font-weight: 600;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--off-white);
  stroke-width: 6px;
  stroke-linejoin: round;
}
.pin-austin .pin-label { font-size: 26px; font-family: "Playfair Display", serif; }
.pin:hover .pin-halo,
.pin:focus-visible .pin-halo { opacity: 0.35; }
.pin:focus-visible .pin-dot { stroke: var(--navy); stroke-width: 5; }
.pin.is-selected .pin-dot,
.pin-austin:hover .pin-dot { fill: var(--navy); stroke: var(--navy); }
.pin.is-selected .pin-count,
.pin.is-selected .pin-sub,
.pin-austin:hover .pin-count,
.pin-austin:hover .pin-sub { fill: var(--white); }
.pin.is-empty .pin-dot { stroke: rgba(23, 22, 38, 0.25); }
.pin.is-empty .pin-count { fill: rgba(23, 22, 38, 0.4); }
.pin.is-empty .pin-halo { fill: rgba(23, 22, 38, 0.3); opacity: 0.08; }

/* Austin neighborhoods */
.hood-shape {
  fill: #d8efe5;
  stroke: var(--off-white);
  stroke-width: 1.5;
  stroke-linejoin: round;
  transition: fill .15s;
}
.hood-tag { cursor: pointer; }
.hood-label,
.hood-count {
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--off-white);
  stroke-linejoin: round;
}
.hood-label {
  fill: var(--dark);
  font-family: "Playfair Display", serif;
  font-size: 40px;
  font-weight: 600;
  stroke-width: 8px;
}
.hood-count {
  fill: var(--green-text);
  font-size: 25px;
  font-weight: 600;
  stroke-width: 6px;
}
.hood:hover .hood-shape,
.hood.is-hover .hood-shape { fill: #b5e0cd; }
.hood:focus-visible .hood-shape { stroke: var(--navy); stroke-width: 4; }
.hood.is-empty .hood-shape { fill: #ecebe6; }
.hood-tag.is-empty .hood-count { fill: var(--gray); font-weight: 400; }
.hood.is-empty:hover .hood-shape,
.hood.is-empty.is-hover .hood-shape { fill: #e0dfd8; }
.hood.is-selected .hood-shape { fill: var(--navy); }
.hood-tag.is-selected .hood-label,
.hood-tag.is-selected .hood-count { fill: var(--white); stroke: var(--navy); }

/* Area list beside the map */
.area-panel h2 {
  font-size: 1.1rem;
  margin: 4px 0 14px;
}
.area-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.area-chip {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  text-align: left;
}
.area-chip strong {
  min-width: 28px;
  text-align: center;
  font-size: 0.85rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(62, 180, 137, 0.14);
  color: var(--green-text);
}
.area-chip.is-empty { color: var(--gray); }
.area-chip.is-empty strong { background: rgba(23, 22, 38, 0.06); color: var(--gray); }
.area-chip.is-selected {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.area-chip.is-selected strong { background: rgba(255, 255, 255, 0.18); color: var(--white); }
.area-note {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--gray);
}

/* Results */
.am-results { padding: 56px 0 72px; scroll-margin-top: 16px; }
.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 24px;
}
.results-head h2 { margin: 0; }
.results-count { color: var(--gray); font-size: 1rem; }
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
}
.listing-card {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(23, 22, 38, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.listing-media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--dark);
  overflow: hidden;
}
.listing-media video,
.listing-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.listing-media video[controls] { object-fit: contain; }
.listing-media.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(62, 180, 137, 0.35), transparent 60%),
    linear-gradient(160deg, var(--navy), var(--navy-dark));
}
.listing-placeholder-text {
  color: var(--white);
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  text-align: center;
  padding: 0 20px;
}
.listing-play {
  position: absolute;
  inset: 0;
  border: 0;
  cursor: pointer;
  background: linear-gradient(to top, rgba(23, 22, 38, 0.45), transparent 45%);
}
.listing-play::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 68px;
  height: 68px;
  margin: -34px 0 0 -34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: transform .15s;
}
.listing-play::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -12px 0 0 -6px;
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent var(--navy);
}
.listing-play:hover::before,
.listing-play:focus-visible::before { transform: scale(1.08); }
.listing-play[hidden] { display: none; }
.listing-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--dark);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}
.listing-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.listing-body p { margin: 0; }
.listing-area {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.listing-price {
  font-family: "Playfair Display", serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--dark);
}
.listing-price small {
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--gray);
  margin-left: 2px;
}
.listing-spec { color: var(--gray); font-size: 0.95rem; }
.listing-ask { margin-top: auto; align-self: flex-start; }
.listing-body .listing-ask { margin-top: 14px; }
.results-empty {
  grid-column: 1 / -1;
  padding: 40px;
  text-align: center;
  background: var(--off-white);
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
}
.results-empty p { max-width: 520px; margin: 0 auto 20px; }
.results-note {
  margin: 24px 0 0;
  font-size: 0.85rem;
  color: var(--gray);
}

@media (max-width: 860px) {
  .am-intro { padding: 48px 0 24px; }
  .am-shell { padding: 0 16px; }
  .am-layout { grid-template-columns: 1fr; }
  .map-card { padding: 14px 10px 4px; }
  .area-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 6px;
    scrollbar-width: thin;
  }
  .area-chip { width: auto; white-space: nowrap; gap: 10px; border-radius: 999px; }
  .area-note { display: none; }
  .band-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; }
  .band-chip { white-space: nowrap; }
  .hood-label { font-size: 44px; }
  .hood-count { font-size: 28px; }
  .am-results { padding: 40px 0 56px; }
  .results-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .listing-body { padding: 12px 12px 14px; }
  .listing-area { font-size: 0.65rem; letter-spacing: 0.08em; }
  .listing-price { font-size: 1.3rem; }
  .listing-spec { font-size: 0.8rem; }
  .listing-body .listing-ask { margin-top: 10px; width: 100%; padding-left: 8px; padding-right: 8px; font-size: 0.68rem; }
  .listing-tag { top: 8px; left: 8px; font-size: 0.6rem; padding: 3px 8px; }
  .listing-play::before { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
  .listing-play::after { margin: -9px 0 0 -4px; border-width: 9px 0 9px 15px; }
  .listing-placeholder-text { font-size: 1.1rem; }
}

/* Photo viewer (opened from a photo-only listing card) */
.listing-photos-btn {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}
.listing-photos-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(23, 22, 38, 0.78);
  color: #fff;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 2px;
}
.listing-photos-btn:focus-visible { outline: 3px solid var(--accent-text, #c4145a); outline-offset: -3px; }
.photo-viewer {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.photo-viewer::backdrop { background: rgba(10, 10, 20, 0.92); }
.photo-viewer[open] { display: flex; align-items: center; justify-content: center; }
.pv-img {
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 96px);
  object-fit: contain;
  border-radius: 2px;
}
.pv-close,
.pv-nav {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.8rem;
}
.pv-close:hover, .pv-nav:hover { background: rgba(255, 255, 255, 0.28); }
.pv-close:focus-visible, .pv-nav:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.pv-close { top: 14px; right: 14px; }
.pv-nav { top: 50%; margin-top: -22px; }
.pv-prev { left: 14px; }
.pv-next { right: 14px; }
.pv-count {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: 0.85rem;
  margin: 0;
}
@media (max-width: 600px) {
  .pv-nav { top: auto; bottom: 10px; margin-top: 0; }
  .pv-prev { left: 14px; }
  .pv-next { right: 14px; }
}
