/* =========================================================
   map-skin.css - PIEL ÚNICA DE LOS MAPAS DE VENAVIAJERA
   ---------------------------------------------------------
   Hasta ahora cada página pintaba su propio mapa: pais.php y
   atlas-clandestino.php usaban marcadores .pp-marker de 13px
   con popup de cristal, y guia.php uno propio (.tactical-dot)
   con popup opaco de borde naranja. Eran el mismo mapa con dos
   caras distintas.

   Este archivo es la fuente única de esa piel. Todo cuelga de
   `.vv-map`, la clase que se pone en el contenedor del mapa,
   así que se puede cargar en cualquier página sin tocar nada
   más. pais.css y atlas-clandestino.css pueden migrar aquí
   borrando sus bloques equivalentes.
   ========================================================= */

.vv-map {
    /* — Cristal (calcado de los tokens --g-* de pais.css) —
       La clave es el brightness() del backdrop-filter: en vez de
       tapar el mapa con un panel opaco, se OSCURECE lo que hay
       detrás y encima se pinta un tinte muy ligero. Se sigue
       viendo el mapa a través y el texto gana contraste. */
    --vvm-tint:   rgba(12, 15, 19, 0.46);
    --vvm-line:   rgba(255, 255, 255, 0.20);
    --vvm-blur:   blur(26px) saturate(190%) brightness(0.50);
    --vvm-ink:    #F4F6F9;
    --vvm-ink-dim: rgba(244, 246, 249, 0.68);
    --vvm-shadow: 0 2px 6px -2px rgba(0, 0, 0, .55),
                  0 12px 28px -12px rgba(0, 0, 0, .70),
                  0 32px 64px -28px rgba(0, 0, 0, .85);
    /* Bisel: luz arriba, sombra abajo. Es lo que da el grosor del vidrio. */
    --vvm-bevel:  inset 0 1px 0 rgba(255, 255, 255, .22),
                  inset 0 -1px 0 rgba(0, 0, 0, .38),
                  inset 1px 0 0 rgba(255, 255, 255, .07),
                  inset -1px 0 0 rgba(0, 0, 0, .22);
    /* Borde con degradado (se pinta con el truco de la máscara, más abajo) */
    --vvm-edge:   linear-gradient(145deg,
                      rgba(255,255,255,.42) 0%,
                      rgba(255,255,255,.10) 26%,
                      rgba(255,255,255,.02) 52%,
                      rgba(255,255,255,.16) 100%);
    --vvm-radius: 12px;
    --vvm-pad:    clamp(12px, 1.6vw, 20px);
    --vvm-ease:   cubic-bezier(.22, .61, .36, 1);
    --vvm-accent: var(--color-primary, #FF5E14);
    /* Naranja de marca para TEXTO pequeño sobre cristal: da 5,2:1 en oscuro. */
    --vvm-accent-text: var(--color-primary, #FF5E14);
}

body.light-theme .vv-map {
    --vvm-tint:   rgba(255, 255, 255, 0.58);
    --vvm-line:   rgba(15, 23, 42, 0.16);
    --vvm-blur:   blur(26px) saturate(180%) brightness(1.52);
    --vvm-ink:    #0C1116;
    --vvm-ink-dim: #4E5964;
    --vvm-shadow: 0 2px 6px -2px rgba(15, 23, 42, .10),
                  0 12px 28px -14px rgba(15, 23, 42, .22),
                  0 32px 64px -30px rgba(15, 23, 42, .28);
    --vvm-bevel:  inset 0 1px 0 rgba(255, 255, 255, .95),
                  inset 0 -1px 0 rgba(15, 23, 42, .09),
                  inset 1px 0 0 rgba(255, 255, 255, .55),
                  inset -1px 0 0 rgba(15, 23, 42, .05);
    --vvm-edge:   linear-gradient(145deg,
                      rgba(255,255,255,.95) 0%,
                      rgba(255,255,255,.35) 28%,
                      rgba(15,23,42,.05) 55%,
                      rgba(15,23,42,.12) 100%);
    /* El naranja de marca solo da 3,1:1 sobre cristal claro: se oscurece a 6,4:1 */
    --vvm-accent-text: #A83A08;
}

/* ---------------------------------------------------------
   1. MARCADORES
   Un solo nodo por punto: el degradado va en su fondo y los
   anillos de pulso son pseudoelementos. Menos DOM = mapa más
   fluido cuando hay muchos puntos.
   --mk color base · --mk2 variante clara · --d desfase del pulso
   --------------------------------------------------------- */
.vv-map .custom-div-icon {
    background: transparent !important;
    border: none !important;
    overflow: visible !important;   /* El pulso se expande fuera del iconSize */
}

.vv-map .pp-marker {
    position: relative;
    display: block;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%,
                var(--mk2, #FFA04D) 0%,
                var(--mk, #FF5E14) 72%);
    border: 2px solid rgba(255, 255, 255, .88);
    box-shadow: 0 0 0 1px rgba(255, 94, 20, .55),
                0 2px 7px rgba(0, 0, 0, .5);
    transition: transform .18s var(--vvm-ease);
}

.vv-map .pp-marker::before,
.vv-map .pp-marker::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid var(--mk, #FF5E14);
    opacity: .5;
    animation: pp-ping 2.6s var(--d, 0s) ease-out infinite;
}
/* El segundo anillo solo en el punto activo: pulso doble y más marcado */
.vv-map .pp-marker::after { display: none; }

.vv-map .leaflet-marker-icon:hover .pp-marker { transform: scale(1.35); }
.vv-map .pp-marker.is-active { transform: scale(1.55); z-index: 2; }
.vv-map .pp-marker.is-active::before,
.vv-map .pp-marker.is-active::after {
    display: block;
    border-width: 1.5px;
    animation-duration: 1.6s;
}
.vv-map .pp-marker.is-active::after { animation-delay: calc(var(--d, 0s) + .8s); }

@keyframes pp-ping {
    0%   { transform: scale(.5);  opacity: .6; }
    70%  { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(1.6); opacity: 0; }
}

body.light-theme .vv-map .pp-marker {
    border-color: rgba(255, 255, 255, .98);
    box-shadow: 0 0 0 1px rgba(255, 94, 20, .65),
                0 2px 7px rgba(15, 23, 42, .35);
}

/* Mientras el mapa hace zoom o se arrastra ya está recolocando todos los
   marcadores: pausar los pulsos ahí evita tirones en móvil. */
.vv-map.leaflet-zoom-anim .pp-marker::before,
.vv-map.leaflet-zoom-anim .pp-marker::after,
.vv-map.leaflet-dragging .pp-marker::before,
.vv-map.leaflet-dragging .pp-marker::after { animation-play-state: paused; }

/* ---------------------------------------------------------
   2. POPUP (TARJETA DE CRISTAL)
   core.css fuerza fondo opaco y borde naranja con !important,
   de ahí que aquí también haga falta.
   --------------------------------------------------------- */
.vv-map .leaflet-popup-content-wrapper {
    background: var(--vvm-tint) !important;
    -webkit-backdrop-filter: var(--vvm-blur);
    backdrop-filter: var(--vvm-blur);
    color: var(--vvm-ink) !important;
    border: 1px solid var(--vvm-line) !important;
    border-radius: var(--vvm-radius) !important;
    padding: 0;
    overflow: hidden;
    box-shadow: var(--vvm-shadow);
}
.vv-map .leaflet-popup-tip {
    background: var(--vvm-tint) !important;
    border: 1px solid var(--vvm-line) !important;
    box-shadow: none;
}
.vv-map .leaflet-popup-content {
    margin: 0 !important;
    width: 280px !important;
    font-family: var(--font-body) !important;
    font-size: 0.9rem !important;
    line-height: 1.5;
}
.vv-map .leaflet-container a.leaflet-popup-close-button {
    color: var(--vvm-ink-dim) !important;
    font-size: 22px !important;
    top: 6px;
    right: 7px;
    z-index: 20;
}

/* --- Tarjeta interna --- */
.vv-map .tactical-card { display: flex; flex-direction: column; }

/* Proporción fija: el hueco está reservado antes de que llegue la imagen,
   así que el popup no da un salto al cargarla. */
.vv-map .card-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: rgba(255, 94, 20, 0.12);
}
.vv-map .card-cover img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    filter: saturate(.92) contrast(1.04);
}
/* Velo oscuro, no un degradado hacia la superficie: el popup ya no tiene
   fondo opaco al que fundir. */
.vv-map .card-cover::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(6, 8, 11, .55), transparent 55%);
}

