/* ==========================================================================
   N Capital — effetti "wow" del gestionale (sopra a motion.css)
   aurora sullo sfondo, schede in 3D con riflesso, bordo luminoso che gira,
   transizioni tra le pagine, titoli che si compongono, costellazione nel benvenuto,
   evidenziazione che scivola nel menu, onda al clic, coriandoli sui successi.
   Con «riduci movimento» attivo resta tutto fermo.
   ========================================================================== */

@property --nc-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

/* ---------- aurora sullo sfondo ---------- */
html.nc-aurora-on { background: var(--nc-bg, #f4f7fc); }
html.nc-aurora-on:not(.dark) .fi-body { background: transparent !important; }
#nc-aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
#nc-aurora i { position: absolute; display: block; border-radius: 50%; will-change: transform; }
#nc-aurora .a1 { width: 62vmax; height: 62vmax; left: -18vmax; top: -24vmax; background: radial-gradient(circle, rgba(47, 107, 240, .28), transparent 62%); animation: nc-drift1 26s ease-in-out infinite alternate; }
#nc-aurora .a2 { width: 58vmax; height: 58vmax; right: -20vmax; top: 10vh; background: radial-gradient(circle, rgba(15, 180, 135, .22), transparent 62%); animation: nc-drift2 32s ease-in-out infinite alternate; }
#nc-aurora .a3 { width: 50vmax; height: 50vmax; left: 25vw; bottom: -30vmax; background: radial-gradient(circle, rgba(124, 92, 255, .16), transparent 62%); animation: nc-drift3 38s ease-in-out infinite alternate; }
#nc-aurora .cur { width: 46vmax; height: 46vmax; left: 0; top: 0; margin: -23vmax 0 0 -23vmax; background: radial-gradient(circle, rgba(47, 107, 240, .14), transparent 60%); opacity: 0; transition: opacity .8s ease; }
html.nc-pointer #nc-aurora .cur { opacity: 1; }
#nc-aurora::after { /* puntinato leggero */
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(10, 26, 74, .07) 1px, transparent 1px); background-size: 26px 26px;
  mask-image: radial-gradient(ellipse at 60% 20%, #000 10%, transparent 70%); -webkit-mask-image: radial-gradient(ellipse at 60% 20%, #000 10%, transparent 70%);
}
.dark #nc-aurora .a1 { background: radial-gradient(circle, rgba(47, 107, 240, .22), transparent 62%); }
.dark #nc-aurora .a2 { background: radial-gradient(circle, rgba(15, 180, 135, .14), transparent 62%); }
.dark #nc-aurora::after { background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px); }
@keyframes nc-drift1 { to { transform: translate(14vw, 10vh) scale(1.15); } }
@keyframes nc-drift2 { to { transform: translate(-12vw, 18vh) scale(.9); } }
@keyframes nc-drift3 { to { transform: translate(-16vw, -14vh) scale(1.2); } }

/* menu laterale e barra in alto in vetro, così l'aurora si intravede */
@media (min-width: 1024px) {
  html.nc-aurora-on:not(.dark) .fi-sidebar { background: rgba(255, 255, 255, .72) !important; backdrop-filter: saturate(1.5) blur(18px); -webkit-backdrop-filter: saturate(1.5) blur(18px); }
  html.nc-aurora-on:not(.dark) .fi-sidebar-header { background: transparent !important; }
}

/* ---------- schede in 3D con riflesso (variabili messe dallo script) ---------- */
.nc-tilt { transform-style: preserve-3d; will-change: transform; }
.nc-tilt.nc-tilting { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px) scale(1.012); transition: transform .12s ease-out, box-shadow .3s ease !important; }
.nc-tilt:not(.nc-tilting) { transition: transform .7s var(--nc-ease, ease), box-shadow .45s ease; }
.nc-glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2; opacity: 0; transition: opacity .4s ease;
  background: radial-gradient(500px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .55), transparent 40%); mix-blend-mode: soft-light; }
.nc-tilting > .nc-glare { opacity: 1; }
html:not(.dark) .fi-wi-stats-overview-stat.nc-tilting { box-shadow: 0 2px 4px rgba(10, 26, 74, .04), 0 30px 50px -22px rgba(31, 63, 191, .45) !important; }

/* ---------- bordo luminoso che gira attorno alle statistiche ---------- */
.fi-wi-stats-overview-stat { position: relative; }
.fi-wi-stats-overview-stat::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none; z-index: 3;
  background: conic-gradient(from var(--nc-angle), transparent 0 55%, #2f6bf0 70%, #0fb487 82%, transparent 92%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; transition: opacity .4s ease;
}
.fi-wi-stats-overview-stat:hover::before { opacity: 1; animation: nc-spin 2.6s linear infinite; }
@keyframes nc-spin { to { --nc-angle: 360deg; } }

