/*
 * Palette sampled from the Venture Vorld badge:
 *   cream   #f7e5b6   forest  #1b3c27
 *   sand    #e9c886   sunset  #e49e46
 *
 * The globe keeps its night sky, but the sky is now deep forest rather than
 * blue-black, the land is a lit sage-cream and the pins are the badge's
 * sunset orange — the same three-way split as the logo.
 */

:root {
  --bg: #081410;
  --ink: #f7e5b6;
  --muted: #b0a67f;
  --dim: #978e6c;

  --pin: #e49e46;
  --pin-soft: rgba(228, 158, 70, 0.1);
  --pin-line: rgba(228, 158, 70, 0.36);
  /* Dark forest on the orange, the way the badge does it. White would fail contrast. */
  --pin-ink: #16301f;

  --card: #0c1a12;
  --glass: rgba(12, 26, 18, 0.85);
  --line: rgba(247, 229, 182, 0.16);
  --focus: #f7e5b6;

  /* Whatever the device already has. No font files, no font requests. */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: radial-gradient(900px 900px at 50% 46%, #12271a 0%, #0a1710 46%, var(--bg) 100%);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- starfield ---------- */

.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.stars span {
  position: absolute;
  border-radius: 50%;
  background: #f7e5b6;
}

/* ---------- chrome ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 20px 26px;
  padding-top: max(20px, env(safe-area-inset-top));
  pointer-events: none;
}

/* Zoomed in over land the globe is pale, and cream text on it disappears.
   A scrim behind the header keeps the name and the tally readable wherever
   the globe happens to be. */
.topbar::before {
  content: '';
  position: absolute;
  inset: 0 0 -24px;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(6, 16, 11, 0.82), rgba(6, 16, 11, 0));
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  pointer-events: auto;
}

.brand-mark {
  display: block;
  width: 44px;
  height: auto;
  border-radius: 9px;
  flex: none;
}

.brand span {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

/* ---------- search ---------- */

.find {
  position: relative;
  /* The blur below makes this a stacking context, so the results list inside
     it cannot rise above the tally on its own: the whole box has to. */
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 7px;
  width: min(310px, 100%);
  margin-left: auto;
  padding: 0 10px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(12, 26, 18, 0.78);
  color: var(--dim);
  pointer-events: auto;
  backdrop-filter: blur(6px);
  transition: border-color 0.18s ease;
}

.find:focus-within {
  border-color: rgba(247, 229, 182, 0.42);
}

.find-icon {
  flex: none;
}

.find-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  outline: none;
}

.find-input::placeholder {
  color: var(--dim);
}

/* The browser's own clear cross, which does not match anything here. */
.find-input::-webkit-search-cancel-button {
  display: none;
}

.find-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(247, 229, 182, 0.12);
  color: var(--ink);
  cursor: pointer;
}

.find-clear[hidden] {
  display: none;
}

