/* ============================================
   Scroll Animations & Effects
   ============================================ */

/* --- Fade In Up --- */
.animate {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children — scalato a 12 figli con incremento piu fluido (0.08s) */
.animate-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.animate-stagger.visible > *:nth-child(1)  { transition-delay: 0.08s; }
.animate-stagger.visible > *:nth-child(2)  { transition-delay: 0.16s; }
.animate-stagger.visible > *:nth-child(3)  { transition-delay: 0.24s; }
.animate-stagger.visible > *:nth-child(4)  { transition-delay: 0.32s; }
.animate-stagger.visible > *:nth-child(5)  { transition-delay: 0.40s; }
.animate-stagger.visible > *:nth-child(6)  { transition-delay: 0.48s; }
.animate-stagger.visible > *:nth-child(7)  { transition-delay: 0.56s; }
.animate-stagger.visible > *:nth-child(8)  { transition-delay: 0.64s; }
.animate-stagger.visible > *:nth-child(9)  { transition-delay: 0.72s; }
.animate-stagger.visible > *:nth-child(10) { transition-delay: 0.80s; }
.animate-stagger.visible > *:nth-child(11) { transition-delay: 0.88s; }
.animate-stagger.visible > *:nth-child(12) { transition-delay: 0.96s; }

.animate-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* --- Counter Animation --- */
.count-up {
  display: inline-block;
}

/* --- Fade In --- */
.fade-in {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
}

/* --- Slide In Left --- */
.slide-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-left.visible {
  opacity: 1;
  transform: translateX(0);
}

/* --- Slide In Right --- */
.slide-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* --- Scale In --- */
.scale-in {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* --- Pulse accent element --- */
@keyframes pulse-accent {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 163, 90, 0.4); }
  50% { box-shadow: 0 0 0 15px rgba(196, 163, 90, 0); }
}

.pulse {
  animation: pulse-accent 2s infinite;
}

/* --- Float --- */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.float {
  animation: float 3s ease-in-out infinite;
}

/* --- Logo spin on hover --- */
.logo img {
  transition: transform 0.5s ease;
}

.logo:hover img {
  transform: rotateY(180deg);
}

/* --- Nav link underline animation --- */
@keyframes nav-underline {
  from { width: 0; }
  to { width: 100%; }
}

/* --- Button ripple effect --- */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

/* --- Card hover shine effect --- */
.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.card:hover::after {
  left: 100%;
}

.card {
  position: relative;
  overflow: hidden;
}

/* --- Smooth page transitions --- */
.page-transition {
  animation: pageIn 0.4s ease;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   STEP D additions: fade-up, refined scale-in, lift-on-hover,
   float-slow, settle-in, .is-visible companion to .visible.
   Tutto additivo — non rimuove utility precedenti.
   ============================================================ */

/* --- Fade Up (opacity + translateY 20→0) --- */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  will-change: opacity, transform;
}
.fade-up.is-visible,
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Fade In (durata leggermente piu corta del default 0.8s) --- */
.fade-in.is-visible { opacity: 1; }

/* --- Scale In (refinement: piu sottile, 0.96→1) --- */
.scale-in {
  transform: scale(0.96);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.scale-in.is-visible,
.scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* --- Lift on Hover utility (cards / tiles / interactive blocks) --- */
.lift-on-hover {
  transition: transform var(--t-base, 220ms) cubic-bezier(0.22, 0.61, 0.36, 1),
              box-shadow var(--t-base, 220ms) ease;
  will-change: transform;
}
.lift-on-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--elevation-2, 0 6px 18px rgba(0,0,0,0.12));
}

/* --- Float Slow (depth shapes hero) --- */
@keyframes float-slow {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(8px, -12px, 0) scale(1.04); }
  66%      { transform: translate3d(-6px, 6px, 0) scale(0.98); }
}
.float-slow { animation: float-slow 14s ease-in-out infinite; }

/* --- Settle In (editorial kinetic title) --- */
@keyframes settle-in-kf {
  0%   { opacity: 0; transform: scale(1.02) translateY(6px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.settle-in {
  transform-origin: 0% 50%;
  animation: settle-in-kf 0.8s ease-out both;
}

/* --- Reduced motion fallback (esplicito per le utility Step D) --- */
@media (prefers-reduced-motion: reduce) {
  .fade-up,
  .scale-in,
  .settle-in {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
  .float-slow { animation: none !important; }
  .lift-on-hover:hover { transform: none !important; }
}
