/* Reset and Base Styles */
html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hide default cursor only on desktop */
@media (min-width: 769px) and (pointer: fine) {
    a, button {
        cursor: none;
    }
}

/* Text selection styles */
::selection {
    background: #8E0CE5;
    color: white;
}

::-moz-selection {
    background: #8E0CE5;
    color: white;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--color-gray-900);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: #202124;
    /* Optimize for smooth scrolling */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    /* Mobile optimizations */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Prevent zoom on input focus on iOS */
    touch-action: manipulation;
}

/* Light theme for project pages */
body.light-theme {
    background: #ffffff;
    color: var(--color-gray-900);
}

body.light-theme .navbar {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

body.light-theme .nav-link {
    color: var(--color-gray-700);
}

body.light-theme .nav-link:hover {
    color: var(--color-gray-900);
}

body.light-theme .bar {
    background: var(--color-gray-700);
}

body.light-theme .logo-dark {
    opacity: 1;
}

body.light-theme .logo-light {
    opacity: 0;
}

body.light-theme .logo-dark rect {
    fill: #101828;
    stroke: #101828;
}

body.light-theme .logo-dark path {
    fill: #ffffff;
}

/* Fix colors for light theme */
body.light-theme .project-title {
    color: #101828;
}

body.light-theme .section-title {
    color: #101828;
    text-align: left;
}

body.light-theme .section-text {
    color: #495057;
}

body.light-theme .metadata-label {
    color: #6c757d;
}

body.light-theme .metadata-value {
    color: #101828;
}

body.light-theme .project-metadata .project-link {
    color: #2563eb !important;
    text-decoration: underline !important;
    text-decoration-skip-ink: none !important;
    text-underline-offset: 2px !important;
}

body.light-theme .project-metadata .project-link:hover {
    color: #1d4ed8 !important;
}

body.light-theme .project-metadata .link-arrow {
    color: #101828;
}

body.light-theme .back-link {
    color: #495057;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

body.light-theme .back-link:hover {
    color: #212529;
    background: #e9ecef;
}

/* Project Page Styles */
.project-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 120px 20px 60px;
    text-align: left;
}

.back-button {
    margin-bottom: 60px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
}

.back-link:hover {
    transform: translateX(-4px);
}

.project-header {
    margin-bottom: 40px;
}

.project-logo {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.project-logo .logo-square {
    width: 48px;
    height: 48px;
    background: #101828;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 20px;
}

.project-logo-image {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

/* Стили для ссылки на странице проекта */
.project-metadata .project-link {
    color: #2563eb !important;
    text-decoration: underline !important;
    text-decoration-skip-ink: none !important;
    text-underline-offset: 2px !important;
    transition: color 0.3s ease;
}

.project-metadata .project-link:hover {
    color: #1d4ed8 !important;
}

/* Стили для стрелочки */
.project-metadata .link-arrow {
    font-size: 14px;
    color: #101828;
    margin-left: 4px;
    display: inline-block;
    vertical-align: baseline;
}

/* Убираем подчеркивание для тегов на главной странице */
.tag {
    text-decoration: none !important;
}

.project-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

.project-metadata {
    margin-bottom: 60px;
}

.metadata-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #e9ecef;
}

.metadata-item:last-child {
    border-bottom: none;
}

.metadata-label {
    font-weight: 500;
    font-size: 14px;
}

.metadata-value {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.project-sections {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.project-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: left;
    margin-left: 0;
    padding-left: 0;
}

.section-text {
    font-size: 1rem;
    line-height: 1.7;
    margin: 0;
}

.project-image-container {
    margin: 32px auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    background: #f8f9fa;
    width: 180%;
    margin-left: -40%;
    max-width: 100vw;
    min-width: 100%;
    box-sizing: border-box;
    display: block;
    position: relative;
}

.project-main-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-width: 100%;
    min-width: 100%;
}

.image-caption {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--color-gray-600);
    margin-top: 16px;
    text-align: left;
    max-width: 1290px;
    margin-left: 0;
    margin-right: auto;
}

/* Light theme adjustments for image caption */
body.light-theme .image-caption {
    color: var(--color-gray-500);
}

/* Light theme adjustments for project images */
body.light-theme .project-image-container {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Problem List Styles */
.problem-list {
    margin: 16px 0;
    padding-left: 20px;
    color: #495057;
}

.problem-list li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.subsection-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 24px 0 12px 0;
    color: var(--color-gray-900);
}

/* Light theme adjustments for subsection titles */
body.light-theme .subsection-title {
    color: #101828;
}

/* Responsive Design for Project Page */
@media (max-width: 1400px) {
    .project-image-container {
        width: 170%;
        margin-left: -35%;
        max-width: 100vw;
        min-width: 100%;
    }
}

@media (max-width: 1200px) {
    .project-image-container {
        width: 150%;
        margin-left: -25%;
        max-width: 100vw;
        min-width: 100%;
    }
}

@media (max-width: 1000px) {
    .project-image-container {
        width: 130%;
        margin-left: -15%;
        max-width: 100vw;
        min-width: 100%;
    }
}

@media (max-width: 768px) {
    .project-container {
        padding: 100px 16px 40px;
    }
    
    .project-title {
        font-size: 2rem;
    }
    
    .metadata-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .project-image-container {
        width: 115%;
        margin-left: -7.5%;
        max-width: 100vw;
        min-width: 100%;
        border-radius: 8px;
    }
}

@media (max-width: 600px) {
    .project-image-container {
        width: 110%;
        margin-left: -5%;
        max-width: 100vw;
        min-width: 100%;
        border-radius: 6px;
    }
    
    .image-caption {
        font-size: 0.85rem;
        margin-top: 12px;
        max-width: 100%;
        padding: 0;
        text-align: left;
    }
}

/* Exact Copy Design System */
:root {
    /* Primary Colors - Exact Purple */
    --color-primary-500: rgb(128 0 255);
    --color-primary-600: rgb(112 0 224);
    --color-primary-700: rgb(96 0 192);
    
    /* Neutral Colors */
    --color-gray-50: rgb(250 250 250);
    --color-gray-100: rgb(245 245 245);
    --color-gray-200: rgb(229 229 229);
    --color-gray-300: rgb(212 212 212);
    --color-gray-400: rgb(163 163 163);
    --color-gray-500: rgb(115 115 115);
    --color-gray-600: rgb(82 82 82);
    --color-gray-700: rgb(64 64 64);
    --color-gray-800: rgb(38 38 38);
    --color-gray-900: rgb(23 23 23);
    --color-gray-950: rgb(0 0 0);
    
    /* Brand Colors */
    --color-brand-500: var(--color-primary-500);
    --color-brand-600: var(--color-primary-600);
    --color-brand-700: var(--color-primary-700);
    
    --color-white: rgb(255 255 255);
    --color-black: rgb(0 0 0);
    
    /* Shadows from react-main */
    --shadow-xs: 0px 1px 2px rgba(10, 13, 18, 0.05);
    --shadow-sm: 0px 1px 3px rgba(10, 13, 18, 0.1), 0px 1px 2px -1px rgba(10, 13, 18, 0.1);
    --shadow-md: 0px 4px 6px -1px rgba(10, 13, 18, 0.1), 0px 2px 4px -2px rgba(10, 13, 18, 0.06);
    --shadow-lg: 0px 12px 16px -4px rgba(10, 13, 18, 0.08), 0px 4px 6px -2px rgba(10, 13, 18, 0.03), 0px 2px 2px -1px rgba(10, 13, 18, 0.04);
    --shadow-xl: 0px 20px 24px -4px rgba(10, 13, 18, 0.08), 0px 8px 8px -4px rgba(10, 13, 18, 0.03), 0px 3px 3px -1.5px rgba(10, 13, 18, 0.04);
    --shadow-2xl: 0px 24px 48px -12px rgba(10, 13, 18, 0.18), 0px 4px 4px -2px rgba(10, 13, 18, 0.04);
    
    /* Border radius */
    --radius-sm: 0.125rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-3xl: 1.5rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(32, 33, 36, 0.3) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    z-index: 1200; /* ensure navbar and its controls stay above overlays */
    height: 56px; /* Increased from 42px */
    padding: 0 8px; /* Increased from 2px on each side */
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    /* Mobile optimizations */
    -webkit-transform: translateZ(0) translateX(-50%);
    transform: translateZ(0) translateX(-50%);
    /* Hug logo specifically - width based on logo */
    width: fit-content;
    min-width: 56px; /* Logo width (40px) + padding (8px on each side) */
    display: flex;
    align-items: center;
}

/* Global dim/blur backdrop when mobile menu is open */
body.menu-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(12, 13, 15, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1050; /* below navbar(1200) and menu(1100), above page */
    pointer-events: auto; /* intercept taps to prevent page interactions */
}



.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    gap: 20px;
    /* Ensure container doesn't force header to expand beyond logo */
    flex-shrink: 0;
    /* Make container width fit only the logo */
    width: fit-content;
    min-width: fit-content;
}

