/* Promassage prototipo v2: esperienza mobile da app e animazioni morbide.
   Tutto è limitato a body.pm-v2, il resto del sito non cambia. */

.pm-v2 { --v2-ease: cubic-bezier(.22,.8,.24,1); }

/* ---------- Passaggio morbido tra le pagine (browser recenti) ---------- */
@view-transition { navigation: auto; }
::view-transition-group(root) { animation-duration: .2s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* ---------- Animazioni di base ---------- */
.pm-v2 .v2-reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s var(--v2-ease), transform .8s var(--v2-ease); transition-delay: var(--d, 0s); }
.pm-v2 .v2-reveal.is-in { opacity: 1; transform: none; }

/* Logo che si disegna */
.pm-v2 .pm-logo svg path:last-child { stroke-dasharray: 160; stroke-dashoffset: 160; animation: v2-draw 1.4s .25s var(--v2-ease) forwards; }
.pm-v2 .pm-logo svg path:first-child { transform-origin: 50% 100%; animation: v2-rise .7s var(--v2-ease) both; }
@keyframes v2-draw { to { stroke-dashoffset: 0; } }
.v2-logo-seen .pm-v2 .pm-logo svg path { animation: none !important; stroke-dashoffset: 0; }
@keyframes v2-rise { from { transform: scaleY(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* Ritratto che si svela dentro l'arco, poi respira lentamente */
.pm-v2 .pm-hero .pm-arch { animation: v2-unveil 1.2s .15s var(--v2-ease) both; }
.pm-v2 .pm-hero .pm-arch img { animation: v2-breathe 16s ease-in-out infinite alternate both; transform-origin: 50% 35%; will-change: transform; }
@keyframes v2-unveil { from { clip-path: inset(100% 0 0 0 round 400px 400px 24px 24px); } to { clip-path: inset(0 0 0 0 round 400px 400px 24px 24px); } }
@keyframes v2-breathe { from { transform: scale(1.06); } to { transform: scale(1); } }

/* Testo dell'hero in sequenza */
.pm-v2 .pm-hero__grid > div:first-child > * { animation: v2-up .9s var(--v2-ease) both; }
.pm-v2 .pm-hero__grid > div:first-child > *:nth-child(2) { animation-delay: .12s; }
.pm-v2 .pm-hero__grid > div:first-child > *:nth-child(3) { animation-delay: .24s; }
.pm-v2 .pm-hero__grid > div:first-child > *:nth-child(4) { animation-delay: .36s; }
.pm-v2 .pm-hero__grid > div:first-child > *:nth-child(5) { animation-delay: .48s; }
@keyframes v2-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* Feedback al tocco */
.pm-v2 .pm-btn, .pm-v2 .v2-tcard, .pm-v2 .v2-filter { -webkit-tap-highlight-color: transparent; }
.pm-v2 .pm-btn:active { transform: scale(.97); }
.pm-v2 .pm-btn { transition: transform .15s ease, background-color .2s, color .2s, border-color .2s; }

/* ---------- Trattamenti: filtri + schede ---------- */
.pm-v2 .v2-filters { display: flex; gap: 8px; margin: -8px 0 24px; }
.pm-v2 .v2-filter { font: inherit; font-size: 15px; font-weight: 500; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--pm-bordo-forte, #D6CBBB); background: transparent; color: var(--pm-terra); cursor: pointer; transition: background-color .25s, color .25s, border-color .25s; }
.pm-v2 .v2-filter.is-active { background: var(--pm-terra); border-color: var(--pm-terra); color: var(--pm-crema); }
.pm-v2 .v2-track { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; }
.pm-v2 .v2-tcard { display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; background: var(--pm-crema); border: 1px solid var(--pm-bordo); color: var(--pm-terra); text-decoration: none; transition: transform .35s var(--v2-ease), box-shadow .35s var(--v2-ease), opacity .35s, border-color .2s; }
.pm-v2 .v2-tcard.is-hidden { display: none; }
.pm-v2 .v2-tcard__img { position: relative; display: block; aspect-ratio: 4/3; overflow: hidden; background: var(--pm-sabbia); }
.pm-v2 .v2-tcard__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--v2-ease); }
.pm-v2 .v2-tcard__tag { position: absolute; left: 14px; top: 14px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; background: var(--pm-crema); color: var(--pm-terracotta-scuro); padding: 6px 10px; border-radius: 999px; }
.pm-v2 .v2-tcard__body { display: flex; flex-direction: column; gap: 8px; padding: 20px 22px 22px; flex: 1; }
.pm-v2 .v2-tcard__title { font-family: var(--pm-serif); font-size: 23px; line-height: 1.2; }
.pm-v2 .v2-tcard__text { font-size: 15px; color: var(--pm-testo-2); flex: 1; }
.pm-v2 .v2-tcard__foot { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.pm-v2 .v2-tcard__foot strong { white-space: nowrap; }
.pm-v2 .v2-tcard__foot small { line-height: 1.3; }
.pm-v2 .v2-tcard__foot small { color: var(--pm-testo-3); font-size: 13px; }
.pm-v2 .v2-tcard__go { margin-left: auto; flex: 0 0 36px; width: 36px; height: 36px; min-width: 36px; aspect-ratio: 1; border-radius: 50%; display: inline-grid; place-items: center; background: var(--pm-crema-chiaro); border: 1px solid var(--pm-bordo); color: var(--pm-terracotta-scuro); transition: transform .3s var(--v2-ease), background-color .3s; }
.pm-v2 .v2-dots { display: none; }
.pm-v2 .v2-sheet-extra { display: none; }

/* Numeri recensioni */
.pm-v2 .pm-score__n { font-variant-numeric: tabular-nums; }

/* ---------- Telefono ---------- */
@media (max-width: 900px) {
  /* Hero: ritratto a tutta larghezza, testo che sale sopra come un foglio */
  .pm-v2 .pm-hero { padding: 0 0 40px; }
  .pm-v2 .pm-hero .pm-container { padding: 0; }
  .pm-v2 .pm-hero__grid { display: flex; flex-direction: column-reverse; gap: 0; }
  .pm-v2 .pm-hero__media { max-width: none; width: 100%; margin: 0; }
  .pm-v2 .pm-hero .pm-arch { aspect-ratio: auto; height: min(46svh, 420px); border-radius: 0; }
  .pm-v2 .pm-hero .pm-arch img { object-position: 50% 8%; }
  .pm-v2 .pm-hero__meta { display: none; }
  @keyframes v2-unveil { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
  .pm-v2 .pm-hero__grid > div:first-child { position: relative; z-index: 2; margin-top: -48px; background: var(--pm-crema); border-radius: 28px 28px 0 0; padding: 22px 20px 0; }
  .pm-v2 .pm-hero__grid > div:first-child::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--pm-bordo-forte, #D6CBBB); margin: 0 auto 18px; }
  .pm-v2 .pm-hero .pm-badge { position: absolute; top: -66px; left: 20px; margin: 0; background: rgba(251,248,243,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 6px 20px rgba(58,51,48,.12); font-size: 14px; }
  .pm-v2 .pm-hero h1 { font-size: 34px; margin-bottom: 12px; }
  .pm-v2 .pm-hero__text { font-size: 17px; }
  .pm-v2 .pm-hero .pm-btns { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 18px !important; }
  .pm-v2 .pm-hero .pm-btns .pm-btn { justify-content: center; padding: 0 12px; white-space: nowrap; min-width: 0; }
  .pm-v2 .pm-hero .pm-tel-num { display: none; }
  .pm-v2 .pm-hero__meta { font-size: 14px; }

  /* Trattamenti: schede da scorrere col dito */
  .pm-v2 #trattamenti .pm-container { padding-right: 0; }
  .pm-v2 .v2-filters { padding-right: 20px; }
  .pm-v2 .v2-rail { overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior-x: contain; }
  .pm-v2 .v2-rail::-webkit-scrollbar { display: none; }
  .pm-v2 .v2-track { display: flex; gap: 14px; padding: 4px 20px 8px 0; }
  .pm-v2 .v2-tcard { flex: 0 0 80%; scroll-snap-align: start; }
  .pm-v2 .v2-tcard:hover { transform: none; box-shadow: none; }
  .pm-v2 .v2-tcard:active { transform: scale(.985); }

  /* Recensioni: carosello */
  .pm-v2 #recensioni .pm-container { padding-right: 0; }
  .pm-v2 #recensioni .pm-reviews-head, .pm-v2 #recensioni .pm-reviews-more { padding-right: 20px; }
  .pm-v2 #recensioni .pm-grid-3 { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 4px 20px 8px 0; overscroll-behavior-x: contain; }
  .pm-v2 #recensioni .pm-grid-3::-webkit-scrollbar { display: none; }
  .pm-v2 #recensioni .pm-review { flex: 0 0 86%; scroll-snap-align: start; }

  /* Puntini */
  .pm-v2 .v2-dots { display: flex; justify-content: center; gap: 6px; margin-top: 16px; padding-right: 20px; }
  .pm-v2 .v2-dots span { width: 6px; height: 6px; border-radius: 6px; background: var(--pm-bordo-forte, #D6CBBB); transition: width .3s var(--v2-ease), background-color .3s; }
  .pm-v2 .v2-dots span.is-on { width: 20px; background: var(--pm-terracotta-scuro); }

  /* Menu a pannello dal basso */
  .pm-v2 .pm-nav.is-open { display: block; position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 90; padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); border: 0; border-radius: 28px 28px 0 0; background: var(--pm-crema); box-shadow: 0 -20px 60px rgba(58,51,48,.25); animation: v2-sheet .38s var(--v2-ease) both; max-height: 88svh; overflow-y: auto; }
  .pm-v2 .pm-nav.is-open::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--pm-bordo-forte, #D6CBBB); margin: 0 auto 14px; }
  .pm-v2 .pm-nav.is-open ul { gap: 0; }
  .pm-v2 .pm-nav.is-open li { border-bottom: 1px solid var(--pm-bordo); }
  .pm-v2 .pm-nav.is-open ul a { display: flex; justify-content: space-between; align-items: center; padding: 16px 4px; font-family: var(--pm-serif); font-size: 24px; color: var(--pm-terra); text-decoration: none; }
  .pm-v2 .pm-nav.is-open ul a::after { content: "→"; font-family: var(--pm-sans); font-size: 18px; color: var(--pm-terracotta-scuro); }
  .pm-v2 .pm-nav.is-open .v2-sheet-extra { display: block; padding-top: 18px; }
  .pm-v2 .v2-sheet-extra .pm-btns { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .pm-v2 .v2-sheet-extra .pm-btn--wa { order: -1; }
  .pm-v2 .v2-sheet-extra .pm-btn { justify-content: center; min-width: 0; padding: 0 20px; white-space: nowrap; font-size: 15px; }
  .pm-v2 .v2-sheet-extra .pm-btn--outline { padding: 0 18px; }
  .pm-v2 .v2-sheet-extra p { margin: 14px 0 0; font-size: 14px; color: var(--pm-testo-3); text-align: center; }
  .pm-v2 .v2-sheet-extra p a { color: var(--pm-terracotta-scuro); }
  .pm-v2 .v2-scrim { position: fixed; inset: 0; z-index: 85; background: rgba(40,36,33,.38); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: v2-fade .3s ease both; }
  .pm-v2.v2-menu-open { overflow: hidden; }
  .pm-v2.v2-menu-open .pm-header { z-index: 95; }
  .pm-v2.v2-menu-open .pm-mobile-bar { visibility: hidden; }
  @keyframes v2-sheet { from { transform: translateY(100%); } to { transform: none; } }
  @keyframes v2-fade { from { opacity: 0; } to { opacity: 1; } }

  /* Barra in basso rispettosa della barra iPhone */
  .pm-v2 .pm-mobile-bar { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .pm-v2 *, .pm-v2 *::before, .pm-v2 *::after { animation: none !important; transition: none !important; }
  .pm-v2 .v2-reveal { opacity: 1; transform: none; }
  .pm-v2 .pm-logo svg path:last-child { stroke-dashoffset: 0; }
}

/* Pulsanti nel pannello menu: mantengono i loro colori */
.pm-v2 .v2-sheet-extra .pm-btn--wa, .pm-v2 .v2-sheet-extra .pm-btn--wa:hover { color: #fff; }
.pm-v2 .v2-sheet-extra .pm-btn--outline { color: var(--pm-terra); }

/* Fuori orario su telefoni stretti: i due pulsanti dell'apertura uno sotto l'altro */
@media (max-width: 420px) {
  .pm-chiuso.pm-v2 .pm-hero .pm-btns, .pm-chiuso .pm-v2 .pm-hero .pm-btns { grid-template-columns: 1fr; }
}
@media (max-width: 340px) {
  .pm-v2 .pm-hero .pm-btns { grid-template-columns: 1fr; }
}

/* Effetti al passaggio del mouse solo dove esiste un mouse: sui telefoni il primo tocco non deve servire ad attivare l'hover */
@media (hover: hover) and (pointer: fine) {
  .pm-v2 .v2-tcard:hover { transform: translateY(-4px); box-shadow: 0 18px 40px -18px rgba(58,51,48,.28); color: var(--pm-terra); }
  .pm-v2 .v2-tcard:hover .v2-tcard__img img { transform: scale(1.05); }
  .pm-v2 .v2-tcard:hover .v2-tcard__go { transform: translateX(3px); background: var(--pm-terracotta-scuro); color: #fff; }
}
.pm-v2 .v2-tcard:active .v2-tcard__go { background: var(--pm-terracotta-scuro); color: #fff; }
.pm-v2 .v2-tcard { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
