/* =========================================================
   Loris Lodroni — Effetti avanzati
   (caricato dopo style.css)
   ========================================================= */
@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes spinAngle { to { --angle: 360deg; } }

/* texture leggera */
.bg-noise {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* testo sfumato animato */
.grad-text {
  background: linear-gradient(110deg, #4ade80, #2dd4bf, #a3e635, #4ade80);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: gradShift 7s ease-in-out infinite;
}
@keyframes gradShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* ---------- Pulsanti ---------- */
.btn { transition: transform .35s var(--ease), box-shadow .35s var(--ease), color .3s; }
.btn--primary {
  --btn-bg: var(--green-2);
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--btn-bg), var(--btn-bg)) padding-box,
    conic-gradient(from var(--angle), transparent 0% 55%, #bbf7d0 68%, #ffffff 74%, transparent 88%) border-box;
  animation: spinAngle 3.2s linear infinite;
  box-shadow: 0 8px 26px -10px rgba(34, 197, 94, .55), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn--primary:hover {
  --btn-bg: #1bb454;
  background:
    linear-gradient(var(--btn-bg), var(--btn-bg)) padding-box,
    conic-gradient(from var(--angle), transparent 0% 55%, #bbf7d0 68%, #ffffff 74%, transparent 88%) border-box;
  box-shadow: 0 16px 40px -10px rgba(34, 197, 94, .7), 0 0 0 4px rgba(34, 197, 94, .12), inset 0 1px 0 rgba(255,255,255,.25);
}

.btn--ghost {
  --btn-bg: #101314;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--btn-bg), var(--btn-bg)) padding-box,
    conic-gradient(from var(--angle), rgba(255,255,255,.14) 0 100%) border-box;
}
.btn--ghost:hover {
  --btn-bg: #14181a;
  background:
    linear-gradient(var(--btn-bg), var(--btn-bg)) padding-box,
    conic-gradient(from var(--angle), rgba(255,255,255,.12) 0%, #4ade80 12%, #2dd4bf 22%, rgba(255,255,255,.12) 36%, rgba(255,255,255,.12) 100%) border-box;
  animation: spinAngle 2.4s linear infinite;
  box-shadow: 0 12px 30px -14px rgba(34, 197, 94, .45);
}

/* riflesso che attraversa il pulsante */
.btn::after {
  content: ""; position: absolute; top: 0; left: -80%; width: 50%; height: 100%; z-index: -1;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), transparent);
  transform: skewX(-22deg); pointer-events: none;
}
.btn:hover::after { left: 130%; transition: left .85s var(--ease); }

/* testo che scorre verso l'alto */
.btn__label { display: inline-block; overflow: hidden; height: 1.3em; line-height: 1.3; vertical-align: middle; }
.btn__roll { display: block; position: relative; transition: transform .5s var(--ease); }
.btn__roll::after { content: attr(data-text); position: absolute; left: 0; top: 100%; }
.btn:hover .btn__roll { transform: translateY(-100%); }

/* ripple al click */
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none; z-index: -1;
  background: radial-gradient(circle, rgba(255,255,255,.35), transparent 70%);
  transform: scale(0); animation: ripple .7s var(--ease) forwards;
}
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

.nav a:not(.btn) { transition: color .3s, transform .3s var(--ease); }

/* ---------- Cursore ---------- */
.cursor-ring, .cursor-dot { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 10000; opacity: 0; transition: opacity .3s; }
body.cursor-on .cursor-ring, body.cursor-on .cursor-dot { opacity: 1; }
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.cursor-ring { width: 36px; height: 36px; margin: -18px 0 0 -18px; }
.cursor-ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(255,255,255,.35);
  transition: transform .35s var(--ease), background .3s, border-color .3s;
}
.cursor-ring.is-hover::before { transform: scale(1.7); border-color: var(--green-line); background: rgba(34,197,94,.07); }
.cursor-ring.is-down::before { transform: scale(.8); }

