/* «La oficina viva» · capa 2 (Reinier, 20-nov), restaurada el 21-nov.
   La orden 028 la había quitado («ruido»); Reinier la pidió expresamente: botones más
   llamativos, titulares que se noten al bajar, el asistente que suena, cursor distinto.
   Va después de oficina.css. Los bucles esperan a .of-pronto (js/oficina-capa2.js);
   los formularios no se mueven; con «reducir movimiento», nada. */

/* ---------- Botones magnéticos ---------- */
.of-magnete { translate: var(--of-tx, 0) var(--of-ty, 0); transition: translate .35s var(--of-molla), transform .5s var(--of-molla), box-shadow .5s var(--of-molla) !important; }
.hp-bottone, .bottone { translate: 0 0; transition: translate .8s var(--of-molla), transform .5s var(--of-molla), box-shadow .5s var(--of-molla); }

/* ---------- El asistente «suena»: vibra y emite ondas, como un teléfono ---------- */
.ass-bolla { position: fixed; isolation: isolate; }
.ass-bolla::before, .ass-bolla::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 1.5px var(--mint);
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .of-pronto .ass-bolla { animation: of-squillo 6s var(--of-molla) 3s infinite; }
  .of-pronto .ass-bolla::before { animation: of-onda 6s cubic-bezier(.2,.6,.3,1) 3s infinite; }
  .of-pronto .ass-bolla::after { animation: of-onda 6s cubic-bezier(.2,.6,.3,1) 3.25s infinite; }
  .ass-bolla:hover, .ass-bolla:focus-visible { animation-play-state: paused; }
}
@keyframes of-squillo {
  0%, 16%, 100% { transform: none; }
  1% { transform: rotate(-9deg) scale(1.04); } 2% { transform: rotate(8deg) scale(1.04); }
  3% { transform: rotate(-7deg) scale(1.04); } 4% { transform: rotate(6deg) scale(1.04); }
  5% { transform: rotate(-4deg) scale(1.03); } 6% { transform: rotate(3deg) scale(1.02); }
  7% { transform: rotate(0) scale(1); }
  9% { transform: rotate(-8deg) scale(1.04); } 10% { transform: rotate(7deg) scale(1.04); }
  11% { transform: rotate(-5deg) scale(1.03); } 12% { transform: rotate(4deg) scale(1.02); }
  13% { transform: rotate(0) scale(1); }
}
@keyframes of-onda {
  0% { opacity: .85; transform: scale(1); }
  14% { opacity: 0; transform: scale(1.55, 1.9); }
  100% { opacity: 0; transform: scale(1.55, 1.9); }
}

/* ---------- Titulares y tecnología viva 100 % GPU (27-nov: 0 reflows al hacer scroll) ----------
   NUNCA animar font-weight ni background-position atados al scroll (causaban tirones graves).
   Solo transform y opacity en compositor GPU: 60 fps reales en escritorio y móvil. */
@media (prefers-reduced-motion: no-preference) {
  .contenuto h1 { position: relative; }
  .contenuto h1::after {
    content: ""; position: absolute; top: -6%; bottom: -6%; left: 0; width: 26%; pointer-events: none;
    background: linear-gradient(100deg, transparent, rgb(124 255 196 / .22) 50%, transparent);
    opacity: 0;
  }
  .of-pronto .contenuto h1::after { animation: of-barra 1.5s var(--of-molla) .1s both; }
  .of-pronto .occhiello::before, .of-pronto .hp-per::before { animation: of-pulso-led 2.4s ease-in-out infinite; }
}
@keyframes of-barra { from { transform: translateX(-40%); opacity: 1; } 85% { opacity: 1; } to { transform: translateX(300%); opacity: 0; } }
@keyframes of-pulso-led { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.45); opacity: .65; } }
@media (forced-colors: active) {
  .contenuto h1, .contenuto h2 { background: none !important; -webkit-text-fill-color: currentColor !important; }
  .contenuto h1::after { display: none; }
}