.find-list,
.countries {
  position: absolute;
  z-index: 90;
  margin: 6px 0 0;
  padding: 5px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.find-list {
  top: 100%;
  left: 0;
  right: 0;
  max-height: min(340px, 60vh);
}

.find-list[hidden],
.countries[hidden] {
  display: none;
}

.find-row {
  display: block;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.find-row:hover,
.find-row.is-on {
  background: rgba(247, 229, 182, 0.1);
}

.find-title {
  display: block;
  font-size: 13px;
  line-height: 1.3;
  /* One line: a title can be very long and this is a menu, not the card. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.find-where {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.find-empty {
  padding: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- the tally, and the countries behind it ---------- */

.tally {
  position: relative;
  z-index: 10;
  margin-left: auto;
  pointer-events: auto;
}

.counts {
  display: block;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  text-align: right;
}

.counts:hover,
.counts[aria-expanded='true'] {
  border-color: var(--line);
  color: var(--ink);
}

.counts::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: -2px 0 0 7px;
  border-right: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  transform: rotate(45deg);
  vertical-align: middle;
}

.counts[aria-expanded='true']::after {
  transform: rotate(225deg);
  margin-top: 2px;
}

.countries {
  top: 100%;
  right: 0;
  width: 246px;
  max-height: min(390px, 64vh);
}

.country-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.country-row:hover,
.country-row.is-on {
  background: rgba(247, 229, 182, 0.1);
}

.country-flag {
  flex: none;
  font-size: 16px;
  line-height: 1;
}

.country-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-count {
  flex: none;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 60;
  margin: 0;
  padding: 0 20px;
  text-align: center;
  font-size: 12.5px;
  color: var(--dim);
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.notice {
  position: fixed;
  left: 50%;
  top: 68px;
  z-index: 60;
  transform: translateX(-50%);
  margin: 0;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  font-size: 12px;
  color: var(--muted);
}

/* ---------- globe ---------- */

/* The stage fills the window and is also what you drag. The canvas never
   resizes; zooming changes the radius drawn inside it. */
.stage {
  position: fixed;
  inset: 0;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.6s ease;
}

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

#globe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

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

/* ---------- country names ---------- */

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

.country {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  /* Dark type with a pale halo, so a name stays readable whether it lands on
     the light green of the land or the dark of a coastline's sea. */
  color: #16301f;
  text-shadow:
    0 0 3px rgba(238, 245, 225, 0.9),
    0 0 7px rgba(238, 245, 225, 0.65);
  will-change: transform;
}

.country[hidden] {
  display: none;
}

/* ---------- zoom ---------- */

.zoom {
  position: fixed;
  right: 22px;
  bottom: 26px;
  z-index: 75;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--glass);
  backdrop-filter: blur(6px);
}

.zoom-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.zoom-btn + .zoom-btn {
  border-top: 1px solid var(--line);
}

.zoom-btn:hover {
  background: rgba(247, 229, 182, 0.09);
}

.compass-dial {
  display: block;
  transform-origin: center;
  will-change: transform;
}

.compass.is-off {
  background: rgba(228, 158, 70, 0.14);
}

/* ---------- pins ---------- */

.pin {
  position: absolute;
  left: 0;
  top: 0;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  padding: 0;
  border: 0;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  will-change: transform;
}

.pin[hidden] {
  display: none;
}

.pin-ring {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--pin-line);
  background: var(--pin-soft);
  transition: width 0.18s ease, height 0.18s ease, background 0.18s ease;
}

.pin-core {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pin);
  box-shadow: 0 0 10px rgba(228, 158, 70, 0.7);
  transition: width 0.18s ease, height 0.18s ease;
}

