/* Home page "Global Presence" section — core/views/partials/front/global-presence.php */

.rs-global-presence-area {
  --gp-accent: var(--rs-theme-light-blue, #0d80ce);
  --gp-accent-rgb: 13, 128, 206;
  --gp-ink: #1d2733;
  --gp-muted: #5b6776;
  --gp-line: #e4e9f0;
}

.rs-global-presence-area .gp-intro {
  max-width: 720px;
  margin: 16px auto 0;
}

.gp-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}

/* ---- Globe card ---------------------------------------------------- */
.gp-globe-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--gp-line);
  box-shadow: 0 12px 34px -18px rgba(15, 22, 35, 0.22);
}

/* Fills the card, which stretches to the region list's height, so the globe
   grows to the card's full width (sized in JS to the smaller of width/height). */
.gp-globe-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: clamp(380px, 42vw, 560px);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

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

.gp-globe-canvas {
  position: absolute;
  inset: 0;
  display: block;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.gp-globe-ready .gp-globe-canvas {
  opacity: 1;
}

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

.gp-globe-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 180px;
  color: rgba(var(--gp-accent-rgb), 0.12);
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.gp-globe-ready .gp-globe-fallback {
  opacity: 0;
}

.gp-drag-hint {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 30px;
  font-size: 11.5px;
  letter-spacing: 0.3px;
  color: var(--gp-muted);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(15, 22, 35, 0.1);
  backdrop-filter: blur(8px);
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.gp-drag-hint.is-hidden,
.gp-no-globe .gp-drag-hint {
  opacity: 0;
}

/* ---- Markers ------------------------------------------------------- */
.gp-marker {
  position: absolute;
  display: none;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  z-index: 5;
}

.gp-marker .gp-dot {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gp-accent);
  border: 1.5px solid #fff;
  box-shadow: 0 0 8px 1px rgba(var(--gp-accent-rgb), 0.45), 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.gp-marker.is-focus {
  z-index: 9;
}

.gp-marker.is-focus .gp-dot {
  transform: scale(1.7);
  box-shadow: 0 0 14px 4px rgba(var(--gp-accent-rgb), 0.65), 0 1px 4px rgba(0, 0, 0, 0.25);
}

.gp-marker.is-dim .gp-dot {
  opacity: 0.3;
}

.gp-marker-hq {
  z-index: 8;
  padding: 0;
  border: 0;
  background: none;
}

.gp-marker-hq .gp-dot {
  position: relative;
  box-shadow: 0 0 10px 2px rgba(var(--gp-accent-rgb), 0.6);
}

.gp-pulse {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--gp-accent);
  transform: translate(-50%, -50%);
  animation: gp-pulse 2.6s ease-out infinite;
}

.gp-pulse-late {
  animation-delay: 1.3s;
}

@keyframes gp-pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0.7;
  }
  70% {
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.6);
    opacity: 0;
  }
}

.gp-hq-label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2.5px 9px;
  border-radius: 6px;
  background: var(--gp-accent);
  font-family: var(--rs-ff-title);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.5;
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(var(--gp-accent-rgb), 0.4);
}

/* ---- Tooltip ------------------------------------------------------- */
.gp-tooltip {
  position: absolute;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--gp-line);
  box-shadow: 0 10px 30px rgba(15, 22, 35, 0.18);
  pointer-events: none;
}

.gp-tooltip[hidden] {
  display: none;
}

.gp-tooltip img {
  border-radius: 3px;
}

.gp-tooltip-name {
  display: block;
  font-family: var(--rs-ff-title);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--gp-ink);
  white-space: nowrap;
}

.gp-tooltip-sub {
  display: block;
  font-size: 11.5px;
  color: var(--gp-muted);
  white-space: nowrap;
}

.gp-tooltip-sub:empty {
  display: none;
}

