/* =========================================================
   Impact map (homepage)
   ========================================================= */
.impact-section .collage-head p { max-width: 56ch; margin: 0 auto; }

.impact-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  background: #fff;
  border: 1px solid rgba(2, 6, 23, .10);
  border-radius: 26px;
  box-shadow: 0 30px 70px rgba(127, 29, 29, .12), 0 6px 18px rgba(2, 6, 23, .05);
  overflow: hidden;
}

/* ---------- Map stage ---------- */
.im-stage {
  position: relative;
  min-height: 600px;
  background: #f4f1ee;
}
.im-canvas {
  position: absolute;
  inset: 0;
  background: #f4f1ee;
  font: inherit;
}
.im-canvas:focus-visible { outline: 3px solid rgba(220, 38, 38, .5); outline-offset: -3px; }

/* Soft vignette so the map melts into the card */
.im-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 401;
  box-shadow: inset 0 0 80px rgba(127, 29, 29, .10);
}

/* View toggle */
.im-toggle {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 500;
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(2, 6, 23, .10);
  box-shadow: 0 8px 24px rgba(2, 6, 23, .10);
}
.im-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--muted, #475569);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .2s ease, color .2s ease;
}
.im-toggle button svg { width: 15px; height: 15px; }
.im-toggle button:hover { color: var(--text, #0f172a); }
.im-toggle button[aria-pressed="true"] {
  background: var(--red, #dc2626);
  color: #fff;
  box-shadow: 0 6px 16px rgba(220, 38, 38, .35);
}
.im-toggle button:focus-visible { outline: 3px solid rgba(220, 38, 38, .45); outline-offset: 2px; }

/* Legend */
.im-legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  max-width: calc(100% - 90px);
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(2, 6, 23, .08);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted, #475569);
}
.im-legend span { display: inline-flex; align-items: center; gap: 7px; }
.im-legend i { display: inline-block; flex: none; }
.lg-hq { width: 14px; height: 14px; border-radius: 50%; background: var(--red, #dc2626); box-shadow: 0 0 0 3px rgba(220, 38, 38, .25); }
.lg-site { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2.5px solid var(--red, #dc2626); }
.lg-country { width: 16px; height: 11px; border-radius: 3px; background: rgba(220, 38, 38, .35); border: 1.5px solid var(--red, #dc2626); }
.lg-zone { width: 16px; height: 11px; border-radius: 3px; background: rgba(220, 38, 38, .10); border: 1.5px dashed var(--red, #dc2626); }

/* Scroll hint */
.im-hint {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 500;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .78);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
  transition: opacity .3s ease;
}
.im-hint.is-hidden { opacity: 0; }

/* ---------- Side panel ---------- */
.im-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 600px;
  border-left: 1px solid rgba(2, 6, 23, .08);
  background: linear-gradient(180deg, #fff, #fff8f8);
}
.im-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(2, 6, 23, .07);
}
.im-stat {
  text-align: center;
  padding: 10px 4px;
  border-radius: 14px;
  background: rgba(220, 38, 38, .06);
}
.im-stat b {
  display: block;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -.02em;
  color: var(--red2, #b91c1c);
  font-variant-numeric: tabular-nums;
}
.im-stat small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted2, #64748b);
}

.im-scroll {
  overflow-y: auto;
  padding: 6px 10px 16px;
  scrollbar-width: thin;
}
.im-group {
  margin: 14px 8px 6px;
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted2, #64748b);
}
.im-list { list-style: none; margin: 0; padding: 0; }
.im-item {
  appearance: none;
  width: 100%;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
  text-align: left;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 9px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.im-item:hover { background: rgba(220, 38, 38, .06); }
.im-item:focus-visible { outline: 3px solid rgba(220, 38, 38, .4); outline-offset: 0; }
.im-item.is-active { background: rgba(220, 38, 38, .10); }
.im-item .num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  color: var(--red2, #b91c1c);
  background: #fff;
  border: 2px solid var(--red, #dc2626);
  margin-top: 1px;
}
.im-item .num.flag { border-color: transparent; background: rgba(220, 38, 38, .12); font-size: 14px; }
.im-item strong { display: block; font-size: 14.5px; line-height: 1.3; }
.im-item span.addr { display: block; font-size: 12.5px; line-height: 1.4; color: var(--muted2, #64748b); margin-top: 2px; }

/* ---------- Markers ---------- */
.aa-pin { display: grid; place-items: center; border-radius: 50%; font-family: inherit; }
.aa-pin--site {
  width: 28px;
  height: 28px;
  background: #fff;
  border: 2.5px solid #dc2626;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 6px 14px rgba(127, 29, 29, .28);
  transition: transform .2s ease, background .2s ease, color .2s ease;
}
.leaflet-marker-icon:hover .aa-pin--site,
.aa-pin--site.is-active { transform: scale(1.18); background: #dc2626; color: #fff; }

.aa-pin--hq {
  position: relative;
  width: 34px;
  height: 34px;
  background: #dc2626;
  border: 3px solid #fff;
  box-shadow: 0 8px 20px rgba(220, 38, 38, .45);
}
.aa-pin--hq svg { width: 16px; height: 16px; }

.aa-pin--country {
  position: relative;
  width: 18px;
  height: 18px;
  background: #dc2626;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, .5);
}
.aa-pin--hq::before,
.aa-pin--hq::after,
.aa-pin--country::before,
.aa-pin--country::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(220, 38, 38, .55);
  animation: aa-pulse 2.4s cubic-bezier(.16, 1, .3, 1) infinite;
}
.aa-pin--hq::after,
.aa-pin--country::after { animation-delay: 1.2s; }
@keyframes aa-pulse {
  0% { transform: scale(1); opacity: .9; }
  100% { transform: scale(3.2); opacity: 0; }
}

/* Partner logo markers */
.aa-pin--logo {
  width: 40px;
  height: 40px;
  padding: 0;
  overflow: hidden;
  border: 3px solid #dc2626;
  background: #fff;
  box-shadow: 0 0 0 2px #fff, 0 8px 18px rgba(127, 29, 29, .32);
}
/* Leaflet forces marker images to width:auto, so size them explicitly */
.leaflet-container .aa-pin--logo img { width: 100% !important; height: 100% !important; max-width: 100% !important; max-height: 100% !important; object-fit: cover; border-radius: 50%; display: block; }
.leaflet-marker-icon:hover .aa-pin--logo,
.aa-pin--logo.is-active { background: #fff; transform: scale(1.22); box-shadow: 0 0 0 3px #fff, 0 0 0 7px rgba(220, 38, 38, .35), 0 10px 22px rgba(127, 29, 29, .35); }

.im-item .num.logo { overflow: hidden; padding: 0; border-width: 2px; }
.im-item .num.logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

.aa-pop .pop-logo { float: right; width: 44px; height: 44px; border-radius: 50%; object-fit: cover; margin: 14px 2px 6px 10px; border: 2px solid rgba(220, 38, 38, .25); }

/* Country name labels */
.aa-label {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #7f1d1d;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 6px #fff;
}
.aa-label::before { display: none; }

/* ---------- Vector layers ---------- */
.aa-country { transition: fill-opacity .25s ease; cursor: pointer; }
.aa-arc {
  stroke-dasharray: 2 9;
  stroke-linecap: round;
  animation: aa-flow 1.1s linear infinite;
}
@keyframes aa-flow { to { stroke-dashoffset: -11; } }
.aa-zone { animation: aa-zone 3.6s ease-in-out infinite; }
@keyframes aa-zone {
  0%, 100% { fill-opacity: .10; }
  50% { fill-opacity: .17; }
}

/* ---------- Popups ---------- */
.impact-map .leaflet-popup-content-wrapper {
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(2, 6, 23, .18);
  padding: 0;
}
.impact-map .leaflet-popup-content { margin: 14px 16px 14px; min-width: 210px; font: inherit; line-height: 1.45; }
.impact-map .leaflet-popup-close-button { top: 6px !important; right: 6px !important; color: #94a3b8 !important; }
.aa-pop .tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #b91c1c;
  background: rgba(220, 38, 38, .09);
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.aa-pop h4 { margin: 0 0 3px; font-size: 15.5px; line-height: 1.3; color: #0f172a; }
.aa-pop p { margin: 0; font-size: 13px; color: #64748b; }
.aa-pop a {
  display: inline-block;
  margin-top: 9px;
  font-size: 13px;
  font-weight: 800;
  color: #b91c1c !important;
  text-decoration: none;
}
.aa-pop a:hover { text-decoration: underline; }

.impact-map .leaflet-control-zoom {
  border: 1px solid rgba(2, 6, 23, .10) !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(2, 6, 23, .10) !important;
}
.impact-map .leaflet-control-zoom a { color: #0f172a; width: 34px; height: 34px; line-height: 32px; }
.impact-map .leaflet-control-attribution { font-size: 10px; background: rgba(255, 255, 255, .75); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .impact-map { grid-template-columns: 1fr; }
  .im-stage { min-height: 460px; }
  .im-panel { border-left: 0; border-top: 1px solid rgba(2, 6, 23, .08); max-height: none; }
  .im-scroll { max-height: 380px; }
}
@media (max-width: 560px) {
  .impact-map { border-radius: 20px; }
  .im-stage { min-height: 400px; }
  .im-toggle { top: 12px; left: 12px; }
  .im-toggle button { padding: 7px 11px; font-size: 12.5px; }
  .im-toggle button svg { display: none; }
  .im-legend { left: 10px; bottom: 10px; font-size: 11.5px; gap: 4px 10px; padding: 8px 10px; }
  .im-hint { display: none; }
  .im-stat b { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .aa-arc, .aa-zone,
  .aa-pin--hq::before, .aa-pin--hq::after,
  .aa-pin--country::before, .aa-pin--country::after { animation: none; }
}
