@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
    --bg-deep: #030712;
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-surface: rgba(255, 255, 255, 0.03);
    --primary-accent: #3b82f6;
    --secondary-accent: #8b5cf6;
}

::selection {
    background: var(--primary-accent);
    color: white;
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(to right, var(--primary-accent), var(--secondary-accent));
    z-index: 1000;
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    transform: translateY(20px);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-accent);
    border-color: var(--primary-accent);
}

/* Base */
html.lenis {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

body {
    background-color: var(--bg-deep);
    color: #f8fafc;
    overflow-x: hidden;
}

/* Canvas Background */
#canvas-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.6;
    pointer-events: none;
}

/* Noise Overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Background Glow Orbs */
.bg-glow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
    filter: blur(120px);
}

.bg-glow-orb {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
    animation: orbFloat 20s infinite alternate;
}

.orb-1 {
    width: 40vw;
    height: 40vw;
    background: var(--primary-accent);
    top: -10%;
    left: -10%;
}

.orb-2 {
    width: 35vw;
    height: 35vw;
    background: var(--secondary-accent);
    bottom: -5%;
    right: -5%;
    animation-delay: -5s;
}

.orb-3 {
    width: 30vw;
    height: 30vw;
    background: #4f46e5;
    top: 40%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes orbFloat {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(10vw, 5vh) scale(1.1);
    }

    66% {
        transform: translate(-5vw, 15vh) scale(0.9);
    }

    100% {
        transform: translate(5vw, -5vh) scale(1);
    }
}

/* Bento Card */
.bento-card {
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

.bento-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

.bento-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.08), transparent 40%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.bento-card:hover::after {
    opacity: 1;
}

/* Hacker Text */
.hacker-text {
    font-family: 'Space Grotesk', monospace;
    cursor: default;
}

/* Nav Pill */
.nav-pill {
    background: rgba(3, 7, 18, 0.6);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    padding: 0.75rem 2rem;
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 90%;
    max-width: 600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
}

.nav-item {
    position: relative;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-item:hover,
.nav-item.active {
    color: white;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--primary-accent);
    border-radius: 50%;
}

/* Logo Animation */
.logo-anim {
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.group:hover .logo-anim {
    transform: rotate(12deg) scale(1.1);
    filter: drop-shadow(0 0 10px rgba(37, 99, 235, 0.6));
}

@media (max-width: 768px) {
    .bento-card {
        min-height: auto;
        padding: 1.5rem !important;
    }

    .nav-pill {
        width: 95%;
        padding: 0.75rem 1.25rem;
    }

    h1 {
        font-size: 2.25rem !important;
    }

    /* Optimized Mobile Buttons */
    .hero-btn,
    .btn-magnetic {
        min-width: 140px;
        margin-bottom: 0.5rem;
        padding: 0.5rem 1rem !important;
        font-size: 0.85rem !important;
        display: inline-flex;
        justify-content: center;
        align-items: center;
    }

    /* Ensure no double scroll */
    body.overflow-hidden {
        overflow: hidden !important;
    }

    /* Reduce noise on weak devices */
    .noise-overlay {
        opacity: 0.02;
    }
}

/* Hero */
.hero-char {
    transform: translateY(100%) rotateX(-90deg);
    opacity: 0;
}

.hamburger-line {
    transform-origin: center;
}

#menu-toggle.active .hamburger-line:first-child {
    transform: translateY(4px) rotate(45deg);
}

#menu-toggle.active .hamburger-line:last-child {
    transform: translateY(-4px) rotate(-45deg);
}

/* Magnetic Buttons */
.btn-magnetic {
    display: inline-block;
    will-change: transform;
}

/* Marquee */
.marquee-container {
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.marquee-content {
    animation: scroll 30s linear infinite;
}

@keyframes scroll {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

/* Timeline specific */
.timeline-card {
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
}

.timeline-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    height: 100%;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--primary-accent), transparent);
}

/* Accordion */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.accordion-item.active .accordion-content {
    max-height: 500px;
    /* Arbitrary large height */
    transition: max-height 0.5s ease-in;
}

.accordion-icon {
    transition: transform 0.3s;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}