
:root {
    /* Premium Color Palette (Green, Red, Black) */
    --primary: #10b981;
    --primary-light: #34d399;
    --primary-dark: #059669;
    --primary-text: #065f46; /* High contrast emerald for WCAG AA compliance */
    --secondary: #1e293b;
    --accent: #f43f5e;
    --black-deep: #020617;
    
    /* Light Mode */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-nav: rgba(255, 255, 255, 0.8);
    --text-main: #0f172a;
    --text-muted: #475569;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --glass: rgba(255, 255, 255, 0.7);
    
    /* Spacing & Borders */
    --radius-lg: 1.25rem;
    --radius-md: 0.75rem;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 4rem;
    
    /* Transitions */
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-body: #020617;
    --bg-card: #0f172a;
    --bg-nav: rgba(2, 6, 23, 0.8);
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --primary-text: #34d399; /* Vibrant mint green for high contrast dark mode */
    --border: #1e293b;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.8);
    --glass: rgba(15, 23, 42, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 10px;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

/* Header & Nav */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-nav);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    transition: var(--transition);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary-text) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo i {
    color: var(--primary-text);
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.4));
}

.nav-links {
    display: flex;
    gap: var(--spacing-md);
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-text);
}

/* Theme Toggle */
.menu-toggle {
    display: none;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--border);
}

.hidden {
    display: none !important;
}

.tool-card.hidden {
    display: none !important;
}

/* Hero Section */
.hero {
    padding: 6rem 0 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -10%;
    width: 60%;
    height: 100%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, transparent 70%);
    filter: blur(80px);
    z-index: -1;
    animation: float 20s infinite alternate;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -50%;
    right: -10%;
    width: 60%;
    height: 100%;
    background: radial-gradient(circle, rgba(244, 63, 94, 0.1) 0%, transparent 70%);
    filter: blur(80px);
    z-index: -1;
    animation: float 15s infinite alternate-reverse;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10%, 10%) scale(1.1); }
}

.hero h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.25rem;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--primary) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 2.5rem;
    line-height: 1.6;
}

/* Search Bar */
.search-container {
    max-width: 650px;
    margin: 0 auto 3rem;
    position: relative;
    z-index: 10;
}

.search-input {
    width: 100%;
    padding: 1.25rem 2rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 500;
    outline: none;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), var(--shadow-lg);
    transform: translateY(-2px);
}

/* Tool Grid & Sections */
.category-section {
    margin-bottom: 4rem;
    scroll-margin-top: 100px;
}

.category-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.category-title i {
    color: var(--primary);
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    background: rgba(16, 185, 129, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: var(--spacing-xl);
}

.tool-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(244, 63, 94, 0.05) 100%);
    opacity: 0;
    transition: var(--transition);
}

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

.tool-card:hover::before {
    opacity: 1;
}

.tool-icon {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(244, 63, 94, 0.05) 100%);
    color: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.tool-card:hover .tool-icon {
    transform: scale(1.1) rotate(5deg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.4);
}

.tool-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    z-index: 1;
}

.tool-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    z-index: 1;
}

/* Footer */
footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: var(--spacing-xl) 0 2rem;
    margin-top: var(--spacing-xl);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand .logo {
    margin-bottom: 1.25rem;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 350px;
    line-height: 1.6;
}

.footer-links h4 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.footer-links ul {
    list-style: none;
}

.footer-links ul li {
    margin-bottom: 0.75rem;
}

.footer-links ul li a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition);
}

.footer-links ul li a:hover {
    color: var(--primary-text);
    padding-left: 5px;
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-body);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.social-links a:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

