/* Build 775: keep OM discovery choices and usable recommendations ahead of rollout education. */

html body .our-map-discovery-status-row {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

html body main.app-shell section.map-stage.map-focus.our-map-mode .our-map-discovery-bar:not([hidden]) {
  z-index: 730 !important;
  background:
    radial-gradient(circle at 2% 0%, rgba(108, 223, 193, 0.2), transparent 30%),
    rgba(250, 255, 253, 0.985) !important;
}

html body main.app-shell section.map-stage.map-focus.our-map-mode .our-map-discovery-status-row .our-map-spot-count {
  min-width: 0;
  min-height: 22px !important;
  flex: 1 1 auto;
  margin: 0 !important;
}

html body .our-map-use-location {
  display: inline-flex;
  min-width: max-content;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid rgba(11, 119, 103, 0.2);
  border-radius: 13px;
  color: #126b62;
  background: rgba(239, 249, 246, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  font: inherit;
  font-size: 0.66rem;
  font-weight: 880;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

html body .our-map-use-location > span:first-child,
html body .our-map-use-location svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

html body .our-map-use-location:focus-visible {
  outline: 3px solid rgba(7, 132, 118, 0.34);
  outline-offset: 2px;
}

/* The original card type was technically legible but felt miniature on a phone. */
html body .our-map-result-source,
html body .our-map-result-trust {
  font-size: 0.57rem;
}

html body .our-map-result-main > small,
html body .our-map-result-meta {
  font-size: 0.64rem;
  line-height: 1.3;
}

html body .our-map-result-why {
  font-size: 0.69rem;
  line-height: 1.4;
}

html body .our-map-result-main > b,
html body .our-map-result-actions button {
  font-size: 0.64rem;
}

html body .our-map-empty-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
}

html body .our-map-empty-actions button {
  min-width: max-content;
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid rgba(11, 119, 103, 0.2);
  border-radius: 12px;
  color: #126b62;
  background: rgba(255, 255, 255, 0.94);
  font: inherit;
  font-size: 0.63rem;
  font-weight: 860;
  cursor: pointer;
}

html body .our-map-empty-actions button:first-child {
  border-color: #087d72;
  color: #ffffff;
  background: linear-gradient(145deg, #087d72, #18aa93);
}

html body .our-map-empty-actions button:focus-visible {
  outline: 3px solid rgba(7, 132, 118, 0.34);
  outline-offset: 2px;
}

html body .our-map-result-actions button[data-our-map-result-save]:is([aria-pressed="true"], .is-saved),
html body .our-map-popup .our-map-save-later-action:is([aria-pressed="true"], .is-saved) {
  border-color: rgba(7, 125, 114, 0.38);
  color: #087168;
  background: linear-gradient(145deg, #e0f6ef, #f4fcf9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.78), 0 6px 14px rgba(4, 91, 83, 0.1);
}

/* A retained shortlist stays useful while it refreshes; the quiet label explains the movement. */
html body .our-map-results:has(.our-map-result-list[aria-busy="true"]) .our-map-results-heading::after {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  margin-left: auto;
  padding: 0 8px;
  border-radius: 999px;
  color: #537570;
  background: rgba(224, 243, 237, 0.9);
  content: "Refreshing…";
  font-size: 0.56rem;
  font-weight: 820;
  letter-spacing: 0.02em;
  animation: omDiscoveryRefreshPulse 1.4s ease-in-out infinite;
}

html body .our-map-results:has(.our-map-result-list[aria-busy="true"]) #ourMapShowAllResults {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  html body .our-map-use-location:hover {
    border-color: rgba(8, 118, 102, 0.38);
    background: #ffffff;
    box-shadow: 0 7px 17px rgba(12, 79, 71, 0.1);
    transform: translateY(-1px);
  }

  html body .our-map-empty-actions button:hover {
    border-color: rgba(8, 118, 102, 0.38);
    box-shadow: 0 7px 17px rgba(12, 79, 71, 0.1);
    transform: translateY(-1px);
  }

  html body .our-map-result-actions button[data-our-map-result-save]:is([aria-pressed="true"], .is-saved):hover,
  html body .our-map-popup .our-map-save-later-action:is([aria-pressed="true"], .is-saved):hover {
    border-color: rgba(7, 125, 114, 0.54);
    color: #075f58;
    background: linear-gradient(145deg, #d8f3ea, #effaf6);
  }
}

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  html body main.app-shell section.map-stage.map-focus.our-map-mode .our-map-discovery-bar:not([hidden]) {
    max-height: min(
      78dvh,
      calc(100dvh - var(--bottom-nav-height, 78px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 72px)
    ) !important;
    gap: 8px !important;
    scroll-padding-block: 51px 18px !important;
  }

  html body .our-map-tray-head {
    padding-bottom: 3px !important;
  }

  html body .our-map-intent-picker {
    gap: 6px;
  }

  html body .our-map-intent-heading {
    min-height: 42px;
  }

  html body .our-map-results {
    gap: 6px;
  }

  html body .our-map-results-heading {
    min-height: 39px;
  }

  html body .our-map-result-card {
    min-height: 204px;
    gap: 7px;
  }

  html body .our-map-coverage-note {
    margin-top: 5px;
  }
}

@media (max-width: 420px) {
  html body .our-map-discovery-status-row {
    gap: 7px;
  }

  html body .our-map-use-location {
    padding-inline: 9px;
    font-size: 0.63rem;
  }

  html body .our-map-result-list {
    grid-auto-columns: min(84vw, 296px);
  }
}

/* Short landscape screens use the drawer as a calm near-full-screen work surface.
   The shortlist remains above rollout notes without shrinking its actions. */
@media (max-height: 620px) and (min-width: 600px) {
  html body main.app-shell section.map-stage.map-focus.our-map-mode .our-map-discovery-bar:not([hidden]) {
    z-index: 830 !important;
    bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
    grid-template-columns: minmax(230px, 0.78fr) minmax(310px, 1.22fr) !important;
    grid-template-areas:
      "head head"
      "intent status"
      "intent results"
      "signin signin"
      "coverage coverage"
      "cities cities"
      "worlds worlds"
      "contribute contribute" !important;
    width: min(920px, calc(100vw - max(20px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px)))) !important;
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px))) !important;
  }

  html body .our-map-tray-head { grid-area: head; }
  html body .our-map-intent-picker { grid-area: intent; align-self: start; }
  html body .our-map-discovery-status-row { grid-area: status; }
  html body .our-map-results { grid-area: results; }
  html body .our-map-live-sign-in { grid-area: signin; }
  html body .our-map-coverage-note { grid-area: coverage; }
  html body .our-map-florida-city-jumps { grid-area: cities; }
  html body .our-map-worlds-note { grid-area: worlds; }
  html body .our-map-contribute-help { grid-area: contribute; }

  html body main.app-shell section.map-stage.map-focus.our-map-mode .our-map-mood-choices {
    flex-wrap: wrap !important;
    align-content: start !important;
    overflow: visible !important;
  }

  html body main.app-shell section.map-stage.map-focus.our-map-mode .our-map-mood-choices button {
    min-width: calc(50% - 4px) !important;
  }

  html body .our-map-result-list {
    grid-auto-columns: min(46vw, 310px);
  }

  html body .our-map-result-card {
    min-height: 196px;
    gap: 6px;
    padding: 10px;
  }
}

@keyframes omDiscoveryRefreshPulse {
  0%, 100% { opacity: 0.64; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html body :is(.our-map-use-location, .our-map-empty-actions button) {
    transition: none;
  }

  html body .our-map-results:has(.our-map-result-list[aria-busy="true"]) .our-map-results-heading::after {
    animation: none;
  }
}
