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

:root {
  --ink:    #0f0f0f;
  --paper:  #f7f5f0;
  --muted:  #8a8680;
  --accent: #5c5470;
  --mid:    #e8e4dd;
  --code-bg:#1a1a1a;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* NAV */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 4rem;
  background: rgba(247,245,240,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--mid);
}
.nav-logo {
  font-family: 'DM Mono', monospace; font-size: .85rem;
  letter-spacing: .08em; color: var(--ink); text-decoration: none;
}
.nav-links { display: flex; gap: 2.5rem; list-style: none; }
.nav-links a {
  font-size: .85rem; font-weight: 500; letter-spacing: .04em;
  text-decoration: none; color: var(--muted); transition: color .2s;
}
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  font-family: 'DM Mono', monospace; font-size: .8rem; font-weight: 500;
  padding: .55rem 1.4rem; background: var(--ink); color: var(--paper);
  border: none; cursor: pointer; text-decoration: none; letter-spacing: .04em;
  transition: background .2s;
}
.nav-cta:hover { background: var(--accent); }

/* HERO */
#hero {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
  padding-top: 80px;
}
.hero-left {
  display: flex; flex-direction: column; justify-content: center;
  padding: 6rem 4rem; border-right: 1px solid var(--mid);
}
.hero-eyebrow {
  font-family: 'DM Mono', monospace; font-size: .75rem;
  letter-spacing: .12em; color: var(--accent);
  text-transform: uppercase; margin-bottom: 1.5rem;
}
.hero-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.6rem, 4.5vw, 4.2rem);
  line-height: 1.06; letter-spacing: -.02em; margin-bottom: 1.5rem;
}
.hero-title em { font-style: italic; color: var(--accent); }
.hero-desc {
  font-size: 1.05rem; color: var(--muted); line-height: 1.8;
  max-width: 40ch; margin-bottom: 2.5rem;
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn-primary {
  font-family: 'DM Mono', monospace; font-size: .82rem; font-weight: 500;
  letter-spacing: .05em; padding: .75rem 2rem;
  background: var(--ink); color: var(--paper);
  border: none; cursor: pointer; text-decoration: none; transition: background .2s;
}
.btn-primary:hover { background: var(--accent); }
.btn-ghost {
  font-family: 'DM Mono', monospace; font-size: .82rem; font-weight: 500;
  letter-spacing: .05em; padding: .75rem 2rem;
  background: transparent; color: var(--ink);
  border: 1px solid var(--mid); cursor: pointer; text-decoration: none;
  transition: border-color .2s;
}
.btn-ghost:hover { border-color: var(--ink); }

.hero-right {
  display: flex; flex-direction: column; justify-content: center;
  padding: 3rem 4rem; background: var(--code-bg);
  position: relative; overflow: hidden;
}
.hero-right::before {
  content: ''; position: absolute; top: -40%; right: -20%;
  width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle, rgba(92,84,112,.15) 0%, transparent 70%);
  pointer-events: none;
}
.code-block {
  font-family: 'DM Mono', monospace; font-size: .82rem;
  line-height: 2; color: #ccc;
  white-space: pre; overflow-x: auto;
  margin: 0;
}
.ck { color: #bb86fc; }
.cv { color: #82aaff; }
.cs { color: #a8d8a8; }
.cf { color: #ffcb6b; }
.cc { color: #3d3d3d; }

/* SECTION BASE */
section { padding: 4rem 4rem; }
.section-header {
  display: flex; align-items: baseline; gap: 1.5rem; margin-bottom: 4rem;
}
.section-eyebrow {
  font-family: 'DM Mono', monospace; font-size: .72rem; color: var(--accent);
  letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
}
.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2rem, 3.5vw, 3rem); line-height: 1.1; letter-spacing: -.02em;
}
.section-line { flex: 1; height: 1px; background: var(--mid); align-self: center; }

/* SERVIZI */
#servizi { border-top: 1px solid var(--mid); }
.services-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0; border: 1px solid var(--mid);
}
.service-card {
  padding: 2.5rem; border-right: 1px solid var(--mid);
  border-bottom: 1px solid var(--mid); transition: background .25s; cursor: default;
}
.service-card:nth-child(3n) { border-right: none; }
.service-card:nth-last-child(-n+3) { border-bottom: none; }
.service-card:hover { background: var(--ink); }
.service-card:hover .service-icon,
.service-card:hover .service-title,
.service-card:hover .service-desc { color: var(--paper); }
.service-card:hover .service-result { color: var(--accent); border-color: #333; }
.service-icon { font-size: 1.6rem; margin-bottom: 1rem; transition: color .25s; }
.service-title {
  font-family: 'DM Serif Display', serif; font-size: 1.2rem;
  margin-bottom: .6rem; transition: color .25s;
}
.service-desc {
  font-size: .88rem; color: var(--muted); line-height: 1.65;
  transition: color .25s; margin-bottom: 1rem;
}
.service-result {
  font-family: 'DM Mono', monospace; font-size: .72rem;
  color: var(--accent); letter-spacing: .06em;
  padding: .35rem .75rem; border: 1px solid var(--mid);
  display: inline-block; transition: color .25s, border-color .25s;
}

/* PROCESSO */
#processo { background: var(--ink); color: var(--paper); }
#processo .section-title { color: var(--paper); }
#processo .section-line { background: #2a2a2a; }
.process-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border: 1px solid #1f1f1f;
}
.process-step {
  padding: 2.5rem 2rem; border-right: 1px solid #1f1f1f;
  position: relative;
}
.process-step:last-child { border-right: none; }
.step-num {
  font-family: 'DM Serif Display', serif; font-size: 3.5rem;
  color: #1f1f1f; line-height: 1; margin-bottom: 1.2rem;
}
.step-title {
  font-family: 'DM Mono', monospace; font-size: .82rem;
  color: #fff; letter-spacing: .06em; margin-bottom: .75rem;
}
.step-desc { font-size: .88rem; color: #666; line-height: 1.65; }
.step-arrow {
  position: absolute; top: 2.5rem; right: -0.75rem;
  color: var(--accent); font-size: 1.2rem; z-index: 1;
}
.process-step:last-child .step-arrow { display: none; }

/* RISULTATI / BENEFITS */
#risultati { border-top: 1px solid var(--mid); }
.benefits-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--mid); border: 1px solid var(--mid); }
.benefit-card {
  background: var(--paper); padding: 3rem 2.5rem;
  display: flex; gap: 1.5rem; align-items: flex-start;
  transition: background .25s;
}
.benefit-card:hover { background: #f0ece4; }
.benefit-num {
  font-family: 'DM Serif Display', serif; font-size: 3rem;
  color: var(--mid); line-height: 1; flex-shrink: 0;
  transition: color .25s;
}
.benefit-card:hover .benefit-num { color: var(--accent); }
.benefit-title {
  font-family: 'DM Serif Display', serif; font-size: 1.3rem;
  margin-bottom: .5rem; line-height: 1.2;
}
.benefit-desc { font-size: .9rem; color: var(--muted); line-height: 1.7; }

/* CONTATTI */
@keyframes grid-scroll {
  0%   { background-position: 0 0; }
  100% { background-position: 40px 40px; }
}
#contatti {
  background: var(--accent); color: var(--paper);
  text-align: center; padding: 7rem 4rem;
  position: relative; overflow: hidden;
}
#contact-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
#contatti .bg-grid {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: grid-scroll 3s linear infinite;
}
#contatti > *:not(canvas):not(.bg-grid) { position: relative; z-index: 1; }
#contatti .section-title { color: var(--paper); font-size: clamp(2.5rem, 5vw, 4rem); }
.contact-sub {
  font-size: 1.05rem; color: rgba(255,255,255,.75);
  margin: 1.5rem auto 3rem; max-width: 44ch; line-height: 1.75;
}
.contact-form {
  display: flex; flex-direction: column; gap: 1rem;
  max-width: 480px; margin: 0 auto; text-align: left;
}
.contact-form input,
.contact-form textarea {
  font-family: 'Inter', sans-serif; font-size: .95rem;
  background: rgba(0,0,0,.35); color: var(--paper);
  border: 1px solid rgba(255,255,255,.2); border-radius: 10px;
  padding: 1rem 1.25rem;
  outline: none; resize: none; width: 100%;
  transition: border-color .25s, background .25s, box-shadow .25s;
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: rgba(255,255,255,.38); }
.contact-form input:focus,
.contact-form textarea:focus {
  border-color: rgba(255,255,255,.7);
  background: rgba(0,0,0,.45);
  box-shadow: 0 0 0 3px rgba(255,255,255,.08);
}
.btn-white {
  font-family: 'DM Mono', monospace; font-size: .82rem; font-weight: 500;
  letter-spacing: .05em; padding: .9rem 2.2rem;
  background: var(--paper); color: var(--accent);
  border: none; cursor: pointer; text-decoration: none; transition: background .2s, color .2s;
  align-self: flex-start;
}
.btn-white:hover { background: var(--ink); color: var(--paper); }
.contact-form-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn-outline-white {
  font-family: 'DM Mono', monospace; font-size: .82rem; font-weight: 500;
  letter-spacing: .05em; padding: .9rem 2.2rem;
  background: transparent; color: var(--paper);
  border: 1px solid rgba(255,255,255,.5); cursor: pointer;
  transition: border-color .2s, background .2s;
  flex: 1; text-align: center;
}
.btn-outline-white:hover { border-color: var(--paper); background: rgba(255,255,255,.08); }

