/* ================= SETUP & VARIABLES ================= */
:root {
    /* LIGHT MODE (Default) Color Palette */
    --bg-page: #F5F7FA;      /* Light Pale Gray */
    --bg-card: #FFFFFF;      /* Pure White */
    --bg-hero: #E4E8ED;      /* Slightly darker gray for hero section */
    --bg-pill: rgba(255,255,255,0.5); /* Transparent white for inner skills */
    
    --text-primary: #333333; /* Soft Black */
    --text-secondary: #666666; /* Lighter Gray for supporting text */
    --accent-blue: #4A90E2;  /* The soft blue accent */
    --border-light: #E1E4E8; /* Subtle divider color */
    --shadow-color: rgba(0, 0, 0, 0.05);

    /* Typography */
    --font-stack: 'Inter', sans-serif;

    /* Geometry & Spacing */
    --card-radius: 16px;
    --pill-radius: 50px;
    --section-spacing: 60px;
    
    /* Soft Shadow */
    --soft-shadow: 0px 4px 20px var(--shadow-color);
}

/* DARK MODE OVERRIDES */
body.dark-mode {
    --bg-page: #121212;      /* Deep dark background */
    --bg-card: #1E1E1E;      /* Dark gray cards */
    --bg-hero: #2A2A2A;      /* Slightly lighter dark for hero */
    --bg-pill: rgba(255,255,255,0.08); /* Transparent white for dark mode */

    --text-primary: #E0E0E0; /* Off-white text */
    --text-secondary: #A0A0A0; /* Medium gray text */
    --border-light: #333333; /* Darker borders */
    --shadow-color: rgba(0, 0, 0, 0.5); /* Stronger, darker shadow */
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    /* Main Cursor Path */
    cursor: url('images/pointer.png') 0 0, auto;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-stack);
    line-height: 1.6;
    padding: 20px; 
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ================= HOVER CURSOR SETTINGS ================= */
/* Apply hover cursor to links, buttons, and our toggle buttons */
a:hover, 
.pill-btn:hover, 
.card-image-link:hover,
button.category-btn:hover,
#theme-toggle:hover,
#sound-toggle:hover,
.mobile-menu-btn:hover {
    cursor: url('images/hover.png') 0 0, pointer;
}


/* ================= UTILITY CLASSES ================= */
.card {
    background-color: var(--bg-card);
    border-radius: var(--card-radius);
    box-shadow: var(--soft-shadow);
    padding: 40px;
    margin-bottom: 30px;
    border: 1px solid var(--border-light);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.badge {
    display: inline-block;
    background-color: var(--accent-blue);
    color: white;
    padding: 8px 16px;
    border-radius: var(--pill-radius);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 25px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.main-container, .header-container, footer {
    max-width: 1000px;
    margin: 0 auto;
}
.icon {
    width: 20px;
    height: 20px;
}

/* ================= HEADER ================= */
header {
    padding: 20px 0;
    margin-bottom: 20px;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; /* Necessary for mobile menu positioning */
}

.logo {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-primary);
}

nav {
    display: flex;
    gap: 15px; 
    align-items: center;
}

/* Container for the items we want to hide on mobile */
.nav-elements {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-link {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
}
.nav-link:hover {
    color: var(--accent-blue);
}

/* --- TOGGLE BUTTONS (Theme & Sound) --- */
#theme-toggle, #sound-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 8px;
    border-radius: 50%;
    transition: color 0.3s ease, background-color 0.3s ease;
    
    display: grid;
    place-items: center;
    grid-template-areas: "icon-stack";
    overflow: hidden; 
}

#theme-toggle:hover, #sound-toggle:hover {
    color: var(--accent-blue);
    background-color: var(--bg-hero);
}

/* Stack the icons */
#theme-toggle .icon, #sound-toggle .icon {
    grid-area: icon-stack;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
}

