:root {
  /* Core Colors */
  --bg-deep: #050508;
  --bg-surface: rgba(15, 15, 20, 0.6);
  --bg-surface-hover: rgba(25, 25, 35, 0.8);
  
  --accent-cyan: #00f0ff;
  --accent-violet: #8a2be2;
  --accent-blue: #0066ff;
  
  --text-main: #ffffff;
  --text-muted: #a0a0b0;
  
  /* Gradients */
  --grad-primary: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
  --grad-surface: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 100%);
  
  /* Glass */
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  
  /* Layout */
  --nav-height: 80px;
  --container-width: 1280px;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  height: var(--nav-height);
  z-index: 1000;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.navbar.scrolled {
  background: rgba(5, 5, 8, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: var(--glass-border);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo img {
  height: 40px;
  /* Converte il bianco in nero e ripristina i colori originali (blu/viola) */
  filter: invert(1) hue-rotate(180deg) brightness(1.2);
  /* Rende il nero trasparente in modo da fondersi col dark theme */
  mix-blend-mode: screen;
}

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

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

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

/* Buttons */
.btn {
  padding: 0.8rem 1.8rem;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  border: none;
}

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 0 30px rgba(138, 43, 226, 0.5);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
}

.btn-outline:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.05);
}

/* Hero Section */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-top: var(--nav-height);
}

#canvas-hero {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.ai-core-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  width: 600px;
  height: 600px;
  pointer-events: none;
}

.ai-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,240,255,0.1) 0%, rgba(0,0,0,0) 70%);
  animation: pulse-core 4s ease-in-out infinite alternate;
  filter: blur(20px);
}

@keyframes pulse-core {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.2); opacity: 0.8; box-shadow: 0 0 100px rgba(138, 43, 226, 0.3); }
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 900px;
}

.hero-badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: rgba(255,255,255,0.05);
  border: var(--glass-border);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  margin-bottom: 2rem;
  backdrop-filter: blur(10px);
  animation: float 6s ease-in-out infinite;
}

.hero h1 {
  font-size: 4.5rem;
  margin-bottom: 1.5rem;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

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

.hero-hubs {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-hubs span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hero-hubs i {
  color: var(--accent-violet);
}

/* Sections Common */
.section {
  padding: 8rem 0;
  position: relative;
  z-index: 2;
}

.section-header {
  text-align: center;
  margin-bottom: 5rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.section-header h2 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.section-header p {
  font-size: 1.1rem;
  color: var(--text-muted);
}

/* Glass Card */
.glass-card {
  background: var(--bg-surface);
  border: var(--glass-border);
  border-radius: 24px;
  padding: 2.5rem;
  backdrop-filter: blur(16px);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--grad-surface);
  opacity: 0.5;
  pointer-events: none;
}

.glass-card:hover {
  transform: translateY(-5px);
  border-color: rgba(0, 240, 255, 0.3);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5), inset 0 0 20px rgba(138,43,226,0.1);
}

/* AI OS Section */
.ai-os-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.ai-os-content h2 {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
}

.ai-os-visual {
  position: relative;
  height: 500px;
}

.dashboard-mock {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 15, 0.8);
  border: var(--glass-border);
  border-radius: 20px;
  padding: 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  transform: perspective(1000px) rotateY(-15deg);
  transition: transform 0.5s;
}

.dashboard-mock:hover {
  transform: perspective(1000px) rotateY(-5deg);
}

.mock-module {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.mock-module::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

/* KPI Section */
.kpi-section {
  background: linear-gradient(0deg, rgba(5,5,8,1) 0%, rgba(15,15,20,1) 50%, rgba(5,5,8,1) 100%);
  border-top: 1px solid rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

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

.kpi-value {
  font-size: 4rem;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

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

.product-icon {
  font-size: 2.5rem;
  color: var(--accent-cyan);
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.5));
}

.product-features {
  list-style: none;
  margin-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
}

.product-features li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.product-features li i {
  color: var(--accent-violet);
  font-size: 0.8rem;
}

/* AI Agents */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

/* Chaos to Control */
.chaos-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: 30px;
  overflow: hidden;
  border: var(--glass-border);
}

