/* --- Variabili Globali --- */
:root {
    --primary: #B39DDB;
    --primary-light: #D1C4E9;
    --primary-dark: #7E57C2;
    --primary-darker: #5E35B1;
    --background: #F5F5F5;
    --card-bg: #FFFFFF;
    --text: #424242;
    --text-light: #757575;
    --text-primary: var(--primary-dark);
    --warning: #FFD700; /* Giallo per le stelle */
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* --- Reset e Stili di Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    background-color: var(--background);
    background-image: url('https://www.transparenttextures.com/patterns/subtle-white-feathers.png');
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.7;
    overflow-x: hidden;
}

/* MODIFICA: Regola migliorata per un blocco dello scroll più efficace su mobile e iOS */
.body-no-scroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

main {
    flex: 1;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.narrow-content {
    max-width: 800px;
    margin: 0 auto;
}

.text-center {
    text-align: center;
}

strong {
    font-weight: 700;
    color: var(--primary-darker);
}

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.navbar .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.6rem;
    color: var(--primary-dark);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.navbar .logo-image {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-links {
    display: flex;
    gap: 25px;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-dark);
    background-color: var(--primary-light);
}

/* --- Hero Section --- */
.hero-section {
    min-height: 100vh;
    background: linear-gradient(rgba(94, 53, 177, 0.6), rgba(94, 53, 177, 0.6)),
                url('https://images.unsplash.com/photo-1506126613408-4e05960270e5?auto=format&fit=crop&q=80&w=2070') no-repeat center center/cover;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    padding: 80px 20px;
    position: relative;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-content h1 {
    font-size: 3.2rem;
    margin-bottom: 20px;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.hero-content .hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 40px;
    opacity: 0.9;
    font-weight: 300;
}

.hero-content h1 strong, .hero-content .hero-subtitle strong {
    color: white;
    font-weight: 700;
}

.social-cta-subtitle {
    margin-top: 15px;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* --- Pulsanti --- */
.btn {
    display: inline-block;
    padding: 14px 30px;
    font-size: 1.1rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(126, 87, 194, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(94, 53, 177, 0.4);
}

.btn-large {
    padding: 16px 40px;
    font-size: 1.2rem;
}

/* --- Sezioni Generali --- */
.section {
    padding: 80px 0;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.section-in-container {
    padding-left: 20px;
    padding-right: 20px;
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

.bg-light {
    background: rgba(255, 255, 255, 0.5);
}

.section-title {
    font-size: 2.2rem;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 15px;
}

.section-subtitle {
    font-size: 1.1rem;
    text-align: center;
    max-width: 700px;
    margin: 0 auto 50px;
    color: var(--text-light);
}

/* --- Card --- */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    border: 1px solid rgba(179, 157, 219, 0.2);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
}

.card-icon, .feature-icon {
    font-size: 2.8rem;
    color: var(--primary-dark);
    margin-bottom: 20px;
}

.card h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.solution-container {
    background: rgba(209, 196, 233, 0.2);
    border-radius: 20px;
    padding: 50px 30px;
    margin-top: 60px;
}

/* --- Sezioni Specifiche --- */
.mission-content, .app-grows-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
    font-size: 1.1rem;
}
.app-grows-content p {
    margin-bottom: 30px;
}

.mission-content p {
    margin-bottom: 20px;
}

.features-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* --- SEZIONE STUDI SCIENTIFICI --- */
.studies-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.study-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(179, 157, 219, 0.2);
    display: flex;
    align-items: flex-start;
    gap: 20px;
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.study-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.study-card-icon {
    font-size: 2rem;
    color: var(--primary-dark);
    padding-top: 5px;
}

.study-card-content h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.study-card-content p {
    margin-bottom: 15px;
    color: var(--text-light);
    line-height: 1.6;
}

.study-link {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.3s ease;
}

.study-link:hover {
    color: var(--primary-darker);
}

.study-link i {
    font-size: 0.8em;
    margin-left: 5px;
}

/* --- SEZIONE APP SHOWCASE --- */
#app-preview {
    overflow-x: hidden;
}

.app-showcase-container {
    position: relative;
    width: 100%;
    height: 550px;
    margin-top: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.showcase-screen {
    position: absolute;
    height: 480px;
    width: auto;
    border-radius: 25px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform-origin: center center;
}

.screen-1 { transform: rotate(-5deg) translate(-20px, 0); z-index: 4; }
.screen-2 { transform: rotate(3deg) translate(20px, 10px); z-index: 3; }
.screen-3 { transform: rotate(8deg) translate(-10px, 5px); z-index: 2; }
.screen-4 { transform: rotate(-3deg) translate(10px, -10px); z-index: 1; }

.section.visible .screen-1 { transform: translateX(-160%) rotate(-8deg); }
.section.visible .screen-2 { transform: translateX(-55%) rotate(-3deg); }
.section.visible .screen-3 { transform: translateX(55%) rotate(3deg); }
.section.visible .screen-4 { transform: translateX(160%) rotate(8deg); }


/* --- SEZIONE TESTIMONIANZE CON SLIDER --- */
.testimonial-card-slider {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    background: var(--card-bg);
    border-radius: 18px;
    padding: 30px;
    text-align: center;
    box-shadow: none;
    border: 1px solid rgba(0,0,0,0.05);
}
.testimonial-stars {
    color: var(--warning);
    font-size: 1.2rem;
    margin-bottom: 15px;
}
.testimonial-text {
    font-style: italic;
    color: var(--text-light);
    margin-bottom: 20px;
    flex-grow: 1;
}
.testimonial-author {
    font-weight: 700;
    color: var(--primary-dark);
}

@keyframes scroll {
    from { transform: translateX(0); }
    to { transform: translateX(calc(-350px * 7)); }
}

.slider {
    height: 280px;
    margin: auto;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.slider::before, .slider::after { display: none; }

.slide-track {
    animation: scroll 40s linear infinite;
    display: flex;
    width: calc(350px * 14);
    backface-visibility: hidden;
    will-change: transform;
}

.slider:hover .slide-track { animation-play-state: paused; }

.slide {
    height: 280px;
    width: 350px;
    padding: 15px;
}
.slide .testimonial-card-slider { height: 100%; }

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
    margin-top: 40px;
}
.about-text p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}
.about-image img {
    width: 100%;
    max-width: 350px;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    margin: 0 auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}

/* --- SEZIONE PARTNER --- */
.partners-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 50px;
    flex-wrap: wrap;
}
.partner-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: var(--text-light);
}
.partner-item i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--primary);
}
.partner-item span {
    font-weight: 600;
    font-size: 1.1rem;
}


