:root {
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --page-bg: transparent;
  --card-bg: #0b2450;
  --ocean: #0b2450;
  --country: #173768;
  --country-border: #21467f;
  --country-active: #436bff;
  --country-hover: #5a7eff;
  --country-selected: #32d7bd;
  --panel-bg: #102d61;
  --button-bg: #1a3d78;
  --button-hover: #244a8c;
  --text: #f7f9ff;
  --muted: #b9c7e5;
  --marker: #ffffff;
  --marker-core: #32d7bd;
  --focus: #ffffff;
  --shadow: 0 24px 70px rgba(1, 13, 42, .28);
  --radius: 22px;
}

body.theme-light {
  --card-bg: #f9fbff;
  --ocean: #f9fbff;
  --country: #d9dde5;
  --country-border: #ffffff;
  --country-active: #0f3f84;
  --country-hover: #174f9e;
  --country-selected: #00a99d;
  --panel-bg: #ffffff;
  --button-bg: #f1f4f9;
  --button-hover: #e6ecf5;
  --text: #1d2939;
  --muted: #667085;
  --marker: #ffffff;
  --marker-core: #00a99d;
  --focus: #0f3f84;
  --shadow: 0 18px 55px rgba(15, 35, 70, .12);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
button, a { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.map-app { width: 100%; padding: 12px; }
.map-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  width: min(1400px, 100%);
  min-height: 690px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.map-stage { min-width: 0; padding: 18px; }
.map-canvas {
  position: relative;
  width: 100%;
  min-height: 650px;
  overflow: hidden;
  border-radius: calc(var(--radius) - 8px);
  background: var(--ocean);
}
.region-map { display: block; width: 100%; height: 650px; touch-action: pan-y; user-select: none; }
.map-ocean { fill: var(--ocean); }
.country {
  fill: var(--country);
  stroke: var(--country-border);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  transition: fill .22s ease, opacity .22s ease;
  outline: none;
}

.country.is-active {
  fill: var(--country-active);
  cursor: pointer;
}

.country.is-active:hover,
.country.is-active:focus {
  fill: var(--country-hover);
}

/* País seleccionado */
.country.is-selected,
.country.is-active.is-selected,
.country.is-active.is-selected:hover,
.country.is-active.is-selected:focus {
  fill: var(--country-selected);
}

.country.is-dimmed {
  opacity: .48;
}

.marker { cursor: pointer; }
.marker.is-hidden { display: none; }
.marker__pulse {
  fill: var(--marker-core);
  opacity: .34;
  transform-box: fill-box;
  transform-origin: center;
  animation: marker-pulse 2s ease-out infinite;
}
.marker__ring { fill: var(--marker); }
.marker__core { fill: var(--marker-core); }
.marker:focus { outline: none; }
.marker:focus .marker__ring { stroke: var(--focus); stroke-width: 4; }
@keyframes marker-pulse {
  0% { transform: scale(.72); opacity: .48; }
  75%, 100% { transform: scale(1.7); opacity: 0; }
}

.map-controls {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 4;
  display: grid;
  gap: 8px;
}
.map-control {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  color: #15315f;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 7px 20px rgba(1,13,42,.18);
}
.map-control:hover { transform: translateY(-1px); }
.map-control:focus-visible,
.reset-map:focus-visible,
.country-button:focus-visible,
.branch-card__close:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.reset-map {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: #15315f;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 7px 20px rgba(1,13,42,.18);
  transition: opacity .2s ease, transform .2s ease;
}
.reset-map.is-hidden { opacity: 0; pointer-events: none; transform: translateY(8px); }

.country-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 34px 26px;
  background: var(--panel-bg);
}
.map-heading h1 { margin: 0 0 10px; font-size: clamp(1.7rem, 3vw, 2.35rem); line-height: 1.05; }
.map-heading p { margin: 0; color: var(--muted); line-height: 1.55; }
.eyebrow {
  margin-bottom: 8px !important;
  color: var(--country-selected) !important;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.map-heading--mobile { display: none; }
.country-list { display: grid; gap: 10px; }
.country-button {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 8px 13px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  background: var(--button-bg);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease, border-color .2s ease;
}
.country-button:hover { background: var(--button-hover); transform: translateX(-2px); }
.country-button.is-selected {
  background: var(--button-hover);
  background: color-mix(in srgb, var(--country-selected) 24%, var(--button-bg));
  border-color: var(--country-selected);
}
.country-button__flag {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 50%;
  background: rgba(255,255,255,.96);
  font-size: 29px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.country-button__name { min-width: 0; font-weight: 700; line-height: 1.15; }
.country-button__count { color: var(--muted); font-size: .77rem; white-space: nowrap; }

.branch-card {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  width: min(330px, calc(100% - 36px));
  padding: 20px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px;
  background: rgba(7,27,65,.94);
  color: #fff;
  box-shadow: 0 18px 42px rgba(0,0,0,.25);
  backdrop-filter: blur(12px);
}
body.theme-light .branch-card { background: rgba(255,255,255,.96); color: #1d2939; border-color: rgba(15,63,132,.15); }
.branch-card__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 25px;
  cursor: pointer;
}
.branch-card__country { color: var(--country-selected); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.branch-card h2 { margin: 7px 28px 7px 0; font-size: 1.15rem; }
.branch-card p { margin: 0 0 14px; color: var(--muted); line-height: 1.4; }
.branch-card a { color: var(--country-selected); font-weight: 800; text-decoration: none; }
.branch-card a:hover { text-decoration: underline; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 940px) {
  .map-card { grid-template-columns: 1fr; min-height: 0; }
  .map-stage { padding-bottom: 10px; }
  .map-heading--desktop { display: none; }
  .map-heading--mobile { display: block; padding: 10px 8px 22px; }
  .country-panel { padding: 18px 26px 28px; }
  .country-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .region-map, .map-canvas { min-height: 590px; height: 590px; }
}
@media (max-width: 600px) {
  .map-app { padding: 0; }
  .map-card { border-radius: 0; }
  .map-stage { padding: 12px; }
  .map-canvas { border-radius: 14px; }
  .country-panel { padding: 16px 12px 24px; }
  .country-list { grid-template-columns: 1fr; }
  .region-map, .map-canvas { min-height: 340px; height: 340px; }
  .country-button:hover { transform: none; }
  .branch-card { left: 12px; right: 12px; bottom: 64px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ==========================================================
   MODO FULL BLEED
   Elimina el espacio exterior para ocupar todo el iframe.
   ========================================================== */

html {
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
}

body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background: var(--card-bg);
}

.map-app {
    width: 100%;
    min-height: 100vh;
    padding: 0;
}

.map-card {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

@media (max-width: 940px) {
    .map-card {
        min-height: 100vh;
    }
}
    
/* =========================================================
   MOBILE - ZOOM ÚNICAMENTE EN VISTA GENERAL
   ========================================================= */

@media (max-width: 767px) {

    .map-canvas {
        position: relative;
        overflow: hidden;
    }

    .region-map {
        width: 100%;
        height: 100%;
        transform: none;
        transform-origin: center center;
    }

    .region-map.is-mobile-overview {
        transform: translate(-30%, -25%) scale(2.2);
        transform-origin: center center;
    }
}

@media (max-width: 767px) {

  .map-controls {
    top: 18px;
    right: 14px;
    transition: top .3s ease;
  }

  .map-canvas:has(.region-map.is-mobile-overview) .map-controls {
    top: 120px;
  }
}