/* CSO v31 — Rifinitura design e fluidità (strato aggiuntivo).
   Non modifica testi, immagini o struttura: solo resa visiva e movimento.
   Tutto il movimento rispetta "Riduci movimento" e l'impostazione enable_motion.
   Il diamante 3D della home non viene toccato da queste regole. */

:root {
  --cso-ease-out: cubic-bezier(.16, 1, .3, 1);
  --cso-ease-soft: cubic-bezier(.22, .61, .36, 1);
  --cso-shadow-rest: 0 1px 2px rgba(32, 40, 44, .04), 0 8px 24px -18px rgba(32, 40, 44, .18);
  --cso-shadow-lift: 0 2px 6px rgba(32, 40, 44, .05), 0 26px 48px -28px rgba(32, 40, 44, .34);
  --cso-shadow-media: 0 34px 70px -42px rgba(32, 40, 44, .45);
}

/* ---------- Tipografia ---------- */
body { text-rendering: optimizeLegibility; -moz-osx-font-smoothing: grayscale; }
h1,
h2,
h3 { font-kerning: normal; font-feature-settings: "kern", "liga"; }
main p,
main li { text-wrap: pretty; }

/* ---------- Intestazione: vetro smerigliato allo scorrimento ---------- */
.cso-soft .cso-header-wrapper {
  transition: box-shadow .4s var(--cso-ease-soft), transform .45s var(--cso-ease-out), background-color .4s ease;
}
.cso-soft .cso-header-wrapper .site-header { transition: background-color .4s ease, border-color .4s ease; }
.cso-soft .cso-header-wrapper.cso-is-scrolled { box-shadow: 0 12px 32px -22px rgba(32, 40, 44, .32); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .cso-soft .cso-header-wrapper.cso-is-scrolled { background: rgba(255, 255, 255, .82); -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px); }
  .cso-soft .cso-header-wrapper.cso-is-scrolled .site-header { background: transparent; border-bottom-color: rgba(227, 231, 233, .7); }
}
/* Su telefono e tablet l'intestazione scivola via mentre si legge e torna appena si risale. */
@media (max-width: 1179px) {
  .cso-soft .cso-header-wrapper.cso-is-hidden { transform: translateY(calc(-100% - 2px)); box-shadow: none; }
}

/* Link di navigazione: sottolineatura che cresce dal centro. */
@media (hover: hover) and (pointer: fine) {
  .cso-soft .desktop-nav > a:not(.button) { position: relative; border-bottom-color: transparent !important; }
  .cso-soft .desktop-nav > a:not(.button)::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 1px; background: var(--gold);
    transform: scaleX(0); transform-origin: 50% 50%; transition: transform .45s var(--cso-ease-out);
  }
  .cso-soft .desktop-nav > a:not(.button):hover::after,
.cso-soft .desktop-nav > a[aria-current="page"]::after { transform: scaleX(1); }
}

