/* --- 1. Root Variables & Reset --- */
:root {
    --primary-bg: #0d0d0d;
    --secondary-bg: #1a1a1a;
    --card-bg: rgba(30, 30, 30, 0.7);
    --text-light: #f5f5f5;
    --text-accent: #a0a0a0;
    --accent-color: #bb86fc;
    --border-color: rgba(187, 134, 252, 0.2);
    --shadow-dark: rgba(0, 0, 0, 0.8);
    --shadow-glow: rgba(187, 134, 252, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Open Sans', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-light);
    line-height: 1.7;
    overflow-x: hidden;
}

/* --- 2. Typography (Refined for Subtlety) --- */
h1, h2, h3, h4 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

p {
    font-weight: 300;
    color: var(--text-light);
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

/* --- 3. Header & Navigation Fixes --- */
header {
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(12px);
    padding: 0 5%;
    height: 100px; 
    display: flex;
    justify-content: space-between; /* This keeps them on opposite sides */
    align-items: center; /* FIX: This ensures logo and text are perfectly centered vertically */
    position: fixed; 
    top: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center; /* FIX: Centers the image inside the logo div[cite: 3] */
}

.logo img {
    height: 75px; 
    width: auto;
    display: block; /* FIX: Removes extra bottom spacing[cite: 3] */
    transition: transform 0.4s ease;
    filter: drop-shadow(0 0 5px var(--shadow-glow)); 
}

.logo img:hover {
    transform: rotate(-2deg) scale(1.05); /* Interactive[cite: 1, 5] */
}

/* Desktop Nav */
nav ul {
    list-style: none;
    display: flex;
    gap: 2.5rem;
}

nav a {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-light);
    position: relative;
    padding-bottom: 5px;
}

nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    bottom: 0;
    left: 0;
    transition: width 0.3s ease;
}

nav a:hover::after {
    width: 100%;
}

/* --- 4. Hamburger Menu Logic --- */
.menu-icon {
    display: none; /* Hidden on desktop */
    cursor: pointer;
    font-size: 2.2rem;
    color: var(--accent-color);
    z-index: 1100; /* Keep this high to stay above the sliding menu[cite: 3] */
    position: relative; 
}

/* --- 5. Main Layout & Section Polish --- */
main {
    margin-top: 100px; /* Matches header height[cite: 3, 5] */
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 2rem;
}

section {
    background-color: var(--secondary-bg);
    padding: 5rem 3rem;
    border-radius: 24px;
    box-shadow: 0 15px 35px var(--shadow-dark);
    margin-bottom: 4rem;
    border: 1px solid var(--border-color);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s forwards;
}

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    text-align: center;
    font-size: 2.5rem; /* Reduced for better balance[cite: 3, 5] */
    font-weight: 600;
    margin-bottom: 4rem;
    text-transform: uppercase;
    background: linear-gradient(to right, #ffffff, var(--accent-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- 6. Projects Section Specific Fixes --- */
.projects-grid {
    margin-top: 2rem;
}

/* Fix for H3 margin in Projects Part[cite: 3, 6] */
#projects h3 {
    margin-top: 4rem;
    margin-bottom: 2rem;
    font-size: 1.8rem;
    color: var(--accent-color);
    text-align: center;
    width: 100%;
}

/* --- 7. Hero Section --- */
#hero {
    background: transparent;
    border: none;
    box-shadow: none;
    text-align: center;
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#hero h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

#hero p {
    font-size: 1.4rem;
    color: var(--text-accent);
    max-width: 800px;
    margin: 0 auto 3rem auto;
}

.social-links a {
    font-size: 2.2rem;
    margin: 0 1rem;
    display: inline-block;
}

.social-links a:hover {
    transform: translateY(-5px);
    color: #fff;
    text-shadow: 0 0 15px var(--accent-color);
}

/* --- 8. About Section --- */
.profile-picture {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 3px solid var(--accent-color);
    padding: 5px;
    margin: 0 auto 2rem auto;
    display: block;
    transition: 0.5s;
}

.profile-picture:hover {
    transform: scale(1.05);
}

#about p {
    max-width: 850px;
    margin: 0 auto 1.5rem auto;
    text-align: justify;
}

