/* Match the landing page background: flat cream (same #F4F0E8 as --bg),
   without main.css's dot pattern. */
body {
  background-image: none;
}

.zones-page {
  padding-top: 8px;
  padding-bottom: 96px;
}

.zones-hero {
  max-width: 720px;
  margin-bottom: 24px;
}

.zones-kicker {
  display: inline-block;
  margin-bottom: 8px;
  font-family: 'Caveat', cursive;
  color: var(--pink-shadow);
  font-size: 24px;
  font-weight: 700;
  transform: rotate(-1deg);
}

.zones-hero h1 {
  margin-bottom: 10px;
}

.zones-hero p,
.zones-note {
  color: var(--muted);
  margin: 0;
}

/* "Create a Campaign" CTA in the hero. The coin-burst hover comes from
   site-chrome (.money-cta); hidden in embed mode via [data-zones-chrome]. */
.zones-cta {
  margin-top: 18px;
}

.zone-search {
  position: absolute;
  z-index: 5;
  top: 18px;
  left: 18px;
  width: min(420px, calc(100% - 36px));
}

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

.zone-search__row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 0 12px;
}

.zone-search__icon {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 20px;
}

.zone-search__input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  padding: 16px 0;
  font: inherit;
  background: transparent;
  color: var(--ink);
  outline: 0;
}

.zone-search__submit {
  flex: 0 0 auto;
  border: 0;
  border-left: 1px solid rgba(10, 10, 10, 0.14);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 0 6px 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.zone-search__submit:disabled {
  cursor: wait;
  opacity: 0.55;
}

.zone-search__result {
  margin-top: 10px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 750;
  background: rgba(255, 253, 248, 0.96);
  color: var(--muted);
  box-shadow: 3px 3px 0 var(--ink);
}

.zone-search__result:empty {
  display: none;
}

.zone-search__result.is-supported {
  background: rgba(34, 197, 94, 0.14);
  color: #166534;
}

.zone-search__result.is-unsupported {
  background: rgba(255, 45, 45, 0.12);
  color: #991b1b;
}

.zone-search__result.is-error {
  background: #fff3cd;
  color: #7c4a03;
}

.zones-map-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
  animation: zones-card-launch 860ms cubic-bezier(0.2, 1.25, 0.32, 1) both;
  transform-origin: 50% 60%;
}

.zones-map-full {
  min-height: 540px;
  isolation: isolate;
}

.zones-map-full::before,
.zones-map-full::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 4;
}

.zones-map-full::before {
  inset: -35%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 45, 45, 0.22) 0 9%, transparent 10% 17%, rgba(255, 255, 255, 0.28) 18% 19%, transparent 20%),
    conic-gradient(from -35deg, transparent 0deg 284deg, rgba(255, 255, 255, 0.68) 300deg, transparent 326deg);
  opacity: 0;
  transform: scale(0.62) rotate(-22deg);
}

.zones-map-full::after {
  top: -18%;
  bottom: -18%;
  width: 34%;
  left: -42%;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.16) 28%, rgba(255, 255, 255, 0.72) 50%, rgba(255, 45, 45, 0.18) 64%, transparent 100%);
  filter: blur(0.5px);
  opacity: 0;
  transform: skewX(-14deg);
}

body.zones-map-ready .zones-map-full {
  animation: zones-map-pop 860ms cubic-bezier(0.2, 1.25, 0.32, 1) both;
}

body.zones-map-ready .zones-map-full::before {
  animation: zones-radar-burst 1200ms ease-out 120ms both;
}

body.zones-map-ready .zones-map-full::after {
  animation: zones-search-sweep 1100ms cubic-bezier(0.16, 1, 0.3, 1) 180ms both;
}

/* Map on the left, the covered-cities panel beside it on wide screens. Both
   share one height so their bottom edges line up; the city list scrolls
   inside the panel when it is longer. */
@media (min-width: 900px) {
  .zones-map-card {
    --zones-map-h: clamp(520px, 68vh, 680px);
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  /* Beats .map-full's calc(100vh - 200px) and the 540px floor above (same
     specificity, later in source). */
  .zones-map-full {
    height: var(--zones-map-h);
    min-height: 0;
  }
}

.zones-map {
  position: absolute;
  inset: 0;
}

body.zones-embed [data-zones-chrome] {
  display: none;
}

body.zones-embed .site-header,
body.zones-embed footer.tail {
  display: none;
}

body.zones-embed .zones-page {
  max-width: none;
  padding: 18px;
}

body.zones-embed .zones-hero {
  margin-bottom: 16px;
}

body.zones-embed .zones-hero h1 {
  font-size: clamp(28px, 5vw, 40px);
}

body.zones-embed .zones-map-full {
  height: min(52vh, 480px);
  min-height: 320px;
}

/* bare=1 embed (used by /how-it-works): host page owns the heading, the map
   fills the whole iframe viewport minus the embed padding. */
body.zones-bare .zones-hero {
  display: none;
}

body.zones-bare .zones-page {
  padding-top: 18px;
  padding-bottom: 18px;
}

body.zones-bare .zones-map-full {
  height: calc(100vh - 36px);
  min-height: 0;
}

@media (max-width: 820px) {
  .zone-search__row {
    gap: 8px;
  }

  .zones-map-full {
    min-height: 420px;
  }
}

/* Coverage pin popups + the "cities we cover" panel beside the map. The pins
   themselves render inside the map's WebGL canvas (symbol layer), not as DOM
   elements — HTML markers drift in globe projection (mapbox-gl-js #12592). */
.zone-pop { font: 600 13px/1.3 'Inter', system-ui, sans-serif; color: var(--ink); padding: 1px 2px; }

.zones-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  background: var(--white);
  padding: 20px;
}

