:root {
  --void: #04070c;
  --bone: #e8dfcb;
  --ink: #e9eef4;
  --muted: #94a7b9;
  --dim: #6b7f92;
  --amber: #f0a852;
  --amber-lit: #ffd08f;
  --hair: rgba(150, 180, 205, 0.16);
  --pane: rgba(8, 15, 24, 0.74);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --pad: clamp(1rem, 2.6vw, 2.1rem);
}

* { box-sizing: border-box; }

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

body {
  background: var(--void) radial-gradient(circle at 50% 44%, #0a1220 0%, #060b14 46%, #03060b 82%) fixed;
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#globe {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}

#globe:focus-visible {
  outline: 1px solid rgba(240, 168, 82, 0.55);
  outline-offset: -3px;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 42%, rgba(0, 0, 0, 0.42) 100%);
}

.ui {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* ------------------------------------------------------------- masthead */

.mast {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  max-width: 20rem;
}

.wordmark {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.62em;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.05rem, 2.2vw, 1.32rem);
  letter-spacing: 0.3em;
  color: var(--bone);
}

.wordmark .bead {
  width: 0.42em;
  height: 0.42em;
  border-radius: 50%;
  background: var(--amber-lit);
  box-shadow: 0 0 0 3px rgba(240, 168, 82, 0.13), 0 0 14px 2px rgba(240, 168, 82, 0.5);
  flex: none;
}

.tagline {
  margin: 0.62rem 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(0.82rem, 1.5vw, 0.94rem);
  line-height: 1.45;
  color: var(--muted);
}

.meta {
  margin: 0.7rem 0 0;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.mast::after {
  content: "";
  display: block;
  width: 3.2rem;
  height: 1px;
  margin-top: 0.85rem;
  background: linear-gradient(to right, rgba(240, 168, 82, 0.6), rgba(240, 168, 82, 0));
}

/* ---------------------------------------------------------------- tools */

.tools {
  position: absolute;
  top: var(--pad);
  right: var(--pad);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.7rem;
}

.ghost {
  pointer-events: auto;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  margin: 0;
  padding: 0.52rem 0.95rem;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: rgba(8, 15, 24, 0.5);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.ghost::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 9px rgba(240, 168, 82, 0.75);
}

.ghost:hover {
  border-color: rgba(240, 168, 82, 0.5);
  background: rgba(24, 18, 10, 0.6);
  color: #fff;
}

.ghost:focus-visible {
  outline: 1px solid rgba(240, 168, 82, 0.75);
  outline-offset: 2px;
}

body.touring .ghost {
  border-color: rgba(240, 168, 82, 0.45);
  color: var(--amber-lit);
}

body.touring .ghost::before {
  animation: bead 1.8s ease-in-out infinite;
}

@keyframes bead {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.readout {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  color: var(--dim);
}

/* ----------------------------------------------------------------- note */

.note {
  pointer-events: auto;
  position: absolute;
  right: var(--pad);
  top: 50%;
  width: min(23rem, 34vw);
  transform: translateY(-50%);
  padding: 1.5rem 1.55rem 1.35rem;
  border: 1px solid var(--hair);
  border-radius: 3px;
  background: var(--pane);
  backdrop-filter: blur(11px) saturate(120%);
  -webkit-backdrop-filter: blur(11px) saturate(120%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.note::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, rgba(240, 168, 82, 0.85), rgba(240, 168, 82, 0.05));
}

.note.in {
  animation: noteIn 0.5s cubic-bezier(0.16, 0.84, 0.44, 1) both;
}

@keyframes noteIn {
  from { opacity: 0; transform: translateY(-50%) translateX(14px); }
  to { opacity: 1; transform: translateY(-50%) translateX(0); }
}

.note-close {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--dim);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.2s ease;
}

.note-close:hover { color: var(--bone); }
.note-close:focus-visible { outline: 1px solid rgba(240, 168, 82, 0.7); }

.note-head {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin: 0;
}

.note-num {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--amber);
}