/* ---------- Transizione pagine a colonne ---------- */
.page-transition { background: none; border: 0; transform: none !important; display: flex; pointer-events: none; transition: none; }
.page-transition.active { pointer-events: all; }
.page-transition i {
  flex: 1; background: #121617; box-shadow: inset 1px 0 0 rgba(255,255,255,.03);
  transform: scaleY(0); transform-origin: bottom;
  transition: transform .6s var(--ease);
}
.page-transition i:nth-child(2) { transition-delay: .05s; }
.page-transition i:nth-child(3) { transition-delay: .1s; }
.page-transition i:nth-child(4) { transition-delay: .15s; }
.page-transition i:nth-child(5) { transition-delay: .2s; }
.page-transition[data-dir="top"] i { transform-origin: top; }
.page-transition.active i { transform: scaleY(1); }
.page-transition.no-anim i, .page-transition.no-anim .page-transition__logo { transition: none !important; }
.page-transition__logo {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -40%); opacity: 0; white-space: nowrap;
  font-family: var(--display); font-size: clamp(1.6rem, 4vw, 2.6rem); font-weight: 700; letter-spacing: -.02em;
  transition: opacity .3s, transform .5s var(--ease);
}
.page-transition__logo b { color: var(--green); }
.page-transition.active .page-transition__logo { opacity: 1; transform: translate(-50%, -50%); transition-delay: .3s; }

/* ---------- Torna su con anello di progresso ---------- */
.to-top .to-top__ring { position: absolute; inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); transform: rotate(-90deg); }
.to-top__ring circle { fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 144.5; stroke-dashoffset: 144.5; transition: stroke-dashoffset .15s linear; }