/* Menu mobile: apertura morbida con voci in sequenza. */
.cso-soft .menu-lines,
.cso-soft .menu-lines::before { transition: transform .35s var(--cso-ease-out), border-color .25s ease; }
@media (prefers-reduced-motion: no-preference) {
  .cso-soft .mobile-menu[open] .mobile-nav { animation: cso-menu-in .42s var(--cso-ease-out) both; transform-origin: 50% 0; }
  .cso-soft .mobile-menu[open] .mobile-nav > * { animation: cso-menu-item .5s var(--cso-ease-out) both; }
  .cso-soft .mobile-menu[open] .mobile-nav > :nth-child(2) { animation-delay: .03s; }
  .cso-soft .mobile-menu[open] .mobile-nav > :nth-child(3) { animation-delay: .06s; }
  .cso-soft .mobile-menu[open] .mobile-nav > :nth-child(4) { animation-delay: .09s; }
  .cso-soft .mobile-menu[open] .mobile-nav > :nth-child(5) { animation-delay: .12s; }
  .cso-soft .mobile-menu[open] .mobile-nav > :nth-child(6) { animation-delay: .15s; }
  .cso-soft .mobile-menu[open] .mobile-nav > :nth-child(n+7) { animation-delay: .18s; }
}
@keyframes cso-menu-in { from { opacity: 0; transform: translateY(-8px) scaleY(.98); } to { opacity: 1; transform: none; } }
@keyframes cso-menu-item { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Pulsanti ---------- */
.cso-soft .button,
.cso-soft .cso-home-action,
.cso-soft .cso-home-dealers__button,
.cso-soft .cso-wa-button,
.cso-soft .cso-small-button,
.cso-soft .cso-footer-oam {
  transition: background-color .3s var(--cso-ease-soft), color .3s var(--cso-ease-soft), border-color .3s var(--cso-ease-soft),
              box-shadow .4s var(--cso-ease-soft), transform .4s var(--cso-ease-out);
}
.cso-soft .button .icon,
.cso-soft .cso-home-action .icon,
.cso-soft .cso-home-link .icon,
.cso-soft .text-link .icon,
.cso-soft .cso-wa-button .icon,
.cso-soft .cso-home-dealers__button .icon,
.cso-soft .cso-home-dealers__link .icon {
  transition: transform .45s var(--cso-ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .cso-soft .button:not([disabled]):hover,
.cso-soft .cso-home-action:hover,
.cso-soft .cso-home-dealers__button:hover,
.cso-soft .cso-wa-button:hover {
    transform: translateY(-1px); box-shadow: 0 14px 28px -18px rgba(32, 40, 44, .55);
  }
  .cso-soft .button:hover .icon,
.cso-soft .cso-home-action:hover .icon,
.cso-soft .cso-home-link:hover .icon,
.cso-soft .text-link:hover .icon,
.cso-soft .cso-wa-button:hover .icon,
.cso-soft .cso-home-dealers__button:hover .icon,
.cso-soft .cso-home-dealers__link:hover .icon { transform: translateX(4px); }
}
.cso-soft .button:not([disabled]):active,
.cso-soft .cso-home-action:active,
.cso-soft .cso-home-dealers__button:active,
.cso-soft .cso-wa-button:active,
.cso-soft .cso-small-button:active {
  transform: translateY(0) scale(.98); box-shadow: none; transition-duration: .12s;
}

/* Link testuali: la linea dorata si riempie di inchiostro al passaggio. */
.cso-soft .text-link,
.cso-soft .cso-home-link,
.cso-soft .small-link,
.cso-soft .cso-home-dealers__link {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 1px;
  transition: background-size .55s var(--cso-ease-out), color .3s ease;
}
@media (hover: hover) and (pointer: fine) {
  .cso-soft .text-link:hover,
.cso-soft .cso-home-link:hover,
.cso-soft .small-link:hover,
.cso-soft .cso-home-dealers__link:hover { background-size: 100% 1px; }
}

/* ---------- Schede: profondità e sollevamento ---------- */
.cso-soft .cso-home-service,
.cso-soft .cso-home-line,
.cso-soft .cso-home-priority,
.cso-soft .cso-reviews__card,
.cso-soft .cso-line-card,
.cso-soft .cso-dealer-tile {
  transition: transform .6s var(--cso-ease-out), box-shadow .6s var(--cso-ease-out), border-color .3s ease, background-color .3s ease;
}
@media (hover: hover) and (pointer: fine) {
  .cso-soft .cso-home-service:hover,
.cso-soft .cso-home-line:hover,
.cso-soft .cso-reviews__card:hover,
.cso-soft .cso-line-card:hover,
a.cso-dealer-tile:hover {
    transform: translateY(-4px); box-shadow: var(--cso-shadow-lift);
  }
  .cso-soft .cso-home-priority:hover { box-shadow: var(--cso-shadow-lift); }
}

/* Fotografie principali leggermente sospese sul fondo (solo foto a pieno formato). */
.cso-soft .hero-figure .image-frame,
.cso-soft .about-figure img,
.cso-soft .cso-page-hero__figure:not(.cso-page-hero__figure--contain) .cso-photo__image {
  box-shadow: var(--cso-shadow-media);
}
.cso-soft .cso-home-service__image img,
.cso-soft .cso-home-line__image img,
.cso-soft .cso-line-card__image img,
.cso-soft .cso-diamond-editorial__image,
.cso-soft .about-figure img {
  transition: transform .9s var(--cso-ease-out);
}

/* Pannelli scuri: luce morbida a strati, senza cambiarne il colore. */
.cso-soft .cso-home-feature__panel,
.cso-soft .cso-home-dealers__features,
.cso-soft .cso-wa-process,
.cso-soft .cso-page-hero--ink .cso-page-hero__grid {
  background-image:
    radial-gradient(120% 90% at 100% 0%, rgba(172, 187, 198, .14), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(255, 255, 255, .05), transparent 60%);
}

/* Separatori più delicati nella fascia dei numeri. */
.cso-soft .cso-home-trust__value { transition: color .4s ease; }

/* ---------- Comparsa allo scorrimento ---------- */
.cso-soft .cso-pv { opacity: 0; transform: translate3d(0, 28px, 0); }
.cso-soft .cso-pv.cso-pv--in {
  opacity: 1; transform: none;
  transition: opacity .9s var(--cso-ease-out) var(--cso-d, 0s), transform 1.1s var(--cso-ease-out) var(--cso-d, 0s);
}
.cso-soft .cso-pv.cso-pv--media { transform: translate3d(0, 36px, 0) scale(.985); }
.cso-soft .cso-pv.cso-pv--media.cso-pv--in { transform: none; }
.cso-soft .cso-pv[data-reveal].is-revealed { animation: none !important; }

/* ---------- Ingresso della prima schermata (solo arrivo da fuori sito) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .cso-logo-entry body[data-motion="true"] :is(.hero-copy, .cso-page-hero__copy) > * {
    animation: cso-rise 1s var(--cso-ease-out) backwards;
  }
  .cso-logo-entry body[data-motion="true"] :is(.hero-copy, .cso-page-hero__copy) > :nth-child(1) { animation-delay: .15s; }
  .cso-logo-entry body[data-motion="true"] :is(.hero-copy, .cso-page-hero__copy) > :nth-child(2) { animation-delay: .23s; }
  .cso-logo-entry body[data-motion="true"] :is(.hero-copy, .cso-page-hero__copy) > :nth-child(3) { animation-delay: .31s; }
  .cso-logo-entry body[data-motion="true"] :is(.hero-copy, .cso-page-hero__copy) > :nth-child(4) { animation-delay: .39s; }
  .cso-logo-entry body[data-motion="true"] :is(.hero-copy, .cso-page-hero__copy) > :nth-child(5) { animation-delay: .47s; }
  .cso-logo-entry body[data-motion="true"] :is(.hero-copy, .cso-page-hero__copy) > :nth-child(n+6) { animation-delay: .55s; }
  .cso-logo-entry body[data-motion="true"] :is(.hero-figure, .cso-page-hero__figure) {
    animation: cso-media-in 1.4s var(--cso-ease-out) .1s backwards;
  }
  .cso-logo-entry body[data-motion="true"] .hero-figure .hero-image {
    animation: cso-zoom-settle 2.2s var(--cso-ease-out) .1s backwards;
  }
}
@keyframes cso-rise { from { opacity: 0; transform: translate3d(0, 22px, 0); } to { opacity: 1; transform: none; } }
@keyframes cso-media-in { from { opacity: 0; clip-path: inset(6% 4% 6% 4% round 22px); } to { opacity: 1; clip-path: inset(0 0 0 0 round 0); } }
@keyframes cso-zoom-settle { from { scale: 1.12; } to { scale: var(--cso-media-scale, 1); } }

/* ---------- Parallasse leggera (desktop) ---------- */
.cso-parallax-on .hero-figure .hero-image { --cso-media-scale: 1.07; scale: var(--cso-media-scale); translate: 0 var(--cso-py, 0px); will-change: translate; }

/* ---------- Immagini: dissolvenza al caricamento ---------- */
.cso-soft img.cso-img-wait { opacity: 0; }
.cso-soft img.cso-img-ready { opacity: 1; transition: opacity .8s var(--cso-ease-soft); }

/* ---------- Passaggio fluido tra le pagine (Chrome, Edge, Safari 18+) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .cso-soft .cso-header-wrapper { view-transition-name: cso-header; }
  ::view-transition-old(root) { animation: cso-vt-out .28s var(--cso-ease-soft) both; }
  ::view-transition-new(root) { animation: cso-vt-in .5s var(--cso-ease-out) both; }
  ::view-transition-group(cso-header) { animation-duration: 0s; }
}
@keyframes cso-vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes cso-vt-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Accessibilità: movimento ridotto ---------- */
@media (prefers-reduced-motion: reduce) {
  .cso-soft .cso-pv,
.cso-soft .cso-pv.cso-pv--media { opacity: 1 !important; transform: none !important; }
  .cso-soft img.cso-img-wait { opacity: 1; }
  .cso-soft .cso-header-wrapper.cso-is-hidden { transform: none; }
  .cso-parallax-on .hero-figure .hero-image { scale: 1; translate: none; }
  .cso-soft .button:hover,
.cso-soft .cso-home-service:hover,
.cso-soft .cso-home-line:hover,
.cso-soft .cso-reviews__card:hover,
.cso-soft .cso-line-card:hover,
a.cso-dealer-tile:hover { transform: none !important; }
}
body:not([data-motion="true"]) .cso-pv { opacity: 1; transform: none; }
