/* Reset e base ottimizzato */
* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
}

html {
  scroll-behavior: smooth;
}

body { 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6; 
  background-color: #121212; 
  color: #fff;
  font-display: swap;
}

.container { 
  width: 90%; 
  max-width: 1000px; 
  margin: 0 auto; 
  padding: 20px; 
}

/* Skip link per accessibilità */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #003366;
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
}

.skip-link:focus {
  top: 6px;
}

/* Sfondo full-screen ottimizzato */
#particles-js { 
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; 
  z-index: -1; 
  background: linear-gradient(135deg, #001f3f 0%, #003366 100%);
}

/* Lazy loading per immagini */
img.lazy {
  opacity: 0;
  transition: opacity 0.3s;
}

img {
  opacity: 1;
  max-width: 100%;
  height: auto;
}

/* Placeholder per immagini che caricano */
.image-placeholder {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
  display: inline-block;
  min-height: 200px;
  width: 100%;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Header ottimizzato */
.site-header { 
  background: rgba(0, 51, 102, 0.95);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 15px 0; 
  flex-wrap: wrap; 
}

.logo { 
  height: 60px; 
  width: auto;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

.nav-list { 
  list-style: none; 
  display: flex; 
  gap: 25px; 
}

.nav-list a { 
  text-decoration: none; 
  color: #fff;
  font-weight: 500;
  transition: color 0.3s ease, border-bottom 0.3s ease;
  padding-bottom: 2px;
  position: relative;
}

.nav-list a:hover,
.nav-list a:focus {
  color: #00aaff;
}

.nav-list a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: #00aaff;
  transition: width 0.3s ease;
}

.nav-list a:hover::after,
.nav-list a:focus::after {
  width: 100%;
}

/* Hero ottimizzato */
.hero { 
  position: relative; 
  overflow: hidden; 
  color: #fff; 
  padding: 100px 0; 
  text-align: center;
  min-height: 60vh;
  display: flex;
  align-items: center;
}

.hero-animation { 
  position: absolute; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; 
  background: linear-gradient(-45deg, #1e3c72, #2a5298, #1e3c72, #2a5298); 
  background-size: 400% 400%; 
  animation: gradientBG 15s ease infinite; 
  opacity: 0.6; 
  z-index: 0; 
}

@keyframes gradientBG {
  0% { background-position: 0 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.hero .container { 
  position: relative; 
  z-index: 1; 
}

.hero h1 { 
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 20px;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero p { 
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  margin-bottom: 30px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Pulsanti ottimizzati */
.btn, .contact-button a, button {
  display: inline-block;
  padding: 14px 28px;
  background: linear-gradient(135deg, #007acc, #005fa3);
  color: #ffffff;
  text-decoration: none;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 122, 204, 0.3);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover, .contact-button a:hover, button:hover {
  background: linear-gradient(135deg, #005fa3, #004080);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 122, 204, 0.4);
}

.btn:active {
  transform: translateY(0);
}

/* Sezioni ottimizzate */
section { 
  padding: 80px 0;
  position: relative;
}

section:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

section h2 { 
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 30px;
  text-align: center;
  color: #fff;
  position: relative;
}

section h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #007acc, #00aaff);
  margin: 15px auto;
  border-radius: 2px;
}

.services ul, 
.features-list { 
  list-style: none;
  display: grid;
  gap: 20px;
  margin-top: 30px;
}

.services li,
.features-list li {
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 12px;
  border-left: 4px solid #007acc;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.services li:hover,
.features-list li:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(10px);
  box-shadow: 0 8px 25px rgba(0, 122, 204, 0.2);
}

/* Form contatti ottimizzato */
.contact form { 
  max-width: 600px; 
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.05);
  padding: 40px;
  border-radius: 16px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.contact input,
.contact textarea {
  width: 100%;
  padding: 15px;
  margin-top: 8px;
  margin-bottom: 25px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-size: 16px;
  transition: all 0.3s ease;
}

.contact input::placeholder,
.contact textarea::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.contact input:focus,
.contact textarea:focus {
  outline: none;
  border-color: #007acc;
  box-shadow: 0 0 15px rgba(0, 122, 204, 0.3);
  background-color: rgba(255, 255, 255, 0.08);
}

label {
  color: #fff;
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

/* Footer ottimizzato */
.site-footer { 
  background: linear-gradient(135deg, #222, #111);
  color: #eee; 
  text-align: center; 
  padding: 40px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.site-footer a {
  color: #00aaff;
  transition: color 0.3s ease;
}

.site-footer a:hover {
  color: #007acc;
}

/* Progetti e loghi */
.project-logo {
  width: 100%;
  max-width: 400px;
  height: auto;
  display: block;
  margin: 30px auto;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.project-logo:hover {
  transform: scale(1.05);
}

/* Menu Toggle ottimizzato */
.menu-toggle {
  display: none;
  font-size: 1.8rem;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.menu-toggle:hover,
.menu-toggle:focus {
  background: rgba(255, 255, 255, 0.1);
}

/* Screenshots ottimizzati */
.screenshots h3 {
  margin-top: 50px;
  margin-bottom: 20px;
  font-size: 1.5rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 10px;
  color: #00aaff;
}

.screenshots img {
  margin-bottom: 30px;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.screenshots img:hover {
  transform: scale(1.02);
}

/* CTA ottimizzato */
.cta-contact {
  background: linear-gradient(135deg, #004080, #002a5c);
  color: #fff;
  padding: 60px 20px;
  text-align: center;
  border-radius: 16px;
  margin-top: 60px;
  box-shadow: 0 15px 35px rgba(0, 64, 128, 0.3);
  position: relative;
  overflow: hidden;
}

.cta-contact::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
  pointer-events: none;
}

.cta-contact h2 {
  font-size: 2rem;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.cta-contact p {
  font-size: 1.1rem;
  margin-bottom: 30px;
  position: relative;
  z-index: 1;
}

.cta-contact .btn {
  background: #fff;
  color: #004080;
  position: relative;
  z-index: 1;
}

.cta-contact .btn:hover {
  background: #f0f8ff;
}

/* Video demo ottimizzato */
.video-demo {
  padding: 60px 20px;
  text-align: center;
  margin-top: 40px;
}

.video-vertical {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.video-vertical iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Testimonials ottimizzati */
.testimonials blockquote {
  background: rgba(255, 255, 255, 0.05);
  margin: 30px 0;
  padding: 30px;
  border-left: 4px solid #007acc;
  border-radius: 12px;
  font-style: italic;
  position: relative;
  backdrop-filter: blur(10px);
}

.testimonials blockquote::before {
  content: '"';
  font-size: 4rem;
  color: #007acc;
  position: absolute;
  top: -10px;
  left: 15px;
  opacity: 0.3;
}

.testimonials cite {
  display: block;
  text-align: right;
  margin-top: 15px;
  color: #00aaff;
  font-weight: 600;
}

/* Main content */
main {
  position: relative;
  z-index: 1;
  min-height: 50vh;
  padding-top: 20px;
  padding-bottom: 20px;
}

/* Responsive ottimizzato */
@media (max-width: 768px) {
  .header-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }

  .menu-toggle {
    display: block;
  }

  .nav-list {
    display: none;
    flex-direction: column;
    gap: 20px;
    background: rgba(0, 51, 102, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    margin-top: 15px;
    border-radius: 12px;
    width: 100%;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  }

  .nav-list.active {
    display: flex;
  }

  .hero {
    padding: 60px 0;
  }

  .hero h1 { 
    font-size: 2rem; 
  }
  
  .hero p { 
    font-size: 1rem; 
  }

  section {
    padding: 60px 0;
  }

  .contact form {
    padding: 30px 20px;
  }

  .services ul,
  .features-list {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) {
  .services ul,
  .features-list {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

/* Performance e accessibilità */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .hero-animation {
    animation: none;
  }
}

/* Miglioramenti per stampa */
@media print {
  .site-header,
  .site-footer,
  .menu-toggle,
  #particles-js {
    display: none;
  }
  
  body {
    background: white;
    color: black;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
}

/* Focus visibile per accessibilità */
*:focus {
  outline: 2px solid #007acc;
  outline-offset: 2px;
}

/* Utility classes */
.visually-hidden {
 position: absolute !important;
 width: 1px !important;
 height: 1px !important;
 padding: 0 !important;
 margin: -1px !important;
 overflow: hidden !important;
 clip: rect(0, 0, 0, 0) !important;
 white-space: nowrap !important;
 border: 0 !important;
}

.text-center {
 text-align: center;
}

.mt-large {
 margin-top: 3rem;
}

.mb-large {
 margin-bottom: 3rem;
}

/* Animazioni per performance */
@keyframes fadeIn {
 from { opacity: 0; transform: translateY(20px); }
 to { opacity: 1; transform: translateY(0); }
}

.fade-in {
 animation: fadeIn 0.6s ease-out;
}

/* Loading states */
.loading {
 pointer-events: none;
 opacity: 0.6;
}

.loading::after {
 content: '';
 position: absolute;
 top: 50%;
 left: 50%;
 width: 20px;
 height: 20px;
 margin: -10px 0 0 -10px;
 border: 2px solid #007acc;
 border-top-color: transparent;
 border-radius: 50%;
 animation: spin 1s linear infinite;
}

@keyframes spin {
 to { transform: rotate(360deg); }
}