/* Lumanex — Engage layer
 * Widget "Parla con Luca" (launcher + popup) e micro-interazioni della home.
 * Usa i token di lumanex.css. Angolo in basso a SINISTRA: a destra c'è il pulsante cookie.
 */

/* Contatti rivelati da JS (anti-spam): `hidden` deve vincere anche su .lx-btn / .lx-flex */
[data-lx-reveal][hidden], [data-lx-locked][hidden] { display: none !important; }

/* ---------- Widget ---------- */
.lx-eng {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 90; /* sotto header (100) e banner cookie (99999) */
  font-family: var(--lx-font-sans);
  max-width: calc(100vw - 32px);
}
.lx-eng[hidden] { display: none; }

/* Launcher */
.lx-eng__launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 8px 8px;
  background: var(--lx-primary-800);
  color: var(--lx-text-invert);
  border: 1px solid rgba(0, 194, 255, .35);
  border-radius: var(--lx-radius-full);
  box-shadow: 0 12px 30px rgba(11, 37, 69, .35);
  font: 600 var(--lx-text-sm)/1.2 var(--lx-font-sans);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .35s var(--lx-ease), transform .35s var(--lx-ease), background .2s var(--lx-ease);
}
.lx-eng.is-ready .lx-eng__launcher { opacity: 1; transform: none; pointer-events: auto; }
.lx-eng.is-open .lx-eng__launcher { display: none; }
.lx-eng__launcher:hover { background: var(--lx-primary-700); }
.lx-eng__launcher:focus-visible,
.lx-eng__close:focus-visible,
.lx-eng__card .lx-btn:focus-visible { outline: none; box-shadow: var(--lx-focus-ring); }

