:root {
  --bg: #05070d;
  --bg-raised: #0b1020;
  --panel: rgba(12, 17, 31, 0.78);
  --panel-solid: #0c1220;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.26);
  --text: #e9edf6;
  --muted: #93a0b8;
  --blue: #4f8cff;
  --blue-soft: #7fb4ff;
  --blue-glow: rgba(79, 140, 255, 0.35);
  --danger: #ff8a8a;
  --radius-lg: 22px;
  --radius-md: 14px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(56, 108, 255, 0.22), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(32, 80, 200, 0.16), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 75%);
}

a { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--blue-soft); outline-offset: 2px; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px clamp(18px, 4vw, 40px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.06em;
  text-decoration: none;
}
.brand-accent { color: var(--blue-soft); }
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--blue) 0%, #1c2f6b 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset, 0 6px 18px var(--blue-glow);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.9;
}

.site-nav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.site-nav a { text-decoration: none; color: var(--muted); transition: color .2s; }
.site-nav a:hover { color: var(--text); }
.site-nav .nav-cta {
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
}
.site-nav .nav-cta:hover { border-color: var(--blue); }

/* Hero layout */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-areas:
    "copy map"
    "form map";
  grid-template-rows: auto 1fr;
  gap: 28px clamp(24px, 4vw, 56px);
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 40px) clamp(18px, 4vw, 40px) 64px;
  align-items: start;
}
.hero-copy { grid-area: copy; padding-top: 12px; }
.map-card { grid-area: map; }
.quick-start { grid-area: form; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(79, 140, 255, 0.07);
  color: var(--blue-soft);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.eyebrow-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.18);
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(38px, 5.2vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.025em;
}
.headline-accent {
  background: linear-gradient(90deg, #ffffff 0%, var(--blue-soft) 55%, var(--blue) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  max-width: 34em;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 1.4vw, 18px);
}

/* Map card */
.map-card {
  position: relative;
  height: clamp(480px, 74vh, 680px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--panel-solid);
  box-shadow:
    0 30px 80px -30px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 60px -20px var(--blue-glow);
  isolation: isolate;
}
.map-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 450;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 80px rgba(5, 7, 13, 0.45);
}

.map { position: absolute; inset: 0; background: #dfe2e6; }

.map .leaflet-tile-pane { filter: grayscale(0.92) contrast(1.06) brightness(1.03); }

.map-toolbar {
  position: absolute;
  top: 14px; left: 14px; right: 14px;
  z-index: 1000;
  display: flex;
  gap: 10px;
  pointer-events: none;
}
.map-toolbar > * { pointer-events: auto; }

.location-search {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 14px;
  border-radius: 999px;
  background: rgba(8, 11, 20, 0.86);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
}
.location-search:focus-within { border-color: var(--blue); }
.location-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 6px 0;
}
.location-search input::placeholder { color: #8a96ad; }
.location-search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

.icon {
  width: 18px; height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  color: var(--muted);
}

.search-submit, .locate-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 999px;
  transition: background .2s, border-color .2s, opacity .2s;
}
.search-submit {
  padding: 7px 14px;
  border: 0;
  background: var(--blue);
  color: #fff;
}
.search-submit:hover { background: #3d7af0; }
.search-submit:disabled { opacity: .6; cursor: progress; }

.locate-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 9px 14px;
  color: var(--text);
  background: rgba(8, 11, 20, 0.86);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
}
.locate-btn:hover { border-color: var(--blue); }
.locate-btn .icon { color: var(--blue-soft); }
.locate-btn[aria-busy="true"] { cursor: progress; opacity: .75; }
.locate-btn[aria-busy="true"] .icon { animation: spin 1.2s linear infinite; }

.map-chip {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 90px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(8, 11, 20, 0.88);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  white-space: nowrap;
}
.map-chip[hidden] { display: none; }
.map-chip-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.map-chip-meta { color: var(--muted); }
.map-chip-dot {
  width: 8px; height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 0 var(--blue-glow);
  animation: pulse 2.4s ease-out infinite;
}

.map-status {
  position: absolute;
  left: 50%;
  top: 70px;
  z-index: 1000;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 28px);
  margin: 0;
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(8, 11, 20, 0.92);
  border: 1px solid var(--line-strong);
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.map-status.is-visible { opacity: 1; }

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    radial-gradient(400px 240px at 50% 50%, rgba(79, 140, 255, 0.14), transparent 70%),
    #070b16;
  color: var(--muted);
  font-size: 14px;
  transition: opacity .45s ease, visibility .45s;
}
.map-loading.is-done { opacity: 0; visibility: hidden; }
.spinner {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(127, 180, 255, 0.18);
  border-top-color: var(--blue-soft);
  animation: spin .9s linear infinite;
}

.mobile-hint { display: none; }

