/*
Theme Name: Coccimiglio Group
Theme URI: https://coccimigliogroup.it
Description: Tema WordPress custom per Coccimiglio Group. Design system basato su UIkit 3, animazioni GSAP e smooth scroll Lenis. I contenuti delle pagine si gestiscono con Gutenberg, che eredita lo stesso stile tramite gli editor styles.
Version: 2.1.0
Author: Giuseppe Montesanti
Text Domain: coccimiglio-group
Tags: business, custom-colors, custom-menu, editor-style, featured-images, block-patterns
*/

/* ==========================================================================
   Effetti e interazioni (solo frontend).
   Il design system (token, base, tipografia, componenti UIkit, stili dei
   blocchi Gutenberg) vive in assets/css/base.css ed è enqueued dal tema con
   dipendenza esplicita: qui restano solo le animazioni di frontend.
   ========================================================================== */

/* ------------------------------ LENIS SMOOTH ---------------------------- */
html.lenis,
html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-stopped {
  overflow: hidden;
}

/* ------------------------------ LINK ANIMATI ---------------------------- */
.link-underline {
  position: relative;
}
.link-underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  height: 1px;
  width: 100%;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.5s var(--cg-ease);
}
.link-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left center;
}

/* I titoli del design non hanno la sottolineatura all'hover.
   Nessuna trasformazione qui: scalare l'elemento lo faceva sparire e
   ricomparire a intermittenza al passaggio del cursore. */
.cg-t-hero:hover,
.cg-t-hero:hover::after {
  text-decoration: none;
}

/* -------------------------------- MASCHERE ------------------------------ */
.mask-line {
  overflow: hidden;
  display: block;
}
.mask-line > span {
  display: block;
  will-change: transform;
}
.ml-inner {
  display: block;
}

/* ------------------------------ IMAGE REVEAL ---------------------------- */
.clip-reveal {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.2s var(--cg-ease);
}
.clip-reveal.is-in {
  clip-path: inset(0 0 0 0);
}
.img-zoom {
  overflow: hidden;
}
.img-zoom img,
.img-zoom video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--cg-ease);
}
.img-zoom:hover img,
.img-zoom:hover video {
  transform: scale(1.06);
}

/* ------------------------------ ANIMAZIONI ------------------------------ */
@keyframes cg-spin {
  to {
    transform: rotate(360deg);
  }
}
.spin-slow {
  animation: cg-spin 14s linear infinite;
}

@keyframes cg-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}
.pulse-dot {
  animation: cg-pulse 1.6s ease-in-out infinite;
  transform-origin: center;
}

/* Stato iniziale degli elementi animati da GSAP.
   Solo `.hero-reveal` parte nascosto perché main.js anima con gsap.to();
   `.reveal` viene impostato da gsap.fromTo(), così il contenuto resta
   visibile anche se il JavaScript non viene eseguito. */
.hero-reveal {
  opacity: 0;
  transform: translateY(2.5rem);
  will-change: transform, opacity;
}
.reveal {
  will-change: transform, opacity;
}

/* ------------------------------- GRAIN / NOISE -------------------------- */
.grain::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 250 250' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------------------- PAGE TRANSITION --------------------------- */
.cg-page-transition {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  background: #fff;
  clip-path: inset(0 0 100% 0);
  pointer-events: none;
}
/* Logo del gruppo centrato nella transizione (fondo bianco). */
.cg-page-transition__logo {
  display: block;
  width: auto;
  height: clamp(4rem, 14vw, 8.5rem);
}
@media (prefers-reduced-motion: reduce) {
  .cg-page-transition {
    display: none !important;
  }
}

/* ----------------------------- CUSTOM CURSOR ---------------------------- */
:root {
  --cc-z-index: 2147483640 !important;
}
#cc--main,
.cc_div,
pressidium-floating-button {
  z-index: 2147483640 !important;
}

@media (hover: hover) and (pointer: fine) {
  body.cg-has-cursor,
  body.cg-has-cursor * {
    cursor: none !important;
  }
}
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2147483647 !important;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  will-change: transform;
}
.cursor-dot {
  width: 7px;
  height: 7px;
  background: var(--cg-red);
}
.cursor-ring {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(242, 240, 235, 0.55);
  transition: width 0.35s var(--cg-ease), height 0.35s var(--cg-ease),
    background-color 0.35s, border-color 0.35s;
}
.cursor-ring.is-active {
  width: 72px;
  height: 72px;
  background: rgba(236, 1, 25, 0.16);
  border-color: var(--cg-red);
}
@media (hover: none), (pointer: coarse) {
  .cursor-dot,
  .cursor-ring {
    display: none;
  }
}
@media (max-width: 767px) {
  .cursor-dot,
  .cursor-ring {
    display: none;
  }
}

/* --------------------------- HOVER PREVIEW SERVIZI --------------------- */
#service-preview {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  display: none;
  width: 22vw;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--cg-radius);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
}
@media (min-width: 768px) {
  #service-preview {
    display: block;
  }
}
#service-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#service-preview .cg-badge {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
}

/* ---------------------------- TABULAR / MISC --------------------------- */
.tabular {
  font-variant-numeric: tabular-nums;
}
.v-center {
  display: flex;
  align-items: center;
}

/* Accessibilità: riduce il movimento su richiesta */
@media (prefers-reduced-motion: reduce) {
  .marquee-track,
  .spin-slow,
  .pulse-dot {
    animation: none !important;
  }
  .clip-reveal,
  .reveal,
  .hero-reveal {
    clip-path: none;
    opacity: 1;
    transform: none;
  }
}
