/*
Theme Name: TechMinimal
Author: Your Name
Description: High-performance, SEO-optimized theme for tech tutorials.
Version: 1.1
*/

:root {
    /* Color Palette: Professional Slate & White */
    --bg-body: #ffffff;
    --bg-light: #f8f9fa;
    --text-main: #1a202c; /* Slate 900 */
    --text-muted: #4a5568; /* Slate 600 */
    --accent: #2b6cb0;     /* Professional Blue */
    --border: #e2e8f0;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-serif: 'Merriweather', Georgia, serif;
    
    /* Spacing */
    --container: 1100px;
    --gap: 2rem;
}

/* --- Base --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    color: var(--text-main);
    line-height: 1.6;
    background: var(--bg-body);
    transition: background 0.3s ease, color 0.3s ease; /* Smooth Dark Mode Transition */
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1rem;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #111;
}

/* High Legibility for Body Text */
.entry-content {
    font-family: var(--font-serif);
    font-size: 1.125rem; /* 18px for readability */
    color: #2d3748;
}

.entry-content h2, .entry-content h3 {
    font-family: var(--font-sans);
    margin-top: 2.5rem;
}

/* --- Header --- */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
    transition: border-color 0.3s ease;
}
.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.site-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.025em; color: var(--text-main); }

/* Navigation Alignment Fix */
.main-nav {
    display: flex;
    align-items: center;
}
.main-nav ul { display: flex; list-style: none; gap: 1.5rem; margin: 0; padding: 0; }

/* --- Grid Layout (Homepage) --- */
.hero-section {
    padding: 3rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 3rem;
}

.hero-post {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
    margin-bottom: 4rem;
}

.post-card h2 { font-size: 1.25rem; margin-top: 0.5rem; }
.meta-data { font-size: 0.875rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* --- Single Post Features --- */
.post-header { margin: 3rem 0; text-align: center; max-width: 800px; margin-left: auto; margin-right: auto; }
.post-header h1 { font-size: 2.5rem; }

.tutorial-meta {
    display: inline-flex;
    gap: 1.5rem;
    background: var(--bg-light);
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    font-size: 0.875rem;
    margin-top: 1rem;
    font-weight: 600;
}

/* Table of Contents */
.tech-toc {
    background: var(--bg-light);
    padding: 1.5rem;
    border-left: 4px solid var(--accent);
    margin: 2rem 0;
    font-family: var(--font-sans);
}
.toc-title { font-weight: 700; margin-bottom: 0.5rem; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.05em; }
.tech-toc ul { list-style: none; }
.tech-toc li { margin-bottom: 0.25rem; }
.tech-toc .toc-h3 { margin-left: 1.5rem; font-size: 0.95em; }

/* Code Blocks */
pre {
    border-radius: 8px;
    margin: 1.5rem 0;
    font-size: 0.9em;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-post { grid-template-columns: 1fr; }
    .post-header h1 { font-size: 2rem; }
    .main-nav ul { display: none; } /* Mobile menu handling would go here */
}

/* --- Footer --- */
.site-footer {
    background: var(--bg-light);
    border-top: 1px solid var(--border);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
    font-size: 0.95rem;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-col h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.5rem; }

.site-info {
    text-align: center;
    border-top: 1px solid #e2e8f0;
    padding-top: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* --- Full Width Template Overrides --- */
.page-header {
    text-align: center;
    padding: 3rem 0;
}
.page-header h1 {
    font-size: 3rem;
    font-weight: 800;
}

.page-content-full {
    font-family: var(--font-sans); 
    font-size: 1rem;
    line-height: 1.7;
    max-width: 100%;
}

.page-content-full img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* --- Search Form Styling --- */
.search-form {
    display: flex;
    align-items: center;
    max-width: 400px;
    position: relative;
}

.search-field {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 3rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    background: var(--bg-light);
    color: var(--text-main);
    transition: all 0.2s ease;
}

.search-field:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.search-submit {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-submit:hover {
    color: var(--accent);
}

/* 404 Page Search Bar Adjustment */
.error-404 .search-form {
    margin: 2rem auto; 
}

/* --- Dark Mode Variables --- */
body.dark-mode {
    --bg-body: #1a202c;       /* Dark Slate Background */
    --bg-light: #2d3748;      /* Lighter Slate for cards/sidebar */
    --text-main: #f7fafc;     /* Off-white text */
    --text-muted: #a0aec0;    /* Muted grey */
    --border: #4a5568;        /* Dark border */
    --accent: #63b3ed;        /* Lighter Blue for contrast on dark */
}

/* Adjustments for specific elements in Dark Mode */
body.dark-mode .site-header,
body.dark-mode .hero-section,
body.dark-mode .site-footer {
    border-color: var(--border);
}

body.dark-mode h1, 
body.dark-mode h2, 
body.dark-mode h3,
body.dark-mode .site-title {
    color: var(--text-main);
}

body.dark-mode .entry-content {
    color: #e2e8f0; 
}

body.dark-mode .search-field {
    background: var(--bg-light); 
    color: var(--text-main);
    border-color: var(--border);
}

body.dark-mode .tech-toc {
    background: var(--bg-light);
    border-left-color: var(--accent);
}

body.dark-mode .site-info {
    border-color: var(--border);
}

/* Toggle Button Styling */
#dark-mode-toggle {
    background: none;
    border: 2px solid transparent;
    cursor: pointer;
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.3s;
    margin-left: 1rem; 
    display: flex;
    align-items: center;
}

#dark-mode-toggle:hover {
    background: var(--bg-light);
}

/* Icon Swapping Logic */
body.dark-mode .icon-moon { display: none; }
body.dark-mode .icon-sun { display: block !important; }