/* ==========================================================================
   ROMOLABS — Main Stylesheet v3.0
   Futuristic AI / Robotics · Neural-network theme · 2026
   Palette: purple #a78bfa · blue #60a5fa · deep navy #0a0e27 / #16213e
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
    --c-purple: #a78bfa;
    --c-blue: #60a5fa;
    --c-violet: #818cf8;
    --c-bg-0: #0a0e27;
    --c-bg-1: #16213e;
    --c-glass: rgba(22, 33, 62, 0.45);
    --c-glass-line: rgba(167, 139, 250, 0.16);
}

/* ---------- Base ---------- */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--c-bg-0);
    background-image:
        radial-gradient(1200px 600px at 15% -10%, rgba(167, 139, 250, 0.12), transparent 60%),
        radial-gradient(1000px 700px at 100% 0%, rgba(96, 165, 250, 0.10), transparent 55%),
        linear-gradient(160deg, #0a0e27 0%, #0c1330 45%, #16213e 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ---------- Neural-network canvas (animated background) ---------- */
#neural-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.9;
}

/* keep all real content above the canvas */
nav.fixed { z-index: 50; }
main, footer { position: relative; z-index: 10; }

/* ---------- Subtle moving grid (over the canvas, behind content) ---------- */
.grid-bg {
    position: relative;
}
.grid-bg::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(167, 139, 250, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(96, 165, 250, 0.035) 1px, transparent 1px);
    background-size: 64px 64px;
    animation: gridShift 22s linear infinite;
    -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
    mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
}

@keyframes gridShift {
    0% { background-position: 0 0; }
    100% { background-position: 64px 64px; }
}

/* ---------- Glassmorphism ---------- */
.glass {
    background: var(--c-glass);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--c-glass-line);
}

.glass-strong {
    background: rgba(10, 14, 39, 0.72);
    backdrop-filter: blur(28px) saturate(150%);
    -webkit-backdrop-filter: blur(28px) saturate(150%);
    border-bottom: 1px solid rgba(167, 139, 250, 0.14);
}

/* ---------- Gradient text ---------- */
.gradient-text {
    background: linear-gradient(110deg, #a78bfa 0%, #60a5fa 45%, #c4b5fd 70%, #60a5fa 100%);
    background-size: 220% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    animation: gradientFlow 5s ease infinite;
}

@keyframes gradientFlow {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

/* ---------- Glow border (cards) ---------- */
.glow-border { position: relative; }

.glow-border::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(135deg, var(--c-purple), transparent 40%, var(--c-blue));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.glow-border:hover::before { opacity: 1; }

.glow-pulse {
    box-shadow: 0 0 22px rgba(167, 139, 250, 0.35), 0 0 60px rgba(96, 165, 250, 0.12);
}

/* ---------- Buttons — animated glow ---------- */
.cta-glow {
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    animation: btnGlow 3.2s ease-in-out infinite;
}

.cta-glow:hover {
    transform: translateY(-2px);
}

.cta-glow::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, #a78bfa, #60a5fa, #a78bfa);
    background-size: 200% 200%;
    z-index: -1;
    border-radius: inherit;
    filter: blur(10px);
    opacity: 0.35;
    transition: opacity 0.3s ease;
    animation: gradientFlow 4s ease infinite;
}

.cta-glow:hover::after { opacity: 0.75; }

@keyframes btnGlow {
    0%, 100% { box-shadow: 0 0 0 rgba(167, 139, 250, 0.0), 0 6px 18px rgba(167, 139, 250, 0.18); }
    50% { box-shadow: 0 0 24px rgba(167, 139, 250, 0.45), 0 6px 26px rgba(96, 165, 250, 0.28); }
}

/* ---------- Animated nav link underline ---------- */
#nav-menu a {
    position: relative;
}
#nav-menu a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--c-purple), var(--c-blue));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
#nav-menu a:hover::after { transform: scaleX(1); }

/* ---------- Scroll reveal — fadeInUp ---------- */
.reveal {
    opacity: 0;
    transform: translateY(34px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

.reveal-left {
    opacity: 0;
    transform: translateX(-44px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-left.visible { opacity: 1; transform: translateX(0); }

.reveal-right {
    opacity: 0;
    transform: translateX(44px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-right.visible { opacity: 1; transform: translateX(0); }

.reveal-scale {
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-scale.visible { opacity: 1; transform: scale(1); }

/* Sequenced stagger */
.stagger > * { transition-delay: calc(var(--i, 0) * 90ms); }

/* ---------- Floating ---------- */
.float { animation: float 6s ease-in-out infinite; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-14px); }
}

/* ---------- Service cards — hover lift + shine sweep ---------- */
.service-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 70%;
    height: 100%;
    background: linear-gradient(
        100deg,
        transparent 0%,
        rgba(196, 181, 253, 0.12) 45%,
        rgba(96, 165, 250, 0.18) 50%,
        transparent 100%
    );
    transform: skewX(-18deg);
    transition: left 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.service-card:hover::before { left: 130%; }

.service-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 24px 50px rgba(167, 139, 250, 0.18), 0 0 0 1px rgba(167, 139, 250, 0.25) inset;
    border-color: rgba(167, 139, 250, 0.4);
}

/* ---------- Process step numbers — pulsing ring ---------- */
.proc-num { position: relative; }
.proc-num::before,
.proc-num::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    border: 2px solid rgba(167, 139, 250, 0.55);
    animation: ringPulse 2.6s ease-out infinite;
    pointer-events: none;
}
.proc-num::after { animation-delay: 1.3s; }

@keyframes ringPulse {
    0%   { transform: scale(1); opacity: 0.7; }
    70%  { transform: scale(1.55); opacity: 0; }
    100% { transform: scale(1.55); opacity: 0; }
}

/* ---------- Stat counter ---------- */
.stat-number { font-variant-numeric: tabular-nums; }

/* ---------- Services tabs ---------- */
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.service-img { position: absolute; inset: 0; opacity: 0; transition: opacity 0.5s ease; }
.service-img.active { opacity: 1; }

/* ---------- Mobile nav ---------- */
@media (max-width: 767px) {
    #nav-menu:not(.hidden) {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 4rem;
        left: 0;
        width: 100%;
        background: rgba(10, 14, 39, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: 1.5rem 1rem;
        gap: 1rem;
        border-bottom: 1px solid rgba(167, 139, 250, 0.14);
        z-index: 50;
    }
    #nav-menu:not(.hidden) a {
        font-size: 0.875rem;
        padding: 0.75rem 0;
    }
    #nav-menu:not(.hidden) a::after { display: none; }
}

/* ---------- WhatsApp floating button ---------- */
.whatsapp-float {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25D366;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: whatsappPulse 2s ease-in-out infinite;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(37, 211, 102, 0.6);
}

@keyframes whatsappPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(37, 211, 102, 0.6); }
}

/* ---------- Touch targets ---------- */
@media (pointer: coarse) {
    a, button, summary { min-height: 44px; }
    details summary { display: flex; align-items: center; }
}

/* ---------- iOS safe areas ---------- */
@supports (padding-top: env(safe-area-inset-top)) {
    nav.fixed { padding-top: env(safe-area-inset-top); }
    footer { padding-bottom: env(safe-area-inset-bottom); }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: #0a0e27; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #a78bfa, #60a5fa);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #c4b5fd, #818cf8); }

/* ---------- Selection ---------- */
::selection {
    background: rgba(167, 139, 250, 0.85);
    color: #0a0e27;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .reveal, .reveal-left, .reveal-right, .reveal-scale {
        opacity: 1 !important;
        transform: none !important;
    }
}
