/* =========================================================
   Coro Consulenti Aziendali — stili custom + micro-animazioni
   I selettori "di base" usano :where() (specificità 0) così le
   utility Tailwind presenti nell'HTML restano sempre prioritarie.
   ========================================================= */

html { scroll-behavior: smooth; }

/* I riquadri del blog vengono mostrati/nascosti via attributo "hidden": le utility Tailwind
   di display (flex, grid, inline-flex) non devono prevalere sull'attributo. */
[hidden] { display: none !important; }

/* Fade d'ingresso della pagina + fade d'uscita (transizione tra pagine) */
body { animation: page-in .55s ease; }
body.is-leaving { opacity: 0; transition: opacity .25s ease; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

/* ============ Tipografia: peso un po' più deciso ============ */
/* Titoli e testi display in Raleway con peso pieno; le utility
   Tailwind (font-bold, font-semibold, ...) restano prioritarie grazie a :where(). */
:where(h1, h2, h3, h4, h5, h6, .font-serif) { font-weight: 800; }

/* ============ Eyebrow ============ */
:where(.eyebrow) {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #2E7D6F;
}

/* ============ Elenchi con spunta ============ */
:where(.list-check) { list-style: none; margin: 0; padding-left: 0; }
:where(.list-check > li) { position: relative; padding-left: 2rem; }
.list-check > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .12em;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 9999px;
  background-color: rgba(63, 154, 138, .18);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232E7D6F' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: .8rem;
  transition: transform .35s cubic-bezier(.2, .7, .3, 1), background-color .35s ease;
}
.list-check > li:hover::before {
  transform: scale(1.18) rotate(-8deg);
  background-color: rgba(63, 154, 138, .34);
}

/* ============ Navigazione ============ */
:where(.nav-links a) { color: #1D4460; font-weight: 600; }
:where(#mobile-menu nav > a) { color: #1D4460; font-weight: 600; }

.nav-links a { position: relative; transition: color .3s ease; }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 2px;
  border-radius: 2px;
  background: #2E7D6F;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform .4s cubic-bezier(.2, .7, .3, 1);
}
.nav-links a:hover { color: #2E7D6F; }
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); transform-origin: left center; }
#mobile-menu nav > a { transition: color .3s ease, transform .3s ease; }
#mobile-menu nav > a:hover { color: #2E7D6F; transform: translateX(4px); }
#mobile-menu nav > a.active { color: #2E7D6F; }

/* Header fisso durante lo scroll: l'header è position:fixed (vedi partials/header.html)
   e lo spazio in pagina è riservato dallo spacer. Il wrapper dell'include non deve
   quindi creare né box né contesto di posizionamento. */
[data-include$="header.html"] { display: contents; }

/* Header: ombra e sfondo al primo scroll */
.site-header { transition: box-shadow .4s ease, background-color .4s ease; }
.site-header.scrolled {
  background-color: rgba(251, 251, 251, .96);
  box-shadow: 0 14px 34px -18px rgba(20, 49, 69, .45);
}

