/* RCLX coverage map — modal + map styling */

#rclx-map-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#rclx-map-modal[data-open="true"] { display: flex; }

#rclx-map-modal .modal-card {
  position: relative;
  width: min(1200px, 100%);
  max-height: calc(100vh - 48px);
  background: #1c1c22;
  border: 1px solid #3a3a44;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

#rclx-map-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #3a3a44;
  background: #16161b;
}
#rclx-map-modal .modal-title {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
}
#rclx-map-modal .modal-subtitle {
  color: #a1a1aa;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 2px;
}
#rclx-map-modal .modal-close {
  background: transparent;
  border: 1px solid #3a3a44;
  color: #fff;
  /* Fix #6: 44×44 to meet Apple HIG minimum. This is the only "exit
     the modal entirely" affordance on mobile, so it has to be tappable
     without a magnifying glass. */
  width: 44px; height: 44px;
  min-width: 44px; min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, background .15s;
}
#rclx-map-modal .modal-close:hover { border-color: #fff; background: rgba(255,255,255,0.05); }
#rclx-map-modal .modal-close:focus-visible {
  outline: 2px solid #06B6D4;
  outline-offset: 2px;
}

#rclx-map-modal .modal-body {
  /* Fix #22: the parent .modal-card is a flex column with overflow:hidden
     and a max-height. Without flex:1 + min-height:0 here, this child took
     its intrinsic content height (~1500px on mobile) and the parent's
     overflow:hidden silently clipped the bottom — the SVG map, the lead
     form, and the market list all rendered below the visible window with
     no scroll affordance. min-height:0 is the flex-child override that
     lets overflow:auto actually engage. */
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0;
}

#rclx-map-modal .map-stage {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 50%, #232329 0%, #16161b 60%, #08080c 100%);
  padding: 16px 24px 0;
}

#rclx-map-modal .map-loading,
#rclx-map-modal .map-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 420px;
  color: #a1a1aa;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}
#rclx-map-modal .map-error {
  color: #f87171;
  flex-direction: column;
  gap: 12px;
}
#rclx-map-modal .map-error button {
  background: linear-gradient(90deg, #E63946 0%, #06B6D4 100%);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

#rclx-map-modal svg.us-map {
  width: 100%;
  height: auto;
  display: block;
  background: transparent;
  /* Fix #23: removes the 300ms double-tap-zoom delay so county taps
     register instantly on iOS, and biases ambiguous gestures toward
     click rather than a partial scroll. Vertical scrolling of the
     modal body still works through the SVG region. */
  touch-action: manipulation;
}
/* Fix #23: a teal tap-highlight gives an immediate "your finger landed"
   signal on dark Safari, vs the default washed-out grey-blue rectangle
   that's barely visible on #1c1c22. Applied to every clickable surface
   inside the modal so the perceived responsiveness is uniform. */
#rclx-map-modal button,
#rclx-map-modal .county,
#rclx-map-modal .market-list-row {
  -webkit-tap-highlight-color: rgba(6, 182, 212, 0.28);
}

#rclx-map-modal .county {
  fill: #33333d;
  stroke: #1c1c22;
  stroke-width: 0.4;
  transition: fill .12s;
  /* Fix #2: every county is tappable — red opens the build card, teal
     opens a "T-Mobile fiber market" interest card, grey opens the
     grey-state capture form. Pointer cursor signals that on desktop. */
  cursor: pointer;
}
#rclx-map-modal .county.covered-low    { fill: #0e3a48; }
#rclx-map-modal .county.covered-mid    { fill: #0d566c; }
#rclx-map-modal .county.covered-high   { fill: #06B6D4; }

/* New-build counties — red fill with a slow color pulse. Listed AFTER
 * the .covered-* rules so equal-specificity ties resolve in favor of
 * red, in line with the brief's "red beats teal" precedence. The pulse
 * uses a fill-color shift rather than a scale transform so adjacent
 * counties don't jitter against each other. */
