/* The map's Layers control (a button opening a panel of checkboxes) and the pill on an
   organisation's popup. Loaded after app.css, so it uses its tokens. */

.layers { position: relative; }
.layers-button .icon { margin-right: 0.3rem; }
.layers-panel { position: absolute; top: calc(100% + 0.3rem); left: 0; z-index: 3; display: flex; flex-direction: column; min-width: 14rem; padding: 0.3rem; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.layers-panel[hidden] { display: none; }
.layers-panel .check { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; padding: 0 0.5rem; border-radius: 6px; cursor: pointer; }
.layers-panel .check:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }

.hint-status.hint-organisation { color: var(--text); background: color-mix(in srgb, var(--c-organisations) 22%, var(--surface)); border: 1px solid var(--c-organisations); }
.pill-organisation.soft { background: transparent; }
.pill-organisation { color: var(--text); background: color-mix(in srgb, var(--c-organisations) 22%, transparent); border: 1px solid var(--c-organisations); }

/* The map legend: a drop-down at the top right of the visible map, left of the side panel.
   On a phone the regions fill the top, so it sits at the bottom left, opening upwards. */
.map-legend { position: absolute; top: 0.5rem; right: calc(min(var(--side-w), 70vw) + 0.5rem); z-index: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; max-width: min(19rem, calc(100% - 1rem)); }
.legend-panel { padding: 0.4rem 0.7rem 0.6rem; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 0.85rem; max-height: min(calc(100dvh - 9rem), 36rem); overflow-y: auto; }
.legend-panel[hidden] { display: none; }
.legend-heading { margin: 0.5rem 0 0.2rem; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.legend-heading:first-child { margin-top: 0.1rem; }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; }
.legend-row { display: flex; align-items: center; gap: 0.5rem; min-height: 24px; }
.legend-swatch { flex: none; width: 16px; height: 16px; border-radius: 50%; box-sizing: border-box; }
.legend-swatch.fill { background: var(--swatch); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--control); }
.legend-swatch.ring { background: transparent; border: 3px solid var(--swatch); }
.legend-swatch.ring.dashed { border-style: dashed; }
.legend-swatch.group { background: var(--swatch); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--control); }
.legend-icon { flex: none; width: 22px; height: 22px; border-radius: 6px; }
.legend-logo { display: inline-grid; place-items: center; background: #fff; color: #0f172a; border: 2px solid #0f172a; font-size: 0.5rem; font-weight: 800; text-transform: uppercase; box-sizing: border-box; }

/* The organisation popup: the logo beside the name, and the administrators as people. */
.popup-org-head { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.35rem; }
.popup-org-head .popup-logo { flex: none; margin: 0; max-width: 64px; max-height: 48px; }
.popup-people { margin-top: 0.4rem; border-top: 1px solid var(--line); padding-top: 0.4rem; font-size: 0.9rem; }
.popup-people ul { margin: 0.25rem 0 0; display: grid; gap: 0.3rem; }
.popup-person { display: flex; align-items: center; gap: 0.5rem; }
.popup-person > span:last-child { display: grid; min-width: 0; line-height: 1.25; }
.popup-person .person-name { font-weight: 600; }
.popup-person .muted { font-size: 0.8rem; overflow-wrap: anywhere; }
.popup-logo { display: block; max-width: 120px; max-height: 60px; margin: 0.25rem 0 0.5rem; padding: 4px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.popup-line a { overflow-wrap: anywhere; }
@media (max-width: 768px) {
  .map-legend { top: auto; right: auto; left: 0.5rem; bottom: 1.6rem; flex-direction: column-reverse; align-items: flex-start; }
}
