/* ============================================================
   TREDIWEB — landing page
   ============================================================ */
:root {
  --bg: #050507;
  --bg-2: #0b0b12;
  --surface: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f2f2f5;
  --muted: #9b9ba8;
  --accent: #00f0ff;
  --accent-2: #7c3aed;
  --grad: linear-gradient(100deg, #00f0ff 0%, #7c3aed 100%);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --radius: 20px;
  --header-h: 76px;
}

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

html { scroll-behavior: smooth; }

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

::selection { background: var(--accent); color: #000; }

img { max-width: 100%; display: block; }
a { color: inherit; }

h1, h2, h3, .btn { font-family: var(--font-display); }

em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.stroke {
  -webkit-text-stroke: 1.5px var(--text);
  color: transparent;
}

/* ------------ Loader ------------ */
.loader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
}
.loader__img {
  width: clamp(110px, 18vw, 150px); height: auto;
  animation: loaderPulse 1.8s ease-in-out infinite;
}
@keyframes loaderPulse { 0%,100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.05); opacity: 1; } }
.loader__bar { width: min(260px, 60vw); height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.loader__bar-fill { width: 0%; height: 100%; background: var(--grad); }

/* ------------ Cursor ------------ */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 150;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent);
  mix-blend-mode: difference;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width .25s, height .25s, opacity .25s;
  opacity: 0;
}
.cursor.is-active { width: 56px; height: 56px; }
@media (hover: none), (max-width: 768px) { .cursor { display: none; } }

