/* --- VARIABLES Y CONFIGURACIÓN BASE --- */
:root {
    --primary-red: #c62828;
    --white: #ffffff;
    --text-dark: #333;
    --bg-light: #fcfcfc;
    --font-main: 'Montserrat', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- ANIMACIONES DE CARGA (KEYFRAMES) --- */
@keyframes expandContainer {
    from { transform: scaleX(0); opacity: 0; }
    to { transform: scaleX(1); opacity: 1; }
}

@keyframes fadeInText {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- HEADER & NAVBAR --- */
.header {
    background-color: var(--primary-red);
    padding: 15px 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
}

.navbar {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.brand { 
    color: var(--white); 
    font-weight: 700; 
    font-size: 1.5rem; 
    text-decoration: none; 
}

.nav-links { 
    display: flex; 
    list-style: none; 
    gap: 30px; 
}

.nav-links a { 
    color: var(--white); 
    text-decoration: none; 
    font-size: 0.9rem; 
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover { color: rgba(255,255,255,0.8); }

/* --- BOTONES FLOTANTES IZQUIERDOS (NAVEGACIÓN RÁPIDA) --- */
.navegacion-rapida {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-rapida-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 130px;
    height: 48px;
    padding: 8px 12px;
    text-align: center;
    background-color: var(--primary-red);
    color: var(--white);
    font-weight: 600;
    font-size: 0.8rem;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: background-color 0.25s, transform 0.25s;
}

.nav-rapida-btn:hover {
    background-color: #b71c1c;
    transform: scale(1.05);
}

/* --- BLOQUES DE TÍTULOS PRINCIPALES CON ANIMACIÓN ROJA --- */
.main-title-container {
    background-color: var(--primary-red);
    margin-left: 20%; 
    width: 80%;       
    padding: 20px 40px;
    margin-bottom: 60px;
    margin-top: 150px;
    
    transform-origin: right; 
    opacity: 0;
    animation: expandContainer 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.main-title-container.section-title-bar {
    margin-top: 40px;
}

.main-title {
    color: var(--white);
    font-size: 3.5rem;
    font-weight: 400;
    
    opacity: 0;
    animation: fadeInText 0.4s ease-out forwards;
    animation-delay: 0.35s; 
}

/* --- CONTENIDOS DE CADA SECCIÓN --- */
.content-wrapper {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 50px 60px 50px;
    
    opacity: 0; 
    animation: fadeInUp 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    animation-delay: 0.5s; 
}

.row-item {
    display: flex;
    align-items: center;
    gap: 40px;
    margin-bottom: 30px;
}

.item-content {
    flex: 1;
    font-size: 1rem;
    color: var(--text-dark);
}

.item-content p { text-align: justify; margin-bottom: 8px; }

/* --- CONTENEDOR DE VIDEO PRINCIPAL --- */
.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Relación de aspecto 16:9 exacta */
    height: 0;
    margin-top: 20px;
    margin-bottom: 40px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    background-color: #000;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
}

/* --- RECTÁNGULO ROJO CENTRAL ADAPTADO AL TEXTO --- */
.sub-title-box {
    background-color: var(--primary-red);
    width: fit-content;
    margin: 40px auto 30px auto;
    padding: 10px 30px;
    text-align: center;
    border-radius: 4px;
}

.sub-title-box h2 {
    color: var(--white);
    font-size: 1.4rem;
    font-weight: 600;
}

/* --- CUADRÍCULA DE 4 ELEMENTOS EN RATIO 16:9 --- */
.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columnas en PC */
    gap: 35px; /* Separación clara entre elementos */
    margin-top: 50px;
}

.grid-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-box {
    width: 100%;
    aspect-ratio: 16 / 9; /* Ratio 16:9 exacto para imágenes y timelapse */
    background-color: #eaeaea;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.image-box img,
.image-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-box img:hover {
    transform: scale(1.03);
}

.grid-text {
    font-size: 0.95rem;
    color: var(--text-dark);
    text-align: justify;
}

/* ===== BOTONES FLOTANTES DE CONTACTO (SIEMPRE ENCIMA) ===== */
.contacto-flotante {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999; /* Z-index ultra alto para que nada los tape */
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 12px;
    font-family: 'Montserrat', sans-serif;
    pointer-events: auto; /* Garantiza que los clics funcionen siempre */
}
.contacto-item {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 10px;
}

.contacto-boton {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    border: none;
    border-radius: 50%;
    background: #D92332;
    color: white;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 14px #0003;
    transition: transform .25s, background .25s;
}

.contacto-boton svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.contacto-boton::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -7px;
    border-radius: 50%;
    background: #D9233266;
    animation: contacto-destello 1.8s ease-out infinite;
    pointer-events: none;
}

.contacto-boton::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -7px;
    border: 2px solid #D9233299;
    border-radius: 50%;
    animation: contacto-onda 1.8s ease-out infinite .6s;
    pointer-events: none;
}

@keyframes contacto-destello {
    0%, 100% {
        opacity: .25;
        transform: scale(.92);
    }
    50% {
        opacity: .85;
        transform: scale(1.12);
    }
}

@keyframes contacto-onda {
    0% {
        opacity: .8;
        transform: scale(.85);
    }
    100% {
        opacity: 0;
        transform: scale(1.5);
    }
}

.contacto-boton:hover {
    background: #B91828;
    transform: scale(1.08);
}

.contacto-panel {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 0;
    max-width: calc(100vw - 120px);
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateX(8px);
    background: white;
    color: #222;
    border-radius: 12px;
    box-shadow: 0 4px 20px #0002;
    transition: width .3s, padding .3s, opacity .2s,
                transform .3s, visibility .3s;
}

.contacto-panel.btn-copiar {
    cursor: pointer;
    user-select: all;
}

.contacto-item:hover .contacto-panel,
.contacto-item:focus-within .contacto-panel {
    width: 220px;
    padding: 12px 16px;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.contacto-panel-titulo {
    font-size: 12px;
    font-weight: 700;
    color: #D92332;
}

.contacto-panel-dato {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contacto-panel-ayuda {
    font-size: 10px;
    color: #777;
}

/* --- RESPONSIVE GENERAL --- */
@media (max-width: 768px) {
    .main-title-container {
        margin-left: 10%;
        width: 90%;
        padding: 15px 25px;
    }
    .main-title { font-size: 2.2rem; }
    .content-wrapper { padding: 0 20px 40px 20px; }
    
    .navegacion-rapida {
        left: 10px;
    }
    .nav-rapida-btn {
        width: 105px;
        height: 42px;
        font-size: 0.7rem;
    }
    .sub-title-box {
        width: 60%;
    }
    .image-grid {
        grid-template-columns: 1fr; /* 1 columna en celulares */
        gap: 25px;
    }
}

@media (max-width: 480px) {
    .contacto-flotante {
        right: 16px;
        bottom: 16px;
        gap: 10px;
    }

    .contacto-boton {
        width: 50px;
        height: 50px;
        flex-basis: 50px;
    }

    .contacto-boton svg {
        width: 24px;
        height: 24px;
    }

    .contacto-item:hover .contacto-panel,
    .contacto-item:focus-within .contacto-panel {
        width: min(190px, calc(100vw - 110px));
        padding: 10px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .contacto-boton::before,
    .contacto-boton::after {
        animation: none;
    }

    .contacto-boton,
    .contacto-panel {
        transition: none;
    }
}
/* --- MODAL DE IMAGEN EN PANTALLA COMPLETA --- */
.image-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.image-modal.active .modal-content {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 25px;
    right: 35px;
    background: transparent;
    border: none;
    color: white;
    font-size: 3rem;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: var(--primary-red);
}

/* Permitir que el cursor indique que la imagen es interactiva */
.image-box img {
    cursor: zoom-in;
}