#rclx-map-modal .county.new-build {
  fill: #E63946;
  stroke: rgba(255,255,255,0.45);
  stroke-width: 0.55;
  cursor: pointer;
  animation: rclx-county-build-pulse 3.2s ease-in-out infinite;
}
@keyframes rclx-county-build-pulse {
  0%, 100% { fill: #E63946; }
  50%      { fill: #b8232f; }
}
@media (prefers-reduced-motion: reduce) {
  #rclx-map-modal .county.new-build { animation: none; }
}

/* Fix #3: counties where every entry is 'coming-soon' get a less-saturated
 * red and a slower (~50%) pulse so reps can tell at a glance these are
 * pre-launch markets, not active builds. Selector specificity is one class
 * higher than .county.new-build, so this rule wins without !important. */
#rclx-map-modal .county.new-build.coming-soon {
  fill: #c52838;
  animation: rclx-county-coming-soon-pulse 4.8s ease-in-out infinite;
}
@keyframes rclx-county-coming-soon-pulse {
  0%, 100% { fill: #c52838; }
  50%      { fill: #7d1a23; }
}
#rclx-map-modal .county.new-build.coming-soon:focus-visible,
#rclx-map-modal .county.new-build.coming-soon:hover {
  fill: #e25260;
  stroke: #fff;
  stroke-width: 0.9;
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  #rclx-map-modal .county.new-build.coming-soon { animation: none; }
}

#rclx-map-modal .state-line {
  fill: none;
  stroke: #4d4d59;
  stroke-width: 0.7;
  pointer-events: none;
}
#rclx-map-modal .county:focus-visible,
#rclx-map-modal .county:hover,
#rclx-map-modal .county:active {
  fill: #1d8aa3;
  stroke: #fff;
  stroke-width: 0.8;
  outline: none;
}
/* New-build counties: hover stays in the red family so the layer stays
 * legible on mouseover (default :hover would flip it teal). :active
 * gives mobile a press-state — Fix #23 — since touch devices never see
 * :hover and reps were tapping into a void without visible feedback. */
#rclx-map-modal .county.new-build:focus-visible,
#rclx-map-modal .county.new-build:hover,
#rclx-map-modal .county.new-build:active {
  fill: #ff5566;
  stroke: #fff;
  stroke-width: 0.9;
  animation: none;
}

#rclx-map-modal .build-pin {
  fill: #E63946;
  stroke: rgba(255,255,255,0.85);
  stroke-width: 1.2;
  cursor: pointer;
}
#rclx-map-modal .build-pin-pulse {
  fill: rgba(230, 57, 70, 0.5);
  pointer-events: none;
  transform-origin: center;
  animation: rclx-pulse 2s ease-in-out infinite;
}
@keyframes rclx-pulse {
  0%   { transform: scale(0.6); opacity: 0.85; }
  100% { transform: scale(2.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #rclx-map-modal .build-pin-pulse { animation: none; opacity: 0.4; transform: scale(1.3); }
}

#rclx-map-modal .tooltip {
  position: absolute;
  pointer-events: none;
  background: #08080c;
  color: #fff;
  border: 1px solid #3a3a44;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  transform: translate(-50%, calc(-100% - 12px));
  white-space: nowrap;
  z-index: 5;
  opacity: 0;
  transition: opacity .12s;
}
#rclx-map-modal .tooltip[data-show="true"] { opacity: 1; }
#rclx-map-modal .tooltip strong {
  display: block;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}
#rclx-map-modal .tooltip .tooltip-status {
  color: #a1a1aa;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

#rclx-map-modal .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 12px 24px 16px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: #a1a1aa;
  border-bottom: 1px solid #26262e;
}
#rclx-map-modal .legend-item { display: flex; align-items: center; gap: 8px; }
#rclx-map-modal .legend-swatch {
  width: 14px; height: 14px; border-radius: 3px; display: inline-block;
}
/* Single teal swatch for the simplified legend (Fix #4). The map paints
 * three saturations under the hood; the legend just signals "we're in
 * this state." */
#rclx-map-modal .swatch-footprint { background: #0d566c; }
#rclx-map-modal .swatch-build {
  background: #E63946;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(230,57,70,0.3);
}

/* Fix #28: .below-map used to be a two-column grid hosting the lead-form
   AND the market list. The lead-form was deleted (it duplicated three
   other lead-capture surfaces and produced unfixable visual overlap with
   the city-card on phones); only the market list remains, so the grid
   is now a simple block container. */
