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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: white;
    color: #333;
    line-height: 1.6;
    overflow: hidden; /* Prevent scrolling */
    height: 100vh;
    width: 100vw;
    transition: background-color 0.3s ease; /* Smooth background transition */
}

/* Dark mode for about section (background black, text inverted) */
body.dark-mode {
    background-color: black;
    color: white;
}

body.dark-mode .nav-link {
    color: white;
}

body.dark-mode .nav-link:hover {
    color: #ccc;
}

body.dark-mode .main-nav.has-active .nav-link:not(.active) {
    opacity: 0.3;
}

body.dark-mode .main-nav:hover .nav-link:not(:hover):not(.active) {
    opacity: 0.1;
}

body.dark-mode .nav-link.active {
    color: white;
    font-weight: 500;
}

body.dark-mode .main-nav.work-nav .nav-link {
    color: white;
}

/* Work mode: Enable scrolling, adjust layout */
body.work-mode {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
}

body.work-mode .content-section:not(#work) {
    display: none !important;
}

body.resume-mode {
    overflow: hidden;
    height: 100vh;
}

body.resume-mode .nav-container {
    top: auto;
    bottom: 0;
    height: auto;
    padding: 0 2rem;
    align-items: flex-end;
    justify-content: center;
}

body.resume-mode .main-nav {
    gap: 1.5rem;
}

body.resume-mode .nav-link {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
}

body.resume-mode .nav-link:hover {
    font-size: 1.25rem;
}

body.work-mode #work.active {
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    height: auto !important;
    min-height: 100vh;
    display: block !important;
    pointer-events: auto;
    z-index: auto;
    padding: 2rem;
    padding-bottom: 140px; /* Space for bottom nav */
    overflow: visible;
}

/* Navigation Container */
.nav-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 1000;
    pointer-events: none; /* Allows clicks to pass through to content */
    transition: all 0.3s ease;
}

.nav-container .main-nav {
    pointer-events: auto; /* Only nav is clickable */
}

/* Main Navigation */
.main-nav {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    justify-content: center;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: #333;
    font-size: 1.25rem;
    font-weight: 400;
    text-transform: lowercase;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 1rem;
    opacity: 1; /* Full opacity by default */
    cursor: pointer;
    z-index: 1001;
}

/* Non-active links get reduced opacity when an active link exists */
.main-nav.has-active .nav-link:not(.active) {
    opacity: 0.3;
}

/* Active link stays full opacity */
.nav-link.active {
    opacity: 1;
    font-weight: 500;
}

/* Hover effect - size increase and full opacity */
.nav-link:hover {
    font-size: 1.5rem;
    font-weight: 500;
    color: #000;
    transform: translateY(-2px);
    opacity: 1; /* Ensure full opacity on hover */
}

/* When hovering over the nav area, reduce opacity of non-hovered links to 0.1 */
.main-nav:hover .nav-link:not(:hover):not(.active) {
    opacity: 0.1;
}

/* Work mode nav adjustments: bottom positioning, smaller gaps */
body.work-mode .nav-container {
    top: auto;
    bottom: 0;
    height: auto;
    padding: 0rem 2rem;
    align-items: flex-end;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Smooth slide down */
}

body.work-mode .main-nav {
    gap: 1.5rem;
    flex-direction: row;
}

body.work-mode .nav-link {
    color: #333;
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
}

body.work-mode .nav-link:hover {
    font-size: 1.25rem;
    color: #000;
}

/* Content Sections */
.content-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: none;
    z-index: 500;
    pointer-events: none; /* Allows nav clicks to work */
    transition: background-color 0.3s ease;
}

.content-section.active {
    display: block;
    pointer-events: auto;
}

/* About section specific: black background */
.content-section#about.active {
    background-color: black;
    color: white;
}

/* Resume section */
#resume.active {
    background: #f6f6f3;
}

.resume-shell {
    position: absolute;
    inset: 1.5rem 1.5rem 5.5rem;
    z-index: 502;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    animation: resumeFadeIn 0.35s ease forwards;
}