/* ------------ Header ------------ */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 56px);
  transition: background .35s, backdrop-filter .35s, border-color .35s;
  border-bottom: 1px solid transparent;
}
.header.is-scrolled {
  background: rgba(5, 5, 7, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.header__logo {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.2rem; letter-spacing: 0.08em; text-decoration: none;
}
.header__logo span { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.header__nav { display: flex; gap: 32px; }
.header__nav a {
  text-decoration: none; font-size: 0.92rem; color: var(--muted);
  transition: color .25s;
}
.header__nav a:hover { color: var(--text); }
@media (max-width: 860px) { .header__nav { display: none; } }

/* ------------ Buttons ------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 32px;
  font-size: 1rem; font-weight: 600;
  border-radius: 100px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: transform .3s cubic-bezier(.22,1,.36,1), box-shadow .3s, background .3s, color .3s, border-color .3s;
  will-change: transform;
}
.btn--primary {
  background: var(--grad); color: #04040a;
  box-shadow: 0 8px 32px rgba(0, 240, 255, 0.22);
}
.btn--primary:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 14px 44px rgba(0, 240, 255, 0.35); }
.btn--ghost {
  background: transparent; color: var(--text); border-color: var(--line);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-3px); }
.btn--small { padding: 11px 24px; font-size: 0.9rem; }
.btn--big { padding: 20px 44px; font-size: 1.15rem; }
.btn--full { width: 100%; }
.btn__arrow { transition: transform .3s; display: inline-block; }
.btn:hover .btn__arrow { transform: translateX(5px); }

/* ------------ Hero ------------ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: calc(var(--header-h) + 40px) 20px 80px;
  overflow: hidden;
}
.hero__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block;
}
.hero__content { position: relative; z-index: 2; max-width: 980px; }
.hero__eyebrow {
  display: inline-block;
  font-size: 0.82rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 100px;
  padding: 8px 20px;
  margin-bottom: 28px;
  background: rgba(0, 240, 255, 0.05);
}
.hero__title {
  font-size: clamp(2.4rem, 7vw, 5.4rem);
  font-weight: 700; line-height: 1.06; letter-spacing: -0.02em;
  margin-bottom: 26px;
  /* nascosta finché prepareHero() non imposta le parole sotto maschera:
     evita che sia visibile dietro il loader e poi "scatti" via */
  opacity: 0;
}
.hero__title .word { display: inline-block; overflow: hidden; vertical-align: top; }
.hero__title .word > i { display: inline-block; font-style: normal; }
.hero__sub {
  font-size: clamp(1.02rem, 2vw, 1.25rem);
  color: var(--muted);
  max-width: 640px; margin: 0 auto 38px;
}
.hero__sub strong { color: var(--text); }
.hero__cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 22px; }
.hero__note { font-size: 0.85rem; color: var(--muted); letter-spacing: 0.02em; }
.hero__scroll {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  font-size: 0.72rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  z-index: 2;
}
.hero__scroll span {
  width: 1px; height: 44px;
  background: linear-gradient(to bottom, transparent, var(--accent));
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse { 0%,100% { opacity: .3; } 50% { opacity: 1; } }

/* ------------ Marquee ------------ */
.marquee {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 20px 0; overflow: hidden; white-space: nowrap;
  background: var(--bg-2);
}
.marquee__track { display: inline-flex; align-items: center; gap: 36px; will-change: transform; }
.marquee__track span {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 500;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em;
}
.marquee__track i { color: var(--accent); font-style: normal; }

/* ------------ Sections ------------ */
.section { padding: clamp(90px, 12vw, 160px) clamp(20px, 5vw, 64px); max-width: 1240px; margin: 0 auto; }
.section__head { max-width: 780px; margin-bottom: clamp(48px, 6vw, 80px); }
.section__eyebrow {
  font-size: 0.8rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 18px;
}
.section__title {
  font-size: clamp(1.9rem, 4.6vw, 3.4rem);
  font-weight: 700; line-height: 1.12; letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.section__sub { color: var(--muted); font-size: 1.08rem; max-width: 620px; }

/* ------------ Steps / Offer ------------ */
.steps {
  list-style: none;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px;
  counter-reset: step;
}
.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px 26px;
  transition: transform .4s cubic-bezier(.22,1,.36,1), border-color .4s, background .4s;
}
.step:hover { transform: translateY(-8px); border-color: rgba(0, 240, 255, 0.4); background: rgba(0, 240, 255, 0.04); }
.step__num {
  font-family: var(--font-display); font-size: 2.6rem; font-weight: 700;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}
.step h3 { font-size: 1.2rem; margin-bottom: 10px; }
.step p { color: var(--muted); font-size: 0.95rem; }
.step p strong { color: var(--text); }
.offer__cta { text-align: center; margin-top: clamp(48px, 6vw, 72px); }
@media (max-width: 1024px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

/* ------------ Why 3D ------------ */
.why__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.why__card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 40px 34px;
  transition: transform .4s cubic-bezier(.22,1,.36,1), border-color .4s;
}
.why__card:hover { transform: translateY(-6px); border-color: rgba(124, 58, 237, 0.5); }
.why__icon {
  width: 54px; height: 54px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad); color: #04040a;
  font-size: 1.4rem; margin-bottom: 22px;
}
.why__card h3 { font-size: 1.3rem; margin-bottom: 10px; }
.why__card p { color: var(--muted); }
@media (max-width: 760px) { .why__grid { grid-template-columns: 1fr; } }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
  margin-top: clamp(48px, 6vw, 80px);
  text-align: center;
}
.stat {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 38px 20px; background: var(--bg-2);
}
.stat__num {
  font-family: var(--font-display); font-size: clamp(2.6rem, 5vw, 4rem); font-weight: 700;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.stat__unit { font-family: var(--font-display); font-size: 1.4rem; color: var(--accent); margin-left: 4px; }
.stat p { color: var(--muted); margin-top: 8px; font-size: 0.92rem; }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr; } }

/* ------------ Portfolio ------------ */
.works { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; max-width: 940px; margin: 0 auto; }
.work {
  display: block; text-decoration: none; position: relative;
}
/* Il "biglietto" visivo vero e proprio: qui vivono bordo, sfondo e transform 3D.
   Tenuto separato da .work così l'ingresso ruotato (su .work) e il tilt al mouse
   (su .work__inner) non entrano mai in conflitto. */