/* Menu mobile: apertura animata + voci a cascata */
#mobile-menu:not(.hidden) { animation: menu-in .35s cubic-bezier(.2, .7, .3, 1); }
#mobile-menu:not(.hidden) nav > * { animation: menu-item-in .4s ease backwards; }
#mobile-menu:not(.hidden) nav > *:nth-child(1) { animation-delay: .04s; }
#mobile-menu:not(.hidden) nav > *:nth-child(2) { animation-delay: .09s; }
#mobile-menu:not(.hidden) nav > *:nth-child(3) { animation-delay: .14s; }
#mobile-menu:not(.hidden) nav > *:nth-child(4) { animation-delay: .19s; }
#mobile-menu:not(.hidden) nav > *:nth-child(5) { animation-delay: .24s; }
#mobile-menu:not(.hidden) nav > *:nth-child(6) { animation-delay: .29s; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes menu-item-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ============ Schede (pagina "Studio e Servizi") ============ */
.tab-btn.is-active { background-color: #1D4460; border-color: #1D4460; color: #FFFFFF; }
.tab-btn.is-active:hover { background-color: #2E7D6F; border-color: #2E7D6F; color: #FFFFFF; }

/* ============ Scroll reveal ============ */
.js .reveal { opacity: 0; transform: translateY(30px); }
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity .85s cubic-bezier(.2, .7, .3, 1), transform .85s cubic-bezier(.2, .7, .3, 1);
}
.js .reveal.delay-1.is-visible { transition-delay: .12s; }
.js .reveal.delay-2.is-visible { transition-delay: .24s; }
.js .reveal.delay-3.is-visible { transition-delay: .36s; }

/* Voci degli elenchi che entrano a cascata dopo il blocco padre */
.js .reveal .list-check > li { opacity: 0; transform: translateX(-12px); }
.js .reveal.is-visible .list-check > li { animation: li-in .55s cubic-bezier(.2, .7, .3, 1) forwards; }
.js .reveal.is-visible .list-check > li:nth-child(1) { animation-delay: .18s; }
.js .reveal.is-visible .list-check > li:nth-child(2) { animation-delay: .28s; }
.js .reveal.is-visible .list-check > li:nth-child(3) { animation-delay: .38s; }
.js .reveal.is-visible .list-check > li:nth-child(4) { animation-delay: .48s; }
.js .reveal.is-visible .list-check > li:nth-child(5) { animation-delay: .58s; }
.js .reveal.is-visible .list-check > li:nth-child(6) { animation-delay: .68s; }
@keyframes li-in { to { opacity: 1; transform: none; } }

/* ============ Immagini: zoom + riflesso al passaggio del mouse ============ */
.zoom-wrap { position: relative; }
.zoom-wrap img {
  transition: transform .9s cubic-bezier(.2, .7, .3, 1);
  will-change: transform;
}
.zoom-wrap:hover img { transform: scale(1.07); }
.zoom-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 36%, rgba(255, 255, 255, .28) 48%, transparent 62%);
  transform: translateX(-130%);
  transition: transform .95s cubic-bezier(.3, .6, .3, 1);
}
.zoom-wrap:hover::after { transform: translateX(130%); }

/* ============ Card: sollevamento al passaggio del mouse ============ */
article.reveal,
.bg-white.rounded-2xl {
  transition: opacity .85s cubic-bezier(.2, .7, .3, 1),
              transform .85s cubic-bezier(.2, .7, .3, 1),
              translate .4s cubic-bezier(.2, .7, .3, 1),
              box-shadow .4s ease;
}
article.reveal:hover,
.bg-white.rounded-2xl:hover { translate: 0 -7px; }

/* Icona della card che "reagisce" all'hover */
article .w-12.rounded-xl,
article .w-11.rounded-xl,
.bg-white .w-9.rounded-lg { transition: transform .45s cubic-bezier(.2, .7, .3, 1), background-color .3s ease, color .3s ease; }
article:hover .w-12.rounded-xl,
article:hover .w-11.rounded-xl,
.bg-white.rounded-2xl:hover .w-9.rounded-lg { transform: rotate(-6deg) scale(1.1); }

/* ============ Bottoni e link d'azione ============ */
a.inline-flex[href],
button[type="submit"] {
  transition-property: color, background-color, border-color, box-shadow, translate, transform;
  transition-duration: .35s;
  transition-timing-function: cubic-bezier(.2, .7, .3, 1);
}
a.inline-flex[href]:hover,
button[type="submit"]:hover { translate: 0 -3px; }
a.bg-teal[href]:hover,
button.bg-teal:hover { box-shadow: 0 16px 32px -12px rgba(63, 154, 138, .75); }
a.bg-brand[href]:hover { box-shadow: 0 16px 32px -12px rgba(29, 68, 96, .6); }

a.inline-flex[href] svg,
button[type="submit"] svg { transition: transform .35s cubic-bezier(.2, .7, .3, 1); }
a.inline-flex[href]:hover svg,
button[type="submit"]:hover svg { transform: translateX(5px); }

