/* What stands over the map, and the page's states: a handle on a compared area, live reading's +, the sweep's line, the exploded view,
   a frame's comparison window, About, the dev tools, the story, the interface hidden, the theme's cross-fade. After charts.css, before
   small.css. */
/* on the map: a handle (a compared shape's number or edge, a spot's centre or edge, any badge) shows a hand */
.on-handle #gl {
  cursor: grab !important;
}
.moving-shape #gl {
  cursor: grabbing !important;
}
/* the + that drives live reading on touch */
#cross {
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  pointer-events: none;
  background:
    linear-gradient(var(--ink), var(--ink)) center/22px 2px no-repeat,
    linear-gradient(var(--ink), var(--ink)) center/2px 22px no-repeat,
    linear-gradient(var(--bg), var(--bg)) center/26px 6px no-repeat,
    linear-gradient(var(--bg), var(--bg)) center/6px 26px no-repeat;
}
#selfx,
#embedfx,
#explodedfx,
#sweep {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
/* The sweep: one line across the map, the model to its left and the satellite picture to its right (--x, the line's place); a grip a fingertip wide,
   the only part that takes the pointer, so a gesture anywhere else on the map is the map's; a quiet label at the top of each side. */
#sweep {
  z-index: 1;
  --x: 50%;
  overflow: hidden;
}
#sweep[hidden] {
  display: none;
}
#sweepline {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--x);
  width: 2px;
  margin-left: -1px;
  background: var(--ink);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--bg) 70%, transparent);
}
#sweepgrip {
  position: absolute;
  left: var(--x);
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  cursor: ew-resize;
  color: var(--ink);
  outline: 0;
}
#sweepgrip::before {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--ink);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--bg) 60%, transparent);
}
#sweepgrip:focus-visible::before {
  box-shadow: 0 0 0 3px var(--accent);
}
#sweepgrip svg {
  position: relative;
  width: 14px;
  height: 14px;
}
/* the line turned (web/sweep.js): through its grip at its angle, the line long enough to cross the map at any angle (the sweep clips it) */
#sweep.turned #sweepline {
  top: var(--gy);
  bottom: auto;
  left: var(--gx);
  height: var(--len);
  margin: calc(var(--len) / -2) 0 0 -1px;
  transform: rotate(var(--rot));
}
#sweep.turned #sweepgrip {
  left: var(--gx);
  top: var(--gy);
}
/* the handle that turns it: small, on the line a little way from the grip, a fingertip's hit area round it */
#sweepturn {
  position: absolute;
  left: var(--tx, 50%);
  top: var(--ty, 20%);
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  color: var(--ink);
  outline: 0;
}
#sweepturn[hidden] {
  display: none;
}
#sweepturn::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--ink);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--bg) 60%, transparent);
}
#sweepturn:focus-visible::before {
  box-shadow: 0 0 0 3px var(--accent);
}
#sweepturn svg {
  position: relative;
  width: 12px;
  height: 12px;
}
.sweeplab {
  position: absolute;
  top: var(--lab-top, 10px);
  padding: 2px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}
.sweeplab[hidden] {
  display: none;
}
#sweepmodel {
  right: calc(100% - var(--x) + 8px);
}
#sweepsat {
  left: calc(var(--x) + 8px);
}
/* the interface hidden: the line stays where it splits the map, its grip and words go. A page framing the map shows the line and its two words,
   which are content, not interface (the embed contract's sweep), and never the grip */
.nohud #sweepgrip,
.nohud #sweepturn,
:root:not(.embed) .nohud .sweeplab,
.embed #sweepturn,
.embed #sweepgrip {
  display: none;
}
.embed #wrap,
.embed #wrap * {
  pointer-events: none !important;
}
/* An exploded view (web/exploded.js): the one thing in a frame a reader may take hold of, to turn it; a swipe up or down still scrolls the
   page. Its plates are the map's own layers, so the sweep's line and the outlines are not drawn over it. */
.embed #wrap.exploded {
  pointer-events: auto !important;
  touch-action: pan-y;
  cursor: grab;
}
.exploded #sweep,
.exploded #embedfx {
  display: none !important;
}
.embed .nohud #head,
.embed .nohud #legend,
.embed .nohud:not(.embed-compare) #selfx,
.embed #status {
  display: none !important;
}
/* The embed contract's compare: the map's own comparison window, read-only, shown with the interface hidden, its areas outlined on the map in
   their colours. Nothing in it is for editing: no tabs, ×, fold, grip or handles. */