.nav-logo a {
    text-decoration: none;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
}


.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--color-gray-300);
    font-weight: 500;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    font-size: 0.8rem;
    letter-spacing: 0.025em;
    padding: 0.4rem 0.8rem;
    /* cursor hidden only on desktop via media below */
    /* Mobile optimizations */
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Hide default cursor on desktop for nav links */
@media (min-width: 769px) and (pointer: fine) {
    .nav-link {
        cursor: none;
    }
}

.nav-link:hover {
    color: var(--color-white);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -1px; /* Position directly on the header's border-bottom */
    left: 50%;
    width: 0;
    height: 1px; /* Thinner line */
    background: rgba(255, 255, 255, 0.4); /* More subtle, semi-transparent white */
    transition: all 0.3s ease;
    transform: translateX(-50%);
    z-index: 1; /* Ensure it appears above the border */
}

.nav-link:hover::after {
    width: 80%;
}



/* Logo SVG styles */
.logo-svg {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    transition: all 1s ease-in-out;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
    /* Ensure SVG maintains aspect ratio and doesn't scale */
    overflow: visible;
}

/* Show dark version (white square, dark letters) by default */
.logo-dark {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    opacity: 1;
    visibility: visible;
    transition: all 1s ease-in-out;
    transform: scale(1);
    box-sizing: border-box;
    /* Prevent any scaling or size changes */
    flex-shrink: 0;
    flex-grow: 0;
}

.logo-light {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    opacity: 0;
    visibility: hidden;
    transition: all 1s ease-in-out;
    transform: scale(1);
    box-sizing: border-box;
    /* Prevent any scaling or size changes */
    flex-shrink: 0;
    flex-grow: 0;
}



/* Smooth transitions for logo elements */
.logo-square {
    transition: fill 1s ease-in-out, stroke 1s ease-in-out;
}

.logo-letters {
    transition: fill 1s ease-in-out;
}

/* Hover effects with smooth transitions */

.logo-svg:hover .logo-dark rect {
    fill: var(--color-primary-500);
    stroke: var(--color-primary-500);
}

.logo-svg:hover .logo-dark path {
    fill: var(--color-white);
}

.logo-svg:hover .logo-light rect {
    fill: var(--color-primary-600);
    stroke: var(--color-primary-600);
}

.logo-svg:hover .logo-light path {
    fill: var(--color-white);
}



.hamburger {
    display: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    background: transparent;
    border: none;
    outline: none;
    position: relative;
}

.hamburger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-icon {
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    transition: all 0.3s ease;
}

.bar {
    width: 25px;
    height: 3px;
    background-color: var(--color-white);
    margin: 3px 0;
    transition: 0.3s ease;
    border-radius: 2px;
}

