:root {
  --navy: #071a2d;
  --navy-soft: #0c2a45;
  --blue: #29a9df;
  --blue-light: #8bdcf6;
  --page: #f3f7f9;
  --white: #ffffff;
  --text: #142b3a;
  --muted: #607786;
  --border: #d7e1e7;
  --shadow: 0 12px 34px rgba(7, 26, 45, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  background: var(--page);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: relative;
  z-index: 1000;
  color: var(--white);
  background: var(--navy);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-drop {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 50% 12%;
  color: var(--navy);
  background: linear-gradient(135deg, var(--blue-light), var(--blue));
  transform: rotate(45deg);
  box-shadow: 0 8px 22px rgba(41, 169, 223, 0.28);
}

.brand-drop::first-letter {
  transform: rotate(-45deg);
}

.brand-drop {
  font-size: 0;
}

.brand-drop::after {
  content: "F";
  font-size: 16px;
  font-weight: 900;
  transform: rotate(-45deg);
}

.header-link {
  color: var(--blue-light);
  text-decoration: none;
  font-weight: 700;
}

.hero {
  color: var(--white);
  background:
    radial-gradient(circle at 15% 0%, rgba(41, 169, 223, 0.27), transparent 33rem),
    linear-gradient(140deg, var(--navy), var(--navy-soft));
}

.hero-inner {
  min-height: 310px;
  padding: 62px 0 86px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 48px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero-copy {
  max-width: 760px;
  margin: 24px 0 0;
  color: #d9edf7;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.hero-actions {
  min-width: 180px;
  display: grid;
  gap: 10px;
}

.button {
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 800;
}

.button-primary {
  color: #04131d;
  background: linear-gradient(135deg, var(--blue-light), var(--blue));
}

.button-secondary {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.search-panel {
  position: relative;
  z-index: 900;
  margin-top: -38px;
  padding: 18px;
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.search-panel label {
  display: grid;
  gap: 7px;
  color: #3f5868;
  font-size: 0.82rem;
  font-weight: 800;
}

.search-panel input,
.search-panel select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--text);
  border: 1px solid #bbcbd4;
  border-radius: 8px;
  background: var(--white);
}

.search-panel input:focus,
.search-panel select:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(41, 169, 223, 0.16);
}

.map-layout {
  width: min(1440px, calc(100% - 32px));
  margin: 28px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 20px;
}

.map-column,
.results-column {
  min-height: 660px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.map-column {
  position: relative;
}

#map {
  width: 100%;
  height: 660px;
  background: #dfeaf0;
}

.map-message {
  position: absolute;
  z-index: 700;
  top: 18px;
  left: 50%;
  width: min(520px, calc(100% - 36px));
  padding: 12px 15px;
  border: 1px solid #d1dde4;
  border-radius: 9px;
  color: #355163;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(7, 26, 45, 0.13);
  transform: translateX(-50%);
}

.results-column {
  display: flex;
  flex-direction: column;
}

.results-heading {
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.results-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}

.count-badge {
  min-width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--navy);
  background: #dcf2fb;
  font-weight: 900;
}

.status-message {
  margin: 18px;
  padding: 14px;
  border: 1px solid #cbdce5;
  border-radius: 9px;
  color: #3a596a;
  background: #f2f9fc;
}

.results-list {
  overflow-y: auto;
}

.result-card {
  width: 100%;
  padding: 20px 22px;
  display: block;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  text-align: left;
}

.result-card:hover,
.result-card:focus {
  background: #f5fbfd;
  outline: none;
}

.result-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.result-card h3 {
  margin: 0;
  color: var(--navy);
  font-size: 1.05rem;
}

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

.result-distance {
  flex: 0 0 auto;
  color: #177fa9;
  font-size: 0.82rem;
  font-weight: 900;
}

.result-tags {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  color: #365466;
  background: #edf3f6;
  font-size: 0.72rem;
  font-weight: 800;
}

.water-marker {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 3px solid var(--white);
  border-radius: 50% 50% 50% 12%;
  color: var(--white);
  background: #188ec0;
  box-shadow: 0 4px 12px rgba(7, 26, 45, 0.35);
  transform: rotate(45deg);
}

.water-marker span {
  font-size: 13px;
  font-weight: 900;
  transform: rotate(-45deg);
}

.water-marker.type-private-fill-station {
  background: #6c56b5;
}

.water-marker.type-hydrant-meter-program {
  background: #d36b35;
}

.water-marker.type-approved-hydrant-fill-location {
  background: #d34b4b;
}

.water-marker.type-water-delivery-company {
  background: #367d55;
}

.water-marker.type-temporary-project-source {
  background: #7a6d54;
}

.user-marker {
  width: 18px;
  height: 18px;
  border: 4px solid var(--white);
  border-radius: 50%;
  background: #0a77ff;
  box-shadow: 0 0 0 2px #0a77ff, 0 4px 12px rgba(7, 26, 45, 0.35);
}

.popup-card {
  min-width: 260px;
  max-width: 320px;
}

.popup-card h3 {
  margin: 0 0 6px;
  color: var(--navy);
}

.popup-card p {
  margin: 5px 0;
}

.popup-label {
  color: #526a78;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.popup-actions {
  margin-top: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.popup-actions a {
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--white);
  background: var(--navy);
  text-decoration: none;
  font-weight: 800;
}

.popup-actions a.secondary {
  color: var(--navy);
  background: #dff3fb;
}

.trust-section {
  padding: 72px 0;
}

.trust-section h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.3rem);
  letter-spacing: -0.04em;
}