/* ---------- transizioni tra le pagine ---------- */
.fi-main { transition: opacity .25s ease, filter .25s ease, transform .25s ease; }
html.nc-leaving .fi-main { opacity: .25; filter: blur(6px); transform: scale(.992); }
@keyframes nc-page-in { from { opacity: 0; filter: blur(10px); transform: translateY(10px); } to { opacity: 1; filter: none; transform: none; } }
html.nc-entering .fi-main { animation: nc-page-in .6s var(--nc-ease, ease) both; }

/* ---------- titoli che si compongono parola per parola ---------- */
.nc-w { display: inline-block; white-space: pre; }
html.nc-words .nc-w { animation: nc-word .8s var(--nc-ease, ease) both; animation-delay: calc(var(--i, 0) * 55ms + 80ms); }
@keyframes nc-word { from { opacity: 0; filter: blur(8px); transform: translateY(.45em) rotateX(40deg); } to { opacity: 1; filter: none; transform: none; } }

/* ---------- costellazione nel benvenuto ---------- */
.nc-hero > canvas.nc-stars { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: .9; }

/* ---------- evidenziazione che scivola nel menu ---------- */
.fi-sidebar-nav { position: relative; }
#nc-nav-pill { position: absolute; left: 0; top: 0; z-index: 0; border-radius: 12px; pointer-events: none; opacity: 0;
  background: linear-gradient(120deg, rgba(31, 63, 191, .09), rgba(15, 180, 135, .09)); box-shadow: inset 0 0 0 1px rgba(31, 63, 191, .1);
  transition: transform .35s var(--nc-ease, ease), width .35s var(--nc-ease, ease), height .35s var(--nc-ease, ease), opacity .25s ease; }
#nc-nav-pill.on { opacity: 1; }
.dark #nc-nav-pill { background: rgba(255, 255, 255, .06); box-shadow: none; }
.fi-sidebar-item-button { position: relative; z-index: 1; }
html.nc-pill-on .fi-sidebar-item:not(.fi-sidebar-item-active) .fi-sidebar-item-button:hover { background: transparent !important; }

/* ---------- onda al clic e riflesso sui pulsanti principali ---------- */
.nc-ripple-host { position: relative; overflow: hidden; isolation: isolate; }
.nc-ripple { position: absolute; border-radius: 50%; pointer-events: none; z-index: -1; transform: scale(0); background: rgba(255, 255, 255, .45); animation: nc-ripple .65s ease-out forwards; }
@keyframes nc-ripple { to { transform: scale(1); opacity: 0; } }
.fi-btn-color-primary:not(:has(.fi-btn-badge-ctn)), .nc-btn--light { position: relative; overflow: hidden; isolation: isolate; }
.fi-btn-color-primary:not(:has(.fi-btn-badge-ctn))::after, .nc-btn--light::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; z-index: 1; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent); transform: skewX(-20deg); opacity: 0;
}
.fi-btn-color-primary:not(:has(.fi-btn-badge-ctn)):hover::after, .nc-btn--light:hover::after { opacity: 1; animation: nc-sweep .9s ease; }
@keyframes nc-sweep { from { left: -60%; } to { left: 130%; } }

/* ---------- coriandoli ---------- */
#nc-confetti { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; }

/* ---------- avatar e campanella ---------- */
.fi-topbar .fi-avatar { transition: transform .35s var(--nc-ease, ease), box-shadow .35s ease; }
.fi-topbar .fi-avatar:hover { transform: scale(1.08) rotate(-4deg); box-shadow: 0 0 0 3px rgba(47, 107, 240, .25); }
@keyframes nc-ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } }
.fi-topbar-database-notifications-btn:has(.fi-badge) svg, .fi-topbar [aria-label*="otific"]:has(.fi-badge) svg { transform-origin: 50% 10%; animation: nc-ring 2.2s ease 1s 2; }

@media (prefers-reduced-motion: reduce) {
  #nc-aurora i { animation: none !important; }
  .nc-hero > canvas.nc-stars, #nc-confetti { display: none; }
  html.nc-leaving .fi-main, html.nc-entering .fi-main, html.nc-words .nc-w { animation: none !important; opacity: 1 !important; filter: none !important; transform: none !important; }
  .fi-wi-stats-overview-stat:hover::before { animation: none; }
}
@media print { #nc-aurora, #nc-confetti, #nc-nav-pill { display: none !important; } }
