:root {
  --bg: #05070f;
  --panel: rgba(13, 18, 32, 0.82);
  --panel-border: rgba(120, 160, 255, 0.18);
  --text: #eef2ff;
  --text-dim: #9aa7c7;
  --accent: #5b8cff;
  --accent-2: #38d9c3;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, #0c1430 0%, #05070f 65%);
}

/* ---------- Header overlay ---------- */
.overlay-header {
  position: absolute;
  top: 22px;
  left: 26px;
  z-index: 10;
  pointer-events: none;
  user-select: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px rgba(91, 140, 255, 0.9);
}

.brand h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tagline {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.stats {
  margin-top: 10px;
  font-size: 12px;
  color: var(--accent-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- Hint pill ---------- */
.hint {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 12.5px;
  color: var(--text-dim);
  pointer-events: none;
  user-select: none;
  transition: opacity 1s ease;
  white-space: nowrap;
}

.hint.hidden { opacity: 0; }

/* ---------- Avatar markers ---------- */
.person-marker {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transform: translateZ(0);
}

.person-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transition: transform 0.15s ease;
}

.person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-marker:hover .person-avatar { transform: scale(1.12); }

.person-label {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgba(8, 12, 24, 0.75);
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* ---------- Theme toggle button ---------- */

.theme-toggle {
  position: fixed;
  top: 100px;
  right: 10px;
  z-index: 10;
  width: 30px;
  height: 30px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 0.2s;
  padding: 0;
  line-height: 1;
}

.theme-toggle:hover {
  background: rgba(91, 140, 255, 0.25);
}

/* ---------- Light mode overrides ---------- */

body.map-light {
  --bg: #f0f4fa;
  --panel: rgba(240, 245, 255, 0.92);
  --panel-border: rgba(60, 100, 200, 0.2);
  --text: #1a2a4a;
  --text-dim: #445580;
  --accent: #2563eb;
  --accent-2: #0891b2;
}

body.map-light #map {
  background: radial-gradient(ellipse at 50% 40%, #c8dff0 0%, #e8f2fa 65%);
}

body.map-light .person-label {
  color: #1a2a4a;
  background: rgba(240, 248, 255, 0.9);
  text-shadow: none;
}

body.map-light .maplibregl-popup.profile-popup .maplibregl-popup-tip {
  border-top-color: rgba(240, 245, 255, 0.92);
}

/* ---------- MapLibre chrome ---------- */
.maplibregl-ctrl-attrib {
  background: rgba(8, 12, 24, 0.6) !important;
  color: var(--text-dim);
}
.maplibregl-ctrl-attrib a { color: var(--text-dim) !important; }

.maplibregl-ctrl-group {
  background: var(--panel) !important;
  border: 1px solid var(--panel-border);
}
.maplibregl-ctrl-group button span { filter: invert(1); }

@media (max-width: 600px) {
  .overlay-header { top: 14px; left: 16px; }
  .brand h1 { font-size: 19px; }
  .hint { font-size: 11px; padding: 7px 14px; max-width: 90vw; white-space: normal; text-align: center; }
}

/* ---------- Side panel ---------- */

#side-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(360px, 92vw);
  background: #ffffff;
  box-shadow: -8px 0 48px rgba(0, 0, 0, 0.38);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
  overflow-y: auto;
  border-radius: 20px 0 0 20px;
  scrollbar-width: none;
}

#side-panel::-webkit-scrollbar { display: none; }
#side-panel.open { transform: translateX(0); }

.sp-header {
  position: relative;
  height: 180px;
  border-radius: 20px 0 0 0;
  flex-shrink: 0;
}

.sp-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  line-height: 1;
}

.sp-close:hover { background: rgba(0, 0, 0, 0.38); }

.sp-avatar-wrap {
  position: absolute;
  bottom: -40px;
  left: 20px;
}

.sp-avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #fff;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  display: block;
}

.sp-avatar-initials {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
}

.sp-online-dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border-radius: 50%;
  border: 2.5px solid #fff;
}

.sp-body {
  padding: 52px 20px 40px;
  color: #111827;
}

.sp-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sp-name {
  font-size: 21px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.sp-role {
  font-size: 13px;
  color: #6b7280;
  margin-top: 3px;
}

.sp-linkedin {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  text-decoration: none;
  transition: background 0.15s;
}

.sp-linkedin:hover { background: #dbeafe; border-color: #0a66c2; }

.sp-meta {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: #6b7280;
}

.sp-meta span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sp-snippet {
  margin-top: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #374151;
  border-top: 1px solid #f3f4f6;
  padding-top: 16px;
}

@media (max-width: 600px) {
  #side-panel { width: 100vw; border-radius: 0; }
  .sp-header { border-radius: 0; }
}
