:root {
    --primary: #6366f1;
    --secondary: #8b5cf6;
    --background: #0a0f1c;
    --surface: rgba(255, 255, 255, 0.03);
    --text: #f8fafc;
    --text-secondary: rgba(248, 250, 252, 0.7);
    --animation-speed: 0.4s;
    --animation-delay: 0.1s;
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    will-change: transform;
}

.neural-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 70%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
    pointer-events: none;
    will-change: transform;
    transition: height 0.3s ease;
}

#neural-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.2;
    pointer-events: none;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform;
    transition: height 0.25s ease-out;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    position: relative;
    z-index: 1;
}

.content-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
}

.header {
    min-height: 35vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    margin-bottom: 2rem;
    padding: 2rem 1rem;
    transform: translateZ(0);
}

.title-container {
    position: relative;
    z-index: 2;
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
    max-width: 800px;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Animation for filtering */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn var(--animation-speed) ease-out forwards;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
    transform: translateZ(0);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0 auto 1.5rem;
    max-width: 600px;
}

.header-features {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.feature i {
    color: var(--primary);
}

.services {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin: 0 auto;
    max-width: 1200px;
    position: relative;
    justify-content: flex-start;
    flex: 1;
    min-height: 200px;
    height: auto;
    transition: all 0.3s ease-in-out;
    will-change: opacity, transform, height;
}

.service {
    position: relative;
    padding: 1.2rem;
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    transition: all 0.3s ease;
    overflow: hidden;
    flex: 0 0 calc(33.333% - 1.35rem);
    max-width: calc(33.333% - 1.35rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
}

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

.service::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        800px circle at var(--mouse-x) var(--mouse-y),
        rgba(255, 255, 255, 0.06),
        transparent 40%
    );
    opacity: 0;
    transition: opacity 0.4s;
    z-index: 2;
}

.service::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right bottom,
        transparent,
        rgba(99, 102, 241, 0.05) 40%,
        rgba(139, 92, 246, 0.05)
    );
    z-index: 1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.service > * {
    position: relative;
    z-index: 3;
}

.service:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.service:hover::before {
    opacity: 1;
}

.service:hover::after {
    opacity: 1;
}

.icon {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.1),
        rgba(139, 92, 246, 0.1));
    position: relative;
    transition: all 0.3s ease;
}

.icon::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
}

.icon i {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.2));
}

.service:hover .icon {
    transform: scale(1.1) rotate(-5deg);
}

.service-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.service-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.service-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(145deg, 
        rgba(99, 102, 241, 0.2),
        rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
}

.service-link::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
}

.service-link:hover {
    transform: translateX(4px);
    background: linear-gradient(145deg, 
        rgba(99, 102, 241, 0.3),
        rgba(139, 92, 246, 0.3));
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.2);
}

.service-link i {
    transition: transform 0.3s ease;
}

.service-link:hover i {
    transform: translateX(4px);
}

.service-link .text {
    position: relative;
    z-index: 2;
}

footer p {
    font-family: system-ui, -apple-system, sans-serif;
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    opacity: 0.8;
    width: 100%;
    margin-top: auto;
}

.footer-container {
    width: 100%;
    clear: both;
}

/* Category tabs styling */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    margin: 0 auto 2.5rem;
    max-width: 1200px;
    position: relative;
    z-index: 10;
    padding: 0.5rem;
}

.category-tab {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(145deg, 
        rgba(99, 102, 241, 0.1), 
        rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    min-width: min-content;
    flex: 0 0 auto;
}

.category-tab::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.category-tab i {
    font-size: 1.2rem;
    color: var(--primary);
    transition: all 0.3s ease;
}

.category-tab:hover {
    transform: translateY(-3px);
    background: linear-gradient(145deg, 
        rgba(99, 102, 241, 0.15), 
        rgba(139, 92, 246, 0.15));
    color: var(--text);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.category-tab.active {
    background: linear-gradient(145deg, 
        rgba(99, 102, 241, 0.25), 
        rgba(139, 92, 246, 0.25));
    color: #fff;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.25);
    transform: translateY(-4px);
}

.category-tab.active::before {
    opacity: 0.8;
}

.category-tab.active i {
    color: #fff;
    transform: scale(1.2);
    filter: drop-shadow(0 0 5px rgba(99, 102, 241, 0.5));
}

/* Active state for category tabs */
.category-tab {
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-tab.active {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

.category-tab:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* Project filtering - simplified */
.service {
    transition: opacity 0.25s ease;
}

.service.hidden {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    position: absolute !important;
    pointer-events: none !important;
    z-index: -999 !important;
    overflow: hidden !important;
}

/* Navigation button styling */
.nav-button {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 1rem;
    padding: 1.2rem;
    background: rgba(13, 13, 25, 0.6);
    border-radius: 20px;
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 100;
    border: 2px solid transparent;
    backdrop-filter: blur(10px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.1);
    overflow: hidden;
}

.nav-button::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, 
        #ff3d00, #00a8ff, #ff3d00, #00a8ff,
        #ff3d00, #00a8ff, #ff3d00, #00a8ff);
    border-radius: inherit;
    animation: borderRotate 4s linear infinite;
    background-size: 500%;
    z-index: -2;
}

.nav-button::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: rgba(13, 13, 25, 0.9);
    border-radius: inherit;
    z-index: -1;
}

@keyframes borderRotate {
    0% { background-position: 0% 50% }
    100% { background-position: 130% 50% }
}

.nav-button:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.2);
}

