/* === RESET & BASE === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1428;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --text-primary: #ffffff;
  --text-secondary: #8892b0;
  --text-muted: #5a6380;
  --gold: #d4a04a;
  --gold-light: #f0c674;
  --gold-dark: #b8862e;
  --blue: #4a90d9;
  --blue-light: #64b5f6;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(212, 160, 74, 0.3);
  --glass: rgba(15, 20, 40, 0.8);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-gold: 0 0 30px rgba(212, 160, 74, 0.15);
  --radius: 16px;
  --radius-sm: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);

  /* Category colors */
  --cat-pa: #4a90d9;
  --cat-turismo: #27ae60;
  --cat-formazione: #8e44ad;
  --cat-sicurezza: #e74c3c;
  --cat-immobiliare: #e67e22;
  --cat-ai: #00d4ff;
  --cat-comunicazione: #f39c12;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
}

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

a:hover {
  color: var(--gold-light);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* === PARTICLE CANVAS === */
#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* === NAVBAR === */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 16px 0;
  transition: all var(--transition);
  backdrop-filter: blur(0px);
}

#navbar.scrolled {
  padding: 10px 0;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.1rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--bg-primary);
  letter-spacing: -0.5px;
}

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

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  position: relative;
  padding: 4px 0;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gold);
  transition: width var(--transition);
}

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

.nav-link:hover::after {
  width: 100%;
}

/* === HERO === */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
  padding: 120px 24px 60px;
}

.hero-badge {
  display: inline-block;
  padding: 8px 20px;
  border: 1px solid var(--border-hover);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.5px;
  margin-bottom: 32px;
  background: rgba(212, 160, 74, 0.05);
}

.hero-title {
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 24px;
  letter-spacing: -2px;
}

.hero-name {
  display: block;
}

.hero-name.gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light), var(--gold));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s ease infinite;
}

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

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.highlight {
  color: var(--text-primary);
  font-weight: 600;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary {
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-primary);
  font-weight: 700;
  font-size: 1rem;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(212, 160, 74, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(212, 160, 74, 0.4);
  color: var(--bg-primary);
}

.btn-secondary {
  padding: 14px 32px;
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1rem;
  border-radius: 50px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(-2px);
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 1px;
}

.mouse {
  width: 26px;
  height: 40px;
  border: 2px solid var(--text-muted);
  border-radius: 13px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.mouse-wheel {
  width: 3px;
  height: 8px;
  background: var(--gold);
  border-radius: 2px;
  animation: scroll-wheel 2s ease infinite;
}

@keyframes scroll-wheel {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(12px); }
}

/* === ANIMATIONS === */
.animate-fade-in {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.8s ease forwards;
}

.animate-fade-in-delay-1 {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.8s ease 0.2s forwards;
}

.animate-fade-in-delay-2 {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.8s ease 0.4s forwards;
}

.animate-fade-in-delay-3 {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.8s ease 0.6s forwards;
}

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

/* Scroll-triggered animations */
[data-scroll] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

[data-scroll].visible {
  opacity: 1;
  transform: translateY(0);
}

/* === STATS === */
#stats {
  position: relative;
  z-index: 1;
  padding: 80px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
}

.stat-card {
  text-align: center;
  padding: 32px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  backdrop-filter: blur(10px);
}

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

.stat-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gold);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

/* === PROJECTS SECTION === */
#projects {
  position: relative;
  z-index: 1;
  padding: 80px 0 120px;
}

.section-title {
  text-align: center;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.title-line {
  display: inline-block;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.title-line:last-child {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 48px;
}

/* === FILTERS === */
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 48px;
}

.filter-btn {
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-btn:hover {
  border-color: var(--gold);
  color: var(--text-primary);
  background: rgba(212, 160, 74, 0.08);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-primary);
  border-color: transparent;
  font-weight: 700;
}

.filter-icon {
  font-size: 1rem;
}

/* === PROJECT CARDS === */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.project-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
  backdrop-filter: blur(10px);
  transform-style: preserve-3d;
  perspective: 1000px;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cat-color, var(--gold)), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.project-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-6px);
  box-shadow: var(--shadow), var(--shadow-gold);
}

.project-card:hover::before {
  opacity: 1;
}

.project-card.hidden {
  display: none;
}

.project-card.animate-in {
  animation: cardIn 0.5s ease forwards;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.card-icon {
  font-size: 2rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 160, 74, 0.08);
  border-radius: 12px;
  flex-shrink: 0;
}

.card-title-group {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 2px;
  line-height: 1.3;
}

