* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    border: none;
    outline: none;
    scroll-behavior: smooth;
    font-family: -apple-system, sans-serif;
}
:root {
    /* LIGHT MODE DEFAULTS */
    --bg-color:#fdfdfd;      /* Main light background (Home, Problem Solving) */
    --secondary-color: #64aae7; /* Accent Blue */
    --text-color: #000000;    /* Main black text */
    --main-color: #ffffff;    /* Primary White for containers/buttons/accents */
    --snd-bg-color: #e5e5e5;  /* Secondary light background (About, Contact) */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* DARK MODE VARIABLES (Applied to body via JS) */
body.dark-mode {
    --bg-color: #000000;      /* Pure Black Main background */
    --snd-bg-color: #1a1a1a;  /* Dark gray Secondary background */
    --text-color: #ffffff;    /* Pure White text */
    --main-color: #333333;    /* Dark container background */
}

/* Removed global animated background keyframes/styles */

html {
    font-size: 100%; /* Base for standard 16px interpretation */
    overflow-x : hidden;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 1.6rem;
    line-height: 1.6;
    /* Added transition for smooth theme switch */
    transition: background-color 0.5s, color 0.5s; 
}

section {
    min-height : 100vh;
    padding : 10rem 9% 2rem;
    /* Added perspective for 3D card animation */
    perspective: 1500px; 
    position: relative; /* Required for the animated pseudo-element */
    z-index: 1; /* Ensures content is above the animation */
}

/* --- SCROLL ANIMATION CLASSES --- */
.animate {
    opacity: 0;
    transform: translateY(50px);
    transition: all 1s ease-in-out;
}

.show-animate {
    opacity: 1;
    transform: translateY(0);
}

/* Specific animation for headings (cleaner movement) */
.animate.heading {
    transform: translateX(-50px);
}
.show-animate.heading {
    transform: translateX(0);
}
/* ---------------------------------- */

/* --- TYPING EFFECT STYLING --- */
.typing {
    /* Ensures the span is visible even when empty */
    min-width: 0.8rem; 
    /* Ensures the text is the secondary color */
    color: var(--secondary-color);
    position: relative;
    display: inline-block;
}

/* Typing cursor animation: ONLY visible when .typing is PRESENT */
.typing::after {
    content: '|';
    position: absolute;
    right: -0.5rem;
    top: -0.2rem;
    font-size: 1.1em;
    animation: blink 0.7s infinite;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}
/* ---------------------------------- */


 /* header section code */
 .header {
    position: fixed;
    width : 100%;
    top: 0;
    right : 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center; /* Ensures vertical alignment */
    padding : 2rem 9%;
    background : var(--secondary-color);
    backdrop-filter: blur(10px);
    transition : all 0.5s ease;
    }

    .logo {
        font-size: 3rem;
        font-weight: 700;
        color : var(--main-color);
        cursor : pointer;
        transition : all 0.3s ease;
        }

        .logo:hover {
            transform : scale(1.05);
        }
        
        .navbar {
            display: flex; /* Makes the navbar and toggle button align horizontally */
            align-items: center;
        }

        .navbar a {
            font-size: 1.9rem; /* RESTORED LARGER SIZE */
            color : var(--main-color);
            margin-left : 4rem; /* RESTORED LARGER SPACING */
            font-weight: 700;
            transition : 0.3s ease;

        }
        .navbar a:hover,
        .navbar a.active {
            color : var(--main-color); /* Kept white for contrast on blue header */
            border-bottom: 0.3rem solid var(--main-color);
        }
        
        /* Standardized menu button ID */
        #menu-icon { 
            font-size: 3.6rem; /* RESTORED LARGER SIZE */
            color : var(--main-color);
            cursor : pointer;
            display : none; /* Hidden by default on desktop */
        }

        /* --- Theme Toggle Button Styling --- */
        #theme-toggle {
            font-size: 2.4rem; /* RESTORED LARGER SIZE */
            color: var(--main-color);
            cursor: pointer;
            margin-left: 4rem; /* RESTORED LARGER SPACING */
            transition: color 0.3s, transform 0.3s;
        }
        
        #theme-toggle:hover {
            transform : scale(1.1);
        }
        
        /* ---------------------------------- */
        
        /* home section code */
        .home { 
    display: flex; 
    justify-content: center;
    align-items: center;
    /* ENSURE BACKGROUND COLOR FOLLOWS THEME */
    background: var(--bg-color); 
    color: var(--text-color);
    /* ----------------------------------- */

        }
        .home-img img {
    /* Set a reasonable maximum size for desktop, keeping 25vw for responsiveness */
    max-width: 400px; /* RESTORED LARGER SIZE */
    width: 25vw;
    height: 25vw; 
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 0 25px var(--secondary-color);
    cursor: pointer;
    animation: floatimage 4s ease-in-out infinite;
    transition: 0.4s ease;
}

