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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  background-color: #030305;
  color: #F5F5F0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  cursor: none;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===== DESIGN TOKENS ===== */
:root {
  --void: #030305;
  --surface: #0A0A0F;
  --surface-bright: #141419;
  --root: #D4FF90;
  --root-dim: #8AB84A;
  --ghost: #F5F5F0;
  --ghost-dim: #8A8A85;
  --ghost-faint: #4A4A45;
  --container-pad: clamp(1.5rem, 5vw, 4rem);
  --section-max: 1200px;
}

/* ===== FONTS ===== */
.font-display {
  font-family: 'Space Grotesk', sans-serif;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ===== CUSTOM CURSOR ===== */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--root);
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-4px, -4px);
  transition: transform 0.15s ease-out;
}

.custom-cursor.hover {
  transform: translate(-4px, -4px) scale(2.5);
}

@media (max-width: 1023px) {
  .custom-cursor {
    display: none;
  }
  body {
    cursor: auto;
  }
}

/* ===== BLINKING CURSOR ===== */
.blink-cursor {
  animation: blink 1s step-end infinite;
}

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

/* ===== NAVIGATION ===== */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  z-index: 100;
  background: transparent;
  backdrop-filter: none;
  transition: background 0.4s ease, backdrop-filter 0.4s ease;
}

#navbar.scrolled {
  background: rgba(3, 3, 5, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-inner {
  max-width: var(--section-max);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--container-pad);
}

.brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  color: var(--root);
  letter-spacing: 0.05em;
}

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

.nav-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--ghost-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.25s ease;
}

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

.hamburger {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 1px;
  background: var(--ghost-dim);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--void);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.mobile-menu.active {
  display: flex;
}

.mobile-menu a {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--ghost);
}

.close-menu {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--ghost-dim);
  cursor: pointer;
  padding: 8px;
}

@media (max-width: 767px) {
  .nav-links {
    display: none;
  }
  .hamburger {
    display: flex;
  }
}

/* ===== HERO ===== */
#hero {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

#canvas-container {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#canvas-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  padding: clamp(3rem, 8vw, 6rem) var(--container-pad);
  max-width: var(--section-max);
  margin: 0 auto;
  width: 100%;
}

.hero-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  color: var(--root);
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  opacity: 0;
  transform: translateY(30px);
}

.hero-title {
  max-width: 900px;
}

.title-line {
  overflow: hidden;
}

.hero-title .word {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(4rem, 10vw, 8.5rem);
  line-height: 0.88;
  letter-spacing: -0.03em;
  color: var(--ghost);
  opacity: 0;
  transform: translateY(60px);
}

.hero-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.875rem, 1.1vw, 1.0625rem);
  line-height: 1.6;
  color: var(--ghost-dim);
  max-width: 520px;
  margin-top: 2rem;
  opacity: 0;
  transform: translateY(40px);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
  opacity: 0;
  transform: translateY(30px);
}

.btn-primary {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  letter-spacing: 0.01em;
  background: var(--root);
  color: var(--void);
  padding: 0.875rem 2rem;
  border: none;
  transition: background 0.3s ease;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--ghost);
}

.btn-secondary {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  letter-spacing: 0.01em;
  background: transparent;
  color: var(--ghost);
  padding: 0.875rem 2rem;
  border: 1px solid var(--ghost-faint);
  transition: border-color 0.3s ease, color 0.3s ease;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--root);
  color: var(--root);
}

.btn-large {
  padding: 1rem 3rem;
  border-radius: 0;
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: clamp(2rem, 4vw, 3rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  z-index: 1;
}

.scroll-line {
  position: relative;
  width: 1px;
  height: 32px;
  background: var(--ghost-faint);
}

.scroll-dot {
  position: absolute;
  left: 50%;
  top: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--root);
  transform: translateX(-50%);
  animation: scrollDot 2s ease-in-out infinite;
}

@keyframes scrollDot {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(16px); }
}

.scroll-indicator span {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.6rem, 0.8vw, 0.7rem);
  color: var(--ghost-faint);
  letter-spacing: 0.05em;
  margin-top: 0.5rem;
}

