/* ========================================
   Jóvenes Científicos - Estilos
   ======================================== */

/* Variables CSS */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #06b6d4;
    --accent: #f59e0b;
    --success: #10b981;
    --dark: #1e293b;
    --gray-900: #0f172a;
    --gray-800: #1e293b;
    --gray-700: #334155;
    --gray-600: #475569;
    --gray-500: #64748b;
    --gray-400: #94a3b8;
    --gray-300: #cbd5e1;
    --gray-200: #e2e8f0;
    --gray-100: #f1f5f9;
    --gray-50: #f8fafc;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --max-width: 1200px;
}

/* Reset y base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ========================================
   HEADER
   ======================================== */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.logo a {
    color: inherit;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--gray-600);
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--gray-700);
    transition: all 0.3s;
}

/* ========================================
   HERO
   ======================================== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: 4rem 0;
    text-align: center;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
}

/* ========================================
   PAGE HEADER
   ======================================== */
.page-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: 3rem 0;
    text-align: center;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.page-header p {
    font-size: 1.125rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* ========================================
   CATEGORÍAS
   ======================================== */
.categories {
    padding: 3rem 0;
    background: var(--white);
}

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

.category-card {
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
}

.category-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.category-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.category-card h3 {
    font-size: 1.25rem;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.category-card p {
    color: var(--gray-600);
    font-size: 0.95rem;
}

/* ========================================
   POSTS SECTION
   ======================================== */
.posts-section {
    padding: 3rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.875rem;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--gray-600);
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.post-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
}

.post-image {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--gray-200);
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.post-card:hover .post-image img {
    transform: scale(1.05);
}

.post-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.post-excerpt {
    color: var(--gray-600);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
}

.post-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.post-date {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

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

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

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.load-more-container {
    text-align: center;
    margin-top: 2rem;
}

/* Loading */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message,
.empty-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--gray-600);
}

.error-message {
    color: #dc2626;
}

/* ========================================
   PATROCINADORES
   ======================================== */
.sponsors-section {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    padding: 3rem 0;
    border-top: 3px solid var(--primary);
}

.sponsors-title {
    text-align: center;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 2rem;
}

.sponsors-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: var(--max-width);
    margin: 0 auto;
    align-items: center;
    justify-items: center;
}

.sponsor-logo-link {
    display: block;
    max-width: 320px;
}

.sponsor-logo-link img {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
}

@media (max-width: 768px) {
    .sponsors-section {
        padding: 2.5rem 0;
    }
    
    .sponsors-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .sponsors-title {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .sponsors-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: 3rem 0 1.5rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand h3 {
    color: var(--white);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.footer-brand p {
    max-width: 300px;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--gray-400);
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-800);
    text-align: center;
    font-size: 0.875rem;
}

.footer-bottom a {
    color: var(--primary-light);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
        gap: 0;
    }

    .nav.active {
        display: flex;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: none;
    }

    .menu-toggle {
        display: flex;
    }

    .hero-title {
        font-size: 1.875rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .category-card {
        padding: 1rem;
    }

    .category-icon {
        font-size: 2rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-brand p {
        max-width: none;
    }

    .footer-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .category-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 3rem 0;
    }

    .hero-title {
        font-size: 1.5rem;
    }
}