.hamburger.active .hamburger-icon {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.hamburger.active .close-icon {
    display: flex;
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Position the close icon absolutely over the hamburger icon */
.hamburger {
    position: relative;
}

.close-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    pointer-events: none;
}

.hamburger.active .close-icon {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Background Elements */
.background-gif-element {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1; /* place video below grid so grid is visible */
    /* Performance optimizations */
    will-change: auto;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Reduce animation frame rate for better performance */
    animation: none;
    /* Optimize for mobile */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.background-gif-element video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.06;
    mix-blend-mode: multiply;
    display: block;
    visibility: visible;
}

/* Desktop styles for larger background video */
@media (min-width: 1024px) {
    .background-gif-element video {
        object-fit: cover;
    }
}

/* Mobile optimization - reduce video opacity on mobile for better performance */
@media (max-width: 768px) {
    .background-gif-element video {
        opacity: 0.035; /* slightly lower on mobile */
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* Ensure grid pseudo-element sits inside its container stacking context */
@media (max-width: 768px) {
    .background-lines-element { position: fixed; }
}

.background-lines-element {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../assets/images/bg-lines.png') no-repeat center;
    background-size: cover; /* desktop */
    opacity: 0.2;
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 2; /* above video, below content */
}

/* Mobile: ensure bg-lines is visible and performant */
@media (max-width: 768px) {
    .background-lines-element {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: url('../assets/images/bg-lines.png') no-repeat center;
        background-size: cover;
        opacity: 0.2;
        mix-blend-mode: screen;
        pointer-events: none;
        z-index: 2;
        overflow: hidden;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    /* Disable rotated pseudo-element on mobile */
    .background-lines-element::before { content: none; }
}

/* Very small screens: slightly reduce intensity */
@media (max-width: 480px) {
    .background-lines-element { opacity: 0.18; }
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: transparent;
    color: var(--color-white);
    padding-top: 80px;
    position: relative;
    overflow: hidden;
    z-index: 3;
    margin-bottom: -1px;
    /* Mobile optimizations */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.hero::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
    z-index: 0;
}

.hero-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    min-height: calc(100vh - 120px);
    position: relative;
    z-index: 5;
    padding-top: 120px;
    width: 100%;
    box-sizing: border-box;
    /* Prevent layout shift during animations */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
    margin: 0 auto;
    width: fit-content;
    max-width: 100%;
}

.hero-title {
    font-size: 4rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 2;
    font-family: 'Instrument Serif', serif;
    text-align: center;
    color: var(--color-white);
    /* Prevent layout shift during animations */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: auto;
}

.highlight {
    color: var(--color-white);
    position: relative;
    opacity: 1;
    visibility: visible;
}

/* Add padding around text spans for better cursor interaction */
.hero-description span,
.about-content p span,
.project-content h3 span,
.project-content p span,
.section-title span {
    padding: 5px 15px;
    display: inline-block;
}

/* Keep hero title spans inline for single line display */
.hero-title span {
    padding: 5px 15px;
    display: inline;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Prevent layout shift during typing animation */
.hero-title .highlight {
    display: inline-block;
    min-width: 0;
    transition: none;
    /* Hide text initially to prevent flash */
    visibility: hidden;
    opacity: 1;
    /* Additional protection against flash */
    position: relative;
}

/* Show text only after JavaScript initialization */
.hero-title .highlight.initialized {
    visibility: visible;
}

.hero-title .highlight {
    display: block;
}

.hero-title span:not(.highlight) {
    white-space: nowrap;
}

/* Ensure location text stays on one line */
.location {
    white-space: nowrap;
    display: inline;
}





@keyframes gradient-shift {
    0%, 100% { 
        background-position: 0% 50%; 
        -webkit-background-position: 0% 50%;
    }
    50% { 
        background-position: 100% 50%; 
        -webkit-background-position: 100% 50%;
    }
}

@keyframes underline-grow {
    to { 
        transform: scaleX(1); 
        -webkit-transform: scaleX(1);
    }
}

.hero-subtitle {
    font-size: 1.75rem;
    font-weight: 400;
    margin-bottom: 2rem;
    opacity: 1;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-align: center;
    color: var(--color-white);
}

.hero-description {
    font-size: 1.125rem;
    margin-bottom: 3rem;
    opacity: 0.8;
    line-height: 1.6;
    text-align: center;
    color: var(--color-gray-300);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    /* cursor hidden only on desktop via media below */
    font-size: 0.95rem;
    line-height: 1.25rem;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.025em;
    font-family: 'Instrument Sans', sans-serif;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Hide default cursor on desktop for buttons */
@media (min-width: 769px) and (pointer: fine) {
    .btn {
        cursor: none;
    }
}

.btn-primary {
    background: #8E0CE5;
    color: var(--color-white);
    box-shadow: 0 4px 12px 0 rgba(142, 12, 229, 0.3);
    border: 2px solid #A855F7;
}

.btn-primary:hover {
    background: #8E0CE5;
    border-color: #A855F7;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(142, 12, 229, 0.4);
    /* Mobile optimizations */
    -webkit-transform: translateY(-1px);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px 0 rgba(128, 0, 255, 0.3);
    /* Mobile optimizations */
    -webkit-transform: translateY(0);
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(59, 5, 95, 0.09);
    color: #b36bf7;
    border: 2px solid #A855F7;
    box-shadow: none;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.btn-secondary:hover {
    background: #8E0CE5;
    color: var(--color-white);
    border-color: #A855F7;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(141, 47, 230, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    /* Mobile optimizations */
    -webkit-transform: translateY(-1px);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
    /* Mobile optimizations */
    -webkit-transform: translateY(0);
    transform: translateY(0);
}

.btn-ghost {
    background: transparent;
    color: var(--color-gray-600);
    border: 1px solid var(--color-gray-300);
}

.btn-ghost:hover {
    background: var(--color-gray-50);
    border-color: var(--color-gray-400);
    color: var(--color-gray-700);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { 
        transform: rotate(0deg); 
        -webkit-transform: rotate(0deg);
    }
    100% { 
        transform: rotate(360deg); 
        -webkit-transform: rotate(360deg);
    }
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.profile-card {
    width: 320px;
    height: 320px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-3xl);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.profile-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

.profile-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

.profile-image {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    z-index: 2;
}

.profile-image {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.8);
}



/* Section Styles */
.section-title {
    font-size: 3rem;
    font-weight: 400;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--color-white);
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-family: 'Instrument Serif', serif;
}

/* About Section */
.about {
    padding: 6rem 0;
    background: transparent;
    color: var(--color-white);
    position: relative;
    overflow: hidden;
    z-index: 3;
    margin-bottom: -1px;
    margin-top: -1px;
    /* Mobile optimizations */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* About Experience (inside About) */
.about-experience { margin-top: 1.75rem; }
.about-subtitle { margin: 0.5rem 0 0.9rem; }
.about-subtitle span {
    font-family: 'Instrument Serif', serif;
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--color-white);
    padding: 5px 15px;
    display: inline-block;
}
.about-experience .experience-list { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.about-experience .experience-item { display: grid; grid-template-columns: 1fr 180px; align-items: center; gap: 16px; padding: 16px 18px; background: #2C2E36; border: 1px solid #3C3E48; border-radius: 12px; transition: border-color 0.2s ease, transform 0.2s ease; }
.about-experience .experience-item:hover { border-color: #4A4D58; transform: translateY(-1px); }
.about-experience .exp-meta { display: flex; flex-direction: column; gap: 4px; }
.about-experience .exp-role { display: none; }
.about-experience .exp-company { color: var(--color-white); font-size: 1rem; font-weight: 600; letter-spacing: 0.2px; }
.about-experience .exp-dates { color: var(--color-gray-400); font-size: 0.92rem; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; -moz-font-feature-settings: "tnum" 1; -webkit-font-feature-settings: "tnum" 1; font-feature-settings: "tnum" 1; }
@media (max-width: 640px) { .about-experience .experience-item { grid-template-columns: 1fr; align-items: start; gap: 8px; } .about-experience .exp-dates { white-space: normal; text-align: left; } }

.about::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
    z-index: 1;
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

.about-card {
    background: #2C2E36;
    border: 1px solid #353842;
    border-radius: var(--radius-3xl);
    padding: 2rem;
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
    position: relative;
}

/* Removed hover highlight effect */

.about-lede span {
    display: block;
    font-family: 'Instrument Serif', serif;
    font-size: 2rem;
    line-height: 1.35;
    color: var(--color-white);
    margin-bottom: 1rem;
    letter-spacing: 0.1px;
}

.about-body p span { color: var(--color-gray-300); }
.about-body p { margin-bottom: 1.1rem; }

.about-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
    align-items: stretch;
    grid-auto-rows: 1fr;
}

.stat {
    background: #2B2C33;
    border: 1px solid #3C3E48;
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 100%;
}

.stat-value span {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-white);
}

.stat-label span {
    display: block;
    font-size: 0.8rem;
    color: var(--color-gray-400);
    margin-top: 4px;
}

.stat-badges {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-badges .tag {
    font-size: 0.7rem;
    padding: 0.35rem 0.7rem;
}

@media (max-width: 900px) {
    .about-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .about-card { padding: 1.25rem; }
    .about-lede span { font-size: 1.4rem; }
    .about-stats { grid-template-columns: 1fr; }
}

.about-content p {
    color: var(--color-white);
    font-size: 1.125rem;
    line-height: 1.75;
    margin-bottom: 1.5rem;
}

.about-text p {
    font-size: 1.125rem;
    line-height: 1.75;
    margin-bottom: 3rem;
    color: var(--color-white);
}

.skills h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--color-gray-900);
}

.skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.skill-category h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-brand-600);
}

.skill-category ul {
    list-style: none;
}

.skill-category li {
    padding: 0.5rem 0;
    color: var(--color-gray-600);
    position: relative;
    padding-left: 1.5rem;
    font-size: 0.875rem;
}

.skill-category li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--color-brand-500);
}

/* Projects Section */
.projects {
    padding: 3rem 0;
    position: relative;
    overflow: hidden;
    background: transparent;
    color: var(--color-white);
    z-index: 3;
    /* Mobile optimizations */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.projects::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    pointer-events: none;
    z-index: 0;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    position: relative;
    z-index: 5;
    /* Prevent horizontal scrollbar */
    max-width: 100%;
    overflow-x: hidden;
    /* Add padding to prevent hover cutoff */
    padding: 1rem 0;
}

/* Desktop: 2 columns layout with proper alignment */
@media (min-width: 1200px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 3rem;
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
        /* Add top and bottom padding for hover effect */
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

.project-card {
    background: #2C2E36;
    border-radius: var(--radius-3xl);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(30, 31, 37, 0.3), 0 2px 4px -1px rgba(30, 31, 37, 0.2);
    transition: all 0.3s ease;
    border: 1px solid #353842;
    position: relative;
    backdrop-filter: blur(5px);
    --mouse-x: 50%;
    --mouse-y: 50%;
    --border-glow: 0;
    /* Mobile optimizations */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* Prevent horizontal scrollbar */
    max-width: 100%;
    box-sizing: border-box;
}

.project-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
    width: 100%;
}

/* Border glow effect - applies to the actual border */
.project-card.border-glow {
    position: relative;
}

.project-card.border-glow .border-glow-effect {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: var(--radius-3xl);
    background: radial-gradient(
        circle 100px at var(--mouse-x) var(--mouse-y),
        rgba(255, 255, 255, 1) 0%,
        rgba(255, 255, 255, 0.95) 15%,
        rgba(255, 255, 255, 0.85) 30%,
        rgba(255, 255, 255, 0.7) 50%,
        rgba(255, 255, 255, 0.4) 70%,
        rgba(255, 255, 255, 0.2) 85%,
        transparent 100%
    );
    z-index: 0;
    pointer-events: none;
}

.project-card.border-glow .border-glow-mask {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-3xl);
    background: #2C2E36;
    z-index: 1;
    pointer-events: none;
}

/* Ensure content stays above the mask */
.project-card .project-image,
.project-card .project-content {
    position: relative;
    z-index: 2;
}

.project-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(30, 31, 37, 0.4), 0 10px 10px -5px rgba(30, 31, 37, 0.3);
    /* Mobile optimizations */
    -webkit-transform: translateY(-4px) scale(1.02);
    transform: translateY(-4px) scale(1.02);
}

