/* ===== CSS Variables ===== */
:root {
    /* Sunset Color Scheme */
    --color-bg-dark: rgb(20, 13, 18);
    --color-bg-black: rgb(15, 5, 10);
    --color-text-light: rgba(238, 238, 238, 1);
    --color-accent-orange: rgba(255, 120, 80, 1);
    --color-accent-pink: rgba(255, 107, 129, 1);
    --color-accent-purple: rgba(155, 89, 182, 1);
    --color-accent-gold: rgba(255, 177, 66, 1);
    --color-border: rgb(226, 226, 226);

    /* Typography */
    --font-primary: 'Inter Tight', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing */
    --spacing-xs: 1rem;
    --spacing-sm: 1.5rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 8rem;

    /* Border radius */
    --radius: 0.4rem;

    /* Transitions */
    --transition: all 300ms ease;
}

/* ===== Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

html.lenis {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto;
}

body {
    font-family: var(--font-primary);
    background: linear-gradient(192deg, var(--color-bg-black) 34%, rgba(255, 120, 80, 0.15) 100%);
    background-attachment: fixed;
    color: var(--color-text-light);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

/* 3D Canvas Background */
#canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* Ensure all content is above the 3D background */
.container,
.hero,
.section,
.navbar,
.preloader {
    position: relative;
    z-index: 1;
}

/* ===== Preloader ===== */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(192deg, var(--color-bg-black) 34%, rgba(255, 120, 80, 0.15) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* ===== 3D Cube Loader ===== */
.cube-loader {
    perspective: 1000px;
    width: 150px;
    height: 150px;
}

.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    animation: rotateCube 3s infinite ease-in-out;
}

@keyframes rotateCube {
    0% {
        transform: rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1);
    }
    25% {
        transform: rotateX(90deg) rotateY(90deg) scale3d(1.2, 1.2, 0.3);
    }
    50% {
        transform: rotateX(180deg) rotateY(180deg) scale3d(1.4, 1.4, 0.1);
    }
    75% {
        transform: rotateX(270deg) rotateY(270deg) scale3d(1.2, 1.2, 0.3);
    }
    100% {
        transform: rotateX(360deg) rotateY(360deg) scale3d(1, 1, 1);
    }
}

.cube-face {
    position: absolute;
    width: 150px;
    height: 150px;
    border: 2px solid rgba(255, 120, 80, 0.8);
    background: linear-gradient(135deg, rgba(255, 120, 80, 0.1), rgba(255, 107, 129, 0.1));
    backdrop-filter: blur(10px);
    box-shadow:
        0 0 20px rgba(255, 120, 80, 0.5),
        inset 0 0 20px rgba(255, 120, 80, 0.2);
    animation: morphFace 3s infinite ease-in-out, pulseGlow 2s infinite ease-in-out;
}

@keyframes morphFace {
    0% {
        border-radius: 0%;
    }
    25% {
        border-radius: 30%;
    }
    50% {
        border-radius: 50%;
    }
    75% {
        border-radius: 30%;
    }
    100% {
        border-radius: 0%;
    }
}

.cube-front {
    transform: translateZ(75px);
}

.cube-back {
    transform: rotateY(180deg) translateZ(75px);
}

.cube-left {
    transform: rotateY(-90deg) translateZ(75px);
}

.cube-right {
    transform: rotateY(90deg) translateZ(75px);
}

.cube-top {
    transform: rotateX(90deg) translateZ(75px);
}

.cube-bottom {
    transform: rotateX(-90deg) translateZ(75px);
}

/* Pulsing glow effect */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow:
            0 0 20px rgba(255, 120, 80, 0.5),
            inset 0 0 20px rgba(255, 120, 80, 0.2);
    }
    50% {
        box-shadow:
            0 0 40px rgba(255, 107, 129, 0.8),
            inset 0 0 30px rgba(255, 107, 129, 0.3);
    }
}

.preloader-animation {
    width: 500px;
    height: 500px;
    max-width: 90vw;
    max-height: 90vh;
    display: none; /* Hidden - using cube loader instead */
}

