/* =========================================================================
   Global Reset & Variables
   ========================================================================= */
:root {
    --bg-color-1: #060913;
    --bg-color-2: #161b33;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    --accent-hover: #0284c7;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --gradient-text: linear-gradient(90deg, #38bdf8, #818cf8);
    --font-family: 'Outfit', sans-serif;
    --transition-speed: 0.3s;
}

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

body {
    background: linear-gradient(135deg, var(--bg-color-1) 0%, var(--bg-color-2) 100%);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* =========================================================================
   Typography & Utilities
   ========================================================================= */
h1,
h2,
h3 {
    font-weight: 800;
    line-height: 1.2;
}

.highlight {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glassmorphism {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    cursor: pointer;
}

.btn.primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

.btn.primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.btn.secondary {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}

.btn.secondary:hover {
    background: var(--glass-bg);
    transform: translateY(-2px);
}

/* =========================================================================
   Navbar
   ========================================================================= */
.navbar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-speed) ease;
}

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

/* =========================================================================
   Hero Section
   ========================================================================= */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
    padding: 100px 10%;
    max-width: 1400px;
    margin: 0 auto;
    flex-direction: row-reverse;
}

.hero-content {
    flex: 1;
    max-width: 600px;
    opacity: 0.85;
    transition: opacity 0.5s ease;
}

.hero-content:hover {
    opacity: 1;
}

.hero-content h1 {
    font-size: 4rem;
    margin-bottom: 10px;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-content h2 {
    font-size: 2rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-weight: 400;
    transition: all 0.6s ease;
    min-height: 40px;
}

#typewriter {
    border-right: 3px solid var(--accent);
    padding-right: 5px;
    animation: blinkCaret 0.8s step-end infinite;
}

@keyframes blinkCaret {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: var(--accent);
    }
}

.hero-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    transition: all 0.6s ease;
}

.hero-buttons {
    display: flex;
    gap: 20px;
}

.hero-image-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1200px;
}

/* 3D Flip Container */
.flip-container {
    width: 350px;
    height: 450px;
    position: relative;
    cursor: pointer;
    perspective: 1200px;
    z-index: 10;
}

.flip-card {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
}

.flip-container.flipped .flip-card {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 20px 40px rgba(56, 189, 248, 0.15),
        0 15px 30px rgba(0, 0, 0, 0.4),
        inset 0 0 0 2px var(--accent),
        0 0 20px rgba(56, 189, 248, 0.1);
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.flip-card-front {
    background: transparent;
}

.flip-card-back {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(129, 140, 248, 0.1));
    backdrop-filter: blur(10px);
    transform: rotateY(180deg);
    border: 2px solid var(--accent);
}

.flip-container:hover .flip-card-front,
.flip-container:hover .flip-card-back {
    box-shadow:
        0 40px 80px rgba(56, 189, 248, 0.4),
        0 25px 50px rgba(0, 0, 0, 0.6),
        inset 0 0 0 2px var(--accent),
        0 0 80px rgba(56, 189, 248, 0.3),
        0 0 120px rgba(56, 189, 248, 0.2);
    transform: translateY(-10px);
}

.flip-container:hover .flip-card-front {
    transform: rotateY(0deg) translateZ(20px);
}

.flip-container.flipped .flip-card-front {
    transform: rotateY(0deg) translateZ(20px);
}

.flip-card-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.3), transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.1), rgba(0, 0, 0, 0.2));
    pointer-events: none;
    z-index: 2;
}

.flip-card-front::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.3), rgba(129, 140, 248, 0.1));
    border-radius: 20px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.5s;
    filter: blur(20px);
}

.flip-container:hover .flip-card-front::after {
    opacity: 1;
}

.tilt-box {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
    cursor: pointer;
    perspective: 1200px;
    position: relative;
}

/* Background glowing circle behind the picture */
.tilt-box::before {
    content: '';
    position: absolute;
    width: 380px;
    /* Make the circle bigger */
    height: 380px;
    /* Make the circle bigger */
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, rgba(129, 140, 248, 0.1) 60%, transparent 100%);
    box-shadow: 0 0 50px rgba(56, 189, 248, 0.2);
    border: 2px dashed rgba(56, 189, 248, 0.5);
    z-index: 1;
    /* Keeps the circle under the picture */
    transform: translateZ(-20px);
    transition: all 0.6s ease-out;
    animation: rotateCircle 25s linear infinite;
}

@keyframes rotateCircle {
    from {
        transform: translateZ(-20px) rotate(0deg);
    }

    to {
        transform: translateZ(-20px) rotate(360deg);
    }
}

.tilt-box:hover::before {
    box-shadow: 0 0 80px rgba(56, 189, 248, 0.5);
    background: radial-gradient(circle, rgba(56, 189, 248, 0.3) 0%, rgba(129, 140, 248, 0.15) 60%, transparent 100%);
}

