/* ============================================
   PROJ-8: Interactive World Map Section
   ============================================ */

.worldmap-section {
  padding: var(--v3-section-py, 130px) 0;
  background-color: var(--v2-bg-warm-white, #F0F0E1);
  overflow: hidden;
}

.worldmap-section .v3-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--v3-gutter, 24px);
}


/* ============================================
   Section Header
   ============================================ */

.worldmap-header {
  text-align: center;
  margin-bottom: 56px;
}

.worldmap-header .v3-eyebrow {
  justify-content: center;
}

.worldmap-title {
  font-family: var(--v3-font-serif, 'Cormorant Garamond', Georgia, serif);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 700;
  color: var(--v3-primary, #005550);
  line-height: 1.15;
  margin: 0 0 16px 0;
}

.worldmap-intro {
  font-family: var(--v3-font-sans, 'DM Sans', sans-serif);
  font-size: 1.05rem;
  color: var(--v3-text-muted, #7a7a6a);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.7;
}


/* ============================================
   Map Container
   ============================================ */

.worldmap-container {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
}

.worldmap-img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0.35;
  filter: grayscale(30%) contrast(0.9);
  transition: opacity 0.4s ease;
}

.worldmap-dots-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}


/* ============================================
   Pulsating Dots
   ============================================ */

