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

:root {
  --bg: #1a1a1a;
  --surface: #222222;
  --border: #303030;
  --accent: #e8651a;
  --text: #f2f2f2;
  --muted: #737373;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* NAV */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 4rem;
  background: rgba(17, 17, 17, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
}

.logo span { color: var(--accent); }

nav ul {
  list-style: none;
  display: flex;
  gap: 2.5rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

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

/* HERO */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8rem 4rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.hero-tag::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 1.5rem;
}

h1 em {
  font-style: normal;
  color: var(--muted);
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 520px;
  margin-bottom: 3rem;
  line-height: 1.7;
}

.cta-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.85rem 2rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover { background: #d45a14; }

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

.btn-outline:hover { border-color: #444; background: var(--surface); }

/* PAGE HERO (for non-index pages) */
.page-hero {
  padding: 7rem 4rem 3rem;
  max-width: 1100px;
  margin: 0 auto;
}

.page-hero h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin-bottom: 1rem;
}

.page-hero p {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 560px;
  line-height: 1.7;
}

/* SECTION BASE */
section {
  padding: 6rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3rem;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

/* SCREEN READER ONLY */
.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;
}

/* DIVIDER */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 4rem;
}

/* SERVICES */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5px;
  background: var(--border);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 3rem;
}

.service-card {
  background: var(--surface);
  padding: 2.5rem;
  transition: background 0.2s;
}

.service-card:hover { background: #161616; }

.service-icon {
  width: 44px; height: 44px;
  background: var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  color: var(--accent);
}

.service-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.service-card p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ABOUT / PRESENTAZIONE */
.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
  margin-top: 3rem;
}

.about-text p {
  color: var(--muted);
  line-height: 1.8;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.about-placeholder {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.8;
  background: var(--surface);
}

.about-placeholder .placeholder-label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.formazione-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.formazione-list li {
  padding-left: 1.2rem;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.formazione-list li strong {
  font-size: 0.95rem;
  font-weight: 600;
}

.formazione-list li span {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}


.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
}

.tag {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--muted);
  transition: all 0.2s;
}

.tag:hover { border-color: var(--accent); color: var(--accent); }

.about-stats {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.stat {
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.stat-number {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--accent);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* PORTFOLIO CAROUSEL */
.carousel-wrapper {
  position: relative;
  margin-top: 3rem;
}

.carousel-track {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.carousel-track::-webkit-scrollbar { display: none; }

.project-card {
  width: 48%;
  min-width: 48%;
  flex-shrink: 0;
  scroll-snap-align: start;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
}

.project-card:hover { border-color: var(--accent); }

.project-img {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  overflow: hidden;
}

.project-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.project-info { padding: 1.5rem; }

.project-info h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}

.project-info p {
  font-size: 0.85rem;
  color: var(--muted);
}

.project-tags {
  display: flex;
  gap: 0.4rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.project-tag {
  padding: 0.25rem 0.65rem;
  background: var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.carousel-dots { display: flex; gap: 0.5rem; }

.carousel-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  padding: 0;
}

.carousel-dot.active {
  background: var(--accent);
  transform: scale(1.4);
}

.carousel-arrows { display: flex; gap: 0.5rem; }

.carousel-btn {
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}

.carousel-btn:hover { border-color: var(--accent); background: #1e1e1e; }
.carousel-btn:disabled { opacity: 0.3; cursor: default; }

/* PHOTO CARD (carosello stampa 3D) */
.photo-card {
  width: 48%;
  min-width: 48%;
  flex-shrink: 0;
  scroll-snap-align: start;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.2s;
}

.photo-img {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.photo-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder-label {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photo-caption {
  padding: 0.9rem 1.2rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  backdrop-filter: blur(6px);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s;
}

.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-gallery {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  overflow: hidden;
}

.modal-gallery-track {
  display: flex;
  height: 100%;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-gallery-slide {
  min-width: 100%;
  height: 100%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
  overflow: hidden;
}

.modal-gallery-slide img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

.modal-gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 2;
}

.modal-gallery-btn:hover { background: rgba(0,0,0,0.85); }
.modal-gallery-btn.prev { left: 1rem; }
.modal-gallery-btn.next { right: 1rem; }

.modal-gallery-counter {
  position: absolute;
  bottom: 0.75rem;
  right: 1rem;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.5);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}

.modal-body { padding: 2rem; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.modal-close:hover { border-color: #555; color: var(--text); }

.modal-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

/* CONTACT */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
  margin-top: 3rem;
}

.contact-left p {
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 2rem;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  transition: all 0.2s;
  background: var(--surface);
}

.contact-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.contact-link span { color: var(--muted); font-size: 1rem; }

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

input, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color 0.2s;
  width: 100%;
  outline: none;
}

input:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 120px; }

/* STAMPA 3D */
.print3d-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
  margin-top: 3rem;
}

.print3d-intro p {
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.gadget-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.gadget-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.gadget-item::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.bundle-card {
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 2.5rem;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

.bundle-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}

.bundle-badge {
  display: inline-block;
  background: var(--accent);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  margin-bottom: 1.25rem;
}

.bundle-card h3 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.bundle-card p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.bundle-includes {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.bundle-includes span {
  font-size: 0.85rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.bundle-includes span::before {
  content: '✓';
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
}

/* FOOTER */
footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}

footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); }

/* SCROLL FADE */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* HAMBURGER */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 101;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* PRIVACY CHECKBOX */
.privacy-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}
.privacy-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  accent-color: var(--accent);
  margin-top: 2px;
  cursor: pointer;
}
.privacy-check a { color: var(--accent); text-decoration: underline; }

/* COOKIE BANNER */
#cookie-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.5rem;
  max-width: 560px;
  width: calc(100% - 2rem);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  font-size: 0.83rem;
  color: var(--muted);
}
#cookie-banner p { flex: 1; line-height: 1.5; }
#cookie-banner a { color: var(--accent); text-decoration: underline; }
#cookie-banner .cookie-btns { display: flex; gap: 0.6rem; flex-shrink: 0; }
#cookie-banner button {
  padding: 0.45rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font);
}
#cookie-accept { background: var(--accent); color: #fff; border-color: var(--accent); }
#cookie-decline { background: transparent; color: var(--muted); }
#cookie-banner.hidden { display: none; }

/* RESPONSIVE */
@media (max-width: 768px) {
  nav { padding: 1.25rem 1.5rem; }
  .nav-toggle { display: flex; }

  nav ul {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(17, 17, 17, 0.97);
    backdrop-filter: blur(12px);
    padding: 5rem 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    z-index: 100;
  }

  nav ul.open { display: flex; }

  nav ul li a {
    display: block;
    padding: 1rem 0;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
  }

  nav ul li:last-child a { border-bottom: none; }

  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .hero, section { padding-left: 1.5rem; padding-right: 1.5rem; }
  .page-hero { padding-left: 1.5rem; padding-right: 1.5rem; }
  .divider { margin: 0 1.5rem; }
  .about-layout, .contact-wrapper { grid-template-columns: 1fr; gap: 2.5rem; }
  .print3d-layout { grid-template-columns: 1fr; gap: 2.5rem; }
  .project-card { width: 82%; min-width: 82%; }
  .modal-overlay { padding: 1rem; }
  footer { flex-direction: column; gap: 0.75rem; text-align: center; padding: 2rem 1.5rem; }
}
