:root {
  --bg: #fafaf7;
  --fg: #1a1a1a;
  --muted: #6a6a6a;
  --border: #e4e2dc;
  --critical: #c0392b;
  --high: #e67e22;
  --moderate: #f1c40f;
  --covered: #27ae60;
  --link: #1455c4;
  --link-visited: #0e3a8a;
  --max-width: 1180px;
  --header-h: 60px;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --yc: #ff6600;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.55;
  font-size: 16px;
  font-feature-settings: "ss01" on, "cv11" on;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: var(--link-visited); }

.site-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  border-bottom: 1px solid var(--border);
  background: white;
  position: sticky;
  top: 0;
  z-index: 200;
}
.site-header .brand {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  color: var(--fg);
  text-decoration: none;
}
.site-header .brand:visited { color: var(--fg); }
.site-header .brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  font-variation-settings: "opsz" 14;
  letter-spacing: -0.005em;
}
.site-header .brand-by {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.site-header nav { display: flex; align-items: center; height: 100%; }
.site-header nav a {
  margin-left: 1.25rem;
  padding: 0.6rem 0.5rem;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.site-header nav a:visited { color: var(--muted); }
.site-header nav a:hover { color: var(--fg); }

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.75rem 3rem;
}

.page-map main { max-width: 100%; padding: 0; }
.page-map .hero {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.25rem 1.75rem 0.95rem;
}
.page-map .below-map {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem 1.75rem 3rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.35rem, 1.9vw + 0.5rem, 2.05rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 36;
  margin: 0 0 0.55rem;
  color: #111;
  white-space: normal;
  text-wrap: balance;
}
.hero .subhead {
  color: var(--muted);
  margin: 0 0 0.85rem;
  font-size: 1.02rem;
  line-height: 1.55;
}
.hero .subhead strong { color: var(--fg); font-weight: 600; }
.hero .subhead a { color: var(--muted); border-bottom: 1px dotted var(--muted); }
.hero .subhead a:hover { color: var(--fg); border-bottom-color: var(--fg); text-decoration: none; }
.hero .cta-prompt {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.9rem 0.55rem 0.7rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  user-select: none;
}
.hero .cta-prompt:hover {
  background: var(--bg);
  border-color: #bbb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.hero .cta-prompt:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.hero-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.hero-about-link,
.hero-about-link:visited,
.hero-about-link:hover {
  color: var(--fg);
  text-decoration: none;
}
.hero .cta-prompt .cta-arrow {
  font-size: 1.25rem;
  line-height: 1;
  color: var(--link);
  font-weight: 600;
  font-family: var(--font-body);
  transform: translateY(-1px);
}

.inline-select-wrap {
  display: inline;
}
#specialty-select {
  field-sizing: content;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--fg);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: inherit;
  line-height: inherit;
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.02em;
  color: var(--fg);
  cursor: pointer;
  padding: 0;
  margin: 0;
  vertical-align: baseline;
}
#specialty-select:hover { opacity: 0.65; }
#specialty-select:focus { outline: none; }
#specialty-select:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
#specialty-select option {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  color: var(--fg);
  background: white;
}
.inline-select-caret {
  display: inline;
  pointer-events: none;
  font-size: 0.5em;
  color: var(--muted);
  vertical-align: middle;
  margin-left: 0.15em;
}

.map-shell {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--header-h) - 180px);
  min-height: 520px;
  background: #ecebe6;
}
#map { position: absolute; inset: 0; width: 100%; height: 100%; }

.map-legend {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  font-size: 0.8rem;
  z-index: 5;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  max-width: 230px;
  font-family: var(--font-body);
}
.legend-title {
  font-family: var(--font-body);
  font-weight: 600;
  margin-bottom: 0.45rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.legend-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.15rem 0; color: var(--fg); }
.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.1);
  flex-shrink: 0;
}
.legend-divider { height: 1px; background: var(--border); margin: 0.5rem 0; }
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--high);
  border: 1.2px solid #1a1a1a;
  flex-shrink: 0;
}
.legend-cah { color: var(--muted); }

.side-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 95vw;
  height: 100%;
  background: white;
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 16px rgba(0,0,0,0.06);
  transform: translateX(110%);
  /* Hide via visibility AFTER the slide-out transition. Without this, the
     translated panel overlaps content below the map on mobile because the
     bottom-sheet panel is taller than .map-shell and translateY(110%) leaks
     past .map-shell's bottom edge. */
  visibility: hidden;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.2s;
  overflow-y: auto;
  z-index: 20;
}
.side-panel.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0s;
}

#side-close {
  position: absolute;
  top: 0.45rem;
  right: 0.6rem;
  background: transparent;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#side-close:hover { color: var(--fg); background: var(--border); }
#side-close:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

#side-content { padding: 1.8rem 1.9rem 3rem; line-height: 1.62; }
#side-content h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.55rem;
  line-height: 1.22;
  font-variation-settings: "opsz" 24;
  margin: 0.6rem 0 0.4rem;
  letter-spacing: -0.012em;
}
#side-content h3 {
  font-family: var(--font-body);
  margin: 2rem 0 0.65rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
#side-content p { margin: 0.85rem 0; }
#side-content ul { padding-left: 1.2rem; margin: 0.6rem 0; }
#side-content li { margin: 0.3rem 0; }

