/* Theme Variables */
:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-card: #181818;
    --accent-gold: #d4af37;
    --accent-coral: #ff6b6b;
    --accent-cyan: #4ecdc4;
    --text-primary: #f5f5f5;
    --text-secondary: #b0b0b0;
    --text-dim: #707070;
    --border: #2a2a2a;
}

[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --accent-gold: #b8860b;
    --accent-coral: #e63946;
    --accent-cyan: #2a9d8f;
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --text-dim: #718096;
    --border: #e2e8f0;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'IBM Plex Sans', sans-serif;
    line-height: 1.7;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(78, 205, 196, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 107, 107, 0.05) 0%, transparent 60%);
    z-index: -2;
    animation: bgPulse 20s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Grain texture */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    z-index: -1;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Hero Section */
.hero {
    position: relative;
    padding: 8rem 2rem 6rem;
    text-align: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(212, 175, 55, 0.15) 0%,
        rgba(255, 107, 107, 0.1) 50%,
        rgba(78, 205, 196, 0.12) 100%);
    z-index: -1;
    animation: heroGradient 15s ease infinite;
}

@keyframes heroGradient {
    0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
    50% { opacity: 0.8; transform: scale(1.1) rotate(2deg); }
}

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-coral));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.8s ease-out;
}

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

.hero p {
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    font-weight: 300;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

main {
    padding: 4rem 0;
}

/* Filter Section */
.filter-section {
    margin-bottom: 4rem;
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

.search-wrapper {
    position: relative;
    max-width: 600px;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.search-input::placeholder {
    color: var(--text-dim);
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 1.1rem;
}

/* Category Pills */
.category-pills {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.category-pill {
    padding: 0.6rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.category-pill:hover,
.category-pill.active {
    background: var(--accent-gold);
    color: var(--bg-primary);
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}

/* Grid Layout */
.blog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.main-content {
    animation: fadeInUp 0.6s ease-out 0.6s both;
}

/* Featured Article */
.featured-article {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3rem;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
}

.featured-article::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-coral));
    opacity: 0;
    transition: opacity 0.4s ease;
}

.featured-article:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 60px rgba(212, 175, 55, 0.2);
}

.featured-article:hover::before {
    opacity: 0.05;
}

.featured-badge {
    display: inline-block;
    background: var(--accent-gold);
    color: var(--bg-primary);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.article-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
    position: relative;
    z-index: 1;
}

.article-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.article-meta .author {
    color: var(--accent-coral);
    font-weight: 500;
}

.article-excerpt {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 2rem;
    background: transparent;
    color: var(--accent-gold);
    border: 2px solid var(--accent-gold);
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    z-index: 1;
}

.read-more-btn:hover {
    background: var(--accent-gold);
    color: var(--bg-primary);
    transform: translateX(5px);
}

.read-more-btn i {
    transition: transform 0.3s ease;
}

.read-more-btn:hover i {
    transform: translateX(5px);
}

/* Articles Grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.4s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 0;
    background: var(--accent-cyan);
    transition: height 0.4s ease;
}

.article-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-cyan);
    box-shadow: 0 20px 50px rgba(78, 205, 196, 0.2);
}

.article-card:hover::before {
    height: 100%;
}

.article-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.article-card .article-meta {
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.article-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.article-card .read-more-btn {
    padding: 0.5rem 1.5rem;
    font-size: 0.85rem;
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.article-card .read-more-btn:hover {
    background: var(--accent-cyan);
}

/* Sidebar */
.sidebar {
    animation: fadeInUp 0.6s ease-out 0.8s both;
}

.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.sidebar-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent-gold);
}

.category-list {
    list-style: none;
}

.category-list li {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-list li:last-child {
    border-bottom: none;
}

.category-list li:hover {
    color: var(--accent-gold);
    padding-left: 0.5rem;
}

.category-list i {
    color: var(--accent-gold);
    font-size: 1.1rem;
}

.recent-posts {
    list-style: none;
}

.recent-posts li {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.recent-posts li:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.recent-posts a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.recent-posts a::before {
    content: '→';
    color: var(--accent-coral);
    font-weight: bold;
    flex-shrink: 0;
}

.recent-posts a:hover {
    color: var(--accent-coral);
}

/* Newsletter */
.newsletter-card {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    border: 1px solid var(--accent-gold);
    position: relative;
    overflow: hidden;
}

.newsletter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-coral));
    opacity: 0.05;
}

.newsletter-card h3 {
    color: var(--accent-gold);
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.newsletter-input {
    padding: 0.8rem 1.2rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.newsletter-input:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.newsletter-btn {
    padding: 0.8rem 1.5rem;
    background: var(--accent-gold);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.newsletter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.3);
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 3rem 0 2rem;
    margin-top: 6rem;
    text-align: center;
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
}

.social-icon {
    width: 45px;
    height: 45px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-icon:hover {
    background: var(--accent-gold);
    color: var(--bg-primary);
    border-color: var(--accent-gold);
    transform: translateY(-5px);
}

.copyright {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-top: 2rem;
}

/* Loading Animation */
.article-card,
.featured-article {
    animation: fadeInScale 0.5s ease-out both;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.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; }

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: translateY(-5px) rotate(15deg);
    box-shadow: 0 15px 50px rgba(212, 175, 55, 0.3);
    border-color: var(--accent-gold);
}

.theme-toggle i {
    font-size: 1.5rem;
    color: var(--accent-gold);
    transition: transform 0.3s ease;
}

.theme-toggle:hover i {
    transform: scale(1.1);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

[data-theme="dark"] .theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="light"] .theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="light"] .theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
}

/* Add transitions to all theme-dependent elements */
.hero,
.featured-article,
.article-card,
.sidebar-card,
.search-input,
.category-pill,
.social-icon,
footer {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Light theme specific adjustments */
[data-theme="light"] .hero::before {
    background: linear-gradient(135deg, 
        rgba(184, 134, 11, 0.15) 0%,
        rgba(230, 57, 70, 0.1) 50%,
        rgba(42, 157, 143, 0.12) 100%);
}

[data-theme="light"] body::before {
    background: 
        radial-gradient(circle at 20% 20%, rgba(184, 134, 11, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(42, 157, 143, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(230, 57, 70, 0.05) 0%, transparent 60%);
}

[data-theme="light"] .featured-article,
[data-theme="light"] .article-card,
[data-theme="light"] .sidebar-card {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .featured-article:hover,
[data-theme="light"] .article-card:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (min-width: 1024px) {
    .blog-grid {
        grid-template-columns: 1fr 350px;
        gap: 4rem;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 5rem 1.5rem 4rem;
    }

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

    .container {
        padding: 0 1.5rem;
    }

    main {
        padding: 3rem 0;
    }

    .featured-article {
        padding: 2rem;
    }

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

    .category-pills {
        justify-content: center;
    }

    .filter-section {
        text-align: center;
    }

    .search-wrapper {
        margin: 0 auto;
    }

    .theme-toggle {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 50px;
        height: 50px;
    }

    .theme-toggle i {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    .featured-article,
    .article-card,
    .sidebar-card {
        padding: 1.5rem;
    }

    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

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

/* Selection */
::selection {
    background: var(--accent-gold);
    color: var(--bg-primary);
}