/* --- Base Styles and Layout (Consolidated) --- */

body {
    font-family: Arial, sans-serif;
    background-color: #0d1117;
    color: #c9d1d9;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

header {
    background: #161b22;
    padding: 40px 20px;
    text-align: center;
    position: relative;
}

header h1 {
    color: #58a6ff;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

header p {
    font-size: 1.1rem;
    color: #8b949e;
    transition: color 0.3s ease;
}

nav {
    text-align: center;
    background: #21262d;
    padding: 10px;
}

nav a {
    color: #58a6ff;
    margin: 0 15px;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

nav a:hover {
    color: #ff9800;
}

section {
    padding: 40px 20px;
    max-width: 800px;
    margin: auto;
}

h2 {
    color: #58a6ff;
    margin-bottom: 20px;
    text-align: center;
}

ul {
    list-style: none;
    padding: 0;
}

ul li {
    margin: 10px 0;
}

ul li a {
    color: #c9d1d9;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

ul li a:hover {
    color: #58a6ff;
}

footer {
    text-align: center;
    background: #161b22;
    color: #8b949e;
    padding: 20px;
    margin-top: 40px;
}

/* --- Utility Classes & Elements --- */

/* Avatar */
.avatar {
    width: 150px !important;
    height: 150px !important;
    border-radius: 50% !important;
    object-fit: cover;
    display: block;
    margin: 0 auto 20px auto;
    border: 3px solid #58a6ff;
}

/* General Button (for Theme Toggle) */
.btn {
    display: inline-block;
    margin: 10px;
    padding: 10px 20px;
    background: #58a6ff;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    transition: transform 0.3s ease, background 0.3s ease;
}

.btn:hover {
    transform: scale(1.05);
    background: #0066cc;
}

/* Theme Toggle Button */
#theme-toggle {
    position: absolute;
    top: 15px;
    right: 20px;
    padding: 8px 12px;
    font-size: 14px;
}

/* --- Project Cards (The Fix is Here) --- */

.projects-grid {
    display: grid;
    /* Using the more detailed grid settings from the top block */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px; /* Using 20px gap for better spacing */
    margin-top: 20px;
}

.card {
    /* CONSOLIDATED STYLES: Blending properties from both card versions */
    background: #21262d;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, background 0.3s ease;
    
    /* FLEXBOX STRUCTURE FOR EQUAL HEIGHTS (Crucial for the fix) */
    display: flex;
    flex-direction: column;
    
    /* Removed justify-content: space-between; as flex-grow is better */
    min-height: 230px; 
    box-sizing: border-box;
    text-align: center; /* Keeping text aligned centrally */
}

.card:hover {
    transform: translateY(-8px);
    background: #2c313a;
}

.card h3 {
    margin-bottom: 10px;
    color: #58a6ff;
    font-size: 18px;
    word-break: break-word;
}

.card p {
    color: #c9d1d9;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    /* THIS IS THE FINAL FIX for the alignment issue */
    flex-grow: 1; 
}

/* Project Buttons */
.project-btn {
    display: inline-block;
    margin-top: auto; /* This line is only needed if .card is not a flex container, but keep it as a fallback */
    padding: 10px 20px;
    background: #58a6ff;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: transform 0.2s ease, background 0.3s ease;
}

.project-btn:hover {
    transform: scale(1.05);
    background: #0066cc;
}

/* --- Theme Specific Styles --- */

/* Light Mode */
body.light-mode {
    background-color: #ffffff;
    color: #0d1117;
}

body.light-mode header {
    background: #f5f5f5;
}

body.light-mode nav {
    background: #eaeaea;
}

body.light-mode h2,
body.light-mode a {
    color: #0066cc;
}

/* Change title color in light mode */
body.light-mode header h1 {
    color: #0056b3;
}

/* Make subtitle darker in light mode */
body.light-mode header p {
    color: #333;
}

/* Light Mode Project Button */
body.light-mode .project-btn {
    background: #0066cc;
    color: #fff;
}
body.light-mode .project-btn:hover {
    background: #004999;
}


/* --- Social Buttons (Dark and Light) --- */

/* Social Buttons Base */
.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 10px;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s, color 0.3s, border 0.3s;
    border: 2px solid transparent;
}

/* Dark Mode Socials (Default) */
body:not(.light-mode) .email-btn {
    background: #2c2c2c;
    border-color: #ff6b6b;
    color: #ff6b6b;
}
body:not(.light-mode) .email-btn:hover {
    background: #ff6b6b;
    color: #fff;
}

body:not(.light-mode) .github-btn {
    background: #2c2c2c;
    border-color: #c9d1d9;
    color: #c9d1d9;
}
body:not(.light-mode) .github-btn:hover {
    background: #c9d1d9;
    color: #000;
}

body:not(.light-mode) .linkedin-btn {
    background: #2c2c2c;
    border-color: #58a6ff;
    color: #58a6ff;
}
body:not(.light-mode) .linkedin-btn:hover {
    background: #58a6ff;
    color: #000;
}

/* Light Mode Socials (Overrides) */
body.light-mode .email-btn {
    background: #fff;
    border-color: #d93025;
    color: #d93025;
}
body.light-mode .email-btn:hover {
    background: #d93025;
    color: #fff;
}

body.light-mode .github-btn {
    background: #fff;
    border-color: #333;
    color: #333;
}
body.light-mode .github-btn:hover {
    background: #333;
    color: #fff;
}

body.light-mode .linkedin-btn {
    background: #fff;
    border-color: #0077b5;
    color: #0077b5;
}
body.light-mode .linkedin-btn:hover {
    background: #0077b5;
    color: #fff;
}
