/* =========================================
   1. COLOR VARIABLES (THEMING)
   ========================================= */
:root {
    /* --- LIGHT MODE (DEFAULT) --- */
    --bg-body: #f8fafc;       /* Light Grey Background */
    --bg-nav: #ffffff;        /* White Navbar */
    --bg-card: #ffffff;       /* White Cards */
    
    /* Code blocks usually look best dark, even in light mode */
    --bg-code: #1e293b;       /* Dark Slate */
    
    --text-main: #334155;     /* Dark Grey Text */
    --text-header: #0f172a;   /* Black/Navy Headers */
    --text-muted: #64748b;    /* Muted Text */
    --text-code: #e2e8f0;     /* Light text for code blocks */

    --border-color: #e2e8f0;  /* Light Borders */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);

    --primary: #2563eb;       /* Blue 600 */
    --primary-hover: #1d4ed8; /* Blue 700 */
    --accent-red: #dc2626;

    --ad-bg: #f1f5f9;
    --ad-border: #cbd5e1;
}

/* --- DARK MODE OVERRIDES --- */
[data-theme="dark"] {
    --bg-body: #0f172a;       /* Slate 950 */
    --bg-nav: #1e293b;        /* Slate 800 */
    --bg-card: #1e293b;       /* Slate 800 */
    --bg-code: #020617;       /* Darker Slate */

    --text-main: #cbd5e1;     /* Light Grey Text */
    --text-header: #f8fafc;   /* White Headers */
    --text-muted: #94a3b8;    /* Muted Text */

    --border-color: #334155;  /* Dark Borders */
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

    --primary: #3b82f6;       /* Blue 500 */
    --primary-hover: #60a5fa; /* Blue 400 */
    
    --ad-bg: #1e293b;
    --ad-border: #475569;
}

/* =========================================
   2. GLOBAL RESET & BASE
   ========================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a { text-decoration: none; color: inherit; transition: color 0.2s; }
img { max-width: 100%; display: block; }

/* Wrapper to center content */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

/* =========================================
   3. NAVBAR & FOOTER
   ========================================= */
.navbar {
    background-color: var(--bg-nav);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

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

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-header);
    letter-spacing: -0.05em;
    flex-shrink: 0; 
}
.brand-accent { color: var(--primary); }

.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-link { font-weight: 500; color: var(--text-main); font-size: 0.95rem; }
.nav-link:hover { color: var(--primary); }

.btn-youtube {
    color: var(--accent-red);
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap; 
}
.btn-youtube:hover { opacity: 0.8; }

/* THEME TOGGLE BUTTON */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    transition: all 0.2s;
    flex-shrink: 0;
}
.theme-toggle-btn:hover { background-color: var(--border-color); }

/* --- MOBILE HEADER FIXES --- */
@media (max-width: 640px) {
    .nav-brand {
        font-size: 1.25rem;
    }
    
    .nav-link {
        display: none;
    }

    .nav-links {
        gap: 0.75rem;
    }

    .btn-youtube {
        font-size: 0.9rem;
    }

    .theme-toggle-btn {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }
}