.vv-map .card-mission-tag {
    position: absolute; top: 9px; left: 9px; z-index: 2;
    display: inline-flex; align-items: center;
    height: 20px; padding: 0 9px;
    border-radius: 999px;
    background: linear-gradient(100deg,
                var(--popup-color, var(--vvm-accent)) 0%,
                var(--popup-light, var(--vvm-accent)) 100%);
    color: #0b0b0d;
    font-family: var(--font-subheading);
    font-weight: 800; font-size: 0.55rem;
    letter-spacing: 0.09em; text-transform: uppercase; line-height: 1;
    max-width: calc(100% - 18px);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}

.vv-map .card-body { padding: 12px 14px 14px; }
.vv-map .card-title {
    margin: 0 0 6px;
    font-family: var(--font-subheading);
    font-weight: 800; font-size: 0.95rem;
    line-height: 1.25; letter-spacing: 0;
    color: var(--vvm-ink);
    text-transform: none;
}
.vv-map .card-desc {
    margin: 0 0 10px;
    font-size: 0.8rem; line-height: 1.45;
    color: var(--vvm-ink-dim);
}
.vv-map .card-actions { display: flex; gap: 8px; align-items: center; }

.vv-map .card-btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    min-height: 34px; padding: 0 12px;
    border: 1px solid var(--vvm-accent);
    border-radius: 8px;
    background: var(--vvm-accent);
    color: #0b0b0d;
    font-family: var(--font-subheading);
    font-weight: 700; font-size: 0.74rem;
    letter-spacing: 0.04em; text-transform: uppercase;
    text-decoration: none; cursor: pointer;
    transition: filter .18s var(--vvm-ease), background-color .18s var(--vvm-ease);
}
.vv-map .card-btn:hover { filter: brightness(1.12); color: #0b0b0d; }

.vv-map .card-btn--ghost {
    flex: 0 0 auto;
    width: 34px; padding: 0;
    background: transparent;
    border-color: var(--vvm-line);
    color: var(--vvm-ink);
}
.vv-map .card-btn--ghost:hover {
    border-color: var(--vvm-accent);
    color: var(--vvm-accent);
    background: rgba(255, 94, 20, 0.1);
}
.vv-map .card-btn--ghost.added {
    background: var(--vvm-accent);
    border-color: var(--vvm-accent);
    color: #0b0b0d;
}

/* ---------------------------------------------------------
   3. CONTROLES Y ATRIBUCIÓN
   --------------------------------------------------------- */
/* Copiado literal de pais.css / atlas-clandestino.css. La forma NO es
   decorativa: el botón de arriba (+) es una píldora redondeada por arriba y
   el de abajo (−) por abajo, con 4px de separación. Si se ponen dos cápsulas
   iguales, el conjunto se lee al revés y canta que no es el mismo mapa. */
.vv-map .leaflet-control-zoom { border: 0 !important; box-shadow: none !important; }
.vv-map .leaflet-control-zoom a {
    width: 36px; height: 36px; line-height: 34px;
    background: var(--vvm-tint);
    -webkit-backdrop-filter: var(--vvm-blur);
    backdrop-filter: var(--vvm-blur);
    border: 1px solid var(--vvm-line) !important;
    color: var(--vvm-ink) !important;
    font-size: 1.1rem;
}
.vv-map .leaflet-control-zoom a:first-child { border-radius: 999px 999px 7px 7px; }
.vv-map .leaflet-control-zoom a:last-child  { border-radius: 7px 7px 999px 999px; margin-top: 4px; }
.vv-map .leaflet-control-zoom a:hover { color: var(--vvm-accent) !important; }

.vv-map .leaflet-control-attribution {
    background: var(--vvm-tint) !important;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--vvm-ink-dim) !important;
    border-radius: 8px 0 0 0;
    font-size: 0.62rem;
    padding: 2px 7px;
}
.vv-map .leaflet-control-attribution a { color: var(--vvm-ink-dim) !important; }

