:root {
  --ink: #14211f;
  --muted: #586864;
  --line: #dbe5e0;
  --paper: #f6faf8;
  --surface: #ffffff;
  --brand: #0f6b5b;
  --brand-dark: #08483e;
  --mint: #dff3ec;
  --mint-soft: #eef8f4;
  --coral: #d9534f;
  --coral-soft: #fdeeed;
  --amber: #9a5b00;
  --amber-soft: #fff4df;
  --home: #1d5fd6;
  --home-soft: #e8f0fe;
  --shadow: 0 10px 26px rgba(15, 36, 32, 0.06);
  --shadow-lg: 0 16px 34px rgba(15, 36, 32, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.wrap {
  width: min(1200px, calc(100% - 36px));
  margin: 0 auto;
}

/* Header */
header {
  background: rgba(246, 250, 248, 0.94);
  border-bottom: 1px solid rgba(219, 229, 224, 0.9);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
}

.nav {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.logo {
  font-family: 'Manrope', sans-serif;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--brand-dark);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.logo span {
  color: #e46b54;
}

.logo small {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.navlinks {
  display: flex;
  gap: 22px;
  color: #415450;
  font-size: 14px;
  font-weight: 600;
}

.navlinks a:hover {
  color: var(--brand);
}

.nav-cta {
  border: 1px solid var(--brand);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--brand);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  transition: 0.2s ease;
}

.nav-cta:hover {
  background: var(--brand);
  color: #fff;
}

/* Hero */
.hero {
  padding: 52px 0 38px;
  background: radial-gradient(circle at 85% 15%, #dff3ec 0, transparent 38%), var(--paper);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 10px;
}

h1, h2, h3 {
  font-family: 'Manrope', sans-serif;
  letter-spacing: -0.9px;
  margin: 0;
}

h1 {
  font-size: clamp(32px, 4.2vw, 52px);
  line-height: 1.08;
  max-width: 780px;
}

.hero-lead {
  max-width: 720px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
  margin: 16px 0 24px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: 0.2s ease;
}

.button.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 107, 91, 0.18);
}

.button.primary:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.button.secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 28px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}

.stat-box strong {
  display: block;
  font-family: 'Manrope', sans-serif;
  font-size: 20px;
  color: var(--brand-dark);
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.audit-banner {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--mint-soft);
  border: 1px solid #c5e6d9;
  color: #194d43;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
}

/* Sections & Controls */
.section {
  padding: 46px 0;
}

.section-alt {
  background: #ffffff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

h2 {
  font-size: clamp(24px, 3vw, 34px);
}

.section-head p {
  max-width: 500px;
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 22px;
  box-shadow: 0 4px 14px rgba(15, 36, 32, 0.03);
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter {
  padding: 8px 13px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  color: #4b5d58;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
}

.filter.active,
.filter:hover {
  background: var(--mint);
  color: var(--brand-dark);
  border-color: #9ed4c1;
}

.sortbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sortbar label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.sortbar select {
  border: 1px solid #c3d6cf;
  border-radius: 10px;
  background: #fff;
  color: var(--brand-dark);
  padding: 9px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.result-count {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
}

.badge-ok {
  background: #e1f5eb;
  color: #0b5a44;
}

.badge-off {
  background: var(--coral-soft);
  color: #a62c28;
}

.badge-new {
  background: var(--home-soft);
  color: var(--home);
}

.badge-warn {
  background: var(--amber-soft);
  color: var(--amber);
}

/* Photo Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.apt-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: 0.2s ease;
  box-shadow: var(--shadow);
}

.apt-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.apt-card.unavailable {
  border-color: #ebd7d5;
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #e6efeb;
  overflow: hidden;
  display: block;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.apt-card:hover .card-media img {
  transform: scale(1.03);
}

.rank-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--brand-dark);
  color: #fff;
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.media-badges {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: calc(100% - 56px);
}

.card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-body h3 {
  font-size: 18px;
  line-height: 1.25;
}

.code-chip {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: #f0f5f3;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
}

.card-address {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 10px;
}

.distance-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--mint-soft);
  border-radius: 9px;
  padding: 7px 10px;
  margin-bottom: 12px;
}

.spec-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.spec-pill {
  font-size: 12px;
  color: #415550;
  background: #f3f7f5;
  border: 1px solid #e2ebe7;
  border-radius: 8px;
  padding: 4px 8px;
}

.price-box {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.price-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.price-main strong {
  font-family: 'Manrope', sans-serif;
  font-size: 21px;
  color: var(--brand-dark);
}

.price-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.price-note {
  font-size: 11.5px;
  color: #6a7a75;
  margin-top: 6px;
  line-height: 1.4;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-sm {
  flex: 1;
  text-align: center;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: 0.15s ease;
}

.btn-sm.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-sm.primary:hover {
  background: var(--brand-dark);
}

.btn-sm:not(.primary):hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* Detailed Comparison Section */
.compare-sync-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.compare-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.compare-card.top-pick {
  border: 2px solid var(--brand);
}

.compare-top {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfc;
}

.compare-thumb {
  width: 160px;
  height: 128px;
  border-radius: 12px;
  overflow: hidden;
  background: #e6efeb;
  position: relative;
}

.compare-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compare-header h3 {
  font-size: 19px;
  margin: 4px 0;
}

.compare-price-line {
  font-family: 'Manrope', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--brand-dark);
  margin: 4px 0;
}

.compare-meta-line {
  font-size: 12px;
  color: var(--muted);
}

.compare-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.compare-specs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 14px;
  margin: 0;
}

.compare-specs div {
  font-size: 13px;
  border-bottom: 1px dashed #e6efeb;
  padding-bottom: 6px;
}

.compare-specs dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--muted);
}