.project-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: var(--radius-3xl);
    background: radial-gradient(
        circle 60px at var(--mouse-x) var(--mouse-y),
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0.15) 30%,
        rgba(255, 255, 255, 0.05) 60%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.project-card:hover::before {
    opacity: 1;
}

.project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-3xl);
    background: radial-gradient(
        circle 80px at var(--mouse-x) var(--mouse-y),
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.04) 40%,
        rgba(255, 255, 255, 0.02) 70%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 2;
    /* Ensure the effect stays within bounds */
    overflow: hidden;
    border-radius: inherit;
}

.project-card:hover::after {
    opacity: 1;
}

.project-image {
    height: 240px;
    background: var(--color-black);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.project-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

.project-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

.project-placeholder {
    font-size: 3rem;
    color: var(--color-white);
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.project-placeholder-black {
    width: 100%;
    height: 100%;
    background: var(--color-black);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-size: 1.5rem;
    font-weight: 500;
    opacity: 0.7;
}

.project-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.project-card:hover .project-preview-image {
    transform: scale(1.05);
}

.project-content {
    padding: 1.5rem;
    background: #2C2E36;
}

.project-content h3 span,
.project-content p span {
    padding-left: 0;
}

.project-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-white);
    line-height: 1.4;
}

.project-content p {
    color: var(--color-gray-300);
    margin-bottom: 1.25rem;
    line-height: 1.6;
    font-size: 0.875rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: #353740;
    color: var(--color-white);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #3C3E48;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.025em;
}

.tag:hover {
    background: #3C3E48;
    border-color: #4A4D58;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    /* Mobile optimizations */
    -webkit-transform: translateY(-1px);
    transform: translateY(-1px);
}

/* Contact Section */
.contact {
    padding: 6rem 0;
    background: transparent;
    color: var(--color-white);
    position: relative;
    overflow: hidden;
    z-index: 3;
    margin-bottom: -1px;
    margin-top: -1px;
    /* Mobile optimizations */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Experience Section */
.experience {
    padding: 4rem 0 6rem;
    background: transparent;
    color: var(--color-white);
    position: relative;
    z-index: 3;
}

.experience-list {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.experience-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: #2C2E36;
    border: 1px solid #353842;
    border-radius: 14px;
}

.exp-meta { display: flex; flex-direction: column; gap: 4px; }
.exp-role { font-weight: 600; color: var(--color-white); }
.exp-company { color: var(--color-gray-300); font-size: 0.95rem; }
.exp-dates { color: var(--color-gray-400); font-size: 0.9rem; white-space: nowrap; }

@media (max-width: 640px) {
    .experience-item { grid-template-columns: 1fr; align-items: start; }
    .exp-dates { white-space: normal; }
}

.contact::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
    z-index: 1;
}

/* New Contact Form Styles */
.contact-form-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

.contact-form-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.contact-title {
    font-family: 'Instrument Serif', serif;
    font-size: 56px;
    font-weight: 400;
    color: var(--color-white);
    margin: 0;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #2B2C33;
    border-radius: 7px;
    border: 1px solid #3C3E48;
}