/* Hero loaded state */
.hero-loaded .hero-eyebrow,
.hero-loaded .hero-subtitle,
.hero-loaded .hero-cta,
.hero-loaded .scroll-indicator {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s cubic-bezier(0.33, 1, 0.68, 1), transform 0.8s cubic-bezier(0.33, 1, 0.68, 1);
}

.hero-loaded .hero-eyebrow { transition-delay: 0.2s; }
.hero-loaded .hero-subtitle { transition-delay: 0.8s; }
.hero-loaded .hero-cta { transition-delay: 1.2s; }
.hero-loaded .scroll-indicator { transition-delay: 1.5s; }

.hero-loaded .hero-title .word {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 1.2s cubic-bezier(0.33, 1, 0.68, 1), transform 1.2s cubic-bezier(0.33, 1, 0.68, 1);
}

.hero-loaded .title-line:nth-child(1) .word { transition-delay: 0.3s; }
.hero-loaded .title-line:nth-child(2) .word { transition-delay: 0.38s; }

/* ===== SECTIONS SHARED ===== */
.section-inner {
  max-width: var(--section-max);
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 6rem) var(--container-pad);
}

.section-inner.center {
  text-align: center;
  max-width: 800px;
}

.section-label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  color: var(--root);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.section-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--ghost);
}

/* ===== SERVIZI ===== */
#servizi {
  background: var(--void);
}

.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 3rem;
}

@media (min-width: 768px) {
  .services-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.service-card {
  background: var(--surface);
  padding: clamp(2rem, 3vw, 3rem) clamp(1rem, 2vw, 2rem);
  border-left: 2px solid transparent;
  transition: border-left-color 0.4s ease, opacity 0.8s cubic-bezier(0.33, 1, 0.68, 1), transform 0.8s cubic-bezier(0.33, 1, 0.68, 1);
  opacity: 0;
  transform: translateY(40px);
}

.service-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.service-card:hover {
  border-left-color: var(--root);
}

.service-icon {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  color: var(--root);
  margin-bottom: 1rem;
}

.service-card h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ghost);
  margin-bottom: 0.75rem;
}

.service-card p {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.875rem, 1.1vw, 1.0625rem);
  line-height: 1.6;
  color: var(--ghost-dim);
}

/* ===== FILOSOFIA ===== */
#filosofia {
  background: var(--surface);
}

.manifesto {
  margin-top: 2rem;
  max-width: 1000px;
}

.manifesto-line {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1.0;
  letter-spacing: -0.02em;
  margin-bottom: 0.1em;
}

.manifesto-line .char {
  display: inline;
  color: var(--ghost-faint);
  transition: color 0.05s ease;
}

.manifesto-line .char.revealed {
  color: var(--ghost);
}

.philosophy-text {
  margin-top: clamp(3rem, 6vw, 6rem);
  max-width: 640px;
  margin-left: auto;
}

.philosophy-text p {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.875rem, 1.1vw, 1.0625rem);
  line-height: 1.6;
  color: var(--ghost-dim);
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.33, 1, 0.68, 1), transform 0.8s cubic-bezier(0.33, 1, 0.68, 1);
}

.philosophy-text p.visible {
  opacity: 1;
  transform: translateY(0);
}

.philosophy-text .strong {
  color: var(--ghost);
  font-weight: 500;
}

.divider {
  width: 60px;
  height: 1px;
  background: var(--ghost-faint);
  margin: 2rem 0;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.33, 1, 0.68, 1), transform 0.8s cubic-bezier(0.33, 1, 0.68, 1);
}

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

/* ===== CLIENTI ===== */
#clienti {
  background: var(--void);
}

.clients-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(2rem, 4vw, 4rem);
  margin-top: 3rem;
}

.clients-row span {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ghost-faint);
  transition: color 0.3s ease;
}

.clients-row span:hover {
  color: var(--ghost);
}

