/* ===================================================================
   Travel Globe — full-bleed dark immersive
   =================================================================== */

/* --- Reset & base ------------------------------------------------ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #080810;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-x pan-y pinch-zoom;
}

/* --- Animations -------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes markerBreathe {
  0%, 100% { transform: translate(-50%, -50%) scale(0.92); opacity: 0.42; }
  50%      { transform: translate(-50%, -50%) scale(1.22); opacity: 0.22; }
}

@keyframes cardIn {
  from { opacity: 0; transform: translate(-50%, 10px) scale(0.98); }
  to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* --- Globe container --------------------------------------------- */
#globe-container {
  position: fixed;
  inset: 0;
  z-index: 1;
  animation: fadeIn 2s ease-out;
}

#globe-container canvas {
  display: block;
}

/* --- Globe HTML markers ------------------------------------------ */
.globe-marker {
  position: relative;
  width: 30px;
  height: 30px;
  border: 0;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: auto;
  font: inherit;
  color: #fff;
  filter: drop-shadow(0 0 10px rgba(232, 145, 58, 0.18));
}

.globe-marker-halo,
.globe-marker-core,
.globe-marker-count {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.globe-marker-halo {
  width: 22px;
  height: 22px;
  background: radial-gradient(circle, rgba(240, 192, 128, 0.44), rgba(232, 145, 58, 0.10) 58%, transparent 72%);
  border: 1px solid rgba(240, 192, 128, 0.28);
  animation: markerBreathe 3.6s ease-in-out infinite;
}

.globe-marker-core {
  width: 5px;
  height: 5px;
  background: #ffd89b;
  box-shadow: 0 0 8px rgba(255, 216, 155, 0.86), 0 0 18px rgba(232, 145, 58, 0.34);
}

.globe-marker-count {
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 12, 24, 0.78);
  border: 1px solid rgba(255, 216, 155, 0.58);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 14px rgba(232, 145, 58, 0.28);
}

.globe-marker-label {
  position: absolute;
  left: 50%;
  bottom: 26px;
  max-width: 180px;
  transform: translate(-50%, 6px);
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(8, 8, 16, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.globe-marker.is-hovered .globe-marker-label,
.globe-marker.is-selected .globe-marker-label {
  opacity: 1;
  transform: translate(-50%, 0);
}

.globe-marker.is-hovered .globe-marker-halo,
.globe-marker.is-selected .globe-marker-halo {
  width: 28px;
  height: 28px;
  border-color: rgba(168, 224, 255, 0.48);
  background: radial-gradient(circle, rgba(168, 224, 255, 0.42), rgba(91, 192, 235, 0.10) 58%, transparent 72%);
}

.globe-marker.is-hovered .globe-marker-core,
.globe-marker.is-selected .globe-marker-core {
  background: #a8e0ff;
  box-shadow: 0 0 10px rgba(168, 224, 255, 0.96), 0 0 24px rgba(91, 192, 235, 0.42);
}

.globe-marker.is-cluster {
  width: 34px;
  height: 34px;
}

.globe-marker.is-cluster .globe-marker-halo {
  width: 30px;
  height: 30px;
}

/* --- Flat map container ------------------------------------------ */
#flat-map {
  position: fixed;
  inset: 0;
  z-index: 1;
  animation: fadeIn 0.6s ease-out;
}

#flat-map svg {
  width: 100%;
  height: 100%;
}

/* --- Floating masthead pill -------------------------------------- */
.masthead {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 16px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;

  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 20px;

  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;

  transition: opacity 0.5s ease;
}

.masthead-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.masthead-sub {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.55;
}

/* --- View toggle ------------------------------------------------ */
#view-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  padding: 3px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

#view-toggle button {
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: all 0.2s ease;
  font-family: inherit;
}

#view-toggle button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* --- Timeline scrubber ------------------------------------------ */
#timeline {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  height: 58px;
  padding: 0 max(18px, env(safe-area-inset-left, 18px)) max(0px, env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-right, 18px));
  background: rgba(8, 8, 16, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.03em;
  animation: fadeIn 2.5s ease-out;
}

#timeline .brush-container {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
}

#timeline svg {
  width: 100%;
  height: 36px;
}

#timeline-label {
  min-width: 140px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.58);
}

#timeline .timeline-rail {
  stroke: rgba(255, 255, 255, 0.10);
  stroke-width: 1;
}

#timeline .yr,
#timeline .timeline-year {
  font-feature-settings: "tnum";
}

#timeline .timeline-dot {
  filter: drop-shadow(0 0 5px rgba(232, 145, 58, 0.42));
  transition: r 0.16s ease, opacity 0.16s ease, fill 0.16s ease;
}

