/* ============================================
   AIGenesis - Global Stylesheet
   Enterprise AI Innovation for Italian SMEs
   ============================================ */

/* --------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------- */
:root {
  /* Primary Colors */
  --color-bg: #000000;
  --color-bg-secondary: #0A0A0A;
  --color-bg-tertiary: #111111;
  
  /* Accent Colors */
  --color-accent: #00D9FF;
  --color-accent-secondary: #00FF9D;
  --color-accent-gradient: linear-gradient(135deg, #00D9FF 0%, #00FF9D 100%);
  
  /* Text Colors */
  --color-text: #FFFFFF;
  --color-text-secondary: #8B8B8B;
  --color-text-muted: #5A5A5A;
  
  /* Utility Colors */
  --color-border: #1A1A1A;
  --color-border-hover: rgba(0, 217, 255, 0.25);
  --color-glow-cyan: rgba(0, 217, 255, 0.2);
  --color-glow-green: rgba(0, 255, 157, 0.2);
  
  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-glow-cyan: 0 0 20px rgba(0, 217, 255, 0.3);
  --shadow-glow-green: 0 0 20px rgba(0, 255, 157, 0.3);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-card-hover: 0 8px 40px rgba(0, 217, 255, 0.15);
  
  /* Animation Durations */
  --duration-micro: 0.2s;
  --duration-fast: 0.3s;
  --duration-standard: 0.6s;
  --duration-slow: 1s;
  --duration-ambient: 3s;
  
  /* Easing Functions */
  --ease-entrance: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-exit: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-transition: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.45, 0, 0.55, 1);
}

/* --------------------------------------------
   CSS Reset (Specific Selectors Only)
   -------------------------------------------- */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  padding: 0;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

p {
  margin: 0;
  padding: 0;
  color: var(--color-text-secondary);
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

li {
  margin: 0;
  padding: 0;
}

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

a:hover {
  color: var(--color-accent);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
  outline: none;
}

/* --------------------------------------------
   Typography Utilities
   -------------------------------------------- */
.text-gradient {
  background: var(--color-accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-animated {
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-secondary), var(--color-accent));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
}

/* Heading Styles */
.heading-hero {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -0.02em;
}

.heading-section {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.heading-card {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 600;
  line-height: 1.3;
}

/* Body Text */
.body-large {
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.body-small {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
}

/* Card description: più contrasto e peso per leggibilità su dark */
.card-desc {
  color: #D1D5DB;
  font-weight: 500;
}

/* Box servizi: altezza leggermente ridotta (padding e spaziatura) */
.card-box-inner {
  padding: 1.25rem 1.5rem;
}
.card-box-inner > .flex:first-child {
  margin-bottom: 0.75rem;
}


.caption {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* --------------------------------------------
   Gradient Utilities
   -------------------------------------------- */
.bg-gradient-accent {
  background: var(--color-accent-gradient);
}

.border-gradient {
  position: relative;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
}

.border-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: var(--color-accent-gradient);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  transition: opacity var(--duration-fast) var(--ease-transition);
}

.border-gradient:hover::before {
  opacity: 1;
}

/* --------------------------------------------
   Glow Effects
   -------------------------------------------- */
.glow-cyan {
  box-shadow: var(--shadow-glow-cyan);
}

.glow-green {
  box-shadow: var(--shadow-glow-green);
}

.glow-cyan-strong {
  box-shadow: 0 0 40px rgba(0, 217, 255, 0.4);
}

.text-glow-cyan {
  text-shadow: 0 0 20px rgba(0, 217, 255, 0.5);
}

/* --------------------------------------------
   Keyframe Animations
   -------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-30px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(30px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 217, 255, 0.6);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 217, 255, 0.6), 0 0 60px rgba(0, 255, 157, 0.3);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes floatSlow {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(2deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes underlineGrow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* Animation Utility Classes */
.animate-fadeIn {
  animation: fadeIn var(--duration-standard) var(--ease-entrance) forwards;
}

.animate-fadeInUp {
  animation: fadeInUp var(--duration-standard) var(--ease-entrance) forwards;
}

.animate-slideUp {
  animation: slideUp var(--duration-slow) var(--ease-entrance) forwards;
}

.animate-scaleIn {
  animation: scaleIn var(--duration-standard) var(--ease-bounce) forwards;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

.animate-pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-float-slow {
  animation: floatSlow 8s ease-in-out infinite;
}

.animate-gradient {
  animation: gradientShift 3s ease infinite;
  background-size: 200% auto;
}

.animate-bounce-slow {
  animation: bounce 2s ease-in-out infinite;
}

/* Animation Delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }

/* Initial States for Scroll Animations */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(40px);
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--duration-standard) var(--ease-entrance),
              transform var(--duration-standard) var(--ease-entrance);
}

/* --------------------------------------------
   Card Styles
   -------------------------------------------- */
.card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--duration-fast) var(--ease-transition);
}