.clients-text {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.875rem, 1.1vw, 1.0625rem);
  line-height: 1.6;
  color: var(--ghost-dim);
  text-align: center;
  max-width: 560px;
  margin: 3rem auto 0;
}

/* ===== CHI SIAMO ===== */
#chisiamo {
  background: var(--void);
}

#chisiamo p {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.875rem, 1.1vw, 1.0625rem);
  line-height: 1.6;
  color: var(--ghost-dim);
  margin-top: 2rem;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(2rem, 4vw, 4rem);
  margin-top: 3rem;
}

.stat {
  text-align: center;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.88;
  letter-spacing: -0.03em;
  color: var(--root);
}

.stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.6rem, 0.8vw, 0.75rem);
  letter-spacing: 0.05em;
  color: var(--ghost-dim);
  margin-top: 0.5rem;
}

/* ===== CONTATTI CTA ===== */
#contatti {
  background: var(--surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cta-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(4rem, 10vw, 8.5rem);
  line-height: 0.88;
  letter-spacing: -0.03em;
  color: var(--ghost);
  margin-top: 2rem;
}

.cta-title .char {
  display: inline;
  color: var(--ghost-faint);
  transition: color 0.05s ease;
}

.cta-title .char.revealed {
  color: var(--ghost);
}

.cta-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.875rem, 1.1vw, 1.0625rem);
  line-height: 1.6;
  color: var(--ghost-dim);
  max-width: 480px;
  margin: 2rem auto 0;
}

.cta-wrap {
  margin-top: 3rem;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.8s cubic-bezier(0.33, 1, 0.68, 1), transform 0.8s cubic-bezier(0.33, 1, 0.68, 1);
}

.cta-wrap.visible {
  opacity: 1;
  transform: scale(1);
}

.cta-phone {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.6rem, 0.8vw, 0.75rem);
  letter-spacing: 0.05em;
  color: var(--ghost-faint);
  margin-top: 0.5rem;
}

/* ===== FOOTER ===== */
footer {
  background: var(--surface);
  padding: clamp(3rem, 6vw, 6rem) var(--container-pad);
}

.footer-inner {
  max-width: var(--section-max);
  margin: 0 auto;
  text-align: center;
}

.footer-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.88;
  letter-spacing: -0.03em;
  color: var(--root);
}

.footer-tagline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  color: var(--ghost-dim);
  letter-spacing: 0.05em;
  margin-top: 0.5rem;
}

.footer-bottom {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--ghost-faint);
}

.footer-bottom span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--ghost-faint);
  letter-spacing: 0.05em;
}

.footer-mind {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--root-dim);
  transition: color 0.3s ease;
}

.footer-mind span {
  color: var(--ghost-faint);
  margin: 0 0.3rem;
}

.footer-mind:hover {
  color: var(--root);
}

@media (max-width: 640px) {
  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* ===== SCROLL REVEAL BASE ===== */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.33, 1, 0.68, 1), transform 0.8s cubic-bezier(0.33, 1, 0.68, 1);
}

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

/* Stagger delays for children */
.reveal-stagger .reveal:nth-child(1) { transition-delay: 0s; }
.reveal-stagger .reveal:nth-child(2) { transition-delay: 0.12s; }
.reveal-stagger .reveal:nth-child(3) { transition-delay: 0.24s; }
.reveal-stagger .reveal:nth-child(4) { transition-delay: 0.36s; }
.reveal-stagger .reveal:nth-child(5) { transition-delay: 0.48s; }

/* ===== TECH GRID ===== */
.tech-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 3rem;
}

.tech-grid span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--ghost-faint);
  border: 1px solid var(--ghost-faint);
  padding: 0.5rem 1rem;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.tech-grid span:hover {
  color: var(--root);
  border-color: var(--root);
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .blink-cursor,
  .scroll-dot {
    animation: none;
  }
  .reveal,
  .service-card,
  .philosophy-text p,
  .divider,
  .cta-wrap,
  .hero-eyebrow,
  .hero-subtitle,
  .hero-cta,
  .scroll-indicator,
  .hero-title .word {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
