/* The globe of names: a globe made only of thin meridians and parallels on warm paper, with invented place names
   on it. Throw it and it spins on, slows down, and a spring stops it on a name, which takes on weight and the one
   colour of the page. */
:root {
  --paper: #f3f0e8;    /* the page */
  --ink: #141414;      /* the lines and the names */
  --accent: #2438ff;   /* the name the globe stops on, and its meridian */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Fraunces Variable', Georgia, serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.stage {
  position: fixed;
  inset: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

@media (hover: hover) {
  .stage {
    cursor: grab;
  }
}

.stage.is-dragging {
  cursor: grabbing;
}

.lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.lines--back {
  z-index: 0;
}

.lines--front {
  z-index: 2;
}

.names {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* every name hangs from its place on the globe: the script gives the holder a flat matrix that lies it on the
   surface (so it narrows towards the edge and reads mirrored behind) and moves it in front of or behind the lines */
.place {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
}

.name {
  position: absolute;
  left: 0;
  top: 0;
  font-size: var(--type, 28px);
  font-style: italic;
  line-height: 1;
  letter-spacing: 0.005em;
  white-space: pre;
  font-kerning: normal;
  font-optical-sizing: auto;
  transform-origin: 50% 100%;
  /* a halo the colour of the paper, as on a printed map: the lines stop short of the letters */
  text-shadow: 0 0 2px var(--paper), 0 0 3px var(--paper), 0 0 5px var(--paper);
}

/* the hint under the globe; it goes away the first time someone takes the globe */
.hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(26px, 6vh);
  z-index: 3;
  margin: 0;
  text-align: center;
  font-size: 14px;
  font-style: italic;
  letter-spacing: 0.02em;
  font-variation-settings: 'wght' 380;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  margin: 0;
}

.stage:focus-visible .hint {
  opacity: 0.6 !important;
}
