/* Fioreva Tech · map module
   Panel, label layer and legend for the pixel map of Qatar. The map itself is canvas. */

[data-module="map"].qm {
  display: flex;
  flex-direction: column;
  /* a long .qa address in the bar must not widen the map past its column on a phone */
  min-width: 0;
}

.qm-panel {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-l);
  background: #000;
  overflow: hidden;
}

/* ---------- bar ---------- */
.qm-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-2);
  font: 500 .8125rem/1 var(--mono);
}
.qm-led {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px rgba(0, 255, 194, .7);
}
.qm-title { flex: none; font-weight: 600; color: var(--fg); white-space: nowrap; }
.qm-addr {
  margin-left: auto;
  min-width: 0;
  overflow: hidden;
  color: var(--fg-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- stage ---------- */
.qm-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.qm-cv {
  position: absolute;
  top: 0;
  left: 0;
  image-rendering: pixelated;
}
.qm-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* place names: mono, on the grid, black backing so they read over land and leaders.
   The text is centred in its box rather than sized to it, so a taller line height (a text-spacing
   override) spills into the empty leading above and below the letters, not over them. */
.qm-lab,
.qm-chip {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  font: 500 var(--qm-fs, 11px)/1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  white-space: nowrap;
}
.qm-lab > *,
.qm-chip > * { flex: none; }
.qm-lab {
  padding: 0 var(--qm-px, 5px);
  background: #000;
  color: var(--fg-2);
  opacity: 0;
  transition: opacity .3s steps(3), color .2s;
}
.qm-lab.is-in { opacity: 1; }
.qm-lab.is-off { opacity: 0; transition: none; }
.qm-lab.is-back { transition-delay: .22s; }
.qm-lab.is-right { text-align: right; }
.qm-lab b { font-weight: 600; color: var(--fg); }
.qm-lab.qm-scale { background: transparent; color: var(--fg-3); }
.qm-lab.is-two b,
.qm-lab.is-two span { display: block; }
/* the hub on two lines: a long store name ends in an ellipsis instead of widening the rail.
   An Arabic name runs right to left (dir="auto"), so it keeps its first word and the ellipsis
   lands at its end; it still lines up on the left like every rail label. */
.qm-lab.is-two b { overflow: hidden; text-overflow: ellipsis; text-align: left; }
.qm-lab.is-hot.is-pay,
.qm-lab.is-hot.is-order { color: var(--red); }
.qm-lab.is-hot.is-ship,
.qm-lab.is-hot.is-done { color: var(--mint); }
.qm-lab.is-hot.is-msg { color: var(--cream); }

/* hidden samples of the label font: the map sizes its label boxes from their measured widths */
.qm-probe {
  position: absolute;
  top: 0;
  left: 0;
  visibility: hidden;
  pointer-events: none;
}
.qm-probe span {
  position: absolute;
  top: 0;
  left: 0;
  font: 500 12px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  white-space: nowrap;
}
.qm-probe span:last-child { font-weight: 600; }

/* transient labels for demo activity */
.qm-chip {
  padding: 0 var(--qm-px, 5px);
  border: 1px solid currentColor;
  border-radius: 2px;
  background: #000;
  opacity: 0;
  transition: opacity .2s steps(3);
}
.qm-chip.is-in { opacity: 1; }
/* nothing pops up before Qatar has drawn itself */
[data-module="map"]:not(.is-booted) .qm-chip { visibility: hidden; }
.qm-chip.is-pay { color: var(--red); border-color: rgba(255, 0, 37, .55); }
.qm-chip.is-ship { color: var(--mint); border-color: rgba(0, 255, 194, .45); }
.qm-chip.is-msg { color: var(--cream); border-color: rgba(255, 236, 187, .45); }
/* the shared order: black text on a solid fill */
.qm-chip.is-order {
  border-color: var(--red);
  background: var(--red);
  color: #000;
  font-weight: 600;
  box-shadow: 0 0 18px rgba(255, 0, 37, .35);
}
.qm-chip.is-done {
  border-color: var(--mint);
  background: var(--mint);
  color: #000;
  font-weight: 600;
  box-shadow: 0 0 18px rgba(0, 255, 194, .3);
}

/* ---------- legend ---------- */
.qm-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-2);
  font: 500 .6875rem/1.3 var(--mono);
}
.qm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--fg-2);
}
.qm-legend li { display: flex; align-items: center; gap: 8px; }
.qm-sw { width: 8px; height: 8px; flex: none; }
.qm-sw.is-pay { background: var(--red); }
.qm-sw.is-ship { background: var(--mint); }
.qm-sw.is-msg { background: var(--cream); }
.qm-cap { color: var(--fg-3); }

@media (max-width: 480px) {
  .qm-bar { height: 42px; padding: 0 14px; }
  .qm-foot { padding: 10px 14px; }
}

/* paused by the visitor or reduced motion: states change without transitions */
[data-module="map"].is-still .qm-lab,
[data-module="map"].is-still .qm-chip { transition: none; }