.status-dots {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.status-dot-pulse {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #0fe32f62;
    border-radius: 50%;
    animation: pulse 2s infinite;
    opacity: 0.1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: blur(0.8px);
}

.status-dot-static {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #0FE32F;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.status-text {
    font-size: 0.875rem;
    color: #0FE32F;
    font-weight: 500;
}

.contact-form {
    background: #2C2E36;
    padding: 2.5rem;
    border-radius: var(--radius-2xl);
    border: 1px solid #353842;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.contact-form::before {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

/* Custom validation messages */
        .validation-message {
            position: absolute;
            top: 50%;
            left: calc(100% + 0.5rem);
            font-size: 0.75rem;
            color: #fff;
            padding: 0.25rem 0.5rem;
            background: #ef4444;
            border-radius: var(--radius-sm);
            opacity: 0;
            transform: translateY(-50%) translateX(-10px);
            transition: all 0.3s ease;
            pointer-events: none;
            z-index: 10;
            white-space: nowrap;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
            max-width: 280px;
            min-width: fit-content;
            width: fit-content;
        }

.validation-message.show {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.validation-message::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -4px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    transform: translateY(-50%) rotate(45deg);
    border-bottom: none;
    border-right: none;
}

.form-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #C9C9C9;
    margin-bottom: 0.5rem;
    position: relative;
    min-width: fit-content;
}

.optional {
    color: #a1a1a1;
    font-weight: 400;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid #3C3E48;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
    background: #2B2C33;
    color: white;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
}

.form-input::placeholder {
    color: #C9C9C9;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: white;
    background: #2B2C33;
    color: white;
}

.form-input.error,
.form-textarea.error {
    border-color: #ef4444 !important;
    border-width: 2px !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;
    background-color: rgba(239, 68, 68, 0.05) !important;
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
    line-height: 1.5;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 0.875rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.input-icon.show {
    opacity: 1;
}

.message-label-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.message-label-container .form-label {
    margin-bottom: 0;
}

.textarea-wrapper {
    position: relative;
}

.char-counter {
    font-size: 0.75rem;
    color: #D1D5DB;
    font-weight: 500;
}

.submit-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: var(--color-primary-500);
    color: var(--color-white);
    border: 2px solid #7f12e6;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.submit-btn:hover {
    background: var(--color-primary-600);
    border-color: #9030eb;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(103, 6, 167, 0.4);
    -webkit-transform: translateY(-1px);
}

.submit-btn:active {
    transform: translateY(0);
    -webkit-transform: translateY(0);
}

/* Footer */
.footer {
    background: transparent;
    color: var(--color-white);
    text-align: center;
    padding: 3rem 0;
    position: relative;
    overflow: hidden;
    z-index: 3;
    margin-bottom: 0;
    /* Mobile optimizations */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.footer-social {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.footer .social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: inherit;
    text-decoration: none;
    font-weight: 500;
}

.footer .social-link i { font-size: 1.1rem; }

.footer .social-link:hover { opacity: 0.85; }

/* Light theme adjustments for footer */
body.light-theme .footer { color: #101828; }
body.light-theme .footer .social-link { color: #101828; }

.footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

/* Responsive Design */

/* Large screens (1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    .hero-title {
        font-size: 4.5rem;
    }
    
    .section-title {
        font-size: 3.5rem;
    }
}

/* Medium screens (768px to 1199px) */
@media (max-width: 1199px) and (min-width: 768px) {
    .container {
        max-width: 960px;
        padding: 0 30px;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .section-title {
        font-size: 2.8rem;
    }
    
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
    
    .contact-form-container {
        max-width: 500px;
    }
    
    .contact-title {
        font-size: 2rem;
    }
    
    .contact-form-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

/* Tablet screens (768px and down) */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }
    
    .navbar {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        height: 56px; /* Optimized to match desktop */
        padding: 0 8px; /* Increased from 2px on each side */
        width: fit-content;
        min-width: 56px; /* Logo width (40px) + padding (8px on each side) */
        display: flex;
        align-items: center;
    }
    
    .nav-container {
        padding: 0;
        gap: 15px;
        /* Ensure container doesn't force header to expand beyond logo */
        flex-shrink: 0;
    }
    
    
    
    .hamburger {
        display: flex;
    }

    .nav-menu {
        /* Compact dropdown panel under the navbar */
        position: fixed;
        top: 64px;
        left: 50%;
        transform: translate(-50%, -10px) scale(0.98);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        width: 92vw;
        max-width: 360px;
        background: rgba(32, 33, 36, 0.86); /* more transparent */
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: 12px 8px;
        text-align: center;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 16px;
        box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
        z-index: 1100;
        opacity: 0;
        pointer-events: none;
        transition: transform 0.25s ease, opacity 0.22s ease;
    }

    /* Dimmed, blurred backdrop around the dropdown for readability */
    .nav-menu::before { display: none; }

    .nav-menu.active {
        transform: translate(-50%, 0) scale(1);
        opacity: 1;
        pointer-events: auto;
    }
    
    .nav-menu .nav-item {
        margin: 0.5rem 0;
    }
    
    .nav-link {
        font-size: 1.2rem;
        padding: 0.9rem 1.2rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    .hero-container {
        padding: 0 20px;
        padding-top: 140px;
        box-sizing: border-box;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .hero-title {
        font-size: 2.8rem;
        line-height: 1.1;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        max-width: 100%;
        padding: 0 10px;
    }
    
    .hero-description {
        font-size: 1rem;
        max-width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        padding: 0 10px;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        width: fit-content;
        max-width: 300px;
        margin: 0 auto;
        justify-content: center;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        padding: 16px 32px;
        font-size: 1rem;
        min-height: 48px;
    }

    .section-title {
        font-size: 2.2rem;
        margin-bottom: 2rem;
    }
    
    .about-content p {
        font-size: 1rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .project-card {
        margin-bottom: 1rem;
    }
    
    .project-image {
        height: 200px;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .contact-form-container {
        max-width: 100%;
        padding: 0 1rem;
    }
    
            .validation-message {
            left: 0;
            top: 100%;
            transform: translateY(0.25rem) translateX(0);
            max-width: 100%;
            min-width: fit-content;
            width: fit-content;
            white-space: nowrap;
        }
    
    .validation-message.show {
        transform: translateY(0.25rem) translateX(0);
    }
    
    .validation-message::before {
        top: -4px;
        left: 1rem;
        transform: rotate(45deg);
    }
    
    .contact-title {
        font-size: 1.75rem;
    }
    
    .contact-form {
        padding: 1.5rem;
    }
    
    .form-input,
    .form-textarea {
        padding: 0.875rem 1rem;
    }
    
    .submit-btn {
        padding: 0.875rem 1.5rem;
    }
    
    .gif-image {
        max-width: 110%;
    }
    
    .logo-svg {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }
    
    .logo-dark,
    .logo-light {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }
}

/* Mobile screens (480px and down) */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .background-gif-element video {
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0.03; /* Further reduce opacity for smaller screens */
    }
    
    .navbar {
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        height: 56px; /* Optimized to match desktop */
        padding: 0 8px; /* Increased from 2px on each side */
        width: fit-content;
        min-width: 56px; /* Logo width (40px) + padding (8px on each side) */
        display: flex;
        align-items: center;
    }
    
    .nav-container {
        padding: 0;
        gap: 10px;
        /* Ensure container doesn't force header to expand beyond logo */
        flex-shrink: 0;
    }
    
    
    
        .hamburger {
        display: flex;
    }

    .nav-menu {
        /* Compact dropdown for small phones */
        position: fixed;
        top: 62px;
        left: 50%;
        transform: translate(-50%, -10px) scale(0.98);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        width: 92vw;
        max-width: 340px;
        background: rgba(32, 33, 36, 0.86); /* more transparent */
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: 10px 8px;
        text-align: center;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 14px;
        box-shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
        z-index: 1100;
        opacity: 0;
        pointer-events: none;
        transition: transform 0.25s ease, opacity 0.22s ease;
    }

    /* Dimmed, blurred backdrop around the dropdown for readability */
    .nav-menu::before { display: none; }

    .nav-menu.active {
        transform: translate(-50%, 0) scale(1);
        opacity: 1;
        pointer-events: auto;
    }
    
    .nav-menu .nav-item {
        margin: 0.6rem 0;
    }
    
    .nav-link {
        font-size: 1.15rem;
        padding: 0.9rem 1.2rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    .hero-container {
        padding: 0 15px;
        padding-top: 120px;
        box-sizing: border-box;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .hero-title {
        font-size: 2.2rem;
        line-height: 1.1;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        max-width: 100%;
        padding: 0 10px;
    }
    
    .hero-description {
        font-size: 0.95rem;
        margin-bottom: 2rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        max-width: 100%;
        padding: 0 10px;
    }

    .btn {
        padding: 16px 32px;
        font-size: 1rem;
        min-height: 48px;
    }
    
    .hero-buttons {
        max-width: 280px;
        width: fit-content;
        margin: 0 auto;
        justify-content: center;
        align-items: center;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
    
    .about-content p {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .about {
        padding: 4rem 0;
    }
    
    .projects {
        padding: 2rem 0;
        min-height: auto; /* remove forced full-screen height on mobile */
        display: block;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem 0;
        flex: initial;
        min-height: auto; /* avoid extra blank space */
    }
    
    .project-card {
        margin-bottom: 0.5rem;
    }
    
    .project-image {
        height: 180px;
    }
    
    .contact {
        padding: 4rem 0;
    }
    
    .project-content {
        padding: 1rem;
    }
    
    .project-content h3 {
        font-size: 1.1rem;
    }
    
    .project-content p {
        font-size: 0.85rem;
    }
    
    .tag {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
    
    .contact-method {
        padding: 0.8rem;
        gap: 0.8rem;
    }
    
    .contact-form-container {
        padding: 0 0.5rem;
    }
    
    .contact-title {
        font-size: 1.5rem;
    }
    
    .contact-form {
        padding: 1rem;
    }
    
    .form-input,
    .form-textarea {
        padding: 0.75rem 0.875rem;
        font-size: 0.875rem;
    }
    
    .submit-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .logo-svg {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }
    
    .logo-dark,
    .logo-light {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }
    
    /* Project images for very small screens */
    .project-image-container {
        width: 108%;
        margin-left: -4%;
        max-width: 100vw;
        min-width: 100%;
        border-radius: 6px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    }
    
    .project-main-image {
        width: 100%;
        height: auto;
        object-fit: contain;
    }
    
    .project-image-container.ui-states-image,
    .project-image-container.results-image {
        width: 100%;
        margin: 16px 0;
        border-radius: 6px;
    }
    
    .project-image-container.ui-states-image img,
    .project-image-container.results-image img {
        width: 100%;
        height: auto;
        object-fit: contain;
        border-radius: 6px;
    }
    
    /* TOC styles for smallest screens */
    .toc-link {
        font-size: 1.05rem;
        padding: 14px 16px;
        margin-bottom: 5px;
    }
    
    .toc-sublink {
        font-size: 1rem;
        padding: 10px 16px 10px 28px;
        margin-bottom: 3px;
        color: rgba(255, 255, 255, 0.95);
    }
    
    /* Navigation styles for smallest screens */
    .nav-link {
        font-size: 1.15rem;
        padding: 0.9rem 1.2rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    .nav-menu .nav-item {
        margin: 0.5rem 0;
    }
}

/* Small mobile screens (360px and down) */
@media (max-width: 360px) {
    .hero-title {
        font-size: 1.8rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        max-width: 100%;
        padding: 0 10px;
    }
    
    .background-gif-element video {
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0.02; /* Minimal opacity for very small screens */
    }
    
    .hero-description {
        font-size: 0.9rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        max-width: 100%;
        padding: 0 10px;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .btn {
        padding: 14px 28px;
        font-size: 0.95rem;
        min-height: 44px;
    }
    
    .hero-buttons {
        max-width: 260px;
        width: fit-content;
        margin: 0 auto;
        justify-content: center;
        align-items: center;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .nav-container {
        padding: 0 10px;
    }
    
    .hero-container {
        padding: 0 10px;
        box-sizing: border-box;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .projects {
        padding: 1.5rem 0;
        min-height: auto; /* remove forced full-screen height */
        display: block;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0.75rem 0;
        flex: 1;
        min-height: calc(100vh - 100px);
    }
    
    .project-card {
        margin-bottom: 0.25rem;
    }
    
    .project-image {
        height: 160px;
    }
    
    /* Project images for smallest screens */
    .project-image-container {
        width: 105%;
        margin-left: -2.5%;
        max-width: 100vw;
        min-width: 100%;
        border-radius: 4px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .project-main-image {
        width: 100%;
        height: auto;
        object-fit: contain;
    }
    
    .project-image-container.ui-states-image,
    .project-image-container.results-image {
        width: 100%;
        margin: 12px 0;
        border-radius: 4px;
    }
    
    .project-image-container.ui-states-image img,
    .project-image-container.results-image img {
        width: 100%;
        height: auto;
        object-fit: contain;
        border-radius: 4px;
    }
}

/* Landscape orientation adjustments for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-container {
        padding-top: 80px;
        min-height: calc(100vh - 80px);
        box-sizing: border-box;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .hero-title {
        font-size: 2.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        max-width: 100%;
        padding: 0 10px;
    }
    
    .hero-buttons {
        flex-direction: row;
        max-width: none;
        width: fit-content;
        margin: 0 auto;
        justify-content: center;
        align-items: center;
    }
    
    .btn {
        width: auto;
        padding: 16px 32px;
        font-size: 1rem;
        min-height: 48px;
    }
    
    .projects {
        padding: 1.5rem 0;
        min-height: calc(100vh - 60px);
        display: flex;
        flex-direction: column;
    }
    
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 0.75rem 0;
        flex: initial;
        min-height: auto; /* avoid tall gap */
    }
    
    .project-card {
        margin-bottom: 0.5rem;
    }
    
    .project-image {
        height: 140px;
    }
    
    .logo-svg {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }
    
    .logo-dark,
    .logo-light {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .background-gif-element,
    .background-lines-element {
        background-size: 110%;
    }
}

/* Mobile fix: ensure bg-lines fits the viewport exactly */
@media (max-width: 768px) {
    .background-lines-element {
        background-size: 100% 100% !important; /* fill full screen */
        background-position: center center;
        background-repeat: no-repeat;
    }
}

/* Custom Cursor */
.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    background: #9CA3AF;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transition: width 0.2s ease, height 0.2s ease, background 0.2s ease;
    /* Mobile optimizations */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* Ensure cursor is visible by default */
    display: block;
    opacity: 1;
}

/* Hide default cursor on desktop with precise pointer */
@media (min-width: 769px) and (pointer: fine) {
    * {
        cursor: none !important;
    }
    
    a, button, .btn, .nav-link, input, textarea, select {
        cursor: none !important;
    }
}

.custom-cursor::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    background: rgba(156, 163, 175, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.2s ease, height 0.2s ease, background 0.2s ease;
}

.custom-cursor.hover {
    width: 16px;
    height: 16px;
    background: rgba(156, 163, 175, 0.8);
    transform: scale(1.1);
    /* Mobile optimizations */
    -webkit-transform: scale(1.1);
    transform: scale(1.1);
}

.custom-cursor.hover::before {
    width: 40px;
    height: 40px;
    background: rgba(156, 163, 175, 0.3);
    transform: translate(-50%, -50%);
    animation: pulse 1.5s ease-in-out infinite;
}

/* Disable custom cursor on mobile/touch devices */
@media (max-width: 768px), (pointer: coarse) {
    .custom-cursor {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
}
/* Additional guard: hide on devices without hover capability */
@media (hover: none), (any-hover: none) {
    .custom-cursor {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
}
/* Final hard lock to prevent any flicker on non-desktop */
@media (max-width: 1023px), (pointer: coarse), (hover: none) {
    .custom-cursor { display: none !important; opacity: 0 !important; visibility: hidden !important; }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(1.05);
        -webkit-transform: translate(-50%, -50%) scale(1.05);
    }
    50% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1.1);
        -webkit-transform: translate(-50%, -50%) scale(1.1);
    }
}

.custom-cursor.text {
    width: 3px;
    height: 24px;
    background: #9CA3AF;
    border-radius: 1px;
    /* Mobile optimizations */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.custom-cursor.text::before {
    width: 0;
    height: 0;
    background: transparent;
}

.custom-cursor.text.large {
    height: 36px;
}

.custom-cursor.text.medium {
    height: 28px;
}

.custom-cursor.text.small {
    height: 20px;
}

/* Smooth Scrolling */

/* TOC Toggle Button */
.toc-toggle-btn {
    position: fixed;
    top: 18px;
    right: 40px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    color: var(--color-gray-700);
    font-size: 1rem;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.toc-toggle-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.toc-toggle-btn.active {
    background: rgba(142, 12, 229, 0.1);
    color: #8E0CE5;
    border-color: rgba(142, 12, 229, 0.2);
}

/* Dark theme for toggle button */
body:not(.light-theme) .toc-toggle-btn {
    background: rgba(32, 33, 36, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-gray-300);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

body:not(.light-theme) .toc-toggle-btn:hover {
    background: rgba(32, 33, 36, 1);
    color: var(--color-gray-200);
}

body:not(.light-theme) .toc-toggle-btn.active {
    background: rgba(142, 12, 229, 0.2);
    color: #8E0CE5;
    border-color: rgba(142, 12, 229, 0.3);
}

/* Table of Contents Styles */
.toc-container {
    position: fixed;
    top: 120px;
    right: 40px;
    width: 240px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    
    /* Custom scrollbar styles */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.toc-container.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Webkit scrollbar styles */
.toc-container::-webkit-scrollbar {
    width: 8px;
}

.toc-container::-webkit-scrollbar-track {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.02) 100%);
    border-radius: 4px;
    margin: 4px 0;
}

.toc-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 100%);
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.toc-container::-webkit-scrollbar-thumb::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: calc(100% - 4px);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.4) 100%);
    border-radius: 1px;
}

.toc-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.2) 100%);
    border-color: rgba(0, 0, 0, 0.2);
    transform: scaleX(1.1);
}

.toc-container::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.4) 100%);
    border-color: rgba(0, 0, 0, 0.3);
    transform: scaleX(1.2);
}

/* Hide scrollbar when not needed */
.toc-container::-webkit-scrollbar-thumb:vertical {
    min-height: 20px;
}

.toc-container:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.toc-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Hide close button on desktop */
.toc-close-btn {
    display: none;
}

.toc-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-gray-700);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toc-nav {
    margin: 0;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin-bottom: 8px;
}

.toc-link {
    display: block;
    padding: 8px 12px;
    color: var(--color-gray-600);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.toc-link:hover {
    color: var(--color-gray-900);
    background: rgba(0, 0, 0, 0.05);
    transform: translateX(4px);
}

.toc-link.active {
    color: #8E0CE5;
    background: rgba(142, 12, 229, 0.1);
    font-weight: 600;
}

/* Dark theme adjustments */
body:not(.light-theme) .toc-container {
    background: rgba(32, 33, 36, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Dark theme webkit scrollbar */
body:not(.light-theme) .toc-container::-webkit-scrollbar-track {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

body:not(.light-theme) .toc-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body:not(.light-theme) .toc-container::-webkit-scrollbar-thumb::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.6) 100%);
}

body:not(.light-theme) .toc-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.2) 100%);
    border-color: rgba(255, 255, 255, 0.3);
}

body:not(.light-theme) .toc-container::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.4) 100%);
    border-color: rgba(255, 255, 255, 0.4);
}