/* ---------- Hero: fasci di luce e spotlight ---------- */
.beams { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 40%, transparent); mask-image: linear-gradient(180deg, #000 40%, transparent); }
.beams i {
  position: absolute; top: -35%; width: 1px; height: 35%;
  background: linear-gradient(180deg, transparent, rgba(74, 222, 128, .8) 85%, #fff);
  animation: beam var(--t) linear var(--d) infinite; opacity: .55;
}
.beams i::after { content: ""; position: absolute; bottom: -2px; left: -2px; width: 5px; height: 5px; border-radius: 50%; background: #bbf7d0; box-shadow: 0 0 12px 3px rgba(74,222,128,.6); }
@keyframes beam { to { transform: translateY(420%); } }
.spotlight {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .6s;
  background: radial-gradient(600px circle at var(--sx, 50%) var(--sy, 50%), rgba(34, 197, 94, .09), transparent 60%);
}

/* bordo luminoso rotante (code window, card, progetti) */
.code-window { position: relative; }
.code-window::before,
.card::after,
.project::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 3;
  background: conic-gradient(from var(--angle), transparent 0% 65%, rgba(74,222,128,.85) 80%, rgba(45,212,191,.6) 86%, transparent 95%);
  -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);
  animation: spinAngle 4s linear infinite;
}
.code-window::before { animation-duration: 5s; }
.card::after, .project::after { opacity: 0; transition: opacity .5s; animation: none; }
.card:hover::after, .project:hover::after { opacity: 1; animation: spinAngle 4s linear infinite; }
.card.form::after { display: none; }

/* tilt 3D: risposta rapida mentre il mouse è sopra */
[data-tilt].tilting,
.card[data-reveal].revealed.tilting,
.project[data-reveal].revealed.tilting { transition: transform .15s ease-out, border-color .4s, box-shadow .5s var(--ease); }

/* ---------- Marquee a doppia riga ---------- */
.marquee { display: grid; gap: 18px; }
.marquee__track--reverse { animation-direction: reverse; animation-duration: 46s; }
.marquee__item--outline { color: transparent; -webkit-text-stroke: 1px #3a4244; font-size: 1.6rem; }
.marquee__item--outline:hover { color: var(--text); -webkit-text-stroke-color: transparent; }

/* ---------- Bento ---------- */
.bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.bento--wide { grid-column: span 2; }
.bento__item { padding: 32px; display: flex; flex-direction: column; }
.bento__item h3 { margin-bottom: 10px; }
.bento__kicker { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--green); margin-bottom: 10px; }
.bento--perf { flex-direction: row; align-items: center; gap: 36px; }
.bento__text { flex: 1; }
.bento__pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.bento__pills span { font-size: .78rem; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-strong); color: #c9d1ce; }

.gauge { position: relative; width: 190px; height: 190px; flex-shrink: 0; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 8; }
.gauge__track { stroke: var(--surface-2); }
.gauge__fill { stroke: var(--green); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 2.2s var(--ease) .3s; filter: drop-shadow(0 0 6px rgba(34,197,94,.6)); }
.revealed .gauge__fill { stroke-dashoffset: 0; }
.gauge__value { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge__value strong { font-family: var(--display); font-size: 3rem; line-height: 1; }
.gauge__value span { font-size: .75rem; color: var(--muted); margin-top: 6px; }

.bento--term { grid-row: span 2; }
.term { margin-top: 18px; flex: 1; border-radius: 12px; background: #0b0e0f; border: 1px solid var(--border-strong); overflow: hidden; display: flex; flex-direction: column; min-height: 240px; }
.term__bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.term__bar i { width: 9px; height: 9px; border-radius: 50%; background: #2a3032; }
.term__bar i:nth-child(1) { background: #ff5f57; }
.term__bar i:nth-child(2) { background: #febc2e; }
.term__bar i:nth-child(3) { background: #28c840; }
.term__bar span { margin-left: auto; font-family: var(--mono); font-size: .7rem; color: var(--muted); }
.term__body { padding: 14px 16px; font-family: var(--mono); font-size: .8rem; line-height: 1.9; }
.term__line { animation: fadeUp .35s var(--ease); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term__line--cmd { color: #e5e9e7; }
.term__line--ok { color: #4ade80; }
.term__line--live { color: #2dd4bf; }
.term__body::after { content: ""; display: inline-block; width: 7px; height: 14px; background: var(--green); vertical-align: -2px; animation: blink 1s steps(1) infinite; }

.radar, .shield, .bars { position: relative; height: 90px; margin-bottom: 22px; }
.radar { width: 90px; }
.radar span { position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--green-line); animation: radar 3s var(--ease) infinite; opacity: 0; }
.radar span:nth-child(2) { animation-delay: 1s; }
.radar span:nth-child(3) { animation-delay: 2s; }
.radar i { position: absolute; left: 39px; top: 39px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 16px var(--green); }
@keyframes radar { 0% { transform: scale(.15); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

.shield { width: 90px; color: var(--text); overflow: hidden; border-radius: 12px; }
.shield svg { width: 90px; height: 90px; transition: color .4s; }
.card:hover .shield svg { color: var(--green); }
.shield__scan { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--green), transparent); box-shadow: 0 0 12px var(--green); animation: scan 2.4s ease-in-out infinite; }
@keyframes scan { 0%, 100% { top: 6%; } 50% { top: 90%; } }

.bars { display: flex; align-items: flex-end; gap: 7px; }
.bars i { width: 12px; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, var(--green), rgba(34,197,94,.15)); transform-origin: bottom; animation: eq 1.6s ease-in-out infinite; }
.bars i:nth-child(1) { height: 40%; animation-delay: -.2s; }
.bars i:nth-child(2) { height: 70%; animation-delay: -.5s; }
.bars i:nth-child(3) { height: 55%; animation-delay: -.9s; }
.bars i:nth-child(4) { height: 90%; animation-delay: -.3s; }
.bars i:nth-child(5) { height: 60%; animation-delay: -1.1s; }
.bars i:nth-child(6) { height: 80%; animation-delay: -.7s; }
.bars i:nth-child(7) { height: 45%; animation-delay: -1.3s; }
@keyframes eq { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.45); } }

/* ---------- Dettagli extra ---------- */
.stat strong { transition: text-shadow .4s; }
.stat:hover strong { text-shadow: 0 0 24px rgba(34,197,94,.45); }
.hero__badge { position: relative; overflow: hidden; }
.hero__badge::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); transform: translateX(-100%); animation: badgeShine 4s var(--ease) infinite 1.5s; }
@keyframes badgeShine { 40%, 100% { transform: translateX(100%); } }
.logo__mark { transition: transform .5s var(--ease), border-color .3s; }
.logo:hover .logo__mark { transform: rotate(-8deg) scale(1.06); border-color: var(--green-line); }

@media (max-width: 1024px) {
  .bento { grid-template-columns: 1fr 1fr; }
  .bento--term { grid-row: auto; }
}
@media (max-width: 640px) {
  .bento { grid-template-columns: 1fr; }
  .bento--wide { grid-column: auto; }
  .bento--perf { flex-direction: column-reverse; align-items: flex-start; }
  .gauge { width: 150px; height: 150px; }
}
/* ---------- Anteprime reali dei siti nel portfolio ---------- */
.shot {
  position: absolute; inset: 14px 14px 0; display: flex; flex-direction: column;
  border-radius: 10px 10px 0 0; overflow: hidden; background: #0b0e0f;
  border: 1px solid var(--border-strong); border-bottom: 0;
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, .9);
}
.project__media:has(.shot) { background: radial-gradient(circle at 50% 0%, #1b2124, #0d1011 75%); }
.shot__bar { display: flex; align-items: center; gap: 5px; padding: 8px 10px; background: #151a1b; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.shot__bar i { width: 7px; height: 7px; border-radius: 50%; background: #2a3032; }
.shot__bar i:nth-child(1) { background: #ff5f57; }
.shot__bar i:nth-child(2) { background: #febc2e; }
.shot__bar i:nth-child(3) { background: #28c840; }
.shot__bar span { margin-left: 8px; font-family: var(--mono); font-size: .66rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shot img { flex: 1; width: 100%; min-height: 0; object-fit: cover; object-position: top center; display: block; transition: transform 1.2s var(--ease); transform-origin: top center; }
.project:hover .shot img { transform: scale(1.06); }

/* ---------- Barra in alto: sfocatura su uno strato a parte ----------
   Il backdrop-filter applicato direttamente a .header "imprigiona" gli elementi
   position:fixed al suo interno (il menu mobile a schermo intero): lo sposto
   su uno pseudo-elemento, così il menu copre sempre tutta la pagina. */
.header.scrolled { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.header::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: rgba(10, 12, 13, 0.78);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  opacity: 0; transition: opacity .4s;
}
.header.scrolled::before { opacity: 1; }

/* ---------- Selettore lingua ---------- */
.header .nav { margin-left: auto; }
.lang-switch {
  position: relative; z-index: 1002; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 2px; padding: 4px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: rgba(255,255,255,.03);
  transition: border-color .3s;
}
.lang-switch:hover { border-color: var(--green-line); }
.lang-switch button { font-family: var(--mono); font-size: .78rem; font-weight: 700; letter-spacing: .06em; padding: 6px 11px; border-radius: 999px; color: var(--muted); transition: color .25s, background .25s, box-shadow .25s; }
.lang-switch button:hover { color: var(--text); }
.lang-switch button.active { background: var(--green-2); color: #fff; box-shadow: 0 4px 14px -6px rgba(34,197,94,.7); }
@media (max-width: 860px) {
  .header .nav { margin-left: 0; }
  .lang-switch { margin-left: auto; }
}
/* ---------- Modulo contatti: errori e campo anti-bot ---------- */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__error { display: none; margin-bottom: 18px; padding: 14px 16px; border-radius: 12px; font-size: .9rem; line-height: 1.55; color: #fecaca; background: rgba(239, 68, 68, .1); border: 1px solid rgba(239, 68, 68, .35); }
.form__error.show { display: block; animation: fadeUp .4s var(--ease); }
.form__error a { color: #fff; text-decoration: underline; }

@media (hover: none) { .cursor-ring, .cursor-dot { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .beams, .cursor-ring, .cursor-dot { display: none; }
}
