/* =========================================================
   NOSSA PRESENÇA — Filiais
   ========================================================= */

.presence {
  background-color: #EEF3F8;
  padding-top: var(--space-20);
  padding-bottom: var(--space-12);
}

/* ---- Container ---- */

.presence__inner {
  width: min(1600px, 95vw);
  padding-inline: var(--space-8);
  margin-inline: auto;
}

/* ---- Cabeçalho ---- */

.presence__header {
  max-width: 560px;
  margin-bottom: var(--space-12);
}

.presence__title {
  font-family: var(--font-heading);
  font-size: clamp(var(--text-2xl), 3vw, var(--text-4xl));
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.1;
  margin-bottom: var(--space-2);
}

.presence__subtitle {
  display: block;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
  letter-spacing: 0.01em;
}

.presence__description {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.75;
}

/* ---- Grid de cards ---- */

.presence__cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  margin-bottom: var(--space-12);
}

/* ---- Card individual ---- */

.presence__card {
  background-color: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.presence__card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.presence__card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background-color: rgba(183, 4, 44, 0.10);
  color: var(--color-primary);
  margin-bottom: var(--space-2);
  flex-shrink: 0;
}

.presence__card-title {
  font-family: var(--font-base);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.3;
}

.presence__card-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.presence__card-desc {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.7;
  flex: 1;
}

.presence__card-address {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  font-style: italic;
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: 1px solid #e5eaf0;
}

.presence__card-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  margin-top: var(--space-1);
  transition: gap var(--transition-fast), opacity var(--transition-fast);
}

.presence__card-link:hover {
  opacity: 0.8;
  gap: var(--space-2);
}

/* ---- Mapa-múndi ---- */

.presence__map-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #c8e0ef;
  min-height: 300px;
}

#world-map {
  width: 100%;
  position: relative;
  cursor: grab;
}

#world-map:active {
  cursor: grabbing;
}

/* Overlay para os botões de bandeira */
.world-map__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Paths dos países — hover com scale no centróide visual */
.land {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 180ms ease;
}

.land.is-hovered {
  transform: scale(1.08);
}

/* Botão circular — div com overflow:hidden, sombra na div, imagem preenche tudo */
.world-map__flag-btn {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 160ms ease;
  z-index: 2;
}

.world-map__flag-btn:hover {
  transform: translate(-50%, -50%) scale(1.7);
  z-index: 10;
}

.world-map__flag-btn img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Máscara circular: esconde o fundo branco retangular do WebP.
     Pode ser removido quando as imagens forem exportadas com alpha. */
  clip-path: circle(50% at 50% 50%);
  image-rendering: -webkit-optimize-contrast;
  filter:
    drop-shadow(0 6px 8px rgba(0, 0, 0, 0.32))
    drop-shadow(0 2px 3px rgba(0, 0, 0, 0.20));
  transition: filter 160ms ease;
}

.world-map__flag-btn:hover img {
  filter:
    drop-shadow(0 12px 14px rgba(0, 0, 0, 0.36))
    drop-shadow(0 4px 6px  rgba(0, 0, 0, 0.24));
}

/* Tooltip customizado */
.world-map__tooltip {
  position: absolute;
  pointer-events: none;
  display: none;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  border-radius: 8px;
  padding: 6px 10px 6px 7px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.18),
    0 1px 4px rgba(0, 0, 0, 0.10);
  font-family: var(--font-base);
  font-size: 0.75rem;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 14px));
  z-index: 30;
}

/* Pequena seta apontando para baixo */
.world-map__tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #ffffff;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.08));
}

.world-map__tooltip-flag {
  width: 44px;
  height: auto;
  border-radius: 2px;
  display: block;
  flex-shrink: 0;
}

.world-map__tooltip-name {
  color: #1a1a1a;
}

/* Card de informação — ancorado ao país clicado */
.world-map__info-card {
  position: absolute;
  /* Posicionado acima do botão-bandeira (52px), com folga para a seta */
  transform: translate(-50%, calc(-100% - 60px));
  background: #ffffff;
  border-radius: 12px;
  padding: 14px 36px 14px 16px;
  min-width: 200px;
  max-width: min(300px, 80vw);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.20),
    0 2px 6px rgba(0, 0, 0, 0.12);
  font-family: var(--font-base);
  z-index: 25;
  animation: world-map__info-card-in 180ms ease-out;
}

@keyframes world-map__info-card-in {
  from { opacity: 0; transform: translate(-50%, calc(-100% - 50px)); }
  to   { opacity: 1; transform: translate(-50%, calc(-100% - 60px)); }
}

/* Seta apontando para baixo (o país) */
.world-map__info-card::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: #ffffff;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.10));
}

.world-map__info-card-close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease;
}

.world-map__info-card-close:hover {
  background: #f0f0f0;
  color: #1a1a1a;
}

.world-map__info-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.world-map__info-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0;
  line-height: 1.2;
}

.world-map__info-card-text {
  font-size: 0.8125rem;
  color: var(--color-text);
  line-height: 1.55;
  margin: 0;
}

.world-map__info-card-text:empty {
  display: none;
}

/* Controles de zoom: +, −, reset */
.world-map__zoom-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 20;
}

.world-map__zoom-btn {
  width: 32px;
  height: 32px;
  background: #ffffff;
  border: none;
  border-radius: 6px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.20),
    0 1px 2px rgba(0, 0, 0, 0.12);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, box-shadow 120ms ease, transform 100ms ease;
}

.world-map__zoom-btn:hover {
  background: #f4f4f4;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.24),
    0 1px 3px rgba(0, 0, 0, 0.14);
}

.world-map__zoom-btn:active {
  background: #e8e8e8;
  transform: scale(0.93);
}

/* Separador entre zoom e reset */
.world-map__zoom-sep {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 1px 2px;
}

/* =========================================================
   RESPONSIVO
   ========================================================= */

@media (max-width: 960px) {
  .presence__cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .presence__inner {
    padding-inline: var(--space-6);
  }

  .presence__cards {
    grid-template-columns: 1fr;
  }

  .world-map__flag-btn {
    width: 38px;
    height: 38px;
  }

  .world-map__flag-img {
    width: 22px;
  }

  .world-map__zoom-btn {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }

  .world-map__info-card {
    min-width: 170px;
    max-width: min(250px, 88vw);
    padding: 12px 32px 12px 14px;
  }
}