body:not(.light-theme) .toc-title {
    color: var(--color-gray-300);
}

body:not(.light-theme) .toc-link {
    color: var(--color-gray-400);
}

body:not(.light-theme) .toc-link:hover {
    color: var(--color-gray-200);
    background: rgba(255, 255, 255, 0.1);
}

body:not(.light-theme) .toc-link.active {
    color: #8E0CE5;
    background: rgba(142, 12, 229, 0.2);
}

/* Responsive design */
@media (max-width: 1200px) {
    .toc-toggle-btn {
        right: 20px;
    }
    
    .toc-container {
        right: 20px;
        width: 200px;
    }
}

@media (max-width: 768px) {
    .toc-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        max-width: none;
        max-height: none;
        padding: 90px 24px 30px;
        background: rgba(0, 0, 0, 0.97);
        backdrop-filter: blur(15px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
        border: none;
        outline: none;
        box-shadow: none;
    }
    
    .toc-container.show {
        opacity: 1;
        visibility: visible;
    }
    
    .toc-header {
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 24px;
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    
    /* Show close button on mobile */
    .toc-close-btn {
        display: flex;
    }
    
    .toc-title {
        font-size: 1.3rem;
        font-weight: 500;
        color: white;
        margin: 0;
    }
    
    .toc-close-btn {
        position: relative;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 10px;
        color: white;
        font-size: 1.1rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        outline: none;
    }
    
    .toc-close-btn:hover {
        background: rgba(255, 255, 255, 0.12);
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .toc-nav {
        padding: 0;
    }
    
    .toc-list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    
    .toc-item {
        margin: 0;
    }
    
    .toc-link {
        font-size: 1.1rem;
        font-weight: 400;
        padding: 16px 18px;
        color: rgba(255, 255, 255, 0.85);
        border-radius: 8px;
        transition: all 0.2s ease;
        display: block;
        text-decoration: none;
        border: 1px solid transparent;
        outline: none;
        margin-bottom: 4px;
    }
    
    .toc-link:hover {
        color: white;
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.08);
    }
    
    .toc-link.active {
        color: white;
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.12);
    }
    
    .toc-sublink {
        font-size: 1.1rem;
        font-weight: 400;
        padding: 12px 16px 12px 32px;
        color: rgba(255, 255, 255, 0.95);
        border-radius: 6px;
        transition: all 0.2s ease;
        display: block;
        text-decoration: none;
        margin-left: 4px;
        margin-bottom: 3px;
        border: 1px solid transparent;
        outline: none;
    }
    
    .toc-sublink:hover {
        color: rgba(255, 255, 255, 0.95);
        background: rgba(255, 255, 255, 0.04);
        border-color: rgba(255, 255, 255, 0.06);
    }
    
    .toc-sublink.active {
        color: rgba(255, 255, 255, 1);
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.08);
    }
}