.resume-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.resume-close-button {
    display: none;
}

.resume-button {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    color: #222;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.resume-button:hover {
    transform: translateY(-2px);
    background: #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.resume-viewer {
    width: 100%;
    min-height: 0;
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    background: white;
}

.resume-fallback {
    height: 100%;
    min-height: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: #333;
}

.resume-fallback a {
    color: #000;
    font-weight: 600;
}

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

/* Work section specific styles */
#work .background-media {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    overflow: hidden;
}

#work .background-media video,
#work .background-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

#work .projects-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

#work .projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    padding: 0.2rem 0;
    justify-content: center;
}

/* Project cards: Clean, stacked card style inspired by YouTube (minimal, hover lift) */
.project-card {
    position: relative;
    background: rgba(209, 248, 255, 0.7);
    border-radius: 16px;
    overflow: visible;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgb(209, 248, 255);
}

.project-thumbnail {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
    border-radius: 16px;
}

.thumb-stack {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Overlapping stack thumbnails */
.stack-thumb {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px 0 0 16px; /* Slight curve on right for stack effect */
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 0;
    opacity: 1;
}

/* Stack positioning: offset from top-right, decreasing scale and offset for depth */
.stack-thumb:nth-child(1) { /* Top image: full size, no offset */
    z-index: 3;
    transform: scale(0.7);
    opacity: 1;
}

.stack-thumb:nth-child(2) { /* Middle image: slight offset down-left, smaller */
    z-index: 2;
    transform: translate(12px, 12px) scale(0.85);
    opacity: 1;
    border-radius: 12px 0 0 12px;
}

.stack-thumb:nth-child(3) { /* Bottom image: more offset, smallest */
    z-index: 1;
    transform: translate(24px, 24px) scale(1);
    opacity: 1;
    border-radius: 8px 0 0 8px;
}

.project-card:hover .stack-thumb:nth-child(1) {
    transform: scale(1.02);
}

.project-card:hover .stack-thumb:nth-child(2) {
    transform: translate(8px, 8px) scale(0.88);
}

.project-card:hover .stack-thumb:nth-child(3) {
    transform: translate(16px, 16px) scale(0.72);
}

/* If fewer than 3 images, hide the missing ones (or adjust via JS if needed) */
.thumb-stack:has(.stack-thumb:nth-child(3)) .stack-thumb:nth-child(3) {
    display: block;
}

.thumb-stack:not(:has(.stack-thumb:nth-child(3))) .stack-thumb:nth-child(3) {
    display: none;
}

.more-media {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 4;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.9);
}

.project-card:hover .more-media {
    opacity: 1;
    transform: scale(1);
}

.project-title {
    padding: 1.25rem;
    font-size: 1.25rem;
    font-weight: 500;
    color: #333;
    text-align: left;
    margin: 0;
    line-height: 1.4;
    background: transparent;
}

/* Links section styles: "Emerging" from central title */
#links .links-container {
    position: absolute;
    top: 50%;
    left: 60%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 502;
    animation: fadeIn 0.5s ease forwards;
    max-width: 600px;
}

/* Contact section styles: Email card positioned above the main nav links (centered, slightly elevated) */
#contact .contact-container {
    position: absolute;
    top: 35%; /* Slightly above the nav center for "above" visual effect */
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 502;
    animation: fadeIn 0.5s ease forwards;
    max-width: 400px;
}

/* Upper and lower containers for cards "coming out" */
.upper-links,
.lower-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
    position: relative;
}

.upper-links {
    margin-bottom: 4rem;
    transform: translateY(-10px); /* Slight lift for "above" effect */
}

.lower-links {
    margin-top: 4rem;
    transform: translateY(10px); /* Slight push for "below" effect */
}

