:root {
    /* Light theme colors */
    --bg-color: #ffffff;
    --text-color: #333333;
    --text-secondary: #555555;
    --text-muted: #666666;
    --nav-bg: #ffffff;
    --nav-border: lightgrey;
    --nav-text: grey;
    --nav-hover: #f2f2f2;
    --link-color: #00b3b3;
    --project-bg: #f8f9fa;
    --canvas-bg: #ffffff;
    --stat-label: #666666;
    --stat-value: #333333;
}

[data-theme="dark"] {
    /* Dark theme colors */
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #888888;
    --nav-bg: #1a1a1a;
    --nav-border: #333333;
    --nav-text: #b0b0b0;
    --nav-hover: #2a2a2a;
    --link-color: #4dd0e1;
    --project-bg: #222222;
    --canvas-bg: #1a1a1a;
    --stat-label: #888888;
    --stat-value: #e0e0e0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px;
}

body {
    font-family: -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", Arial, sans-serif;
    /* font-family: 'Lora', Georgia, 'Times New Roman', serif; */
    margin: 0;
    padding: 0;
    font-size: 16px;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-1 {
    transition-delay: 0.1s;
}

.delay-2 {
    transition-delay: 0.2s;
}

.delay-3 {
    transition-delay: 0.3s;
}

nav {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    padding: 25px 0 5px 0;
    z-index: 1000;
    height: 45px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

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

nav .title {
    font-size: 19px;
    font-weight: bold;
    color: var(--nav-text);
    margin-left: 20px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
}

nav .links {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    align-items: center;
    width: 900px;
}

nav .links a {
    color: var(--nav-text);
    text-decoration: none;
    padding: 8px 12px;
    display: inline-block;
    font-size: 17px;
    transition: color 0.3s ease, background-color 0.3s ease, transform 0.2s ease;
}

nav .links a:hover {
    background-color: var(--nav-hover);
    border-radius: 3px;
    /* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); */
    transform: scale(1.1);
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--nav-text);
    font-size: 18px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 3px;
    transition: color 0.3s ease, background-color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: var(--nav-hover);
    transform: scale(1.1);
}

section {
    padding: 80px 0;
    margin: 0 auto;
    max-width: 900px;
}

section#projects {
    padding-top: 20px;  /* Reduced spacing */
    scroll-margin-top: 20px; /* Adjust scroll position to match padding */
}

#about {
    display: flex;
    align-items: flex-start;
    gap: 40px;
    padding-top: 140px; /* Reduced from 180px to decrease space */
    scroll-margin-top: 70px;
}

#projects h2 {
    scroll-margin-top: 70px; /* Account for navbar height */
    margin-top: 0;
    color: var(--text-secondary);
    font-size: 27px;
    margin-bottom: 30px;
    transition: color 0.3s ease;
}

#about .info h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 25px;
}

#about .profile-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#about .profile-name {
    margin-top: 15px;
    margin-bottom: 5px;
    font-size: 22px;
    color: var(--text-color);
    font-weight: bold;
    transition: color 0.3s ease;
}

#about .profile-subtitle {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

#about img {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    position: relative;
}

#about .info {
    max-width: 80%;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

#about .links {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 15px;
    margin-top: 15px;
    margin-left: 0;
    position: static;
    transform: none;
    width: auto;
}

#about a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

#about a:hover {
    text-decoration: underline;
}

#projects {
    text-align: left;
    padding-left: 0px;
}

#projects .project {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    margin-bottom: 40px;
    gap: 15px;
    width: 100%;
    position: relative;
    background-color: var(--project-bg);
    border-radius: 8px;
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#projects .project-link {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 15px;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

#projects .project:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

#projects .project img {
    width: 220px;
    height: 165px;
    object-fit: cover; /* Ensures aspect ratio is maintained */
    display: block; /* Centers the image horizontally */
    margin: auto; /* Centers the image inside the container */
}

#projects .project .description {
    padding-left: 30px;
    width: calc(100% - 250px);
}

#projects .project .image-container {
    width: 220px;
    height: 165px;
    display: flex;
    justify-content: center;
    align-items: center; /* Ensures the image is centered inside this container */
    background-color: transparent; /* Remove background since project box has its own */
    overflow: hidden; /* Ensures no part of the image overflows the container */
    transition: background-color 0.3s ease;
}

#projects .project .description h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 23px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

#projects .project:hover .description h3 {
    color: var(--link-color);
}

#projects .project .description p {
    margin: 10px 0;
    color: var(--text-secondary);
    line-height: 1.5;
    transition: color 0.3s ease;
}

.icon {
    display: inline-block;
    vertical-align: middle;
    box-sizing: border-box;
    transition: transform 0.2s;
}

.icon:hover {
    transform: scale(1.1);
}

@media screen and (max-width: 768px) {
nav .links {
    flex-direction: column;
    width: 100%;
    left: 0;
    transform: none;
    text-align: center;
    padding: 10px;
}

#about {
    flex-direction: column;
    align-items: center;
    padding-top: 100px;
    gap: 20px;
}

#about .info {
    max-width: 90%;
    text-align: center;
}

#projects .project {
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#projects .project .description {
    width: 100%;
    padding-left: 0;
    margin-top: 15px;
}

#projects .project img,
#projects .project .image-container {
    width: 100%;
    max-width: 300px;
    height: auto;
}
}

/* RL Animation Styles */
#rl-animation {
    padding: 20px 0;
    text-align: center;
    background: var(--bg-color);
    margin: 0;
    width: 100%;
    max-width: none;
    transition: background-color 0.3s ease;
}

.snake-game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

#snakeCanvas {
    background: var(--canvas-bg);
    transition: background-color 0.3s ease;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 8px;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    color: var(--stat-label);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.stat-value {
    color: var(--stat-value);
    font-size: 18px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    transition: color 0.3s ease;
}

/* Mobile responsiveness for RL animation */
@media screen and (max-width: 768px) {
    #rl-animation {
        padding: 30px 10px;
    }
    
    #snakeCanvas {
        width: 100%;
        height: 300px;
    }
    
    .game-stats {
        gap: 20px;
    }
    
    .stat-value {
        font-size: 16px;
    }
}