:root {
    --bg-color: #050505;
    --text-color: #ffffff;
    --text-muted: #a0a0a0;
    --accent-color: #6c5ce7;
    --accent-secondary: #00cec9;
    --border-color: rgba(255, 255, 255, 0.1);
    --font-main: 'Space Grotesk', sans-serif;
    --container-width: 1200px;
    --section-spacing: 15vh;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: none; /* Custom cursor everywhere */
    user-select: none; /* Disable text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

html {
    /* scroll-behavior: smooth;  Handled by Lenis */
    font-size: 16px;
}

body {
    background-color: var(--bg-color);
    background: radial-gradient(circle at center, #1a1a2e 0%, #050505 100%); /* Deep space gradient */
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto;
}

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

a {
    text-decoration: none;
    color: inherit;
    cursor: none;
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

.highlight {
    color: var(--accent-secondary);
}

/* Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.8s cubic-bezier(0.76, 0, 0.24, 1);
}

.preloader.hide {
    transform: translateY(-100%);
}

.loader-content {
    text-align: center;
}

.loader-text {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: 2px;
}

.loader-line {
    width: 0;
    height: 2px;
    background: var(--accent-secondary);
    margin: 0 auto;
    animation: loaderAnim 1.5s cubic-bezier(0.85, 0, 0.15, 1) forwards;
}

@keyframes loaderAnim {
    to { width: 100%; }
}

/* Custom Cursor */
.cursor {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 10000;
    transition: width 0.3s, height 0.3s, background-color 0.3s, border-color 0.3s;
    mix-blend-mode: difference;
}

.cursor-dot {
    position: fixed;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 10000;
}

.cursor.hovered {
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.1);
    border-color: transparent;
    backdrop-filter: blur(2px);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    mix-blend-mode: difference;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 3rem;
}

.nav-link {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.nav-link:hover {
    opacity: 1;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 1px;
    background: white;
    transition: width 0.3s cubic-bezier(0.76, 0, 0.24, 1);
}

.nav-link:hover::after {
    width: 100%;
}

.menu-toggle {
    display: none;
}

/* Scroll Progress */
.scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--accent-secondary);
    width: 0;
    z-index: 1001;
    transition: width 0.1s linear;
}

/* Hero Section Entrance Animations */
.hero-title, 
.hero-subtitle, 
.hero-description, 
.scroll-indicator,
.navbar {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-title { transition-delay: 0.1s; }
.hero-subtitle { transition-delay: 0.2s; }
.hero-description { transition-delay: 0.3s; }
.scroll-indicator { transition-delay: 0.6s; }
.navbar { transition-delay: 0s; transform: translateY(-20px); }

body.loaded .hero-title,
body.loaded .hero-subtitle,
body.loaded .hero-description,
body.loaded .scroll-indicator {
    opacity: 1;
    transform: translateY(0);
}

body.loaded .navbar {
    opacity: 1;
    transform: translateY(0);
}

/* Hero Section */
.hero-section {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding-top: 4rem; /* For Navbar */
}

.hero-title {
    font-size: clamp(4rem, 10vw, 10rem);
    font-weight: 700;
    line-height: 1;
    margin-bottom: 1rem;
    letter-spacing: -2px;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.5rem);
    letter-spacing: 0.5rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    font-weight: 300;
}

.hero-description {
    font-size: 1.25rem;
    line-height: 1.8;
    max-width: 600px;
}

.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    opacity: 0.5;
}

.scroll-indicator span {
    font-size: 0.8rem;
    letter-spacing: 2px;
}

.scroll-indicator .line {
    width: 1px;
    height: 60px;
    background: white;
    animation: scrollLine 2s infinite;
    transform-origin: top;
}

@keyframes scrollLine {
    0% { transform: scaleY(0); }
    50% { transform: scaleY(1); }
    100% { transform: scaleY(0); transform-origin: bottom; }
}

/* Content Sections */
.content-section {
    padding-top: var(--section-spacing);
    padding-bottom: var(--section-spacing);
    min-height: auto; /* Allow content to dictate height */
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 2rem;
    margin-bottom: 5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
}

.section-number {
    font-size: 1rem;
    color: var(--accent-secondary);
    font-family: monospace;
}

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