#rclx-map-modal .below-map {
  padding: 24px;
  border-top: 1px solid #26262e;
}

#rclx-map-modal .market-list-title {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 10px;
}
#rclx-map-modal .market-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #26262e;
  border-radius: 8px;
}
#rclx-map-modal .market-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #26262e;
  color: #fff;
  font-size: 13px;
}
#rclx-map-modal .market-list li:last-child { border-bottom: 0; }
#rclx-map-modal .market-list .city-name { font-weight: 600; }
#rclx-map-modal .market-list .city-state { color: #a1a1aa; font-size: 11px; margin-left: 6px; }
#rclx-map-modal .market-list .pill {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #3a3a44;
  color: #a1a1aa;
}
#rclx-map-modal .market-list .pill[data-status="launched"]  { color: #06B6D4; border-color: #06B6D4; }
#rclx-map-modal .market-list .pill[data-status="building"]  { color: #E63946; border-color: #E63946; }
#rclx-map-modal .market-list .pill[data-status="announced"] { color: #f59e0b; border-color: #f59e0b; }

#rclx-map-modal .map-disclaimer {
  padding: 10px 24px 18px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #71717a;
  text-align: center;
  border-top: 1px solid #26262e;
}

#rclx-map-modal .map-source {
  padding: 0 24px 18px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #71717a;
  text-align: center;
}

/* Lock body scroll when modal open */
body.rclx-modal-open { overflow: hidden; }

/* Visually-hidden helper for input labels (sr-only equivalent). */
#rclx-map-modal .sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Market list row buttons (clickable to open city card) ---- */
#rclx-map-modal .market-list .market-list-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  min-height: 44px;
}
#rclx-map-modal .market-list li {
  /* The <li>'s own padding is now provided by the inner button so the
     hit target spans the full row. */
  padding: 0 14px;
}
#rclx-map-modal .market-list .market-list-row:hover {
  background: rgba(255, 255, 255, 0.03);
}
#rclx-map-modal .market-list .market-list-row:focus-visible {
  outline: 2px solid #06B6D4;
  outline-offset: -2px;
  border-radius: 4px;
}

/* Fix #29: the city-card panel (~150 lines of CSS for the bottom-sheet
   slab, its close button, eyebrow/title/sub text, name+phone form, and
   success/error states) was deleted alongside the JS. The map's only
   remaining tap-driven UI is the grey-state fallback panel (when a rep
   taps an uncovered county or searches for one). The .map-stage still
   needs position: relative for the tooltip's absolute positioning. */
#rclx-map-modal .map-stage {
  position: relative;
}

/* ---- Search row (Fix #1) ----
   Lives between header and legend. The text input + button pair is the
   primary entry point for reps with a specific city in mind. */
#rclx-map-modal .map-search {
  padding: 12px 24px 14px;
  border-bottom: 1px solid #26262e;
  background: #16161b;
}
#rclx-map-modal .map-search-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
#rclx-map-modal .map-search-form input[type="text"] {
  flex: 1;
  background: rgba(10, 10, 14, 0.65);
  border: 1px solid #3a3a44;
  border-radius: 8px;
  padding: 10px 14px;
  /* >=16px prevents iOS Safari zoom on focus. */
  font-size: 16px;
  color: #fff;
  font-family: inherit;
  min-height: 44px;
  transition: border-color .15s, background .15s;
}
#rclx-map-modal .map-search-form input::placeholder { color: #71717a; }
#rclx-map-modal .map-search-form input:focus {
  outline: none;
  border-color: #06B6D4;
  background: rgba(0, 0, 0, 0.7);
}
#rclx-map-modal .map-search-form button[type="submit"] {
  background: linear-gradient(90deg, #E63946 0%, #06B6D4 100%);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 0 22px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  white-space: nowrap;
  transition: filter .15s;
}
#rclx-map-modal .map-search-form button[type="submit"]:hover { filter: brightness(1.1); }
#rclx-map-modal .map-search-form button[type="submit"]:disabled { opacity: 0.6; cursor: default; }