/* --- Theme Icon Animation --- */
.sun-icon { opacity: 1; transform: rotate(0deg); }
.moon-icon { opacity: 0; transform: rotate(-90deg); }
body.dark-mode .sun-icon { opacity: 0; transform: rotate(90deg); }
body.dark-mode .moon-icon { opacity: 1; transform: rotate(0deg); }

/* --- Sound Icon Animation --- */
.sound-on-icon { opacity: 1; transform: scale(1); }
.sound-off-icon { opacity: 0; transform: scale(0.5); }
body.muted .sound-on-icon { opacity: 0; transform: scale(0.5); }
body.muted .sound-off-icon { opacity: 1; transform: scale(1); }


.pill-btn {
    background-color: var(--accent-blue);
    color: white;
    padding: 10px 24px;
    border-radius: var(--pill-radius);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-block;
    border: none;
}
.pill-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.3);
}

/* ================= MOBILE MENU BUTTON (HIDDEN ON DESKTOP) ================= */
.mobile-menu-btn {
    display: none; /* Hide by default */
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-btn .bar {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--text-primary);
    margin: 5px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* Animated Hamburger Icon State */
.mobile-menu-btn.active .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.mobile-menu-btn.active .bar:nth-child(2) {
    opacity: 0;
}
.mobile-menu-btn.active .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}


/* ================= HERO SECTION ================= */
.hero-card {
    text-align: left;
    background-color: var(--bg-hero); 
    border: none;
    box-shadow: none;
}

.hero-card h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.hero-subtext {
    font-size: 1.1rem;
    color: var(--text-primary);
    max-width: 100%; 
    line-height: 1.7;
}


/* ================= SKILLS SECTION ================= */
.skills-section {
    max-width: 1000px;
    margin: var(--section-spacing) auto;
}

.skills-horizontal-wrapper {
    display: flex;
    flex-wrap: wrap; 
    gap: 0; 
    align-items: center; 
    padding-bottom: 10px; 
}

.skill-category-group {
    display: contents;
}