.panel-tag {
  display: inline-block;
  color: white;
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.22rem 0.65rem;
  border-radius: 3px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.panel-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.45rem 0 0;
  line-height: 1.55;
}
.panel-warning {
  background: #fffbe6;
  border-left: 3px solid var(--moderate);
  padding: 0.55rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 0 3px 3px 0;
  margin-top: 0.8rem;
}
.panel-summary {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  line-height: 1.4;
  font-variation-settings: "opsz" 16;
  margin: 1.1rem 0 0.4rem;
  color: var(--fg);
}

.gap-list {
  list-style: none;
  padding: 0;
  margin: 0.7rem 0 0;
}
.gap-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.gap-list li:last-child { border-bottom: 0; }
.gap-list .spec-name { font-weight: 500; color: var(--fg); }
.gap-list .spec-distance {
  color: var(--muted);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-left: 1rem;
}
.gap-list .spec-distance .level-tag {
  display: inline-block;
  padding: 0.06rem 0.4rem;
  border-radius: 2px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.4rem;
  letter-spacing: 0.04em;
}
.gap-list .spec-distance .level-critical { background: var(--critical); color: white; }
.gap-list .spec-distance .level-high { background: var(--high); color: white; }

details.spec-disclosure {
  margin-top: 1.2rem;
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
}
details.spec-disclosure summary {
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--link);
  font-weight: 500;
  list-style: none;
  padding: 0.3rem 0;
}
details.spec-disclosure summary::-webkit-details-marker { display: none; }
details.spec-disclosure summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s;
}
details.spec-disclosure[open] summary::before { transform: rotate(90deg); }

.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.86rem;
}
.spec-table th, .spec-table td {
  padding: 0.42rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.spec-table th {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.spec-table td.num, .spec-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.spec-table .row-critical td:first-child { border-left: 3px solid var(--critical); padding-left: 0.4rem; }
.spec-table .row-high td:first-child { border-left: 3px solid var(--high); padding-left: 0.4rem; }
.spec-table .row-covered { color: var(--muted); }

.cah-list { padding-left: 0; list-style: none; }
.cah-list li { padding: 0.25rem 0; }
.link-btn {
  background: transparent;
  border: 0;
  color: var(--link);
  font: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.link-btn:hover { text-decoration: underline; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  letter-spacing: 0.04em;
}
.badge-critical { background: var(--critical); }
.badge-high { background: var(--high); }
.badge-moderate { background: var(--moderate); color: var(--fg); }
.badge-covered { background: var(--covered); }

.below-map {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 2.5rem;
}
.below-map .why-card,
.below-map .how-card { padding-top: 0.5rem; }
.below-map .tenens-cta-card {
  grid-column: 1 / -1;
  background: white;
  border: 1px solid var(--border);
  border-left: 3px solid var(--yc);
  border-radius: 0 6px 6px 0;
  padding: 0.6rem 1.1rem;
  margin-top: 0.25rem;
}
.tenens-cta-inner {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
}
.tenens-cta-inner:hover { text-decoration: none; color: var(--fg); }
.tenens-cta-inner:visited { color: var(--fg); }
.below-map .why-card p:last-of-type {
  margin-top: 1rem;
}
.below-map h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  font-variation-settings: "opsz" 24;
  margin: 0 0 0.6rem;
  letter-spacing: -0.012em;
  color: #111;
}
.below-map p { max-width: 60ch; color: var(--fg); margin: 0.65rem 0; line-height: 1.6; }
@media (max-width: 720px) {
  .below-map { grid-template-columns: 1fr; gap: 1.5rem; }
}

.prose { max-width: 70ch; padding-top: 0.5rem; }
.prose h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2rem;
  font-variation-settings: "opsz" 32;
  margin-top: 0;
  letter-spacing: -0.015em;
}
.prose h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  font-variation-settings: "opsz" 22;
  margin-top: 2rem;
  letter-spacing: -0.01em;
}
.prose ul { padding-left: 1.5rem; }
.prose strong { font-weight: 600; }

footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
}
.page-map footer { max-width: 100%; text-align: center; }

/* Tablet */
@media (max-width: 980px) {
  .hero h1 { font-size: 2rem; }
  .map-shell { height: calc(100vh - var(--header-h) - 220px); }
}

/* Mobile — bottom sheet panel, smaller hero, larger touch surfaces handled in JS */
@media (max-width: 720px) {
  .site-header { padding: 0 1rem; }
  .site-header nav a { margin-left: 1rem; font-size: 0.85rem; }
  .site-header .brand-name { font-size: 1.05rem; }

  .page-map .hero { padding: 1rem 1rem 0.6rem; }
  .hero h1 { font-size: 1.55rem; max-width: none; }
  .hero .subhead { font-size: 0.92rem; white-space: normal; }

  .map-shell { height: calc(100vh - var(--header-h) - 200px); min-height: 420px; }
  .map-legend { font-size: 0.72rem; padding: 0.5rem 0.65rem; max-width: 180px; }
  .legend-title { font-size: 0.68rem; }

  .side-panel {
    width: 100vw;
    max-width: 100vw;
    height: 70vh;
    max-height: 70vh;
    top: auto;
    bottom: 0;
    border-left: 0;
    border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -6px 18px rgba(0,0,0,0.08);
    transform: translateY(110%);
  }
  .side-panel.open { transform: translateY(0); }
  /* Drag handle hint */
  .side-panel::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0.6rem auto 0;
  }
  #side-close { top: 0.4rem; right: 0.5rem; }
  #side-content { padding: 0.6rem 1.2rem 2rem; }

  .page-map .below-map { padding: 1rem; }
}

@media (max-width: 420px) {
  .hero h1 { font-size: 1.35rem; }
  .map-legend { max-width: 150px; }
}
