/* The orbit page's flat map (map2d.js) and the Globe / Map switch.
   Same tokens as globe.css: flat Panel fills, no borders, the selected
   choice in Ink, the blue only on the satellite and its track (drawn in
   the canvas) and focus rings. */

.cg-map {
  position: absolute;
  inset: 0;
  background: var(--cg-bg, #05070A);
}

.cg-map canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.cg-map-over {
  touch-action: none;
  cursor: grab;
  outline: none;
}

.cg-map-dragging .cg-map-over {
  cursor: grabbing;
}

.cg-map-over:focus-visible {
  outline: 2px solid var(--cg-accent, #3C9DF5);
  outline-offset: -2px;
}

/* in map mode the 3D canvas and its labels step aside */
.cg-mode-map .cg-canvas,
.cg-mode-map .cg-labels,
.cg-mode-map .cg-nogl {
  visibility: hidden;
}

/* over the map the header's text would sit on ice and cloud: give it the
   panels' flat ground (narrow screens start the map below it instead) */
.cg-mode-map:not(.cg-narrow) .cg-head {
  padding: var(--cg-pad);
  background: var(--cg-panel);
}

/* the same for the one line of the left column that has no panel behind it */
.cg-mode-map:not(.cg-narrow) .cg-keys summary {
  padding: calc(4 * var(--cg-u)) calc(8 * var(--cg-u));
  background: var(--cg-panel);
}

/* zoomed in, the map would run up under the site's nav: keep the nav on Space */
.cg-mode-map::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1;
  height: var(--cg-top, 0px);
  background: var(--cg-bg);
  pointer-events: none;
}

.cg[data-ui="compact"] .cg-views {
  display: none;
}

/* ---- Globe / Map, and the map's zoom ------------------------------------------ */

.cg-views {
  position: absolute;
  top: calc(var(--cg-top, 0px) + var(--cg-gap, 16px));
  left: 50%;
  z-index: 2;
  display: flex;
  gap: calc(8 * var(--cg-u, 1px));
  transform: translateX(-50%);
}

/* Globe / Map and the orbit colour swatch */
.cg-views-main {
  display: flex;
  gap: calc(8 * var(--cg-u, 1px));
}

.cg-seg {
  display: flex;
  background: var(--cg-panel, #10151B);
}

.cg-seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--cg-btn-h, 32px);
  min-width: var(--cg-btn-h, 32px);
  padding: 0 calc(14 * var(--cg-u, 1px));
  background: transparent;
  border: 0;
  font: 500 var(--cg-small, 13px)/1 var(--cg-sans);
  color: var(--cg-muted, #8A96A3);
  cursor: pointer;
}

.cg-seg button:hover {
  background: var(--cg-raised, #1A2129);
  color: var(--cg-text, #E6EBF0);
}

.cg-seg button[aria-pressed="true"] {
  background: var(--cg-text, #E6EBF0);
  color: var(--cg-bg, #05070A);
}

.cg-seg-zoom button {
  padding: 0;
  font-size: var(--cg-value, 16px);
  color: var(--cg-text, #E6EBF0);
}

/* at its limit: dimmed, and still focusable (aria-disabled), so the focus doesn't drop */
.cg-seg-zoom button:disabled,
.cg-seg-zoom button[aria-disabled="true"],
.cg-seg-zoom button[aria-disabled="true"]:hover {
  color: var(--cg-muted, #8A96A3);
  background: transparent;
  cursor: default;
  opacity: 0.5;
}

/* The zoom, on the globe and the map alike: + over −, at the lower right of the view, clear of
   the clock bar and the right-hand panels (narrow: above the bottom bar, below). */
.cg .cg-seg-zoom {
  position: absolute;
  right: calc(var(--cg-right-w, 300px) + 2 * var(--cg-gap, 16px));
  bottom: calc(var(--cg-clock-h, 64px) + 2 * var(--cg-gap, 16px));
  z-index: 2;
  flex-direction: column-reverse;
}

.cg-panels-off:not(.cg-narrow) .cg-seg-zoom {
  right: var(--cg-gap, 16px);
}

.cg[data-ui="compact"] .cg-seg-zoom {
  display: none;
}

/* beside the switch, out of the group's width: only the switch is centred, so
   it stays put when Aurora steps aside */
.cg:not(.cg-narrow) .cg-views-side {
  position: absolute;
  top: 0;
  left: 100%;
  display: flex;
  gap: calc(8 * var(--cg-u, 1px));
  margin-left: calc(8 * var(--cg-u, 1px));
}
.cg-previews-btn { white-space: nowrap; }
/* its words say what it will do; on a phone only the eye shows, struck through while they're hidden */
.cg-previews-btn svg { display: none; flex: none; }
.cg-previews-btn:not(.is-hidden) .cg-previews-slash { display: none; }
/* too narrow for a third thing on the row, with the Pictures panel beside it */
@media (max-width: 1339px) {
  .cg:not(.cg-narrow) .cg-views-side {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* narrow: the switch top right, clear of the title on the left; the zoom at the
   right edge just above the bottom bar, with the previews and Aurora beside it,
   under any open sheet */
.cg-narrow .cg-views {
  display: contents;
}

/* the title shares its row with the switch; the lines under it start below */
.cg-narrow .cg-title {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.cg-narrow .cg-views-main {
  position: absolute;
  top: calc(var(--cg-top, 0px) + 12px);
  right: 12px;
  z-index: 2;
}

/* They rest on the bar as it is with its clock showing (--cg-dock-rest-h), and globe.js
   (placeFloats) moves them by --cg-float-x and -y to stay just above a sheet along the bottom,
   or left of one at the side: a transform, eased, so nothing else on the page shifts. */
.cg-narrow .cg-seg-zoom,
.cg-narrow .cg-views-side {
  bottom: calc(var(--cg-dock-rest-h, var(--cg-dock-h, 0px)) + 12px);
  transform: translate(var(--cg-float-x, 0px), var(--cg-float-y, 0px));
  transition: transform 280ms cubic-bezier(.22, 1, .36, 1);
}

.cg-still .cg-seg-zoom,
.cg-still .cg-views-side {
  transition: none;
}

.cg-narrow .cg-seg-zoom {
  right: 12px;
  z-index: 1;
}

/* [previews] [Aurora], left of the zoom, along its foot */
.cg-narrow .cg-views-side {
  position: absolute;
  right: 64px;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.cg-narrow .cg-aurora-btn {
  height: 44px;
}

.cg-narrow .cg-previews-btn {
  order: -1;
  width: 44px;
  height: 44px;
  padding: 0;
}
.cg-narrow .cg-previews-btn svg { display: block; }
.cg-narrow .cg-previews-btn span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* a sheet at the side: the switch moves left of it, as the zoom and the buttons beside it do
   (--cg-float-x, from globe.js), by transform and eased */
.cg-narrow .cg-views-main {
  transform: translateX(var(--cg-float-x, 0px));
  transition: transform 280ms cubic-bezier(.22, 1, .36, 1);
}

.cg-still .cg-views-main {
  transition: none;
}

/* a phone on its side: the header's one row has 6px above it (globe.css) */
@media (max-height: 500px) and (min-width: 480px) and (orientation: landscape) {
  .cg-narrow .cg-views-main {
    top: calc(var(--cg-top, 0px) + 6px);
  }
}

.cg-narrow .cg-seg button {
  height: 44px;
  min-width: 44px;
}

/* a phone: the switch a little tighter, so the title, the switch, the colour and Copy link share a row */
@media (max-width: 759px) {
  .cg-narrow .cg-seg button {
    padding: 0 10px;
  }
}

@media (max-width: 374px) {
  .cg-narrow .cg-seg button {
    padding: 0 8px;
  }
}

@media (pointer: coarse) {
  .cg-seg button {
    height: max(44px, var(--cg-btn-h, 32px));
    min-width: 44px;
  }
}