/* Filter Tabs Styling */
.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.filter-btn {
    padding: 0.6rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

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

.filter-btn.active {
    background: var(--primary);
    color: #020617; /* Very dark slate for perfect 7.8:1 contrast ratio on emerald background */
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* Article Styling */
.article-container {
    background: var(--bg-card);
    border-radius: 2rem;
    padding: 4rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-width: 1000px;
    margin: 0 auto;
}

.article-header {
    text-align: center;
    margin-bottom: 3rem;
}

.article-badge {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(244, 63, 94, 0.1) 100%);
    color: var(--primary-text); /* Theme-aware WCAG contrast emerald */
    padding: 0.5rem 1.25rem;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.article-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.article-meta {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.article-body h3 {
    font-size: 1.75rem;
    margin: 2.5rem 0 1.25rem;
    color: var(--text-main);
}

.article-body h4 {
    font-size: 1.25rem;
    margin: 2rem 0 1rem;
    color: var(--text-main);
}

.article-body p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.article-highlight {
    background: var(--bg-body);
    border-left: 4px solid var(--primary);
    border-image: linear-gradient(to bottom, var(--primary), var(--accent)) 1 100%;
    padding: 2rem;
    border-radius: 0 1rem 1rem 0;
    margin: 3rem 0;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.article-highlight i {
    font-size: 2rem;
    color: var(--primary-text); /* High contrast green */
}

.article-highlight h4 {
    margin-top: 0;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.article-item {
    background: var(--bg-body);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    border: 1px solid var(--border);
}

.article-item i {
    font-size: 2rem;
    color: var(--primary-text); /* High contrast green */
    margin-bottom: 1.25rem;
}

.article-item h5 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.article-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.article-footer a {
    color: var(--primary-text); /* High contrast link */
    font-weight: 700;
    text-decoration: none;
    border-bottom: 2px solid rgba(99, 102, 241, 0.2);
    transition: var(--transition);
}

.article-footer a:hover {
    border-bottom-color: var(--primary);
}

/* Updated Animations */
@keyframes fadeInUpPoppy {
    from { 
        opacity: 0; 
        transform: translateY(40px) scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

.animate-fade-in {
    animation: fadeInUpPoppy 0.8s cubic-bezier(0.2, 0.8, 0.2, 1.1) forwards;
}

.tool-card {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tool-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Staggered transition delay for visible cards */
.tool-grid .tool-card:nth-child(1) { transition-delay: 0.05s; }
.tool-grid .tool-card:nth-child(2) { transition-delay: 0.1s; }
.tool-grid .tool-card:nth-child(3) { transition-delay: 0.15s; }
.tool-grid .tool-card:nth-child(4) { transition-delay: 0.2s; }
.tool-grid .tool-card:nth-child(5) { transition-delay: 0.25s; }
.tool-grid .tool-card:nth-child(6) { transition-delay: 0.3s; }
.tool-grid .tool-card:nth-child(n+7) { transition-delay: 0.35s; }

/* FAQ Section */
.faq-section {
    margin-top: 6rem;
    padding-bottom: 6rem;
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-header {
    text-align: center;
    margin-bottom: 3rem;
}

.faq-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: var(--transition);
}

.faq-item:hover {
    border-color: var(--primary);
}

.faq-question {
    width: 100%;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.faq-question i {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question {
    color: var(--primary);
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
    color: var(--primary);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
}

.faq-item.active .faq-answer {
    max-height: 500px;
    padding: 0 1.5rem 1.5rem;
}

.faq-answer p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 1rem;
}

[data-theme="dark"] .faq-answer {
    background: rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
        background: none;
        border: none;
        color: var(--text-main);
        font-size: 1.5rem;
        cursor: pointer;
        order: 2;
    }

    .theme-toggle {
        order: 3;
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--bg-body);
        padding: 2rem;
        gap: 2rem;
        transition: var(--transition);
        z-index: 999;
        border-top: 1px solid var(--border);
    }

    .nav-links.active {
        left: 0;
    }

    .nav-links li a {
        font-size: 1.25rem;
        width: 100%;
        display: block;
    }

    .hero h1 {
        font-size: 2.5rem;
    }
    
    .tool-grid {
        grid-template-columns: 1fr;
    }
    
    .article-container {
        padding: 2rem;
    }
    
    .article-header h2 {
        font-size: 1.75rem;
    }
}
