html {
    scroll-behavior: smooth;
}

:root {
    /* Color Palette - Premium & Soft */
    --bg-main: #f8f9fc;
    --text-primary: #1a1e26;
    --text-secondary: #4a5568;
    --accent-color: #6366f1;

    /* Soft Gradients */
    --grad-primary: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
    --grad-surface: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.5) 100%);
    --grad-hero: linear-gradient(120deg, #f5f7fa 0%, #c3cfe2 100%);

    /* Transitions & Shadows */
    --transition-base: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 40px -15px rgba(99, 102, 241, 0.1);

    /* Layout */
    --container-width: 1200px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    opacity: 0;
    animation: pageFadeIn 0.8s ease forwards;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-exit {
    animation: pageFadeOut 0.5s ease forwards !important;
}

@keyframes pageFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Typography Helpers */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.2;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 2rem;
}

section {
    padding: 100px 0;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 20px 0;
    transition: var(--transition-base);
}

nav.scrolled {
    padding: 15px 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
}

.logo span {
    color: var(--accent-color);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 40px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition-base);
}

.nav-links a:hover {
    color: var(--accent-color);
}

/* Hero Section */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: var(--grad-hero);
    overflow: hidden;
    position: relative;
    padding-top: 100px;
}

.hero-content {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2;
    pointer-events: none;
    transition: transform 0.2s ease-out;
    /* Smooth parallax */
}

.hero-text {
    pointer-events: auto;
    margin-top: 120px;
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.2));
    /* Integration feel */
}

.hero-text p,
.hero-btns {
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(20px);
    filter: blur(10px);
}

.hero-text h1 {
    font-size: 5rem;
    margin-bottom: 24px;
    letter-spacing: -3px;
    max-width: 800px;
}

.hero-text p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 500px;
}

.hero-btns {
    display: flex;
    gap: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    padding: 18px 36px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-base);
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
    position: relative;
    overflow: hidden;
    width: fit-content;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.5);
}

.btn-icon {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary:hover .btn-icon {
    transform: translateX(5px);
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(45deg);
    transition: 0.5s;
    pointer-events: none;
}

.btn-primary:hover::after {
    left: 120%;
}

.btn-secondary {
    padding: 16px 32px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    color: var(--text-primary);
    border: 2px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-base);
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
}

.btn-secondary:hover {
    background: white;
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover .btn-icon {
    transform: rotate(15deg) scale(1.1);
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

spline-viewer {
    width: 100%;
    height: 100%;
}


/* Services Section */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: 3rem;
    margin-bottom: 16px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Services Section Redesign */
#services {
    background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.03) 0%, transparent 50%);
    position: relative;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-gap: 24px;
    margin-top: 40px;
}

.service-link {
    text-decoration: none;
    cursor: pointer;
    display: flex;
}

.service-item {
    position: relative;
    padding: 40px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 32px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.service-icon {
    margin-left: auto;
    margin-right: auto;
}

.card-large {
    grid-column: span 12;
    min-height: 400px;
}

.card-medium {
    grid-column: span 6;
    min-height: 320px;
}

.service-content {
    position: relative;
    z-index: 2;
}

.service-icon {
    width: 64px;
    height: 64px;
    background: white;
    padding: 16px;
    border-radius: 20px;
    color: var(--accent-color);
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    transition: var(--transition-base);
}

.service-item:hover .service-icon {
    transform: scale(1.1) rotate(-5deg);
    background: var(--accent-color);
    color: white;
}

.service-item h3 {
    font-size: 2rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.service-item p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
}

/* Glass & Glow Effect */
.card-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease-out, height 0.6s ease-out;
    pointer-events: none;
    z-index: 1;
}

.service-item:hover {
    transform: translateY(-10px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 30px 60px rgba(99, 102, 241, 0.1);
}

.service-item:hover .card-glow {
    width: 150%;
    height: 150%;
}

@media (max-width: 992px) {

    .card-large,
    .card-medium {
        grid-column: span 12;
    }
}

/* Portfolio Section */
#portfolio {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, var(--bg-main) 0%, #ffffff 100%);
}

#portfolio::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -5%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.05) 0%, transparent 70%);
    z-index: 0;
}

