/* Town info pages (/town/<slug>) */
body.town-body { background: var(--cream); }
.page.narrow.town-page { max-width: 860px; margin: 0 auto; padding: 20px 16px 40px; height: auto; }
.town-card { background: var(--paper); border-radius: 16px; box-shadow: var(--shadow-soft); border: 1px solid rgba(15, 35, 64, 0.06); padding: 24px 28px 20px; color: var(--ink); }
.town-card .popup-kicker { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.town-h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin: 4px 0 6px; color: var(--navy); }
.town-lede { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.town-sec { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.town-sec h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); margin-bottom: 10px; }
.town-sec h3 { font-size: 15px; font-weight: 700; color: var(--navy); margin: 14px 0 8px; }
.town-sec h4 { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 6px; }
.town-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.town-stat { background: var(--soft); border-radius: 12px; padding: 10px 12px; }
.ts-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.ts-val { font-size: 20px; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; margin-top: 2px; }
.ts-note { font-size: 11px; color: var(--muted); margin-top: 2px; }
.moe { white-space: nowrap; }
.lowrel { display: inline-block; font-size: 10px; font-weight: 700; color: #7a5b00; background: #fbf0c9; border-radius: 6px; padding: 0 5px; margin-left: 2px; }
.town-sub, .town-src, .town-note { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 8px; }
.town-note { font-size: 13px; font-weight: 600; color: var(--navy); background: var(--soft); border-radius: 10px; padding: 8px 10px; }
.town-src a { color: var(--navy); font-weight: 600; }
.town-bars { display: grid; gap: 6px; margin-top: 6px; }
.tb-row { display: grid; grid-template-columns: 120px 1fr 54px; align-items: center; gap: 8px; font-size: 13px; }
.tb-track { height: 10px; background: var(--soft); border-radius: 6px; overflow: hidden; }
.tb-fill { display: block; height: 100%; background: var(--navy); opacity: .75; border-radius: 6px; }
.tb-val { text-align: right; font-weight: 700; color: var(--navy); }
.spark-wrap { color: var(--navy); background: var(--soft); border-radius: 12px; padding: 10px 12px; }
.spark { width: 100%; max-width: 420px; height: 64px; display: block; }
.spark-labels { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); max-width: 420px; }
.spark-labels b { color: var(--navy); font-size: 12px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.town-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.town-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px 6px 0; }
.town-table td { border-bottom: 1px solid var(--line); padding: 6px 8px 6px 0; vertical-align: top; }
.town-table td:not(:first-child), .town-table th:not(:first-child) { white-space: nowrap; }
.town-table .tt-main td { font-weight: 700; color: var(--navy); }
.town-table .muted, .town-list .muted { color: var(--muted); font-size: 12px; }
.town-table.schools td:first-child { min-width: 170px; }
.town-list { list-style: none; display: grid; gap: 6px; font-size: 14px; }
.town-list li { background: var(--soft); border-radius: 10px; padding: 8px 10px; }
.g-contact { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.g-contact .plain { color: var(--ink); user-select: all; word-break: break-all; }
.ad-slot { display: flex; align-items: center; justify-content: center; min-height: 100px; margin: 20px 0 4px; border: 1px dashed #cfc7b8; border-radius: 12px; background: #faf7f0; }
.ad-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #9a9184; }
.town-footer { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 12px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.town-footer .eho { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-weight: 700; color: var(--navy); }
@media (max-width: 760px) {
  .page.narrow.town-page { padding-top: 10px; padding-left: 8px; padding-right: 8px; }
  /* padding-bottom is set below so the sticky Back-to-the-map button cannot cover page-end content */
  .town-card { padding: 16px 14px 14px; border-radius: 14px; }
  .town-h1 { font-size: 24px; }
  .town-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ts-val { font-size: 17px; }
  .tb-row { grid-template-columns: 96px 1fr 48px; font-size: 12px; }
  .ad-slot { min-height: 90px; }
}

.town-dir-links { margin: 0 0 18px; }
.town-dir-list { list-style: none; padding: 0; margin: 0 0 8px; columns: 2; column-gap: 24px; }
.town-dir-list li { break-inside: avoid; padding: 3px 0; }
.town-dir-list a { color: var(--navy, #0f2340); text-decoration: none; font-weight: 600; }
.town-dir-list a:hover, .town-dir-list a:focus { text-decoration: underline; }
.dir-county h2 { margin-top: 18px; }
@media (max-width: 640px) {
  .town-dir-list { columns: 1; }
}

/* House ads (Jack Pysz / REMAX Future) and Advertise-here cards */
.ad-slot.ad-house, .ad-slot.ad-available {
  display: block;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(15, 35, 64, 0.12);
  background: var(--paper);
  overflow: hidden;
}
.ad-slot.ad-house .house-ad, .ad-slot.ad-available .avail-ad {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 14px 16px 12px;
}
.ad-slot.ad-house:hover, .ad-slot.ad-available:hover { border-color: rgba(15, 35, 64, 0.28); }
.ad-kicker { display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #9a9184; font-weight: 700; }
.house-ad-logo { height: 44px; width: auto; display: block; margin: 8px 0 10px; }
.house-ad-who { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }
.house-ad-photo { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: #1a1a1a; }
.house-ad-name { font-weight: 800; color: var(--navy); font-size: 16px; line-height: 1.2; }
.house-ad-title { font-size: 12px; color: var(--muted); line-height: 1.3; margin-top: 1px; }
.house-ad-co { font-size: 13px; font-weight: 700; color: var(--navy); margin-top: 1px; }
.house-ad-headline, .avail-ad-headline { font-size: 18px; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; margin: 0 0 6px; line-height: 1.25; }
.avail-ad-headline { font-size: 22px; margin-top: 6px; }
.avail-ad-price { font-size: 15px; font-weight: 700; color: var(--navy); margin: 0 0 6px; }
.house-ad-body, .avail-ad-body { font-size: 13px; color: var(--ink); line-height: 1.45; margin: 0 0 12px; }
.house-ad-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 46px;
  min-height: 44px;
  max-height: 48px;
  padding: 0 18px;
  margin: 0 0 12px;
  line-height: 1;
  pointer-events: none;
}
.house-ad-legal { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 10px; color: var(--muted); line-height: 1.35; }
.house-ad-more { margin: 0; padding: 0 16px 10px; font-size: 11px; line-height: 1.4; text-align: center; }
.house-ad-more a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.house-ad-more a:hover, .house-ad-more a:focus-visible { color: var(--navy); }
.house-ad-eho { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--navy); }
.house-ad-eho .eho-icon { flex: 0 0 auto; color: var(--navy); }
.form-card .house-ad-legal { margin-top: 4px; }
@media (min-width: 640px) {
  .house-ad-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
  .house-ad-logo { margin: 4px 0; height: 52px; }
  .house-ad-photo { width: 72px; height: 72px; }
}
@media (max-width: 760px) {
  .ad-slot.ad-house .house-ad, .ad-slot.ad-available .avail-ad { padding: 12px 12px 10px; }
  .house-ad-more { padding: 0 12px 8px; }
  .house-ad-headline { font-size: 16px; }
  .house-ad-photo { width: 56px; height: 56px; }
}

/* Keep page-end content, ad legal lines, and the “Advertise with us” link
   clear of the sticky Back-to-the-map button.
   Button is ~44px tall and sits 12–16px above the viewport bottom (plus safe-area). */
body.has-map-back .page.narrow.town-page {
  padding-bottom: calc(44px + 24px + 24px + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 760px) {
  body.has-map-back .ad-slot {
    scroll-margin-bottom: calc(44px + 24px + 12px + env(safe-area-inset-bottom, 0px));
  }
  body.has-map-back .ad-slot.ad-house,
  body.has-map-back .ad-slot.ad-available {
    padding-bottom: calc(44px + 24px + 12px + env(safe-area-inset-bottom, 0px));
  }
}
