/* The map: paper with a grain, lines by category, dots by accent. */

.dr-map-wrap { position: relative; }
.dr-map-frame {
  container: mapframe / inline-size;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  position: relative;
  border: 1px solid var(--color-popover-border);
  border-radius: var(--radius-card);
  background: var(--color-bg);
  overflow: hidden;
}
.dr-map { display: block; width: 100%; height: var(--map-h); user-select: none; }
.dr-map-grain { fill: var(--color-text); opacity: var(--map-grain); pointer-events: none; }
.dr-map-edge { stroke-width: var(--map-edge-w); opacity: var(--map-edge-opacity); stroke-linecap: round; }
.dr-map-edges { pointer-events: stroke; }

.dr-map-node { cursor: pointer; outline: none; touch-action: none; }
.dr-map[data-dragging='true'] .dr-map-node { cursor: grabbing; }
.dr-map-hit { fill: transparent; }
.dr-map-dot { fill: var(--color-accent); stroke: var(--color-bg); stroke-width: 2px; transition: r var(--dur-fast) var(--ease-out); }
@media (hover: hover) { .dr-map-node:hover .dr-map-dot { r: var(--map-dot-hover); } }
.dr-map-node:focus-visible .dr-map-dot, .dr-map-node[aria-current='true'] .dr-map-dot { stroke: var(--color-text); }
.dr-map-label { font-family: var(--font-num); font-size: var(--map-label); fill: var(--color-text-dim); pointer-events: none; }
.dr-map-node[aria-current='true'] .dr-map-label { fill: var(--color-text); }

.dr-map-legend {
  position: absolute;
  left: var(--space-3);
  bottom: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  list-style: none;
  background: var(--color-popover);
  border: 1px solid var(--color-popover-border);
  border-radius: var(--radius-control);
  font-family: var(--font-num);
  font-size: var(--text-label);
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dr-map-legend li { display: flex; align-items: center; gap: var(--space-2); }
.dr-map-hint { position: absolute; left: var(--space-3); bottom: var(--space-3); margin: 0; font-size: var(--text-small); color: var(--color-text-dimmer); }

@container app (max-width: 720px) {
  .dr-map-legend { position: static; flex-direction: row; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin-top: var(--space-2); border: 0; background: none; padding: 0; }
  .dr-map-hint { position: static; margin-top: var(--space-2); }
}

/* A narrow map (a phone, or beside an open character) is drawn at a size its names can be read at, and the frame scrolls sideways; a finger on a dot drags it instead. */
@container mapframe (max-width: 720px) {
  .dr-map { width: var(--map-w-phone); height: auto; aspect-ratio: 1000 / 640; }
}
