/* ==========================================================================
   PALIO DEI TERZIERI — animations.css
   Keyframes, classi reveal, stagger, reduced-motion
   ========================================================================== */

/* ─── KEYFRAMES ─────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scrollBlink {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  50%      { opacity: 1; transform: translateY(4px); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 151, 43, 0.5); }
  70%      { box-shadow: 0 0 0 14px rgba(201, 151, 43, 0); }
}
@keyframes heroReveal {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes scrollDown {
  0%, 100% { opacity: 0.5; transform: scaleY(1); transform-origin: top; }
  50%      { opacity: 0.9; }
}

/* ─── REVEAL CLASSI ─────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── STAGGER (delay progressivi) ───────────────────────────────────── */
.stagger > .reveal:nth-child(1).visible { transition-delay: 0s; }
.stagger > .reveal:nth-child(2).visible { transition-delay: 0.08s; }
.stagger > .reveal:nth-child(3).visible { transition-delay: 0.16s; }
.stagger > .reveal:nth-child(4).visible { transition-delay: 0.24s; }
.stagger > .reveal:nth-child(5).visible { transition-delay: 0.32s; }
.stagger > .reveal:nth-child(6).visible { transition-delay: 0.4s; }

/* ─── ELEMENTI ANIMATI ──────────────────────────────────────────────── */
.shimmer-line {
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(201, 151, 43, 0.3) 25%,
    var(--gold) 50%,
    rgba(201, 151, 43, 0.3) 75%,
    transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 4s linear infinite;
}

.pulse-glow {
  animation: pulseGlow 2.4s infinite;
}

.fade-in {
  animation: fadeIn 0.8s ease both;
}

/* ═══ ARTIGIANATO: TEXTURE, DROP CAP, MARQUEE, MANDALA, ARROWS ═══ */

/* Body fade-in iniziale (rapido, niente attesa) */
body {
  opacity: 0;
  animation: bodyFadeIn 0.4s ease forwards;
}
@keyframes bodyFadeIn {
  to { opacity: 1; }
}

/* Texture grana di carta su tutto il sito (subtile, percepibile su parchment) */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.07;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 0.4  0 0 0 0 0.25  0 0 0 0 0.1  0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Drop-cap: capolettera maiuscolo decorato — niente glow arancione, solo presenza tipografica */
.drop-cap::first-letter {
  font-family: 'Cinzel Decorative', serif;
  font-weight: 900;
  font-size: 4.5em;
  float: left;
  line-height: 0.9;
  margin: 0.05em 0.12em 0 0;
  color: var(--gold);
  padding: 0.05em 0.15em 0;
  background: linear-gradient(180deg, rgba(201, 151, 43, 0.14) 0%, transparent 80%);
  border-left: 3px solid var(--gold);
}
.section-bg-parchment .drop-cap::first-letter {
  color: var(--burgundy);
  background: linear-gradient(180deg, rgba(107, 21, 32, 0.10) 0%, transparent 80%);
  border-left-color: var(--burgundy);
}


/* Marquee scrolling banner */
.marquee-banner {
  background: linear-gradient(90deg, var(--burgundy) 0%, var(--ink-3) 50%, var(--burgundy) 100%);
  border-top: 1px solid rgba(201, 151, 43, 0.35);
  border-bottom: 1px solid rgba(201, 151, 43, 0.35);
  overflow: hidden;
  position: relative;
  padding: 1.1rem 0;
}
.marquee-banner::before,
.marquee-banner::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 120px;
  z-index: 2;
  pointer-events: none;
}
.marquee-banner::before {
  left: 0;
  background: linear-gradient(90deg, var(--burgundy), transparent);
}
.marquee-banner::after {
  right: 0;
  background: linear-gradient(-90deg, var(--burgundy), transparent);
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marqueeRoll 40s linear infinite;
  gap: 0;
}
.marquee-banner:hover .marquee-track { animation-play-state: paused; }
.marquee-item {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  color: var(--gold-light);
  text-transform: uppercase;
  padding: 0 2.2rem;
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
  white-space: nowrap;
  font-weight: 700;
}
.marquee-item .star {
  color: var(--gold);
  font-size: 0.75em;
  display: inline-block;
  transform: rotate(45deg);
}
.marquee-item .star::before { content: '◆'; }
.marquee-item .accent { color: var(--parchment); font-style: italic; font-family: 'EB Garamond', serif; font-weight: 500; }
@keyframes marqueeRoll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* (3D tilt e magnetic effect rimossi: card monoblocco, hover su components.css) */

/* Counter punteggio: animazione */
.punteggio-val {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
}
.punteggio-val .num {
  display: inline-block;
  min-width: 1.2em;
}

/* SVG bersaglio: arrows draw-in animation */
.target-svg .ring {
  transform-origin: 200px 200px;
  animation: ringPulse 4s ease-in-out infinite;
}
.target-svg .ring:nth-of-type(2) { animation-delay: 0.2s; }
.target-svg .ring:nth-of-type(3) { animation-delay: 0.4s; }
.target-svg .ring:nth-of-type(4) { animation-delay: 0.6s; }
@keyframes ringPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.012); }
}

.target-svg .arrow-line {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
}
.target-svg.in-view .arrow-line {
  animation: arrowDraw 0.9s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}
.target-svg.in-view .arrow-line.a2 { animation-delay: 0.25s; }
.target-svg.in-view .arrow-line.a3 { animation-delay: 0.5s; }
@keyframes arrowDraw {
  to { stroke-dashoffset: 0; }
}
.target-svg .arrow-head {
  opacity: 0;
}
.target-svg.in-view .arrow-head {
  animation: arrowHeadFade 0.4s 0.7s ease forwards;
}
.target-svg.in-view .arrow-head.a2 { animation-delay: 1s; }
.target-svg.in-view .arrow-head.a3 { animation-delay: 1.25s; }
@keyframes arrowHeadFade {
  to { opacity: 1; }
}

/* (Stemma rotation hover gestito da components.css: solo scale, niente rotate) */

/* Ornamento angolare per le sezioni parchment — ancorato alla SEZIONE
   con margine interno coerente, non più "fuori" del section-inner */
.section-bg-parchment {
  position: relative;
}
.section-bg-parchment > .section-inner::before,
.section-bg-parchment > .section-inner::after {
  content: '';
  position: absolute;
  width: 48px;
  height: 48px;
  border: 1.5px solid var(--burgundy);
  opacity: 0.35;
  pointer-events: none;
}
.section-bg-parchment > .section-inner {
  position: relative;
}
.section-bg-parchment > .section-inner::before {
  top: 0;
  left: 0;
  border-right: none;
  border-bottom: none;
}
.section-bg-parchment > .section-inner::after {
  bottom: 0;
  right: 0;
  border-left: none;
  border-top: none;
}

/* (sweep CTA rimosso, generava glitch sul transform) */

/* Stempa pin appearance: sembra appuntato a una bacheca */
.stemma-img {
  position: relative;
}

/* Section divider ornamentale (decoro hand-drawn) */
.flourish-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2rem auto;
  max-width: 400px;
  gap: 0.8rem;
}
.flourish-divider svg {
  width: 100%;
  max-width: 380px;
  height: 24px;
}

/* ─── REDUCED MOTION ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero-scroll i { animation: none; }
  body { opacity: 1; animation: none; }
  .marquee-track { animation: none; }
}
