:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: rgba(22, 27, 34, 0.7);
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --accent-color: #E63946;
  --accent-hover: #ff4d5a;
  --glass-border: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] {
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --text-primary: #111111;
  --text-secondary: #4a4a4a;
  --accent-color: #E63946;
  --accent-hover: #d62828;
  --glass-border: rgba(0, 0, 0, 0.1);
  --input-bg: rgba(255, 255, 255, 0.8);
}

body {
  overflow-x: hidden;
  width: 100%;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  background-image: radial-gradient(circle at 15% 50%, rgba(230, 57, 70, 0.03), transparent 25%),
                    radial-gradient(circle at 85% 30%, rgba(230, 57, 70, 0.03), transparent 25%);
}

/* Glassmorphism Header */
header {
  background: var(--bg-secondary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 100000;
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.logo-section {
  text-align: center;
  padding: 25px 20px;
  background: transparent;
  position: relative;
  z-index: 2;
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.logo-section img {
  height: 180px;
  width: auto;
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  display: block;
  margin: 0 auto;
}
.logo-section img:hover {
  transform: scale(1.02);
}

.nav-section {
  padding: 15px 20px;
  text-align: center;
  display: flex;
  gap: 30px;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  position: relative;
  z-index: 1;
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Shrinking Header State */
header.scrolled {
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
header.scrolled .logo-section {
  padding: 10px 20px;
  background: transparent;
}
header.scrolled .logo-section img {
  height: 120px;
}
header.scrolled .nav-section {
  padding: 10px 20px;
}

.nav-section a {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 1.05rem;
  transition: all 0.3s ease;
  white-space: normal;
  padding: 8px 16px;
  border-radius: 8px;
}
.nav-section a:hover, .nav-section a.active {
  color: var(--accent-color);
  background: rgba(230, 57, 70, 0.1);
  box-shadow: inset 0 0 0 1px var(--accent-color);
}

body { padding-top: 310px; }
main { flex-grow: 1; }

@media (max-width: 900px) { 
  body { padding-top: 340px; }
  .servizio-card, .servizio-card:nth-child(even) {
    flex-direction: column;
    gap: 30px;
  }
  .servizio-img-wrapper, .servizio-content {
    width: 100%;
  }
}
@media (max-width: 768px) {
  body { padding-top: 180px !important; }
  .logo-section img { height: 120px; }
  .nav-section { flex-wrap: wrap; gap: 10px; }
}
@media (max-width: 480px) {
  .hero-buttons { gap: 15px; }
  body { padding-top: 160px !important; }
  .logo-section { padding: 15px; }
  .logo-section img { height: 100px; }
  .nav-section { padding: 10px; }
  .nav-section a { font-size: 0.95rem; padding: 6px 12px; }
  .btn-primary { padding: 12px 24px !important; font-size: 0.95rem !important; }
}

@keyframes fadein { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Hero Section */
.hero {
  padding: 80px 20px 60px;
  text-align: center;
  animation: fadein 0.8s ease-out;
}
.hero h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  line-height: 1.1;
  font-weight: 900;
  margin-bottom: 25px;
  color: var(--text-primary);
}
.hero p {
  font-size: 1.3rem;
  margin-bottom: 40px;
  color: var(--text-secondary);
  font-weight: 300;
}
.hero-buttons {
  display: flex;
  gap: 40px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-color), #b82333);
  color: #fff;
  padding: 16px 36px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  border: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  display: inline-block;
  box-shadow: 0 8px 15px rgba(230,57,70,0.25);
}
.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 20px rgba(230,57,70,0.4);
}
.btn-primary:active { transform: translateY(1px); }

/* Sections */
section { padding: 60px 20px; }
section h2 {
  text-align: center;
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 60px;
  font-weight: 800;
  color: var(--text-primary);
}

/* Cards (Glassmorphism) */
.macchinari-container, .vantaggi-container {
  display: grid;
  gap: 30px;
  max-width: 1400px;
  margin: 0 auto;
  animation: fadein 1s ease-out;
}
.macchinari-container { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }

/* Alternating Services Layout */
.servizi-container {
  display: flex;
  flex-direction: column;
  gap: 80px;
  max-width: 1200px;
  margin: 0 auto;
}
.servizio-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 50px;
  background: transparent;
  padding: 0;
  border: none;
  box-shadow: none;
}
.servizio-card:nth-child(even) {
  flex-direction: row-reverse;
}
.servizio-card:hover .servizio-content {
  box-shadow: 0 15px 40px rgba(230, 57, 70, 0.15);
}
.servizio-img-wrapper {
  width: 45%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0,0,0,0.4);
  position: relative;
  aspect-ratio: 4 / 3;
}
.servizio-img-wrapper img {
  width: 100%;
  height: 120%;
  object-fit: cover;
  display: block;
}
.servizio-content {
  width: 50%;
  background: var(--bg-secondary);
  padding: 40px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.servizio-content h3 {
  color: var(--accent-color);
  font-size: 2rem;
  margin-bottom: 20px;
  font-weight: 800;
  line-height: 1.2;
}
.servizio-content p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 1.1rem;
}

/* Base card styling for others */
.macchina, .vantaggio, .chi-siamo-content, .info-block, .contatti-form {
  background: var(--bg-secondary);
  padding: 35px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  will-change: transform;
}
.macchina h3, .vantaggio h4 {
  color: var(--accent-color);
  font-size: 1.5rem;
  margin-bottom: 15px;
  font-weight: 700;
}
.macchina p, .vantaggio p {
  color: var(--text-secondary);
  line-height: 1.7;
  font-weight: 300;
}

/* Misc Components */
.vantaggio { text-align: center; }
.vantaggio h4 { color: var(--accent-color); font-size: 1.3rem; margin-bottom: 12px; }

.chi-siamo-content {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}
.chi-siamo-content p {
  font-size: 1.15rem;
  margin-bottom: 25px;
  color: var(--text-primary);
  font-weight: 300;
}

.contatti-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 30px;
  margin-bottom: 60px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.info-block { text-align: center; }
.info-block h4 { color: var(--accent-color); font-size: 1.4rem; margin-bottom: 15px; }
.info-block p { margin-bottom: 10px; color: var(--text-secondary); font-size: 0.95rem; white-space: normal; }
.info-block .label { font-weight: 600; color: var(--text-primary); display: inline-block; margin-right: 8px; }
.info-block a {
  color: var(--accent-hover);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.info-block a:hover { color: var(--text-primary); }

/* Forms */
.contatti-form { max-width: 800px; margin: 0 auto; }
.contatti-form h3 { text-align: center; font-size: 2rem; margin-bottom: 30px; color: var(--text-primary); }
.form-group { margin-bottom: 25px; }
.form-group label { display: block; margin-bottom: 10px; color: var(--text-primary); font-weight: 500; }
.form-group input, .form-group textarea {
  width: 100%;
  padding: 15px;
  background: var(--input-bg, rgba(0,0,0,0.2));
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-primary);
  transition: all 0.3s;
}
.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(230,57,70,0.2);
}
.form-group textarea { resize: vertical; min-height: 150px; }

