/* ==========================================================================
   Members map — Figma "Bloc — Interactive Map" 130:637 (template-parts/members-map.php)
   Stat cards 130:639 · continent filters 130:656 · map card 130:674 · members by country 130:717
   ========================================================================== */

.members-map {
  /* Marker fills from the Figma marker assets (174:659…) */
  --mm-red: rgba(255, 49, 49, 0.9);
  --mm-red-solid: #ff3131;
  --mm-blue: rgba(98, 117, 242, 0.9);
  --mm-blue-solid: #6275f2;
}
.members-map .section-head { margin-bottom: 32px; }

/* Continent dots */
.mm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--sage-700); }
.mm-dot--africa { background: var(--green-600); }
.mm-dot--europe { background: var(--amber-500); }
.mm-dot--asia { background: var(--sage-500); }
.mm-dot--americas { background: var(--sage-700); }
.mm-dot--oceania { background: var(--olive-700); }

/* Stat cards */
.mm-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-bottom: 32px; }
.mm-stat {
  display: flex; flex-direction: column; gap: var(--spacing-sm);
  background: #fff; border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-small);
}
.mm-stat__value {
  font-family: var(--font-display); font-variation-settings: "SOFT" 0, "WONK" 1; font-weight: 700;
  font-size: 44px; line-height: 46px; color: var(--navy-900); white-space: nowrap;
}
.mm-stat__value--date { font-size: 28px; }
.mm-stat .label { color: var(--color-text-body); }

/* Toolbar */
.mm-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 32px; }
.mm-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.mm-filters .filter { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

/* Layout: map card + table */
.mm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; height: 560px; }

.mm-card {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
  padding: 26px; border-radius: var(--radius-xl); background: var(--navy-950); box-shadow: var(--shadow-medium);
}
.mm-frame { --mm-scale: 1; position: relative; width: 100%; max-width: 792px; aspect-ratio: 791.878 / 391.485; }
.mm-world { width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.mm-markers { position: absolute; inset: 0; }

.mm-marker {
  position: absolute; z-index: 1; padding: 0; margin: 0;
  width: calc(var(--r, 6) * 2px * var(--mm-scale)); height: calc(var(--r, 6) * 2px * var(--mm-scale));
  border-radius: 50%; border: 2px solid #fff; background: var(--mm-blue);
  transform: translate(-50%, -50%); transition: transform .15s ease, box-shadow .15s ease;
}
.mm-marker--sm { border-width: 1.5px; }
.mm-marker--org { background: var(--mm-red); }
.mm-marker:hover, .mm-marker:focus-visible { z-index: 2; transform: translate(-50%, -50%) scale(1.12); }
.mm-marker:focus-visible { outline: 2px solid var(--sage-500); outline-offset: 2px; }
.mm-marker.is-active { z-index: 3; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35); }

.mm-popup {
  position: absolute; z-index: 4; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; white-space: nowrap;
  padding: 14px 16px; border-radius: 10px; background: #fff; box-shadow: var(--shadow-medium);
  transform: translate(calc(-100% - var(--r, 6) * var(--mm-scale) * 1px - 8px), -50%);
}
.mm-popup--right { transform: translate(calc(var(--r, 6) * var(--mm-scale) * 1px + 8px), -50%); }
.mm-popup__continent { font-family: var(--font-mono); font-weight: 500; font-size: 11px; line-height: 18px; letter-spacing: 1px; text-transform: uppercase; color: var(--color-text-muted); }
.mm-popup__country { font-family: var(--font-display); font-variation-settings: "SOFT" 0, "WONK" 1; font-weight: 600; font-size: 17px; line-height: 24px; color: var(--navy-900); }
.mm-popup__members { font-size: 15px; line-height: 22px; color: var(--color-text-body); }
.mm-popup__orgs { font-size: 13px; line-height: 18px; color: var(--green-700); }

.mm-legend {
  position: absolute; left: 20px; bottom: 12px; z-index: 5;
  display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.92);
  font-family: var(--font-mono); font-weight: 500; font-size: 11px; line-height: 18px; letter-spacing: 1px; text-transform: uppercase; color: var(--color-text-muted);
}
.mm-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.mm-legend__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mm-blue-solid); }
.mm-legend__dot--org { background: var(--mm-red-solid); }

/* Members by country */
.mm-panel {
  display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow: hidden;
  padding: 24px; border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-small);
}
.mm-panel__head { display: flex; flex-direction: column; gap: 4px; }
.mm-table-wrap {
  position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--navy-900) rgba(0, 0, 0, 0.06);
}
.mm-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mm-table th {
  position: sticky; top: 0; z-index: 1; background: #fff; text-align: left;
  padding: 8px 8px 10px; border-bottom: 1px solid var(--color-border-default);
  font-family: var(--font-mono); font-weight: 500; font-size: 11px; line-height: 18px; letter-spacing: 1px; text-transform: uppercase; color: var(--color-text-muted);
}
.mm-table th:first-child { width: 118px; }
.mm-table th:last-child { width: 84px; }
.mm-table td { padding: 10px 8px; border-bottom: 1px solid var(--color-border-default); font-size: 14px; line-height: 22px; color: var(--color-text-body); vertical-align: middle; }
.mm-table td:first-child { white-space: nowrap; }
.mm-table td .mm-dot { margin-right: 8px; vertical-align: 1px; }
.mm-table .mm-num { text-align: right; }
.mm-table td.mm-num { font-family: var(--font-mono); font-weight: 500; font-size: 13px; line-height: 18px; letter-spacing: 1px; color: var(--navy-900); }
.mm-table tbody tr { position: relative; cursor: pointer; transition: background .15s; }
.mm-table tbody tr:hover { background: var(--color-bg-soft); }
.mm-table tbody tr.is-active { background: rgba(62, 155, 92, 0.12); box-shadow: inset 3px 0 0 var(--green-600); }
.mm-row-btn {
  padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.mm-row-btn::after { content: ""; position: absolute; inset: 0; }
.mm-row-btn:focus-visible { outline: 0; }
.mm-row-btn:focus-visible::after { outline: 2px solid var(--green-600); outline-offset: -2px; border-radius: 4px; }

/* Responsive */
@media (max-width: 1200px) {
  .mm-layout { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 1024px) {
  .mm-layout { grid-template-columns: 1fr; height: auto; }
  .mm-card { padding: 32px 20px 72px; }
  .mm-table-wrap { flex: none; max-height: 430px; }
}
@media (max-width: 900px) {
  .mm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
@media (max-width: 640px) {
  .members-map.section { padding: 48px 24px; }
  .mm-stat { padding: 20px; }
  .mm-stat__value { font-size: 34px; line-height: 40px; }
  .mm-stat__value--date { font-size: 20px; line-height: 40px; white-space: normal; }
  .mm-toolbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .mm-filters { flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 48px); margin: 0 -24px; padding: 2px 24px 6px; scrollbar-width: none; }
  .mm-filters::-webkit-scrollbar { display: none; }
  .mm-filters .filter { flex-shrink: 0; }
  .mm-card { padding: 24px 10px 96px; border-radius: var(--radius-lg); }
  .mm-legend { left: 12px; right: 12px; flex-direction: column; gap: 4px; border-radius: var(--radius-lg); }
  .mm-popup { padding: 10px 12px; }
  .mm-popup__country { font-size: 15px; line-height: 20px; }
  .mm-popup__members { font-size: 13px; line-height: 18px; }
  .mm-panel { padding: 20px 16px; }
  .mm-table th:first-child { width: 104px; }
  .mm-table th:last-child { width: 76px; }
}