/* Link cards: Fixed length (width), with logo, name, copy button */
/* Email card: Reuse link-card styles with minor adjustments */
.link-card,
.email-card {
    display: flex;
    align-items: center;
    width: 100%; /* Full width of container for consistent length */
    max-width: 400px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 0 1rem;
    text-decoration: none;
    color: #333;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); */
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.email-card {
    /* Specific to email: Slightly taller for better readability, subtle blue tint */
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
}

.link-card:hover,
.email-card:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    color: #000;
}

.link-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 0rem;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.link-logo svg.email-icon {
    width: 20px;
    height: 20px;
    stroke: #333;
}

.link-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
}

.logo-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 8px;
}

.link-name {
    flex: 1;
    font-size: 1rem;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 1rem;
}

.copy-button {
    background: #ffffff; 
    color: rgb(255, 255, 255);
    border: none;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.copy-button:hover {
    transform: scale(1.1);
}

.email-copy {
    background: #ffffff; 
    color: white;
}

/* Project overlay: Full-screen, horizontal scroll for media (intuitive, swipe-friendly) */
.project-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    overflow: hidden;
}

.overlay-content {
    position: relative;
    width: 95%;
    height: 90%;
    display: flex;
    border-radius: 12px;
    overflow: hidden;
}

/* Media container in overlay: Horizontal scroll with visible, larger scrollbar */
.media-container {
    display: flex;
    overflow-x: auto; /* Enable horizontal scroll */
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    height: 100%;
    /* Scrollbar visibility and base styling (Firefox) */
    scrollbar-width: auto; /* 'auto' shows full scrollbar; 'thin' for slimmer but still visible */
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.2); /* Thumb color (semi-transparent white) over track (dark subtle) */
    /* Note: No -ms-overflow-style: none; to allow scrollbar in IE/Edge */
}

/* Custom horizontal scrollbar for WebKit browsers (Chrome, Safari, Edge) */
.media-container::-webkit-scrollbar {
    height: 12px; /* Changed: Larger height (thickness) than default ~6px; adjust to 16px+ for even bigger */
    background: rgba(0, 0, 0, 0.2); /* Subtle dark track background to blend with overlay */
    border-radius: 6px; /* Rounded ends */
}

.media-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1); /* Even subtler track; can make transparent if preferred */
    border-radius: 6px;
}

.media-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.6); /* Larger, semi-transparent white thumb for visibility */
    border-radius: 6px;
    min-height: 12px; /* Ensures it's at least as thick as the scrollbar */
    transition: background 0.2s ease; /* Smooth color change */
}

.media-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.8); /* Brighter on hover for feedback */
}

.media-container::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 1); /* Full white when dragging */
}

/* Hide vertical scrollbar if it accidentally appears (rare, but safe) */
.media-container::-webkit-scrollbar:vertical {
    width: 0;
    background: transparent;
}

.media-container > * {
    flex: 0 0 100%;
    height: 100%;
    scroll-snap-align: center;
    object-fit: contain;
}

/* Background SVG pattern (provision: low opacity overlay, behind other content) */
.background-pattern {
    position: absolute;
    top: -16rem;
    left: -30rem;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.25; /* Subtle; adjust as needed */
    pointer-events: none;
    scale: 0.3;
}

.background-pattern svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Tech images container and floating animation */
.tech-images {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 510;
    pointer-events: none;
}

.tech-icon {
    position: absolute;
    width: 60px;
    height: 60px;
    object-fit: contain;
    animation: float 4s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
    pointer-events: none;
    /* Different z-index variations for layering; adjust per image if needed */
    z-index: 511;
}

/* Floating animation (subtle up-down movement) */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Main about content (positioned to the right) */
.about-content {
    position: absolute;
    top: 40%;
    right: -13%;
    transform: translateY(-50%);
    text-align: right;
    max-width: 400px;
    z-index: 520;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.1); /* Subtle backdrop for readability on black; optional */
    border-radius: 8px;
    animation: fadeIn 0.5s ease forwards;
}

.about-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: white;
    font-weight: 600;
}

.about-description {
    font-size: 1.2rem;
    color: #ccc;
    line-height: 1.8;
}