/* En móvil el zoom se sube: si no, queda debajo del dedo y del borde inferior
   de la pantalla, que es donde el navegador pone su propia barra. */
@media (max-width: 768px) {
    .vv-map .leaflet-bottom.leaflet-right {
        bottom: 12px; right: 6px;
        transition: opacity .2s ease;
    }
    .vv-map .leaflet-control-zoom a { width: 42px; height: 42px; line-height: 40px; }

    /* Con la hoja de objetivos abierta, el zoom le caía justo encima. Estorba
       más que ayuda: si estás eligiendo de una lista, no estás haciendo zoom. */
    .vv-map.is-panel-open .leaflet-bottom.leaflet-right {
        opacity: 0;
        pointer-events: none;
    }
}

/* ---------------------------------------------------------
   4. HERRAMIENTAS FLOTANTES SOBRE EL MAPA
   Calcadas de `.map-tools` (pais.php) y `.ac-tools` (Atlas):
   botones redondos dentro de una píldora de cristal, arriba a
   la derecha. Sin esto, el mapa de la guía no tenía ni "vista
   general" ni acceso al listado de objetivos, que es lo que
   ofrecen las otras dos páginas.
   --------------------------------------------------------- */
.vvm-glass {
    position: relative;
    isolation: isolate;
    background:
        linear-gradient(145deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,.03) 22%, transparent 46%),
        var(--vvm-tint);
    -webkit-backdrop-filter: var(--vvm-blur);
    backdrop-filter: var(--vvm-blur);
    border: 0;
    border-radius: var(--vvm-radius);
    box-shadow: var(--vvm-shadow), var(--vvm-bevel);
    color: var(--vvm-ink);
}
/* Borde de degradado con máscara: un borde plano delata el plástico */
.vvm-glass::before {
    content: '';
    position: absolute; inset: 0; z-index: 2;
    border-radius: inherit;
    padding: 1px;
    background: var(--vvm-edge);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
.vvm-glass > * { position: relative; z-index: 3; }

.vv-map-tools {
    position: absolute;
    /* Por encima de los paneles de Leaflet: sus controles van a 800 y los
       popups a 700. En pais.php basta con 500 porque allí las herramientas
       van FUERA del contenedor del mapa; aquí están dentro. */
    z-index: 900;
    top: var(--vvm-pad);
    right: var(--vvm-pad);
    display: flex;
    gap: 8px;
    padding: 7px;
    border-radius: 999px;
}
.vv-map-tool {
    width: 38px; height: 38px;
    flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--vvm-ink);
    cursor: pointer;
    font-size: 0.92rem;
    transition: background .2s, color .2s, border-color .2s;
}
.vv-map-tool:hover {
    background: rgba(255, 94, 20, 0.2);
    color: var(--vvm-accent-text);
    border-color: var(--vvm-line);
}
.vv-map-tool[aria-expanded="true"] {
    background: rgba(255, 94, 20, 0.22);
    color: var(--vvm-accent-text);
}