/* ===== Scroll Animation ===== */
.scroll-animation {
    width: 100%;
    max-width: 700px;
    height: 500px;
    margin: 4rem auto 0;
    display: none; /* Hidden - using 3D particle system instead */
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Make animation more visible on mobile */
@media (max-width: 768px) {
    .scroll-animation {
        height: 350px;
        margin: 2rem auto 0;
    }
}

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

/* ===== Navigation ===== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: rgba(13, 13, 20, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    margin-top: var(--spacing-md);
    position: sticky;
    top: var(--spacing-md);
    z-index: 100;
}

.logo {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 1.2rem;
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
}

.nav-links a {
    color: var(--color-text-light);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 400;
}

.nav-links a:hover {
    opacity: 0.7;
}

/* ===== Hero Section ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl) 0;
}

.hero-content {
    text-align: center;
    padding: var(--spacing-xl) 0;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 8rem);
    font-weight: 500;
    line-height: 1.1;
    margin-bottom: var(--spacing-md);
    display: flex;
    flex-direction: column;
}

.title-line {
    display: block;
    margin-bottom: -0.8rem;
}

.hero-description {
    font-size: clamp(1rem, 2vw, 1.5rem);
    opacity: 0.8;
    max-width: 40rem;
    margin: 0 auto 2rem;
}

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

.section-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 500;
    margin-bottom: var(--spacing-lg);
}

.section-text {
    font-size: 1.125rem;
    line-height: 1.8;
    opacity: 0.9;
}

/* ===== About Section ===== */
.about-section {
    background-color: rgba(13, 13, 20, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: var(--spacing-xl) var(--spacing-md);
    margin: var(--spacing-xl) 0;
}

.section-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    align-items: center;
}

.visual-placeholder {
    aspect-ratio: 1;
    background: rgba(238, 238, 238, 0.1);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.about-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
}

/* ===== Projects Section ===== */
.projects-section {
    padding: var(--spacing-xl) 0;
}

.projects-section .container {
    max-width: 140rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-md);
}

.project-card {
    background-color: rgba(13, 13, 20, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid transparent;
    position: relative;
    z-index: 1;
}

.project-card:hover {
    transform: translateY(-0.5rem);
    box-shadow: 0 1rem 3rem rgba(255, 120, 80, 0.3);
    border: 1px solid rgba(255, 120, 80, 0.2);
}

.project-image {
    aspect-ratio: 16 / 9;
    background: rgba(238, 238, 238, 0.1);
}

.project-info {
    padding: var(--spacing-md);
}

.project-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}

.project-description {
    opacity: 0.8;
    margin-bottom: var(--spacing-sm);
}

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

.tag {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    background: rgba(238, 238, 238, 0.1);
    border-radius: calc(var(--radius) / 2);
}

/* ===== Skills Section ===== */
.skills-section {
    background-color: rgba(13, 13, 20, 0.7);
    border-radius: var(--radius);
    padding: var(--spacing-xl) 0;
    margin: var(--spacing-xl) 0;
    overflow: hidden;
}

.skills-section .container {
    max-width: 140rem;
}

.skills-section > .container:first-of-type {
    padding: 0 var(--spacing-md);
}

.skills-section > .container:last-of-type {
    padding: 0 var(--spacing-md);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
}

.skill-category {
    padding: var(--spacing-md);
    border: 1px solid rgba(238, 238, 238, 0.2);
    border-radius: var(--radius);
}

.category-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    color: var(--color-accent-orange);
}

.skills-list {
    list-style: none;
}

.skills-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(238, 238, 238, 0.1);
}

.skills-list li:last-child {
    border-bottom: none;
}

/* ===== Contact Section ===== */
.contact-section {
    text-align: center;
    padding: var(--spacing-xl) 0;
}

.contact-content {
    max-width: 40rem;
    margin: 0 auto;
}

.contact-text {
    font-size: 1.125rem;
    margin-bottom: var(--spacing-lg);
    opacity: 0.9;
}

.contact-links {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

.contact-link {
    display: inline-block;
    padding: 1rem 2rem;
    background-color: rgba(13, 13, 20, 0.7);
    backdrop-filter: blur(10px);
    color: var(--color-text-light);
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
    font-weight: 500;
}

.contact-link:hover {
    opacity: 0.7;
    transform: translateY(-0.25rem);
}

/* ===== Footer ===== */
.footer {
    background-color: rgba(13, 13, 20, 0.7);
    backdrop-filter: blur(10px);
    padding: var(--spacing-md);
    text-align: center;
    border-radius: var(--radius) var(--radius) 0 0;
    margin-top: var(--spacing-xl);
}

.footer p {
    opacity: 0.7;
    font-size: 0.875rem;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .nav-links {
        gap: var(--spacing-md);
    }

    .section-grid {
        grid-template-columns: 1fr;
    }

    .navbar {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .contact-links {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    :root {
        --spacing-md: 1rem;
        --spacing-lg: 2rem;
        --spacing-xl: 4rem;
    }

    .navbar {
        position: relative;
        top: 0;
    }

    .nav-links a {
        font-size: 0.9rem;
    }
}

/* ===== Animated Buttons ===== */
.btn-animated {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, rgba(255, 120, 80, 0.8), rgba(255, 177, 66, 0.8));
    color: var(--color-text-light);
    text-decoration: none;
    border: 1px solid rgba(255, 120, 80, 0.3);
    border-radius: var(--radius);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    cursor: pointer;
    overflow: hidden;
    font-family: var(--font-primary);
    font-size: 1rem;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 4px 12px rgba(255, 120, 80, 0.25);
}

.btn-animated:hover {
    transform: translateY(-0.25rem);
    box-shadow: 0 8px 24px rgba(255, 120, 80, 0.4);
    background: linear-gradient(135deg, rgba(255, 120, 80, 1), rgba(255, 177, 66, 1));
    border-color: rgba(255, 177, 66, 0.6);
}

.btn-animated:active {
    transform: translateY(-0.1rem);
    box-shadow: 0 4px 16px rgba(255, 120, 80, 0.3);
}

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

.btn-dots {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    z-index: 1;
}

.btn-project {
    margin-top: 1rem;
    width: 100%;
    cursor: pointer;
    pointer-events: auto;
    z-index: 10;
    position: relative;
}

/* ===== Modal System ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 2, 1, 0.9);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    background-color: rgba(13, 13, 20, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: var(--spacing-lg);
    max-width: 50rem;
    max-height: 90vh;
    overflow-y: auto;
    margin: var(--spacing-md);
    transform: translateY(2rem);
    transition: transform 0.3s ease;
    z-index: 1;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: 2rem;
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(238, 238, 238, 0.1);
    transform: rotate(90deg);
}

.modal-title {
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: var(--spacing-md);
    padding-right: 2rem;
}

.modal-body {
    line-height: 1.8;
}

.modal-body ul {
    margin: var(--spacing-sm) 0;
    padding-left: var(--spacing-md);
}

.modal-body li {
    margin-bottom: 0.5rem;
}

.modal-body p {
    margin-bottom: var(--spacing-sm);
}

/* ===== Magnetic Cursor ===== */
.magnetic-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 120, 80, 0.8);
    pointer-events: none;
    z-index: 99999;
    transition: transform 0.15s ease, width 0.2s ease, height 0.2s ease;
    mix-blend-mode: difference;
}