/* ============ Hero: aurora animata + badge fluttuante ============ */
.hero-glow::before {
  content: "";
  position: absolute;
  inset: -30%;
  pointer-events: none;
  background:
    radial-gradient(38% 38% at 20% 25%, rgba(127, 203, 186, .30), transparent 70%),
    radial-gradient(34% 34% at 80% 72%, rgba(63, 154, 138, .26), transparent 70%);
  animation: aurora 20s ease-in-out infinite alternate;
}
.hero-glow > * { position: relative; z-index: 1; }
@keyframes aurora {
  0%   { transform: translate3d(-4%, -3%, 0) scale(1); }
  50%  { transform: translate3d(5%, 4%, 0) scale(1.14); }
  100% { transform: translate3d(-3%, 6%, 0) scale(1.05); }
}

/* Hero: 3 foto che si alternano in dissolvenza (ciclo di 18s, 6s per foto).
   Le immagini sono impilate: la 2ª e la 3ª compaiono sopra la precedente, così
   non c'è mai un "vuoto" tra uno scatto e l'altro. Senza JS: sola animazione CSS. */
.hero-slideshow { position: relative; }
.hero-slideshow img { position: absolute; inset: 0; }
.hero-slideshow img:nth-child(2),
.hero-slideshow img:nth-child(3) { opacity: 0; }
.hero-slideshow img:nth-child(2) { animation: hero-slide-2 18s linear infinite; }
.hero-slideshow img:nth-child(3) { animation: hero-slide-3 18s linear infinite; }

@keyframes hero-slide-2 {
  0%, 27.7%      { opacity: 0; }   /* 0 → 5s   */
  33.3%, 66.6%   { opacity: 1; }   /* 6s → 12s */
  66.7%, 100%    { opacity: 0; }
}
@keyframes hero-slide-3 {
  0%, 61.1%      { opacity: 0; }   /* 0 → 11s   */
  66.6%, 94.4%   { opacity: 1; }   /* 12s → 17s */
  100%           { opacity: 0; }
}

