:root {
    /* Colors - Dark Mode Only */
    --bg-color: #0F172A;
    --surface-color: #1E293B;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --accent-color: #22D3EE;
    --accent-hover: #06B6D4;
    --border-color: #334155;
    --code-bg: #1E293B;

    /* Sober Accents (Cyclic) */
    --accent-emerald: #10b981;
    --accent-violet: #8b5cf6;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;

    /* Spacing */
    --container-width: 1100px;
    --header-height: 80px;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;

    /* Fonts */
    --font-primary: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Animation */
    --transition: all 0.25s cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
}

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

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

ul {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.1;
}

.section-title {
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.section-title::after {
    content: "";
    display: block;
    width: 200px;
    max-width: 100%;
    height: 1px;
    background-color: var(--border-color);
    margin-left: 1rem;
    flex-shrink: 1;
}

.section-number {
    font-family: var(--font-mono);
    color: var(--accent-color);
    font-size: 1.25rem;
    font-weight: 400;
    margin-right: 0.5rem;
}

/* Container */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header */
.header {
    height: var(--header-height);
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(15, 23, 42, 0.85);
    /* Dark Navy with opacity */
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition), border-color var(--transition);
}

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

.logo {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--accent-color);
}

.nav-list {
    display: flex;
    gap: var(--spacing-md);
}

.nav-link {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.nav-link:hover {
    color: var(--accent-color);
}

/* Sections */
.section {
    padding: var(--spacing-xl) 0;
}

/* Hero */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: var(--header-height);
}

.hero-greeting {
    font-family: var(--font-mono);
    color: var(--accent-color);
    margin-bottom: var(--spacing-sm);
}

.hero-name {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.hero-title {
    font-size: 3.5rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.hero-description {
    max-width: 540px;
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

.hero-cta {
    display: flex;
    gap: var(--spacing-md);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--bg-color);
    /* Dark Navy text on Cyan bg for high contrast */
    font-weight: 600;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.2);
}

.btn-outline {
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.btn-outline:hover {
    background-color: rgba(34, 211, 238, 0.1);
}

/* Skills */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.skill-category h3 {
    margin-bottom: var(--spacing-sm);
    font-size: 1.125rem;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.skill-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    background-color: var(--surface-color);
    color: var(--accent-color);
    border-radius: 99px;
}

/* Projects */
.projects-grid {
    display: grid;
    gap: var(--spacing-lg);
}

.project-card {
    background-color: var(--surface-color);
    padding: var(--spacing-md);
    border-radius: 8px;
    transition: transform var(--transition);
}

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

/* Featured Projects Layout */
.featured-project {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
    align-items: center;
    background-color: transparent !important;
    /* Override default card bg */
    padding: 0 !important;
    /* Remove padding to handle layout custom */
    border: none;
    box-shadow: none;
}

.featured-project:hover {
    transform: none;
    /* Disable card hover lift since interaction is on specific elements */
}

/* Featured Content Block */
.featured-project .project-content {
    grid-column: 1 / 8;
    /* Left side by default */
    grid-row: 1 / -1;
    z-index: 10;
    padding: var(--spacing-md);
    border-radius: 8px;
    background-color: var(--surface-color);
    /* Add card bg back to content only */
    box-shadow: 0 10px 30px -15px rgba(2, 12, 27, 0.7);
    transition: transform var(--transition);
}

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

/* Featured Image Block */
.featured-project .project-image {
    grid-column: 6 / -1;
    /* Right side overlap */
    grid-row: 1 / -1;
    z-index: 1;
    position: relative;
    height: 100%;
    border-radius: 8px;
    background-color: var(--accent-color);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.featured-project .project-image::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: rgba(15, 23, 42, 0.5);
    /* Overlay */
    z-index: 2;
    transition: var(--transition);
    pointer-events: none;
}

.featured-project:hover .project-image::before {
    background-color: transparent;
    /* Reveal image on hover */
}

.featured-project .project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%) contrast(1) brightness(90%);
    transition: var(--transition);
}

.featured-project:hover .project-image img {
    filter: none;
}

/* Elevate image on hover to allow interaction and full view */
.featured-project:hover .project-image {
    z-index: 20;
}

/* Project Gallery */
.project-gallery {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    height: 100%;
    max-height: 450px;
    /* Limit height to 450px on desktop */
    width: 100%;
    scrollbar-width: thin;
    gap: 10px;
    /* Space between images */
    padding: 20px;
    /* Uniform padding */
    scroll-padding: 20px;
    /* Ensures snap respects padding */
    align-items: center;
    /* Center images vertically if container is taller */
}

.project-gallery::-webkit-scrollbar {
    height: 6px;
}

.project-gallery::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.project-gallery::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 3px;
}

.featured-project .project-image .project-gallery img {
    width: auto;
    height: 100%;
    max-height: 450px;
    /* Ensure images respect the limit */
    flex: 0 0 auto;
    object-fit: contain;
    /* Ensure full image is visible, no cropping */
    scroll-snap-align: start;
    border-radius: 4px;
}

/* Alternate Layout for Even Items */
.featured-project.alt-layout .project-content {
    grid-column: 6 / -1;
    text-align: right;
}

.featured-project.alt-layout .project-image {
    grid-column: 1 / 8;
}

.featured-project.alt-layout .project-tech-list {
    justify-content: flex-end;
}

.featured-project.alt-layout .project-links {
    justify-content: flex-end;
}