#timeline .brush .selection {
  fill: rgba(255, 255, 255, 0.12);
  stroke: rgba(255, 255, 255, 0.25);
  stroke-width: 1;
}

#timeline .brush .handle {
  fill: #fff;
  width: 6px;
}

/* --- Photo card ------------------------------------------------- */
#photo-card {
  position: fixed;
  bottom: max(74px, calc(env(safe-area-inset-bottom, 0px) + 74px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: none;
  min-width: 258px;
  background:
    radial-gradient(circle at 50% -20%, rgba(91, 192, 235, 0.10), transparent 42%),
    rgba(12, 12, 24, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 18px 20px 20px;
  max-width: 88vw;
  text-align: center;
  color: #fff;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.45), 0 0 32px rgba(91, 192, 235, 0.08);
}

#photo-card.visible {
  display: block;
  animation: cardIn 0.22s ease-out both;
}

.photo-card-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.46);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: background 0.16s ease, color 0.16s ease;
}

.photo-card-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

#photo-card .place-kicker {
  margin: 0 26px 5px;
  color: rgba(168, 224, 255, 0.68);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#photo-card h3 {
  margin: 0 24px 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.005em;
}

#photo-card .date {
  font-size: 11px;
  opacity: 0.48;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

#photo-card .photo-count {
  margin-bottom: 14px;
  color: rgba(255, 216, 155, 0.58);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#photo-card .photos {
  position: relative;
  width: 168px;
  height: 112px;
  margin: 0 auto;
}

#photo-card .photos img {
  position: absolute;
  inset: 0;
  width: 168px;
  height: 112px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: zoom-in;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
  transition: opacity 1s ease, border-color 0.18s ease, transform 0.18s ease;
  opacity: 0;
}

#photo-card .photos img.active {
  opacity: 1;
}

#photo-card .photos img:hover {
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

#photo-card .nophotos {
  font-size: 12px;
  opacity: 0.3;
}

/* --- Lightbox --------------------------------------------------- */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  background: rgba(4, 4, 12, 0.95);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

#lightbox.show {
  display: flex;
}

#lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 10px;
}

#lightbox .close {
  position: absolute;
  top: 20px;
  right: 28px;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s;
  z-index: 201;
}

#lightbox .close:hover {
  opacity: 1;
}

#lightbox .counter {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  letter-spacing: 0.05em;
}

#lightbox .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s;
  z-index: 201;
  user-select: none;
  padding: 20px;
}

#lightbox .nav:hover {
  opacity: 0.8;
}

#lightbox .nav.prev { left: 10px; }
#lightbox .nav.next { right: 10px; }

/* --- Ambient control button ------------------------------------- */
.ambient-btn {
  position: fixed;
  bottom: max(72px, calc(env(safe-area-inset-bottom, 24px) + 48px));
  right: max(24px, env(safe-area-inset-right, 24px));
  z-index: 10;

  padding: 10px 20px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.50);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.02em;
  font-family: inherit;

  transition: background 0.2s, border-color 0.2s;
}

.ambient-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.30);
}

/* --- Attribution footer ----------------------------------------- */
.attribution {
  position: fixed;
  bottom: max(8px, env(safe-area-inset-bottom, 8px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;

  display: flex;
  gap: 16px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
  pointer-events: none;
  user-select: none;
}

/* --- Utility ---------------------------------------------------- */
.hidden {
  display: none !important;
}

@media (max-width: 700px) {
  .masthead {
    top: max(10px, env(safe-area-inset-top, 10px));
    padding: 7px 12px;
  }

  .masthead-sub,
  .attribution {
    display: none;
  }

  #view-toggle {
    top: max(10px, env(safe-area-inset-top, 10px));
    right: max(10px, env(safe-area-inset-right, 10px));
  }

  #view-toggle button {
    min-height: 36px;
    padding: 7px 11px;
  }

  #timeline {
    height: 62px;
    padding-left: 12px;
    padding-right: 12px;
    gap: 10px;
  }

  #timeline-label {
    min-width: 84px;
    font-size: 10px;
  }

  #photo-card {
    left: 12px;
    right: 12px;
    bottom: max(72px, calc(env(safe-area-inset-bottom, 0px) + 72px));
    transform: none;
    max-width: none;
  }

  #photo-card.visible {
    animation: fadeIn 0.2s ease-out both;
  }

  #photo-card .photos,
  #photo-card .photos img {
    width: min(184px, 58vw);
    height: min(122px, 38vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