/* --- SEZIONE SOCIAL MODEL --- */
.social-model-content {
    max-width: 700px;
    margin: 0 auto;
    font-size: 1.1rem;
}
.social-model-icon {
    font-size: 3rem;
    color: var(--primary-dark);
    margin-bottom: 20px;
}

/* --- SEZIONE FAQ --- */
.faq-container {
    text-align: left;
}
.faq-item {
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--primary-light);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.faq-item h4 {
    font-size: 1.2rem;
    color: var(--text-primary);
    padding: 20px;
    cursor: pointer;
    position: relative;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.faq-item h4::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    transition: transform 0.4s ease;
}
.faq-item.active h4::after {
    transform: rotate(180deg);
}
.faq-item p {
    line-height: 1.8;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, padding 0.5s ease;
    padding: 0 20px;
}
.faq-item.active p {
    max-height: 300px;
    padding: 0 20px 20px;
}

/* --- SEZIONE CONTATTI --- */
.contact-info .contact-email {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}
.contact-info .contact-email:hover { color: var(--primary-darker); }
.contact-info .contact-social-title {
    margin-top: 30px;
    margin-bottom: 20px;
}
.social-icons-contact {
    display: flex;
    justify-content: center;
    gap: 25px;
}
.social-icons-contact a {
    color: var(--primary-dark);
    font-size: 2rem;
    transition: all 0.3s ease;
}
.social-icons-contact a:hover {
    transform: scale(1.1) translateY(-3px);
    color: var(--primary-darker);
}

/* --- Sezione CTA --- */
.cta-section {
    background: var(--primary-darker);
    color: white;
    padding: 70px 20px;
}
.cta-section h2 {
    font-size: 2.2rem;
    margin-bottom: 15px;
}
.cta-section p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 30px;
    opacity: 0.9;
}
.cta-section strong { color: white; }