@media (max-width: 768px) {
    .vv-map-tools { padding: 5px; gap: 5px; --vvm-pad: 11px; }
    .vv-map-tool { width: 42px; height: 42px; }
}

/* ---------------------------------------------------------
   5. PANEL DE OBJETIVOS
   El equivalente al `.intel-panel` de pais.php: la lista de
   paradas sobre el mapa, para poder ir a una sin cazar puntos
   con el dedo.
   --------------------------------------------------------- */
.vv-map-panel {
    position: absolute;
    z-index: 880;   /* Justo bajo las herramientas, por encima de popups (700) */
    top: var(--vvm-pad);
    left: var(--vvm-pad);
    width: min(300px, calc(100% - var(--vvm-pad) * 2 - 60px));
    max-height: calc(100% - var(--vvm-pad) * 2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: top left;
    transition: opacity .22s var(--vvm-ease), transform .22s var(--vvm-ease), visibility .22s;
}
.vv-map-panel[hidden] { display: none; }
.vv-map-panel.is-closed {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-12px) scale(.97);
    pointer-events: none;
}
.vv-map-panel__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
    padding: 11px 14px;
    font-family: var(--font-subheading);
    font-weight: 800; font-size: 0.68rem;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--vvm-ink-dim);
    border-bottom: 1px solid var(--vvm-line);
}
.vv-map-panel__count { color: var(--vvm-accent-text); }
.vv-map-panel__list {
    list-style: none; margin: 0; padding: 6px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--vvm-accent) rgba(255,255,255,.08);
}
.vv-map-panel__list::-webkit-scrollbar { width: 7px; }
.vv-map-panel__list::-webkit-scrollbar-track { background: rgba(255,255,255,.06); border-radius: 8px; }
.vv-map-panel__list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--vvm-accent), #c2410c);
    border-radius: 8px;
}
.vv-map-panel__item {
    width: 100%;
    display: flex; align-items: center; gap: 10px;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--vvm-ink);
    font-family: var(--font-body);
    font-size: 0.83rem; line-height: 1.3; text-align: left;
    cursor: pointer;
    transition: background .18s, border-color .18s;
}
.vv-map-panel__item:hover,
.vv-map-panel__item.is-active {
    background: rgba(255, 94, 20, 0.14);
    border-color: rgba(255, 94, 20, 0.4);
}
.vv-map-panel__num {
    flex: none;
    width: 24px; height: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px;
    background: rgba(255, 94, 20, 0.18);
    color: var(--vvm-accent-text);
    font-family: var(--font-tactical, var(--font-subheading));
    font-weight: 800; font-size: 0.62rem;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    /* En móvil el panel es una hoja: ocupa el ancho y sale desde abajo,
       igual que la lista de pais.php. Cazar puntos con el dedo en una
       pantalla de 390px no es una opción. */
    .vv-map-panel {
        top: auto; left: 0; right: 0; bottom: 0;
        width: 100%;
        max-height: 58%;
        border-radius: 16px 16px 0 0;
        transform-origin: bottom center;
    }
    .vv-map-panel.is-closed { transform: translateY(14px); }
    .vv-map-panel__item { min-height: 48px; font-size: 0.88rem; }
}

/* Aviso de gesto: "usa Ctrl + rueda para hacer zoom" */
.vv-map .vvm-gesture-hint {
    position: absolute; inset: 0; z-index: 900;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background: rgba(6, 8, 11, 0.55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    color: #fff;
    font-family: var(--font-subheading);
    font-weight: 700; font-size: 0.95rem; text-align: center;
    opacity: 0; pointer-events: none;
    transition: opacity .25s var(--vvm-ease);
}
.vv-map .vvm-gesture-hint.is-visible { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    .vv-map .pp-marker::before,
    .vv-map .pp-marker::after { animation: none; opacity: .35; }
    .vv-map .pp-marker { transition: none; }
}