/* Leaflet overrides */
.leaflet-container { font-family: var(--font-body); }
.leaflet-control-zoom.leaflet-bar {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
}
.leaflet-control-zoom a,
.leaflet-control-zoom a:hover {
  width: 34px; height: 34px;
  line-height: 34px;
  background: rgba(8, 11, 20, 0.88);
  color: var(--text);
  border-bottom-color: var(--line);
}
.leaflet-control-zoom a:hover { background: #121a2e; }
.leaflet-touch .leaflet-bar a { width: 36px; height: 36px; line-height: 36px; }
.leaflet-bottom.leaflet-right .leaflet-control-zoom { margin: 0 14px 40px 0; }
.leaflet-control-attribution {
  background: rgba(8, 11, 20, 0.72) !important;
  color: #aab4c8;
  font-size: 10.5px;
  border-top-left-radius: 8px;
}
.leaflet-control-attribution a { color: var(--blue-soft); }

/* Illustrative pins */
.aa-pin { background: none; border: 0; }
.aa-pin.leaflet-interactive { cursor: default; }
.aa-pin-inner {
  position: relative;
  width: 28px; height: 38px;
  transform-origin: 50% 100%;
  animation: pin-in .45s cubic-bezier(.2, .9, .3, 1.3) both;
  transition: transform .2s ease;
}
.aa-pin-inner svg {
  display: block;
  width: 100%; height: 100%;
  overflow: visible;
  filter: drop-shadow(0 5px 6px rgba(0, 0, 0, 0.35));
}
.aa-pin-inner::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -3px;
  width: 16px; height: 5px;
  margin-left: -8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  filter: blur(2px);
  z-index: -1;
}
.aa-pin:hover .aa-pin-inner { transform: translateY(-3px) scale(1.06); }
.aa-pin:hover .aa-pin-core { fill: #a9cbff; }
.aa-pin-ring { animation: ring 3.2s ease-in-out infinite; transform-origin: 14px 13.5px; }

.leaflet-tooltip.aa-tooltip {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #0a0c12;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.7);
}
.leaflet-tooltip-top.aa-tooltip::before { border-top-color: #0a0c12; }

/* Quick Start */
.quick-start-form {
  display: grid;
  gap: 16px;
  padding: clamp(20px, 2.4vw, 28px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.9);
}
.quick-start-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}
.quick-start-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: #c7cfdf; }
.field input {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: rgba(5, 8, 16, 0.75);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: #6f7b93; }
.field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.18);
}
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field-error, .form-error { margin: 0; color: var(--danger); font-size: 13px; }
.field-error:empty, .form-error:empty { display: none; }

.btn-primary {
  margin-top: 4px;
  padding: 15px 20px;
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #5b97ff 0%, #2f6bea 100%);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 14px 30px -12px rgba(79, 140, 255, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  transition: transform .15s ease, box-shadow .2s ease, filter .2s;
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 18px 36px -12px rgba(79, 140, 255, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.14) inset; }
.btn-primary:active { transform: translateY(1px); }
.form-note { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }

/* How it works */
.how {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px clamp(18px, 4vw, 40px) 80px;
}
.how h2 {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.step {
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 23, 42, 0.7), rgba(10, 14, 26, 0.5));
}
.step-num { font-family: var(--font-display); color: var(--blue-soft); font-weight: 600; letter-spacing: .08em; font-size: 13px; }
.step h3 { margin: 10px 0 6px; font-size: 17px; font-weight: 600; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; }

.site-footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px clamp(18px, 4vw, 40px) 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.site-footer p { margin: 0; }

/* Upload stand-in */
.standin { max-width: 640px; margin: 0 auto; padding: 48px 24px; }
.standin pre { padding: 16px; border-radius: 12px; background: var(--bg-raised); border: 1px solid var(--line); white-space: pre-wrap; }

/* Touch devices: pins are not hoverable, so show the hint instead */
@media (hover: none), (pointer: coarse) {
  .leaflet-control-zoom { display: none; }
  .map-chip { max-width: calc(100% - 28px); }
  .mobile-hint {
    display: block;
    position: absolute;
    left: 50%;
    bottom: 60px;
    z-index: 1000;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 28px);
    margin: 0;
    padding: 7px 13px;
    border-radius: 999px;
    background: #0a0c12;
    color: #fff;
    font-size: 12.5px;
    font-weight: 500;
    box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.7);
    pointer-events: none;
  }
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "copy" "map" "form";
    grid-template-rows: auto;
    gap: 22px;
  }
  .map-card { height: clamp(360px, 62vh, 520px); }
  .steps { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .site-nav a:not(.nav-cta) { display: none; }
  .hero-copy { padding-top: 0; }
  .map-toolbar { flex-wrap: wrap; }
  .location-search { max-width: none; flex-basis: 100%; }
  .locate-btn { margin-left: 0; }
  .map-status { top: 116px; }
  .map-card { border-radius: 18px; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 140, 255, 0.55); }
  80%, 100% { box-shadow: 0 0 0 9px rgba(79, 140, 255, 0); }
}
@keyframes pin-in {
  from { opacity: 0; transform: translateY(-10px) scale(.7); }
  to { opacity: 1; transform: none; }
}
@keyframes ring {
  0%, 100% { opacity: .35; transform: scale(1); }
  50% { opacity: .9; transform: scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