.wm-dot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  pointer-events: all;
  z-index: 5;
  /* Ensure 44x44 minimum touch target */
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wm-dot:focus {
  outline: 2px solid var(--v3-secondary, #66C0BE);
  outline-offset: 4px;
  border-radius: 50%;
}

.wm-dot-core {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wm-dot:hover .wm-dot-core {
  transform: scale(1.25);
}

/* Active projects: Teal/Turquoise */
.wm-dot-active .wm-dot-core {
  background-color: #66C0BE;
  box-shadow: 0 0 8px rgba(102, 192, 190, 0.6);
}

/* Completed projects: Warm Orange */
.wm-dot-completed .wm-dot-core {
  background-color: #E8963A;
  box-shadow: 0 0 8px rgba(232, 150, 58, 0.6);
}

/* Mixed (active + completed): split with gradient */
.wm-dot-mixed .wm-dot-core {
  background: linear-gradient(135deg, #66C0BE 50%, #E8963A 50%);
  box-shadow: 0 0 8px rgba(102, 192, 190, 0.4), 0 0 8px rgba(232, 150, 58, 0.4);
}

/* Cluster count badge */
.wm-dot-count {
  font-family: var(--v3-font-sans, 'DM Sans', sans-serif);
  font-size: 9px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Larger dot for clusters */
.wm-dot .wm-dot-count ~ .wm-dot-core,
.wm-dot-count {
  /* This selector won't work, handled via parent */
}

/* If count exists, make core bigger */
.wm-dot:has(.wm-dot-count) .wm-dot-core {
  width: 22px;
  height: 22px;
}


/* ============================================
   Pulse Animation Rings
   ============================================ */

.wm-dot-pulse {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  z-index: 1;
  pointer-events: none;
}

.wm-dot-active .wm-dot-pulse {
  border: 2px solid #66C0BE;
  animation: wmPulseActive 2.5s ease-out infinite;
}

.wm-dot-completed .wm-dot-pulse {
  border: 2px solid #E8963A;
  animation: wmPulseCompleted 2.5s ease-out infinite;
}

.wm-dot-mixed .wm-dot-pulse {
  border: 2px solid #66C0BE;
  animation: wmPulseActive 2.5s ease-out infinite;
}

/* Second pulse ring (staggered) */
.wm-dot-pulse-2 {
  animation-delay: 1s !important;
}

/* Staggered delays per dot */
.wm-dot-delay-1 .wm-dot-pulse { animation-delay: 0s; }
.wm-dot-delay-2 .wm-dot-pulse { animation-delay: 0.4s; }
.wm-dot-delay-3 .wm-dot-pulse { animation-delay: 0.8s; }
.wm-dot-delay-4 .wm-dot-pulse { animation-delay: 1.2s; }
.wm-dot-delay-5 .wm-dot-pulse { animation-delay: 1.6s; }
.wm-dot-delay-6 .wm-dot-pulse { animation-delay: 2.0s; }

@keyframes wmPulseActive {
  0% {
    transform: scale(1);
    opacity: 0.7;
    border-width: 2.5px;
  }
  100% {
    transform: scale(3);
    opacity: 0;
    border-width: 0.5px;
  }
}

@keyframes wmPulseCompleted {
  0% {
    transform: scale(1);
    opacity: 0.7;
    border-width: 2.5px;
  }
  100% {
    transform: scale(3);
    opacity: 0;
    border-width: 0.5px;
  }
}


/* ============================================
   Legend
   ============================================ */

.worldmap-legend {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.worldmap-legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--v3-font-sans, 'DM Sans', sans-serif);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--v3-text-muted, #7a7a6a);
}

.legend-dot-indicator {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot-active {
  background-color: #66C0BE;
  box-shadow: 0 0 0 4px rgba(102, 192, 190, 0.2), 0 0 12px rgba(102, 192, 190, 0.3);
}

.legend-dot-completed {
  background-color: #E8963A;
  box-shadow: 0 0 0 4px rgba(232, 150, 58, 0.2), 0 0 12px rgba(232, 150, 58, 0.3);
}


/* ============================================
   Stats Row
   ============================================ */

.worldmap-stats {
  display: flex;
  justify-content: center;
  gap: 60px;
  margin-top: 50px;
  padding-top: 40px;
  border-top: 1px solid rgba(0, 85, 80, 0.1);
}

.worldmap-stat {
  text-align: center;
}

.worldmap-stat-number {
  display: block;
  font-family: var(--v3-font-serif, 'Cormorant Garamond', Georgia, serif);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}

.worldmap-stat-number-active {
  color: #66C0BE;
}

.worldmap-stat-number-completed {
  color: #E8963A;
}

.worldmap-stat-number-countries {
  color: var(--v3-primary, #005550);
}

.worldmap-stat-label {
  font-family: var(--v3-font-sans, 'DM Sans', sans-serif);
  font-size: 0.9rem;
  color: var(--v3-text-muted, #7a7a6a);
  font-weight: 500;
}


/* ============================================
   PROJECT MODAL - Country Grid Popup
   ============================================ */

.wm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 30, 28, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wm-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Container */
.wm-modal {
  background: #ffffff;
  /*border-radius: 20px;*/
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
  transform: scale(0.92) translateY(30px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.wm-modal-overlay.active .wm-modal {
  transform: scale(1) translateY(0);
}

/* Modal Header */
.wm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  border-bottom: 1px solid rgba(0, 85, 80, 0.08);
  flex-shrink: 0;
}

.wm-modal-header-text {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.wm-modal-title {
  font-family: var(--v3-font-serif, 'Cormorant Garamond', Georgia, serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--v3-primary, #005550);
  margin: 0;
}

.wm-modal-count {
  font-family: var(--v3-font-sans, 'DM Sans', sans-serif);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--v3-text-muted, #7a7a6a);
  background: rgba(0, 85, 80, 0.06);
  padding: 4px 12px;
  border-radius: 50px;
}

/* Close Button */
.wm-modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 85, 80, 0.06);
  border: none;
  color: var(--v3-primary, #005550);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.wm-modal-close:hover {
  background: rgba(0, 85, 80, 0.12);
  transform: scale(1.1);
}

.wm-modal-close:focus {
  outline: 2px solid var(--v3-secondary, #66C0BE);
  outline-offset: 2px;
}

/* Modal Body - Scrollable Grid */
.wm-modal-body {
  padding: 24px 32px 32px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Project Grid: 3 cols desktop, 2 tablet, 1 mobile */
.wm-modal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}


/* ============================================
   Modal Project Cards
   ============================================ */

.wm-modal-card {
  background: var(--v3-bg-light, #fafaf5);
  /*border-radius: 12px;*/
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.wm-modal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 85, 80, 0.12);
}

/* Card Image (16:9) */
.wm-modal-card-img {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  overflow: hidden;
  background-color: rgba(0, 85, 80, 0.05);
}

.wm-modal-card-img img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.wm-modal-card:hover .wm-modal-card-img img {
  transform: scale(1.05);
}

/* Status Badge on Image */
.wm-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--v3-font-sans, 'DM Sans', sans-serif);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 50px;
  color: #ffffff;
  z-index: 2;
}

.wm-badge-active {
  background: #66C0BE;
}

.wm-badge-completed {
  background: #E8963A;
}

/* Card Body */
.wm-modal-card-body {
  padding: 16px 18px 20px;
}

.wm-modal-card-title {
  font-family: var(--v3-font-serif, 'Cormorant Garamond', Georgia, serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--v3-primary, #005550);
  margin: 0 0 8px 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wm-modal-card-desc {
  font-family: var(--v3-font-sans, 'DM Sans', sans-serif);
  font-size: 0.85rem;
  color: var(--v3-text-muted, #7a7a6a);
  line-height: 1.6;
  margin: 0 0 14px 0;
}

.wm-modal-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--v3-font-sans, 'DM Sans', sans-serif);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--v3-secondary, #66C0BE);
  text-decoration: none;
  transition: color 0.2s ease, gap 0.2s ease;
}

.wm-modal-card-cta:hover {
  color: var(--v3-primary, #005550);
  gap: 10px;
}


/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1023px) {
  .wm-modal-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wm-modal {
    max-width: 700px;
  }
}

@media (max-width: 767px) {
  .worldmap-section {
    padding: var(--v2-section-py-mobile, 80px) 0;
  }

  .worldmap-legend {
    gap: 24px;
  }

  .worldmap-stats {
    gap: 30px;
  }

  .worldmap-stat-number {
    font-size: 1.8rem;
  }

  .wm-modal-grid {
    grid-template-columns: 1fr;
  }

  .wm-modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 16px;
  }

  .wm-modal-header {
    padding: 18px 20px;
  }

  .wm-modal-title {
    font-size: 1.3rem;
  }

  .wm-modal-body {
    padding: 16px 20px 24px;
  }

  /* Ensure dots have large enough touch target */
  .wm-dot {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 575px) {
  .worldmap-stats {
    flex-direction: column;
    gap: 20px;
    align-items: center;
  }

  .wm-modal-header-text {
    flex-direction: column;
    gap: 4px;
  }
}


/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .wm-dot-pulse,
  .wm-dot-pulse-2 {
    animation: none !important;
    opacity: 0;
  }

  .wm-modal {
    transition: none;
  }

  .wm-modal-card {
    transition: none;
  }

  .wm-modal-card-img img {
    transition: none;
  }
}