.work__inner {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-2);
  transition: transform .5s cubic-bezier(.22,1,.36,1), border-color .45s, box-shadow .45s;
}
.work:hover .work__inner {
  border-color: rgba(0, 240, 255, 0.45);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
}
.work__media {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding: 16px;
  background: var(--bg-2);
}
.work__img {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s cubic-bezier(.22,1,.36,1);
}
.work:hover .work__img { transform: scale(1.06); }
/* velo scuro in alto per leggibilità del badge */
.work__media::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.45) 0%, transparent 32%, transparent 70%, rgba(0,0,0,.35) 100%);
}
.work__badge {
  position: relative; z-index: 2;
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 6px 14px; border-radius: 100px;
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line);
  color: var(--accent);
  backdrop-filter: blur(6px);
}
.work__info { padding: 22px 24px 26px; }
.work__info h3 { font-size: 1.15rem; margin-bottom: 6px; }
.work__info p { color: var(--muted); font-size: 0.9rem; margin-bottom: 14px; }
.work__link {
  font-size: 0.9rem; font-weight: 600; color: var(--accent);
  transition: letter-spacing .3s;
}
.work:hover .work__link { letter-spacing: 0.04em; }

/* ---- Effetto 3D "wow" — SOLO desktop con puntatore ----
   .works dà la prospettiva per l'ingresso ruotato (rotateX in scroll, gestito da JS);
   .work dà una prospettiva propria per il tilt del wrapper interno al passaggio del mouse. */
@media (min-width: 769px) and (hover: hover) {
  .works { perspective: 1600px; perspective-origin: 50% 42%; }
  .work { perspective: 1000px; }
  .work__inner { transform-style: preserve-3d; will-change: transform; }
  .work.is-3d-ready .work__inner { transform: rotateX(0) rotateY(0); }
}
@media (max-width: 620px) { .works { grid-template-columns: 1fr; } }

/* ------------ Local SEO ------------ */
.local { max-width: 100%; background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.local__inner { max-width: 860px; margin: 0 auto; }
.local__inner p { color: var(--muted); margin-bottom: 20px; font-size: 1.05rem; }
.local__inner p strong { color: var(--text); }
.local__inner .btn { margin-top: 12px; }

/* ------------ FAQ ------------ */
.faq__list { max-width: 820px; }
.faq__item {
  border: 1px solid var(--line); border-radius: 16px;
  margin-bottom: 14px; background: var(--surface);
  overflow: hidden;
  transition: border-color .3s;
}
.faq__item[open] { border-color: rgba(0, 240, 255, 0.4); }
.faq__item summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 22px 26px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__icon {
  flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-weight: 400; color: var(--accent);
  transition: transform .3s;
}
.faq__item[open] .faq__icon { transform: rotate(45deg); }
.faq__item p { padding: 0 26px 24px; color: var(--muted); }

/* ------------ Final CTA ------------ */
.final { text-align: center; }
.final__title {
  font-size: clamp(2.4rem, 7vw, 5rem);
  font-weight: 700; line-height: 1.05; letter-spacing: -0.02em;
  margin-bottom: 22px;
}
.final__sub { color: var(--muted); font-size: 1.1rem; margin-bottom: 36px; }
.final .btn { margin-bottom: 22px; }

/* ------------ Footer ------------ */
.footer {
  border-top: 1px solid var(--line);
  padding: 60px clamp(20px, 5vw, 64px) 110px;
  background: var(--bg-2);
}
.footer__top {
  max-width: 1240px; margin: 0 auto 44px;
  display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap;
}
.footer__logo { width: 160px; height: auto; margin: -18px 0 0 -14px; }
.footer__brand p { color: var(--muted); font-size: 0.92rem; margin-top: 6px; }
.footer__nav { display: flex; flex-direction: column; gap: 12px; }
.footer__nav a { color: var(--muted); text-decoration: none; font-size: 0.92rem; transition: color .25s; }
.footer__nav a:hover { color: var(--accent); }
.footer__social { display: inline-flex; align-items: center; gap: 8px; }
.footer__social svg { flex-shrink: 0; }
.footer__legal { max-width: 1240px; margin: 0 auto; border-top: 1px solid var(--line); padding-top: 26px; }
.footer__legal p { color: #6b6b78; font-size: 0.8rem; line-height: 1.8; }

/* ------------ Mobile sticky CTA ------------ */
.mobile-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(5,5,7,0.95), rgba(5,5,7,0.7) 70%, transparent);
  transform: translateY(110%);
  transition: transform .4s cubic-bezier(.22,1,.36,1);
  display: none;
}
.mobile-cta.is-visible { transform: translateY(0); }
@media (max-width: 768px) { .mobile-cta { display: block; } }