@media (max-width: 480px) {
    .toc-container {
        padding: 80px 20px 24px;
    }
    
    .toc-title {
        font-size: 1.2rem;
    }
    
    .toc-close-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .toc-link {
        font-size: 1.1rem;
        padding: 16px 18px;
        margin-bottom: 6px;
    }
    
    .toc-sublink {
        font-size: 1.05rem;
        padding: 12px 14px 12px 28px;
        margin-bottom: 4px;
        color: rgba(255, 255, 255, 0.95);
    }
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

/* Active section highlighting */
.project-section {
    scroll-margin-top: 100px;
}

/* Project Images Section Styles */
.project-image-section {
    margin-bottom: 60px;
}

.project-image-section:last-child {
    margin-bottom: 0;
}

.image-section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-gray-900);
    margin-bottom: 20px;
    text-align: left;
}

body.light-theme .image-section-title {
    color: #101828;
}

/* Placeholder styles for future images */
.placeholder-image {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.placeholder-image:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-color: #adb5bd;
    transform: translateY(-2px);
}

.placeholder-content {
    text-align: center;
    color: #6c757d;
}

.placeholder-content i {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.6;
}

.placeholder-content p {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
}

/* Dark theme adjustments for placeholders */
body:not(.light-theme) .placeholder-image {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    border-color: #4a5568;
}

