/* Previene el desplazamiento horizontal no deseado en celulares */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* Corta cualquier elemento que intente salirse a la derecha */
}

/* -------------------------------------- */
/* 1. PALETA DE COLORES Y FUENTES (Variables) y Reset */
/* -------------------------------------- */
:root {
    --color-primary: #1B2A4A;        /* Azul Marino Profundo */
    --color-secondary: #3B4E73;      /* Azul Pizarra */
    --color-accent: #C5A059;         /* Dorado Antiguo */
    --color-accent-hover: #B98A4D;   /* Dorado Oscuro (aproximado) */
    --color-background: #F9F9FB;     /* Gris/Blanco Muy Suave */
    --color-text-body: #1A1D20;      /* Gris Casi Negro */
    --color-white: #FFFFFF;
    
    --font-serif: 'Merriweather', serif; 
    --font-sans: 'Lora', serif;          
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-background);
    color: var(--color-text-body);
    line-height: 1.6;
}

.contenedor {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* -------------------------------------- */
/* 2. TIPOGRAFÍA Y TÍTULOS */
/* -------------------------------------- */
h1, h2, h3, h4 {
    font-family: var(--font-serif);
    color: var(--color-primary);
    margin-bottom: 0.5em;
    line-height: 1.1;
}

h1 { font-size: 3em; }
h2 { font-size: 2.5em; }
h3 { font-size: 1.8em; }
p  { font-size: 1.0em;}

/* -------------------------------------- */
/* 3. BOTONES */
/* -------------------------------------- */
.btn-principal, .btn-acento {
    display: inline-block;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 700;
    transition: background-color 0.3s ease-in-out;
    border: none;
    cursor: pointer;
}

.btn-principal {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.btn-acento {
    background-color: var(--color-accent);
    color: var(--color-white);
}

.btn-principal:hover, 
.btn-principal:focus {
    background-color: var(--color-secondary);
    outline: 2px solid var(--color-accent);
}

.btn-acento:hover,
.btn-acento:focus {
    background-color: var(--color-accent-hover);
    outline: 2px solid var(--color-primary);
}

/* -------------------------------------- */
/* 4. HEADER, LOGO Y NAVEGACIÓN */
/* -------------------------------------- */
.header-principal {
    background-color: var(--color-white);
    padding: 1em 0;
    border-bottom: 1px solid var(--color-background);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-principal .contenedor {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.identidad-header {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    max-height: 50px;
    width: auto;
    margin-right: 5px;
    display: block;
}

.header-texto {
    line-height: 1.2;
}

.titulo-iglesia {
    font-family: var(--font-serif);
    font-size: 0.9em;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

.subtitulo-identidad {
    font-family: var(--font-sans);
    font-size: 1em;
    color: var(--color-text-body);
    margin: 0;
}

.menu-hamburguesa {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 110;
}

.menu-hamburguesa span {
    width: 100%;
    height: 3px;
    background-color: var(--color-primary);
    transition: all 0.3s ease;
}

.navegacion a {
    color: var(--color-text-body);
    text-decoration: none;
    margin-left: 20px;
    transition: color 0.3s;
    font-size: 1.2em;
}

.navegacion a:hover,
.navegacion a:focus {
    color: var(--color-accent);
    outline: none; 
}


/* -------------------------------------- */
/* 5. SECCIÓN HÉROE Y BANNERS */
/* -------------------------------------- */
.hero {
    /* Fondo con superposición tenue y la foto de la iglesia */
    background-image: 
        linear-gradient(
            rgba(27, 42, 74, 0.65), /* Reduje ligeramente la opacidad a 65% para que la foto destaque más */
            rgba(27, 42, 74, 0.65)
        ), 
        url('img/fachada-iglesia.png'); /* Asegúrate de mantener tu ruta exacta aquí */

    background-size: cover;        /* Escala la foto para cubrir todo el contenedor */
    background-position: center;   /* Centra la parte más importante de la iglesia */
    background-repeat: no-repeat;
    
    /* ALTO Y ESPACIADO */
    min-height: 70vh;              /* Ocupa el 70% del alto de la pantalla del usuario */
    padding: 6em 2em;              /* Le da bastante margen vertical para "respirar" */
    
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.hero-contenido {
    max-width: 800px;
}

.hero-contenido h1 {
    color: var(--color-white);
    font-size: 3.2em;
    margin-bottom: 0.4em;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); /* Hace que el texto resalte de la foto */
}

.hero-contenido p {
    color: var(--color-white);
    font-size: 1.2em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 1.5em;
}


.page-header {
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: 1em 0;
    text-align: center;
    margin-bottom: 1em;
}

.page-header h1 {
    color: var(--color-white);
    font-size: 1.5em;
    margin: 0;
}

.page-header p {
    font-size: 1.1em;
    margin-top: 0.5em;
    opacity: 0.9;
}

.seccion-fe {
    display: grid;
    font-size: 1.2em;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 2em;
}

/* -------------------------------------- */
/* 6. PILARES */
/* -------------------------------------- */
.pilares {
    padding: 4em 0; 
    text-align: center;
    background-color: var(--color-background); 
}

.pilares-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 2em;
}

.pilar-item {
    background-color: var(--color-white);
    padding: 2em;
    border: 1px solid var(--color-background);
    border-top: 5px solid var(--color-accent);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s;
}

.pilar-item span {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 150px;
    width: 150px;
    margin: 0.5em auto;
    font-size: 3em; 
    line-height: 1; 
    color: var(--color-primary);
}

.pilar-item span img {
    max-height: 100%; 
    max-width: 100%;
    height: auto;
    width: auto;
    object-fit: contain;
}

/* -------------------------------------- */
/* 7. ELEMENTOS DE CONTENIDO */
/* -------------------------------------- */
.seccion-sermones {
    padding-bottom: 3em; 
}

.sermon-principal {
    background-color: var(--color-background);
    padding: 2.5em;
    margin-bottom: 3em;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.sermon-principal h2 { 
    font-size: 2em;
    margin-bottom: 0.8em;
}

.sermon-item {
    margin-bottom: 3em;
    padding-bottom: 2em;
    border-bottom: 1px solid #eee;
}

.titulo-sermon {
    color: var(--color-primary);
    font-size: 1.5em;
    font-family: var(--font-serif);
    margin-bottom: 1em;
}

.descripcion-sermon {
    margin-top: 10px;
}

.sermon-item hr {
    border: 0;
    height: 1px;
    background-color: var(--color-secondary);
    margin: 3em 0;
}

.titulo-seccion-secundaria {
    text-align: center;
    margin-top: 3em;
    margin-bottom: 1.5em;
    font-size: 2em;
}

.sermones-lista {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.sermon-tarjeta {
    background-color: var(--color-background);
    padding: 1.5em;
    border: 1px solid rgba(0,0,0,0.05);
    border-left: 5px solid var(--color-secondary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.sermon-tarjeta:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.sermon-fecha {
    font-size: 0.85em;
    color: var(--color-secondary);
    margin-bottom: 0.5em;
    font-weight: 700;
}

.titulo-sermon-tarjeta {
    font-size: 1.3em;
    margin-bottom: 0.3em;
    line-height: 1.2;
}

.sermon-referencia {
    font-style: italic;
    color: var(--color-text-body);
    margin-bottom: 1em;
}

.btn-reproducir {
    padding: 8px 15px;
    font-size: 0.9em;
}

/* -------------------------------------- */
/* 8. VIDEOS RESPONSIVE */
/* -------------------------------------- */
.video-responsive {
    position: relative;
    width: 100%;
    /* Proporción 16:9 panorámica para YouTube */
    padding-bottom: 56.25%; 
    height: 0;
    overflow: hidden;
    border-radius: 8px; /* Bordes redondeados elegantes */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15); /* Sombra suave profesional */
    margin: 1.5em 0;
    background-color: #000; /* Fondo negro mientras carga */
}

.video-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* -------------------------------------- */
/* 9. FOOTER */
/* -------------------------------------- */
.footer-principal {
    background-color: var(--color-primary);
    color: var(--color-background);
    padding: 2em 0;
    text-align: center;
    margin-top: 4em;
}

.footer-principal p {
    margin: 0.5em 0;
}

/* -------------------------------------- */
/* 10. RESPONSIVE MÓVIL (Media Query) */
/* -------------------------------------- */
@media (max-width: 768px) {
    .header-principal {
        position: relative !important;
    }

    .contenedor {
        width: 100% !important;
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
    
    .header-principal .contenedor {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .identidad-header {
        margin-bottom: 0;
        max-width: 75%; 
    }

    .titulo-iglesia {
        font-size: 1em; 
    }

    .subtitulo-identidad {
        font-size: 0.85em;
    }

    .menu-hamburguesa {
        display: flex !important;
    }

    /* Ocultamos el menú removiendo el !important conflictivo */
    .navegacion {
        display: none; 
        flex-direction: column; 
        position: absolute;
        top: 100%; 
        left: 0;
        width: 100%;
        background-color: var(--color-white);
        padding: 20px;
        box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.08);
        z-index: 99999; 
    }

    /* Activación del menú mediante clase JS */
    .navegacion.activo {
        display: flex !important;
    }

    .navegacion a {
        margin: 0 !important; 
        font-size: 1.1em;
        padding: 12px 0; 
        width: 100%;
        text-align: center;
        border-bottom: 1px solid var(--color-background);
        display: block;
    }

    .navegacion a:last-child {
        border-bottom: none;
    }
    
    .hero {
        min-height: 280px;
        padding: 2em 15px;
    }

    h1 {
        font-size: 1.8em; 
    }
    
    .hero-contenido p {
        font-size: 1em;
        margin-bottom: 15px;
    }

    .sermon-principal {
        padding-left: 15px;
        padding-right: 15px;
        border-radius: 0; 
    }

    /* Transformación visual del botón hamburguesa a una X */
    .menu-hamburguesa.activo span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    .menu-hamburguesa.activo span:nth-child(2) {
        opacity: 0;
    }
    .menu-hamburguesa.activo span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
}

/* -------------------------------------- */
/* 11. PÁGINA DE CONTACTO Y FORMULARIO */
/* -------------------------------------- */
.seccion-contacto {
    padding: 4em 0;
}

.contacto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
    margin-top: 2em;
}

.formulario-contacto label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: 700;
    color: var(--color-primary);
}

.formulario-contacto input[type="text"],
.formulario-contacto input[type="email"],
.formulario-contacto textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-secondary);
    border-radius: 4px;
    background-color: var(--color-white);
    font-family: var(--font-sans);
    color: var(--color-text-body);
    transition: border-color 0.3s;
}

.formulario-contacto input:focus,
.formulario-contacto textarea:focus {
    border-color: var(--color-accent);
    outline: none;
    box-shadow: 0 0 5px rgba(197, 160, 89, 0.5); /* Usar el color acento actualizado */
}

.formulario-contacto textarea {
    resize: vertical;
}

.formulario-container .btn-principal {
    width: 100%;
    margin-top: 25px;
}

/* ------------------ */
/* 12. MAPA E INFORMACIÓN */
/* ------------------ */
.mapa-responsive {
  position: relative;
  width: 100%;             /* Se adapta exactamente al ancho del contenedor */
  max-width: 100%;         /* NUNCA permite que se salga de la pantalla */
  aspect-ratio: 16 / 9;    /* Mantiene la proporción perfecta en cualquier pantalla */
  margin-bottom: 30px;
  border-radius: 8px;      /* Opcional: le da esquinas redondeadas muy elegantes */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.mapa-responsive iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.info-contacto h3 {
    margin-top: 0;
    border-bottom: 2px solid var(--color-secondary);
    padding-bottom: 0.5em;
}

.info-contacto p {
    margin-bottom: 1em;
}

.datos-contacto {
    margin: 1.5em 0;
    padding: 1em;
    background-color: var(--color-background);
    border-left: 5px solid var(--color-accent);
}

/* -------------------------------------- */
/* 13. ACORDEÓN DE DECLARACIONES DE FE */
/* -------------------------------------- */
.acordeon-item {
    border: 1px solid var(--color-background);
    margin-bottom: 10px;
    border-radius: 4px;
    border-bottom: 1px solid #eee;
}

.acordeon-item:last-child {
    border-bottom: none;
}

.acordeon-titulo {
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: 15px 20px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-bottom: none;
    font-family: var(--font-serif);
    font-size: 1.3em;
    display: block;
    transition: background-color 0.3s;
    user-select: none;
}

.acordeon-titulo:hover {
    background-color: var(--color-secondary);
}

.acordeon-titulo::after {
    content: '+';
    float: right;
    font-size: 1.2em;
    font-weight: bold;
}

.acordeon-item.activo .acordeon-titulo {
    background-color: var(--color-secondary);
}

.acordeon-item.activo .acordeon-titulo::after {
    content: '-'; 
}

.acordeon-contenido {
    padding: 0 20px; 
    background-color: var(--color-white);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out; 
}

.acordeon-item.activo .acordeon-contenido {
    padding: 20px; 
}

/* -------------------------------------- */
/* 14. DOCUMENTOS LARGOS Y FLOTANTES */
/* -------------------------------------- */
.seccion-subtitulo {
    padding: 1em 0;
}

.documento-largo {
    max-width: 850px;
    margin: 0 auto;
    line-height: 1.7;
    font-family: var(--font-serif);
    color: var(--text-body);
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
}

.documento-largo .capitulo-titulo {
    font-size: 1.8em;
    color: var(--color-primary);
    margin-top: 2em;
    margin-bottom: 1em;
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 5px;
}

.documento-largo sup {
    font-size: 0.7em;
    color: var(--color-accent);
    font-weight: bold;
    line-height: 0;
}

.documento-largo .seccion-subtitulo {
    font-size: 1.3em;
    color: var(--color-secondary);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.boton-flotante {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background-color: var(--color-primary); /* Utilizando la variable */
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.boton-flotante:hover {
    background-color: var(--color-secondary); /* Utilizando la variable */
    transform: scale(1.05);
}

@media (max-width: 768px) {
  .boton-flotante {
    padding: 8px 14px;      /* Reducimos el relleno interno (era 15px 25px) */
    font-size: 12px;        /* Achicamos un poco la letra */
    bottom: 15px;           /* Lo pegamos un poquito más al borde inferior */
    right: 15px;
  }
}

.whatsapp-flotante {
    position: fixed;
    bottom: 20px;
    left: 20px; 
    z-index: 99999; 
    background-color: #25D366; /* Mantener color de WhatsApp */
    color: white;
    padding: 0;
    border-radius: 50%;        
    text-decoration: none;     
    text-align: center;
    font-size: 28px;
    width: 55px;    
    height: 55px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 1. SEGURO GLOBAL ANTI-DESPLAZAMIENTO */
*, *::before, *::after {
    box-sizing: border-box !important;
}

html, body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important; /* Evita el scroll horizontal */
    margin: 0;
    padding: 0;
}

/* 2. AJUSTE DE CONTENEDORES PARA MÓVILES */
.contenedor {
    width: 100% !important;
    max-width: 1200px; /* O el tamaño máximo que tengas para PC */
    margin: 0 auto;
    padding-left: 15px !important;
    padding-right: 15px !important;
}

.contacto-grid {
    width: 100% !important;
    max-width: 100% !important;
    display: block; /* Para asegurarnos que en móvil no fuerce columnas más anchas */
}

/* 3. AJUSTE DE MAPA E IFRAME */
.info-contacto,
.mapa-ubicacion,
.mapa-responsive {
    width: 100% !important;
    max-width: 100% !important;
}

.mapa-responsive iframe {
    width: 100% !important;
    max-width: 100% !important;
}

/* -------------------------------------- */
/* 15. GALERÍA DE FOTOS Y VIDEO EN VIVO   */
/* (pegar al final de main.css)           */
/* -------------------------------------- */
.seccion-galeria {
    padding: 2em 0;
}

.galeria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.galeria-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background-color: var(--color-secondary);
}

.galeria-grid img:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.galeria-mensaje {
    grid-column: 1 / -1;
    text-align: center;
    color: #555;
    padding: 2em 0;
}

/* Visor ampliado */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lightbox.abierto {
    display: flex;
}

.lightbox img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 4px;
}

.lightbox-cerrar {
    position: absolute;
    top: 15px;
    right: 20px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2.5em;
    cursor: pointer;
    line-height: 1;
}

@media (max-width: 768px) {
    .galeria-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

/* Contenedor responsivo para el video de Facebook */
.fb-video-container {
    position: relative;
    padding-bottom: 56.25%; /* Mantiene la proporción 16:9 */
    height: 0;
    overflow: hidden;
    max-width: 100%;
}

.fb-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Corrección de escala y zoom para el video de Facebook */
.fb-video-container {
    position: relative;
    width: 100%;
    max-width: 800px; /* Ancho máximo para que en PC no se vea gigante */
    margin: 0 auto;   /* Centra el reproductor en la pantalla */
    padding-bottom: 56.25%; /* Mantiene la proporción panorámica 16:9 exactos */
    height: 0;
    overflow: hidden;
    border-radius: 8px; /* Bordes suavemente redondeados */
    background-color: #000; /* Fondo negro para evitar saltos de pantalla */
}

.fb-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
}