/* ---------- Tarjetas tecnológicas vivas en TODA la web (100 % GPU: transform + opacity) ---------- */
.of-tech-vivo,
.oficina-pagina .servizi-cima li,
.oficina-pagina .vantaggio,
.oficina-pagina .blog-card,
.oficina-pagina .tabella-avvolgi.listino,
.oficina-pagina .catalogo > li {
  position: relative;
  overflow: hidden;
  transition: transform .5s var(--of-molla), box-shadow .5s var(--of-molla);
}
.of-tech-vivo::after,
.oficina-pagina .servizi-cima li::after,
.oficina-pagina .vantaggio::after,
.oficina-pagina .blog-card::after,
.oficina-pagina .tabella-avvolgi.listino::after {
  content: ""; position: absolute; inset: 0; width: 42%; pointer-events: none; z-index: 2;
  background: linear-gradient(108deg, transparent 0%, rgb(124 255 196 / .10) 46%, rgb(255 255 255 / .12) 50%, rgb(124 255 196 / .06) 56%, transparent 100%);
  transform: translateX(-160%) skewX(-18deg);
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .of-pronto .of-tech-vivo::after,
  .of-pronto .oficina-pagina .servizi-cima li::after,
  .of-pronto .oficina-pagina .tabella-avvolgi.listino::after {
    animation: of-scan-gpu 6.8s var(--of-molla) var(--scan-delay, 0s) infinite;
  }
  .of-pronto .oficina-pagina .servizi-cima li:nth-child(2)::after { --scan-delay: 1.4s; }
  .of-pronto .oficina-pagina .servizi-cima li:nth-child(3)::after { --scan-delay: 2.8s; }
  .of-pronto .oficina-pagina .vantaggio:hover::after,
  .of-pronto .oficina-pagina .blog-card:hover::after {
    animation: of-scan-hover .95s var(--of-molla) forwards;
  }
}
@media (hover: hover) and (pointer: fine) {
  .oficina-pagina .servizi-cima li:hover,
  .oficina-pagina .vantaggio:hover,
  .oficina-pagina .blog-card:hover {
    transform: translateY(-5px);
    box-shadow: inset 0 0 0 1px rgb(124 255 196 / .32), 0 32px 64px -34px rgb(0 0 0 / .95), 0 0 54px -28px rgb(124 255 196 / .32);
  }
}
@keyframes of-scan-gpu {
  0%, 72%, 100% { transform: translateX(-160%) skewX(-18deg); opacity: 0; }
  76% { opacity: 1; }
  94% { opacity: 1; }
  98% { transform: translateX(360%) skewX(-18deg); opacity: 0; }
}
@keyframes of-scan-hover {
  0% { transform: translateX(-150%) skewX(-18deg); opacity: .95; }
  100% { transform: translateX(350%) skewX(-18deg); opacity: 0; }
}

/* Todo lo que se mueve en bucle arranca con el primer gesto (.of-pronto): en un móvil
   lento, cualquier animación viva durante la carga obliga a recalcular en cada fotograma. */
/* ---------- Botones principales: respiran, les pasa un destello y la flecha empuja ----------
   Explica dónde está la acción de la página sin tener que buscarla. */
