/* ═══════════════════════════════════════════════════════════════
   GRID Agency — Premium Effects System
   World-class visual layer: animations, micro-interactions, polish
   ═══════════════════════════════════════════════════════════════ */

/* ─── Custom Scrollbar ─── */
* { scrollbar-width: thin; scrollbar-color: #3b83f7 #0A0A0F; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0A0A0F; }
::-webkit-scrollbar-thumb { background: #3b83f7; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #5a9af8; }

/* ─── Loading Screen ─── */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0A0A0F;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}
.loading-screen.done {
    pointer-events: none;
    visibility: hidden;
}
.loading-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    color: #3b83f7;
    opacity: 0;
}

/* ─── Noise Texture Overlay ─── */
.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ─── Gradient Mesh Background ─── */
.gradient-mesh {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}
.gradient-mesh .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    will-change: transform;
}
.gradient-mesh .blob-1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(59,131,247,0.25), transparent 70%);
    top: -200px; right: -100px;
}
.gradient-mesh .blob-2 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(124,58,237,0.18), transparent 70%);
    bottom: -150px; left: -100px;
}
.gradient-mesh .blob-3 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(59,131,247,0.12), transparent 70%);
    top: 40%; left: 40%;
}

/* ─── Animated Dot Grid ─── */
.dot-grid-animated {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(59,131,247,0.12) 1px, transparent 1px);
    background-size: 32px 32px;
    z-index: 1;
    pointer-events: none;
    mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
}

/* ─── Floating Particles Canvas ─── */
#particles-canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.5;
}

/* ─── Glow Orb ─── */
.glow-orb {
    position: fixed;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59,131,247,0.15) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    filter: blur(60px);
    will-change: transform;
    top: 0; left: 0;
}

/* ─── Hero Gradient Text Animation ─── */
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
.gradient-text-animated {
    background: linear-gradient(90deg, #3b83f7, #ffffff, #7c3aed, #3b83f7);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 6s ease infinite;
}

/* ─── GRID Logo Glitch ─── */
.glitch-hover {
    position: relative;
    display: inline-block;
    cursor: pointer;
}
.glitch-hover::before,
.glitch-hover::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}
.glitch-hover::before {
    color: #ff0040;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
    transform: translate(2px, -1px);
}
.glitch-hover::after {
    color: #00d4ff;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
    transform: translate(-2px, 1px);
}
.glitch-hover:hover::before,
.glitch-hover:hover::after {
    opacity: 0.8;
    animation: glitch 0.3s ease infinite alternate;
}
@keyframes glitch {
    0% { transform: translate(2px, -1px); }
    25% { transform: translate(-2px, 1px); }
    50% { transform: translate(1px, 2px); }
    75% { transform: translate(-1px, -2px); }
    100% { transform: translate(2px, 1px); }
}

/* ─── Shimmer / Glint Button ─── */
.btn-shimmer {
    position: relative;
    overflow: hidden;
}
.btn-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
}
.btn-shimmer:hover::after {
    animation: shimmer 0.75s ease forwards;
}
@keyframes shimmer {
    to { left: 100%; }
}

/* ─── Magnetic Button ─── */
.magnetic {
    will-change: transform;
}

/* ─── Nav Link Animated Underline ─── */
.nav-animated {
    position: relative;
}
.nav-animated::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: 0;
    width: 0;
    height: 2px;
    background: #3b83f7;
    transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.nav-animated:hover::after {
    width: 100%;
}

/* ─── Section Heading Underline (draws on scroll) ─── */
.heading-underline {
    position: relative;
    display: inline-block;
}
.heading-underline::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b83f7, #7c3aed);
    border-radius: 2px;
    transition: width 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.heading-underline.in-view::after {
    width: 60px;
}

/* ─── Decorative Section Numbers ─── */
.section-number-bg {
    position: absolute;
    top: -30px;
    right: 20px;
    font-size: clamp(5rem, 10vw, 10rem);
    font-weight: 900;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    z-index: 0;
    background: linear-gradient(180deg, rgba(59,131,247,0.08), transparent);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ─── Glass Morphism Card ─── */
.glass-card {
    background: rgba(15, 15, 25, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(59, 131, 247, 0.12);
}

/* ─── Service Card Gradient Reveal ─── */
.service-card-premium {
    position: relative;
    overflow: hidden;
    z-index: 1;
}
.service-card-premium::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 30%, rgba(59,131,247,0.08) 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: -1;
    border-radius: inherit;
}
.service-card-premium:hover::before {
    opacity: 1;
}

/* ─── Animated Card Border (rotating conic gradient) ─── */
@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
.animated-border-card {
    position: relative;
    --border-angle: 0deg;
}
.animated-border-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from var(--border-angle), transparent 60%, #3b83f7 80%, transparent 100%);
    -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.4s;
    pointer-events: none;
}
.animated-border-card:hover::before {
    opacity: 1;
    animation: borderRotate 4s linear infinite;
}
@keyframes borderRotate {
    to { --border-angle: 360deg; }
}