.home-img img:hover {
    box-shadow: 0 0 25px var(--secondary-color), 0 0 35px var(--secondary-color), 0 0 45px var(--secondary-color);
}
@keyframes floatimage {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2.4rem);
    }
    100% {
        transform: translateY(0);
    }
}

/* NEW KEYFRAMES FOR FLASHIER ENTRANCE */
@keyframes fadeInTop {
    0% { transform: translateY(50px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}
@keyframes slideInRight {
    0% { transform: translateX(100px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.home-content {
    margin-left: 5rem;
}

.home-content h3 {
    font-size: 3.7rem; /* RESTORED LARGER SIZE */
    font-weight:700;
    /* Flashy Entrance 1: Hello, I'm */
    opacity: 0;
    animation: fadeInTop 1s ease 0.5s forwards;
}
    
.home-content h3:nth-of-type(2) {
    margin-bottom: 2rem;
    /* Flashy Entrance 3: Web Developer */
    opacity: 0;
    animation: fadeInTop 1s ease 1.5s forwards;
}
            
span {
    color : var(--secondary-color);
}
.home-content h1 {
    font-size: 6rem; /* RESTORED LARGER SIZE */
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-color);
    /* Flashy Entrance 2: Ahmed Wakil */
    opacity: 0;
    animation: slideInRight 1s ease 1s forwards;
}

.home-content p {
    font-size: 1.6rem;
    /* Flashy Entrance 4: Paragraph */
    opacity: 0;
    animation: fadeInTop 1s ease 2s forwards;
    /* Increased margin to lower social media icons */
    margin-bottom: 3rem; 
}
.social-media {
    /* Flashy Entrance 5: Social Icons */
    opacity: 0;
    animation: fadeInTop 1s ease 2.5s forwards;
}
.social-media a {
    /* Corrected typo to inline-flex */
    display : inline-flex;
    justify-content: center;
    align-items : center;
    /* Increased size for better tap target and visual appeal */
    width : 48px;
    height : 48px;
    background: transparent;
    border: 0.2rem solid var(--secondary-color);
    /* Ensure icon color matches accent in both modes */
    color : var(--secondary-color); 
    /* Increased font size for the icon itself */
    font-size: 2.4rem;
    border-radius: 50%;
    margin-right : 1rem;
    transition :  0.3s ease;
}
.social-media a:hover {
    background : var(--secondary-color);
    color : var(--bg-color); /* Lightest color for hover text/icon contrast */
    /* Combined transform functions for smooth flash */
    transform : scale(1.2) translateY(-10px);
    box-shadow: 0 0 25px var(--secondary-color);
}
.btn {
    display : inline-block;
    padding : 1rem 2.8rem;
    background : var(--secondary-color);
    font-size: 1.6rem;
    border-radius: 4rem;
    margin-top : 2rem;
    /* Fixed issues and added Entrance 6 */
    box-shadow: none; 
    color: var(--main-color); /* Main color for contrast against secondary color */
    cursor : pointer;
    opacity: 0;
    animation: fadeInTop 1s ease 3s forwards;
    transition : all 0.4s ease;
}
.btn:hover {
    background : var(--text-color); /* Changed to text color for hover contrast */
    color : var(--bg-color); /* Use background color for text on dark hover */
    box-shadow: 0 0 25px var(--secondary-color);
    transform : scale(1.05);
}
 
/*about section code*/
.about {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    background : var(--snd-bg-color);
}

.about-img img {
    width: 25vw;
    height: 25vw;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 0 25px var(--secondary-color);
    cursor: pointer;  
    transition: 0.4s ease;
}

.about-img img:hover {
    box-shadow: 0 0 25px var(--secondary-color), 0 0 35px var(--secondary-color), 0 0 45px var(--secondary-color);
}

.heading {
    font-size: 6rem; /* RESTORED LARGER SIZE */
    text-align : center;
}

.about-content {
    padding :0 4rem;
}

.about-content h2 {
    text-align  : left;
    line-height : 1.2;
}

.about-content h3 {
    font-size: 3rem; /* RESTORED LARGER SIZE */
    
}

.about-content p {
    margin : 2rem 0 3rem;
    font-size: 1.6rem;
    
}

/* NEW SECTION STYLES: SKILLS */
.skills {
    background: var(--bg-color);
}

.skills-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(28rem, 1fr));
    gap: 2.5rem;
    margin-top: 5rem;
}

.skills-card {
    background: var(--snd-bg-color);
    padding: 3rem;
    border-radius: 0.8rem;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    /* APPLYING PROJECT ANIMATION HERE */
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    transform-style: preserve-3d;
    text-align: left;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 3D and Lift Effect on Hover */
.skills-card:hover {
    /* Lift and rotate slightly in 3D space */
    transform: translateY(-15px) rotateX(5deg) rotateY(-5deg);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2), 0 0 30px var(--secondary-color);
}


.skills-card i {
    font-size: 4rem;
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    transition: all 0.5s ease;
}
.skills-card:hover i {
    transform: scale(1.1) rotate(5deg);
}

.skills-card h3 {
    font-size: 2.5rem; /* RESTORED LARGER SIZE */
    color: var(--text-color);
    margin-bottom: 1rem;
}

.skills-card ul {
    list-style: none;
    padding-left: 0;
    margin-top: 1rem;
}

.skills-card ul li {
    font-size: 1.6rem;
    margin-bottom: 1rem;
    position: relative;
    padding-left: 2rem;
}

.skills-card ul li::before {
    content: '\2022'; /* Unicode bullet point */
    color: var(--secondary-color);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

/* Ensure skills section respects dark mode */
body.dark-mode .skills-card {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--main-color);
}
body.dark-mode .skills-card:hover {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4), 0 0 30px rgba(100, 170, 231, 0.5);
}

/* NEW SECTION STYLES: PROJECTS */
.projects {
    background: var(--snd-bg-color);
}

.projects-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
    margin-top: 5rem;
}

