:root {
  --top-margin: 25px;
  --bottom-bar: 50px;
  --bottom-margin: 10px;
  --bg-color: #0d0d0d;
  --text-main: #ffffff;
  /* Body font: System fonts (Regular weight available) */
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Title font: Custom Bold */
  --font-bold: 'SF Pro Display Bold', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --pop-bg: #111111;
  --pop-border: #ffffff;
}

@font-face {
  font-family: 'SF Pro Display Bold';
  src: url('SFPRODISPLAYBOLD.woff2') format('woff2'),
    url('SFPRODISPLAYBOLD.OTF') format('opentype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

/* Desktop: everything inline */
@media (max-width: 480px) {
  #toggle-container {
    flex-basis: 100%;
    /* FORCES NEXT LINE */
    justify-content: center;
  }

  #popInfo {
    min-width: 60vw;
    padding: 5px 5px;
  }

  #popUp {
    top: 15px;
    width: 20vw;
    max-height: 60vh;
    font-size: 12px;
    /* smaller base text for mobile */
    padding: 10px;
    /* optional: tighter padding */
  }


  .popup-title {
    font-size: 13px;
  }

  .popup-sub {
    font-size: 12px;
  }

  .migration-dest .migration-value {
    font-size: 10px;
  }
}

/* New rule for intermediate screens */
@media (min-width: 480px) and (max-width: 730px) {
  #popInfo {
    min-width: 320px;
  }
}

html,
body {
  height: 100%;
  margin: 0;
  background: rgba(0, 0, 0, 255);
  overflow: hidden;
  /* No scrollbars */
}

#map-container {
  position: relative;
  width: 92vw;
  height: auto;
  /* overridden by JS */
  margin: var(--top-margin) auto 0;
  /* remove bottom margin so JS controls spacing */
  border: 1px solid white;
  overflow: hidden;
  background: #0d0d0d;
  touch-action: none;
  visibility: hidden;
  /* hide until ready */
}

#svg-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#p5-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#svg-wrapper svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* scale inside container */
}

#toolbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: 90vw;
  font-size: 45px;
  text-align: center;
  display: flex;
  padding-bottom: 10px;
  flex-wrap: wrap;
  /* REQUIRED */
  justify-content: center;
  box-sizing: border-box;
}

#toolbar button {
  min-width: 30px;
  height: 30px;
  border: 1px solid #fff;
  cursor: pointer;
  background: rgb(0, 0, 0);
  color: #fff;

}

.zoom-btn {
  font-size: clamp(13px, 1.6vw, 16px);
  font-family: var(--font-bold);
  font-weight: bold;
  cursor: pointer;
  opacity: 1;
}

.zoom-btn:hover {
  background-color: rgb(203, 203, 203) !important;
}

#toolbar-center,
.lang-switch {
  display: inline-block;
  font-size: 0;
}

#toggle-container {
  display: inline-flex;
  justify-content: center;
  align-content: center;
}

.toggle-btn {
  width: auto;
  min-width: 0;
  padding-right: 5px;
  padding-left: 5px;
  font-size: clamp(11px, 1.6vw, 15px);
  white-space: nowrap;
  border: 1px solid #fff;
  cursor: pointer;
  opacity: 0.5;
}

.toggle-btn.active {
  font-weight: 600;
  opacity: 1;
}

.lang-switch button {
  background: none;
  cursor: pointer;
  opacity: 0.5;
  font-size: 12px;
  border-style: dotted !important;
}

.lang-switch button.active {
  opacity: 1;
  text-decoration: underline;
  border-style: solid !important;
}

/* Optional hover */
.lang-switch button:hover {
  opacity: 0.8;
}

#info-btn.active {
  font-weight: 600;
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 1);
  color: rgb(0, 0, 0);
}

#info-btn.active+#popInfo,
#popInfo.active {
  display: block;
}


#popUp {
  position: fixed;
  top: 10%;
  /* halfway down container */
  right: 30px;
  /* keep horizontal position */
  width: clamp(230px, 15vw, 300px);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid white;
  background: #111;
  color: #fff;
  padding: 12px 14px;
  border-radius: 2px;
  font-family: var(--font-stack);
  font-size: 12px;
  line-height: 1.3;
  display: none;
  z-index: 9999;
}

#popUp h2 {
  margin: 0 0 6px 0;
  font-size: 20px;
}

#popUp p {
  margin: 4px 0 0 0px;
}

.popup-header {
  display: flex;
  flex-direction: column;
  /* stack main header and below section */
  gap: 6px;
  /* space between main header and belowHeader */
  margin-bottom: 10px;
}


.popup-header-shape {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
}

.popup-top-row {
  display: flex;
  align-items: center;
  /* shape centers with name + population */
  gap: 10px;
}


.popup-name-pop {
  display: flex;
  flex-direction: column;
}

.notes-up {
  position: relative;
  display: inline-block;
  /* inline with name */
  margin-left: 4px;
}

.notes-star {
  cursor: pointer;
  font-weight: bold;
  margin-left: 4px;
}