.lx-eng__avatar {
  position: relative;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--lx-accent-400), var(--lx-accent-600));
  color: var(--lx-primary-900);
  font: 700 1rem/1 var(--lx-font-serif);
}
.lx-eng__avatar::after { /* pallino stato */
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--lx-text-dim);
  border: 2px solid var(--lx-primary-800);
}
.lx-eng.is-online .lx-eng__avatar::after { background: var(--lx-success); }
.lx-eng.is-online .lx-eng__launcher::before { /* anello pulsante, solo in orario */
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  border-radius: 50%;
  border: 2px solid var(--lx-accent-400);
  opacity: 0;
  animation: lx-eng-ring 2.8s ease-out 1s 3;
  pointer-events: none;
}
.lx-eng__launcher { position: relative; }
@keyframes lx-eng-ring {
  0%   { transform: scale(1);   opacity: .7; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* Card */
.lx-eng__card {
  position: relative;
  width: 360px;
  max-width: 100%;
  background: var(--lx-surface);
  color: var(--lx-text);
  border: 1px solid var(--lx-border);
  border-top: 3px solid var(--lx-accent-400);
  border-radius: var(--lx-radius-lg);
  box-shadow: var(--lx-shadow-lg), 0 2px 8px rgba(11, 37, 69, .08);
  padding: 22px 22px 18px;
  display: none;
}
.lx-eng.is-open .lx-eng__card { display: block; animation: lx-eng-in .45s var(--lx-ease) both; }
@keyframes lx-eng-in {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.lx-eng__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--lx-text-muted);
  cursor: pointer;
  transition: background .2s var(--lx-ease), color .2s var(--lx-ease);
}
.lx-eng__close:hover { background: var(--lx-surface-2); color: var(--lx-text); }

.lx-eng__head { display: flex; align-items: center; gap: 12px; padding-right: 28px; }
.lx-eng__head .lx-eng__avatar { width: 46px; height: 46px; font-size: 1.25rem; }
.lx-eng__head .lx-eng__avatar::after { width: 13px; height: 13px; border-color: var(--lx-surface); }
.lx-eng__who { font-weight: 700; font-size: var(--lx-text-base); color: var(--lx-primary-800); line-height: 1.2; }
.lx-eng__status { font-size: var(--lx-text-xs); color: var(--lx-text-muted); margin-top: 3px; }
.lx-eng.is-online .lx-eng__status { color: #047857; }

.lx-eng__title {
  margin: 16px 0 6px;
  font: 400 1.3125rem/1.25 var(--lx-font-serif);
  color: var(--lx-primary-800);
  letter-spacing: -.01em;
}
.lx-eng__text { margin: 0 0 16px; font-size: var(--lx-text-sm); line-height: 1.6; color: var(--lx-text-muted); }
.lx-eng__actions { display: grid; gap: 8px; }
.lx-eng__actions .lx-btn { width: 100%; justify-content: center; }
.lx-eng__row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.lx-eng__row .lx-btn { white-space: nowrap; }
.lx-eng__num { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.lx-eng__hours { margin: 12px 0 0; font-size: var(--lx-text-xs); color: var(--lx-text-dim); text-align: center; }

@media (max-width: 480px) {
  .lx-eng { left: 12px; bottom: 12px; right: 12px; max-width: none; }
  .lx-eng__card { width: 100%; padding: 20px 18px 16px; }
  /* Sul telefono il launcher resta compatto per non coprire i contenuti */
  .lx-eng__launcher { padding-right: 14px; }
  .lx-eng__launcher .lx-eng__label-long { display: none; }
}

/* Pulsante WhatsApp (verde del marchio, testo scuro per il contrasto) */
.lx-btn--wa {
  background: #25D366;
  color: #06361A;
  border-color: transparent;
}
.lx-btn--wa:hover:not(:disabled) { background: #3BE07A; color: #06361A; transform: translateY(-1px); }
.lx-btn--wa:focus-visible { outline: none; box-shadow: var(--lx-focus-ring); }
.lx-btn--wa i { font-size: 1.15em; }

/* ---------- Home: riga "umana" nell'hero ---------- */
.lx-human {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: var(--lx-space-8);
  padding: 10px 20px 10px 10px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--lx-radius-full);
  background: rgba(255, 255, 255, .05);
  color: rgba(248, 250, 252, .86);
  font-size: var(--lx-text-sm);
  line-height: 1.45;
  text-decoration: none;
  transition: background .2s var(--lx-ease), border-color .2s var(--lx-ease);
}
.lx-human:hover { background: rgba(255, 255, 255, .1); border-color: rgba(0, 194, 255, .5); color: #fff; }
.lx-human .lx-eng__avatar::after { display: none; }
.lx-human strong { color: #fff; font-weight: 600; }
.lx-human__num { color: var(--lx-accent-200); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Home: fibra che "pulsa" nello sfondo dell'hero ---------- */
.lx-hero > .lx-hero__fiber {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 45%, #000 100%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 45%, #000 100%);
}
.lx-hero__fiber i {
  position: absolute;
  left: -30%;
  width: 30%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 194, 255, .85), transparent);
  filter: drop-shadow(0 0 6px rgba(0, 194, 255, .8));
  animation: lx-fiber 7s linear infinite;
}
.lx-hero__fiber i:nth-child(1) { top: 18%; animation-delay: 0s;   animation-duration: 6s; }
.lx-hero__fiber i:nth-child(2) { top: 34%; animation-delay: 2.1s; animation-duration: 8s;  opacity: .6; }
.lx-hero__fiber i:nth-child(3) { top: 58%; animation-delay: 1s;   animation-duration: 7s;  opacity: .8; }
.lx-hero__fiber i:nth-child(4) { top: 76%; animation-delay: 3.4s; animation-duration: 9s;  opacity: .5; }
.lx-hero__fiber i:nth-child(5) { top: 88%; animation-delay: 4.6s; animation-duration: 6.5s; opacity: .7; }
@keyframes lx-fiber {
  from { transform: translateX(0); }
  to   { transform: translateX(480%); }
}

/* ---------- Home: "Come ti seguiamo" ---------- */
.lx-steps {
  list-style: none;
  counter-reset: lx-step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--lx-space-6);
  position: relative;
}
@media (min-width: 900px) {
  .lx-steps { grid-template-columns: repeat(3, 1fr); gap: var(--lx-space-8); }
  .lx-steps::before { /* filo che collega i passaggi */
    content: "";
    position: absolute;
    top: 22px;
    left: 8%;
    right: 8%;
    height: 1px;
    background: linear-gradient(90deg, var(--lx-accent-400), var(--lx-border-strong) 50%, var(--lx-accent-400));
    opacity: .6;
  }
}
.lx-step { position: relative; text-align: center; padding: 0 var(--lx-space-2); }
.lx-step::before {
  counter-increment: lx-step;
  content: counter(lx-step);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto var(--lx-space-4);
  border-radius: 50%;
  background: var(--lx-surface);
  border: 1px solid var(--lx-accent-400);
  color: var(--lx-primary-800);
  font: 400 1.25rem/1 var(--lx-font-serif);
  position: relative;
  box-shadow: 0 0 0 6px var(--lx-bg);
}
.lx-section--alt .lx-step::before { box-shadow: 0 0 0 6px var(--lx-surface-2); }
.lx-step__title { font-size: var(--lx-text-lg); font-weight: 600; color: var(--lx-primary-800); margin: 0 0 var(--lx-space-2); }
.lx-step__body { margin: 0 auto; max-width: 22rem; font-size: var(--lx-text-sm); line-height: 1.65; color: var(--lx-text-muted); }

/* ---------- Home: micro-copy e tocchi di cura ---------- */
.lx-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: var(--lx-space-4) 0 0;
  font-size: var(--lx-text-sm);
  line-height: 1.6;
  color: var(--lx-text-muted);
}
.lx-note i {
  flex: none;
  width: 18px;
  text-align: center;
  color: var(--lx-accent-500);
  line-height: 1.6; /* stessa altezza della prima riga di testo: icona sempre allineata */
}
/* Nota a piè di card: separata dal contenuto con un filetto */
.lx-note--foot {
  margin-top: var(--lx-space-6);
  padding-top: var(--lx-space-5);
  border-top: 1px solid var(--lx-border);
}
.lx-live-hint {
  min-height: 1.5em;
  margin: var(--lx-space-3) 0 0;
  font-size: var(--lx-text-sm);
  color: #047857;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .3s var(--lx-ease), transform .3s var(--lx-ease);
}
.lx-live-hint.is-on { opacity: 1; transform: none; }

/* Card: leggero sollevamento (il design system lo prevede già solo per reduced-motion) */
.lx-card { transition: box-shadow var(--lx-duration) var(--lx-ease), border-color var(--lx-duration) var(--lx-ease), transform var(--lx-duration) var(--lx-ease); }
.lx-card:hover { transform: translateY(-3px); }

/* Box contatti: icone tutte uguali (non si restringono col testo) e ritmo verticale regolare */
.lx-contact-list > * + * { margin-top: var(--lx-space-6); }
.lx-contact-list .lx-card__icon { flex: none; margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  .lx-hero__fiber { display: none; }
  .lx-eng.is-online .lx-eng__launcher::before { animation: none; }
  .lx-card:hover { transform: none; }
}
@media print { .lx-eng, .lx-hero__fiber { display: none !important; } }
