/* Build 761: release polish for a calm, honest and accessible Our Map journey. */

/* Explain the compact MM / OM instrument without enlarging or moving it. */
html body .map-scope-caption {
  display: none;
}

html body main.app-shell section.map-stage.map-focus .map-scope-caption {
  position: absolute;
  z-index: 717;
  top: 134px;
  left: clamp(18px, 3vw, 28px);
  box-sizing: border-box;
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0 9px;
  border: 1px solid rgba(212, 249, 239, 0.26);
  border-radius: 999px;
  color: rgba(236, 255, 249, 0.82);
  background: rgba(5, 42, 53, 0.9);
  box-shadow: 0 7px 17px rgba(2, 29, 41, 0.15);
  backdrop-filter: blur(10px) saturate(1.05);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
  font-size: 0.63rem;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

html body main.app-shell section.map-stage.map-focus .map-scope-caption strong {
  color: #ffffff;
  font-size: 0.67rem;
  font-weight: 920;
}

html body main.app-shell section.map-stage.map-focus .map-scope-caption span::before {
  content: "·";
  margin-right: 4px;
  color: rgba(163, 236, 215, 0.65);
}

html body main.app-shell section.map-stage.map-focus .map-scope-caption[data-scope="om"] {
  border-color: rgba(122, 231, 199, 0.42);
  background: rgba(6, 92, 82, 0.92);
}

html body main.app-shell section.map-stage.map-focus .map-scope-caption[data-visible="true"] {
  transform: translateY(1px) scale(1.025);
  box-shadow: 0 8px 22px rgba(2, 54, 58, 0.25), 0 0 0 3px rgba(115, 229, 197, 0.12);
}

html body main.app-shell section.map-stage:not(.map-focus) .map-scope-caption,
html body main.app-shell section.map-stage.memory-editor-active .map-scope-caption,
html body main.app-shell section.map-stage.map-popup-surface-open .map-scope-caption,
html body main.app-shell section.map-stage:has(.pin-search-panel.open) .map-scope-caption {
  display: none !important;
}

/* Make the shortlist the visual destination; supporting explanation follows it. */
html body .our-map-results {
  padding-top: 2px !important;
  border-top: 0 !important;
}

html body .our-map-spot-count {
  min-height: 22px;
  margin-block: -2px 0 !important;
}

html body .our-map-coverage-note {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  margin: -3px 0 0;
  padding: 7px 10px;
  border: 1px solid rgba(14, 127, 111, 0.13);
  border-radius: 13px;
  color: #54706f;
  background: rgba(241, 250, 247, 0.9);
  font-size: 0.64rem;
  line-height: 1.3;
}

html body .our-map-coverage-note strong {
  flex: 0 0 auto;
  color: #087667;
  font-size: 0.61rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html body .our-map-coverage-note span {
  min-width: 0;
}

html body .our-map-live-sign-in {
  min-height: 52px;
  padding-block: 6px;
  box-shadow: none;
}

html body .our-map-pin-key-button {
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  grid-template-columns: 1fr !important;
  place-items: center !important;
  padding: 0 !important;
}

html body .our-map-pin-key-button > span:first-child {
  display: grid !important;
  width: 28px !important;
  height: 28px !important;
  place-items: center !important;
  border-radius: 10px !important;
  color: #0b786e !important;
  background: rgba(255, 255, 255, 0.78) !important;
  font-size: 0.82rem !important;
  line-height: 1 !important;
}

html body .our-map-pin-key-button > :is(span:nth-child(2), b) {
  display: none !important;
}

html body .our-map-worlds-note {
  grid-template-columns: 27px minmax(0, 1fr);
  min-height: 38px;
  padding: 5px 8px;
  background: rgba(238, 249, 245, 0.78);
}

html body .our-map-worlds-note > span:first-child {
  width: 27px;
  height: 27px;
  border-radius: 9px;
}

/* Unknown totals remain visibly unknown while OM resolves the current area. */
html body [data-our-map-filter-count] {
  font-variant-numeric: tabular-nums;
}

html body .our-map-discovery-bar:is([aria-busy="true"], [data-feed-state="loading"]) [data-our-map-filter-count],
html body [data-our-map-filter-count][data-count-known="false"] {
  color: transparent !important;
  background:
    linear-gradient(100deg, rgba(121, 169, 158, 0.18) 20%, rgba(255, 255, 255, 0.76) 45%, rgba(121, 169, 158, 0.18) 70%) !important;
  background-size: 210% 100% !important;
  animation: omReleaseCountLoading 1.25s ease-in-out infinite;
}

html body .our-map-discovery-bar:is([aria-busy="true"], [data-feed-state="loading"]) .our-map-results-empty {
  min-height: 106px;
  border-style: solid;
  color: transparent;
  background:
    linear-gradient(100deg, #edf7f3 18%, #ffffff 44%, #edf7f3 70%);
  background-size: 220% 100%;
  animation: omReleaseCardLoading 1.35s ease-in-out infinite;
}

html body .our-map-result-list[aria-busy="true"] .our-map-results-empty {
  min-height: 106px;
  border-style: solid;
  color: transparent;
  background:
    linear-gradient(100deg, #edf7f3 18%, #ffffff 44%, #edf7f3 70%);
  background-size: 220% 100%;
  animation: omReleaseCardLoading 1.35s ease-in-out infinite;
}

html body .our-map-result-card {
  outline: 1px solid rgba(255, 255, 255, 0.72);
  outline-offset: -2px;
}

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

/* A selected place becomes one centered sheet with a quiet map scrim. */
html body main.app-shell section.map-stage.map-focus.our-map-mode.map-popup-surface-open::after {
  position: fixed;
  z-index: 732;
  inset: 0;
  content: "";
  background: rgba(2, 31, 42, 0.18);
  pointer-events: none;
}

html body main.app-shell section.map-stage.map-focus.our-map-mode .maplibregl-popup.mymappi-our-map-popup-shell {
  z-index: 738 !important;
}

/* Map markers may carry very high inline stacking values. While a place sheet
   is open, keep every pin and hot-zone count beneath that sheet so its title,
   actions, and private/public explanation remain unobstructed. */
html body main.app-shell section.map-stage.map-focus.our-map-mode.map-popup-surface-open #map.maplibregl-map .maplibregl-marker {
  z-index: 1 !important;
}

html body main.app-shell section.map-stage.map-focus.our-map-mode .mymappi-our-map-popup-shell .maplibregl-popup-content {
  scroll-padding-block: 12px 24px;
}

html body .our-map-popup .popup-actions,
html body .our-map-popup .our-map-popup-action-lane {
  position: relative;
  z-index: 1;
}

html body .our-map-popup .our-map-popup-action-lane {
  padding: 9px !important;
}

html body .our-map-popup .our-map-popup-action-lane button {
  min-height: 44px !important;
}

html body main.app-shell section.map-stage.map-focus.our-map-mode .search-destination-popup.our-map-popup h3 {
  color: #0b3440 !important;
}

html body main.app-shell section.map-stage.map-focus.our-map-mode .search-destination-popup.our-map-popup .popup-meta {
  color: #587277 !important;
}

html body main.app-shell section.map-stage.map-focus.our-map-mode .search-destination-popup.our-map-popup > p:not(.popup-meta) {
  color: #496a6d !important;
}

html body main.app-shell section.map-stage.map-focus.our-map-mode .search-destination-popup.our-map-popup .search-destination-kicker {
  color: #087667 !important;
  background: #e6f8f2 !important;
}

html body main.app-shell section.map-stage.map-focus.our-map-mode.map-popup-surface-open :is(
  #locationBanner,
  #youAreHereMessage,
  .our-map-explorer-button,
  .map-navigation-gadget,
  .our-map-data-attribution
) {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Public OM contributions remain manageable without blending into private MM data. */
html body .our-map-contribution-stories-status {
  margin: 0;
  padding: 11px;
  border-radius: 14px;
  color: #687f80;
  background: rgba(237, 248, 244, 0.82);
  font-size: 0.61rem;
  font-weight: 680;
  line-height: 1.4;
}

html body .our-map-contribution-stories-status.is-error {
  color: #8b4545;
  background: #fff3f1;
}

html body .our-map-contribution-stories-list {
  display: grid;
  gap: 8px;
}

html body .our-map-owned-story-card .our-map-contribution-card-place > i {
  color: #08766d;
  background: #eaf8f4;
  font-weight: 950;
}

html body .our-map-owned-story-card.is-review {
  border-color: rgba(181, 130, 38, 0.2);
  background: #fffaf0;
}

html body .our-map-owned-story-card.is-removed {
  border-color: rgba(164, 78, 78, 0.16);
  background: #fff7f5;
}

html body .our-map-owned-story-copy :is(strong, small) {
  display: block;
}

html body .our-map-owned-story-copy strong {
  color: #173f45;
  font-size: 0.67rem;
  font-weight: 900;
}

html body .our-map-owned-story-copy small {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 3px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

html body .our-map-owned-story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

html body .our-map-owned-story-actions button {
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid rgba(15, 128, 112, 0.16);
  border-radius: 12px;
  color: #08766d;
  background: #ffffff;
  font-size: 0.58rem;
  font-weight: 880;
  cursor: pointer;
}

html body :is(.our-map-owned-story-actions, .our-map-public-story-card > footer) button.is-delete {
  border-color: rgba(161, 67, 67, 0.17) !important;
  color: #9a4444 !important;
  background: #fff5f3 !important;
}

html body .our-map-public-story-card > footer button {
  min-height: 44px !important;
}

html body .our-map-story-panel input[readonly] {
  color: #4f6d6d;
  background: #edf5f3;
  cursor: not-allowed;
}

@keyframes omReleaseCountLoading {
  from { background-position: 100% 0; }
  to { background-position: -110% 0; }
}

@keyframes omReleaseCardLoading {
  from { background-position: 100% 0; }
  to { background-position: -120% 0; }
}

@media (max-width: 720px), (hover: none) and (pointer: coarse) {
  html body main.app-shell section.map-stage.map-focus .map-scope-caption {
    position: fixed;
    top: calc(122px + env(safe-area-inset-top, 0px));
    left: max(14px, env(safe-area-inset-left, 0px));
    min-height: 25px;
    padding-inline: 8px;
  }

  html body main.app-shell section.map-stage.map-focus.our-map-mode .our-map-discovery-bar:not([hidden]) {
    padding-bottom: max(15px, env(safe-area-inset-bottom, 0px)) !important;
    scroll-padding-block: 52px 18px !important;
  }

  html body .our-map-result-list {
    padding-bottom: 11px;
  }

  html body .our-map-coverage-note {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  html body main.app-shell section.map-stage.map-focus.our-map-mode .mymappi-our-map-popup-shell .maplibregl-popup-content {
    max-height: min(66dvh, 560px) !important;
    padding: 16px 15px max(18px, env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (max-width: 1024px) {
  html body main.app-shell section.map-stage.map-focus.our-map-mode.our-map-discovery-open .map-navigation-gadget {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

@media (max-height: 680px) and (max-width: 720px) {
  html body main.app-shell section.map-stage.map-focus .map-scope-caption {
    display: none;
  }

  html body main.app-shell section.map-stage.map-focus.our-map-mode .mymappi-our-map-popup-shell .maplibregl-popup-content {
    max-height: 60dvh !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body main.app-shell section.map-stage.map-focus .map-scope-caption,
  html body .our-map-discovery-bar [data-our-map-filter-count],
  html body .our-map-results-empty {
    animation: none !important;
    transition: none !important;
  }
}
