/* ========================================
   NEXUS - SEO Optimized News Styles
   Prioritizes performance and search ranking
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&display=swap');

:root {
    --primary: #6366f1;
    --secondary: #8b5cf6;
    --tertiary: #06b6d4;
    --dark: #0f0f23;
    --darker: #050510;
    --glass: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ========================================
   Performance-First Base
   ======================================== */

.main-content {
    background: var(--darker);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    max-width: none;
    will-change: scroll-position; /* Optimize for scroll */
}

/* ========================================
   Hero Section - Lightweight
   ======================================== */

.hero {
    min-height: 30vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
    position: relative;
    padding: 4rem 2rem;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    max-width: 800px;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    margin-bottom: 1rem;
    background: var(--gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--gradient);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* Simplified transitions for performance */
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
    color: white;
    text-decoration: none;
}

/* ========================================
   Content Container - SEO Optimized
   ======================================== */

.news-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
    position: relative;
    z-index: 1;
}

/* ========================================
   News Grid - Performance Focus
   ======================================== */

.news-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 4rem;
}

.news-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    contain: layout;
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.featured-card {
    grid-column: span 2;
    flex-direction: row;
    min-height: 300px;
}

.card-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.featured-card .card-image {
    height: 100%;
    min-height: 300px;
}

.news-card:hover .card-image {
    transform: scale(1.02);
}

.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
}

.featured-card .card-content {
    padding: 2.5rem;
    justify-content: space-between;
    flex: 1;
    width: 50%;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .2rem;
    margin-bottom: 1rem;
}

.card-category {
    background: var(--gradient);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.card-date {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text);
}

.featured-card .card-title {
    font-size: 1.8rem;
}

.card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.card-title a:hover {
    color: var(--primary);
}

.card-excerpt {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}

.featured-card .card-excerpt {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

/* Read more link for featured articles */
.read-more-wrapper {
    margin-top: auto;
    padding-top: 1rem;
}

.read-more-link {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.1);
}

.read-more-link:hover {
    color: white;
    background: var(--primary);
    text-decoration: none;
    transform: translateX(3px);
}

.cta-wrapper {
    margin-top: auto;
    padding-top: 1.5rem;
}

.article-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.article-cta-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.article-cta-btn:hover::before {
    left: 100%;
}

.article-cta-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    text-decoration: none;
    color: white;
}

.cta-icon {
    transition: transform 0.3s ease;
    font-weight: bold;
}

.article-cta-btn:hover .cta-icon {
    transform: translateX(3px);
}

.cta-text {
    position: relative;
    z-index: 2;
}

/* ========================================
   Stats Section - Lightweight
   ======================================== */

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin: 4rem 0;
}

.stat-card {
    text-align: center;
    padding: 2rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 900;
    background: var(--gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

/* ========================================
   Trending Section - SEO Optimized
   ======================================== */

.trending-section {
    margin: 4rem 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 2rem;
    background: var(--gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.trending-carousel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    /* Changed from flex to grid for better SEO crawling */
}

.trending-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.trending-card:hover {
    transform: translateY(-3px);
}

.trending-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.trending-content {
    padding: 1.5rem;
}

.trending-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
    line-height: 1.4;
}

.trending-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.trending-title a:hover {
    color: var(--primary);
}

.trending-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}



.card-image-link-featured {
    display: block;
    text-decoration: none;
    color: inherit;
    width: 50%;
}

.card-image-link {
    display: block;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.articleTag-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    margin: 0.2rem 0.2rem 0.2rem 0;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    color: white;
}

/* Couleurs spécifiques par tag */
.articleTag-fundamental { background-color: #6c5ce7; }
.articleTag-synthesis { background-color: #00b894; }
.articleTag-fabrication { background-color: #fd79a8; }
.articleTag-electronics { background-color: #0984e3; }
.articleTag-computing { background-color: #d63031; }
.articleTag-energy { background-color: #e17055; }
.articleTag-environment { background-color: #00cec9; }
.articleTag-biotechnology { background-color: #55efc4; color: #000; }
.articleTag-health { background-color: #ff7675; }
.articleTag-industry { background-color: #fdcb6e; color: #000; }
.articleTag-construction { background-color: #e84393; }
.articleTag-nanotechnology { background-color: #0984e3; }
.articleTag-research { background-color: #636e72; }
.articleTag-market { background-color: #fab1a0; color: #000; }
.articleTag-innovation { background-color: #ffeaa7; color: #000; }

.articleTag-pill:hover {
    opacity: 0.85;
    cursor: pointer;
}


.section-title {
    color: var(--text);
    font-weight: 600;
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 2.5rem;
    margin-top: 3rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--tertiary));
    margin: 1rem auto 0;
    border-radius: 1px;
}

.newsletter {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    text-align: center;
    margin: 4rem 0;
    position: relative;
}

.newsletter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient);
    opacity: 0.03;
    border-radius: 24px;
    z-index: -1;
}

.newsletter-title {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 1rem;
    background: var(--gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.newsletter-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.newsletter-form {
    display: flex;
    gap: 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.newsletter-input {
    flex: 1;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.newsletter-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.newsletter-input::placeholder {
    color: var(--text-muted);
}

.newsletter-submit {
    padding: 1rem 2rem;
    background: var(--gradient);
    border: none;
    border-radius: 50px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.newsletter-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* ========================================
   SEO-Friendly Responsive Design
   ======================================== */

@media (max-width: 1200px) {
    .news-grid {
        grid-template-columns: 1fr 1fr;
    }

    .featured-card {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .hero {
        min-height: 25vh;
        padding: 1.5rem 1rem 1rem;
        margin-bottom: 0.5rem;
    }

    .hero-title {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .cta-button {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    .news-container {
        padding: 1rem 1rem 2rem;
    }

    .news-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .featured-card {
        grid-column: span 1;
    }

    .trending-carousel {
        grid-template-columns: 1fr;
    }

    .newsletter {
        padding: 2rem;
    }

    .newsletter-form {
        flex-direction: column;
        gap: 1rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .stats-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .hero {
        min-height: 20vh;
        padding: 1rem 1rem 0.5rem;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 0.85rem;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .card-content {
        padding: 1.25rem;
    }
}

/* ========================================
   SEO & Accessibility Optimizations
   ======================================== */

/* Reduced motion for accessibility and performance */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for SEO and accessibility */
.news-card:focus-within,
.trending-card:focus-within,
.cta-button:focus,
.newsletter-input:focus,
.newsletter-submit:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Print styles for content accessibility */
@media print {
    .hero,
    .newsletter {
        break-inside: avoid;
    }

    .news-card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }

    .card-image {
        max-height: 200px;
    }
}

/* High contrast support */
@media (prefers-contrast: high) {
    :root {
        --glass-border: rgba(255, 255, 255, 0.5);
        --text-muted: rgba(255, 255, 255, 0.9);
    }
}

/* ========================================
   Performance Hints
   ======================================== */

.card-image,
.trending-image {
    content-visibility: auto; /* Modern performance optimization */
}

.news-grid,
.stats-section,
.trending-carousel {
    contain: layout style; /* CSS containment for better rendering */
}

/* Critical above-the-fold optimization */
.hero-title,
.hero-subtitle,
.cta-button {
    font-display: swap; /* Ensure text visibility during font load */
}