.project-card {
    background: var(--main-color);
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    /* Set up for 3D and lift effect */
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    transform-style: preserve-3d;
}

/* 3D and Lift Effect on Hover */
.project-card:hover {
    /* Lift and rotate slightly in 3D space */
    transform: translateY(-15px) rotateX(5deg) rotateY(-5deg);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2), 0 0 30px var(--secondary-color);
}

.project-content {
    padding: 2.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: left;
    position: relative;
    z-index: 10;
}

.project-card i {
    font-size: 4rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    transition: all 0.5s ease;
}

.project-card:hover i {
    transform: scale(1.1) rotate(5deg);
}

.project-card h3 {
    font-size: 2.2rem; /* Adjusted size */
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.project-card .role {
    font-size: 1.4rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Inner Detail Animation Setup */
.project-details {
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease 0.1s, transform 0.5s ease 0.1s;
    flex-grow: 1;
}

.project-card:hover .project-details {
    opacity: 1;
    transform: translateY(0);
}

.project-details h4 {
    font-size: 1.7rem;
    color: var(--text-color);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    border-bottom: 1px solid var(--snd-bg-color);
    padding-bottom: 0.3rem;
}

.project-details p {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.project-link {
    width: 100%;
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    font-size: 1.5rem;
    /* Ensure the button is visible regardless of the detail slide */
}

/* Dark Mode specific project adjustments */
body.dark-mode .project-card {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--main-color);
}
body.dark-mode .project-card:hover {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4), 0 0 30px rgba(100, 170, 231, 0.5);
}


/* FOOTER STYLES */
footer {
    background: var(--secondary-color);
    color: var(--main-color);
}
footer p {
    /* Uses inline style in HTML, but keeping general footer style clean */
    color: var(--main-color) !important; 
    font-size: 1.6rem;
}


/* ---------------------------------- */
/* MOBILE STYLES (Max 768px width) */
/* ---------------------------------- */
@media (max-width: 768px) {
    
    /* FIX: Ensure icon is visible and aligned to the right, separate from the content flow */
    #menu-icon {
        display: block;
        /* Aligned in the header flex container */
        z-index: 1001; /* Must be above the sliding navbar */
    }
    
    .header {
        padding: 2rem 5%;
    }

    /* NAV BAR MOBILE OVERLAY FIX */
    .navbar {
        position: fixed;
        top: 0; 
        right: -100%; 
        width: 100%;
        height: 100vh;
        
        display: flex; 
        flex-direction: column; 
        justify-content: flex-start; 
        align-items: flex-start;
        
        background: var(--secondary-color);
        transition: right 0.4s ease-in-out;
        z-index: 999;
        overflow-y: auto;
        padding: 10rem 5%; 
        backdrop-filter: none;
    }
    
    /* Active state: slide in from the right */
    .navbar.active-nav {
        right: 0;
    }

    .navbar a {
        display: block;
        margin: 1.5rem 0;
        font-size: 2.8rem; 
        width: 100%; 
        text-align: left;
        padding: 1rem 0;
    }

    .navbar a:hover,
    .navbar a.active {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 0.5rem;
        border-bottom: none;
    }
    
    /* Move the toggle button inside the mobile nav and adjust alignment */
    #theme-toggle {
        margin-left: 0;
        margin-top: 3rem;
        font-size: 3.2rem;
        color: var(--main-color); 
    }

    /* Grid Mobile Fixes */
    .skills-container {
        grid-template-columns: 1fr;
    }

    .projects-container {
        grid-template-columns: 1fr;
    }
    
    .about, .home {
        flex-direction: column;
    }
    
    .home-img, .about-img {
        order: -1; /* Puts image above text on mobile */
        margin-bottom: 3rem;
    }
    
    .home-content, .about-content {
        margin-left: 0;
        text-align: center;
    }
    
    .home-content h3 {
        text-align: center;
    }
    
    .home-content h1 {
        font-size: 3rem; /* Adjusted size */
    }

    .heading {
        font-size: 3rem; /* Adjusted size */
    }

    .home-img img, .about-img img {
        width: 60vw;
        height: 60vw;
        max-width: 300px;
        max-height: 300px;
    }
}