/* Mobile Responsive for Featured */
@media (max-width: 768px) {
    .featured-project {
        display: block !important;
        /* Stack vertically */
        background-color: var(--surface-color) !important;
        padding: 1rem !important;
        border-radius: 8px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

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

    .featured-project .project-content {
        grid-column: auto;
        grid-row: auto;
        padding: 0;
        background-color: transparent;
        box-shadow: none;
        z-index: auto;
        width: 100%;
        max-width: 100%;
    }

    .featured-project:hover .project-content {
        transform: none;
    }

    .featured-project .project-image {
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 200px;
        margin-bottom: 1rem;
        grid-column: auto;
        grid-row: auto;
        overflow: hidden;
    }

    /* Remove grayscale and overlay on mobile - show images in full color */
    .featured-project .project-image::before {
        background-color: transparent !important;
    }

    .featured-project .project-image img {
        filter: none !important;
        /* Show colored images on mobile */
    }

    /* Adjust gallery for mobile - critical for preventing overflow */
    .project-gallery {
        max-height: 300px;
        padding: 5px;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        gap: 5px;
        margin: 0;
    }

    .featured-project .project-image .project-gallery img {
        max-height: 280px;
        width: auto;
        max-width: none;
    }

    .featured-project.alt-layout .project-content {
        text-align: left;
    }

    .featured-project.alt-layout .project-tech-list {
        justify-content: flex-start;
    }

    .featured-project.alt-layout .project-links {
        justify-content: flex-start;
    }
}

.project-overline {
    font-family: var(--font-mono);
    color: var(--accent-color);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.project-title {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.project-tech-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 100%;
}

.project-links {
    display: flex;
    gap: 1rem;
    color: var(--text-primary);
}

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

/* Experience */
.experience-timeline {
    border-left: 2px solid var(--border-color);
    padding-left: var(--spacing-md);
    margin-left: 1rem;
}

.timeline-item {
    position: relative;
    margin-bottom: var(--spacing-lg);
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: calc(var(--spacing-md) * -1 - 5px);
    top: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-color);
}

.timeline-header {
    margin-bottom: 1rem;
}

.role {
    display: inline-block;
    font-size: 1.25rem;
}

.company {
    color: var(--accent-color);
    font-weight: 600;
}

.duration {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.timeline-details {
    color: var(--text-secondary);
    list-style-type: disc;
    /* Use standard bullets for simplicity, or SVG custom ones */
    padding-left: 1.5rem;
}

.timeline-details li {
    margin-bottom: 0.5rem;
}

/* Contact */
.contact-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-heading {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

.contact-text {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    font-size: 1.125rem;
}

.social-links {
    margin-top: var(--spacing-lg);
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    color: var(--text-secondary);
}

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

/* Footer */
.footer {
    padding: var(--spacing-md) 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        padding: 0 var(--spacing-sm);
    }

    .container {
        padding: 0 1rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    .section {
        padding: 3rem 0;
        overflow-x: hidden;
    }

    .nav {
        display: none;
        /* Mobile menu implementation usually requires JS toggle */
    }

    .hero-name {
        font-size: 2.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .hero-title {
        font-size: 2rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .hero-description {
        font-size: 1rem;
        max-width: 100%;
    }

    .hero-cta {
        flex-wrap: wrap;
    }

    .section-title {
        font-size: 1.5rem;
        max-width: 100%;
    }

    .section-title::after {
        width: 60px;
        min-width: 40px;
    }

    /* Ensure project cards fit mobile viewport */
    .project-card {
        padding: 1.5rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    .projects-grid {
        gap: 2rem;
        overflow-x: hidden;
    }

    .project-title {
        font-size: 1.25rem;
        word-wrap: break-word;
    }

    .project-description {
        font-size: 0.95rem;
    }

    .project-tech-list {
        font-size: 0.7rem;
    }

    /* Fix gallery overflow */
    .project-gallery {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Ensure all text elements wrap properly */
    p,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    color: var(--text-primary);
    margin-right: var(--spacing-sm);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .nav {
        display: block;
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: 100%;
        height: 0;
        background-color: var(--bg-color);
        overflow: hidden;
        transition: height 0.3s ease-in-out;
        border-bottom: 1px solid var(--border-color);
    }

    .nav.active {
        height: calc(100vh - var(--header-height));
    }

    .nav-list {
        flex-direction: column;
        align-items: center;
        padding-top: var(--spacing-lg);
        display: flex;
        /* Override previous display: none if set */
    }

    .nav-link {
        font-size: 1.25rem;
    }
}

/* Animation Classes */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, visibility;
}

.fade-in-section.visible {
    opacity: 1;
    transform: none;
}

/* Other Projects List */
.other-projects {
    margin-top: var(--spacing-lg);
}

.other-projects-title {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    text-align: center;
    color: var(--text-primary);
}

.other-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.other-project-item {
    background-color: var(--surface-color);
    padding: 1rem 1.5rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    --item-accent: var(--text-secondary);
    /* Default fallback */
}

/* Cyclic Accents */
.other-project-item:nth-child(4n+1) {
    --item-accent: var(--accent-emerald);
}

.other-project-item:nth-child(4n+2) {
    --item-accent: var(--accent-violet);
}

.other-project-item:nth-child(4n+3) {
    --item-accent: var(--accent-amber);
}

.other-project-item:nth-child(4n+4) {
    --item-accent: var(--accent-rose);
}

.other-project-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--item-accent);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.other-project-item:hover {
    transform: translateX(5px);
    color: var(--text-primary);
    border-color: var(--border-color);
    /* Subtle border on hover */
}

.other-project-item:hover span:first-child {
    color: var(--item-accent);
    font-weight: 500;
}

.other-project-item:hover::before {
    opacity: 1;
}