.compare-specs dd {
  margin: 2px 0 0;
  font-weight: 600;
  color: var(--ink);
}

.compare-box {
  background: #f5faf8;
  border: 1px solid #dcebe4;
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 13px;
}

.compare-box strong {
  display: block;
  font-size: 12px;
  color: var(--brand-dark);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 3px;
}

.discounts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}

.discount-chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  color: #324743;
}

.compare-footer {
  margin-top: auto;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

/* Interactive Map */
.map-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.legend-items {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
  color: #3f524e;
}

.legend-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.dot-hospital { background: var(--coral); }
.dot-home { background: var(--home); }
.dot-apt { background: var(--brand); }
.dot-off { background: #7f8c8d; }

.map-shell {
  display: grid;
  grid-template-columns: 1.45fr 0.85fr;
  gap: 18px;
  align-items: stretch;
}

#real-map {
  width: 100%;
  min-height: 540px;
  height: 540px;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 1;
}

.map-sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  max-height: 540px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.map-sidebar h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.map-ref-group {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}

.map-item {
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: 0.15s ease;
}

.map-item:hover {
  background: var(--mint-soft);
  border-color: #c3e3d7;
}

.map-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.map-item strong {
  font-size: 14px;
  color: var(--ink);
}

.map-item small {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}

.map-item-links {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand);
}

.map-item-links a:hover {
  text-decoration: underline;
}

/* Custom Leaflet Markers */
.pin-marker {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  border: 2.5px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.pin-apt { background: var(--brand); }
.pin-apt-off { background: #6f7f7c; }
.pin-hospital {
  background: var(--coral);
  width: 34px;
  height: 34px;
  font-size: 16px;
}
.pin-home {
  background: var(--home);
  width: 34px;
  height: 34px;
  font-size: 15px;
}

.leaflet-popup-content {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  line-height: 1.45;
  margin: 12px 14px;
}

.popup-box strong {
  display: block;
  font-size: 14.5px;
  color: var(--ink);
  margin-bottom: 4px;
}

.popup-box p {
  margin: 0 0 6px;
  color: var(--muted);
}

.popup-price {
  font-weight: 800;
  color: var(--brand-dark) !important;
}

.popup-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.popup-links a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: underline;
}

/* Reference & Methodology Section */
.ref-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.ref-card {
  background: var(--brand-dark);
  color: #fff;
  border-radius: 18px;
  padding: 24px;
}

.ref-card.home-card {
  background: #14366b;
}

.ref-card h3 {
  font-size: 21px;
  margin-bottom: 8px;
}

.ref-card p {
  color: #d6ebe5;
  margin: 0 0 8px;
  font-size: 14px;
}

.ref-card.home-card p {
  color: #d6e4fb;
}

.ref-card a {
  display: inline-block;
  margin-top: 8px;
  font-weight: 700;
  text-decoration: underline;
  color: #fff;
}

.method-box {
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  font-size: 13.5px;
  color: var(--muted);
}

.method-box h3 {
  color: var(--ink);
  font-size: 17px;
  margin-bottom: 8px;
}

.method-box ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

footer {
  padding: 28px 0 38px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.footer-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .compare-grid {
    grid-template-columns: 1fr;
  }
  .map-shell {
    grid-template-columns: 1fr;
  }
  #real-map {
    min-height: 400px;
    height: 400px;
  }
  .map-sidebar {
    max-height: 360px;
  }
}

@media (max-width: 760px) {
  .nav {
    gap: 10px;
    min-height: 62px;
  }
  .logo {
    font-size: 20px;
  }
  .logo small {
    display: none;
  }
  .nav-cta {
    padding: 7px 12px;
    font-size: 12px;
  }
  .navlinks {
    display: none;
  }
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .ref-grid {
    grid-template-columns: 1fr;
  }
  .compare-top {
    grid-template-columns: 1fr;
  }
  .compare-thumb {
    width: 100%;
    height: 180px;
  }
  .compare-specs {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .wrap {
    width: calc(100% - 24px);
  }
  .nav-cta {
    padding: 6px 10px;
    font-size: 11.5px;
  }
  .hero {
    padding: 34px 0 28px;
  }
  .section {
    padding: 34px 0;
  }
  .controls-bar {
    padding: 12px;
  }
  #real-map {
    min-height: 340px;
    height: 340px;
  }
}
