:root {
    --neutral: #faeee7;
    --base-100: #33272a;
    --neutral-focus: #fffffe;
    --neutral-highlight: #d1d1e9;
    --primary: #6246ea;
    --secondary: #594a4e;
    --accent: #33272a;
}

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

body {
    font-family: "Poppins", 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
    background-color: var(--neutral);
    text-align: center;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.75rem);
    margin-bottom: 1rem;
}

#navbar {
    display: flex;
    justify-content: center;
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--neutral);
    padding: 10px 5px;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    border-bottom: 2px solid var(--primary);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Hamburger Menu Button */
.menu-toggle {
    display: none;
    cursor: pointer;
    padding: 10px;
    background: none;
    border: none;
    z-index: 1001;
    font-size: 24px;
    color: var(--base-100);
    transition: all 0.3s ease;
    border-radius: 4px;
}

.menu-toggle:hover {
    background-color: rgba(51, 39, 42, 0.1);
    transform: scale(1.1);
}

.menu-toggle:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.nav-links {
    display: flex;
    list-style: none;
    font-family: 'Poppins','Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
    gap: clamp(5px, 2vw, 10px);
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
    transition: all 0.3s ease;
}

.nav-links a {
    display: flex;
    text-decoration: none;
    justify-content: center;
    align-items: center;
    color: var(--base-100);
    padding: 8px clamp(10px, 3vw, 25px);
    transition: color 0.3s ease, transform 0.2s ease;
    border-radius: 8px;
    white-space: nowrap;
}

.nav-links a:hover .nav-icon,
.nav-links a:hover .nav-text {
    color: #7f5af0;
    transform: translateY(-2px);
}

.nav-icon {
    font-size: clamp(16px, 2.5vw, 20px);
    color: var(--base-100);
    transition: transform 0.3s ease, color 0.3s ease;
    margin-right: 8px;
}

.nav-text {
    font-size: clamp(14px, 2.2vw, 20px);
    color: var(--base-100);
    transition: color 0.3s ease;
}

section {
    min-height: 50vh;
    padding: clamp(60px, 10vh, 120px) clamp(10px, 5vw, 50px);
    width: 100%;
    max-width: 100%;
}

#projects {
    background-color: var(--secondary);
    color: var(--neutral-focus);
}

#projects h1 {
    color: var(--neutral-focus);
}

#projects .carousel-container {
    max-height: calc(100vh - 100px);
    overflow: auto;
    padding: 0 10px;
}

#projects .carousel-container span {
    color: var(--neutral-focus);
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    margin: 10px 0 5px;
    display: block;
}

#projects .carousel-container a {
    text-decoration: none;
    color: var(--primary);
    font-size: clamp(0.875rem, 2vw, 1rem);
    margin: 10px 0 0 0;
    cursor: pointer;
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

#projects .carousel-container a:hover {
    background-color: rgba(98, 70, 234, 0.1);
}

#experience {
    background-color: var(--neutral);
    color: var(--secondary);
}

#experience h1 {
    color: var(--secondary);
}

#experience .carousel-container {
    max-height: calc(100vh - 100px);
    overflow: auto;
    padding: 0 10px;
}

#experience .carousel-container span {
    color: var(--secondary);
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    margin: 10px 0 5px;
    display: block;
}

#experience .carousel-container a {
    text-decoration: none;
    color: var(--primary);
    font-size: clamp(0.875rem, 2vw, 1rem);
    margin: 10px 0 0 0;
    cursor: pointer;
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

#experience .carousel-container a:hover {
    background-color: rgba(98, 70, 234, 0.1);
}

.show-all {
    text-decoration: none;
    width: max-content;
    margin: 20px auto;
    display: flex;
    align-items: center;
    padding: clamp(8px, 2vw, 12px) clamp(15px, 3vw, 20px);
    background-color: var(--neutral);
    color: var(--accent);
    font-size: clamp(1rem, 3vw, 1.5rem);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.25s ease-in, transform 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.show-all:hover {
    background-color: var(--secondary);
    color: var(--neutral-focus);
    transform: translateY(-2px);
}

#backToTop {
    display: none;
    position: fixed;
    bottom: clamp(20px, 5vw, 40px);
    right: clamp(20px, 5vw, 40px);
    z-index: 999;
    background: var(--primary);
    color: var(--neutral-focus);
    border: none;
    border-radius: 50%;
    width: clamp(40px, 8vw, 48px);
    height: clamp(40px, 8vw, 48px);
    font-size: clamp(1.2rem, 3vw, 2rem);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: background 0.3s ease, transform 0.2s ease;
}

#backToTop:hover {
    background: var(--neutral-highlight);
    color: var(--primary);
    transform: translateY(-3px);
}

/* Project Gallery Responsive Grid */
.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: clamp(1rem, 3vw, 2rem);
    padding: clamp(10px, 3vw, 20px);
    max-width: 1400px;
    margin: 0 auto;
}

.project-card {
    background: var(--neutral-focus);
    border-radius: 12px;
    padding: clamp(1rem, 3vw, 1.5rem);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.project-card h3 {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    margin-bottom: 0.5rem;
    color: var(--base-100);
}

.project-card p {
    font-size: clamp(0.9rem, 2vw, 1rem);
    color: var(--secondary);
    line-height: 1.5;
}

/* Mobile-first responsive breakpoints */
@media (max-width: 768px) {
    #navbar {
        padding: 8px 15px;
        justify-content: space-between;
        align-items: center;
        flex-direction: row;
    }
    
    .menu-toggle {
        display: block;
        order: -1;
    }
    
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--neutral);
        flex-direction: column;
        gap: 0;
        padding: 20px 0;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: all 0.4s ease;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        border-bottom: 2px solid var(--primary);
        z-index: 999;
    }
    
    .nav-links.active {
        max-height: 500px;
        opacity: 1;
    }
    
    .nav-links li {
        width: 100%;
        margin: 0;
    }
    
    .nav-links a {
        padding: 15px 25px;
        width: 100%;
        justify-content: center;
        border-bottom: 1px solid rgba(51, 39, 42, 0.1);
        display: flex;
        align-items: center;
    }
    
    .nav-links a:last-child {
        border-bottom: none;
    }
    
    .nav-text {
        display: block;
        margin-left: 12px;
    }
    
    .nav-icon {
        margin-right: 0;
    }
    
    section {
        padding-top: clamp(100px, 15vh, 150px);
    }
    
    .project-gallery {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        padding: 10px;
    }
    
    .project-card {
        min-width: auto;
        padding: 0.8rem;
    }
}

@media (max-width: 480px) {
    #navbar {
        padding: 8px 10px;
    }
    
    .nav-links a {
        padding: 12px 20px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .nav-links {
        gap: 8px;
    }
    
    .project-gallery {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.2rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .project-gallery {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

@media (min-width: 1025px) {
    .nav-links {
        gap: 15px;
    }
    
    .project-gallery {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 2rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #navbar {
        border-bottom-width: 1px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    section {
        padding-top: 80px;
    }
    
    #navbar {
        padding: 5px;
    }
}

/* Print styles */
@media print {
    #navbar,
    #backToTop,
    .show-all {
        display: none !important;
    }
    
    section {
        padding-top: 0;
        page-break-inside: avoid;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto;
    }
    
    .nav-links a,
    .show-all,
    #backToTop,
    .project-card {
        transition: none;
    }
}