/* ============================================
   MODERN CSS IMPROVEMENTS
   ============================================ */

/* Apply Modern Font Families */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', Georgia, serif;
}

/* Logo gets special tech font treatment */
.logo {
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace !important;
}

/* 1. Better Typography & Spacing with Gradient Header */
.header-top {
    background: linear-gradient(135deg, #5a6c7d 0%, #4a5968 100%);
    color: white;
    padding: 3rem 0;
    position: relative;
    overflow: hidden;
}

.header-top .logo {
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
    font-size: 3.5rem;
    color: white;
    letter-spacing: 0.2rem;
    text-shadow: 0 0 10px rgba(100,200,255,0.5), 2px 2px 4px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, text-shadow 0.3s ease;
    font-weight: 700;
    text-transform: uppercase;
}

.header-top .logo:hover {
    transform: scale(1.05);
    text-decoration: none;
    text-shadow: 0 0 20px rgba(100,200,255,0.8), 2px 2px 4px rgba(0,0,0,0.3);
}

.header-top .tagline {
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
    letter-spacing: 2px;
    font-style: normal;
}

/* 2. Better Navigation with Animated Underlines */
nav {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav a {
    position: relative;
    transition: all 0.3s ease;
}

nav a:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #667eea;
    transition: width 0.3s ease;
}

nav a:hover:after {
    width: 100%;
}

/* 3. Article Cards with Better Depth and Hover Effects */
.article-card {
    background: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.article-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.article-card:hover:before {
    transform: translateX(0);
}

/* 4. Colorful Category Tags with Gradients */
.article-tag {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 0.35rem 1rem;
    border: none;
    transition: transform 0.3s ease;
}

.article-tag:hover {
    transform: scale(1.1);
}

/* Different gradient colors for different categories */
.article-tag.climate {
    background: linear-gradient(135deg, #11998e, #38ef7d);
}

.article-tag.ai-safety {
    background: linear-gradient(135deg, #fc466b, #3f5efb);
}

.article-tag.governance {
    background: linear-gradient(135deg, #ee0979, #ff6a00);
}

.article-tag.philosophy {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

/* 5. Better Sidebar with Shadow and Accent */
.sidebar-section {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid #667eea;
    transition: transform 0.3s ease;
}

.sidebar-section:hover {
    transform: translateX(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.update-note {
    padding: 1rem;
    background: #f8f9ff;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

/* 6. Hero Section with Background Pattern */
.hero {
    background: 
        linear-gradient(135deg, rgba(102,126,234,0.1) 0%, rgba(118,75,162,0.1) 100%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    padding: 4rem 0;
}

/* 7. Modern Buttons with Shine Effect */
.read-more {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(102,126,234,0.3);
}

.read-more:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.2);
    transition: left 0.5s;
}

.read-more:hover:before {
    left: 100%;
}

.read-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102,126,234,0.4);
}

/* 8. Fade In Animation for Cards */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.article-card {
    animation: fadeIn 0.6s ease-out;
    animation-fill-mode: both;
}

.article-card:nth-child(1) { animation-delay: 0.1s; }
.article-card:nth-child(2) { animation-delay: 0.2s; }
.article-card:nth-child(3) { animation-delay: 0.3s; }
.article-card:nth-child(4) { animation-delay: 0.4s; }
.article-card:nth-child(5) { animation-delay: 0.5s; }
.article-card:nth-child(6) { animation-delay: 0.6s; }

/* 9. Newsletter Section with Pattern Background */
.newsletter-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.newsletter-section:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.133 7-7s-3.134-7-7-7-7 3.133-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.133 7-7s-3.134-7-7-7-7 3.133-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.3;
}

.newsletter-section .container {
    position: relative;
    z-index: 1;
}

.newsletter-form button {
    background: white;
    color: #667eea;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.newsletter-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* 10. Enhanced Footer */
footer {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

/* 11. Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* 12. Loading Spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    border: 3px solid rgba(102,126,234,0.1);
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

/* 13. Enhanced Links */
a {
    position: relative;
    color: #667eea;
    transition: all 0.3s ease;
}

.article-body a:hover {
    color: #764ba2;
}

/* 14. Better Blockquotes */
blockquote {
    position: relative;
    padding-left: 3rem;
    border-left: 4px solid linear-gradient(135deg, #667eea, #764ba2);
}

blockquote:before {
    content: '"';
    position: absolute;
    left: 10px;
    top: -10px;
    font-size: 3rem;
    color: #667eea;
    opacity: 0.3;
}

/* 15. Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* 16. Selection Color */
::selection {
    background: #667eea;
    color: white;
}

::-moz-selection {
    background: #667eea;
    color: white;
}

/* 17. Focus Styles for Accessibility */
*:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* 18. Enhanced Form Inputs */
input[type="text"],
input[type="email"],
textarea {
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

/* 19. Article Image Enhancement */
.article-image img {
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.article-image img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* 20. Code Block Styling */
pre, code {
    background: #f4f4f7;
    border-radius: 4px;
    padding: 0.2em 0.4em;
    font-family: 'Courier New', monospace;
}

pre {
    padding: 1rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

/* 21. Table Styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
    font-weight: 600;
}

/* 22. Pulse Animation for New Content */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102,126,234,0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(102,126,234,0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102,126,234,0);
    }
}

.new-content {
    animation: pulse 2s infinite;
}

/* 23. Print Styles */
@media print {
    .header-top {
        background: none;
        color: black;
    }
    
    nav, .sidebar, .newsletter-section, footer {
        display: none;
    }
    
    .article-body {
        max-width: 100%;
    }
}