/* Evin 4 · VIVO-TATTO (16/11) · insieme a assets/js/vivo-tatto.js. Pacchetto «3 · tatto e navigazione».
   Solo transform e opacity animati; nessun bianco che lampeggia; html.fermo e «meno movimento» = tutto fermo e completo.
   Non tocca .cap-finestra, .cap-palco, i piani .wow-* né il filo, e non cambia z-index o position delle sezioni. */

/* ═══ 1 · PULSANTI MAGNETICI E RISPOSTA AL TOCCO ═══
   Il magnete usa la proprietà translate (non transform): si somma all'hover e alle entrate senza litigare. */
html.tatto-on :is(.btn, .cap-prodotto-btn) {
  transition: transform .22s var(--curva), box-shadow .22s var(--curva), background-color .22s, scale .5s cubic-bezier(.2,.8,.2,1.4),
    translate .35s cubic-bezier(.2,.8,.2,1.2); }
html.tatto-on .tatto-mag { translate: var(--bx, 0px) var(--by, 0px); }
html.tatto-on .tatto-mag > .ico-wa { translate: var(--bx, 0px) var(--by, 0px); transition: translate .35s cubic-bezier(.2,.8,.2,1.2); }
/* al tocco: un'unica scala (.96) con ritorno a molla al posto di quella di style.css (.97 in transform) */
html.tatto-on .btn:active { transform: none; }
html.tatto-on :is(.btn, .cap-prodotto-btn).tatto-premuto { scale: .96; transition-duration: .22s, .22s, .22s, .12s, .35s; }
html.tatto-on .tatto-pillola.tatto-premuto .tatto-pillola-tondo { scale: .92; }
.btn, .cap-prodotto-btn, .tatto-chip, .tatto-foglio-voce { position: relative; }
.btn, .cap-prodotto-btn { overflow: hidden; isolation: isolate; }
.tatto-onda { position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; background: #E2AC62; opacity: 0; scale: 0;
  animation: tatto-onda .6s cubic-bezier(.2,.7,.1,1) forwards; }