.embed .nohud.embed-compare #panel {
  display: flex !important;
}
/* and with the interface shown in a frame (ui: "full"), which takes no input, the panel is not: the title block, the time row and the
   tools are what the contract names */
.embed #wrap:not(.nohud) #panel {
  display: none !important;
}
/* Depth, on purpose: a drawer from the right that closes back to the map; on a phone the same element fills the screen,
     with the timeline below it so the numbers can follow the year. */
/* Native dialog supplies focus management, keyboard dismissal and a
     top-layer backdrop without adding a UI dependency. */
#datahelp {
  width: min(580px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  overflow: auto;
  margin: auto;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-big);
}
#datahelp::backdrop {
  background: var(--backdrop);
}
#datahelp article {
  padding: 18px 20px 20px;
}
#datahelp header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
#datahelp h2 {
  font-size: 18px;
  line-height: 1.2;
  margin: 0;
}
#datahelp h3 {
  font-size: var(--fs-caption);
  line-height: 1.3;
  margin: 16px 0 4px;
  color: var(--ink);
}
#datahelp p {
  font-size: var(--fs-caption);
  line-height: 1.5;
  margin: 0;
  color: var(--ink-2);
}
#datahelp kbd {
  font:
    600 12px Inter,
    system-ui,
    sans-serif;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-radius: 4px;
}
#datahelp header {
  position: sticky;
  top: -18px;
  z-index: 1;
  margin: -18px -20px 10px;
  padding: 14px 20px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.dlg-tabs {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: var(--ctl);
}
.dlg-tabs button {
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  background: none;
  box-shadow: none;
  font-weight: 600;
  font-size: 13px;
  color: var(--dim);
}
.dlg-tabs button[aria-selected='true'] {
  background: var(--ctl-on);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
dl.keys {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}
dl.keys dt {
  font-weight: 600;
  color: var(--ink);
}
dl.keys dd {
  margin: 0;
}
dl.keys.measures {
  display: block;
}
#dlg-data a {
  color: var(--accent-text);
}
dl.keys.measures dd {
  margin: 0 0 8px;
}
@media (max-width: 400px) {
  #datahelp article {
    padding: 14px 16px 16px;
  }
}
/* ?dev=1 tools: ramp switch, camera copy, captures, video export */
#devpanel {
  position: absolute;
  z-index: 2;
  left: var(--gutter);
  top: 190px;
  padding: 6px 8px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--fs-small);
  max-width: 240px;
}
#devpanel .row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
#devpanel button {
  min-height: 26px;
  font-size: var(--fs-small);
  padding: 0 8px;
}
#fps {
  font-size: 10px;
  color: var(--dim);
}
/* The story: overlays on their own 2D canvas; while it plays only the map,
     the overlays and the stop button are shown (the overlay draws the credit) */
#tourfx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}
#storystop {
  position: absolute;
  z-index: 2;
  right: var(--gutter);
  top: 12px;
  display: none;
  box-shadow: var(--shadow);
}
.touring #tourfx,
.touring #storystop {
  display: block;
}
.touring #head,
.touring #legend,
.touring #mapcorner,
.touring #panel,
.touring #areatag,
.touring #foot,
.touring #cross,
.touring #devpanel,
.touring .selection-overlay,
.touring #selfx {
  display: none;
}
/* H hides the controls for a clean recording; the title block with its
     year, the legend and the credit stay. */
.nohud #panel,
.nohud #areatag,
.nohud #foot,
.nohud #stack,
.nohud #cross,
.nohud #devpanel,
.nohud .selection-overlay {
  display: none;
}
.nohud #legend {
  bottom: 6px;
}
.nohud #mapcorner {
  bottom: 4px;
}
.nohud #imprint {
  bottom: 28px;
}
/* a frame whose framing page asked for bare: the map without the imprint and credit lines, the page showing the credits beside the
   frame (the embed contract); never in the full page */
.embed .bare #imprint,
.embed .bare #credit {
  visibility: hidden;
}
/* theme switch: a short cross-fade of the whole page (View Transitions;
     browsers without it switch instantly) */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.32s;
}
