/* ========================================
   CrossDev Studio — Custom Styles
   Premium Dark Theme Portfolio
   ======================================== */

/* ===== ROOT VARIABLES ===== */
:root {
    --primary: #6C63FF;
    --secondary: #00D4AA;
    --accent: #FF6B9D;
    --dark-900: #0A0A0F;
    --dark-800: #0F0F1A;
    --dark-700: #141425;
    --dark-600: #1A1A30;
    --dark-500: #22223A;
}

/* ===== GLOBAL RESETS ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--dark-900);
    overflow-x: hidden;
}

::selection {
    background: rgba(108, 99, 255, 0.3);
    color: #fff;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-900);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--secondary), var(--primary));
}

/* ===== PRELOADER ===== */
#preloader {
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-ring {
    width: 60px;
    height: 60px;
    position: relative;
    margin: 0 auto;
}

.ring-segment {
    position: absolute;
    inset: 0;
    border: 3px solid transparent;
    border-radius: 50%;
}

.ring-segment:nth-child(1) {
    border-top-color: var(--primary);
    animation: preloader-spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.ring-segment:nth-child(2) {
    border-right-color: var(--secondary);
    animation: preloader-spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite -0.3s;
}

.ring-segment:nth-child(3) {
    border-bottom-color: var(--accent);
    animation: preloader-spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite -0.6s;
}

@keyframes preloader-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.preloader-progress {
    width: 0%;
    animation: preloader-fill 2s ease-out forwards;
}

@keyframes preloader-fill {
    0% { width: 0%; }
    50% { width: 60%; }
    100% { width: 100%; }
}

/* ===== GLASSMORPHISM ===== */
.glass-card {
    background: rgba(15, 15, 26, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* ===== GRID PATTERN ===== */
.bg-grid-pattern {
    background-image:
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* ===== NOISE TEXTURE ===== */
.noise-overlay {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* ===== NAVBAR ===== */
#navbar.scrolled {
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 60%;
}

/* ===== MOBILE MENU ===== */
#mobile-menu.open {
    opacity: 1;
    pointer-events: all;
}

#mobile-toggle.open .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

#mobile-toggle.open .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

#mobile-toggle.open .hamburger-line:nth-child(3) {
    width: 1.5rem;
    transform: translateY(-8px) rotate(-45deg);
}

/* ===== HERO ANIMATIONS ===== */
@keyframes scroll-down {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(16px);
        opacity: 0;
    }
}

.animate-scroll-down {
    animation: scroll-down 1.5s ease-in-out infinite;
}

/* ===== FLOATING PARTICLES ===== */
.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(108, 99, 255, 0.4);
    border-radius: 50%;
    pointer-events: none;
}

.particle:nth-child(even) {
    background: rgba(0, 212, 170, 0.3);
}

.particle:nth-child(3n) {
    background: rgba(255, 107, 157, 0.3);
}

/* ===== GRADIENT TEXT SHIMMER ===== */
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.text-shimmer {
    background-size: 200% auto;
    animation: shimmer 4s linear infinite;
}

/* ===== SKILL BAR ANIMATION ===== */
.skill-bar {
    width: 0%;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-bar.animated {
    /* Width set via JS */
}

/* ===== PROJECT CARD HOVER ===== */
.project-card {
    transform: translateY(0);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover {
    transform: translateY(-8px);
}

/* ===== SERVICE CARD HOVER ===== */
.service-card {
    transform: translateY(0);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:hover {
    transform: translateY(-6px);
}

/* ===== FORM STYLES ===== */
select option {
    background-color: var(--dark-800);
    color: #fff;
}

/* Custom select arrow */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236C63FF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 18px;
}

/* Input focus glow */
input:focus,
textarea:focus,
select:focus {
    box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.1);
}

/* ===== BACK TO TOP ===== */
#back-to-top.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

/* ===== MAGNETIC BUTTON EFFECT ===== */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.btn-primary:hover::before {
    transform: translateX(100%);
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
        line-height: 1;
    }

    .glass-card {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
}

/* ===== ANIMATED GRADIENT BORDER ===== */
@keyframes border-rotate {
    0% { --angle: 0deg; }
    100% { --angle: 360deg; }
}

/* ===== GLOW PULSE ===== */
@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(108, 99, 255, 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(108, 99, 255, 0.4);
    }
}

/* ===== FLOAT ANIMATION ===== */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

/* ===== SECTION TRANSITIONS ===== */
section {
    position: relative;
}

/* ===== SMOOTH IMAGE LOADING ===== */
img {
    opacity: 0;
    transition: opacity 0.5s ease;
}

img.loaded {
    opacity: 1;
}

/* ===== STATUS MESSAGES ===== */
.form-success {
    color: var(--secondary);
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.2);
    padding: 12px 20px;
    border-radius: 12px;
}

.form-error {
    color: var(--accent);
    background: rgba(255, 107, 157, 0.1);
    border: 1px solid rgba(255, 107, 157, 0.2);
    padding: 12px 20px;
    border-radius: 12px;
}

/* ===== TEXT REVEAL ===== */
.reveal-text {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.8s cubic-bezier(0.77, 0, 0.18, 1);
}

.reveal-text.revealed {
    clip-path: inset(0 0% 0 0);
}

/* ===== TILT EFFECT ON CARDS ===== */
.tilt-card {
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* ===== FOCUS VISIBLE ===== */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ===== PAGE TRANSITION ===== */
.page-transition {
    position: fixed;
    inset: 0;
    background: var(--dark-900);
    z-index: 10000;
    transform: scaleY(0);
    transform-origin: bottom;
}
