/*
 * The PoP globe (runner.ts): the dashboard's Analytics globe
 * (web/src/pages/profile/insights/destinations-map.css) in the design
 * system's tokens (--paper, --paper-2, --ink, --ink-2, --ink-3, --ink-4,
 * --line, --line-2, --brand, --font-mono, --font-display), which the status
 * page (status.css) and the site (site/src/styles/tokens.css) both define.
 * Shared: the status Worker copies it to public/globe.css
 * (scripts/client.ts), the site imports it (HeroGlobe.astro). What is
 * specific to a page (the status page's state colours on labels) stays in
 * that page's CSS.
 */
.globe { display: grid; gap: 8px; justify-items: center; margin: 20px; }
/* Square, as wide as the column up to 34rem; the canvas fills it. */
.globe-stage { position: relative; width: 100%; max-width: 34rem; aspect-ratio: 1; }
.globe-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  /* At 1x vertical swipes still scroll the page; horizontal ones turn the globe. */
  touch-action: pan-y;
}
/* Zoomed in, the globe takes every gesture (turn and pinch). */
.globe-canvas[data-zoomed] { touch-action: none; }
.globe-canvas[data-hover="true"] { cursor: pointer; }
.globe-canvas[data-dragging] { cursor: grabbing; }
.globe-canvas:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.globe-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 20px; }
.globe-zoom { display: inline-flex; align-items: center; gap: 4px; }
.globe-zoom button {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
}
.globe-zoom .globe-zoom-btn { padding: 0; font-size: 1rem; }
.globe-zoom button:hover:not(:disabled) { border-color: var(--ink); }
.globe-zoom button:disabled { color: var(--ink-4); cursor: default; }
.globe-zoom-level {
  min-width: 3.5em;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.globe-hint {
  margin: 0;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
}

/* The open label is moved by the drawing loop (a transform from the stage's corner). */
.globe-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.globe-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0 4px;
  background: color-mix(in srgb, var(--paper-2) 85%, transparent);
  color: var(--ink);
  font-size: 0.75rem;
  line-height: 1.35;
  white-space: nowrap;
}
.globe-label[data-side="hidden"] { visibility: hidden; }
.globe-label-place { font-weight: 600; }
.globe-label-state { color: var(--ink-2); font-family: var(--font-mono); }

/*
 * A location's measured round trip after its label (" - 12 ms", runner.ts
 * `latency`): the dash in ink-2, the number in --brand (the serving dot's
 * green), mono like " - nearest". The nearest one's number is bold.
 */
.globe-label-latency { color: var(--ink-2); font-family: var(--font-mono); }
.globe-label-ms { color: var(--brand); font-variant-numeric: tabular-nums; }
.globe-label[data-you] .globe-label-ms { font-weight: 600; }

/* The viewer's nearest location (nearest.ts): "- nearest" on its label (when it has no number), a sentence under the globe. */
.globe-label-you { color: var(--ink-2); font-family: var(--font-mono); }
.globe-you {
  min-height: 1.4em;
  margin: 0;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: center;
}
.globe-you:empty { visibility: hidden; }