/* --- 9. Grids (Skills, Projects, Certs) --- */
.skills-grid, .projects-grid, .certs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.skill-item, .project-card, .cert-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.skill-item:hover, .project-card:hover, .cert-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-color);
    box-shadow: 0 20px 40px var(--shadow-dark);
}

.skill-item h3, .project-card h4 {
    color: var(--accent-color);
    margin-bottom: 1.5rem;
}

.skill-item ul {
    list-style: none;
}

.skill-item li {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
}

.skill-item i {
    margin-right: 12px;
    color: var(--accent-color);
}

/* --- 10. Links & Buttons --- */
.project-links a, .cert-link {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border: 1px solid var(--accent-color);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 1rem;
    text-transform: uppercase;
}

.project-links a:hover, .cert-link:hover {
    background: var(--accent-color);
    color: var(--primary-bg);
    box-shadow: 0 0 20px var(--accent-color);
}

/* --- 11. Contact & Footer --- */
#contact {
    text-align: center;
}

footer {
    padding: 3rem;
    text-align: center;
    background: var(--secondary-bg);
    border-top: 1px solid var(--border-color);
    color: var(--text-accent);
}

/* --- 12. Responsive Logic (768px and Below) --- */

@media (max-width: 768px) {
    header {
        padding: 0 1.5rem;
        height: 70px;
        display: flex;
        align-items: center;
    }

    .logo {
        display: flex;
        align-items: center;
    }

    .logo img {
        height: 45px;
        margin: 0;
    }

    .menu-icon {
        display: block; 
        font-size: 1.6rem;
        z-index: 1100;
    }

    nav {
        position: fixed;
        top: 0; 
        right: -100%; 
        width: 100%; 
        height: 100vh;
        background: rgba(13, 13, 13, 0.98); 
        transition: 0.4s ease;
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow-y: auto;
    }

    nav.active {
        right: 0;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 1.8rem; 
        padding: 80px 0;
    }

    nav a {
        font-size: 1.1rem;
    }

    main {
        margin-top: 80px; 
        padding: 0 1rem;
    }

    section {
        padding: 2.5rem 1rem; 
        text-align: center;
    }

    .project-links, .badge-links, .certs-grid {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        margin-top: 1.2rem;
    }
    .skills-grid .skill-item {
        text-align: left;
    }

    .cert-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding: 1.2rem 0.8rem; /* Tighter padding for better spacing[cite: 3] */
    }

    .project-links a, .cert-link {
        margin: 15px !important;
        width: fit-content;
        min-width: 130px; /* Slimmer buttons[cite: 3] */
        padding: 0.5rem 0.8rem; /* More compact button size[cite: 3] */
        font-size: 0.75rem; /* Smaller text for links[cite: 3] */
        text-align: center;
    }

    #contact p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        font-size: 0.95rem; /* Smaller paragraph text[cite: 3] */
        display: flex;
        flex-direction: column;
        align-items: center;
        max-width: 100%;
        line-height: 1.5;
    }

    /* Target the email link specifically to make it look proportional[cite: 3] */
    #contact a {
        font-size: 0.85rem !important; 
        margin-top: 10px;
        color: var(--accent-color);
        text-decoration: none;
    }

    .section-title {
        font-size: 1.6rem;
    }

    #hero h1 {
        font-size: 2rem;
    }

    #projects h3 {
        margin-top: 2.5rem;
    }

    .skills-grid, .projects-grid, .certs-grid {
        grid-template-columns: 1fr;
        width: 100%;
    }

    #about p {
        text-align: center;
    }
}

/* --- 13. Small Screens (480px and below) --- */
@media (max-width: 480px) {
    #hero h1 {
        font-size: 1.7rem;
    }
    
    .logo img {
        height: 38px;
    }

    #contact p {
        font-size: 0.85rem; /* Fits 300px width comfortably[cite: 3] */
    }

    #contact a {
        font-size: 0.95rem !important; /* Email address fits on one line[cite: 3] */
    }

    .cert-link {
        min-width: 110px;
        padding: 0.4rem 0.6rem;
    }
}