body:not(.light-theme) .placeholder-content {
    color: #a0aec0;
}

body:not(.light-theme) .placeholder-image:hover {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    border-color: #718096;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .project-image-section {
        margin-bottom: 40px;
    }
    
    .image-section-title {
        font-size: 1.1rem;
        margin-bottom: 16px;
    }
    
    .placeholder-image {
        min-height: 200px;
    }
    
    .placeholder-content i {
        font-size: 1.5rem;
    }
    
    .placeholder-content p {
        font-size: 0.8rem;
    }
}

/* TOC Sub-list Styles */
.toc-sublist {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 16px;
    border-left: 2px solid rgba(0, 0, 0, 0.1);
    padding-left: 12px;
    transition: all 0.3s ease;
    overflow: hidden;
    max-height: 500px; /* Initial height for animation */
}

.toc-subitem {
    margin-bottom: 4px;
}

.toc-sublink {
    display: block;
    padding: 4px 8px;
    color: var(--color-gray-500);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 400;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1.3;
}

.toc-sublink:hover {
    color: var(--color-gray-700);
    background: rgba(0, 0, 0, 0.03);
    transform: translateX(2px);
}

.toc-sublink.active {
    color: #8E0CE5;
    background: rgba(142, 12, 229, 0.08);
    font-weight: 500;
}

/* Dark theme adjustments for sub-links */
body:not(.light-theme) .toc-sublist {
    border-left-color: rgba(255, 255, 255, 0.2);
}

body:not(.light-theme) .toc-sublink {
    color: var(--color-gray-500);
}

body:not(.light-theme) .toc-sublink:hover {
    color: var(--color-gray-300);
    background: rgba(255, 255, 255, 0.05);
}

body:not(.light-theme) .toc-sublink.active {
    color: #8E0CE5;
    background: rgba(142, 12, 229, 0.15);
}

/* Responsive adjustments for sub-links */
@media (max-width: 768px) {
    .toc-sublist {
        margin-left: 12px;
        padding-left: 8px;
    }
    
    .toc-sublink {
        font-size: 1.1rem;
        padding: 12px 16px 12px 32px;
        color: rgba(255, 255, 255, 0.95);
    }
}

/* TOC Toggle Styles */
.toc-link-with-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.toc-link-with-toggle .toc-link {
    flex: 1;
    margin-right: 8px;
}

.toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-500);
    min-width: 20px;
    height: 20px;
}

.toc-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-gray-700);
}

.toc-toggle-icon {
    transition: transform 0.3s ease;
}

.toc-item.collapsed .toc-toggle-icon {
    transform: rotate(-90deg);
}

.toc-item.collapsed .toc-sublist {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    overflow: hidden;
}

/* Light theme TOC toggle */
body.light-theme .toc-toggle {
    color: var(--color-gray-500);
}

body.light-theme .toc-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-gray-700);
}

/* Dark theme TOC toggle */
body:not(.light-theme) .toc-toggle {
    color: var(--color-gray-400);
}

body:not(.light-theme) .toc-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-gray-300);
}

/* UI States Image Container - Full Width */
.project-image-container.ui-states-image {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    margin: 0;
    padding: 0;
}

.project-image-container.ui-states-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
}

/* Real-World Results Image Container - Standard Size */
.project-image-container.results-image {
    width: 100%;
    max-width: 100%;
    margin: 32px 0;
    padding: 0;
}

.project-image-container.results-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  font-weight: 700;
}

/* На всякий случай — для вложенных в секции h1 */
section h1, article h1, nav h1, aside h1 {
  font-size: 2.5rem;
}

@media (max-width: 768px) {
  h1,
  section h1, article h1, nav h1, aside h1 {
    font-size: 2rem;
  }
}