.hp-bottone, .bottone:not(.bottone-secondario):not(.bottone-pericolo):not(.bottone-piccolo) { position: relative; isolation: isolate; }
.hp-bottone::before, .bottone:not(.bottone-secondario):not(.bottone-pericolo):not(.bottone-piccolo)::before {
  content: ""; position: absolute; inset: -3px; z-index: -1; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 34px 6px rgb(255 106 77 / .55), 0 0 0 1px rgb(255 160 140 / .5);
  opacity: .25;
}
/* El destello es una barra que cruza con transform (sin repintar) y se apaga en los extremos redondos. */
.hp-bottone::after, .bottone:not(.bottone-secondario):not(.bottone-pericolo):not(.bottone-piccolo)::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 28%; pointer-events: none;
  background: linear-gradient(105deg, transparent, rgb(255 255 255 / .55) 45%, rgb(255 255 255 / .15) 60%, transparent);
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .of-pronto .hp-bottone::before, .of-pronto .bottone:not(.bottone-secondario):not(.bottone-pericolo):not(.bottone-piccolo)::before { animation: of-respiro 2.6s ease-in-out infinite alternate; }
  .of-pronto .hp-bottone::after, .of-pronto .bottone:not(.bottone-secondario):not(.bottone-pericolo):not(.bottone-piccolo)::after { animation: of-lampo 5.2s var(--of-molla) 1.6s infinite; }
  .of-pronto .hp-freccia svg { animation: of-spinta 5.2s var(--of-molla) 1.6s infinite; }
}
.hp-bottone:hover, .bottone:not(.bottone-secondario):not(.bottone-pericolo):not(.bottone-piccolo):hover { transform: scale(1.035); }
.hp-bottone:hover::before, .bottone:not(.bottone-secondario):not(.bottone-pericolo):not(.bottone-piccolo):hover::before { animation-play-state: paused; opacity: 1; }
.hp-bottone:active, .bottone:active { transform: scale(.97); }
body .hp-bottone:hover .hp-freccia { background: #160905; color: var(--mint); transform: translateX(3px) rotate(-45deg) scale(1.08); }
.hp-freccia { color: inherit; transition: transform .6s var(--of-molla), background-color .4s var(--of-molla), color .4s var(--of-molla) !important; }
@keyframes of-respiro { from { opacity: .18; transform: scale(.97); } to { opacity: .85; transform: scale(1.05); } }
@keyframes of-lampo { 0% { transform: translateX(10%); opacity: 0; } 4% { opacity: 1; } 22% { opacity: 1; } 26%, 100% { transform: translateX(300%); opacity: 0; } }
@keyframes of-spinta { 0%, 24%, 100% { transform: none; } 9% { transform: translateX(5px); } 14% { transform: translateX(-1px); } 18% { transform: translateX(3px); } }

/* ---------- Mira: anillo con estela que acompaña al cursor (la flecha se queda) ---------- */
.of-mira { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; opacity: 0; transition: opacity .5s var(--of-molla); }
.of-mira--vista { opacity: 1; }
.of-mira-anello, .of-mira-scia { position: absolute; left: 0; top: 0; will-change: transform; }
.of-mira-anello::before, .of-mira-anello::after {
  content: ""; position: absolute; left: -18px; top: -18px; width: 36px; height: 36px; border-radius: 50%;
}
.of-mira-anello::before {
  box-shadow: inset 0 0 0 1.5px rgb(124 255 196 / .75), 0 0 22px -6px rgb(124 255 196 / .8);
  transition: transform .45s var(--of-molla), background-color .35s var(--of-molla), opacity .35s var(--of-molla), border-radius .45s var(--of-molla);
}
.of-mira-anello::after { box-shadow: 0 0 0 1.5px var(--mint); opacity: 0; }
.of-mira-scia {
  width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%;
  background: var(--mint); box-shadow: 0 0 12px var(--mint);
  opacity: calc(.6 - var(--i) * .09); scale: calc(1 - var(--i) * .13);
  transition: opacity .3s var(--of-molla);
}
.of-mira--pulsa .of-mira-anello::before { transform: scale(1.65); background-color: rgb(124 255 196 / .1); }
.of-mira--scheda .of-mira-anello::before { transform: scale(2.3); opacity: .45; }
.of-mira--preme .of-mira-anello::before { transform: scale(.72); background-color: rgb(124 255 196 / .25); }
.of-mira--scrive .of-mira-anello::before, .of-mira--scrive .of-mira-scia { opacity: 0; }
.of-mira--onda::after { animation: of-mira-onda .7s cubic-bezier(.2,.6,.3,1) both; }
@keyframes of-mira-onda { from { opacity: .9; transform: scale(.8); } to { opacity: 0; transform: scale(2.8); } }
@media (forced-colors: active) { .of-mira { display: none; } }

/* Los botones de un formulario no se mueven ni destellan. */
form .hp-bottone, form .bottone { translate: none !important; }
form .hp-bottone::before, form .hp-bottone::after, form .bottone::before, form .bottone::after { animation: none !important; opacity: 0 !important; }
@media (prefers-reduced-motion: reduce) { .of-mira { display: none; } .of-magnete { translate: none !important; } }