/* Category Button Styling */
button.category-btn {
    font-family: var(--font-stack); 
    text-align: left;
    transition: all 0.2s ease;
    background-color: var(--bg-card);
    border: 1px solid var(--accent-blue);
    color: var(--text-primary);
    padding: 8px 16px 8px 20px;
    border-radius: var(--pill-radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex; 
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    z-index: 2;
    margin-right: 10px;
    margin-bottom: 12px;
}

button.category-btn:hover { background-color: var(--bg-hero); }

button.category-btn.active {
    background-color: var(--accent-blue);
    color: white;
}

.category-icon {
    color: var(--accent-blue);
    transition: transform 0.3s ease, color 0.3s ease;
}

button.category-btn.active .category-icon {
    transform: rotate(135deg);
    color: white;
}


/* --- SLIDING ANIMATION LOGIC --- */

.skills-pills-container {
    display: contents;
}

/* The Inner Skill Item */
.inner-skill {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    background-color: var(--bg-pill);
    border-radius: var(--pill-radius);
    border: 1px solid var(--border-light); 
    display: inline-flex;
    white-space: nowrap;
    
    max-width: 300px; 
    padding: 5px 12px;
    opacity: 1;
    transform: translateX(0);
    margin-right: 8px;
    margin-bottom: 12px;
    
    transition: 
        max-width 0.35s ease, 
        padding 0.35s ease, 
        margin 0.35s ease, 
        opacity 0.35s ease, 
        transform 0.35s ease,
        border-width 0.2s ease;
}

/* The Hidden State */
.skills-pills-container.hidden .inner-skill {
    max-width: 0;
    padding: 0;
    border-width: 0;
    opacity: 0;
    transform: translateX(-15px);
    overflow: hidden; 
    margin-right: 0;
    margin-bottom: 0;
}

/* Staggered Delays (OPENING ONLY) */
.skills-pills-container:not(.hidden) .inner-skill:nth-child(2n) {
    transition-delay: 0.03s;
}
.skills-pills-container:not(.hidden) .inner-skill:nth-child(3n) {
    transition-delay: 0.06s;
}
.skills-pills-container:not(.hidden) .inner-skill:nth-child(4n) {
    transition-delay: 0.09s;
}


/* ================= WORK GRID SECTION ================= */
.work-section {
    max-width: 1000px;
    margin: var(--section-spacing) auto;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.project-card.card {
    padding: 0; 
    overflow: hidden; 
    transition: transform 0.3s ease;
    margin-bottom: 0; 
}

.project-card:hover {
    transform: translateY(-5px); 
}

.image-container {
    position: relative;
    width: 100%;
    height: 250px;
    background-color: var(--bg-hero);
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hover-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(74, 144, 226, 0.9); 
    opacity: 0; 
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.hover-overlay span {
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
}

.card-image-link:hover .hover-overlay {
    opacity: 1;
}

.card-data {
    padding: 25px;
}

.card-data h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.project-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.data-tags {
    display: flex;
    flex-wrap: wrap; /* THIS IS THE KEY FIX: Allow tags to wrap to a new line */
    gap: 10px;
    /* Optional: Adds a little space between rows when they do wrap */
    margin-top: 5px; 
}

.mini-tag {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-blue);
    background-color: #EDF5FF; 
    padding: 5px 12px;
    border-radius: var(--pill-radius);
}
body.dark-mode .mini-tag {
    background-color: rgba(74, 144, 226, 0.2);
    color: #64B5F6; 
}


/* ================= FOOTER ================= */
footer.card {
    text-align: center;
    padding: 60px 20px;
    margin-top: var(--section-spacing);
}

footer h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

footer p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.main-cta {
    font-size: 1.1rem;
    padding: 15px 40px;
    margin-bottom: 40px;
}

.footer-links {
    margin-bottom: 20px;
    font-weight: 600;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--accent-blue);
}

.copyright {
    font-size: 0.9rem;
    color: #999;
}


/* ================= RESPONSIVE TWEAKS & MOBILE MENU ================= */
@media (max-width: 768px) {
    body {
        padding: 10px; 
    }
    .grid-container {
        grid-template-columns: 1fr;
    }
    .card {
        padding: 25px; 
    }
    
    /* Show Hamburger Button on Mobile */
    .mobile-menu-btn {
        display: block;
        z-index: 101; /* Ensure it stays above the drop down */
        position: relative;
    }

    /* Hide the Navigation Elements by default on mobile */
    .nav-elements {
        position: absolute;
        top: 60px; /* Adjust based on header height */
        right: 0;
        background-color: var(--bg-card);
        border: 1px solid var(--border-light);
        border-radius: var(--card-radius);
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        padding: 20px;
        flex-direction: column;
        align-items: center;
        width: 150px;
        
        /* Hiding mechanics */
        opacity: 0;
        transform: translateY(-10px);
        pointer-events: none;
        transition: all 0.3s ease;
        z-index: 100;
    }

    /* Active State: Show the menu */
    .nav-elements.active {
        opacity: 1;
        transform: translateY(0);
        pointer-events: all;
    }
    
    /* ================= FORCE FOOTER SPACING ================= */

    /* 1. Reset the container */
    .footer-links {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 60px !important; /* This is a large gap (60px). You will definitely see this. */
        margin-bottom: 20px !important;
    }

    /* 2. Reset the links */
    .footer-links a {
        margin: 0 !important; /* Remove margins so they don't fight the gap */
        padding: 0 !important;
        color: var(--text-secondary);
        transition: transform 0.2s ease, color 0.2s ease;
    }

    /* 3. Style the Icon */
    .footer-icon {
        width: 30px !important; /* Made them slightly bigger too */
        height: 30px !important;
        /* No fill needed here because we used fill="currentColor" in HTML */
    }

    /* 4. Hover Effect */
    .footer-links a:hover {
        color: var(--accent-blue) !important;
        transform: translateY(-5px) !important;
    }
}