/* Override colors for about content placeholders if any */
.content-section#about.active .about-title {
    color: white;
}

.content-section#about.active .about-description {
    color: #ccc;
}

/* Fade in animation for content */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Close button for project overlay */
.overlay-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 3001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.overlay-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.overlay-close:active {
    transform: scale(0.95);
}

/* Responsive design */
@media (max-width: 768px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body {
        min-height: 100svh;
    }

    .content-section {
        width: 100%;
        max-width: 100%;
        height: 100svh;
        overflow: hidden;
    }

    .content-section.active {
        padding: 1rem;
    }

    body.has-active-section .content-section.active {
        padding-left: calc(5.75rem + env(safe-area-inset-left));
    }

    .nav-container {
        top: 0;
        bottom: auto;
        height: 100svh;
        align-items: center;
        justify-content: center;
        padding: 1rem;
        background: transparent;
        backdrop-filter: none;
    }

    body.has-active-section .nav-container {
        top: 0;
        bottom: auto;
        left: 0;
        width: calc(5.25rem + env(safe-area-inset-left));
        height: 100svh;
        align-items: center;
        justify-content: center;
        padding: 1rem 0.45rem 1rem calc(0.45rem + env(safe-area-inset-left));
        background: transparent;
        backdrop-filter: none;
    }

    body.dark-mode.has-active-section .nav-container {
        background: transparent;
    }

    .main-nav {
        width: min(100%, 32rem);
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 1.25rem;
        justify-content: center;
        align-items: center;
    }

    body.has-active-section .main-nav {
        position: relative;
        width: 100%;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0.45rem;
        padding: 0.7rem 0.3rem;
        isolation: isolate;
    }

    body.dark-mode.has-active-section .main-nav {
        background: transparent;
    }

    body.has-active-section .main-nav::before {
        content: none;
    }

    body.dark-mode.has-active-section .main-nav::before {
        content: none;
    }
    
    .nav-link {
        flex: 0 1 auto;
        min-width: 5.5rem;
        max-width: 8rem;
        font-size: 1.1rem;
        line-height: 1.15;
        text-align: center;
        padding: 0.5rem 0.25rem;
        white-space: normal;
    }

    body.has-active-section .nav-link {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        max-width: none;
        font-size: 0.68rem;
        padding: 0.42rem 0.15rem;
    }
    
    .nav-link:hover {
        font-size: 1.1rem;
        transform: none;
    }

    body.has-active-section .nav-link:hover {
        font-size: 0.68rem;
    }

    .about-content {
        top: 50%;
        right: 0.5rem;
        left: calc(8.75rem + env(safe-area-inset-left));
        width: auto;
        max-width: none;
        text-align: right;
        padding: 0.75rem 0;
        animation: none;
        opacity: 1;
        transform: translateY(-50%) !important;
    }
    
    .about-title {
        font-size: 2rem;
    }
    
    .about-description {
        font-size: 0.96rem;
    }

    .about-title {
        font-size: 1.5rem;
    }
    
    .about-description {
        font-size: 0.96rem;
    }
    
    /* Adjust mobile content positioning */
    #work .content-placeholder {
        top: 20%;
        left: 50%;
        transform: translate(-50%, 0);
    }
    
    #links .content-placeholder {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    /* Contact mobile: Center the email card above nav */
    #contact .contact-container {
        top: 42%;
        left: calc(5.75rem + ((100vw - 5.75rem) / 2));
        width: min(calc(100vw - 7rem), 400px);
        max-width: none;
    }

    .email-card {
        height: 50px;
        padding: 0 0.75rem;
    }

    .tech-icon {
        width: 36px;
        height: 36px;
    }

    .tech-icon:nth-child(1) { top: 7% !important; left: auto !important; right: 4% !important; bottom: auto !important; }
    .tech-icon:nth-child(2) { top: 14% !important; left: auto !important; right: 18% !important; bottom: auto !important; }
    .tech-icon:nth-child(5) { top: 24% !important; left: auto !important; right: 6% !important; bottom: auto !important; }
    .tech-icon:nth-child(6) { top: 6% !important; left: auto !important; right: 32% !important; bottom: auto !important; }
    .tech-icon:nth-child(10) { top: 25% !important; left: auto !important; right: 24% !important; bottom: auto !important; }

    .tech-icon:nth-child(3) { top: auto !important; bottom: 9% !important; left: auto !important; right: 4% !important; }
    .tech-icon:nth-child(4) { top: auto !important; bottom: 23% !important; left: auto !important; right: 19% !important; }
    .tech-icon:nth-child(7) { top: auto !important; bottom: 8% !important; left: auto !important; right: 31% !important; }
    .tech-icon:nth-child(8) { top: auto !important; bottom: 21% !important; left: auto !important; right: 6% !important; }
    .tech-icon:nth-child(9) { top: auto !important; bottom: 32% !important; left: auto !important; right: 34% !important; }

    /* Work mode mobile adjustments */
    body.work-mode #work.active {
        padding: 1rem;
        padding-left: calc(5.75rem + env(safe-area-inset-left));
        padding-bottom: 1rem;
        overflow-x: hidden;
    }

    body.work-mode .nav-container {
        padding: 1rem 0.45rem 1rem calc(0.45rem + env(safe-area-inset-left));
        bottom: auto;
    }

    body.resume-mode .nav-container {
        display: flex;
    }

    body.work-mode .main-nav,
    body.resume-mode .main-nav {
        gap: 0.45rem;
        flex-direction: column;
        flex-wrap: nowrap;
        justify-content: center;
    }

    body.resume-mode .main-nav {
        width: 100%;
        gap: 0.45rem;
        flex-wrap: nowrap;
    }

    body.work-mode .nav-link,
    body.resume-mode .nav-link {
        font-size: 0.68rem;
        padding: 0.42rem 0.15rem;
    }

    body.resume-mode .nav-link {
        flex: 0 0 auto;
        min-width: 0;
        width: 100%;
        padding: 0.42rem 0.15rem;
        font-size: 0.68rem;
        line-height: 1.1;
        text-align: center;
        white-space: normal;
    }

    body.resume-mode .nav-link:hover {
        font-size: 0.68rem;
        transform: none;
    }

    .resume-shell {
        inset: calc(0.75rem + env(safe-area-inset-top)) 0.75rem calc(0.75rem + env(safe-area-inset-bottom)) calc(5.75rem + env(safe-area-inset-left));
        gap: 0.5rem;
        flex-direction: column-reverse;
    }

    .resume-actions {
        justify-content: center;
        position: relative;
        z-index: 2;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .resume-close-button {
        display: inline-flex;
    }

    .resume-button {
        width: 40px;
        height: 40px;
    }

    #work .projects-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
        padding: 1rem 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    #work .projects-container,
    .project-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .project-card:hover {
        transform: translateY(-4px) scale(1.01);
    }

    .project-thumbnail {
        height: 200px;
    }

    /* Adjust stack for mobile: reduce offsets */
    .stack-thumb:nth-child(2) {
        transform: translate(8px, 8px) scale(0.9);
    }

    .stack-thumb:nth-child(3) {
        transform: translate(16px, 16px) scale(0.8);
    }

    .project-card:hover .stack-thumb:nth-child(2) {
        transform: translate(6px, 6px) scale(0.92);
    }

    .project-card:hover .stack-thumb:nth-child(3) {
        transform: translate(12px, 12px) scale(0.82);
    }

    .project-title {
        padding: 1rem;
        font-size: 1.1rem;
    }

    .overlay-content {
        width: 98%;
        height: 85%;
    }

    /* Links mobile adjustments: Stack vertically, remove angles for simplicity */
    #links .links-container {
        left: calc(5.75rem + ((100vw - 5.75rem) / 2));
        width: min(calc(100vw - 7rem), 400px);
        max-width: none;
    }

    #links .links-title {
        font-size: 3rem;
        margin-bottom: 1.5rem;
    }

    .upper-links,
    .lower-links {
        gap: 0.75rem;
    }

    .link-card {
        width: fit-content;
        min-width: 170px;
        max-width: min(100%, 250px);
        height: 50px;
        padding: 0 0.6rem;
        gap: 0.65rem;
        justify-content: center;
    }

    .link-logo {
        width: 32px;
        height: 32px;
        margin-right: 0;
    }

    .link-logo svg.email-icon {
        width: 18px;
        height: 18px;
    }

    .link-name {
        flex: 0 1 auto;
        font-size: 1rem;
        min-width: 0;
        padding: 0;
    }

    .copy-button {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        margin-left: 0;
    }

    /* Mobile nav: stack if needed */
    @media (max-width: 480px) {
        body.work-mode .main-nav {
            flex-direction: column;
            gap: 0.35rem;
        }

        body.resume-mode .main-nav {
            flex-direction: column;
            gap: 0.35rem;
        }

        .resume-shell {
            inset: calc(0.75rem + env(safe-area-inset-top)) 0.75rem calc(0.75rem + env(safe-area-inset-bottom)) calc(5.75rem + env(safe-area-inset-left));
            gap: 0.5rem;
            flex-direction: column-reverse;
        }

        body.resume-mode .main-nav.has-active .nav-link:not(.active) {
            opacity: 0.22;
        }

        #links .links-title {
            font-size: 2.5rem;
        }

        .project-thumbnail {
            height: 180px;
        }

        .stack-thumb:nth-child(2) {
            transform: translate(6px, 6px) scale(0.9);
        }

        .stack-thumb:nth-child(3) {
            transform: translate(12px, 12px) scale(0.75);
        }

        .link-card {
            height: 48px;
            padding: 0 0.5rem;
            max-width: min(100%, 230px);
            gap: 0.55rem;
        }

        .email-card {
            height: 48px;
            padding: 0 0.5rem;
            width: 100%;
        }

        .email-card {
            height: 52px; /* Slightly taller on very small screens */
        }

        .about-content {
            top: 50%;
            left: calc(8.25rem + env(safe-area-inset-left));
            right: 0.4rem;
            text-align: right;
            animation: none;
            opacity: 1;
            transform: translateY(-50%) !important;
        }

        .about-title {
            font-size: 1.35rem;
        }

        .about-description {
            font-size: 0.9rem;
            line-height: 1.65;
        }

        /* Overlay close button smaller on very small screens */
        .overlay-close {
            width: 36px;
            height: 36px;
            font-size: 1.25rem;
            top: 0.5rem;
            right: 0.5rem;
        }

        .tech-icon {
            width: 32px;
            height: 32px;
        }

        .tech-icon:nth-child(1) { top: 7% !important; left: auto !important; right: 4% !important; bottom: auto !important; }
        .tech-icon:nth-child(2) { top: 14% !important; left: auto !important; right: 17% !important; bottom: auto !important; }
        .tech-icon:nth-child(5) { top: 25% !important; left: auto !important; right: 5% !important; bottom: auto !important; }
        .tech-icon:nth-child(6) { top: 6% !important; left: auto !important; right: 31% !important; bottom: auto !important; }
        .tech-icon:nth-child(10) { top: 25% !important; left: auto !important; right: 23% !important; bottom: auto !important; }

        .tech-icon:nth-child(3) { top: auto !important; bottom: 9% !important; left: auto !important; right: 4% !important; }
        .tech-icon:nth-child(4) { top: auto !important; bottom: 22% !important; left: auto !important; right: 18% !important; }
        .tech-icon:nth-child(7) { top: auto !important; bottom: 7% !important; left: auto !important; right: 30% !important; }
        .tech-icon:nth-child(8) { top: auto !important; bottom: 20% !important; left: auto !important; right: 5% !important; }
        .tech-icon:nth-child(9) { top: auto !important; bottom: 31% !important; left: auto !important; right: 33% !important; }
    }
}