.trust-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.trust-grid article {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--white);
}

.trust-grid h3 {
  margin: 0 0 9px;
}

.trust-grid p {
  margin: 0;
  color: var(--muted);
}

.site-footer {
  color: #b9d0dd;
  background: var(--navy);
}

.footer-inner {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font-size: 0.86rem;
}

@media (max-width: 1050px) {
  .search-panel {
    grid-template-columns: 1fr 1fr;
  }

  .map-layout {
    grid-template-columns: 1fr;
  }

  .results-column {
    min-height: auto;
  }

  .results-list {
    max-height: 520px;
  }
}

@media (max-width: 700px) {
  .header-link {
    display: none;
  }

  .hero-inner {
    padding: 44px 0 72px;
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions {
    grid-template-columns: 1fr 1fr;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .map-layout {
    width: 100%;
    gap: 0;
  }

  .map-column,
  .results-column {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  #map,
  .map-column {
    height: 480px;
    min-height: 480px;
  }

  .trust-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    padding: 22px 0;
    align-items: flex-start;
    flex-direction: column;
  }
}

/* MapTiler / MapLibre map controls and markers */
.map-style-control {
  position: absolute;
  z-index: 20;
  top: 12px;
  right: 12px;
  padding: 4px;
  display: inline-flex;
  gap: 3px;
  border: 1px solid rgba(7, 26, 45, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 12px rgba(7, 26, 45, 0.22);
  backdrop-filter: blur(8px);
}

.map-style-button {
  min-height: 34px;
  padding: 6px 11px;
  border: 0;
  border-radius: 7px;
  color: #405968;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 900;
}

.map-style-button:hover,
.map-style-button:focus-visible {
  color: var(--navy);
  background: #edf6fa;
  outline: none;
}

.map-style-button.is-active {
  color: var(--white);
  background: var(--navy);
}

.maplibregl-ctrl-group {
  overflow: hidden;
  border-radius: 9px;
  box-shadow: 0 3px 12px rgba(7, 26, 45, 0.2);
}

.maplibregl-popup-content {
  padding: 16px;
  border-radius: 11px;
  box-shadow: 0 12px 30px rgba(7, 26, 45, 0.22);
}

.maplibregl-popup-close-button {
  width: 30px;
  height: 30px;
  color: #536b79;
  font-size: 22px;
}

.maplibregl-popup-close-button:hover {
  color: var(--navy);
  background: #edf5f8;
}

.water-marker,
.user-marker {
  cursor: pointer;
}

.result-card.is-active {
  background: #edf8fc;
  box-shadow: inset 4px 0 0 var(--blue);
}

@media (max-width: 700px) {
  .map-style-control {
    top: 10px;
    right: 10px;
  }

  .map-style-button {
    min-height: 32px;
    padding: 5px 9px;
  }
}

.water-marker-anchor {
  width: 38px;
  height: 42px;
  display: grid;
  place-items: start center;
  cursor: pointer;
}

.water-marker-anchor:focus-visible {
  border-radius: 8px;
  outline: 3px solid rgba(41, 169, 223, 0.86);
  outline-offset: 3px;
}

.water-marker-anchor .water-marker {
  cursor: inherit;
}

/* Place search and improved current-location controls */
.search-panel {
  overflow: visible;
}

.place-search-field {
  position: relative;
  display: grid;
  gap: 7px;
  min-width: 0;
}

.place-search-field > label {
  display: block;
  color: #3f5868;
  font-size: 0.82rem;
  font-weight: 800;
}

.place-search-input-wrap {
  position: relative;
}

.place-search-input-wrap input {
  padding-right: 66px;
}

.search-clear-button {
  position: absolute;
  top: 50%;
  right: 7px;
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  color: #426174;
  background: #edf4f7;
  font-size: 0.74rem;
  font-weight: 900;
  transform: translateY(-50%);
}

.search-clear-button:hover,
.search-clear-button:focus-visible {
  color: var(--navy);
  background: #dcecf3;
  outline: 2px solid rgba(41, 169, 223, 0.25);
}

.field-help {
  min-height: 1.1rem;
  color: #6b8290;
  font-size: 0.72rem;
  line-height: 1.35;
}

.place-suggestions {
  position: absolute;
  z-index: 2500;
  top: 73px;
  right: 0;
  left: 0;
  max-height: 330px;
  overflow-y: auto;
  border: 1px solid #b9ccd7;
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 16px 38px rgba(7, 26, 45, 0.2);
}

.place-suggestion {
  width: 100%;
  padding: 12px 14px;
  display: grid;
  gap: 2px;
  border: 0;
  border-bottom: 1px solid #e2eaf0;
  color: var(--text);
  background: var(--white);
  text-align: left;
}

.place-suggestion:last-child {
  border-bottom: 0;
}

.place-suggestion:hover,
.place-suggestion:focus-visible,
.place-suggestion.is-active {
  background: #edf8fc;
  outline: none;
}

.place-suggestion-primary {
  color: var(--navy);
  font-weight: 900;
}

.place-suggestion-secondary {
  color: var(--muted);
  font-size: 0.78rem;
}

.place-suggestion-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 0.84rem;
}

.map-locate-control {
  position: absolute;
  z-index: 20;
  top: 86px;
  left: 10px;
  width: 34px;
  height: 34px;
  padding: 7px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #304f61;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 3px 12px rgba(7, 26, 45, 0.22);
}

.map-locate-control svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.map-locate-control:hover,
.map-locate-control:focus-visible,
.map-locate-control.is-active {
  color: #086cad;
  background: #e9f6fc;
  outline: none;
}

.map-locate-control.is-busy svg {
  animation: fbw-locate-spin 1s linear infinite;
}

@keyframes fbw-locate-spin {
  to {
    transform: rotate(360deg);
  }
}

.search-marker {
  width: 28px;
  height: 28px;
  border: 4px solid var(--white);
  border-radius: 50% 50% 50% 12%;
  background: #f59b23;
  box-shadow: 0 4px 14px rgba(7, 26, 45, 0.36);
  transform: rotate(45deg);
}

.search-marker::after {
  content: "";
  width: 8px;
  height: 8px;
  position: absolute;
  top: 6px;
  left: 6px;
  border-radius: 50%;
  background: var(--white);
}

.user-marker {
  position: relative;
}

.user-marker::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(10, 119, 255, 0.35);
  border-radius: 50%;
  animation: fbw-location-pulse 2s ease-out infinite;
}

@keyframes fbw-location-pulse {
  0% {
    opacity: 0.9;
    transform: scale(0.55);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

@media (max-width: 1050px) {
  .place-search-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .place-search-field {
    grid-column: auto;
  }

  .place-suggestions {
    max-height: 260px;
  }

  .map-locate-control {
    top: 86px;
  }
}