.card-domain {
  font-size: 0.8rem;
  color: var(--gold);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

.card-category {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.card-tagline {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.card-arrow {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(212, 160, 74, 0.1);
  color: var(--gold);
  transition: all var(--transition);
  opacity: 0;
  transform: translateX(-8px);
}

.project-card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Category badge colors */
.card-category[data-cat="pa"] { background: rgba(74, 144, 217, 0.15); color: var(--cat-pa); }
.card-category[data-cat="turismo"] { background: rgba(39, 174, 96, 0.15); color: var(--cat-turismo); }
.card-category[data-cat="formazione"] { background: rgba(142, 68, 173, 0.15); color: var(--cat-formazione); }
.card-category[data-cat="sicurezza"] { background: rgba(231, 76, 60, 0.15); color: var(--cat-sicurezza); }
.card-category[data-cat="immobiliare"] { background: rgba(230, 126, 34, 0.15); color: var(--cat-immobiliare); }
.card-category[data-cat="ai"] { background: rgba(0, 212, 255, 0.15); color: var(--cat-ai); }
.card-category[data-cat="comunicazione"] { background: rgba(243, 156, 18, 0.15); color: var(--cat-comunicazione); }

/* Card top bar colors */
.project-card[data-cat="pa"] { --cat-color: var(--cat-pa); }
.project-card[data-cat="turismo"] { --cat-color: var(--cat-turismo); }
.project-card[data-cat="formazione"] { --cat-color: var(--cat-formazione); }
.project-card[data-cat="sicurezza"] { --cat-color: var(--cat-sicurezza); }
.project-card[data-cat="immobiliare"] { --cat-color: var(--cat-immobiliare); }
.project-card[data-cat="ai"] { --cat-color: var(--cat-ai); }
.project-card[data-cat="comunicazione"] { --cat-color: var(--cat-comunicazione); }

/* === PROJECT DETAIL OVERLAY === */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.overlay-content {
  position: relative;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
  transform: translateY(40px) scale(0.95);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.overlay.active .overlay-content {
  transform: translateY(0) scale(1);
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  z-index: 10;
}

.close-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--gold);
}

/* Detail Content */
.detail-header {
  padding: 40px 40px 0;
}

.detail-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.detail-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.detail-domain {
  font-size: 0.9rem;
  color: var(--gold);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 16px;
}

.detail-category {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-body {
  padding: 24px 40px 40px;
}

.detail-description {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 28px;
}

.detail-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.detail-features {
  list-style: none;
  margin-bottom: 28px;
}

.detail-features li {
  padding: 8px 0;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
}

.detail-features li::before {
  content: '→';
  color: var(--gold);
  font-weight: 700;
  flex-shrink: 0;
}

.detail-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.stack-tag {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-btn-access {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-primary);
  font-weight: 700;
  font-size: 1rem;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(212, 160, 74, 0.3);
}

.detail-btn-access:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(212, 160, 74, 0.4);
  color: var(--bg-primary);
}

.detail-btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 1rem;
  border-radius: 50px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}

.detail-btn-back:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.detail-no-url {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 50px;
  border: 1px solid var(--border);
}

/* === FOOTER === */
#footer {
  position: relative;
  z-index: 1;
  padding: 48px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

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

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.footer-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--bg-primary);
}

.footer-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.footer-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.footer-info a {
  color: var(--gold);
  transition: color var(--transition);
}

.footer-info a:hover {
  color: var(--gold-light);
}

.footer-item {
  white-space: nowrap;
}

.footer-divider {
  margin: 0 12px;
  color: var(--text-muted);
}

.footer-link {
  display: inline-block;
  padding: 8px 20px;
  border: 1px solid var(--border-hover);
  border-radius: 50px;
  font-weight: 600;
  margin-top: 8px;
  transition: all var(--transition);
}

.footer-link:hover {
  background: rgba(212, 160, 74, 0.1);
  border-color: var(--gold);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .hero-title {
    letter-spacing: -1px;
  }

  .nav-links {
    display: none;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .filters {
    gap: 6px;
  }

  .filter-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .detail-header,
  .detail-body {
    padding-left: 24px;
    padding-right: 24px;
  }

  .overlay-content {
    width: 95%;
    max-height: 90vh;
  }

  .footer-divider {
    display: none;
  }

  .footer-item {
    display: block;
    margin-bottom: 4px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 20px 12px;
  }

  .stat-number {
    font-size: 1.8rem;
  }

  .hero-cta {
    flex-direction: column;
    align-items: center;
  }
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

/* === OVERLAY SCROLLBAR === */
.overlay-content::-webkit-scrollbar {
  width: 6px;
}

.overlay-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
