:root[data-theme="light"] {
    --bg-body: #ffffff;
    --bg-section-alt: #fafafa; /* Neutral Gray */
    --bg-card: #ffffff;
    --bg-card-hover: #f4f4f5; /* Neutral Gray */
    --text-primary: #000000;
    --text-secondary: #525252; /* Neutral Gray */
    --accent: #000000;
    --accent-glow: rgba(0, 0, 0, 0.05);
    --border-color: #e5e5e5;
    --nav-bg: rgba(255, 255, 255, 0.85);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="dark"] {
    --bg-body: #050505; /* Almost Black */
    --bg-section-alt: #0a0a0a; /* Dark Neutral Gray */
    --bg-card: #050505;
    --bg-card-hover: #141414; /* Neutral Dark Gray */
    --text-primary: #ffffff;
    --text-secondary: #a3a3a3; /* Neutral Gray */
    --accent: #ffffff;
    --accent-glow: rgba(255, 255, 255, 0.05);
    --border-color: #262626;
    --nav-bg: rgba(5, 5, 5, 0.85);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Alternate Section Background */
.section-alt {
    background-color: var(--bg-section-alt);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    width: 100%;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    line-height: 1.2;
}

.section {
    padding: 6rem 0;
}

.section-title {
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
    display: inline-block;
    width: 100%;
    letter-spacing: -0.05em;
}

.section-subtitle {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    margin-top: -2rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    height: 80px;
    display: flex;
    align-items: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.logo span {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-weight: 500;
    font-size: 1rem;
    color: var(--text-secondary);
    position: relative;
    letter-spacing: -0.02em;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

/* Theme Toggle */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-primary);
    transform: rotate(15deg);
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    height: calc(100vh - 80px);
    background: var(--bg-body);
    z-index: 999;
    transform: translateX(100%);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-top: 1px solid var(--border-color);
}

.mobile-nav-overlay.active {
    transform: translateX(0);
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    text-align: center;
}

.mobile-link {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.05em;
}

/* Hero Section */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 80px;
    position: relative;
    /* Background color removed to allow grid to show */
}

/* Subtle grid pattern background */
.hero-section::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(var(--border-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    /* Larger grid size */
    background-size: 60px 60px;
    opacity: 0.2;
    z-index: -1;
    top: 0;
    left: 0;
    /* Fade out edges */
    mask-image: radial-gradient(circle at center, black 60%, transparent 100%);
    -webkit-mask-image: radial-gradient(circle at center, black 60%, transparent 100%);
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-content {
    animation: fadeIn 1s ease-out;
}

.greeting {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 1rem;
    display: block;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.hero-name {
    font-size: 5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1;
    color: var(--text-primary);
    letter-spacing: -0.05em;
}

.hero-title {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
}

.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border-radius: 4px; /* Slightly squarer for minimalistic look */
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-body);
    border: 1px solid var(--text-primary);
}

.btn-primary:hover {
    background: transparent;
    color: var(--text-primary);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--text-primary);
}

/* Updated Hero Image Wrapper with 'Stacked High-Contrast' Design */
.hero-image-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.hero-image {
    width: 300px;
    height: 400px;
    position: relative;
    z-index: 2;
    transition: var(--transition);
    border-radius: 2px;
    /* Main Image Border */
    border: 8px solid var(--bg-card); 
    box-shadow: 0 0 0 1px var(--text-primary); /* Thin contrast line outer */
}

.hero-image:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -5px rgba(0,0,0,0.2), 0 0 0 1px var(--text-primary);
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: none; /* Changed from grayscale(100%) to none */
    transition: var(--transition);
}

.hero-image:hover img {
    filter: none;
}

/* Background Stack Effect */
.hero-image-wrapper::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 400px;
    background: var(--text-primary);
    top: 15px;
    left: 15px; /* Subtle offset */
    z-index: 1;
    opacity: 0.1; /* Light shadow block */
    transition: var(--transition);
    border-radius: 2px;
}

.hero-image-wrapper:hover::after {
    top: 20px;
    left: 20px;
    opacity: 0.2;
}

/* Remove old geometric accent */
.hero-image-wrapper::before {
    display: none;
}

/* Stats Section */
.stats-section {
    padding: 3rem 0;
    border-bottom: 1px solid var(--border-color);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    text-align: center;
}
.stat-item h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    line-height: 1.2;
}
.stat-item p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.skill-category {
    background: var(--bg-card);
    padding: 2rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    border-radius: 4px;
}

.skill-category:hover {
    border-color: var(--text-primary);
    background: var(--bg-card-hover);
}

.skill-category h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.skill-tag {
    background: transparent;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    border-radius: 4px;
}

.skill-tag:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

/* Services Section */
.services-grid {
    display: grid;
    /* Force 4 columns in one row on large screens */
    grid-template-columns: repeat(4, 1fr); 
    gap: 1.5rem;
}