/* FOOTER */
footer {
  padding: 2rem 4rem;
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--mid);
}
.footer-copy {
  font-family: 'DM Mono', monospace; font-size: .72rem;
  color: var(--muted); letter-spacing: .06em;
}
.footer-links { display: flex; gap: 2rem; }
.footer-links a {
  font-family: 'DM Mono', monospace; font-size: .72rem;
  color: var(--muted); letter-spacing: .06em; text-decoration: none; transition: color .2s;
}
.footer-links a:hover { color: var(--ink); }

/* SCROLL REVEAL */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .65s, transform .65s; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* COOKIE BANNER */
#cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--ink); color: var(--paper);
  border-top: 1px solid #1f1f1f;
  padding: 1.25rem 4rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
  transform: translateY(0); transition: transform .4s ease;
}
#cookie-banner.hidden { transform: translateY(110%); }
.cookie-text {
  font-size: .82rem; color: #aaa; line-height: 1.6; flex: 1; min-width: 200px;
}
.cookie-text a { color: var(--paper); text-decoration: underline; text-underline-offset: 3px; }
.cookie-text a:hover { color: var(--accent); }
.cookie-actions { display: flex; gap: .75rem; flex-shrink: 0; flex-wrap: wrap; }
.cookie-btn {
  font-family: 'DM Mono', monospace; font-size: .75rem; font-weight: 500;
  letter-spacing: .05em; padding: .55rem 1.3rem;
  border: none; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s;
}
.cookie-btn-accept {
  background: var(--paper); color: var(--ink);
}
.cookie-btn-accept:hover { background: var(--accent); color: var(--paper); }
.cookie-btn-reject {
  background: transparent; color: #666;
  border: 1px solid #2a2a2a;
}
.cookie-btn-reject:hover { border-color: #444; color: #aaa; }

/* MOBILE */
@media (max-width: 768px) {
  nav { padding: 1rem 1.5rem; }
  .nav-links { display: none; }
  #hero { grid-template-columns: 1fr; }
  .hero-left { padding: 5rem 1.5rem 3rem; border-right: none; border-bottom: 1px solid var(--mid); }
  .hero-right { padding: 3rem 1.5rem; }
  .code-block { font-size: .72rem; line-height: 1.85; }
  section { padding: 4rem 1.5rem; }
  .services-grid { grid-template-columns: 1fr; }
  .service-card { border-right: none !important; }
  .service-card:nth-last-child(-n+3) { border-bottom: 1px solid var(--mid) !important; }
  .service-card:last-child { border-bottom: none !important; }
  .process-grid { grid-template-columns: 1fr 1fr; }
  .process-step { border-bottom: 1px solid #1f1f1f; }
  .step-arrow { display: none; }
  .benefits-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; gap: 1rem; text-align: center; padding: 2rem 1.5rem; }
  .contact-form-actions { flex-direction: column; }
  .contact-form-actions .btn-white,
  .contact-form-actions .btn-outline-white { flex: none; width: 100%; text-align: center; align-self: auto; }
  #cookie-banner { padding: 1.25rem 1.5rem; flex-direction: column; align-items: flex-start; gap: 1rem; }
  .cookie-actions { width: 100%; }
  .cookie-btn { flex: 1; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}
