@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --bg-color: #050505;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent-color: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --gradient-text: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: auto !important;
    /* Fix Spline scroll hijacking */
    overflow-x: hidden !important;
    /* Prevent horizontal scrollbars */
    scroll-behavior: smooth;
    line-height: 1.6;
}

/* Background effects */
.bg-glow {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 50vw;
    height: 50vh;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
}

.bg-glow-2 {
    position: fixed;
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vh;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    position: fixed;
    top: -100px;
    /* Initially hidden */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 900px;
    z-index: 100;
    background: rgba(10, 10, 10, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    transition: top 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease-out, box-shadow 0.6s ease;
    opacity: 0;
    pointer-events: none;
}

nav.nav-scrolled {
    top: 25px;
    opacity: 1;
    pointer-events: all;
    background: rgba(10, 10, 10, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.logo {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -1px;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.btn-primary {
    background: var(--gradient-text);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.5);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    /* Spinge header in alto e footer in basso, lasciando il robot centrale */
    padding: 12vh 5% 5vh 5%;
    position: relative;
    overflow: hidden;
}

/* Sfumatura scura in basso per garantire la visibilità del testo sul 3D */
.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40vh;
    background: linear-gradient(to top, var(--bg-color) 0%, transparent 100%);
    z-index: 1;
    pointer-events: none;
}

.hero-top {
    width: 100%;
    max-width: 800px;
    z-index: 2;
    animation: fadeUp 1s ease forwards;
    text-align: center;
    pointer-events: none;
}

.hero-top * {
    pointer-events: all;
}

.hero-bottom {
    width: 100%;
    max-width: 800px;
    z-index: 2;
    animation: fadeUp 1s ease forwards 0.3s;
    text-align: center;
    pointer-events: none;
}

.hero-bottom * {
    pointer-events: all;
}

.hero-title {
    font-size: 3.8rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    letter-spacing: -1.5px;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.hero-title span {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 auto 2rem;
    max-width: 600px;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Spline Container - FULL SCREEN RUNTIME CANVAS */
.hero-spline-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    animation: fadeIn 1.5s ease forwards;
}

.spline-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    /* ALTEZZA AUMENTATA: Facendo il canvas canvas + largo del suo div padre, 
       il watermark precipita nell'abisso invisibile tagliato dall'overflow hidden! */
    height: calc(100% + 80px) !important;
    display: block;
    cursor: grab;
    /* Interattività: manina per trascinare il robot */
    outline: none;
    pointer-events: all;
    background: transparent;
}

.spline-scene:active {
    cursor: grabbing;
}

/* Features Section */
.features {
    padding: 8rem 5%;
    position: relative;
}

.section-header {
    text-align: center;
    margin-bottom: 5rem;
}

.section-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2.5rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(800px circle at var(--mouse-x, 0) var(--mouse-y, 0), rgba(255, 255, 255, 0.06), transparent 40%);
    z-index: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: rgba(168, 85, 247, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.feature-card * {
    position: relative;
    z-index: 1;
}

.feature-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    color: #a855f7;
    font-size: 1.5rem;
}

.feature-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.feature-desc {
    color: var(--text-secondary);
}

/* Footer */
footer {
    padding: 4rem 5%;
    border-top: 1px solid var(--card-border);
    display: block;
    color: var(--text-secondary);
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Mobile Defaults & Toggles */
.mobile-toggle {
    display: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-primary);
}

.mobile-only-modal {
    display: none;
}

@media (min-width: 969px) {
    .nav-links {
        display: flex !important;
    }
}

/* Responsive */
@media (max-width: 968px) {
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background: rgba(15, 15, 20, 0.98);
        padding: 2rem;
        border-radius: 20px;
        text-align: center;
        gap: 1.5rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    }

    .nav-links.active {
        display: flex;
    }

    .mobile-toggle {
        display: block;
    }

    nav {
        width: 95%;
        padding: 1rem 1.5rem;
    }

    .logo {
        font-size: 1.3rem;
    }

    /* Hero layout mobile adjustment: stack them */
    .hero {
        padding-top: 15vh;
        padding-bottom: 5vh;
        justify-content: flex-start;
        gap: 1rem;
    }

    .hero-top {
        order: 1;
    }

    .hero-spline-background {
        position: relative;
        height: 40vh;
        min-height: 350px;
        order: 2;
        animation: none;
    }

    .hero-bottom {
        order: 3;
        position: relative;
        margin-top: 1rem;
        z-index: 2;
        padding: 0 1rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    /* Collassa la griglia dei casi d'uso ad un'unica colonna su mobile */
    #usecases .features-grid {
        grid-template-columns: 1fr !important;
    }

    /* Mobile Warning Modal */
    .mobile-only-modal {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        z-index: 10000;
        justify-content: center;
        align-items: center;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.5s ease;
    }

    .mobile-only-modal.show {
        opacity: 1;
        pointer-events: all;
    }

    .mobile-warning-content {
        background: var(--card-bg);
        border: 1px solid var(--accent-color);
        box-shadow: 0 15px 50px rgba(99, 102, 241, 0.3);
        border-radius: 20px;
        padding: 2.5rem 2rem;
        width: 90%;
        max-width: 400px;
        text-align: center;
        transform: translateY(50px);
        transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .mobile-only-modal.show .mobile-warning-content {
        transform: translateY(0);
    }
}

/* =========================================
   PAGINA WORLD MONITOR (monitor.html)
   ========================================= */

.monitor-page {
    /* Impediamo lo scroll nella pagina host, 
       ci penserà l'app nel suo iframe! */
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.monitor-page nav {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 15, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 1;
    z-index: 100;
}

.monitor-container {
    flex: 1;
    /* Prende tutto lo spazio rimasto dopo la nav fluidamente */
    width: 100%;
    position: relative;
    overflow: hidden;
}

.world-monitor-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #000;
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.loaded {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--gradient-text);
    border-right-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}