.form-status { margin-top: 20px; padding: 15px; border-radius: 8px; display: none; text-align: center; font-weight: 600; }
.form-status.success { background: rgba(46, 160, 67, 0.15); color: #3fb950; border: 1px solid rgba(46, 160, 67, 0.4); display: block; }
.form-status.error { background: rgba(248, 81, 73, 0.15); color: #ff7b72; border: 1px solid rgba(248, 81, 73, 0.4); display: block; }

/* WhatsApp */
.whatsapp-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
  box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-size: 32px;
}
.whatsapp-btn:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 12px 30px rgba(37, 211, 102, 0.6);
}

footer {
  text-align: center;
  padding: 40px 20px;
  margin-top: auto;
  border-top: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-weight: 300;
}

/* Portfolio Grid & Lightbox */
.portfolio-section {
    padding: 0 20px 60px;
}
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}
.portfolio-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    cursor: pointer;
}
.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}
.portfolio-item:hover img {
    transform: scale(1.08);
}
.lightbox-trigger {
    display: block;
    width: 100%;
    height: 100%;
}
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.lightbox:target {
    display: flex;
}
.lightbox img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: fadein 0.3s ease-out;
}
.lightbox-close {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: default;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .servizio-card, .servizio-card:nth-child(even) {
    flex-direction: column !important;
    gap: 20px;
  }
  .servizio-img-wrapper, .servizio-content {
    width: 100% !important;
  }
  .servizio-img-wrapper {
    height: 250px;
  }
  .logo-section {
    padding: 15px 10px;
  }
  .logo-section img {
    height: auto;
    max-height: 120px;
    max-width: 90%;
  }
  header.scrolled .logo-section img {
    max-height: 70px;
  }
  .nav-section {
    padding: 10px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
  }
  header.scrolled .nav-section {
    padding: 10px;
  }
  .lang-switch {
    width: 100%;
    justify-content: center;
    border-left: none;
    margin-left: 0;
    padding-left: 0;
    margin-top: 5px;
  }
}

