/* Map view of the home page (index.php, src/views/home-map.php): the full-bleed layout, the pins and Leaflet's chrome.
   Loaded only there. The cards themselves are styled in board.css. */

/* The map: edge to edge, the height of the window under the sticky header, staying put while the page scrolls.
   Two layers come after it: the hero, pulled back up over the map's top left, and the rest of the column (controls,
   cards) following it, so everything sits on top of the map. Phones put the hero first, then the map, then the rest. */
:root { --mapx-top: var(--sf-topbar-h, 72px); --mapx-col: clamp(380px, 44vw, 760px); }
.mapx { position: relative; display: block; max-width: none; margin: 0; padding: 0; }
.mapx-map { position: sticky; top: var(--mapx-top); z-index: 0; height: calc(100vh - var(--mapx-top)); background: #0b1118; }
.map-canvas { width: 100%; height: 100%; }
/* A soft dark fade behind the column, so the cards read cleanly while the map still shows through. Pins stay above it. */
.mapx-map::after { content: ""; position: absolute; inset: 0 auto 0 0; z-index: 450; width: calc(var(--mapx-col) + 140px); pointer-events: none;
                   background: linear-gradient(90deg, rgba(10, 17, 26, .86) 0%, rgba(10, 17, 26, .7) 62%, rgba(10, 17, 26, 0) 100%); }
.mapx-layer { position: relative; z-index: 1; padding: 0 0 0 24px; pointer-events: none; }
.mapx-head { margin-top: calc(-1 * (100vh - var(--mapx-top))); padding-top: 18px; }
.mapx-body { padding-bottom: 40px; }
/* Only the panels and cards catch the pointer; the gaps between them let the map be dragged. */
.mapx-col { width: var(--mapx-col); container-type: inline-size; container-name: board; }
.mapx-panel, .mapx-cards .sec-head, .mapx-cards .sc, .mapx-cards .sec-empty, .mapx-more { pointer-events: auto; }
.mapx-panel { margin: 0 0 12px; padding: 14px 16px; background: rgba(13, 21, 32, .9); border: 1px solid var(--line); border-radius: 14px;
              box-shadow: 0 10px 30px rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(10px) saturate(130%); backdrop-filter: blur(10px) saturate(130%); }
.mapx-headpanel { padding: 18px 20px 16px; }
.mapx-headpanel .welcome { margin: 0; }
.mapx-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.mapx-controls .btn { padding: 9px 16px; font-size: 14px; }
.radius { font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.radius select { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.mapx-where { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.mapx-status { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.mapx-status b { color: var(--ink); }
.mapx-cards { margin-top: 18px; }
.mapx-cards .sec { margin-bottom: 22px; }
.mapx-cards .sec-head { display: inline-flex; padding: 7px 12px; border-radius: 10px; background: rgba(13, 21, 32, .9); border: 1px solid var(--line); }
.mapx-cards .sec-head h2 { font-size: 16px; }
.mapx-cards .sc-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.mapx-cards .sc { box-shadow: 0 8px 22px rgba(0, 0, 0, .35); }
.mapx-more { display: block; margin: 16px auto 0; padding: 10px 22px; font: inherit; font-size: 14px; font-weight: 700; color: var(--brand);
             background: rgba(13, 21, 32, .92); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .15s, background-color .15s; }
.mapx-more:hover { border-color: var(--brand); background: var(--brand-soft); }
.mapx-foot { margin-top: 20px; }
.mapx-foot p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
/* A card being hovered lights its pin; a pin being hovered lights its card. */
.sc.is-hot-pin { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

/* Phones and small tablets: the hero first on the page itself, then the map full width, then the rest of the column
   overlapping the map's bottom edge like a sheet. */
@media (max-width: 899px) {
  :root { --mapx-col: 100%; }
  .mapx { display: flex; flex-direction: column; }
  .mapx-head { order: -1; margin: 0; padding: 0; }
  .mapx-head .mapx-col { padding: 16px 14px 14px; }
  .mapx-head .mapx-panel { margin: 0; padding: 0; background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .mapx-map { position: relative; top: auto; height: 52vh; min-height: 300px; }
  .mapx-map::after { display: none; }
  .mapx-body { margin-top: -28px; padding: 0; }
  .mapx-body .mapx-col { width: 100%; padding: 16px 14px 28px; background: var(--page); border-radius: 18px 18px 0 0; box-shadow: 0 -12px 30px rgba(0, 0, 0, .45); }
  .mapx-body .mapx-col::before { content: ""; display: block; width: 44px; height: 4px; margin: -4px auto 14px; border-radius: 4px; background: var(--line); }
  .mapx-body .mapx-panel { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); box-shadow: none; }
  .mapx-cards .sec-head { background: none; border: 0; padding: 0; }
}
@media (max-width: 699px) { :root { --mapx-top: 0px; } }

/* Pins: a dot per settlement, coloured by how soon its deadline is; the visitor is the blue ringed dot. */
.pin { display: grid; place-items: center; cursor: pointer; } /* the marker box is a 24px hit area; the dot is the <i> inside */
.pin i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 0 0 2px rgba(0, 0, 0, .35); background: var(--money); transition: transform .15s, box-shadow .15s; }
.pin-warm i { background: var(--warn); }
.pin-hot i { background: var(--hot); }
.pin-sent i { background: #6f7f8f; }
.pin-fav i { box-shadow: 0 0 0 2px rgba(0, 0, 0, .35), 0 0 0 5px var(--fav); }
.pin:hover i, .pin.is-hover i { transform: scale(1.45); box-shadow: 0 0 0 2px rgba(0, 0, 0, .35), 0 0 0 7px rgba(142, 205, 244, .45); }
.pin-me { border-radius: 50%; background: var(--brand); border: 3px solid #fff; cursor: grab;
          box-shadow: 0 0 0 4px rgba(142, 205, 244, .35), 0 0 18px rgba(142, 205, 244, .6); }
.pin-me:active { cursor: grabbing; }
.pin-cluster div { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(79, 209, 161, .3); border: 2px solid var(--money);
                   color: #fff; font: 700 13px/1 ui-sans-serif, system-ui, sans-serif; box-shadow: 0 0 0 3px rgba(79, 209, 161, .15); }
.pin-cluster.medium div { background: rgba(242, 200, 107, .3); border-color: var(--warn); box-shadow: 0 0 0 3px rgba(242, 200, 107, .15); }
.pin-cluster.large div { background: rgba(255, 161, 92, .3); border-color: var(--hot); box-shadow: 0 0 0 3px rgba(255, 161, 92, .15); }

/* Leaflet chrome in the site's dark palette. */
.leaflet-container { font: 14px/1.4 ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); box-shadow: 0 6px 24px rgba(0, 0, 0, .5); }
.leaflet-popup-content-wrapper { border: 1px solid var(--line); border-radius: 10px; }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-popup-content b a { color: var(--ink); }
.leaflet-popup-content .pp-place, .leaflet-popup-content .pp-meta { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.leaflet-popup-content .pp-meta.hot { color: var(--hot); }
.leaflet-popup-content .pp-meta.warm { color: var(--warn); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-bar a { background: var(--surface); color: var(--ink); border-bottom-color: var(--line); }
.leaflet-bar a:hover { background: var(--soft); }
.leaflet-control-attribution { background: rgba(13, 21, 32, .8); color: var(--muted); font-size: 11px; }
.leaflet-control-attribution a { color: var(--brand); }
@media (prefers-reduced-motion: reduce) { .pin i { transition: none; } }