.card:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-4px);
}

.card-3d {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: all var(--duration-fast) var(--ease-transition);
  will-change: transform;
}

.card-3d:hover {
  border-color: rgba(0, 217, 255, 0.3);
  box-shadow: 0 0 40px rgba(0, 217, 255, 0.15);
}

.card-glass {
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

/* --------------------------------------------
   Button Styles
   -------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--color-accent-gradient);
  color: #000000;
  border: none;
}

.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(0, 217, 255, 0.5);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.btn-secondary:hover {
  background: rgba(0, 217, 255, 0.1);
  border-color: var(--color-accent);
  box-shadow: 0 0 20px rgba(0, 217, 255, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border: none;
  padding: var(--space-3) var(--space-4);
}

.btn-ghost:hover {
  color: var(--color-accent);
}

.btn-ghost::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-fast) var(--ease-transition);
}

.btn-ghost:hover::after {
  transform: scaleX(1);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1.125rem;
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
}

/* Magnetic Button Effect Base */
.btn-magnetic {
  transition: transform 0.1s ease-out;
}

/* --------------------------------------------
   Tag/Badge Styles
   -------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.tag-accent {
  background: rgba(0, 217, 255, 0.1);
  color: var(--color-accent);
  border-color: rgba(0, 217, 255, 0.3);
}

.tag-gradient {
  background: var(--color-accent-gradient);
  color: #000000;
  border: none;
}

/* --------------------------------------------
   Form Elements
   -------------------------------------------- */
.input {
  width: 100%;
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 1rem;
  transition: all var(--duration-fast) var(--ease-transition);
}

.input::placeholder {
  color: var(--color-text-muted);
}

.input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.input-error {
  border-color: #ff4444;
  animation: shake 0.4s ease-in-out;
}

.input-success {
  border-color: var(--color-accent-secondary);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

textarea.input {
  min-height: 150px;
  resize: vertical;
}

/* --------------------------------------------
   Navigation Styles
   -------------------------------------------- */
.nav-link {
  position: relative;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  padding: var(--space-2) 0;
  transition: color var(--duration-fast) var(--ease-transition);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-fast) var(--ease-transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-text);
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}

/* --------------------------------------------
   Section Styles
   -------------------------------------------- */
.section {
  position: relative;
  padding: var(--space-9) 0;
}

.section-lg {
  padding: var(--space-10) 0;
}

.section-sm {
  padding: var(--space-8) 0;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-4);
  }
}

/* --------------------------------------------
   Grid Utilities
   -------------------------------------------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

@media (max-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------
   Glassmorphism
   -------------------------------------------- */
.glass {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-light {
  background: rgba(5, 5, 5, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* --------------------------------------------
   Divider Styles
   -------------------------------------------- */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border), transparent);
}

.divider-glow {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 217, 255, 0.5), transparent);
  box-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
}

/* --------------------------------------------
   Scrollbar Styles
   -------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* --------------------------------------------
   Selection Styles
   -------------------------------------------- */
::selection {
  background: rgba(0, 217, 255, 0.3);
  color: var(--color-text);
}

/* --------------------------------------------
   Reduced Motion
   -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  .animate-fadeIn,
  .animate-fadeInUp,
  .animate-slideUp,
  .animate-scaleIn,
  .animate-glow,
  .animate-pulse-glow,
  .animate-float,
  .animate-float-slow,
  .animate-gradient,
  .animate-bounce-slow {
    animation: none;
  }
  
  .reveal-on-scroll {
    opacity: 1;
    transform: none;
  }
  
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* --------------------------------------------
   Utility Classes
   -------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

/* Loading States */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: rotate 0.8s linear infinite;
}

/* Icon Styles */
.icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: rgba(0, 217, 255, 0.1);
  color: var(--color-accent);
}

.icon-wrapper-lg {
  width: 64px;
  height: 64px;
}

.icon-wrapper-gradient {
  background: var(--color-accent-gradient);
  color: #000000;
}