/* ---- HQ offices popup --------------------------------------------- */
.gp-hq-modal {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gp-hq-modal[hidden] {
  display: none;
}

.gp-hq-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.gp-hq-modal-box {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

.gp-hq-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid #e8ecf2;
}

.gp-hq-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gp-hq-modal-title-wrap img {
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
}

.gp-hq-modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--gp-ink);
}

.gp-hq-modal-close {
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 18px;
  line-height: 1;
  color: var(--gp-muted);
  transition: background 0.15s ease;
}

.gp-hq-modal-close:hover {
  background: #f1f4f8;
}

.gp-hq-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
  overflow-y: auto;
}

.gp-office {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #e8ecf2;
  background: #fbfcfe;
}

.gp-office p {
  margin: 0;
}

.gp-office-name {
  font-family: var(--rs-ff-title);
  font-size: 13px;
  font-weight: 600;
  color: var(--gp-accent);
}

.gp-office-address {
  margin-top: 4px !important;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--gp-ink);
}

/* ---- Region list --------------------------------------------------- */
.gp-regions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gp-hq-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(var(--gp-accent-rgb), 0.09), rgba(var(--gp-accent-rgb), 0.02));
  border: 1.5px solid rgba(var(--gp-accent-rgb), 0.3);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.gp-hq-card.is-active,
.gp-hq-card:focus-visible {
  border-color: var(--gp-accent);
  box-shadow: 0 10px 26px -14px rgba(var(--gp-accent-rgb), 0.5);
  transform: translateX(-3px);
  outline: none;
}

.gp-hq-card img,
.gp-chip img {
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

.gp-hq-card img {
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.gp-hq-title {
  display: block;
  font-family: var(--rs-ff-title);
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--gp-accent);
}

.gp-hq-sub {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gp-muted);
}

.gp-region {
  padding: 12px 16px;
  border-radius: 16px;
  background: #fbfcfe;
  border: 1px solid #e8ecf2;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.gp-region.is-cycling {
  border-color: rgba(var(--gp-accent-rgb), 0.35);
  box-shadow: 0 0 0 3px rgba(var(--gp-accent-rgb), 0.08);
}

.gp-region.is-active,
.gp-region:focus-visible {
  background: rgba(var(--gp-accent-rgb), 0.05);
  border-color: rgba(var(--gp-accent-rgb), 0.45);
  box-shadow: 0 10px 26px -14px rgba(var(--gp-accent-rgb), 0.45);
  transform: translateX(-3px);
  outline: none;
}

.gp-region-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.gp-region-name {
  font-family: var(--rs-ff-title);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gp-ink);
  transition: color 0.2s ease;
}

.gp-region.is-active .gp-region-name {
  color: var(--gp-accent);
}

.gp-region-count {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--rs-ff-title);
  font-size: 11px;
  font-weight: 700;
  color: var(--gp-muted);
  background: #f1f4f8;
  transition: color 0.2s ease, background 0.2s ease;
}

.gp-region.is-active .gp-region-count,
.gp-region.is-cycling .gp-region-count {
  color: var(--gp-accent);
  background: rgba(var(--gp-accent-rgb), 0.1);
}

.gp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--gp-line);
  background: #fff;
  font-family: var(--rs-ff-title);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  color: #3a4756;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.gp-chip.is-active,
a.gp-chip:hover {
  border-color: rgba(var(--gp-accent-rgb), 0.5);
  background: rgba(var(--gp-accent-rgb), 0.07);
  color: var(--gp-accent);
}

/* ---- Responsive ---------------------------------------------------- */
@media (max-width: 991px) {
  .gp-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Let vertical swipes scroll the page; horizontal drags still spin the globe. */
  .gp-globe-stage {
    touch-action: pan-y;
  }
}

@media (max-width: 575px) {
  .gp-globe-stage {
    min-height: 320px;
  }

  .gp-drag-hint {
    top: 10px;
    right: 10px;
  }

  .gp-globe-fallback {
    font-size: 120px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gp-pulse {
    animation: none;
    opacity: 0;
  }

  .gp-region,
  .gp-hq-card,
  .gp-marker .gp-dot {
    transition: none;
  }
}