.pin-count {
  position: absolute;
  top: -2px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--pin);
  color: var(--pin-ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.pin-name {
  position: absolute;
  top: 29px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 500;
  color: #e9d6ab;
  text-shadow: 0 1px 7px rgba(6, 16, 11, 0.98);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.pin.is-near .pin-name {
  opacity: 1;
}

.pin.is-active .pin-ring {
  width: 32px;
  height: 32px;
  border-color: var(--pin);
  background: rgba(228, 158, 70, 0.16);
  box-shadow: 0 0 26px rgba(228, 158, 70, 0.38);
}

.pin.is-active .pin-core {
  width: 12px;
  height: 12px;
  box-shadow: 0 0 16px var(--pin);
}

.pin.is-active .pin-name {
  opacity: 0;
}

.pin:focus-visible {
  outline: none;
}

.pin:focus-visible .pin-ring {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* ---------- clusters ---------- */

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

.cluster {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  padding: 0 8px;
  border: 1px solid rgba(228, 158, 70, 0.5);
  border-radius: 999px;
  background: rgba(12, 28, 19, 0.88);
  box-shadow: 0 0 18px rgba(228, 158, 70, 0.18);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  pointer-events: auto;
  will-change: transform;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.cluster[hidden] {
  display: none;
}

.cluster:hover {
  background: rgba(228, 158, 70, 0.2);
  border-color: var(--pin);
}

/* ---------- popup ---------- */

.popup {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 80;
  width: 224px;
  max-width: calc(100vw - 28px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.82);
  pointer-events: auto;
  will-change: transform;
}

.popup[hidden] {
  display: none;
}

.popup-tail {
  position: absolute;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: var(--card);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.popup.is-above .popup-tail {
  bottom: -6px;
  transform: rotate(45deg);
}

.popup.is-below .popup-tail {
  top: -6px;
  transform: rotate(225deg);
}

/* Sits over the top-right of the thumbnail, where nothing else goes: the New
   flag is top-left and the duration is bottom-right. */
.popup-close {
  position: absolute;
  right: 7px;
  top: 7px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(247, 229, 182, 0.3);
  border-radius: 50%;
  background: rgba(8, 20, 16, 0.72);
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.popup-close:hover {
  background: rgba(8, 20, 16, 0.94);
  border-color: rgba(247, 229, 182, 0.6);
}

.popup-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 13px 13px 0 0;
  overflow: hidden;
  background: linear-gradient(145deg, #2a3b2a 0%, #101a13 100%);
  text-decoration: none;
}

.popup-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popup-new {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--pin);
  color: var(--pin-ink);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

/* Only the circle is the link. The picture around it used to be one too, so
   a stray press — on a pin hidden behind the card, say — threw you out to
   YouTube on a video you had not chosen. */
.popup-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-play span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(8, 20, 16, 0.55);
  border: 1px solid rgba(247, 229, 182, 0.32);
  backdrop-filter: blur(2px);
}

.popup-dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(8, 20, 16, 0.85);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.popup-body {
  padding: 12px 14px 14px;
}

.popup-place {
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: #e9b46a;
}

.popup-title {
  margin: 0 0 7px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.012em;
  /* Two lines at most, so a long title can't stretch the card. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popup-meta {
  margin: 0 0 12px;
  font-size: 11.5px;
  color: var(--muted);
}

.popup-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--pin);
  color: var(--pin-ink);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
}

.popup-cta:hover {
  background: #efae5e;
}

/* ---------- more than one video in the same place ---------- */

.popup-count {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(228, 158, 70, 0.16);
  color: var(--pin);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.popup-strip {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
}

.popup-strip-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(247, 229, 182, 0.25) transparent;
}

.strip {
  position: relative;
  flex: 0 0 52px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.strip-thumb {
  position: relative;
  display: block;
  width: 52px;
  height: 30px;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(145deg, #2a3b2a 0%, #101a13 100%);
  box-shadow: inset 0 0 0 1px rgba(247, 229, 182, 0.14);
}

.strip-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.strip.is-on .strip-thumb {
  box-shadow: inset 0 0 0 2px var(--pin);
}

.strip-new {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pin);
  box-shadow: 0 0 0 1.5px rgba(8, 20, 16, 0.85);
}

.strip-dur {
  display: block;
  margin-top: 4px;
  font-size: 9.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.strip.is-on .strip-dur {
  color: var(--ink);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- loading ---------- */

.is-loading .stage,
.is-loading .hint {
  opacity: 0;
}

/* ---------- small screens ---------- */

@media (max-width: 620px) {
  .topbar {
    padding: 16px 18px;
    padding-top: max(16px, env(safe-area-inset-top));
    gap: 4px 16px;
  }

  .brand-mark {
    width: 30px;
  }

  /* Search and tally each drop onto their own line rather than squeezing
     the name. The search takes the full width it is given. */
  .find {
    width: 100%;
    margin-left: 0;
  }

  .tally {
    margin: 0;
    width: 100%;
  }

  .counts {
    margin: 0 0 0 auto;
  }

  .notice {
    top: 92px;
  }

  /* High enough to stay clear of the docked card, which grows taller when a
     place holds several videos. */
  .zoom {
    right: 14px;
    bottom: auto;
    top: 150px;
  }

  /* Docked along the bottom; app.js shifts the globe up to make room.
     Capped rather than full-bleed, so it stays a card and leaves the globe
     as much of the screen as possible. */
  .popup {
    position: fixed;
    left: 50%;
    right: auto;
    top: auto;
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: min(320px, calc(100vw - 28px));
    max-width: none;
    transform: translateX(-50%);
  }

  .popup-tail {
    display: none;
  }

  /* A thumb needs more to aim at than a mouse does. */
  .popup-close {
    right: 8px;
    top: 8px;
    width: 32px;
    height: 32px;
  }

  .hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage,
  .hint,
  .pin-name,
  .pin-ring,
  .pin-core {
    transition: none;
  }
}