.float-soft { animation: float-soft 6.5s ease-in-out infinite; }
@keyframes float-soft {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

/* ============ Barra di avanzamento lettura ============ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 60;
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, #2E7D6F, #7FCBBA);
}

/* ============ Torna su ============ */
.to-top {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9999px;
  background: #1D4460;
  color: #7FCBBA;
  cursor: pointer;
  z-index: 55;
  opacity: 0;
  visibility: hidden;
  translate: 0 14px;
  box-shadow: 0 14px 30px -12px rgba(20, 49, 69, .7);
  transition: opacity .35s ease, translate .35s ease, background-color .3s ease, color .3s ease;
}
.to-top.show { opacity: 1; visibility: visible; translate: 0 0; }
.to-top:hover { background: #2E7D6F; color: #FFFFFF; }

/* ============ WhatsApp flottante ============ */
/* Sta in basso a destra, appena sopra il "torna su" così i due non si sovrappongono. */
.wa-float {
  position: fixed;
  right: 1.1rem;
  bottom: 5.1rem;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  background: #25D366;
  color: #FFFFFF;
  z-index: 55;
  box-shadow: 0 14px 30px -12px rgba(20, 49, 69, .7);
  transition: opacity .35s ease, visibility .35s ease, translate .35s ease, background-color .3s ease;
}
.wa-float:hover { background: #1DA851; translate: 0 -3px; }
.wa-float svg { width: 1.6rem; height: 1.6rem; }

/* Su mobile si fa da parte quando il pulsante d'invio del modulo è a schermo. */
@media (max-width: 639px) {
  .wa-float.is-tucked { opacity: 0; visibility: hidden; pointer-events: none; }
}

/* ============ Campi form ============ */
input, select, textarea { transition: box-shadow .3s ease, border-color .3s ease, background-color .3s ease; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(63, 154, 138, .25); }

/* =========================================================
   EFFETTI "WOW" — secondo livello di animazioni.
   Tutto è agganciato a classi aggiunte da assets/main.js
   (prefisso .fx-) e si disattiva con movimento ridotto.
   ========================================================= */

/* ---- Scroll reveal: i blocchi entrano anche "a fuoco" ---- */
.js .reveal:not(.is-visible) { filter: blur(5px); }
.js .reveal.is-visible {
  filter: blur(0);
  transition: opacity .85s cubic-bezier(.2, .7, .3, 1),
              transform .85s cubic-bezier(.2, .7, .3, 1),
              filter .85s cubic-bezier(.2, .7, .3, 1);
}

/* ---- Titolo di pagina: le parole entrano a cascata ---- */
.js .fx-word { display: inline-block; }
.js .fx-split .fx-word { opacity: 0; }
.js .fx-split.is-shown .fx-word { animation: fx-word-in .85s cubic-bezier(.2, .8, .25, 1) both; }
@keyframes fx-word-in {
  from { opacity: 0; transform: translateY(.5em) rotate(1.6deg); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

/* ---- Foto: entrata "a tendina" dall'alto + micro-parallasse ---- */
.js .fx-wipe img {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.1s cubic-bezier(.2, .7, .3, 1),
              transform .9s cubic-bezier(.2, .7, .3, 1);
}
.js .fx-wipe.is-shown img { clip-path: inset(0 0 0 0); }
.js .fx-parallax { scale: 1.14; }

/* ---- Card: inclinazione 3D e alone che segue il puntatore ---- */
.js .fx-tilt { position: relative; transform-style: preserve-3d; }
/* longhand, non shorthand: così resta valido il transition-delay delle .delay-N */
.js .fx-tilt,
.js .reveal.is-visible.fx-tilt {
  transition-property: opacity, filter, transform, translate, box-shadow;
  transition-duration: .85s, .85s, .4s, .4s, .4s;
  transition-timing-function: cubic-bezier(.2, .7, .3, 1);
}
.js .fx-tilt::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .45s ease;
  background: radial-gradient(260px circle at var(--fx-x, 50%) var(--fx-y, 50%), rgba(63, 154, 138, .18), transparent 70%);
}
.js .fx-tilt.is-tilting::after { opacity: 1; }
.js .fx-tilt.is-tilting {
  transform: perspective(1000px) rotateX(var(--fx-rx, 0deg)) rotateY(var(--fx-ry, 0deg));
  box-shadow: 0 30px 58px -30px rgba(20, 49, 69, .55);
}

/* ---- Pulsanti: riflesso al passaggio, onda al clic (il "magnetismo" è in JS) ---- */
.js .fx-btn {
  position: relative;
  overflow: hidden;
  transition-property: color, background-color, border-color, box-shadow, translate, transform;
  transition-duration: .35s;
  transition-timing-function: cubic-bezier(.2, .7, .3, 1);
}
.js .fx-btn::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 45%;
  pointer-events: none;
  opacity: 0;
  transform: skewX(-18deg);
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .4), transparent);
}
.js .fx-btn:hover::after { opacity: 1; animation: fx-shine .85s cubic-bezier(.3, .6, .3, 1); }
@keyframes fx-shine { from { left: -60%; } to { left: 115%; } }

.js .fx-ripple {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, .5);
  pointer-events: none;
  transform: scale(0);
  animation: fx-ripple .6s ease-out forwards;
}
@keyframes fx-ripple { to { transform: scale(20); opacity: 0; } }

/* ---- Blocchi scuri: aurora luminosa in sottofondo ---- */
.js .fx-aurora { position: relative; overflow: hidden; }
.js .fx-aurora::before {
  content: "";
  position: absolute;
  inset: -30%;
  pointer-events: none;
  background:
    radial-gradient(40% 40% at 18% 22%, rgba(127, 203, 186, .20), transparent 70%),
    radial-gradient(36% 36% at 82% 78%, rgba(63, 154, 138, .18), transparent 70%);
  animation: aurora 24s ease-in-out infinite alternate;
}
.js .fx-aurora > * { position: relative; z-index: 1; }