/* Grey-state fallback panel — shown when the typed city isn't in our
   building.json. Captures the lead so the rep doesn't bounce silently.
   position: relative anchors the absolute-positioned × close button. */
#rclx-map-modal .map-search-fallback {
  position: relative;
  margin-top: 12px;
  padding: 14px 16px 16px;
  background: rgba(230, 57, 70, 0.05);
  border: 1px solid rgba(230, 57, 70, 0.25);
  border-radius: 10px;
}
/* Fix #5: × button to dismiss the panel and go back to the map. 44×44
   to meet Apple HIG minimum tap target. */
#rclx-map-modal .map-search-fallback-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 1px solid transparent;
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, background .15s;
}
#rclx-map-modal .map-search-fallback-close:hover {
  border-color: #3a3a44;
  background: rgba(255, 255, 255, 0.05);
}
#rclx-map-modal .map-search-fallback-close:focus-visible {
  outline: 2px solid #06B6D4;
  outline-offset: 2px;
}
#rclx-map-modal .map-search-fallback-msg {
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 12px;
  padding-right: 48px; /* clear the absolute × button */
}
#rclx-map-modal .map-search-fallback-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 540px) {
  #rclx-map-modal .map-search-fallback-row { grid-template-columns: 1fr; gap: 0; }
}
#rclx-map-modal .map-search-fallback-form input[type="text"],
#rclx-map-modal .map-search-fallback-form input[type="tel"] {
  width: 100%;
  background: rgba(10, 10, 14, 0.65);
  border: 1px solid #3a3a44;
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 16px;
  color: #fff;
  /* 14px (was 8px) — at <540px the grid collapses to a single column and
     the 8px gap rendered name + phone-number inputs as visually touching.
     Matches the city-card and lead-form spacing for a consistent rhythm. */
  margin-bottom: 14px;
  font-family: inherit;
  min-height: 44px;
  transition: border-color .15s;
}
#rclx-map-modal .map-search-fallback-form input::placeholder { color: #71717a; }
#rclx-map-modal .map-search-fallback-form input:focus {
  outline: none;
  border-color: #06B6D4;
  background: rgba(0, 0, 0, 0.7);
}
#rclx-map-modal .map-search-fallback-form .consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 11px;
  color: #a1a1aa;
  line-height: 1.5;
  margin: 4px 0 12px;
}
#rclx-map-modal .map-search-fallback-form .consent input {
  /* Fix #24: was 16px — see lead-form .consent input for rationale. */
  width: 22px; height: 22px; margin: 0;
  flex: 0 0 22px;
}
#rclx-map-modal .map-search-fallback-form button[type="submit"] {
  width: 100%;
  background: linear-gradient(90deg, #E63946 0%, #06B6D4 100%);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  transition: filter .15s;
}
#rclx-map-modal .map-search-fallback-form button[type="submit"]:hover { filter: brightness(1.1); }
#rclx-map-modal .map-search-fallback-form button[type="submit"]:disabled { opacity: 0.6; cursor: default; }
#rclx-map-modal .map-search-fallback-form .form-msg {
  font-size: 12px;
  margin-top: 6px;
  color: #a1a1aa;
  min-height: 18px;
}
#rclx-map-modal .map-search-fallback-form .form-msg.success { color: #06B6D4; }
#rclx-map-modal .map-search-fallback-form .form-msg.error   { color: #f87171; }
#rclx-map-modal .map-search-fallback-success {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #06B6D4;
  border-radius: 10px;
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

/* Brief flash on a county after a successful search match (Fix #1).
   !important is needed to win over the steady-state .new-build animation
   on red counties; the flash class is removed after 1.5s by JS so the
   override is short-lived. */
#rclx-map-modal .county.rclx-search-flash {
  animation: rclx-search-flash 1.5s ease-out both !important;
}
@keyframes rclx-search-flash {
  0%   { fill: #fff; stroke: #fff; stroke-width: 1.8; }
  40%  { fill: #ffd1c2; stroke: #fff; stroke-width: 1.4; }
  100% { fill: #E63946; stroke: rgba(255, 255, 255, 0.45); stroke-width: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  #rclx-map-modal .county.rclx-search-flash { animation: none !important; }
}