.notes-bubble {
  display: none;
  position: absolute;
  top: 100%;
  width: 100%;
  box-sizing: border-box;
  background-color: #111111;
  color: #fff;
  font-size: 11px;
  font-weight: 300;
  line-height: 1.3;
  padding: 15px 5px 15px 5px;
  border-radius: 4px;
  text-align: left;
  /* center text */
  z-index: 100;
}

.notes-up:hover .notes-bubble {
  display: block;
}

.popup-title {
  font-size: 18px;
  font-weight: bold;
}

.popup-title.long-name {
  display: inline-block;
  /* allows width restriction */
  max-width: 140px;
  /* adjust based on your layout */
  word-wrap: break-word;
  line-height: 1.1em;
}

.popup-sub {
  font-size: 16px;
  line-height: 1.2;
  margin-left: calc(24px + 10px);
  margin-bottom: 5px;
}

.mig-info {
  font-weight: lighter;
  font-size: 14px;
  line-height: 1.2;
  margin-left: 5px;
  /* aligns under text, not shape */
  margin-bottom: 10px;
}

.migration-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 10px;
}


.citizen-status {
  font-size: 13px;
  justify-content: center;
  margin-top: 4px;
  white-space: pre-line;

}

.migration-row {
  display: flex;
  align-items: center;
  gap: 15px;
}

.migration-dest.long-name {
  display: inline-block;
  max-width: 140px;
  /* adjust based on your layout */
  word-wrap: break-word;
  /* break long words if necessary */
  overflow-wrap: break-word;
  line-height: 1.1em;
}


.shape-wrapper {
  width: 15px;
  /* fixed width for the shape */
  display: flex;
  align-items: center;
  justify-content: center;
}


.shape-wrapper {
  width: 15px;
  /* fixed width for the shape */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 5px;
}


.migration-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
  margin-bottom: 5px;
}

.migration-dest {
  font-weight: 400;
  font-size: 15px;
}

.migration-value {
  font-size: 14px;
  color: #aaa;

}

#popInfo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: max-content;
  max-width: 40%;
  max-height: 80%;
  /* ← 80% of map-container */
  overflow-y: auto;
  z-index: 10;
  background: #000;
  color: #fff;
  padding: 20px 20px;
  border: 1px solid #fff;
  font-family: var(--font-stack);
  font-size: clamp(14px, 2.5vw, 16px);
  line-height: 1.3;
  word-wrap: break-word;

  text-align: left;
  display: none;
  z-index: 9999;
}

.popContact .contact-image {
  display: block;
  /* so margin auto works */
  margin: 10px auto 10px auto;
  height: clamp(15px, 20vw, 50px);
  width: auto;
  /* maintain aspect ratio */
  align-content: center;
}

#disclaimer {
  font-size: clamp(12px, 1.6vw, 14px);
  color: #D5D5D5;
  line-height: 1.3;
  display: inline-block;
  margin-bottom: 25px;
}


#warning {
  font-size: clamp(11px, 1.6vw, 13px);
  font-weight: 300;
  color: #B9B9B9;
  line-height: 1.3;
  display: inline-block;
  margin-bottom: 25px;
}


#popInfo a {
  color: #9fd3ff;
  text-decoration: underline;
}

#popInfo a:hover {
  color: #ffffff;
}

#popInfo .info-icons {
  display: flex;
  justify-content: center;
  /* centers children horizontally */
}

#popInfo .info-icons img {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin: 3px;
}

#popInfo .info-icons a {
  text-decoration: none;
  /* removes underline */

}

/* Intro Modal */
#introModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  /* dynamic height for mobile */
  background: #000;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  /* Force vertical flow */
  overflow-y: auto;
  /* Scroll on container */
  position: fixed;
  inset: 0;
}

.intro-content {
  margin: auto;
  /* Vertically and horizontally centers, but allows scroll if clipped */
  max-width: 600px;
  width: 90%;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Remove max-height constraints */
}

.intro-content h1 {
  font-family: var(--font-bold);
  font-size: clamp(28px, 8vw, 70px);
  /* Slightly smaller min */
  margin-bottom: 15px;
  letter-spacing: 4px;
  color: #fff;
  line-height: 1.1;
}

.intro-content p {
  color: #ccc;
  margin-bottom: 20px;
  font-size: clamp(13px, 4vw, 16px);
  font-family: var(--font-stack);
  line-height: 1.5;
  max-width: 100%;
}

#enter-btn {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 15px 40px;
  font-family: var(--font-bold);
  font-size: clamp(12px, 3vw, 14px);
  cursor: pointer;
  transition: all 0.4s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 15px;
  margin-bottom: 20px;
  border-radius: 30px;
  flex-shrink: 0;
  /* Prevent button squashing */
}

#enter-btn:hover {
  background: #fff;
  color: #000;
}

.intro-logo {
  width: clamp(50px, 15vw, 70px);
  height: auto;
  margin-top: 25px;
  flex-shrink: 0;
}

.intro-socials {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-shrink: 0;
}

.intro-socials img {
  width: 24px;
  height: 24px;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.intro-socials img:hover {
  opacity: 1;
}
.intro-title {  
  height: clamp(30px, 15vw, 60px);
  width: auto;
  margin-top: 20px;
  flex-shrink: 0;
}