.note-kind {
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.note-name {
  margin: 0.5rem 0 0.35rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.45rem, 2.6vw, 1.78rem);
  line-height: 1.15;
  letter-spacing: 0.005em;
  color: var(--bone);
}

.note-coord {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--dim);
}

.note-body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.62;
  color: #d8e2ec;
}

.note-leg {
  margin: 1.05rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--hair);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--dim);
}

.note-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.note-nav button {
  appearance: none;
  border: 0;
  padding: 0.3rem 0;
  background: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: color 0.2s ease;
}

.note-nav button:hover { color: var(--amber-lit); }
.note-nav button:focus-visible { outline: 1px solid rgba(240, 168, 82, 0.7); outline-offset: 2px; }

/* ----------------------------------------------------------------- foot */

.foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 0 calc(var(--pad) * 0.7);
}

.hint {
  margin: 0 var(--pad) 0.8rem;
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  color: var(--dim);
  transition: opacity 0.9s ease;
}

.hint.gone { opacity: 0; }

.hint kbd {
  font-family: var(--mono);
  font-size: 0.68em;
  letter-spacing: 0.06em;
  padding: 0.15em 0.4em;
  border: 1px solid var(--hair);
  border-radius: 3px;
  color: var(--muted);
}

.index {
  pointer-events: auto;
  display: flex;
  gap: 0.15rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.35rem var(--pad) 0.45rem;
  border-top: 1px solid rgba(150, 180, 205, 0.1);
  background: linear-gradient(to top, rgba(4, 8, 14, 0.72), rgba(4, 8, 14, 0));
  -webkit-overflow-scrolling: touch;
  /* Fades the ends so it is obvious the strip keeps going. */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--pad), #000 calc(100% - 2.4rem), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--pad), #000 calc(100% - 2.4rem), transparent 100%);
}

.index::-webkit-scrollbar { display: none; }

.stop {
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45em;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  padding: 0.55rem 0.7rem 0.5rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.22s ease, border-color 0.22s ease;
}

.stop-num {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--dim);
  transition: color 0.22s ease;
}

.stop:hover { color: var(--bone); }
.stop:hover .stop-num { color: var(--amber); }
.stop:focus-visible { outline: 1px solid rgba(240, 168, 82, 0.7); outline-offset: -2px; }

.stop.is-on {
  color: var(--amber-lit);
  border-bottom-color: rgba(240, 168, 82, 0.85);
}

.stop.is-on .stop-num { color: var(--amber); }

/* --------------------------------------------------------------- mobile */

@media (max-width: 899px) {
  .mast { max-width: 16rem; }
  .meta { display: none; }

  .note {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    transform: none;
    border-width: 1px 0 0;
    border-radius: 14px 14px 0 0;
    padding: 1.2rem 1.25rem 1.15rem;
    max-height: 56dvh;
    overflow-y: auto;
  }

  .note::before { width: 100%; height: 2px; bottom: auto; background: linear-gradient(to right, rgba(240, 168, 82, 0.85), rgba(240, 168, 82, 0.05)); }

  .note.in { animation-name: noteUp; }

  @keyframes noteUp {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .note-body { font-size: 0.96rem; }

  body.has-note .foot { opacity: 0; pointer-events: none; }
  .foot { transition: opacity 0.3s ease; }
}

@media (max-width: 520px) {
  .tagline { display: none; }
  .readout { display: none; }
  .hint { font-size: 0.66rem; }
  .hint-keys { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .note.in { animation: none; }
  .hint { transition: none; }
  body.touring .ghost::before { animation: none; }
}

/* --------------------------------------------- when the globe cannot draw */

.fallback {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: none;
  place-items: center;
  padding: 2rem;
  background: radial-gradient(ellipse at 50% 40%, #0a1220, #03060b);
  text-align: center;
}

.no-globe .fallback { display: grid; }
.no-globe .ui { display: none; }

.fallback p {
  max-width: 26rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
}