.footer {
    background-color: var(--bg-nav);
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-socials {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 0 !important;
}

@media (min-width: 768px) {
    .footer .container {
        flex-direction: row;
        justify-content: center;
        gap: 1.5rem;
    }

    .footer p {
        margin: 0;
        display: flex;
        align-items: center;
    }

    .footer p::after {
        content: "|";
        margin-left: 1.5rem;
        color: var(--border-color);
    }
}

.social-link img {
    width: 24px;
    height: 24px;
    transition: transform 0.2s ease, opacity 0.2s;
    opacity: 0.7;
}

.social-link:hover img {
    transform: translateY(-3px);
    opacity: 1;
}

/* =========================================
   4. LAYOUTS (Grid & Flex)
   ========================================= */
.layout-split {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    padding: 2rem 0;
}

@media (min-width: 1024px) {
    .layout-split { flex-direction: row; }
    .content-col { width: 70%; }
    .sidebar-col { width: 30%; }
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

/* =========================================
   5. CARDS & UI ELEMENTS
   ========================================= */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.card-img-wrapper { aspect-ratio: 16/9; overflow: hidden; position: relative; }
.card-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.card:hover .card-img { transform: scale(1.05); }

.card-body { padding: 1.5rem; }
.card-meta { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; font-size: 0.75rem; color: var(--text-muted); }
.card-tag { 
    background-color: rgba(59, 130, 246, 0.1); 
    color: var(--primary); 
    padding: 0.1rem 0.5rem; 
    border-radius: 4px; 
    font-weight: 700; 
}

.card-title { font-size: 1.25rem; font-weight: 700; color: var(--text-header); margin-bottom: 0.5rem; line-height: 1.3; }
.card-desc { font-size: 0.9rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Ad Slots */
.ad-slot {
    background-color: var(--ad-bg);
    border: 2px dashed var(--ad-border);
    display: flex; justify-content: center; align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px;
    border-radius: 0.5rem;
}
.ad-header { height: 90px; width: 100%; margin-top: 1.5rem; }
.ad-sidebar { aspect-ratio: 1/1; width: 100%; margin-bottom: 1.5rem; }
.ad-bottom { height: 120px; width: 100%; margin-top: 2rem; }

/* =========================================
   6. ARTICLE TYPOGRAPHY (Your Content)
   ========================================= */
.article-header { margin-bottom: 2rem; }
.article-h1 { font-size: 2.5rem; font-weight: 800; color: var(--text-header); line-height: 1.1; margin-bottom: 1rem; }

/* Video Container */
.video-container {
    aspect-ratio: 16/9;
    background-color: black;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow);
}
.video-iframe { width: 100%; height: 100%; }

/* Recommendation Box */
.rec-box {
    background-color: rgba(37, 99, 235, 0.1); /* Light blue bg */
    border-left: 4px solid var(--primary);
    padding: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
    margin-bottom: 2rem;
    color: var(--text-main);
    font-weight: 500;
}

/* Article Body Styles */
.article-text { font-size: 1.125rem; line-height: 1.8; color: var(--text-main); margin-bottom: 1.5rem; }
.article-h2 { font-size: 1.75rem; font-weight: 700; color: var(--text-header); margin-top: 2.5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.article-h3 { font-size: 1.4rem; font-weight: 600; color: var(--primary); margin-top: 2rem; margin-bottom: 0.75rem; }
.article-list { list-style: disc inside; margin-bottom: 1.5rem; color: var(--text-main); padding-left: 1rem; }
.article-list li { margin-bottom: 0.5rem; }

/* Sidebar Links */
.sidebar-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 0.75rem;
}
.sidebar-title { font-weight: 700; color: var(--text-header); margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.sidebar-list { list-style: none; }
.sidebar-list li a { display: block; padding: 0.5rem 0; color: var(--text-muted); font-size: 0.95rem; }
.sidebar-list li a:hover { color: var(--primary); padding-left: 5px; }

/* Callouts */
.callout { padding: 1rem; border-left-width: 4px; border-radius: 0 0.5rem 0.5rem 0; margin-bottom: 1.5rem; background-color: var(--bg-card); border: 1px solid var(--border-color); }
.callout.info { border-left-color: var(--primary); }
.callout.success { border-left-color: var(--accent-green); }
.callout-title { display: block; font-weight: 700; color: var(--text-header); margin-bottom: 0.25rem; }

/* Utilities */
.hero-center { text-align: center; padding: 4rem 0 2rem; }
.hero-title { font-size: 3rem; font-weight: 800; color: var(--text-header); margin-bottom: 1rem; }
.hero-sub { font-size: 1.25rem; color: var(--text-muted); }

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 768px) {
    .hero-title { font-size: 2.25rem; }
    .hero-sub { font-size: 1.1rem; }
}