.service-card {
    background: var(--bg-card);
    padding: 2rem 1.5rem; /* Reduced padding to fit 4 in a row */
    border: 1px solid var(--border-color);
    transition: var(--transition);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.service-card:hover {
    border-color: var(--text-primary);
    background: var(--bg-card-hover);
    transform: translateY(-5px);
}

.service-icon {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.service-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.service-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* Significantly smaller width */
    gap: 1.5rem; /* Tighter spacing */
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    border-color: var(--text-primary);
    transform: translateY(-4px);
    box-shadow: 0 10px 20px -5px rgba(0,0,0,0.1); /* Softer, refined visual */
}

.project-image {
    position: relative;
    height: 160px; /* Reduced height */
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.project-card:hover .project-image {
    border-bottom-color: var(--text-primary);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    filter: grayscale(100%); 
}

.project-card:hover .project-image img {
    transform: scale(1.05);
    filter: grayscale(0%);
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: var(--transition);
    backdrop-filter: blur(2px);
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-links {
    display: flex;
    gap: 0.8rem;
}

.project-links a {
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 1rem;
    width: 36px; /* Smaller buttons */
    height: 36px;
    border: 1px solid var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border-radius: 50%; /* Circle for modern feel */
}

.project-links a:hover {
    background: var(--text-primary);
    color: var(--bg-body);
    transform: scale(1.1);
}

.project-content {
    padding: 1.25rem; /* Compact padding */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-content h3 {
    font-size: 1.2rem; /* Smaller heading */
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.project-content p {
    color: var(--text-secondary);
    font-size: 0.85rem; /* Smaller text */
    margin-bottom: 1.25rem;
    line-height: 1.5;
    flex-grow: 1;
}

.project-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.project-card:hover .project-tags {
    border-top-color: var(--text-primary);
}

.project-tags span {
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    background: var(--bg-card-hover);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    border-radius: 2px;
}

/* Education Section */
.education-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 800px; /* Constrain width for "small" feel */
    margin: 0 auto;
}

.education-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: var(--transition);
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.education-card:hover {
    border-color: var(--text-primary);
    transform: translateY(-3px);
    background: var(--bg-card-hover);
}

.edu-year {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
    opacity: 0.7;
}

.education-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    color: var(--text-primary);
    font-weight: 700;
}

.education-card h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Contact Section */
.contact-wrapper {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-card {
    background: var(--bg-card);
    padding: 3rem;
    text-align: center;
    min-width: 300px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    border-radius: 4px;
}

.contact-card:hover {
    border-color: var(--text-primary);
    background: var(--bg-card-hover);
}

.icon-box {
    width: 60px;
    height: 60px;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    margin: 0 auto 1.5rem;
    border-radius: 4px;
}

.contact-card h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.contact-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-family: monospace;
}

.btn-text {
    color: var(--text-primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
}

.btn-text:hover {
    border-bottom-color: var(--text-primary);
    gap: 12px;
}

/* Footer */
.footer {
    background: var(--bg-body);
    padding: 4rem 0 2rem;
    margin-top: 6rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.social-links {
    display: flex;
    gap: 2rem;
}

.social-links a {
    color: var(--text-secondary);
    font-size: 1.5rem;
    transition: var(--transition);
}

.social-links a:hover {
    color: var(--text-primary);
    transform: translateY(-3px);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 1100px) {
    .container {
        max-width: 95%; /* Use more width on intermediate screens */
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr); /* Break to 2x2 on tablet */
    }
}

@media (max-width: 968px) {
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .hero-content {
        order: 2;
    }

    .hero-name {
        font-size: 3.5rem;
    }

    .hero-image-wrapper {
        order: 1;
        margin-bottom: 0;
    }
    
    .hero-image {
        width: 280px;
        height: 380px;
    }

    .hero-image-wrapper::after {
        width: 280px;
        height: 380px;
    }

    .hero-description {
        margin: 0 auto 2rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    .nav-links {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }
    
    .nav-right {
        gap: 1rem;
    }
}

@media (max-width: 600px) {
    .services-grid {
        grid-template-columns: 1fr; /* 1 column for mobile */
    }
    .education-grid {
        grid-template-columns: 1fr; /* Stack education cards on mobile */
    }
    .stats-grid {
        grid-template-columns: 1fr; /* Stack stats on mobile */
        gap: 1.5rem;
    }
}

@media (max-width: 500px) {
    .container {
        padding: 0 1.5rem;
        width: 100%;
    }

    /* Navbar adjustments */
    .navbar {
        height: 70px; /* Slightly smaller navbar */
    }

    .logo {
        font-size: 1.5rem;
    }

    /* Hero Section Fixes */
    .hero-section {
        padding-top: 70px;
        min-height: 100vh;
        /* height: 100vh;  Removed forced height to allow content to flow if needed, preventing cut-off on small screens */
        display: flex;
        align-items: center;
        overflow-x: hidden; /* Prevent horizontal scroll only */
    }

    .hero-container {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 1.5rem;
        padding-bottom: 2rem;
    }

    .hero-image-wrapper {
        margin-bottom: 0.5rem;
        transform: scale(0.9); /* Slight scale down to ensure fit */
    }

    .hero-image {
        width: 180px;
        height: 240px;
        border-width: 6px; /* Thinner border for mobile */
    }

    /* Adjust the shadow stack for mobile */
    .hero-image-wrapper::after {
        width: 180px;
        height: 240px;
        top: 15px;
        left: 15px;
    }

    .hero-content {
        text-align: center;
        width: 100%;
    }

    .greeting {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }

    .hero-name {
        font-size: 2.5rem;
        margin-bottom: 0.2rem;
        line-height: 1.1;
    }
    
    .hero-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .hero-description {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
        padding: 0 1rem; /* Add padding to prevent text touching edges */
    }

    .hero-buttons {
        gap: 1rem;
    }

    .btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.8rem;
    }
    
    .section-title {
        font-size: 2rem;
    }

    .contact-card {
        min-width: 100%;
        padding: 1.5rem;
    }

    /* Fix Skills Grid for mobile */
    .skills-grid {
        grid-template-columns: 1fr;
    }

    /* Fix Projects Grid for mobile */
    .projects-grid {
        grid-template-columns: 1fr;
    }
}
