:root {
    /* Authentic GitHub Dark Theme Palette */
    --primary: #c9d1d9;       /* Main text color */
    --accent: #58a6ff;        /* GitHub blue links */
    --title-color: #ffffff;   /* White section titles */
    --bg: #0d1117;            /* Main background */
    --light-gray: #161b22;    /* Sidebar & Card background */
    --border-color: #30363d;  /* Subtle borders */
    --header-bg: #010409;     /* Header/Footer background */
}

/* Global reset: Fixes the width gap and enables flex height */
* {
    box-sizing: border-box;
}

html { 
    scroll-behavior: smooth; 
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--primary);
    background-color: var(--bg);
    line-height: 1.5;
    /* Sticky Footer Logic */
    display: flex;
    flex-direction: column;
    min-height: 100vh; 
}

/* --- LINKS --- */
a { 
    color: var(--accent); 
    text-decoration: none; 
}

a:hover { 
    text-decoration: underline; 
}

/* --- HEADER --- */
header {
    background: var(--header-bg);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

nav a { 
    color: var(--primary); 
    margin-left: 20px; 
    font-weight: 600; 
}

/* --- LAYOUT LOGIC --- */

/* 1. Sidebar Layout (Used for CV & Tips) */
.page-wrapper, .cv-container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    gap: 30px;
    align-items: flex-start;
    flex: 1; /* Pushes footer down */
}

/* 2. Centered Layout (Used for Home & Research) */
.center-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 80px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1; /* Pushes footer down on pages with low content */
}

.main-content, .content-body { 
    flex: 1; 
    min-width: 0; 
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* --- SIDEBAR --- */
.sidebar {
    flex: 0 0 280px;
    background: var(--light-gray);
    padding: 25px;
    border-radius: 6px;
    position: sticky;
    top: 100px;
    border: 1px solid var(--border-color);
}

.sidebar p {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    font-size: 0.9rem;
}

/* --- SKILLS & TAGS --- */
.skill-group { 
    margin-bottom: 20px; 
}

.skill-group strong { 
    display: block; 
    margin-bottom: 8px; 
    color: #ffffff; 
    font-size: 0.9rem; 
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-tag {
    background: var(--border-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--accent);
    border: 1px solid transparent;
}

/* --- CV ITEM CARDS --- */
.cv-item { 
    margin-bottom: 20px; 
    border-left: 4px solid var(--accent); 
    padding: 20px;                        
    background: var(--light-gray);        
    border-radius: 0 6px 6px 0;           
    text-align: left;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent);
    transition: background 0.2s ease;
    width: 100%;
}

.cv-item:hover {
    background: #1c2128; 
}

.cv-item h3 {
    margin: 0 0 5px 0;
    color: #ffffff;
    font-size: 1.2rem;
}

.cv-date { 
    color: var(--accent); 
    font-weight: bold; 
    font-size: 0.9rem; 
    display: block;
    margin-bottom: 5px;
}

/* --- SECTION HEADERS --- */
.section-title {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin: 30px 0 15px 0;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: #8b949e;
    font-weight: 600;
}

/* --- TIPS BANNER --- */
.section-banner {
    background-color: #000000;
    padding: 40px 20px;
    border-radius: 6px;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-color);
    width: 100%;
}

.section-banner h2 {
    color: #ffffff;
    margin: 0;
    font-size: 2.2rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-align: center;
}

/* --- GENERAL UTILITIES --- */
.tip-group, .summary-box {
    background: var(--light-gray);
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    width: 100%;
}

pre {
    background: #0d1117;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 85%;
    overflow-x: auto;
}

code { color: #ff7b72; } 

.inline-code {
    background: rgba(110,118,129,0.4);
    padding: 0.2em 0.4em;
    border-radius: 6px;
}

/* --- FOOTER FIX --- */
footer { 
    padding: 40px; 
    border-top: 1px solid var(--border-color); 
    text-align: center; 
    background-color: var(--header-bg);
    margin-top: auto; /* Ensures footer is pushed to the bottom in flex containers */
    width: 100%;
}

.footer-links {
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-copyright {
    font-size: 0.85rem;
    color: #8b949e;
}

@media (max-width: 768px) {
    .page-wrapper, .cv-container { flex-direction: column; }
    .sidebar { width: 100%; position: static; }
}