/*
  Kit Show · scrittura: testo che si scrive da solo in un campo e manina che tocca un pulsante.
  Da COPIARE nella cartella della presentazione, accanto a scrittura.js (richiede vendor/gsap.min.js).
  Origine: capitolo «Guarda come funziona» del Planner presenze.
  Colori tramite variabili, da ridefinire nella presentazione:
    --ty-text, --ty-muted, --ty-caret, --ty-send, --ty-ring, --ty-finger, --ty-finger-line, --ty-finger-mark
  Punto del tocco sul pulsante: --ty-x (70%), --ty-y (55%).
*/

/* =========================================================================
   Barra di scrittura: [Menu] [campo] [➤]
   ========================================================================= */
.ty-input { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ty-input > :not(.ty-field) { flex: 0 0 auto; }
/* Una riga sola. Se il testo non ci sta, scrittura.js scorre il campo per mostrarne la fine, come un campo vero. */
.ty-field { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; color: var(--ty-muted, #8a96a3); }
.ty-text { color: var(--ty-text, inherit); }
/* Cursore lampeggiante, solo mentre nel campo c'è testo */
.ty-text:not(:empty)::after {
  content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 1px; vertical-align: -2px;
  background: var(--ty-caret, #3b8fd6); animation: ty-caret 1s steps(1) infinite;
}
@keyframes ty-caret { 50% { opacity: 0; } }
/* Il tasto di invio pulsa (scale) al momento dell'invio */
.ty-send { display: inline-block; color: var(--ty-send, #3b8fd6); transform-origin: 50% 50%; }

/* =========================================================================
   Pulsante toccato e manina
   ========================================================================= */
/* scrittura.js aggiunge .ty-tap al pulsante (e position: relative se era static).
   Lo stato premuto è la scala .94 data da GSAP: il pulsante si schiaccia dal centro.
   Se un antenato ha overflow: hidden la manina, che sporge sotto, viene tagliata: controllalo. */
.ty-tap { overflow: visible; transform-origin: 50% 50%; }
/* Il centro del cerchio è il punto del tocco: --ty-x / --ty-y sul pulsante (default 70% / 55%). */
.ty-finger {
  position: absolute; left: var(--ty-x, 70%); top: var(--ty-y, 55%); z-index: 10;
  width: 46px; height: 58px; margin: -8px 0 0 -18px; box-sizing: border-box;
  font-style: normal; line-height: 0; pointer-events: none; opacity: 0; visibility: hidden;
  filter: drop-shadow(0 4px 4px rgba(0, 34, 67, .3));
}
.ty-finger svg { display: block; width: 100%; height: 100%; }
.ty-finger .ty-hand { fill: var(--ty-finger, #fff); stroke: var(--ty-finger-line, #1d4f91); }
.ty-finger .ty-mark { stroke: var(--ty-finger-mark, #b4cfe0); }
/* Il cerchio del tocco, centrato sul polpastrello */
.ty-ring {
  position: absolute; left: 6px; top: -4px; width: 24px; height: 24px; box-sizing: border-box;
  border: 2px solid var(--ty-ring, #38a5da); border-radius: 50%;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--ty-ring, #38a5da) 16%, transparent);
}

/* Movimento ridotto: niente cursore che lampeggia, niente manina */
@media (prefers-reduced-motion: reduce) {
  .ty-text::after { animation: none; }
  .ty-finger { display: none; }
}