/* Beside the map the panel takes the same height as it (--zones-map-h), so
   the two bottom edges align. Stacked below on narrow screens it grows
   naturally. */
@media (min-width: 900px) {
  .zones-side {
    height: var(--zones-map-h);
  }

  /* The customer popup's map is shorter (52vh capped at 480px, floored at
     320px) — give the panel the same effective height. */
  body.zones-embed .zones-side {
    height: max(min(52vh, 480px), 320px);
  }

  /* bare embed: the panel matches the full-viewport map height. */
  body.zones-bare .zones-side {
    height: calc(100vh - 36px);
  }
}

/* Failure / empty states (zones API down, nothing published): collapse the
   panel chrome so the note sits below the full-width map, like pre-panel. */
body.zones-no-cities .zones-map-card {
  grid-template-columns: 1fr;
}

body.zones-no-cities .zones-side {
  border: 0;
  background: none;
  padding: 0;
  height: auto;
}

body.zones-no-cities .zones-side__title {
  display: none;
}

.zones-side__title {
  margin: 0;
  font-size: 22px;
}

.zones-side .zones-note {
  font-size: 14px;
}

.zones-cities {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}
.zones-cities:empty { display: none; }
.zones-cities__item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--ink);
  background: rgba(255, 253, 248, 0.96);
  border-radius: 10px;
  padding: 10px 12px;
  font: 600 14px/1.2 'Inter', system-ui, sans-serif;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
  animation: zones-row-slide 520ms cubic-bezier(0.2, 1.2, 0.32, 1) both;
}
.zones-cities__item:nth-child(1) { animation-delay: 140ms; }
.zones-cities__item:nth-child(2) { animation-delay: 185ms; }
.zones-cities__item:nth-child(3) { animation-delay: 230ms; }
.zones-cities__item:nth-child(4) { animation-delay: 275ms; }
.zones-cities__item:nth-child(5) { animation-delay: 320ms; }
.zones-cities__item:nth-child(6) { animation-delay: 365ms; }
.zones-cities__item:nth-child(7) { animation-delay: 410ms; }
.zones-cities__item:nth-child(8) { animation-delay: 455ms; }
.zones-cities__item:hover { background: rgba(255, 45, 45, 0.1); }
.zones-cities__item svg { flex: 0 0 auto; }

@keyframes zones-card-launch {
  0% {
    opacity: 0;
    transform: translateY(34px) rotate(-0.8deg) scale(0.955);
  }
  52% {
    opacity: 1;
    transform: translateY(-8px) rotate(0.35deg) scale(1.012);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0) scale(1);
  }
}

@keyframes zones-map-pop {
  0% {
    filter: saturate(0.72) brightness(0.84);
    transform: scale(0.985);
  }
  45% {
    filter: saturate(1.25) brightness(1.08);
    transform: scale(1.008);
  }
  100% {
    filter: saturate(1) brightness(1);
    transform: scale(1);
  }
}

@keyframes zones-radar-burst {
  0% {
    opacity: 0;
    transform: scale(0.48) rotate(-28deg);
  }
  18% {
    opacity: 1;
  }
  72% {
    opacity: 0.62;
  }
  100% {
    opacity: 0;
    transform: scale(1.28) rotate(18deg);
  }
}

@keyframes zones-search-sweep {
  0% {
    opacity: 0;
    left: -42%;
  }
  16% {
    opacity: 1;
  }
  70% {
    opacity: 0.86;
  }
  100% {
    opacity: 0;
    left: 108%;
  }
}

@keyframes zones-row-slide {
  0% {
    opacity: 0;
    transform: translateX(24px) rotate(0.8deg) scale(0.97);
  }
  62% {
    opacity: 1;
    transform: translateX(-4px) rotate(-0.25deg) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotate(0) scale(1);
  }
}

/* Phones: the floating search overlay covers most of an already-small map,
   so on narrow screens we drop the overlay entirely. The map card becomes a
   simple stack — search bar on top in normal flow, the map framed below it,
   then the cities panel underneath. The three listed selectors each match or
   beat the embed/bare height rules above and responsive.css's `.map-full`. */
@media (max-width: 640px) {
  .zones-map-card {
    gap: 12px;
  }

  /* Embedded in the /customer modal the host already shows a "delivery
     coverage" title, so the iframe's own hero is redundant and just eats
     scarce vertical space. Standalone /zones keeps its hero. */
  body.zones-embed .zones-hero {
    display: none;
  }

  .zones-page .zones-map-full,
  body.zones-embed .zones-map-full,
  body.zones-bare .zones-map-full {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: auto;
    min-height: 0;
    border: 0;
    background: none;
    overflow: visible;
  }

  /* The decorative radar/sweep bursts assume the map fills the box; with the
     stacked layout and visible overflow they spill, so skip them on phones. */
  .zones-map-full::before,
  .zones-map-full::after {
    display: none;
  }

  .zone-search {
    position: static;
    width: 100%;
  }

  .zone-search__input {
    padding: 13px 0;
  }

  .zones-map {
    position: relative;
    inset: auto;
    height: clamp(300px, 56vh, 440px);
    border: 1.5px solid var(--ink);
    border-radius: 14px;
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zones-map-card,
  .zones-map-full,
  .zones-map-full::before,
  .zones-map-full::after,
  .zones-cities__item {
    animation: none;
  }
}