/* ------------ Modal ------------ */
.modal { position: fixed; inset: 0; z-index: 180; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(3, 3, 6, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal__box {
  position: relative; z-index: 1;
  width: min(520px, 100%);
  max-height: calc(100svh - 36px);
  overflow-y: auto;
  background: #0c0c14;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: clamp(28px, 5vw, 44px);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7);
}
.modal__close {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); font-size: 0.95rem; cursor: pointer;
  transition: background .25s, transform .25s;
}
.modal__close:hover { background: rgba(255,255,255,0.1); transform: rotate(90deg); }
.modal__box h2 { font-size: 1.6rem; margin-bottom: 8px; letter-spacing: -0.01em; }
.modal__sub { color: var(--muted); font-size: 0.95rem; margin-bottom: 26px; }
.modal__note { text-align: center; font-size: 0.8rem; color: var(--muted); margin-top: 16px; }

.field { margin-bottom: 18px; position: relative; }
.field label { display: block; font-size: 0.86rem; font-weight: 600; margin-bottom: 8px; }
.field label em { color: var(--muted); font-weight: 400; -webkit-text-fill-color: currentColor; background: none; }
.field input[type="text"], .field input[type="email"], .field input[type="tel"], .field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-family: var(--font-body); font-size: 1rem;
  transition: border-color .25s, box-shadow .25s;
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.12);
}
.field__error { display: none; color: #ff5470; font-size: 0.8rem; margin-top: 6px; }
.field.is-invalid input, .field.is-invalid textarea { border-color: #ff5470; }
.field.is-invalid .field__error { display: block; }

.field--check { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.field--check input { margin-top: 4px; accent-color: var(--accent); width: 17px; height: 17px; }
.field--check label { font-weight: 400; font-size: 0.82rem; color: var(--muted); margin: 0; }
.field--check label a { color: var(--accent); }
.field--check .field__error { grid-column: 1 / -1; }

.modal__success { text-align: center; padding: 20px 0; }
.modal__success-icon {
  width: 72px; height: 72px; margin: 0 auto 22px;
  border-radius: 50%; background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #04040a; font-weight: 700;
}
.modal__success h2 { margin-bottom: 10px; }
.modal__success p { color: var(--muted); margin-bottom: 26px; }

/* ------------ Cookie bar ------------ */
.cookiebar {
  position: fixed; z-index: 170;
  left: 16px; right: 16px; bottom: 16px;
  max-width: 620px; margin: 0 auto;
  background: #0c0c14;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 22px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.cookiebar[hidden] { display: none; }
.cookiebar p { font-size: 0.84rem; color: var(--muted); flex: 1 1 300px; }
.cookiebar a { color: var(--accent); }

/* ------------ Legal pages ------------ */
.legal-page { max-width: 820px; margin: 0 auto; padding: calc(var(--header-h) + 60px) 20px 100px; }
.legal-page h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); margin-bottom: 12px; letter-spacing: -0.02em; }
.legal-page .legal-updated { color: var(--muted); font-size: 0.88rem; margin-bottom: 40px; }
.legal-page h2 { font-size: 1.35rem; margin: 40px 0 14px; }
.legal-page h3 { font-size: 1.1rem; margin: 26px 0 10px; }
.legal-page p, .legal-page li { color: var(--muted); margin-bottom: 12px; }
.legal-page ul { padding-left: 22px; margin-bottom: 16px; }
.legal-page strong { color: var(--text); }
.legal-page a { color: var(--accent); }
.legal-page table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 0.9rem; }
.legal-page th, .legal-page td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; color: var(--muted); }
.legal-page th { color: var(--text); background: var(--surface); }

/* ------------ Reveal helpers (GSAP) ------------ */
.reveal-line { opacity: 0; }
body.no-js .reveal-line,
body.no-js .hero__title,
body.no-js [data-step],
body.no-js [data-card],
body.no-js [data-work] { opacity: 1 !important; transform: none !important; }

/* ------------ Reduced motion ------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
  .reveal-line, .hero__title { opacity: 1; }
}
