/* map styles (prefix m-). Colours come from core's custom properties so dark mode works; the canvas itself is painted
   from the same tokens by js/map/palette.js. */

.m-map {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  overflow: hidden;
  background: var(--surface);
  font-family: var(--font);
  color: var(--fg);
}

.m-stage {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: none; /* the map handles drag and pinch itself */
  user-select: none;
  -webkit-user-select: none;
}
.m-stage.m-dragging { cursor: grabbing; }
.m-stage.m-over-item { cursor: pointer; }
.m-stage:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

.m-canvas { display: block; width: 100%; height: 100%; }

.m-tooltip {
  position: absolute;
  z-index: 2;
  max-width: min(24rem, 80%);
  padding: 0.35rem 0.6rem;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  line-height: 1.3;
  pointer-events: none;
  white-space: normal;
}
.m-tooltip[hidden] { display: none; }
.m-tooltip.m-tooltip-left { transform: translateX(calc(-100% - 28px)); }

/* the control strip: projection switch on top, zoom at the bottom; the wrapper lets clicks through to the map */
.m-controls {
  position: absolute;
  inset: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
  z-index: 1;
}
.m-group { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.m-zoom { justify-content: flex-end; }

.m-button {
  pointer-events: auto;
  min-height: var(--target);
  min-width: var(--target);
  padding: 0.25rem 0.75rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.m-button:hover { border-color: var(--accent); }
.m-button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.m-button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.m-icon { font-size: 1.25rem; line-height: 1; padding: 0.25rem; }

.m-notice {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: calc(var(--target) + 1rem);
  z-index: 1;
  padding: 0.4rem 0.75rem;
  background: var(--warning-soft);
  color: var(--fg);
  border-radius: var(--radius);
  font-size: 0.875rem;
  pointer-events: none;
}
.m-notice[hidden] { display: none; }

/* visually hidden text alternative */
.m-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (forced-colors: active) {
  .m-button[aria-pressed="true"] { outline: 2px solid Highlight; }
}

@media (max-width: 30rem) {
  .m-button { padding: 0.25rem 0.5rem; font-size: 0.8125rem; }
}