.profile-pic {
    width: 320px;
    /* Also increased the picture size to match */
    height: 320px;
    object-fit: cover;
    border-radius: 50%;
    /* Remove this line if mypic.png is a transparent cutout! */
    border: 4px solid var(--accent);
    /* Remove this line if mypic.png is a transparent cutout! */
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: brightness(1.05) contrast(1.1);
    box-shadow:
        0 15px 35px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(56, 189, 248, 0.2);
    position: relative;
    z-index: 3;
    /* Keeps picture on top of circle */
    transform-style: preserve-3d;
    transform: perspective(1200px) rotateX(0deg) rotateY(0deg) translateZ(0);
}

.tilt-box:hover .profile-pic {
    border-color: #fff;
}

/* Back Card Content */
.back-content {
    text-align: center;
    padding: 30px 20px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 3;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.flip-container:hover .back-content {
    opacity: 1;
    transform: translateY(0);
}

.back-content h3 {
    font-size: 1.8rem;
    color: var(--accent);
    margin-bottom: 10px;
    font-weight: 800;
    animation: textGlow 2s ease-in-out infinite alternate;
}

.back-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 20px;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.tech-stack {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    position: relative;
    z-index: 2;
    padding-top: 20px;
    border-top: 1px solid rgba(56, 189, 248, 0.3);
}

.tech {
    background: rgba(56, 189, 248, 0.2);
    color: var(--accent);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--accent);
    animation: popUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    transition: all 0.3s ease;
}

.tech:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}

.tech:nth-child(1) {
    animation-delay: 0.1s;
}

.tech:nth-child(2) {
    animation-delay: 0.2s;
}

.tech:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes textGlow {
    from {
        text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
    }

    to {
        text-shadow: 0 0 20px rgba(56, 189, 248, 0.8), 0 0 30px rgba(56, 189, 248, 0.6);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popUp {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* =========================================================================
   About Me Section (Timeline)
   ========================================================================= */
.about {
    padding: 100px 10%;
    background: rgba(0, 0, 0, 0.2);
}

.section-title {
    text-align: center;
    margin-bottom: 60px;
}

.section-title h2 {
    font-size: 3rem;
}

.about-content {
    display: flex;
    flex-direction: column;
    gap: 60px;
    max-width: 1000px;
    margin: 0 auto;
}

.about-text {
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.timeline {
    position: relative;
    padding-left: 50px;
    border-left: 2px solid var(--glass-border);
}

.timeline-item {
    position: relative;
    margin-bottom: 50px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

/* The UP ARROW marker */
.timeline-item .arrow.up {
    position: absolute;
    left: -58px;
    /* centering the arrow on the line */
    top: 5px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 14px solid var(--accent);
    filter: drop-shadow(0 0 8px var(--accent));
}

.timeline-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 25px 30px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    transition: transform 0.3s;
}

.timeline-content:hover {
    transform: translateX(10px);
    border-color: var(--accent);
}

.timeline-content h3 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: #fff;
}

.timeline-content p {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.timeline-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-bottom 0.3s;
}

/* =========================================================================
   Responsive Design
   ========================================================================= */
@media (max-width: 768px) {
    .hero {
        flex-direction: column-reverse;
        padding: 80px 5%;
        gap: 40px;
        min-height: auto;
    }

    .hero-image-wrapper {
        order: -1;
        width: 100%;
        margin-bottom: 20px;
    }

    .flip-container {
        width: 280px;
        height: 360px;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content h2 {
        font-size: 1.5rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 15px;
    }

    .btn {
        width: 100%;
        text-align: center;
    }
}

.timeline-link:hover {
    border-bottom: 1px solid var(--accent);
}

/* =========================================================================
   Projects Section
   ========================================================================= */
.projects {
    padding: 100px 10%;
}

.github-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
}

.github-link:hover {
    text-decoration: underline;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.project-card {
    padding: 30px;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--accent);
}

.project-card h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 20px;
    width: fit-content;
}

.badge.team {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.badge.self {
    background: rgba(167, 139, 250, 0.2);
    color: #a78bfa;
}

.badge.college {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
}

.project-card p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    flex-grow: 1;
}

/* =========================================================================
   Footer (Contact)
   ========================================================================= */
.footer {
    text-align: center;
    padding: 60px 20px;
    margin: 50px 10% 30px 10%;
}

.footer h2 {
    font-size: 2.5rem;
    margin-bottom: 40px;
}

.contact-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 40px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.3s;
}

.contact-item:hover {
    color: var(--accent);
}

.contact-item .icon {
    font-size: 1.5rem;
}

.copyright {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* =========================================================================
   Animations (Fade in via JS IntersectionObserver)
   ========================================================================= */
.fade-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

.fade-left {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

.fade-right {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

/* =========================================================================
   Responsive Design
   ========================================================================= */
@media (max-width: 900px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding-top: 150px;
    }

    .hero-buttons {
        justify-content: center;
        margin-bottom: 50px;
    }

    .hero-content h1 {
        font-size: 3rem;
    }

    .timeline {
        padding-left: 25px;
    }

    .timeline-item .arrow.up {
        left: -33px;
    }

    .nav-links {
        display: none;
        /* simple mobile behavior */
    }

    .navbar {
        justify-content: center;
    }
}