/* ==========================================
   FREDIGITAL - Custom Styles & Animations
   ========================================== */

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #0d0d1a;
}
::-webkit-scrollbar-thumb {
    background: #44445f;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #525275;
}

/* ---- Selection ---- */
::selection {
    background: rgba(51, 141, 255, 0.3);
    color: #fff;
}

/* ---- Hero Grid Background ---- */
.hero-grid {
    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;
}

/* ---- Navbar solid on scroll ---- */
#navbar.scrolled {
    background: rgba(13, 13, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#navbar.scrolled .nav-link {
    font-size: 0.8125rem;
}

/* ---- Mobile menu open hamburger ---- */
#menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}
#menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}
#menu-toggle.active .hamburger-line:nth-child(3) {
    width: 1.5rem;
    transform: rotate(-45deg) translate(4px, -4px);
}

/* ==========================================
   ANIMATIONS
   ========================================== */

/* ---- Pulse slow ---- */
@keyframes pulse-slow {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}
.animate-pulse-slow {
    animation: pulse-slow 6s ease-in-out infinite;
}

/* ---- Animation delay utilities ---- */
.animation-delay-200 { animation-delay: 200ms; }
.animation-delay-400 { animation-delay: 400ms; }
.animation-delay-600 { animation-delay: 600ms; }
.animation-delay-2000 { animation-delay: 2000ms; }

/* ---- Fade in ---- */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate-fade-in {
    animation: fade-in 1s ease-out forwards;
    opacity: 0;
}

/* ---- Fade in up ---- */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.animate-fade-in-up {
    animation: fade-in-up 0.8s ease-out forwards;
    opacity: 0;
}

/* ---- Draw line (underline) ---- */
@keyframes draw-line {
    from { stroke-dashoffset: 400; }
    to { stroke-dashoffset: 0; }
}
.animate-draw-line {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: draw-line 1.5s ease-out 0.8s forwards;
}

/* ---- Scroll dot ---- */
@keyframes scroll-dot {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(8px); }
}
.animate-scroll-dot {
    animation: scroll-dot 1.5s ease-in-out infinite;
}

/* ==========================================
   REVEAL ON SCROLL
   ========================================== */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children for grid items */
.reveal:nth-child(2) { transition-delay: 100ms; }
.reveal:nth-child(3) { transition-delay: 200ms; }
.reveal:nth-child(4) { transition-delay: 300ms; }
.reveal:nth-child(5) { transition-delay: 400ms; }
.reveal:nth-child(6) { transition-delay: 500ms; }

/* ==========================================
   SERVICE CARDS - Glow effect
   ========================================== */
.service-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1rem;
    padding: 1px;
    background: linear-gradient(135deg, transparent 30%, rgba(51, 141, 255, 0.1) 50%, transparent 70%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.5s;
}
.service-card:hover::before {
    opacity: 1;
}

/* ==========================================
   PROJECT CARDS
   ========================================== */
.project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(13, 13, 26, 0.8), transparent 50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.project-card:hover::after {
    opacity: 1;
}

/* ==========================================
   PARTICLES
   ========================================== */
.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(51, 141, 255, 0.4);
    border-radius: 50%;
    pointer-events: none;
}

@keyframes float-particle {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(50px);
        opacity: 0;
    }
}

/* ==========================================
   CURSOR GLOW (desktop only)
   ========================================== */
.cursor-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(51, 141, 255, 0.06), transparent 70%);
    pointer-events: none;
    z-index: 0;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s;
}

/* ==========================================
   FORM FOCUS EFFECTS
   ========================================== */
input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 4px rgba(51, 141, 255, 0.1);
}

/* ==========================================
   SMOOTH SCROLLBAR for Firefox
   ========================================== */
* {
    scrollbar-width: thin;
    scrollbar-color: #44445f #0d0d1a;
}

/* ==========================================
   RESPONSIVE TWEAKS
   ========================================== */
@media (max-width: 768px) {
    .hero-grid {
        background-size: 40px 40px;
    }

    .cursor-glow {
        display: none;
    }
}

/* ---- Typing cursor blink ---- */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
.animate-blink {
    animation: blink 1s step-end infinite;
}