/* ---- Hero: lama di luce che attraversa lentamente il riquadro ---- */
.hero-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(112deg, transparent 38%, rgba(127, 203, 186, .14) 47%, rgba(255, 255, 255, .08) 52%, transparent 62%);
  animation: fx-hero-sweep 9s ease-in-out infinite;
}
@keyframes fx-hero-sweep {
  0%        { transform: translateX(-85%); opacity: 0; }
  8%        { opacity: 1; }
  38%, 100% { transform: translateX(85%); opacity: 0; }
}

/* ---- Barra di avanzamento e "torna su": rifiniture luminose ---- */
.scroll-progress { box-shadow: 0 0 16px rgba(63, 154, 138, .75); }
.to-top svg { transition: transform .35s cubic-bezier(.2, .7, .3, 1); }
.to-top:hover svg { transform: translateY(-3px); }
.to-top.show::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid rgba(63, 154, 138, .55);
  pointer-events: none;
  animation: fx-pulse 2.8s ease-out infinite;
}
@keyframes fx-pulse {
  0%        { transform: scale(1); opacity: .8; }
  70%, 100% { transform: scale(1.45); opacity: 0; }
}

/* ---- Link del footer e campi del form ---- */
footer ul a { display: inline-block; transition: transform .3s cubic-bezier(.2, .7, .3, 1), color .3s ease; }
footer ul a:hover { transform: translateX(5px); }
.js input:focus, .js select:focus, .js textarea:focus {
  box-shadow: 0 0 0 3px rgba(63, 154, 138, .28), 0 0 26px -8px rgba(63, 154, 138, .7);
}

/* =========================================================
   AREA RISERVATA (blog-admin.html, body.no-hover-fx)
   Mentre si scrive un articolo niente effetti al passaggio del
   mouse: i riquadri non si sollevano né si inclinano e i pulsanti
   restano fermi. Tutto il resto del sito non cambia.
   ========================================================= */
.no-hover-fx article.reveal:hover,
.no-hover-fx .bg-white.rounded-2xl:hover,
.no-hover-fx a.inline-flex[href]:hover,
.no-hover-fx button[type="submit"]:hover { translate: 0 0; }
.no-hover-fx a.bg-teal[href]:hover,
.no-hover-fx button.bg-teal:hover,
.no-hover-fx a.bg-brand[href]:hover { box-shadow: none; }
.no-hover-fx a.inline-flex[href]:hover svg,
.no-hover-fx button[type="submit"]:hover svg { transform: none; }
.no-hover-fx article:hover .w-12.rounded-xl,
.no-hover-fx article:hover .w-11.rounded-xl,
.no-hover-fx .bg-white.rounded-2xl:hover .w-9.rounded-lg { transform: none; }
.no-hover-fx .list-check > li:hover::before { transform: none; background-color: rgba(63, 154, 138, .18); }
.js .no-hover-fx .fx-btn:hover::after { display: none; }

/* ============ Barra dei controlli dell'editor ============ */
.editor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  padding: .55rem .6rem;
  border: 1px solid rgba(20, 49, 69, .10);
  border-radius: .75rem .75rem 0 0;
  background-color: #ECF1F2;
}
.ed-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 2rem;
  padding: .3rem .6rem;
  border: 1px solid rgba(20, 49, 69, .14);
  border-radius: .5rem;
  background-color: #FFFFFF;
  color: #1D4460;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.ed-btn:hover { border-color: #2E7D6F; color: #2E7D6F; }
.ed-sep { width: 1px; height: 1.4rem; background-color: rgba(20, 49, 69, .14); }

/* ============ Rispetto delle preferenze di movimento ridotto ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .js .reveal:not(.is-visible) { filter: none; }
  .js .reveal .list-check > li { opacity: 1; transform: none; }
  .js .fx-split .fx-word { opacity: 1; }
  .js .fx-wipe img { clip-path: none; }
  .js .fx-parallax { scale: 1; }
  .js .fx-tilt.is-tilting { transform: none; }
  .js .fx-tilt::after,
  .js .fx-btn::after,
  .js .fx-aurora::before,
  .hero-glow::after,
  .to-top.show::before { display: none; }
}