.portfolio-badge {
    display: inline-block;
    padding: 8px 20px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-color);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.section-header {
    text-align: center;
    margin-bottom: 80px;
    position: relative;
    z-index: 1;
}

.portfolio-header h2 {
    font-size: 4.8rem;
    font-weight: 400;
    letter-spacing: -3px;
    margin-bottom: 15px;
}

.portfolio-header h2 span {
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-color) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.portfolio-header p {
    font-size: 1.1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-secondary);
    opacity: 0.8;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 50px;
    position: relative;
    z-index: 1;
}

.portfolio-item {
    position: relative;
    border-radius: 32px;
    overflow: hidden;
    height: 480px;
    cursor: pointer;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.2, 1, 0.3, 1);
}

.portfolio-overlay {
    position: absolute;
    bottom: 30px;
    left: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 30px;
    border-radius: 24px;
    transform: translateY(30px);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.portfolio-overlay span {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 8px;
}

.portfolio-overlay h3 {
    font-size: 1.8rem;
    color: var(--text-primary);
}

.portfolio-item:hover img {
    transform: scale(1.1) rotate(1deg);
}

.portfolio-item:hover .portfolio-overlay {
    transform: translateY(0);
    opacity: 1;
}

.portfolio-footer {
    text-align: center;
    margin-top: 80px;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 40px;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition-base);
}

.btn-outline:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.3);
}

/* Contact Footer */
.contact-container {
    padding-bottom: 50px;
}

.contact-card {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.contact-card h2 {
    font-size: 3.5rem;
    margin-bottom: 24px;
}

.contact-card p {
    margin-bottom: 40px;
}

.contact-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.social-links-contact {
    display: flex;
    gap: 15px;
}

.social-icon-btn {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: var(--transition-base);
    text-decoration: none;
}

.social-icon-btn:hover {
    background: white;
    color: var(--accent-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-color);
}

@media (max-width: 600px) {
    .contact-actions {
        flex-direction: column;
        gap: 20px;
    }
}

footer {
    padding: 40px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Animations */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s forwards;
}

.fade-in-delay {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s 0.2s forwards;
}

.fade-in-delay-2 {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s 0.4s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fixed Secondary Spline Asset */
.fixed-spline-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 260px;
    height: 260px;
    z-index: 1000;
    pointer-events: auto;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.15));
    transition: var(--transition-base);
    border-radius: 50%;
    /* overflow: hidden; removed to show the tooltip */
}

.fixed-spline-container:hover {
    transform: scale(1.1) translateY(-5px);
}

.spline-tooltip {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: white;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10000;
    /* Even higher layer */
    pointer-events: none;
    /* Don't interfere with mouse */
}

.spline-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid white;
}

.fixed-spline-container:hover .spline-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
    .fixed-spline-container {
        width: 180px;
        height: 180px;
        bottom: 20px;
        left: 20px;
    }
}

/* AI Chat Window Styles */
.chat-window {
    position: fixed;
    bottom: 100px;
    left: 40px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-header {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-status {
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 10px #4ade80;
}

.chat-header span {
    font-weight: 700;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: 0.3s;
}

.chat-close:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8f9fa;
}

.message {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    max-width: 85%;
    line-height: 1.4;
}

.message.ai {
    background: white;
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.message.user {
    background: var(--accent-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 15px 20px !important;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #cbd5e1;
    border-radius: 50%;
    display: inline-block;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

.chat-input-area {
    padding: 20px;
    display: flex;
    gap: 10px;
    border-top: 1px solid #eee;
}

.chat-input-area input {
    flex: 1;
    border: 1px solid #eee;
    padding: 12px 16px;
    border-radius: 12px;
    outline: none;
    transition: 0.3s;
}

.chat-input-area input:focus {
    border-color: var(--accent-color);
}

.chat-input-area button {
    background: var(--accent-color);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.chat-input-area button:hover {
    transform: scale(1.05);
    background: #4f46e5;
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        left: 20px;
        right: 20px;
        bottom: 80px;
        height: 60vh;
    }
}

/* Tablet & Mobile */
@media (max-width: 992px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-text h1 {
        font-size: 3.5rem;
    }

    .hero-text p {
        margin: 0 auto 40px;
    }

    .hero-btns {
        justify-content: center;
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .nav-links {
        display: none;
    }

    .hero-text h1 {
        font-size: 2.8rem;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }
}