.magnetic-cursor.hover {
    width: 60px;
    height: 60px;
    background: rgba(255, 120, 80, 0.4);
}

.cursor-follower {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 107, 129, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    transition: transform 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.cursor-follower.hover {
    width: 80px;
    height: 80px;
    border-color: rgba(255, 120, 80, 0.6);
}

/* Hide custom cursor on mobile */
@media (max-width: 768px) {
    .magnetic-cursor,
    .cursor-follower {
        display: none;
    }
}

/* ===== Scroll Animations ===== */
.fade-in-up {
    opacity: 0;
    transform: translateY(3rem);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in {
    opacity: 0;
    transition: opacity 1s ease;
}

.fade-in.visible {
    opacity: 1;
}

.slide-in-left {
    opacity: 0;
    transform: translateX(-3rem);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.slide-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(3rem);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.slide-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* Mobile modal adjustments */
@media (max-width: 768px) {
    .modal-content {
        max-width: 100%;
        margin: 1rem;
        padding: 2rem 1.5rem;
    }

    .modal-title {
        font-size: 1.5rem;
    }
}

/* ===== Tech Stack Carousel (Integrated with Skills) ===== */
.carousel-wrapper {
    overflow: hidden;
    position: relative;
}

.carousel-wrapper::before,
.carousel-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
    z-index: 2;
    pointer-events: none;
}

.carousel-wrapper::before {
    left: 0;
    background: linear-gradient(to right, var(--color-bg-black), transparent);
}

.carousel-wrapper::after {
    right: 0;
    background: linear-gradient(to left, var(--color-bg-black), transparent);
}

.carousel-track {
    display: flex;
    gap: 2rem;
    animation: scroll-left 40s linear infinite;
    width: max-content;
}

.carousel-reverse .carousel-track {
    animation: scroll-right 40s linear infinite;
}

.carousel-item {
    flex-shrink: 0;
    background-color: transparent;
    backdrop-filter: none;
    padding: 1.5rem 2.5rem;
    border-radius: var(--radius);
    border: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.carousel-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 120, 80, 0.1), transparent);
    transition: left 0.5s ease;
}

.carousel-item:hover {
    transform: translateY(-5px);
    box-shadow: none;
}

.carousel-item:hover::before {
    left: 100%;
}

.carousel-item i {
    font-size: 2.5rem;
    flex-shrink: 0;
}

/* Override DevIcon colors for non-colored icons */
.carousel-item i:not(.colored) {
    color: var(--color-accent-orange);
}

.tech-name {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text-light);
    white-space: nowrap;
    display: block;
}

/* Pause animation on hover */
.carousel-wrapper:hover .carousel-track {
    animation-play-state: paused;
}

/* Keyframe animations */
@keyframes scroll-left {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

@keyframes scroll-right {
    from {
        transform: translateX(-50%);
    }
    to {
        transform: translateX(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .carousel-item {
        padding: 1rem 1.5rem;
        gap: 0.5rem;
    }

    .carousel-item i {
        font-size: 2rem;
    }

    .tech-name {
        font-size: 0.85rem;
    }

    .carousel-track {
        gap: 1rem;
        animation-duration: 30s;
    }

    .carousel-wrapper::before,
    .carousel-wrapper::after {
        width: 50px;
    }
}