.nav-button .icon-container {
    position: relative;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff3d00, #00a8ff);
    animation: iconPulse 2s infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.nav-button i {
    font-size: 1.2rem;
    color: #fff;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

.nav-button .text-content {
    position: relative;
    overflow: hidden;
    height: 24px;
}

.nav-button .text {
    display: block;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    background: linear-gradient(90deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-button:hover .text {
    transform: translateY(-100%);
    animation: textGlow 2s infinite;
}

@keyframes textGlow {
    0%, 100% { filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3)); }
    50% { filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6)); }
}

.nav-button .particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.nav-button .particle {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
}

/* Accessibility and UX improvements */
button, a, .category-tab {
    -webkit-tap-highlight-color: transparent;
}

/* Better focus states for keyboard navigation */
a:focus, button:focus, .category-tab:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Hide focus outline for mouse users while keeping it for keyboard navigation */
:focus:not(:focus-visible) {
    outline: none;
}

/* Improve scrolling experience on iOS */
html, body {
    -webkit-overflow-scrolling: touch;
}

/* Responsive design */
@media (max-width: 1100px) {
    .services {
        gap: 1.8rem;
    }
    
    .service {
        flex: 0 0 calc(50% - 1rem);
        max-width: calc(50% - 1rem);
    }
}

@media (max-width: 900px) {
    .services {
        gap: 1.6rem;
    }
    
    .service {
        flex: 0 0 calc(50% - 0.8rem);
        max-width: calc(50% - 0.8rem);
    }
    
    .category-tab {
        padding: 0.7rem 1.3rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }

    h1 {
        font-size: 2.5rem;
    }
    
    .category-tabs {
        gap: 0.8rem;
        padding: 0.5rem;
        margin-bottom: 2rem;
        overflow-x: auto;
    }
    
    .category-tab {
        padding: 0.8rem 1.2rem;
        font-size: 0.95rem;
        white-space: nowrap;
    }

    .services {
        gap: 2rem;
    }

    .service {
        padding: 2rem;
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    .category-tab {
        padding: 0.7rem 1rem;
    }

    .category-tab span {
        display: inline-block;
    }
    
    .service {
        padding: 1.5rem;
    }
    
    .service-title {
        font-size: 1.3rem;
    }
    
    .service-desc {
        font-size: 0.9rem;
    }
}

@media (max-width: 600px) {
    .header {
        min-height: 30vh;
        padding: 1.5rem 0.5rem;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .category-tabs {
        gap: 0.5rem;
        margin-bottom: 1.8rem;
    }
    
    .category-tab {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .category-tab span {
        display: none;
    }
    
    .category-tab i {
        font-size: 1.2rem;
        margin: 0 0.1rem;
    }
    
    .services {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    
    .service {
        padding: 1.3rem;
    }
    
    .service-title {
        font-size: 1.3rem;
    }
    
    .nav-button {
        top: 1rem;
        right: 1rem;
        padding: 0.8rem;
        border-radius: 16px;
    }
    
    .nav-button .text {
        font-size: 0.9rem;
    }
    
    .nav-button .icon-container {
        width: 28px;
        height: 28px;
    }
    
    .nav-button i {
        font-size: 1rem;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 0.8rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .header-features {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .category-tabs {
        justify-content: space-around;
        width: 100%;
    }
    
    .category-tab {
        padding: 0.5rem;
        border-radius: 12px;
    }
    
    .service {
        padding: 1.2rem;
    }
    
    .icon {
        width: 60px;
        height: 60px;
    }
    
    .service-link {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
    
    .feature {
        font-size: 0.85rem;
        flex-basis: 45%;
    }
    
    .subtitle {
        font-size: 0.9rem;
        padding: 0 0.5rem;
    }
    
    .service-title {
        font-size: 1.2rem;
    }
    
    .service-desc {
        font-size: 0.9rem;
    }
    
    .nav-button {
        padding: 0.8rem;
        top: 1rem;
        right: 1rem;
        font-size: 0.9rem;
    }
    
    .nav-button .icon-container {
        width: 30px;
        height: 30px;
    }
}

/* Extra small devices (portrait phones) */
@media (max-width: 320px) {
    .container {
        padding: 0.6rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .header-features {
        gap: 0.8rem;
    }
    
    .category-tab {
        padding: 0.4rem;
        border-radius: 10px;
    }
    
    .icon {
        width: 50px;
        height: 50px;
        margin-bottom: 1rem;
    }
    
    .icon i {
        font-size: 1.5rem;
    }
    
    .service-title {
        font-size: 1.1rem;
        margin-bottom: 0.7rem;
    }
    
    .service-desc {
        margin-bottom: 1.5rem;
    }
    
    .feature span {
        display: none;
    }
    
    .feature i {
        font-size: 1.2rem;
    }
}

/* Adding touch support for mobile devices */
@media (hover: none) and (pointer: coarse) {
    .service {
        transform: none !important;
    }
    
    .service:hover {
        transform: translateY(-4px) !important;
    }
    
    .service-link:hover {
        transform: translateX(2px);
    }
    
    .category-tab:active {
        transform: scale(0.95);
    }
}