/* SplitType Animation Masking */
/* Removed duplicate .word */

/* --- ULTRA-PREMIUM FEATURES --- */
/* Custom Cursor */
@media (hover: hover) and (pointer: fine) {
  html, body, *, *::before, *::after { 
    cursor: url('../img/transparent.png') 0 0, none !important; 
  }
  html.is-transitioning body {
    pointer-events: none !important;
  }
}
#custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background-color: var(--accent-color);
  border-radius: 50%;
  pointer-events: none;
  z-index: 100001;
  mix-blend-mode: difference;
  transform: translate(-50%, -50%);
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
@media (hover: hover) and (pointer: fine) {
  #custom-cursor { display: block; }
}

/* Laser Transition Overlay */
.laser-overlay {
  position: fixed;
  top: -10vh;
  left: 0;
  width: 100%;
  height: 120vh;
  background-color: #050505;
  z-index: 100000;
  pointer-events: none;
  transform: translateY(-100%);
}
.laser-line {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: var(--accent-color);
  box-shadow: 0 0 20px var(--accent-color), 0 0 40px var(--accent-color);
}

/* Lenis Recommended CSS */
html.lenis, html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}
.lenis.lenis-stopped {
  overflow: hidden;
}
.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

/* Prevent Barba Flash */
[data-barba="container"] {
  opacity: 0;
  visibility: hidden;
}
[data-barba="container"].is-visible {
  opacity: 1;
  visibility: visible;
}

/* --- WEBGL & FULLSCREEN NAV --- */
#webgl-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* --- SPLIT SCREEN MENU --- */
.fullscreen-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 99999;
  pointer-events: auto;
  display: flex;
  visibility: hidden;
  opacity: 0;
  flex-direction: row;
}

.fs-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.fs-panel-left {
  width: 65%;
  background: var(--bg-primary);
  padding-left: 10%;
  align-items: flex-start;
  opacity: 1;
}

.fs-panel-right {
  width: 35%;
  background: #111; /* Dark contrast */
  padding: 40px; padding-top: 160px;
  align-items: flex-start;
}
[data-theme="light"] .fs-panel-right {
  background: #f0f0f0;
}

.fs-nav-content {
  display: flex;
  margin-top: 100px;
  flex-direction: column;
  gap: 15px;
}

.fs-link {
  font-size: 3rem;
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
  text-decoration: none;
  display: block;
  line-height: 1.1;
  transition: opacity 0.3s ease, filter 0.3s ease, color 0.3s ease;
}
.fs-link:hover {
  color: var(--accent-color);
}
.fs-link.is-blurred {
  opacity: 0.3;
  filter: blur(4px);
}

.fs-nav-contacts {
  display: flex;
  margin-top: 100px;
  flex-direction: column;
  gap: 30px;
  color: var(--text-primary);
}
.fs-nav-contacts h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}
.fs-nav-contacts p {
  font-size: 1rem;
  margin: 0;
  opacity: 0.8;
}
.contact-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.social-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.social-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  transition: color 0.3s ease;
}
.social-links a:hover {
  color: var(--accent-color);
}

@media (max-width: 768px) {
  .fullscreen-nav {
    flex-direction: column;
  }
  .fs-panel-left {
      width: 100%;
      height: 60%;
      padding: 20px;
      padding-top: 170px;
      justify-content: flex-start;
    }
  .fs-panel-right {
      width: 100%;
      height: 40%;
    padding: 20px;
  }
  .fs-link {
    font-size: 2rem;
  }
  .fs-nav-content { margin-top: 50px; }
    .fs-nav-contacts { margin-top: 0px; }
}
/* Audio Toggle */
#soundToggle {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 8px;
}

/* Dark Theme Logo Override */
[data-theme="dark"] .logo-section img {
  opacity: 1;
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.6));
}

.portfolio-item img, .servizio-img-wrapper img {
  transition: transform 0.3s ease;
}











