/* SOCES Integration Styles (V3 - Stability Patch)
   - Títulos legibles y responsivos.
   - Fix: Ancho completo forzado incluso con poco contenido.
*/

:root {
    --soces-primary: #0b1c3e;       /* Deep Royal Blue */
    --soces-secondary: #ffd700;     /* Gold */
    --soces-accent: #f0f0f0;        /* Light Gray/White */
    --soces-text-light: #ffffff;    /* Pure White */
    --soces-text-dark: #333;        /* Dark text */
    --soces-card-bg: rgba(255, 255, 255, 0.95);
    --soces-bg-gradient: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    --soces-font-heading: 'Montserrat', sans-serif;
    --soces-font-body: 'Inter', sans-serif;
}

/* === FIX DE ESTRUCTURA (CRÍTICO) === */
/* Esto arregla el problema de "zoom out" o contracción cuando hay poco texto */
.soces-single-facultad,
.soces-single-sociedad,
.soces-single-proyecto,
.soces-wrapper {
    width: 100% !important;     /* Fuerza ancho total */
    min-width: 100% !important; /* Refuerzo */
    display: block !important;  /* Evita comportamiento flex-item por defecto */
    box-sizing: border-box;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--soces-font-heading, sans-serif);
}

.soces-wrapper h1, .soces-wrapper h2, .soces-wrapper h3,
.soces-single-facultad h1, .soces-single-facultad h2,
.soces-single-sociedad h1, .soces-single-sociedad h2,
.soces-single-proyecto h1, .soces-single-proyecto h2 {
    font-family: var(--soces-font-heading);
    font-weight: 700;
}

/* Hero Section (Con corrección de crecimiento) */
.hero {
    /* Altura flexible */
    min-height: 60vh;
    height: auto !important; /* Permite crecer si el título es largo */
    
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    
    /* Espacio extra abajo para que el texto no choque con la tarjeta blanca que sube */
    padding: 6rem 2rem 10rem 2rem;
    
    background-color: #0f2027; 
    overflow: hidden;
    font-family: var(--soces-font-body);
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(11, 28, 62, 0.90) 0%, rgba(0, 0, 0, 0.8) 100%);
    z-index: 1;
}

.header-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    gap: 2rem;
    height: auto; 
}

.logo-container {
    flex: 1;
    display: flex;
    justify-content: center;
}

.uni-logo,
.assoc-logo {
    width: 150px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.3));
    transition: transform 0.3s ease;
}

.uni-logo:hover,
.assoc-logo:hover {
    transform: scale(1.1);
}

.hero-text {
    flex: 2;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    margin-bottom: 1rem;
    color: #ffffff !important; 
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.9);
    animation: fadeInDown 1s ease-out;
    word-wrap: break-word;
    max-width: 100%;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    color: #f0f0f0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    animation: fadeInUp 1s ease-out 0.3s forwards;
}

/* Button */
.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--soces-secondary);
    color: var(--soces-primary);
    font-weight: 600;
    text-decoration: none;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 1s ease-out 0.6s forwards;
    opacity: 0;
    font-family: var(--soces-font-body);
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

/* Societies Grid & Containers */
.soces-wrapper .container,
.soces-single-facultad .container,
.soces-single-sociedad .container,
.soces-single-proyecto .container {
    max-width: 1200px;
    width: 100%; /* Asegura que llene el wrapper */
    margin: -4rem auto 4rem;
    padding: 0 2rem;
    position: relative;
    z-index: 10;
    font-family: var(--soces-font-body);
}

.soces-wrapper .grid,
.soces-single-facultad .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--soces-card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    height: 100%;
    color: var(--soces-text-dark);
}

.card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.card-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.card:hover .card-icon img {
    transform: scale(1.1) rotate(5deg);
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--soces-primary);
    font-family: var(--soces-font-heading);
}

.card p,
.card .card-description {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.card-link {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--soces-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: gap 0.2s;
}

.card-link:hover {
    gap: 0.8rem;
    color: #B8860B; 
}


/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 968px) {
    .header-content {
        flex-direction: column;
        gap: 2rem;
    }

    .uni-logo,
    .assoc-logo {
        width: 100px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero {
        padding: 4rem 2rem 8rem 2rem; /* Ajuste móvil */
    }
}

/* Detail Page Styles */
.detail-hero h1 {
    font-size: 3rem;
    color: #ffffff !important;
    text-shadow: 0 4px 8px rgba(0,0,0,0.9);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    color: var(--soces-secondary);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--soces-secondary);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    transition: all 0.3s ease;
    background: transparent;
    cursor: pointer;
}

.back-link ion-icon {
    font-size: 1.2rem;
}

.back-link:hover {
    background: var(--soces-secondary);
    color: var(--soces-primary);
}

.society-list,
.society-roles,
.project-section {
    background: var(--soces-card-bg);
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    margin-bottom: 3rem;
    color: var(--soces-text-dark);
}

.society-list h2,
.society-roles h2,
.project-section h2 {
    color: var(--soces-primary);
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--soces-secondary);
    display: inline-block;
    padding-bottom: 0.5rem;
}

.society-items,
.role-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 0;
}

.society-item,
.role-list li {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--soces-secondary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: var(--soces-text-dark);
}

.society-item:hover,
.role-list li:hover {
    transform: translateX(5px);
}

.society-item h4,
.role-list strong {
    color: var(--soces-primary);
    font-size: 1.1rem;
    font-family: var(--soces-font-heading);
}

.society-item p {
    font-size: 0.9rem;
    color: #666;
}

/* Video & PDF Container */
.video-container,
.pdf-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 1.5rem;
}

.video-container iframe,
.pdf-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.gallery-item img:hover {
    transform: scale(1.05);
}

/* Author List */
.author-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.author-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.1rem;
    color: var(--soces-text-dark);
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Faculty Navigation Footer */
.faculty-nav-footer {
    background: rgba(11, 28, 62, 0.9);
    padding: 2rem 1rem;
    margin-top: 3rem;
    border-top: 1px solid rgba(255, 215, 0, 0.3);
    text-align: center;
}

.faculty-nav-footer h3 {
    color: var(--soces-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    text-transform: uppercase;
}

.faculty-logos-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.faculty-logos-row img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: grayscale(100%) brightness(1.5);
    transition: all 0.3s ease;
}

.faculty-logos-row a:hover img {
    filter: grayscale(0%) brightness(1);
    transform: scale(1.2);
}
/* --- LIGHTBOX (Visor de Imágenes) --- */
.lightbox-modal {
    display: none; /* Oculto por defecto */
    position: fixed;
    z-index: 9999; /* Por encima de todo */
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9); /* Fondo negro semitransparente */
    backdrop-filter: blur(5px); /* Efecto borroso elegante */
}

.lightbox-content {
    margin: auto;
    display: block;
    width: auto;
    max-width: 90%;
    max-height: 85vh; /* Que no sea más alto que la pantalla */
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    animation: zoomIn 0.3s; /* Animación de entrada */
}

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 10000;
    background: transparent;
    border: none;
    line-height: 1;
}

.close-lightbox:hover,
.close-lightbox:focus {
    color: var(--soces-secondary);
    text-decoration: none;
    cursor: pointer;
}

/* Animación de Zoom */
@keyframes zoomIn {
    from {transform: scale(0.5); opacity: 0;}
    to {transform: scale(1); opacity: 1;}
}

/* Cursor para indicar que se puede hacer clic */
.gallery-item img {
    cursor: zoom-in;
    transition: transform 0.3s ease;
}
.gallery-item img:hover {
    transform: scale(1.03); /* Pequeño efecto al pasar el mouse */
}