/* About Section */
.about-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 4rem;
}

.about-text p {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-weight: 300;
}

.about-stats {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    border-left: 1px solid var(--border-color);
    padding-left: 3rem;
    justify-content: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-num {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-color);
}

.stat-label {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

/* Contact Section */
.contact-section {
    min-height: 90vh; /* Make sure footer is pushed down */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.contact-wrapper {
    text-align: center;
    margin-top: auto;
    margin-bottom: auto;
    padding: 5rem 0;
}

.contact-title {
    font-size: 5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.contact-desc {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 4rem;
}

.magnetic-btn {
    display: inline-block;
    position: relative;
    padding: 1.5rem 4rem;
    border: 1px solid var(--border-color);
    border-radius: 100px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.magnetic-btn:hover {
    border-color: transparent;
}

.btn-text {
    position: relative;
    z-index: 2;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-color);
    transition: color 0.3s;
}

.magnetic-btn:hover .btn-text {
    color: var(--bg-color);
}

.btn-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 1;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.magnetic-btn:hover .btn-bg {
    transform: translateY(0);
}

.site-footer {
    display: flex;
    justify-content: space-between;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-link {
    margin-left: 2rem;
    color: var(--text-muted);
    transition: color 0.3s;
}

.footer-link:hover {
    color: white;
}

/* Animations */
.reveal-text, .reveal-up {
    opacity: 0;
    transform: translateY(50px) scale(0.95);
    filter: blur(10px);
    transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity, filter;
}

.reveal-text.visible, .reveal-up.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before, .glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent; /* Changed from var(--bg-color) to remove black bars */
    opacity: 0.8;
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 #ff00c1;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
    animation: glitch-anim-1 2.5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 #00fff9;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
    animation: glitch-anim-2 2s infinite linear alternate-reverse;
}

/* Scramble Effect Dud */
.dud {
    color: var(--accent-secondary);
    opacity: 0.7;
}

@keyframes glitch-anim-1 {
    0% { clip-path: inset(20% 0 80% 0); }
    20% { clip-path: inset(60% 0 10% 0); }
    40% { clip-path: inset(40% 0 50% 0); }
    60% { clip-path: inset(80% 0 5% 0); }
    80% { clip-path: inset(10% 0 70% 0); }
    100% { clip-path: inset(30% 0 20% 0); }
}

@keyframes glitch-anim-2 {
    0% { clip-path: inset(10% 0 60% 0); }
    20% { clip-path: inset(30% 0 20% 0); }
    40% { clip-path: inset(70% 0 10% 0); }
    60% { clip-path: inset(20% 0 50% 0); }
    80% { clip-path: inset(50% 0 30% 0); }
    100% { clip-path: inset(0% 0 80% 0); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    * { cursor: auto !important; }
    .cursor, .cursor-dot { display: none; }
    
    .navbar { padding: 1.5rem; }
    .nav-links { display: none; }
    .menu-toggle { display: block; width: 30px; height: 20px; position: relative; }
    .menu-toggle span { display: block; width: 100%; height: 2px; background: white; margin-bottom: 6px; }

    .hero-title { font-size: 15vw; }
    
    .about-content { grid-template-columns: 1fr; gap: 2rem; }
    .about-stats { border-left: none; border-top: 1px solid var(--border-color); padding-left: 0; padding-top: 2rem; flex-direction: row; justify-content: flex-start; gap: 4rem; }
    
    .contact-title { font-size: 3rem; }
    .magnetic-btn { padding: 1rem 2.5rem; }
    
    .site-footer { flex-direction: column; gap: 1rem; text-align: center; }
    .footer-link { margin: 0 1rem; }
}

/* Custom Context Menu */
.context-menu {
    position: fixed;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.5rem 0;
    min-width: 180px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    pointer-events: none; /* Initially disable pointer events */
}

.context-menu.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    pointer-events: auto; /* Enable when active */
}

.menu-items {
    list-style: none;
}

.menu-item {
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: none; /* Keep custom cursor */
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    padding-left: 1.8rem;
}

.menu-item::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    width: 4px;
    height: 4px;
    background: var(--accent-secondary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.menu-item:hover::before {
    opacity: 1;
}