/* ─── Icon Pulse Glow ─── */
.icon-glow {
    transition: filter 0.3s ease, transform 0.3s ease;
}
.icon-glow:hover {
    filter: drop-shadow(0 0 16px rgba(59,131,247,0.6));
    transform: scale(1.1);
}

/* ─── Stats Bar ─── */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
}
@media (min-width: 768px) {
    .stats-bar { grid-template-columns: repeat(4, 1fr); }
}
.stat-item {
    text-align: center;
    padding: 2.5rem 1.5rem;
}
.stat-number {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    color: #3b83f7;
    line-height: 1;
    direction: ltr;
}
.stat-label {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-top: 0.75rem;
}

/* ─── Marquee / Social Proof ─── */
.marquee-container {
    overflow: hidden;
    white-space: nowrap;
    padding: 1.5rem 0;
}
.marquee-track {
    display: inline-flex;
    align-items: center;
    gap: 5rem;
    animation: marquee 35s linear infinite;
}
@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.marquee-item {
    height: 50px;
    width: auto;
    object-fit: contain;
    opacity: 0.3;
    transition: all 0.5s;
    flex-shrink: 0;
}
.marquee-item.marquee-item-lg {
    height: 125px;
}
.marquee-item:hover {
    opacity: 1;
}

/* ─── Portfolio Hover Overlay ─── */
.portfolio-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 30%, rgba(10,10,15,0.95) 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
    z-index: 20;
}
.group:hover .portfolio-card-overlay {
    opacity: 1;
}

/* ─── Floating 3D Abstract Shape ─── */
@keyframes shapeFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(3deg); }
    50% { transform: translateY(-10px) rotate(-2deg); }
    75% { transform: translateY(-25px) rotate(4deg); }
}
@keyframes shapeSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.floating-shape {
    position: relative;
    width: 280px;
    height: 280px;
    animation: shapeFloat 8s ease-in-out infinite;
}
.shape-ring {
    position: absolute;
    inset: 0;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    border: 1px solid;
}
.shape-ring:nth-child(1) {
    border-color: rgba(59,131,247,0.3);
    animation: shapeSpin 20s linear infinite;
}
.shape-ring:nth-child(2) {
    inset: 15%;
    border-color: rgba(124,58,237,0.2);
    border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%;
    animation: shapeSpin 15s linear infinite reverse;
}
.shape-ring:nth-child(3) {
    inset: 30%;
    border-color: rgba(59,131,247,0.15);
    border-radius: 50% 50% 30% 70% / 40% 60% 40% 60%;
    animation: shapeSpin 25s linear infinite;
}
.shape-ring:nth-child(4) {
    inset: 10%;
    border-color: rgba(59,131,247,0.08);
    border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%;
    animation: shapeSpin 30s linear infinite reverse;
    background: radial-gradient(circle, rgba(59,131,247,0.03), transparent);
}

/* ─── Scroll Reveal Animations ─── */
.reveal-up {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal-up.revealed {
    opacity: 1;
    transform: translateY(0);
}
.reveal-scale {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

/* ─── Stagger delay via CSS variable ─── */
.stagger-children > .reveal-up,
.stagger-children > .reveal-scale {
    transition-delay: calc(var(--i, 0) * 0.12s);
}

/* ─── Hero Word Clip (for GSAP text reveal) ─── */
.hero-word-wrapper {
    overflow: hidden;
    display: inline-block;
}
.hero-word {
    display: inline-block;
}

/* ─── Featured Project Parallax ─── */
.featured-project-img {
    transition: transform 0.3s ease-out;
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal-up, .reveal-scale { opacity: 1; transform: none; }
    .loading-screen { display: none !important; }
    .marquee-track { animation: none; }
    .floating-shape { animation: none; }
    .gradient-text-animated { animation: none; }
    .shape-ring { animation: none; }
    #particles-canvas { display: none; }
    .glow-orb { display: none; }
    .gradient-mesh .blob { filter: blur(80px); }
}
