/* RESET GENERALE & STILI PRECEDENTI */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
    scroll-behavior: smooth;
}

html, body {
    width: 100%;
    overflow-x: hidden; /* Blocca tassativamente lo scorrimento verso destra */
}

body {
    background-color: #0F0A1C; /* Deep Purple Night */
    color: #F1EDFA; /* Ice White */
    padding-top: 80px; /* Spazio per la navbar fissa */
}

/* NAVBAR SYSTEM */
.navbar {
    background-color: rgba(15, 10, 28, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    height: 80px;
    display: flex;
    align-items: center;
}

.nav-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
    color: #F1EDFA;
    letter-spacing: -0.5px;
}

.nav-menu a {
    color: #A49DB5;
    text-decoration: none;
    margin: 0 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: #FF2A85;
}

.btn-nav {
    padding: 0.6rem 1.2rem;
    border: 1px solid #FF2A85;
    color: #FF2A85;
    font-size: 0.9rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}
.btn-nav:hover {
    background-color: #FF2A85;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(255, 42, 133, 0.3);
}

/* HERO SECTION */
.hero {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    position: relative;
    overflow: hidden;
}

.hero-container {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.badge {
    background-color: rgba(139, 92, 246, 0.15);
    color: #8B5CF6; /* Neon Violet */
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.text-gradient {
    background: linear-gradient(135deg, #FF2A85, #8B5CF6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    font-size: 1.1rem;
    color: #A49DB5;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background-color: #FF2A85; /* Cyber Pink */
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(255, 42, 133, 0.3);
}

.btn-primary:hover {
    background-color: #e01f70;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 42, 133, 0.5);
}

.btn-secondary {
    border: 1px solid rgba(241, 237, 250, 0.2);
    color: #F1EDFA;
}

.btn-secondary:hover {
    background-color: rgba(241, 237, 250, 0.05);
    border-color: #F1EDFA;
    transform: translateY(-3px);
}

.hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.tech-card {
    background-color: #1A1230; /* Dark Violet Slate */
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    z-index: 2;
    overflow: hidden;
}

.card-header {
    background-color: rgba(15, 10, 28, 0.6);
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
}
.red { background-color: #ff5f56; }
.yellow { background-color: #ffbd2e; }
.green { background-color: #27c93f; }

.card-title {
    font-size: 0.8rem;
    color: #6C6382;
    margin-left: 1rem;
    font-family: monospace;
}

.card-body {
    padding: 1.5rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
}

.code-line {
    margin-bottom: 0.5rem;
    color: #A49DB5;
}
.indent { margin-left: 1.5rem; }
.code-keyword { color: #FF2A85; }
.code-string { color: #27c93f; }
.code-builtin { color: #8B5CF6; }

.glow-sphere {
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, rgba(255, 42, 133, 0.05) 70%, transparent 100%);
    filter: blur(40px);
    z-index: 1;
    border-radius: 50%;
}

/* SEZIONE SERVIZI */
.services-section {
    padding: 6rem 2rem;
    background-color: #0F0A1C;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.service-card {
    background-color: #1A1230;
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    text-align: left;
    transition: all 0.3s ease;
}

.service-card:hover {
    transform: translateY(-5px);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.05);
}

.service-icon {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

.service-card h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: #ffffff;
}

.service-card p {
    color: #A49DB5;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* SEZIONE PORTFOLIO (CAROSELLO 3D) */
.portfolio-section {
    background-color: #1A1230;
    padding: 6rem 2rem;
    text-align: center;
    border-top: 1px solid rgba(139, 92, 246, 0.1);
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    overflow: hidden;
}

.container-center {
    max-width: 1200px;
    margin: 0 auto;
}

.portfolio-section h2, .services-section h2 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.section-subtitle {
    max-width: 600px;
    margin: 0 auto 5rem auto;
    color: #A49DB5;
    line-height: 1.6;
}

/* PALCOSCENICO 3D */
.carousel-stage {
    width: 100%;
    height: 350px;
    perspective: 1200px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.carousel-3d {
    width: 280px;
    height: 180px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.carousel-item {
    position: absolute;
    width: 280px;
    height: 180px;
    left: 0;
    top: 0;
    transform: rotateY(calc(var(--item-index) * 120deg)) translateZ(240px);
    transition: all 0.3s ease;
}

.mockup-screen {
    background-color: #0F0A1C;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    width: 100%;
    height: 100%;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.screen-top {
    background-color: rgba(255,255,255,0.05);
    height: 20px;
    display: flex;
    align-items: center;
    padding-left: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.screen-top span {
    width: 6px;
    height: 6px;
    background-color: rgba(255,255,255,0.2);
    border-radius: 50%;
}

.screen-content {
    height: calc(100% - 20px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.site-1 { background: linear-gradient(45deg, #1e1b4b, #311042); }
.site-2 { background: linear-gradient(45deg, #111827, #1e3a8a); }
.site-3 { background: linear-gradient(45deg, #1f2937, #115e59); }

.screen-content h3 { font-size: 1.2rem; margin-bottom: 0.3rem; color: #fff;}
.screen-content p { font-size: 0.8rem; color: #A49DB5; }

.carousel-controls {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.btn-ctrl {
    background-color: #1A1230;
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #F1EDFA;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.btn-ctrl:hover {
    background-color: #FF2A85;
    border-color: #FF2A85;
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(255, 42, 133, 0.4);
}

.btn-visit {
    margin-top: 1rem;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    background-color: rgba(255, 42, 133, 0.2);
    border: 1px solid #FF2A85;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-visit:hover {
    background-color: #FF2A85;
    box-shadow: 0 0 10px rgba(255, 42, 133, 0.5);
}

.badge-work {
    margin-top: 1rem;
    font-size: 0.75rem;
    background-color: rgba(139, 92, 246, 0.1);
    border: 1px dashed rgba(139, 92, 246, 0.4);
    color: #A49DB5;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

/* SEZIONE CHI SIAMO */
.about-section {
    padding: 8rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.about-container {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    align-items: center;
}

.about-visual {
    display: flex;
    justify-content: center;
    width: 100%;
}

.abstract-box {
    width: 350px;
    height: 350px;
    background-color: #1A1230;
    border-radius: 24px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(139, 92, 246, 0.1);
}

.grid-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(139, 92, 246, 0.1) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(139, 92, 246, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

.floating-circle {
    position: absolute;
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #FF2A85, #8B5CF6);
    border-radius: 50%;
    top: 30%;
    left: 30%;
    filter: blur(10px);
    opacity: 0.6;
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-15px) scale(1.05); }
}

.about-content h2 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.about-content p {
    font-size: 1.05rem;
    color: #A49DB5;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

/* SEZIONE LABORATORIO ESPERIMENTI */
.lab-section {
    background-color: #0F0A1C;
    padding: 6rem 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.lab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.lab-card {
    background-color: #1A1230;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 16px;
    padding: 2rem;
    text-align: left;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

.flex-center {
    justify-content: flex-start;
    align-items: center;
    text-align: center;
}

.lab-card-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.flex-center .lab-card-header {
    flex-direction: column;
    gap: 0.5rem;
}

.lab-icon { font-size: 1.8rem; }
.lab-card h3 { font-size: 1.3rem; color: #ffffff; font-weight: 600; }

.lab-card-desc {
    color: #A49DB5;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.canvas-container {
    background-color: rgba(10, 6, 21, 0.5);
    border: 1px dashed rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    height: 300px;
}

#spiderCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* PREMIUM UI TOGGLE */
.toggle-wrapper {
    margin-top: auto;
    margin-bottom: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.theme-toggle-btn {
    position: relative;
    width: 100px;
    height: 50px;
    background-color: #0F0A1C;
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 50px;
    cursor: pointer;
    outline: none;
    padding: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.8);
}

.theme-toggle-btn .toggle-handle {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #1A1230, #0F0A1C);
    border: 1px solid rgba(241, 237, 250, 0.15);
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.handle-center {
    width: 12px;
    height: 12px;
    background-color: #6C6382;
    border-radius: 50%;
    transition: background-color 0.4s ease;
}

.toggle-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50px;
    background: radial-gradient(circle at 70% 50%, rgba(255, 42, 133, 0.15), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.theme-toggle-btn[aria-pressed="true"] {
    border-color: #FF2A85;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5), 0 0 15px rgba(255, 42, 133, 0.25);
}

.theme-toggle-btn[aria-pressed="true"] .toggle-handle {
    left: 55px;
    background: linear-gradient(135deg, #FF2A85, #8B5CF6);
    border-color: rgba(255,255,255,0.3);
    box-shadow: 0 4px 12px rgba(255, 42, 133, 0.4);
}

.theme-toggle-btn[aria-pressed="true"] .handle-center { background-color: #ffffff; }
.theme-toggle-btn[aria-pressed="true"] .toggle-glow { opacity: 1; }
.toggle-status-text { font-size: 0.85rem; font-family: monospace; color: #A49DB5; transition: color 0.3s ease; }

/* MAIN FOOTER & NEW FORM GRID */
.main-footer {
    background-color: #0A0615;
    border-top: 1px solid rgba(139, 92, 246, 0.1);
    padding: 4rem 2rem 2rem 2rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 4rem;
    align-items: center; /* Centra verticalmente il blocco di sinistra rispetto al form */
}

/* Colonna di Sinistra (Brand Centrata) */
.footer-brand {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}

/* Logo su Due Righe di Impatto */
.logo-stacked {
    display: flex;
    flex-direction: column;
    line-height: 0.95;
    font-weight: 800;
    font-size: 3.5rem;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
}

.logo-top { color: #ffffff; }
.logo-bottom {
    background: linear-gradient(135deg, #FF2A85 0%, #8B5CF6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.footer-slogan {
    color: #A49DB5;
    font-size: 1.05rem;
    max-width: 320px;
    line-height: 1.4;
}

.footer-contact-zone {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.mail-text { color: #A49DB5; font-size: 0.9rem; }
.mail-address span {
    color: #FF2A85;
    font-family: monospace;
    font-size: 1rem;
    background-color: rgba(15, 10, 28, 0.6);
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    border: 1px solid rgba(139, 92, 246, 0.15);
    user-select: all;
    display: inline-block;
}

/* Contenitore Form di Destra */
.footer-form-wrapper {
    background-color: #1A1230;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    text-align: left;
}

.footer-form-wrapper h3 { font-size: 1.5rem; color: #ffffff; margin-bottom: 0.5rem; }
.footer-form-wrapper p { color: #A49DB5; font-size: 0.9rem; margin-bottom: 1.5rem; }

.contact-form { display: flex; flex-direction: column; gap: 1.2rem; }

.form-group input, 
.form-group textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: #0F0A1C;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    color: #F1EDFA;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.form-group input:focus, 
.form-group textarea:focus {
    border-color: #FF2A85;
    box-shadow: 0 0 10px rgba(255, 42, 133, 0.2);
}

.btn-submit { width: 100%; cursor: pointer; border: none; }

.footer-bottom {
    border-top: 1px solid rgba(241, 237, 250, 0.05);
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: #6C6382;
    font-size: 0.85rem;
}
.footer-legal { font-style: italic; }

/* MEDIA QUERIES RESPONSIVE */
@media (max-width: 992px) {
    .hero-container, .about-container { grid-template-columns: 1fr; text-align: center; gap: 3rem; }
    .hero-content h1 { font-size: 2.8rem; }
    .portfolio-section h2, .services-section h2, .about-content h2 { font-size: 2.5rem; }
    .hero-buttons { justify-content: center; }
    .about-visual { order: 2; }
}

@media (max-width: 768px) {
    .nav-menu { display: none; }
    .carousel-stage { transform: scale(0.85); height: 300px; }
    .abstract-box { width: 280px; height: 280px; }
    .footer-grid { grid-template-columns: 1fr; gap: 3rem; }
    .footer-brand { text-align: center; }
    .footer-form-wrapper { padding: 1.5rem; }
    .footer-bottom { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
    .hero-content h1 { font-size: 2.2rem; }
    .carousel-stage { transform: scale(0.7); height: 260px; }
    .hero { padding: 2rem 1rem; }
    .services-section, .portfolio-section, .about-section, .lab-section { padding: 4rem 1rem; }
}