/* v1.2 mobile layout polish
   Screenshot-driven spacing, wrapping, and control-style corrections.
*/

@media (max-width: 720px) {
  /* Keep accessible labels for assistive technology without rendering a visible title. */
  .sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  /* Explore mirrors Map: search field with the advanced-filter button on the right. */
  body[data-mobile-view="explore"] .mobile-compact-explore {
    position: relative;
    margin-top: 14px;
  }

  .mobile-basic-search {
    min-height: 50px;
    margin-right: 58px;
    padding: 0 14px;
  }

  .mobile-basic-search input,
  .mobile-map-search input {
    min-height: 44px;
    padding: 0;
  }

  .mobile-advanced-link {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    width: 50px;
    min-height: 50px;
    justify-content: center;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(15, 79, 103, 0.08);
  }

  .mobile-advanced-link span {
    display: none;
  }

  /* Wayfinding wraps within the viewport and uses the same rounded-rectangle language as search. */
  .mobile-discovery-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
    overflow: visible;
    padding-bottom: 0;
  }

  .mobile-discovery-chip {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    justify-content: flex-start;
    padding: 0 12px;
    border-radius: 12px;
  }

  .mobile-discovery-chip.chip-neutral {
    grid-column: 1 / -1;
  }

  /* Collections wrap as compact icon/title rounded rectangles rather than elongated pills. */
  body[data-mobile-view="explore"] .collections-panel {
    margin-top: 10px;
  }

  body[data-mobile-view="explore"] .collections-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    padding: 0 2px 3px;
  }

  body[data-mobile-view="explore"] .collection-button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    justify-content: flex-start;
    padding: 7px 10px;
    border-radius: 12px;
  }

  body[data-mobile-view="explore"] .collection-copy {
    overflow: hidden;
  }

  body[data-mobile-view="explore"] .collection-copy strong {
    display: block;
    overflow: hidden;
    white-space: normal;
    line-height: 1.2;
    text-overflow: ellipsis;
  }

  /*
    Keep map search below the Leaflet zoom stack and curated-map badge.
    This keeps the top-left native map controls unobstructed.
  */
  .mobile-map-tools {
    top: 72px;
    right: 12px;
    left: 88px;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 8px;
  }

  .mobile-map-search {
    min-height: 48px;
    padding: 0 13px;
    background: rgba(251, 253, 255, 0.97);
  }

  .mobile-map-filter {
    width: 48px;
    min-height: 48px;
    border-radius: 12px;
  }

  .mobile-search-area {
    margin-top: 2px;
  }
}

@media (max-width: 420px) {
  .mobile-discovery-chip,
  body[data-mobile-view="explore"] .collection-button {
    padding-right: 9px;
    padding-left: 9px;
    font-size: 11px;
  }

  .mobile-map-tools {
    right: 10px;
    left: 82px;
  }
}