/* Partner locator: mobile first, list below the map; side by side from 900 px. */
.locator {
  margin: 0;
}

.layout {
  display: grid;
  grid-template-areas: "controls" "map" "results";
}

.controls {
  grid-area: controls;
  padding: 12px 16px 4px;
}

.results {
  grid-area: results;
  padding: 4px 16px 24px;
}

.map-wrap {
  grid-area: map;
  position: relative;
  height: 55vh;
  min-height: 320px;
}

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

.search {
  display: flex;
  gap: 8px;
}

.search input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}

.search input:focus-visible,
.select select:focus-visible {
  outline: 2px solid var(--petrol);
  outline-offset: 1px;
}

.row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.select {
  position: relative;
  flex: 1;
  min-width: 0;
}

.select select {
  appearance: none;
  width: 100%;
  font: inherit;
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.select::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--petrol-dark);
  border-bottom: 2px solid var(--petrol-dark);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.toggle,
.chip {
  font: inherit;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--petrol-dark);
  background: var(--surface);
  color: var(--petrol-dark);
  cursor: pointer;
  min-height: 36px;
}

.toggle[aria-pressed='true'] {
  background: var(--petrol-dark);
  color: var(--on-accent);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  background: var(--sand);
  border-color: var(--line);
  color: var(--text);
}

.status {
  /* Two lines kept free: the "N partners on the map" line that replaces "Loading partners..."
     wraps on phones and in the side column, and must not push the map down (ADR 0046). */
  min-height: 2.8em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.count {
  /* Holds its line before the count is known, so the list does not move when it arrives. */
  min-height: 1lh;
  margin: 4px 0 8px;
  font-size: 14px;
  font-weight: 600;
}

/* The source line waits for the map and the list: shown before them, the list pushed it away
   (a layout shift on desktop, ADR 0046). */
.layout:not(:has(#map[data-ready="true"])) .results footer {
  display: none;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.list li {
  border-bottom: 1px solid var(--line);
}

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  padding: 10px 4px;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
}

.item:hover {
  background: var(--sand);
}

.item:focus-visible {
  outline: 2px solid var(--petrol);
  outline-offset: -2px;
}

.item[aria-current='true'] {
  background: var(--sand);
  box-shadow: inset 4px 0 0 var(--petrol-dark);
}

.item-name {
  font-weight: 600;
}

.item-meta {
  grid-column: 1;
  color: var(--muted);
  font-size: 14px;
}

.item-dist {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--petrol-dark);
  font-size: 14px;
  white-space: nowrap;
}

.empty,
.more,
.source {
  padding: 12px 4px;
  color: var(--muted);
  font-size: 14px;
}

.card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 28px;
  max-height: calc(100% - 56px);
  overflow: auto;
  padding: 14px 16px;
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  box-shadow: 0 4px 18px rgb(0 0 40 / 20%);
}

.card h2 {
  margin: 0 32px 8px 0;
  font-size: 18px;
}

.card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
  font-size: 14px;
}

.card dt {
  color: var(--muted);
}

.card dd {
  margin: 0;
}

.card-actions {
  margin: 12px 0 0;
}

.card-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text);
  cursor: pointer;
}

.card-close:focus-visible {
  outline: 2px solid var(--petrol);
}

@media (min-width: 900px) {
  .locator {
    height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .layout {
    flex: 1;
    min-height: 0;
    grid-template-columns: 400px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas: "controls map" "results map";
  }

  .controls,
  .results {
    border-right: 1px solid var(--line);
  }

  .results {
    overflow-y: auto;
    min-height: 0;
  }

  .map-wrap {
    height: auto;
    min-height: 0;
  }

  .card {
    left: auto;
    right: 16px;
    top: 16px;
    bottom: auto;
    width: 340px;
  }
}

/* Equal Earth world overview over the map (ADR 0044). */
.overview {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: auto;
  padding: 12px 16px;
  background: var(--surface);
}

.overview[hidden] {
  display: none;
}

.overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.overview-head h2 {
  margin: 0;
  font-size: 1.125rem;
}

.overview-hint {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.875rem;
}