/* --- Footer --- */
.footer {
    background: var(--primary-darker);
    color: white;
    padding: 60px 20px 30px;
}
.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}
.footer-logo .footer-logo-link {
    text-decoration: none;
    color: white;
}
.footer-logo h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}
.footer-logo p { opacity: 0.7; }
.footer-links-group h4 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--primary-light);
}
.footer-links-group ul { list-style: none; }
.footer-links-group ul li { margin-bottom: 10px; }
.footer-links-group ul li a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}
.footer-links-group ul li a:hover { color: white; }
.footer-social h4 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--primary-light);
}
.social-icons {
    display: flex;
    gap: 15px;
}
.social-icons a {
    color: white;
    font-size: 1.3rem;
    transition: all 0.3s ease;
}
.social-icons a:hover {
    transform: scale(1.1) translateY(-2px);
    color: var(--primary-light);
}
.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Menu Mobile --- */
.mobile-menu { display: none; z-index: 9999; }
.menu-btn {
    position: relative;
    width: 30px;
    height: 30px;
    cursor: pointer;
    background: none;
    border: none;
}
.menu-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--primary-dark);
    margin: 5px 0;
    border-radius: 3px;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.menu-btn.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.menu-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0.5);
}
.menu-btn.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* MODIFICA: Regole aggiornate per il menu mobile */
.mobile-nav-links {
    position: fixed;
    top: 76px;
    right: -100%;
    width: 100%;
    height: calc(100vh - 76px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* MODIFICATO: Allinea le voci in alto */
    gap: 25px;
    padding: 40px 0; /* AGGIUNTO: Spaziatura interna per non attaccare le voci ai bordi */
    z-index: 9998;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto; /* AGGIUNTO: Permette lo scroll se le voci del menu non entrano nello schermo */
    -webkit-overflow-scrolling: touch; /* AGGIUNTO: Migliora l'esperienza di scroll su iOS */
}

.mobile-nav-links.active { right: 0; }
.mobile-nav-links .nav-link { font-size: 1.5rem; color: var(--text-primary); }

/* --- Media Queries --- */
@media (max-width: 1200px) {
    .section.visible .screen-1 { transform: translateX(-120%) rotate(-8deg); }
    .section.visible .screen-2 { transform: translateX(-40%) rotate(-3deg); }
    .section.visible .screen-3 { transform: translateX(40%) rotate(3deg); }
    .section.visible .screen-4 { transform: translateX(120%) rotate(8deg); }
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .mobile-menu { display: block; }
    .hero-content h1 { font-size: 2.5rem; }
    .hero-content .hero-subtitle { font-size: 1.1rem; }
    .section { padding: 60px 0; }
    .section-title { font-size: 1.8rem; }
    .about-content { grid-template-columns: 1fr; gap: 30px; }
    .about-image { grid-row: 1; }
    .footer-content, .footer-bottom { text-align: center; }
    .social-icons { justify-content: center; }

    .app-showcase-container {
        height: 650px;
    }
    .showcase-screen {
        height: 280px;
    }

    .screen-1, .screen-2, .screen-3, .screen-4 {
        transform: rotate(0deg) translate(0, 0) scale(0.9);
    }
    .screen-1 { z-index: 4; }
    .screen-2 { z-index: 3; }
    .screen-3 { z-index: 2; }
    .screen-4 { z-index: 1; }

    .section.visible .screen-1 { transform: translate(-55%, -55%) rotate(-4deg) scale(1); }
    .section.visible .screen-2 { transform: translate(55%, -55%) rotate(4deg) scale(1); }
    .section.visible .screen-3 { transform: translate(-55%, 55%) rotate(4deg) scale(1); }
    .section.visible .screen-4 { transform: translate(55%, 55%) rotate(-4deg) scale(1); }
}

@media (max-width: 480px) {
    .app-showcase-container {
        height: 550px;
    }
    .showcase-screen {
        height: 230px;
    }
    .section.visible .screen-1 { transform: translate(-52%, -52%) rotate(-4deg) scale(1); }
    .section.visible .screen-2 { transform: translate(52%, -52%) rotate(4deg) scale(1); }
    .section.visible .screen-3 { transform: translate(-52%, 52%) rotate(4deg) scale(1); }
    .section.visible .screen-4 { transform: translate(52%, 52%) rotate(-4deg) scale(1); }
}

/* --- MODIFICA RICHIESTA: Nuovo Indicatore di Scorrimento Animato --- */
.scroll-down-indicator {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.scroll-down-indicator.hidden {
    opacity: 0;
    visibility: hidden;
}
.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    animation: breathe 2.5s infinite cubic-bezier(0.45, 0, 0.55, 1);
}

/* Ritardi per creare l'effetto a cascata */
.dot:nth-child(2) {
    animation-delay: 0.2s;
}
.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes breathe {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}
