        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --bg-primary: #0a0a0f;
            --bg-secondary: #111118;
            --bg-card: rgba(30, 30, 40, 0.5);
            --cyan: #06b6d4;
            --cyan-dark: #0891b2;
            --cyan-light: #22d3ee;
            --text-primary: #f3f4f6;
            --text-secondary: #9ca3af;
            --border: #374151;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background-color: var(--bg-primary);
            color: var(--text-primary);
            line-height: 1.6;
            overflow-x: hidden;
        }

        /* Navigation */
        nav {
            position: fixed;
            top: 0;
            width: 100%;
            z-index: 1000;
            transition: all 0.3s ease;
            background-color: transparent;
        }

        nav.scrolled {
            background-color: rgba(10, 10, 15, 0.95);
            backdrop-filter: blur(10px);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        .nav-container {
            max-width: 1280px;
            margin: 0 auto;
            padding: 0 1.5rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 80px;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .logo-icon {
            width: 48px;
            height: 48px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .logo-circle {
            width: 32px;
            height: 32px;
            border: 2px solid var(--cyan);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .logo-dot {
            width: 8px;
            height: 8px;
            background: var(--cyan);
            border-radius: 50%;
        }

        .logo-text h1 {
            font-size: 1.25rem;
            font-weight: 700;
            color: white;
        }

        .logo-text p {
            font-size: 0.75rem;
            color: var(--cyan);
            letter-spacing: 0.1em;
        }

        .nav-links {
            display: flex;
            gap: 2rem;
            align-items: center;
        }

        .nav-links a {
            color: var(--text-secondary);
            text-decoration: none;
            transition: color 0.3s;
        }

        .nav-links a:hover {
            color: var(--cyan);
        }

        .cta-button {
            padding: 0.5rem 1.5rem;
            background: rgba(6, 182, 212, 0.2);
            border: 1px solid var(--cyan);
            color: var(--cyan);
            border-radius: 6px;
            text-decoration: none;
            transition: all 0.3s;
        }

        .cta-button:hover {
            background: rgba(6, 182, 212, 0.3);
        }

        .mobile-menu-btn {
            display: none;
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 1.5rem;
            cursor: pointer;
        }

        .mobile-menu {
            display: none;
            background: rgba(17, 17, 24, 0.95);
            backdrop-filter: blur(10px);
            padding: 1rem;
        }

        .mobile-menu.active {
            display: block;
        }

        .mobile-menu a {
            display: block;
            padding: 0.75rem;
            color: var(--text-secondary);
            text-decoration: none;
        }

        /* Hero Section */
        .hero {
            position: relative;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .hero-background {
            position: absolute;
            inset: 0;
            z-index: 0;
        }

        .video-placeholder {
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #111118 0%, #1a1a2e 50%, rgba(6, 182, 212, 0.1) 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0.4;
        }


        .hero-video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            opacity: 0.4;
        }


        .hero-overlay {
            position: absolute;
            inset: 0;
            background: linear-gradient(to bottom, transparent 0%, rgba(10, 10, 15, 0.5) 50%, var(--bg-primary) 100%);
        }

        .hero-content {
            position: relative;
            z-index: 10;
            text-align: center;
            padding: 0 1.5rem;
            max-width: 1100px;
        }

        .hero-content h2 {
            font-size: clamp(2.5rem, 6vw, 4.5rem);
            font-weight: 700;
            margin-bottom: 1.5rem;
            line-height: 1.2;
        }

        .hero-content .highlight {
            color: var(--cyan);
        }

        .hero-content p {
            font-size: clamp(1.125rem, 2vw, 1.5rem);
            color: var(--text-secondary);
            margin-bottom: 2.5rem;
        }

        .hero-cta {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 1rem 2rem;
            background: var(--cyan);
            color: var(--bg-primary);
            border-radius: 8px;
            font-weight: 600;
            text-decoration: none;
            transition: all 0.3s;
            box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
        }

        .hero-cta:hover {
            background: var(--cyan-light);
            transform: scale(1.05);
        }

        .hero-logo-top {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 2rem; /* Spazio tra logo e titolo */
}

.hero-logo-top img {
    width: 280px; /* Dimensione aumentata */
    height: auto;
    display: block;
    /* Effetto bagliore per renderlo "Wow" */
    filter: drop-shadow(0 0 10px rgba(0, 255, 0, 0.493)); 
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hero-logo-top img:hover {
    transform: scale(1.1) rotate(5deg); /* Leggera rotazione al passaggio */
}

/* Adattamento per schermi piccoli (Mobile) */
@media (max-width: 768px) {
    .hero-logo-top img {
        width: 120px; /* Un po' più piccolo su mobile per non coprire tutto */
        margin-top: 20px;
    }
}

/* Adattamento per schermi piccoli (Mobile) */
@media (max-width: 768px) {
    .hero-logo-top img {
        width: 180px; /* Un po' più piccolo su mobile per non coprire tutto */
        margin-top: 20px;
    }
}
        .scroll-indicator {
            position: absolute;
            bottom: 2rem;
            left: 50%;
            transform: translateX(-50%);
            animation: bounce 2s infinite;
        }

        .scroll-indicator-box {
            width: 24px;
            height: 40px;
            border: 2px solid var(--cyan);
            border-radius: 20px;
            display: flex;
            justify-content: center;
            padding-top: 8px;
        }

        .scroll-indicator-dot {
            width: 4px;
            height: 12px;
            background: var(--cyan);
            border-radius: 4px;
        }

        @keyframes bounce {

            0%,
            100% {
                transform: translateX(-50%) translateY(0);
            }

            50% {
                transform: translateX(-50%) translateY(-10px);
            }
        }

        /* Section Styles */
        section {
            padding: 4rem 1.5rem;
        }

        .section-title {
            text-align: center;
            font-size: clamp(2rem, 4vw, 2.5rem);
            font-weight: 700;
            margin-bottom: 4rem;
        }

        .container {
            max-width: 1280px;
            margin: 0 auto;
        }

        /* Horizontal Scroll Sections */
        .horizontal-scroll-wrapper {
            position: relative;
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        .horizontal-scroll-wrapper::-webkit-scrollbar {
            display: none;
        }

        .horizontal-scroll {
            display: flex;
            gap: 1.5rem;
            padding: 0 1.5rem 2rem;
        }

        .scroll-spacer {
            flex-shrink: 0;
            width: 2rem;
        }

        .scroll-hint {
            text-align: center;
            color: var(--text-secondary);
            font-size: 0.875rem;
            margin-top: 1rem;
        }

        /* Service Cards */
        .service-card {
            flex-shrink: 0;
            width: 280px;
            background: var(--bg-card);
            backdrop-filter: blur(10px);
            padding: 2rem;
            border-radius: 12px;
            border: 1px solid var(--border);
            transition: all 0.3s;
            margin-right: 10px;
        }

        .service-card:hover {
            border-color: rgba(6, 182, 212, 0.5);
            transform: scale(1.05);
        }

        .service-icon {
            font-size: 3rem;
            margin-bottom: 1rem;
        }

        .service-card h3 {
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--cyan);
            margin-bottom: 0.75rem;
        }

        .service-card p {
            color: var(--text-secondary);
            font-size: 0.875rem;
            line-height: 1.6;
        }

        /* Expertise Section */
        .expertise-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 4rem;
            align-items: center;
        }

        .expertise-list {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .expertise-item {
            display: flex;
            align-items: flex-start;
            gap: 0.75rem;
        }

        .expertise-dot {
            width: 8px;
            height: 8px;
            background: var(--cyan);
            border-radius: 50%;
            margin-top: 0.5rem;
            flex-shrink: 0;
        }

        .expertise-item p {
            color: var(--text-secondary);
            font-size: 1.125rem;
        }

        .expertise-note {
            color: var(--text-secondary);
            font-style: italic;
            margin-top: 2rem;
        }

        .expertise-image {
            aspect-ratio: 1;
            background: linear-gradient(135deg, rgba(6, 182, 212, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
            border-radius: 16px;
            border: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
            text-align: center;
            padding: 2rem;
        }

        /* Project Cards */
        .project-card {
            flex-shrink: 0;
            width: 85vw;
            max-width: 384px;
            background: var(--bg-secondary);
            border-radius: 12px;
            overflow: hidden;
            border: 1px solid var(--border);
            transition: all 0.3s;
            text-decoration: none;
            color: inherit;
            display: block;
        }

        .project-card:hover {
            border-color: rgba(6, 182, 212, 0.5);
            transform: scale(1.05);
        }

        .project-image {
            position: relative;
            height: 256px;
            overflow: hidden;
        }

        .project-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s;
        }

        .project-card:hover .project-image img {
            transform: scale(1.1);
        }

        .project-image::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(to top, var(--bg-secondary) 0%, transparent 60%);
            opacity: 0.6;
        }

        .project-badge {
            position: absolute;
            top: 1rem;
            right: 1rem;
            background: rgba(6, 182, 212, 0.2);
            backdrop-filter: blur(10px);
            border: 1px solid var(--cyan);
            color: var(--cyan);
            padding: 0.5rem 1rem;
            border-radius: 20px;
            font-size: 0.875rem;
            z-index: 10;
        }

        .project-content {
            padding: 1.5rem;
        }

        .project-content h3 {
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--cyan);
            margin-bottom: 0.5rem;
            transition: color 0.3s;
        }

        .project-card:hover .project-content h3 {
            color: var(--cyan-light);
        }

        .project-content p {
            color: var(--text-secondary);
            font-size: 0.875rem;
            margin-bottom: 1rem;
        }

        .project-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
        }

        .project-tag {
            padding: 0.25rem 0.75rem;
            background: rgba(6, 182, 212, 0.1);
            border: 1px solid rgba(6, 182, 212, 0.3);
            color: var(--cyan);
            font-size: 0.75rem;
            border-radius: 20px;
        }

        /* About Section */
        .about-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 4rem;
            align-items: center;
            margin-bottom: 4rem;
        }

        .about-image {
            aspect-ratio: 1;
            background: linear-gradient(135deg, rgba(6, 182, 212, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
            border-radius: 16px;
            border: 1px solid var(--border);
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
            text-align: center;
            padding: 2rem;
        }

        .about-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .about-content p {
            color: var(--text-secondary);
            margin-bottom: 1.5rem;
            line-height: 1.8;
        }

        .about-content p:first-child {
            font-size: 1.25rem;
            color: var(--text-primary);
        }

        .competenze-box {
            background: rgba(30, 30, 40, 0.5);
            backdrop-filter: blur(10px);
            padding: 1.5rem;
            border-radius: 12px;
            border: 1px solid var(--border);
            margin-top: 2rem;
        }

        .competenze-box h3 {
            font-size: 1.125rem;
            font-weight: 600;
            color: var(--cyan);
            margin-bottom: 1rem;
        }

        .competenze-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 1rem;
            font-size: 0.875rem;
            color: var(--text-secondary);
        }

        /* Stats Section */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 2rem;
            text-align: center;
        }

        .stat-card {
            background: rgba(30, 30, 40, 0.3);
            padding: 2rem;
            border-radius: 12px;
            border: 1px solid var(--border);
        }

        .stat-number {
            font-size: 2.5rem;
            font-weight: 700;
            color: var(--cyan);
            margin-bottom: 0.5rem;
        }

        .stat-label {
            color: var(--text-secondary);
        }

        /* Contact Section */
        .contact-section {
            background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
        }

        .contact-content {
            text-align: center;
            max-width: 800px;
            margin: 0 auto;
        }

        .contact-content h2 {
            font-size: clamp(2rem, 4vw, 2.5rem);
            margin-bottom: 1.5rem;
        }

        .contact-content p {
            font-size: 1.25rem;
            color: var(--text-secondary);
            margin-bottom: 2.5rem;
        }

        .contact-button {
            display: inline-flex;
            align-items: center;
            gap: 0.75rem;
            padding: 1.25rem 2.5rem;
            background: var(--cyan);
            color: var(--bg-primary);
            border-radius: 8px;
            font-weight: 600;
            font-size: 1.125rem;
            text-decoration: none;
            transition: all 0.3s;
            box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
        }

        .contact-button:hover {
            background: var(--cyan-light);
            transform: scale(1.05);
        }

        /* Footer */
        footer {
            background: var(--bg-primary);
            border-top: 1px solid var(--border);
            padding: 3rem 1.5rem;
        }

        .footer-content {
            max-width: 1280px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 1rem;
        }

        .footer-text {
            color: var(--text-secondary);
            font-size: 0.875rem;
        }

        /* Responsive Design */
        @media (min-width: 768px) {

            .expertise-grid,
            .about-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 768px) {
            .nav-links {
                display: none;
            }

            .mobile-menu-btn {
                display: block;
            }

            .hero-content h2 {
                font-size: 2rem;
            }

            .about-grid {
                grid-template-columns: 1fr;
            }

            .about-image {
                order: 2;
            }

            .about-content {
                order: 1;
            }

            section {
                padding: 2.5rem 1rem;
                /* Spazio molto più compatto tra le sezioni */
            }

            .invisible-layer {
                padding: 5rem 1.5rem;
                /* La sezione "Quello che non si vede" era troppo alta */
            }
        }

        /* ============================================
   CAROUSEL SYSTEM - Responsive & Smart
   ============================================ */

        .carousel-container {
            position: relative;
            max-width: 1280px;
            margin: 0 auto;
            padding: 0 1.5rem;
        }

        .carousel-wrapper {
            overflow: hidden;
            cursor: grab;
            user-select: none;
        }

        .carousel-wrapper:active {
            cursor: grabbing;
        }

        .carousel-track {
            display: flex;
            gap: 1.5rem;
            transition: transform 0.4s ease;
            padding: 1rem 0;
        }

        /* Arrows */
        .carousel-arrow {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 50px;
            height: 50px;
            background: rgba(6, 182, 212, 0.2);
            border: 1px solid var(--cyan);
            border-radius: 50%;
            color: var(--cyan);
            font-size: 2rem;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 10;
            transition: all 0.3s ease;
            backdrop-filter: blur(10px);
        }

        .carousel-arrow:hover {
            background: rgba(6, 182, 212, 0.4);
            transform: translateY(-50%) scale(1.1);
        }

        .carousel-arrow:disabled {
            cursor: not-allowed;
            opacity: 0.3;
        }

        .carousel-arrow-left {
            left: -25px;
        }

        .carousel-arrow-right {
            right: -25px;
        }

        /* Responsive adjustments */
        @media (max-width: 1320px) {
            .carousel-arrow-left {
                left: 0;
            }

            .carousel-arrow-right {
                right: 0;
            }
        }

        @media (max-width: 768px) {
            .carousel-arrow {
        display: flex !important; 
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
            .carousel-wrapper {
                overflow-x: auto;
                overflow-y: hidden;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;
                -ms-overflow-style: none;
                scroll-snap-type: x mandatory;
               -webkit-overflow-scrolling: touch;
            }

 
        }

        .invisible-layer {
            position: relative;
            background: #050810;
            padding: 14rem 2rem;
            overflow: hidden;
            text-align: center;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        #techGrid {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            z-index: 0;
        }

        .invisible-container {
            position: relative;
            z-index: 2;
            max-width: 1100px;
        }

        .reveal-mask {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1rem;
        }

        .reveal-mask span {
            position: relative;
            overflow: hidden;
            font-size: clamp(3rem, 6vw, 4rem);
            font-weight: 800;
            color: #e5e7eb;
            line-height: 1.1;
        }

        .reveal-mask span::after {
            content: "";
            position: absolute;
            inset: 0;
            background: #050810;
            transform: translateX(0%);
            animation: revealText 1.4s ease forwards;
        }

        .reveal-mask span:nth-child(2)::after {
            animation-delay: 0.4s;
        }

        @keyframes revealText {
            to {
                transform: translateX(100%);
            }
        }

        .reveal-mask em {
            font-style: normal;
            color: #60a5fa;
            text-shadow: 0 0 20px rgba(96, 165, 250, 0.6);
        }

        .sequence {
            margin-top: 5rem;
        }

        .line {
            opacity: 0;
            transform: translateY(30px);
            transition: 0.8s ease;
            color: #9ca3af;
            margin: 1.2rem 0;
            font-size: 1.5rem;
            letter-spacing: 0.04em;
        }

        .line.active {
            opacity: 1;
            transform: translateY(0);
        }

        .closing {
            margin-top: 7rem;
            font-size: 1.7rem;
            font-weight: 600;
            letter-spacing: 0.15em;
            opacity: 0;
            transition: 1.2s ease;
            color: #ffffff;
        }

        .closing.active {
            opacity: 1;
            text-shadow: 0 0 25px rgba(255, 255, 255, 0.3);
        }

        .expertise-image {
            position: relative;
            padding: 0 !important;
            /* Rimuoviamo il padding per far respirare il canvas */
            overflow: hidden;
            background: transparent !important;
        }

        #render-canvas {
            width: 100%;
            height: 100%;
            object-fit: cover;
            /* Mantiene le proporzioni come un'immagine */
        }

        .canvas-hint {
            position: absolute;
            bottom: 15px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(6, 182, 212, 0.6);
            padding: 5px 15px;
            border-radius: 20px;
            font-size: 0.7rem;
            color: white;
            pointer-events: none;
            opacity: 0.8;
        }

        /* =========================================
   Rendering Gallery (Bento Box Style)
========================================= */

.bento-gallery {
    display: grid;
    /* Fissiamo ESATTAMENTE 4 colonne su desktop. 
       Questo ci dà il controllo matematico della griglia. */
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 250px; /* Ho alzato leggermente per renderli più proporzionati */
    gap: 15px;
    grid-auto-flow: dense; /* Continua a compattare i buchi */
    
    padding: 0 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Impostazioni Flip Card --- */
.flip-card {
    background-color: transparent;
    perspective: 1000px;
    cursor: pointer;
    border-radius: 16px; /* Bordo arrotondato */
}

/* Le classi per far variare le dimensioni per creare la "board" */
.size-1x1 { grid-column: span 1; grid-row: span 1; }
.size-2x2 { grid-column: span 2; grid-row: span 2; }
.size-1x2 { grid-column: span 1; grid-row: span 2; }
.size-2x1 { grid-column: span 2; grid-row: span 1; }

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1); /* Animazione morbida */
    transform-style: preserve-3d;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); /* Leggera ombra */
}

/* La classe .flipped viene attivata al clic dal codice HTML */
.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Nasconde il retro su Safari */
    backface-visibility: hidden;
    border-radius: 16px;
    overflow: hidden;
}

/* --- Fronte della carta (Immagine) --- */
.flip-card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Taglia l'immagine per farla rientrare senza deformarla */
    transition: transform 0.3s ease;
}

.flip-card:hover .flip-card-front img {
    transform: scale(1.05); /* Effetto zoom leggero al passaggio del mouse (solo desktop) */
}

/* --- Retro della carta (Dettagli) --- */
.flip-card-back {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%); /* Colori scuri stile Luxen */
    color: white;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.flip-card-back h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.flip-card-back p {
    font-size: 0.9rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.back-tag {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* =========================================
   Mobile Optimization
========================================= */
@media (max-width: 768px) {
    .bento-gallery {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 180px;
    }
    
    /* Ridimensioniamo gli elementi enormi per farli stare su mobile */
    .size-2x2 { grid-column: span 2; grid-row: span 2; }
    .size-2x1 { grid-column: span 2; grid-row: span 1; }
}