/* =========================================================
   tactical-guide.css - V18 (CWV, A11Y UE, MOBILE SWIPE)
   ========================================================= */

/* A11Y UE COMPLIANCE */
:focus-visible { outline: 3px solid var(--color-primary, #f97316); outline-offset: 3px; border-radius: 2px; } 

/* 1. ESTILOS DE INTERFAZ (BOTONES Y WAYPOINTS) */
.tactical-actions-row { display: flex; gap: 10px; margin-top: 15px; }
.btn-tactical-map { flex: 1; background: var(--color-text-main); color: var(--color-bg-body); border: 1px solid var(--color-text-main); font-family: "Orbitron", sans-serif; font-weight: 700; padding: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.3s ease; }
.btn-tactical-map:hover { background: transparent; color: var(--color-text-main); }

.repsol-map-btn {
    background-color: transparent; 
    border: 1px solid var(--color-primary); 
    color: var(--color-primary); 
    width: 36px; height: 36px; 
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; cursor: pointer; margin-left: 15px; border-radius: 4px; 
    /* ELIMINADO EL 'ALL'. Transición táctica exclusiva para la GPU: */
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease; 
}

.repsol-map-btn:hover { 
    background-color: var(--color-primary); 
    color: #000; 
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.3); 
}

.toc-tactical { background: rgba(0,0,0,0.05); border-left: 3px solid var(--color-primary); padding: 20px; border-radius: 0 8px 8px 0; }
.toc-tactical h3 { margin-top: 0; font-family: "Orbitron", sans-serif; font-size: 1.1rem; letter-spacing: 1px; color: var(--color-primary); }
.toc-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.toc-list li a { text-decoration: none; color: inherit; font-size: 0.9rem; transition: color 0.2s; display: flex; align-items: center; gap: 8px; font-weight: 500;}
.toc-list li a:hover { color: var(--color-primary); }
.toc-num { font-weight: bold; color: var(--color-primary); }

/* 2. PROTECCIÓN GLOBAL Y CORE VITALS (CWV) */
html, body { width: 100%; margin: 0; padding: 0; overscroll-behavior-x: none; }
*, *::before, *::after { box-sizing: border-box; }

/* Nota: .hero-tactical se define completo mas abajo, en el bloque "CLS OPTIMIZATION", con aspect-ratio incluido. Se ha quitado la definicion corta duplicada de aqui. */
.hero-bg img {
    position: absolute !important; top: 0 !important; left: 0 !important;
    width: 100% !important; height: 100% !important; 
    object-fit: cover !important; z-index: 0;
}
.hero-overlay, .hero-grid { position: relative; z-index: 1; }

/* CWV HACK: content-visibility desactivado para recuperar los cálculos del scroll.
   Nota: sin content-visibility, contain-intrinsic-size no hace nada, por eso se ha quitado. */
.stop-card-v8 { }

.stop-card-v8 * { min-width: 0 !important; }

.stop-card-v8 h1, .stop-card-v8 h2, .stop-card-v8 h3, .stop-card-v8 p, .stop-card-v8 a, .stop-card-v8 span {
    overflow-wrap: break-word !important; word-wrap: break-word !important; word-break: break-word !important; hyphens: auto;
}

.stops-feed img, .sidebar-sticky img, .stop-img-frame img {
    width: 100% !important; max-width: 100% !important; height: auto !important; object-fit: cover;
}
.leaflet-container img { width: initial !important; max-width: none !important; height: initial !important; object-fit: initial !important; }

/* 3. BLINDAJE MÓVIL Y GESTOS TÁCTICOS */
@media (max-width: 768px) {
    .container, .guide-container, .hero-grid, .stops-feed, .mission-manifesto, .waypoints-tactical-section {
        max-width: 100vw !important; overflow-x: hidden !important; 
    }
    .stop-card-v8 {
        width: 100% !important; max-width: 100vw !important; margin-left: 0 !important; margin-right: 0 !important;
        box-sizing: border-box !important; overflow: hidden !important; 
    }
    .stop-top-row { display: flex !important; flex-direction: column !important; width: 100% !important; gap: 15px; }
    .stop-visual-col, .stop-data-col { width: 100% !important; max-width: 100% !important; min-width: 0 !important; padding-left: 0 !important; padding-right: 0 !important; }
    .stop-img-frame, .stop-img-frame img { width: 100% !important; max-width: 100% !important; }
    .toc-list { grid-template-columns: 1fr !important; }
    .hero-col-left, .hero-col-right { padding: 0 15px; }
}

/* 4. HUD: BARRA LÁSER DE INFILTRACIÓN */
.infiltration-progress-wrap {
    position: fixed; top: 0; left: 0; width: 100%; height: 6px; 
    background: rgba(255, 255, 255, 0.15); z-index: 2147483647; 
    pointer-events: auto; cursor: pointer;
}
.infiltration-progress-bar {
    height: 100%; width: 0%; background: var(--color-primary, #f97316);
    box-shadow: 0 0 10px var(--color-primary, #f97316), 0 0 3px #ffffff; 
    border-radius: 0 3px 3px 0; will-change: width;
}
.mission-complete-pulse { animation: orangeNeonPulse 0.8s infinite alternate !important; }
@keyframes orangeNeonPulse {
    0% { opacity: 0.8; box-shadow: 0 0 10px var(--color-primary), 0 0 3px #fff; }
    100% { opacity: 1; box-shadow: 0 0 25px var(--color-primary), 0 0 10px #fff, 0 0 40px var(--color-primary); }
}

/* 5. EFECTO "PAGE CURL" (BOTONES A11Y) */
.page-curl-hint {
    position: fixed; top: 50%; transform: translateY(-50%); height: 110px; display: flex; align-items: center;
    z-index: 999990; cursor: pointer; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1), background 0.4s;
    appearance: none; -webkit-appearance: none; padding: 0; margin: 0; border: none; /* Reset de Botón Crítico */
}
.page-curl-hint i { color: var(--color-primary, #f97316); font-size: 1.4rem; }

.page-curl-hint.next { right: 0; width: 35px; background: linear-gradient(to left, rgba(249, 115, 22, 0.25), transparent); border-left: 2px solid var(--color-primary, #f97316); border-radius: 50% 0 0 50%; justify-content: flex-start; padding-left: 10px; }
.page-curl-hint.next i { animation: pulseRightArrow 2s infinite; }

.page-curl-hint.prev { left: 0; width: 35px; background: linear-gradient(to right, rgba(249, 115, 22, 0.25), transparent); border-right: 2px solid var(--color-primary, #f97316); border-radius: 0 50% 50% 0; justify-content: flex-end; padding-right: 10px; }
.page-curl-hint.prev i { animation: pulseLeftArrow 2s infinite; }

.page-curl-hint.next.anim-flap { animation: pageFlapNext 3.5s ease-in-out forwards; }
.page-curl-hint.prev.anim-flap { animation: pageFlapPrev 3.5s ease-in-out forwards; }

@keyframes pageFlapNext { 0% { width: 35px; } 15% { width: 90px; background: linear-gradient(to left, rgba(249, 115, 22, 0.6), rgba(249, 115, 22, 0.1)); } 80% { width: 90px; background: linear-gradient(to left, rgba(249, 115, 22, 0.6), rgba(249, 115, 22, 0.1)); } 100% { width: 35px; } }
@keyframes pageFlapPrev { 0% { width: 35px; } 15% { width: 90px; background: linear-gradient(to right, rgba(249, 115, 22, 0.6), rgba(249, 115, 22, 0.1)); } 80% { width: 90px; background: linear-gradient(to right, rgba(249, 115, 22, 0.6), rgba(249, 115, 22, 0.1)); } 100% { width: 35px; } }
@keyframes pulseRightArrow { 0%, 100% { transform: translateX(2px); opacity: 0.6; } 50% { transform: translateX(-4px); opacity: 1; } }
@keyframes pulseLeftArrow { 0%, 100% { transform: translateX(-2px); opacity: 0.6; } 50% { transform: translateX(4px); opacity: 1; } }

@media (min-width: 769px) { .page-curl-hint { display: none; } }

/* =========================================================
   BLINDAJE TÁCTICO: HOJA DE RUTA (SIDEBAR) INAMOVIBLE
   ========================================================= */
/* Garantiza que el sidebar completo se quede pegado al hacer scroll */
.sidebar-sticky {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 90px !important;
    align-self: flex-start !important;
}

/* =========================================================
   tactical-guide.css - CLS OPTIMIZATION BLOCK
   ========================================================= */

/* 1. HACK CLS: FIJAR EL LIENZO DEL HERO BANNER */
/* Esto evita que el título y el contenido den un salto cuando la imagen de fondo carga */
.hero-tactical { 
    position: relative;
    width: 100%; 
    aspect-ratio: 16 / 9; /* Reservamos el espacio exacto antes de la carga */
    overflow: hidden; 
    contain: layout paint; /* Aísla el cálculo del navegador para mejorar el rendimiento */
}

/* En móviles, la imagen suele recortarse o cambiar de proporción. 
   Ajusta este aspect-ratio al que realmente tenga tu diseño móvil para evitar el salto. */
@media (max-width: 768px) {
    .hero-tactical {
        aspect-ratio: 4 / 5; 
    }
}

/* 2. HACK CLS: FIJAR LAS IMÁGENES DE LAS PARADAS */
/* Aunque el HTML tenga width y height, en responsive a veces falla el cálculo inicial.
   Forzamos el aspect-ratio en CSS para que el navegador reserve el bloque de cemento. */
.stop-img-frame {
    /* Si el frame tiene algún padding o border, esto ayuda a estabilizarlo */
    display: block;
    width: 100%;
}

.stop-img-frame img {
    width: 100%;
    height: auto;
    aspect-ratio: 467 / 300; /* La proporción exacta de tus imágenes (500x250 o similar) */
    object-fit: cover;
    display: block; /* Elimina el espacio fantasma debajo de las imágenes inline */
}

/* 3. HACK CLS: EVITAR EL SALTO DE FUENTES (FOIT/FOUT) EN LOS ICONOS */
/* Cuando FontAwesome carga, los iconos pasan de 0px a su tamaño real, empujando el texto.
   Reservamos el ancho estándar de un icono antes de que la fuente esté lista. */
i.fa-solid, i.fa-regular, i.fa-brands {
    display: inline-block;
    min-width: 1.25em; /* Ancho seguro para la mayoría de iconos de FA */
    text-align: center;
    line-height: 1; /* Estabiliza la altura de línea */
}

/* 4. HACK CLS: ALTURA MÍNIMA PARA TÍTULOS CRÍTICOS */
/* Si la fuente personalizada del título tarda en cargar, el fallback font puede ser más pequeño,
   causando un salto cuando la fuente final se aplica. */
.hero-title { 
    min-height: 1.2em; 
    contain: layout paint; 
}

.stop-title-main { 
    min-height: 1.2em; 
    contain: layout; 
}

.hero-title { 
    min-height: 1.2em; 
    line-height: 1.2 !important; /* Congela la altura exacta sin depender de la fuente */
    contain: layout paint; 
    overflow: hidden; /* Evita que los descendientes empujen el alto */
}

.stop-title-main { 
    min-height: 1.2em; 
    line-height: 1.2 !important; 
    contain: layout; 
    overflow: hidden;
}

p, span, div {
    /* Estabiliza todo el texto base de la guía */
    line-height: 1.6; 
}
/* =========================================================
   A11Y AA FIX: WCAG 2.2.2 - Parpadeo (Pause, Stop, Hide)
   El "blink" y el "wh-stamp.blink" se definen en otra hoja de estilos
   del sitio con animation: blink 1s infinite. Un parpadeo indefinido
   incumple el criterio 2.2.2 (Nivel A). Limitamos las iteraciones para
   que se detenga solo, sin tocar la animacion en si.
   ========================================================= */
.wh-stamp.blink,
.blink {
    animation-iteration-count: 3 !important;
}

/* =========================================================
   FIX CLS DE CAMPO (Search Console): la Hoja de Ruta ya no se
   oculta animando max-height/margin-bottom (eso mueve el resto
   del sidebar y cuenta como Cambio de Diseño real en Chrome).
   Ahora solo se desvanece: el hueco queda reservado, sin reflow.
   ========================================================= */
#sidebarTimelineWidget.wire-collapsed-fade {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}