.btn-oro .tatto-onda { background: #F3D29C; }
@keyframes tatto-onda { from { scale: 0; opacity: .15; } to { scale: 2.4; opacity: 0; } }

/* ═══ 2 · PILLOLA WHATSAPP CHE SA DOVE SEI (telefono) ═══
   Si allarga con tre pezzi in transform (il tondo fisso, il corpo in scaleX, il tappo sinistro in translateX): mai width animata. */
.tatto-pillola { display: none; }
@media (max-width: 860px) {
  .tatto-pillola { --h: 54px; --larga: 140px; --w: calc(var(--larga) + var(--h) + 22px);
    display: block; position: fixed; z-index: 45; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: var(--h); height: var(--h); color: #fff; text-decoration: none; -webkit-user-select: none; user-select: none; touch-action: manipulation;
    opacity: 0; translate: 0 24px; pointer-events: none; transition: opacity .35s var(--curva), translate .5s cubic-bezier(.2,.8,.2,1.15); }
  .tatto-pillola.su { opacity: 1; translate: 0 0; pointer-events: auto; }
  html.menu-aperto .tatto-pillola { opacity: 0; pointer-events: none; }
  .tatto-pillola-tondo { position: absolute; right: 0; top: 0; transition: scale .4s cubic-bezier(.2,.8,.2,1.4); width: var(--h); height: var(--h); border-radius: 50%; display: grid; place-items: center;
    background: var(--verde); box-shadow: 0 12px 26px -10px rgba(6,42,34,.75); }
  .tatto-pillola-tondo .ico-wa { width: 24px; height: 24px; color: #fff; }
  .tatto-pillola-corpo { position: absolute; top: 0; right: calc(var(--h) / 2); height: var(--h); width: calc(var(--w) - var(--h)); background: var(--verde);
    transform-origin: 100% 50%; transform: scaleX(0); transition: transform .55s cubic-bezier(.2,.8,.2,1); }
  .tatto-pillola-tappo { position: absolute; top: 0; right: 0; width: var(--h); height: var(--h); border-radius: 50%; background: var(--verde);
    box-shadow: 0 12px 26px -10px rgba(6,42,34,.6); transform: translateX(0); transition: transform .55s cubic-bezier(.2,.8,.2,1); }
  .tatto-pillola-testo { position: absolute; top: 0; right: calc(var(--h) + 2px); height: var(--h); width: var(--larga); display: block; overflow: hidden;
    font-weight: 700; font-size: 14.5px; line-height: var(--h); white-space: nowrap; text-align: right; color: #fff;
    opacity: 0; transition: opacity .25s var(--curva); }
  .tatto-pillola.larga .tatto-pillola-corpo { transform: scaleX(1); }
  .tatto-pillola.larga .tatto-pillola-tappo { transform: translateX(calc(var(--h) - var(--w))); }
  .tatto-pillola.larga .tatto-pillola-testo { opacity: 1; transition: opacity .35s var(--curva) .2s; }
  .tatto-pillola:not(.larga) { pointer-events: none; }
  .tatto-pillola.su:not(.larga) .tatto-pillola-tondo { pointer-events: auto; }
  .tatto-pillola.su .tatto-pillola-tondo, .tatto-pillola.su.larga { pointer-events: auto; }
  /* l'ultima riga della griglia degli oli: spazio sotto, la pillola non copre il pulsante */
  html.tatto-on .cap-oli { padding-bottom: 76px; }
}
.tatto-pillola-misura { position: absolute; left: -9999px; top: 0; visibility: hidden; white-space: nowrap; font-weight: 700; font-size: 14.5px; }
/* l'etichetta che rotola (pillola, testata, pillola dei capitoli) */
.tatto-rulli { display: inline-grid; overflow: hidden; vertical-align: top; text-align: center; }
.tatto-pillola-testo, .tatto-cap-nome { display: grid; overflow: hidden; }
.tatto-rullo { grid-area: 1 / 1; display: block; transition: transform .42s cubic-bezier(.2,.8,.2,1), opacity .3s var(--curva); }
.tatto-rullo.entra { transform: translateY(100%); opacity: 0; transition: none; }
.tatto-rullo.esce { transform: translateY(-100%); opacity: 0; }

/* ═══ 3 · INDICE DEI CAPITOLI CON ANTEPRIME (PC) ═══ */
body { timeline-scope: --tatto-c1, --tatto-c2, --tatto-c3, --tatto-c4, --tatto-c5, --tatto-tutti; }
#ingrosso { view-timeline: --tatto-c1 block; } #oli-scena { view-timeline: --tatto-c2 block; } #cisterne { view-timeline: --tatto-c3 block; }
#business-card.capitolo { view-timeline: --tatto-c4 block; } #distributore.capitolo { view-timeline: --tatto-c5 block; }
.capitoli { view-timeline: --tatto-tutti block; }
.tatto-anteprime { position: absolute; right: calc(100% + 14px); top: 50%; width: 330px; translate: 0 -50%; pointer-events: none; visibility: hidden;
  transition: visibility 0s .4s; }
.tatto-anteprime-fondo { position: absolute; inset: 0; border-radius: 18px; background: rgba(16,14,12,.92); box-shadow: 0 0 0 1px rgba(243,210,156,.16), 0 30px 60px -30px rgba(0,0,0,.8);
  transform-origin: 100% 50%; transform: scaleX(.2); opacity: 0; transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .3s var(--curva); }
.tatto-anteprime-lista { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px; }
.tatto-ant { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 14px; padding: 6px 10px 6px 6px; border-radius: 12px; text-align: left;
  color: #fff; opacity: 0; transform: translateX(16px); transition: opacity .3s var(--curva), transform .45s cubic-bezier(.2,.8,.2,1), background-color .2s;
  transition-delay: 0s; }
.tatto-ant-foto { display: block; width: 56px; height: 70px; border-radius: 9px; overflow: hidden; background: #2A2620; box-shadow: 0 0 0 1px rgba(243,210,156,.18); }
.tatto-ant-foto img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--curva); }
.tatto-ant-testo { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tatto-ant-testo b { font-size: 11px; letter-spacing: .14em; color: var(--oro); font-weight: 700; }
.tatto-ant-testo strong { font-size: 15px; font-weight: 700; line-height: 1.2; }
.tatto-ant-testo small { font-size: 12px; line-height: 1.3; color: rgba(255,255,255,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tatto-ant-barra { position: absolute; left: -2px; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--oro);
  transform-origin: 50% 0; transform: scaleY(0); }
.wow-indice li.attivo ~ * { }
.wow-indice.tatto-aperto .tatto-anteprime { pointer-events: auto; visibility: visible; transition: visibility 0s; }
.wow-indice.tatto-aperto .tatto-anteprime-fondo { transform: none; opacity: 1; }
.wow-indice.tatto-aperto .tatto-ant { opacity: 1; transform: none; transition-delay: calc(.06s + var(--i) * .04s), calc(.06s + var(--i) * .04s), 0s; }
.wow-indice.tatto-aperto a span { opacity: 0 !important; visibility: hidden !important; }   /* la pillola del nome: c'è già il pannello */
@media (hover: hover) and (pointer: fine) {
  .tatto-ant:hover { background-color: rgba(243,210,156,.1); }
  .tatto-ant:hover .tatto-ant-foto img { transform: scale(1.08); }
}
@supports (animation-timeline: view()) {
  html.js:not(.fermo) .tatto-ant-barra { animation: tatto-barra linear both; animation-timeline: var(--tl); animation-range: contain 0% contain 100%; }
}
/* la barretta: animation-timeline non accetta var() in tutti i browser, quindi anche per nome */
@supports (animation-timeline: view()) {
  html.js:not(.fermo) .tatto-ant:nth-child(1) .tatto-ant-barra { animation-timeline: --tatto-c1; }
  html.js:not(.fermo) .tatto-ant:nth-child(2) .tatto-ant-barra { animation-timeline: --tatto-c2; }
  html.js:not(.fermo) .tatto-ant:nth-child(3) .tatto-ant-barra { animation-timeline: --tatto-c3; }
  html.js:not(.fermo) .tatto-ant:nth-child(4) .tatto-ant-barra { animation-timeline: --tatto-c4; }
  html.js:not(.fermo) .tatto-ant:nth-child(5) .tatto-ant-barra { animation-timeline: --tatto-c5; }
}
@keyframes tatto-barra { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ═══ 3-bis · TELEFONO: la pillola dei capitoli sotto la testata e il foglio che sale dal basso ═══ */
.tatto-cap { display: none; }
@media (max-width: 860px) {
  .tatto-cap { display: inline-flex; align-items: center; gap: 9px; position: fixed; z-index: 44; left: max(16px, env(safe-area-inset-left, 0px));
    bottom: calc(26px + env(safe-area-inset-bottom, 0px)); height: 34px; padding: 0 14px 0 12px; border-radius: 999px;
    background: #14110E; box-shadow: 0 0 0 1px rgba(243,210,156,.28), 0 8px 22px rgba(0,0,0,.28); color: #fff; font-size: 13px; font-weight: 650; overflow: hidden;
    opacity: 0; translate: 0 10px; pointer-events: none; transition: opacity .3s var(--curva), translate .4s var(--curva); }
  .tatto-cap.su { opacity: 1; translate: 0 0; pointer-events: auto; }
  html.menu-aperto .tatto-cap { opacity: 0; pointer-events: none; }
  .tatto-cap-num { color: var(--oro); font-size: 11.5px; letter-spacing: .1em; font-variant-numeric: tabular-nums; }
  .tatto-cap-nome { min-width: 4.5em; line-height: 34px; height: 34px; }
  .tatto-cap-barra { position: absolute; left: 12px; right: 12px; bottom: 5px; height: 2px; border-radius: 2px; background: rgba(243,210,156,.18); overflow: hidden; }
  .tatto-cap-barra i { position: absolute; inset: 0; background: var(--oro); transform-origin: 0 50%; transform: scaleX(.02); }
}
@supports (animation-timeline: view()) {
  html.js:not(.fermo) .tatto-cap-barra i { animation: tatto-avanza linear both; animation-timeline: --tatto-tutti; animation-range: contain 0% contain 100%; }
}
@keyframes tatto-avanza { from { transform: scaleX(.02); } to { transform: scaleX(1); } }

.tatto-foglio { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; max-height: 86dvh; border: 0; padding: 0 0 calc(18px + env(safe-area-inset-bottom, 0px));
  border-radius: 24px 24px 0 0; background: #FBF7EF; color: #14241F; box-shadow: 0 -20px 60px -20px rgba(0,0,0,.5); overflow: auto; overscroll-behavior: contain;
  --giu: 0px; transform: translateY(var(--giu)); }
.tatto-foglio[open] { animation: tatto-foglio-su .45s cubic-bezier(.2,.8,.2,1) both; }
.tatto-foglio.chiude { animation: tatto-foglio-giu .32s cubic-bezier(.4,0,.8,.4) both; }
.tatto-foglio.trascina { animation: none; }
@keyframes tatto-foglio-su { from { transform: translateY(100%); } to { transform: translateY(var(--giu)); } }
@keyframes tatto-foglio-giu { from { transform: translateY(var(--giu)); } to { transform: translateY(100%); } }
.tatto-foglio::backdrop { background: rgba(6,42,34,.55); }
.tatto-foglio[open]::backdrop { animation: tatto-velo .35s var(--curva) both; }
@keyframes tatto-velo { from { opacity: 0; } }
.tatto-foglio-testa { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 12px; background: #FBF7EF; }
.tatto-foglio-maniglia { position: absolute; left: 50%; top: 8px; width: 42px; height: 4px; margin-left: -21px; border-radius: 2px; background: rgba(30,87,76,.25); }
.tatto-foglio-titolo { font-weight: 700; font-size: 18px; color: #14241F; }
.tatto-foglio-chiudi { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; line-height: 1; color: var(--verde); background: rgba(30,87,76,.08); }
.tatto-foglio-griglia { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 16px 6px; }
.tatto-foglio-voce { display: block; text-align: left; border-radius: 16px; overflow: hidden; background: #2A2620; color: #fff; min-width: 0;
  animation: tatto-voce .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(.08s + var(--i) * .05s); }
.tatto-foglio-voce:last-child { grid-column: 1 / -1; }
.tatto-foglio-voce-foto { display: block; aspect-ratio: 4 / 3; overflow: hidden; }
.tatto-foglio-voce:last-child .tatto-foglio-voce-foto { aspect-ratio: 16 / 7; }
.tatto-foglio-voce-foto img { width: 100%; height: 100%; object-fit: cover; }
.tatto-foglio-voce-testo { display: flex; flex-direction: column; padding: 10px 12px 12px; gap: 1px; }
.tatto-foglio-voce-testo b { font-size: 11px; letter-spacing: .14em; color: var(--oro); }
.tatto-foglio-voce-testo strong { font-size: 15px; line-height: 1.2; }
.tatto-foglio-voce-testo small { font-size: 12px; line-height: 1.3; color: rgba(255,255,255,.62); }
@keyframes tatto-voce { from { opacity: 0; transform: translateY(18px); } }

/* ═══ 4 · LA CHAT DI «PARLIAMONE» COI MESSAGGI RAPIDI ═══ */
.tatto-telefono .telefono-schermo { position: relative; }
.tatto-telefono .telefono-barra { position: relative; z-index: 3; }
.tatto-telefono .chat { transition: transform .45s cubic-bezier(.2,.8,.2,1); will-change: transform; }
.tatto-chip-riga { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  padding: 10px 10px 14px; background: linear-gradient(180deg, rgba(239,231,221,0) 0%, #EFE7DD 22%); }
.tatto-chip { padding: 6px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 650; line-height: 1.2; white-space: nowrap; color: var(--verde);
  background: #FBF7EF; box-shadow: inset 0 0 0 1px rgba(30,87,76,.28); overflow: hidden; isolation: isolate;
  opacity: 0; transform: translateY(10px); transition: opacity .35s var(--curva), transform .45s cubic-bezier(.2,.8,.2,1.2), background-color .2s, color .2s, scale .4s cubic-bezier(.2,.8,.2,1.4); }
.tatto-telefono.tatto-pronto .tatto-chip, html.fermo .tatto-chip { opacity: 1; transform: none; }
.tatto-chip:nth-child(2) { transition-delay: .05s, .05s, 0s, 0s, 0s; } .tatto-chip:nth-child(3) { transition-delay: .1s, .1s, 0s, 0s, 0s; }
.tatto-chip:nth-child(4) { transition-delay: .15s, .15s, 0s, 0s, 0s; } .tatto-chip:nth-child(5) { transition-delay: .2s, .2s, 0s, 0s, 0s; }
.tatto-chip[aria-pressed="true"] { background: var(--verde); color: #fff; box-shadow: none; }
.tatto-chip.tatto-premuto { scale: .94; }
@media (hover: hover) and (pointer: fine) { .tatto-chip:hover { background-color: #F3EADB; } .tatto-chip[aria-pressed="true"]:hover { background-color: #23665a; } }
.tatto-puntini { display: flex; align-self: flex-end; gap: 5px; padding: 12px 14px; background: #FBF7EF; border-bottom-right-radius: 4px;
  box-shadow: 0 0 0 1px rgba(212,159,93,.25); animation: bolla-entra .45s var(--curva) both; }
.tatto-puntini i { width: 7px; height: 7px; border-radius: 50%; background: #D49F5D; opacity: .35; animation: tatto-puntino 1.2s ease-in-out infinite; }
.tatto-puntini i:nth-child(2) { animation-delay: .2s; } .tatto-puntini i:nth-child(3) { animation-delay: .4s; }
@keyframes tatto-puntino { 0%, 70%, 100% { opacity: .35; } 35% { opacity: 1; } }
.tatto-telefono.tatto-fuori .tatto-puntini i { animation-play-state: paused; }
.tatto-mia { display: block; }
.tatto-mia-testo { display: inline; }
.tatto-spunte { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 800; letter-spacing: -.32em; color: #9AA39E; transition: color .5s var(--curva); vertical-align: 1px; }
.tatto-spunte.lette { color: #3FA2D8; }
.btn.tatto-pronto-invio { animation: tatto-invio .6s cubic-bezier(.2,.8,.2,1.3); }
@keyframes tatto-invio { 0% { scale: 1; } 35% { scale: 1.05; } 100% { scale: 1; } }
/* il telefono segue appena il mouse (±4°), sopra all'inclinazione di sempre */
@media (hover: hover) and (pointer: fine) and (min-width: 861px) {
  html.js:not(.fermo) .tatto-telefono { transform: perspective(1000px) rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)) rotate(-7deg); transition: transform .6s cubic-bezier(.2,.8,.2,1); }
}
@media (max-width: 860px) {
  /* il telefono finto un po' più grande: i cinque messaggi rapidi stanno su due righe */
  .tatto-telefono { width: 252px; }
  .tatto-telefono .telefono-schermo { height: 392px; }
  .tatto-chip { padding: 6px 10px; font-size: 12px; }
  .tatto-chip-riga { gap: 5px; padding: 8px 6px 12px; }
}

/* ═══ 5 · PASSAGGIO DA CINEMA FRA LE PAGINE ═══ */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
::view-transition-group(*) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2,.7,.1,1); }
::view-transition-old(*), ::view-transition-new(*) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2,.7,.1,1); }
::view-transition-old(root) { animation-duration: .3s; }
/* la foto: dentro il gruppo si tiene la proporzione (niente immagine stirata), i due stati si incrociano */
::view-transition-group(scena-ingrosso), ::view-transition-group(scena-oli), ::view-transition-group(scena-cisterne),
::view-transition-group(scena-card), ::view-transition-group(scena-distributore) { overflow: clip; border-radius: 0; }
::view-transition-old(scena-ingrosso), ::view-transition-new(scena-ingrosso), ::view-transition-old(scena-oli), ::view-transition-new(scena-oli),
::view-transition-old(scena-cisterne), ::view-transition-new(scena-cisterne), ::view-transition-old(scena-card), ::view-transition-new(scena-card),
::view-transition-old(scena-distributore), ::view-transition-new(scena-distributore) { height: 100%; width: 100%; object-fit: cover; }
::view-transition-group(logo) { animation-duration: .45s; }
.hero-tela { view-transition-name: none; }
/* i nomi: il logo dappertutto; nelle pagine interne la foto e il titolo dell'apertura (una sola per pagina, mai doppi);
   in home li mette vivo-tatto.js all'ultimo (pageswap), solo sulla scena del capitolo di destinazione */
.testata-logo { view-transition-name: logo; }
.pagina-carburanti .apertura-foto { view-transition-name: scena-ingrosso; } .pagina-carburanti .apertura h1 { view-transition-name: titolo-ingrosso; }
.pagina-oli-motore .apertura-foto { view-transition-name: scena-oli; } .pagina-oli-motore .apertura h1 { view-transition-name: titolo-oli; }
.pagina-cisterne-in-comodato .apertura-foto { view-transition-name: scena-cisterne; } .pagina-cisterne-in-comodato .apertura h1 { view-transition-name: titolo-cisterne; }
.pagina-business-card .apertura-foto { view-transition-name: scena-card; } .pagina-business-card .apertura h1 { view-transition-name: titolo-card; }
.pagina-distributore .apertura-foto { view-transition-name: scena-distributore; } .pagina-distributore .apertura h1 { view-transition-name: titolo-distributore; }
/* arrivando con la transizione, la foto della pagina non rifà la sua entrata (la fa già la transizione) */
html.tatto-arrivo .apertura-foto img, html:active-view-transition .apertura-foto img { animation: none; }
html.fermo::view-transition-group(*), html.fermo::view-transition-old(*), html.fermo::view-transition-new(*) { animation-duration: 0s !important; }

/* ═══ VERSIONE FERMA: niente magnete, niente onde, niente rotolamenti ═══ */
html.fermo .tatto-mag, html.fermo .tatto-mag > .ico-wa { translate: none !important; }
html.fermo .tatto-onda { display: none; }
html.fermo .tatto-rullo, html.fermo .tatto-pillola, html.fermo .tatto-pillola *, html.fermo .tatto-cap, html.fermo .tatto-anteprime *,
html.fermo .tatto-foglio, html.fermo .tatto-foglio *, html.fermo .tatto-chip, html.fermo .tatto-telefono .chat { transition: none !important; animation: none !important; }
html.fermo .tatto-puntini i { animation: none; opacity: .8; }
html.fermo .tatto-premuto { scale: 1; }
@media (prefers-reduced-motion: reduce) {
  .tatto-mag, .tatto-mag > .ico-wa { translate: none !important; }
  .tatto-onda { display: none; }
  .tatto-puntini i, .tatto-foglio, .tatto-foglio-voce { animation: none !important; }
}

/* 16/11 unione: finché c'è la barra dei cookie, la pillola dei capitoli non si mostra (non si accavallano) */
body:has(#thk-barra-cookie) .tatto-cap { display: none !important; }
