/* ANDAZ R1.5-D4: mobile-only map cards OUTSIDE the map viewport. */
/* Loaded after D3, Phase4, and original listing layout styles. */
@media (max-width: 1023px) {
  /* Pricing map: content takes its own grid row after map and legend. */
  html[data-mh-shell="public"] [data-testid="market-map"][data-map-layout="framed"] {
    grid-template-rows: auto var(--mulk-map-height) auto auto auto auto;
  }
  html[data-mh-shell="public"] [data-testid="market-map"][data-map-layout="framed"] > .mulk-public-selection-host {
    grid-area: 6 / 1 !important;
    position: relative !important;
    inset: auto !important;
    display: block;
    width: 100%;
    min-width: 0;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    pointer-events: auto !important;
    z-index: 1 !important;
    isolation: isolate;
  }
  html[data-mh-shell="public"] [data-testid="market-map"] > .mulk-public-selection-host:not(:has(.mw-public-panel,.mw-public-legacy)) {
    display: none !important;
  }
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-panel,
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-panel[data-detent="peek"],
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-panel[data-detent="half"],
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-panel[data-detent="full"] {
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    flex-direction: column;
    width: calc(100% - 24px) !important;
    height: auto !important;
    max-width: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 12px auto 18px !important;
    overflow: visible !important;
    border: 1px solid color-mix(in srgb,var(--em-accent,#13856b) 28%,var(--em-line,#d7e6e0)) !important;
    border-radius: 20px !important;
    background: var(--em-surface,#fff) !important;
    box-shadow: 0 14px 34px rgba(15,56,47,.13) !important;
    pointer-events: auto !important;
  }
  /* External information cards use natural page scroll, not sheet drag controls. */
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-grip,
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-expand {
    display: none !important;
  }
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-legacy {
    position: relative !important;
    inset: auto !important;
    width: calc(100% - 24px) !important;
    max-width: 100% !important;
    margin: 12px auto 18px;
    border-radius: 18px;
    pointer-events: auto !important;
  }
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-panel-header {
    flex: 0 0 auto;
    padding: 12px 15px !important;
    border-radius: 19px 19px 0 0;
    background: linear-gradient(120deg,#def2e8 0%,#f2faf6 70%,#ffffff 100%) !important;
    color: #163c34;
  }
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-panel-body {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    min-height: 96px !important;
    max-height: none !important;
    overflow: visible !important;
    touch-action: pan-y;
    padding: 14px 15px 20px !important;
    overscroll-behavior: auto !important;
  }
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-panel[data-detent="peek"] .mw-public-panel-body {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-heading h2 {
    font-size: clamp(16px,4vw,19px) !important;
    line-height: 1.45 !important;
    -webkit-line-clamp: 2 !important;
  }
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-head-actions {
    display: flex !important;
    gap: 10px;
    grid-template-columns: none !important;
  }
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-expand {
    width: auto !important;
    min-width: 48px;
    font-size: 12px !important;
    padding-inline: 10px !important;
    overflow: visible !important;
    color: #11684f;
  }
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-grip {height: 18px !important;min-height: 18px !important;}
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-cover {width: 100%;height: auto !important;max-height: 210px;object-fit: cover;}
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-price {
    padding: 14px !important;
    margin: 12px 0 !important;
    border: 1px solid var(--em-line,#d6e6df) !important;
    background: var(--em-surface-soft,#f3f8f5);
    border-radius: 14px;
  }
  html[data-mh-shell="public"] [data-testid="market-map"] .mw-public-action {
    border-radius: 12px;
    background: var(--em-surface,#fff);
  }
  html[data-mh-shell="public"] .mw-project-label .az-map-price-row {
    display: none !important;
  }
  /* Price map filters: single-line labels, no 3-line mobile buttons. */
  html[data-mh-shell="public"] [data-map-layout="framed"] [data-testid="market-map-filters"] > div:first-child {
    display: grid !important;
    grid-template-columns: repeat(3,minmax(0,1fr)) !important;
    gap: 5px !important;
    width: 100%;
  }
  html[data-mh-shell="public"] [data-map-layout="framed"] [data-testid="market-map-filters"] > div:first-child button {
    min-width: 0 !important;
    min-height: 42px !important;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px !important;
    padding: 6px 4px !important;
    font-size: clamp(10px,2.7vw,12px) !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis;
    letter-spacing: -.02em;
    border-radius: 11px;
  }
  html[data-mh-shell="public"] [data-map-layout="framed"] [data-testid="market-map-filters"] > div:first-child button > span {
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Sale/rent map: vertical native page scroll above the actual map canvas. */
  .lx-map-wrap {height: clamp(325px,49dvh,470px);}
  .lx-map .maplibregl-cooperative-gesture-screen,
  .lx-map .maplibregl-cooperative-gesture-screen * {display: none !important;}
  .lx-map .maplibregl-popup {display: none !important;}
  .lx-mobile-selection {
    width: calc(100% - 20px);
    margin: 12px auto 16px;
    border: 1px solid #a9d8c8;
    border-radius: 20px;
    background: var(--em-surface,#fff);
    color: var(--em-text,#15342f);
    box-shadow: 0 9px 27px rgba(10,62,46,.12);
    overflow: hidden;
    direction: inherit;
  }
  .lx-mobile-selection-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 14px;
    background: linear-gradient(120deg,#ddf4e7,#f2faf7);
    color: #173e32;
    border-bottom: 1px solid #d3e6dd;
  }
  .lx-mobile-selection-logo {flex: none;width: 38px;height:38px;object-fit: contain;}
  .lx-mobile-selection-title {min-width: 0;flex: 1;}
  .lx-mobile-selection-title small {display:block;line-height:1.4;font-size:11px;color:#337966;}
  .lx-mobile-selection-title h3 {margin: 3px 0 0;font-size:clamp(16px,4.3vw,20px);line-height:1.55;overflow-wrap:anywhere;}
  .lx-mobile-selection-close {flex:none;display:grid;place-items:center;width:44px;height:44px;border:1px solid #c5dbd2;border-radius:12px;background:#fff;color:#21483c;cursor:pointer;}
  .lx-mobile-selection-close .em-icon {width:19px;height:19px;}
  .lx-mobile-selection-state {padding:20px 15px;margin:0;color:var(--em-muted);font-size:14px;}
  .lx-mobile-selection-cards {display:grid;grid-template-columns:minmax(0,1fr);gap:12px;padding:12px;}
  .lx-mobile-selection-cards .lx-card {border-radius:14px;box-shadow:none;}
  .lx-mobile-selection-cards .lx-card-image {aspect-ratio: 16/8;max-height:210px;}
  .lx-mobile-selection-cards .lx-card-body {padding:13px 14px;}
  .lx-mobile-selection-profile {
    display:flex;align-items:center;justify-content:center;gap:8px;
    min-height:49px;margin:3px 12px 15px;padding:10px 12px;
    background:#0f7a60;color:#fff !important;font-size:13px;font-weight:700;text-decoration:none;
    border-radius:12px;text-align:center;
  }
  .lx-mobile-selection-profile .em-icon {width:19px;height:19px;}
  .lx-mobile-location-choices {padding:12px;display:grid;gap:8px;}
  .lx-mobile-location-choice {display:flex;justify-content:space-between;align-items:center;gap:14px;
    width:100%;min-height:48px;border:1px solid var(--em-line);border-radius:11px;background:var(--em-surface-soft);color:var(--em-text);padding:10px 12px;text-align:start;}
  .lx-mobile-location-choice strong {min-width:0;overflow-wrap:anywhere;}
  .lx-mobile-location-choice span {flex:none;color:var(--em-muted);font-size:12px;}
  .lx-toolbar > .lx-result-count {display: none !important;}
  .lx-tabs {gap:5px;}
  .lx-tabs button {border-radius:11px;padding-inline:6px !important;}
  .lx-tabs button[aria-pressed="true"] {background:#e1f5ed;color:#086f51;box-shadow:inset 0 -3px #0f8966;}
  .lx-map-frame {border-radius:18px;overflow:hidden;}
  .lx-filter-fields input,.lx-filter-fields select {border-radius:12px;}
  .lx-search {border-radius:13px;}
}
@media (min-width: 1024px) { .lx-mobile-selection {display:none !important;} }
@media (max-width: 1023px) and (orientation: landscape) and (max-height: 560px) {
  html[data-mh-shell="public"] [data-testid="market-map"][data-map-layout="framed"] {--mulk-map-height: clamp(250px,58dvh,370px);}
  .lx-map-wrap {height: clamp(260px,65dvh,370px);}
}
@media (prefers-reduced-motion: reduce) {
  .lx-mobile-selection,.mw-public-panel {scroll-behavior:auto!important;transition:none!important;}
}