.chaos-side, .control-side {
  padding: 4rem;
}

.chaos-side {
  background: rgba(255, 0, 50, 0.02);
  border-right: 1px solid rgba(255,255,255,0.05);
}

.control-side {
  background: rgba(0, 240, 255, 0.02);
}

.chaos-list, .control-list {
  list-style: none;
  margin-top: 2rem;
}

.chaos-list li, .control-list li {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chaos-list i { color: #ff3366; }
.control-list i { color: var(--accent-cyan); }

/* Process */
.process-timeline {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
}

.process-timeline::before {
  content: '';
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-cyan), var(--accent-violet));
  opacity: 0.3;
}

.process-step {
  display: flex;
  gap: 2rem;
  position: relative;
  z-index: 1;
}

.step-number {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 2px solid var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  box-shadow: 0 0 15px rgba(0,240,255,0.3);
  flex-shrink: 0;
}

/* Forms */
.custom-form {
  max-width: 600px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-control {
  width: 100%;
  padding: 1rem 1.5rem;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: #fff;
  font-family: inherit;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0,240,255,0.2);
}

/* Pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.pricing-card.featured {
  border-color: var(--accent-cyan);
  transform: scale(1.05);
  box-shadow: 0 20px 50px rgba(0,240,255,0.1);
}

.pricing-card.featured::before {
  background: linear-gradient(180deg, rgba(0,240,255,0.1) 0%, rgba(0,0,0,0) 100%);
}

.pricing-name {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* Footer */
footer {
  border-top: var(--glass-border);
  padding: 4rem 0 2rem;
  background: #020204;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-col h4 {
  margin-bottom: 1.5rem;
  color: var(--text-main);
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 0.8rem;
}

.footer-col ul a {
  color: var(--text-muted);
}

.footer-col ul a:hover {
  color: var(--accent-cyan);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .hero h1 { font-size: 3.5rem; }
  .ai-os-grid { grid-template-columns: 1fr; }
  .agents-grid { grid-template-columns: repeat(2, 1fr); }
  .chaos-control { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero h1 { font-size: 2.5rem; }
  .section { padding: 4rem 0; }
  .pricing-card.featured { transform: scale(1); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .agents-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════
   REFINEMENT LAYER — dark polish (additivo, non invasivo)
   ═══════════════════════════════════════════════════════ */

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-height) + 16px); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* Selezione testo brandizzata */
::selection { background: rgba(0, 240, 255, 0.28); color: #fff; }

/* Scrollbar raffinata */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.18) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0,240,255,0.35), rgba(138,43,226,0.35));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(0,240,255,0.6), rgba(138,43,226,0.6));
  background-clip: padding-box;
}

/* Focus visibile accessibile e coerente */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Micro-lift coerente su superfici a vetro e card */
.glass-panel,
.pricing-card,
.agent-card,
.module-card,
.security-card {
  transition: transform .35s cubic-bezier(.25,.8,.25,1),
              box-shadow .35s cubic-bezier(.25,.8,.25,1),
              border-color .35s ease;
  will-change: transform;
}
.glass-panel:hover,
.module-card:hover,
.security-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 44px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,240,255,0.12);
  border-color: rgba(0,240,255,0.22);
}

/* Pulsanti primari: shine sottile al hover */
.btn-primary,
.btn.btn--primary,
.cta-primary {
  position: relative;
  overflow: hidden;
}
.btn-primary::after,
.btn.btn--primary::after,
.cta-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .6s ease;
  pointer-events: none;
}
.btn-primary:hover::after,
.btn.btn--primary:hover::after,
.cta-primary:hover::after {
  transform: translateX(120%);
}

/* Link nav: underline animata */
.nav-links > a.nav-item,
.nav-item > span {
  position: relative;
}
.nav-links > a.nav-item::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 100%;
  height: 2px;
  background: var(--grad-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
  border-radius: 2px;
}
.nav-links > a.nav-item:hover::after { transform: scaleX(1); }

/* Immagini più nitide e stabili nel layout */
img { max-width: 100%; height: auto; }

/* Rendering testo più pulito */
body { text-rendering: optimizeLegibility; -moz-osx-font-smoothing: grayscale; }
