:root {
  --bg: #0e141b;
  --text: #e6edf3;
  --cardW: min(90vw, 480px);
  --cardH: 62vh;
  --radius: 20px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #0f0f0f;
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  min-height: calc(var(--vh, 1vh) * 100);
  padding: 0;
  margin: 0;
  overflow-x: hidden; /* evita overflow orizzontale */
}

/* --- Home Section --- */
.home {
  background-color: #0f0f0f;
  width: 100%;
  max-width: 480px;
  min-height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  position: relative;
  z-index: 2; /* sopra il canvas */
  padding: 2rem 1.5rem;
  padding-bottom: calc(2rem + var(--safe-bottom));
}

/* --- Branding --- */
.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.site-name {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.tagline p {
  font-size: 1.3rem;
  font-weight: 500;
  opacity: 0.9;
  line-height: 1.4;
  display: block;
  margin: 0.3rem 0;
  text-align: left;
}

/* --- GIF Frame --- */
.gif-frame {
  width: 100%;
  height: calc((var(--vh) * 65) - var(--safe-bottom)); /* proporzione base */
  max-height: clamp(480px, 68vh, 720px); /* limite dinamico */
  min-height: 340px;
  background-color: #161b22;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: height 0.4s ease, max-height 0.4s ease;
}

.preview-gif {
  width: 100%;
  height: 100%;
  object-fit: cover; /* riempie il frame senza deformarsi */
  border-radius: 14px;
  display: block;
}

/* Arrows container */
.arrows {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.5rem; /* leggero margine interno */
  margin-top: clamp(12px, 3vh, 40px); /* spostamento proporzionale */
  margin-bottom: calc(8px + var(--safe-bottom));
}

/* Arrows */
.arrow {
  width: 32px;
  height: auto;
  opacity: 0.85;
  filter: brightness(0) invert(1) drop-shadow(0 0 6px rgba(255, 255, 255, 0.25));
  transition: opacity 0.2s ease;
}

.scroll-text {
  color: var(--text);
  font-size: 0.9rem;
  letter-spacing: 0.8px;
  opacity: 0.8;
  text-transform: uppercase;
  font-weight: 500;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.15));
}

.arrows:hover .arrow,
.arrows:hover .scroll-text {
  opacity: 1;
}

/* Stile base pulsanti header (inizialmente nascosti su mobile) */
.hero-actions {
  display: none;
}

.hero-btn {
  text-decoration: none;
  color: var(--text); /* Prende il colore del testo della home */
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.6rem 1.4rem;
  border: 1px solid rgba(230, 237, 243, 0.25); /* Bordo sottilissimo ed elegante */
  border-radius: 50px; /* Pill shape */
  transition: all 0.3s ease;
  background: transparent;
  white-space: nowrap;
}

/* Hover effect pulito */
.hero-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(230, 237, 243, 0.8);
  transform: translateY(-2px);
}

/* Tocco specifico per Fiverr (opzionale: verde leggero al passaggio) */
.fiverr-link:hover {
  border-color: #1dbf73;
  color: #1dbf73;
  background: rgba(29, 191, 115, 0.1);
}
/* --- My Approach Section --- */
.approach {
  color: var(--text);
  width: 100%;
  min-height: calc(var(--vh, 1vh) * 100); /* copre l’intero schermo */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0vh 1.5rem;
  box-sizing: border-box;
  position: relative;
  z-index: 1; /* sopra il serpente */
  background: transparent; /* lascia visibile il background generale */
  overflow: hidden; /* così le particelle restano dentro */
}

#approachParticles {
  position: absolute;
  inset: 0;
  width: 400% !important;
  height: 800% !important;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}

/* Titolo */
.approach-title {
  display: flex;
  flex-direction: column;
  text-align: left;
  font-size: clamp(4.4rem, 12vw, 6rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 2.4rem;
}

.approach-title span {
  display: block;
}

/* Testo */
.approach-content p {
  font-size: 1.3rem;
  line-height: 1.7;
  opacity: 0.9;
  margin-bottom: 1.2rem;
}

/* Evidenzia le keyword */
.approach-content strong {
  color: #93c5fd; /* blu chiaro tech */
  font-weight: 500;
}

#dotGrid {
  width: 100%;
  height: calc(var(--vh) * 68);
  display: block;
  border-radius: 14px;
  background-color: #0f0f0f;
}

/* Evita che il testo si tagli su schermi molto piccoli */
@media (max-height: 600px) {
  .approach {
    height: auto;
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
}

/* device bassi */
@media (max-height: 700px) {
  .gif-frame {
    height: 56vh;
  }
}

/* iPhone Pro Max, Galaxy Ultra, display alti */
@media (min-height: 850px) {
  .gif-frame {
    height: 75vh;
  }
}

/* tablet verticali, desktop stretti, schermi molto alti */
@media (min-height: 1000px) {
  .gif-frame {
    height: 82vh;
  }
}
@media (min-height: 1200px) {
  .gif-frame {
    height: 88vh;
  }
}

@media (min-height: 720px) and (max-height: 780px) {
  .gif-frame {
    max-height: clamp(340px, 64vh, 480px); /* GIF leggermente più corta */
  }
  .arrows {
    margin-top: clamp(8px, 2.5vh, 24px); /* frecce un po’ più vicine */
  }
}

@keyframes tracking-in-expand-fwd-bottom {
  0% {
    letter-spacing: -0.5em;
    transform: translateZ(-700px) translateY(500px);
    opacity: 0;
  }
  40% {
    opacity: 0.6;
  }
  100% {
    transform: translateZ(0) translateY(0);
    opacity: 1;
  }
}

.tracking-in-expand-fwd-bottom {
  animation: tracking-in-expand-fwd-bottom 1s
    cubic-bezier(0.215, 0.61, 0.355, 1) both;
}

.animated-text {
  opacity: 0; /* invisibile fino a quando entra */
  display: inline-block;
  will-change: transform, opacity;
}

@keyframes logo-glow-once {
  0% {
    text-shadow: 0 0 0px rgba(147, 197, 253, 0);
  }
  100% {
    text-shadow: 0 0 5px rgba(147, 197, 253, 0.8),
      0 0 7px rgba(147, 197, 253, 0.4);
  }
}

.site-name.glow-on {
  animation: logo-glow-once 1s ease-out forwards;
}

/* --- Timeline --- */
.timeline {
  position: relative;
  margin-top: 2rem;
  padding: 2rem 0;
  width: 100%;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, #5227ff 0%, #ffd84d 100%);
  border-radius: 3px;
  opacity: 0.3;
}

.timeline-item {
  position: relative;
  width: 100%;
  margin: 3.5rem 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.timeline-icon {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -10px);
  background: radial-gradient(circle, #ffd84d 0%, #5227ff 90%);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(255, 216, 77, 0.4);
  transition: box-shadow 0.4s ease, transform 0.4s ease;
}

.timeline-icon img {
  width: 32px;
  height: 32px;
  filter: brightness(1.1);
  transition: transform 0.4s ease;
}

/* glowing animation */
.timeline-item.visible .timeline-icon {
  box-shadow: 0 0 20px rgba(255, 216, 77, 0.7), 0 0 40px rgba(82, 39, 255, 0.3);
  transform: translate(-50%, -10px) scale(1.15);
}
.timeline-item.visible .timeline-icon img {
  transform: scale(1.2);
}

.timeline-content {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 1.8rem;
  width: 45%;
  box-shadow: 0 0 20px rgba(82, 39, 255, 0.15);
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s ease-out;
}

.timeline-content h3 {
  color: #ffd84d;
  font-size: 1.4rem;
  margin-bottom: 0.8rem;
}

.timeline-content p {
  color: var(--text);
  line-height: 1.7;
  font-size: 1.1rem;
  opacity: 0.9;
}

.timeline-content.left {
  align-self: flex-start;
  transform-origin: right;
}

.timeline-content.right {
  align-self: flex-end;
  transform-origin: left;
}

.timeline-content.show {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile */
@media (max-width: 768px) {
  .timeline::before {
    left: 28px;
  }

  .timeline-icon {
    left: 28px;
    transform: translateY(-10px);
  }

  .timeline-content {
    width: 80%;
    margin-left: 3rem;
  }

  .timeline-content.left,
  .timeline-content.right {
    transform-origin: center;
  }
}

.flip-section {
  position: relative;
  height: calc(var(--vh, 1vh) * 100);
  margin-top: calc(var(--vh, 1vh) * -10);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  perspective: 1200px; /* aumenta un po' la profondità */
  overflow: hidden;
}

.flip-card {
  width: 95%;
  max-width: 500px;
  height: 80vh;
  position: sticky;
  top: 10vh;
  perspective: 1000px;
  padding: 2rem 1.5rem;
}

.flip-card-inner {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
  transition: none; /* niente transizioni CSS */
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  inset: 0; /* assicura che entrambi i lati occupino la stessa area */
  border-radius: 24px;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.flip-card-back {
  transform: rotateY(180deg);
}

.flip-card-front {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  align-items: flex-start; /* testo in alto */
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  font-size: 1.8rem;
  color: #1a1a1a;
  font-weight: 600;
  background: linear-gradient(
    135deg,
    #f6e27a,
    #cfae63 30%,
    #d4af37 70%,
    #b68d40
  );
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 25px rgba(255, 255, 255, 0.1),
    0 0 40px rgba(215, 180, 60, 0.25);
}

/* Luce mobile sopra il gradiente */
.flip-card-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 40%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0) 60%
  );
  transform: translateX(-100%);
  animation: lightSweepSmooth 6s ease-in-out infinite;
  will-change: transform;
}

@keyframes lightSweepSmooth {
  0% {
    transform: translateX(-100%) skewX(-10deg);
  }
  50% {
    transform: translateX(100%) skewX(-10deg);
  }
  100% {
    transform: translateX(-100%) skewX(-10deg);
  }
}

/* Testo inciso */
.engrave-clean {
  position: relative;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #00000020; /* quasi trasparente, serve solo come base */
  user-select: none;

  /* INCISIONE NITIDA */
  text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.45),
    /* ombra interna (nitida, zero blur) */ 0px -1px 0px rgba(255, 255, 255, 0.6); /* luce sul bordo superiore */
}

.flip-card-back {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff2ff;
  font-size: 1.6rem;
  font-weight: 600;
  background: linear-gradient(135deg, #6b00b8 0%, #2d004d 100%);
  overflow: hidden;
  transform: rotateY(180deg) translateZ(0);
  -webkit-backface-visibility: hidden;
  contain: layout paint style;
}

.spotlight-layer {
  position: absolute;
  inset: 0;
  transform: translateZ(0);
  background: radial-gradient(
    circle,
    rgba(255, 0, 150, 0.35) 0%,
    rgba(255, 180, 60, 0.25) 20%,
    rgba(255, 0, 150, 0.15) 40%,
    rgba(255, 0, 150, 0) 70%
  );
  background-size: 200% 200%;
  mix-blend-mode: screen;
  pointer-events: none;
  will-change: background-position;
  z-index: 0;
}

.flip-card-back h2 {
  position: relative;
  z-index: 1;
}

.flip-card-back::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 60px rgba(255, 0, 150, 0.25),
    inset 0 0 90px rgba(255, 200, 80, 0.15), 0 0 80px rgba(255, 0, 150, 0.15);
  pointer-events: none;
}

.flip-card-back::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 0, 150, 0.35) 0%,
    rgba(255, 180, 60, 0.25) 25%,
    rgba(255, 0, 150, 0) 70%
  );
  mix-blend-mode: screen;
  border-radius: 50%;
  will-change: transform;
}

/* Responsività mobile */
@media (max-width: 768px) {
  .flip-card {
    width: 100%;
    top: 5vh;
    border-radius: 0;
  }

  .flip-card-inner,
  .flip-card-front,
  .flip-card-back {
    border-radius: 24px;
  }
}

.back-content {
  position: relative;
  z-index: 2;
  padding: 2.2rem 1.8rem;
  max-width: 95%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-align: left;
}

.back-title {
  font-size: clamp(1.4rem, 4.5vw, 1.8rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

/* layout righe */
.back-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}

.emoji {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.back-line {
  font-size: 0.98rem;
  line-height: 1.6;
  max-width: 100%;
}

/* highlight parola chiave */
.back-line .highlight {
  font-weight: 600;
  color: #ffd84d;
}

/* resto frase */
.back-line .rest {
  opacity: 0;
}

/* separatore */
.back-separator {
  height: 1px;
  width: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 216, 77, 0.5),
    rgba(255, 0, 150, 0.1)
  );
  transform-origin: left;
  transform: scaleX(0);
  opacity: 0;
}

/* stati iniziali per animazioni */
.back-title,
.back-item {
  opacity: 0;
  transform: translateY(10px);
}

/* quando il back viene "attivato" da JS */
.flip-card-back.back-animate .back-title {
  animation: backTitleIn 0.35s ease-out forwards;
}

.flip-card-back.back-animate .back-item {
  animation: backItemIn 0.5s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

.flip-card-back.back-animate .back-line .rest {
  animation: backRestIn 0.45s ease-out forwards;
  animation-delay: calc(var(--delay, 0s) + 0.15s);
}

.flip-card-back.back-animate .back-separator {
  animation: separatorIn 0.4s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

/* keyframes */
@keyframes backTitleIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes backItemIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes backRestIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes separatorIn {
  from {
    opacity: 0;
    transform: scaleX(0);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

/* mobile: un po' più arioso */
@media (max-width: 768px) {
  .back-content {
    padding: 2rem 1.4rem;
  }

  .back-line {
    font-size: 0.96rem;
  }
}

/* SEZIONE */
.ongoing-section {
  width: 100%;
  color: var(--text);
  padding: 0 1.5rem 2rem;
  margin-top: 2.5rem;
}

/* TITOLO SPEZZATO */
.ongoing-title {
  display: flex;
  flex-direction: column;
  text-align: left;
  font-size: clamp(4.4rem, 12vw, 6rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 2.4rem;
}

.tech-tags {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.tech-tags span {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: monospace; /* Tocco "Developer" */
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Animazione apple style */
.ongoing-card.card-visible {
  opacity: 1;
  transform: translateY(0);
}

.contact-cta {
  width: 100%;
  padding: 4rem 1.5rem 10rem;
  text-align: center;
  position: relative;
  overflow: visible;
  min-height: calc(100vh + 400px);
}

.cta-split-title {
  display: flex;
  flex-direction: column;
  text-align: left;
  font-size: clamp(3.5rem, 10vw, 5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 2.4rem;
  color: var(--text);
}

.cta-split-title span {
  display: block;
}

/* CTA BUTTONS — VERSIONE DEFINITIVA */
.cta-buttons {
  display: flex;
  flex-direction: column;
  gap: 2.6rem; /* più aria */
  align-items: flex-start;
}

/* Base */
.cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem; /* più spazio tra testo e icona */

  width: 100%;
  max-width: 420px; /* più largo */
  padding: 1.8rem 2.2rem; /* più alto e più pieno */

  text-decoration: none;
  font-weight: 700;
  color: #fff;

  border-radius: 26px; /* forma più morbida */
  line-height: 1;

  font-size: 1.45rem; /* più grande */

  transition: transform 0.28s ease, opacity 0.28s ease, box-shadow 0.38s ease,
    gap 0.28s ease;
}

/* Icona */
.btn-icon {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  display: block; /* evita che il browser calcoli male la trasparenza */
  image-rendering: auto;
}

.cta-btn img {
  mix-blend-mode: normal;
  background-color: transparent;
}

/* Hover */
.cta-btn:hover {
  transform: translateY(-6px);
  opacity: 0.97;
  gap: 1.1rem;
}

.cta-btn:hover .btn-icon {
  transform: translateX(4px);
}

.cta-btn:active {
  transform: scale(0.96);
}

/* LIGHT SWEEP + GRADIENT SHIFT COMBINATI */
.primary-btn,
.fiverr-btn {
  position: relative;
  overflow: hidden;
}

/* Light sweep */
.primary-btn::after,
.fiverr-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0) 40%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0) 60%
  );
  transform: translateX(-140%);
  transition: transform 1.4s ease; /* molto più lenta */
  pointer-events: none;
}

.primary-btn:hover::after,
.fiverr-btn:hover::after {
  transform: translateX(140%);
}

/* GRADIENT SHIFT LENTO */
.primary-btn {
  background: linear-gradient(135deg, #5227ff, #8b5cff, #5227ff);
  background-size: 350% 350%; /* movimento più ampio */
  animation: gradientMove 8s ease-in-out infinite; /* prima era 3s */
}

.fiverr-btn {
  background: linear-gradient(135deg, #0f8e55, #1dbf73, #0f8e55);
  background-size: 350% 350%;
  animation: gradientMove 8s ease-in-out infinite;
}

/* Keyframes più morbidi */
@keyframes gradientMove {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Stato iniziale */
.big-btn {
  opacity: 0;
  transform: translateY(24px);
}

/* Quando visibili */
.big-btn.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.55s ease-out, transform 0.55s ease-out;
}

/* effetto cascata */
.big-btn:nth-child(1).visible {
  transition-delay: 0.1s;
}
.big-btn:nth-child(2).visible {
  transition-delay: 0.25s;
}

/* Sezione ironica sotto i bottoni */

/* Titolo spezzato come "My / Projects" */
.about-quote {
  display: flex;
  flex-direction: column;
  text-align: left;
  font-size: clamp(3.6rem, 11vw, 5rem);
  font-weight: 700;
  line-height: 1.05;
  color: var(--text);
  opacity: 0;
  margin-top: 10rem;
  transform: translateY(0px); /* SPAZIO SOTTO LE SPARKLES */
  transition: opacity 0.7s ease;
}

.about-quote.visible {
  opacity: 1;
}

/* Migliora la leggibilità */
.about-quote span:last-child {
  opacity: 0.75;
}

#sparkCanvas {
  position: absolute;
  inset: 0;
  top: 0%;
  height: 100%;
  width: 100%;
  pointer-events: none;
  z-index: 0;
}

@media (min-width: 500px) {
  #sparkCanvas {
    height: 100%; /* invece di 130% */
    top: -10%;
  }
}

.contact-cta > * {
  position: relative;
  z-index: 2;
}

/* === DEV CARD FINALE === */

.dev-card {
  margin-top: 2.8rem;
  width: 100%;
  max-width: 480px;
  padding: 1.8rem 1.6rem 2.2rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
  /* ... le tue regole esistenti ... */

  /* Aggiungi questo pattern a griglia sottile sopra il colore di fondo */
  background-image: linear-gradient(
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px; /* Dimensione dei quadrati */
  background-position: center center;
}

/* --- CSS AGGIORNATO CON EFFETTO MAGNETICO --- */

/* --- HEADER "MAGNETIC BLACK HOLE" (Fixed Shield) --- */

/* --- HEADER "STRETCHING BLACK HOLE" --- */

.dev-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 2rem;
  padding-top: 1.5rem;
  position: relative;
  z-index: 10;
}

.dev-label {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 2.5rem;
  font-weight: 500;
  order: 1;
}

/* CONTENITORE (Fermo) */
.photo-container {
  order: 2;
  position: relative;
  width: 150px;
  height: 150px;
  margin-bottom: 2rem;
  border-radius: 50%;
  z-index: 1;
}

/* SETUP COMUNE PER I DUE ANELLI */
.glow-static,
.glow-dynamic {
  position: absolute;
  inset: -15px; /* Sborda di 15px */
  border-radius: 50%;
  filter: blur(12px); /* La sfocatura li fonde insieme */
}

/* DEFINIZIONE DEL GRADIENTE (M87*) PER ENTRAMBI */
.glow-static::before,
.glow-dynamic::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    #5e0b0b 10%,
    #ff4500 40%,
    #ffd700 50%,
    #ff4500 60%,
    #5e0b0b 90%,
    transparent 100%
  );
  animation: blackhole-spin 10s linear infinite;
}

/* 1. ANELLO STATICO (La base che non si muove mai) */
.glow-static {
  z-index: -1; /* Sotto lo scudo */
  opacity: 0.8; /* Base solida */
}

/* 2. ANELLO DINAMICO (Quello che si sposta) */
.glow-dynamic {
  z-index: -2; /* Sotto l'anello statico */
  /* Transizione elastica per la deformazione */
  transition: transform 0.1s linear;
  /* Variabili JS */
  transform: translate(var(--x, 0px), var(--y, 0px));
  opacity: 1;
}

/* 3. SCUDO NERO STATICO */
.static-shield {
  position: absolute;
  inset: 0;
  background: #000;
  border-radius: 50%;
  z-index: 1; /* Copre i centri degli anelli */
  pointer-events: none;
}

/* 4. FOTO */
.dev-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  position: relative;
  z-index: 2;
  border: 2px solid #000;
}

@keyframes blackhole-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Testi */
.dev-name {
  order: 3;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.5rem 0;
}
.dev-role {
  order: 4;
  font-size: 1.15rem;
  color: #ffd84d;
  font-weight: 500;
  opacity: 0.9;
}

/* Tabs */
.dev-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.dev-tab {
  border: none;
  outline: none;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(230, 237, 243, 0.85);
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease,
    transform 0.18s ease;
}

.dev-tab.active {
  background: linear-gradient(135deg, #ffb700, #e5a300);
  color: #ffffff;
  box-shadow: 0 0 10px #ffd9ac;
  transform: translateY(-1px);
}

/* Swipe panels */
.dev-panels-wrapper {
  overflow: hidden;
  width: 100%;
}

.dev-panels {
  display: flex;
  width: 100%;
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
}

.dev-panel {
  min-width: 100%;
  padding-right: 0.3rem;
  text-align: left;
}

.dev-panel h4 {
  font-size: 1.05rem;
  margin-bottom: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
}

.dev-panel p {
  font-size: 0.98rem;
  line-height: 1.7;
  opacity: 0.9;
  margin-bottom: 0.6rem;
}

.dev-panel strong {
  color: #ffd84d;
  font-weight: 600;
}

/* Lista stack */
.dev-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0;
  margin: 0;
}

.dev-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dev-list li span:first-child {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffd84d;
}

.dev-list li span:last-child {
  font-size: 0.95rem;
  opacity: 0.88;
}

/* Piccola resa desktop 
@media (min-width: 768px) {
  .contact-cta {
    max-width: 600px;
  }

  .dev-card {
    margin-left: auto;
    margin-right: auto;
  }
}*/

/* --- Nascondi le frecce extra su Mobile --- */
.arrow.desktop-only {
  display: none;
}

/* =========================================
   DESKTOP HERO LAYOUT (min-width: 1024px)
   ========================================= */
/* =================================================================
   🖥️ DESKTOP STANDARD (min-width: 720px)
   ================================================================= */
@media (min-width: 720px) {
  /* --- 1. HOME --- */
  .home {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: auto 1fr auto;
    height: 100vh;
    padding: 1.5rem 3rem 2rem;
    align-items: center;
    max-width: 100%;
    gap: 1rem;
    overflow: hidden;
  }

  .hero-actions {
    /* Mostriamoli su desktop */
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Allineati a destra */
    gap: 1rem; /* Spazio tra i due tasti */

    /* GRID PLACEMENT: Colonne da 10 a 12 (Angolo in alto a destra) */
    grid-column: 10 / -1;
    grid-row: 1;

    z-index: 10;
  }
  .brand,
  .gif-wrapper {
    display: contents;
  }

  .site-name {
    grid-column: 1 / 4;
    grid-row: 1;
    font-size: 2rem;
    margin: 0;
    align-self: center;
    justify-self: start;
    z-index: 10;
  }
  .tagline {
    grid-column: 4 / 10;
    grid-row: 1;
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 2rem;
    align-items: center;
    z-index: 10;
  }
  .tagline p {
    font-size: 1rem;
    margin: 0;
    white-space: nowrap;
  }

  .gif-frame {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    height: 100%;
    max-height: 80vh;
    border-radius: 24px;
    object-fit: cover;
    z-index: 1;
  }

  .arrows {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    z-index: 10;
  }
  .arrow.desktop-only {
    display: block;
  }
  #dotGrid {
    height: 100% !important;
    width: 100% !important;
    border-radius: 24px;
  }

  /* --- 2. MY APPROACH (Orizzontale) --- */
  .approach-title span {
    display: inline !important; /* Ora può finalmente stare accanto al resto */
  }
  .approach {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    padding: 4rem 0;
    max-width: 100%;
    overflow: hidden;
    align-items: start;
    position: relative; /* Assicura che il canvas stia qui dentro */
    isolation: isolate; /* Crea un nuovo contesto di stacking */
  }
  #approachParticles {
    position: absolute;
    inset: 0;
    width: 100% !important; /* Sovrascrive il 400% del mobile */
    height: 100% !important; /* Sovrascrive l'800% del mobile */
    z-index: -1 !important; /* Forza lo sfondo dietro al testo */
    opacity: 1 !important; /* Le rendiamo visibili */
    pointer-events: none;
  }
  .approach-title {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 5rem;
    margin-bottom: 4rem;
    position: relative;
    z-index: 2;
    display: block !important; /* Disabilita la modalità colonna flessibile */
  }

  .timeline {
    grid-column: 2 / 12;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 0;
    padding-top: 4rem;
    width: 100%;
  }
  .timeline::before {
    width: 100%;
    height: 3px;
    top: 25px;
    left: 0;
    transform: none;
    background: linear-gradient(90deg, #5227ff 0%, #ffd84d 100%);
  }
  .timeline-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    width: 100%;
    height: 100%;
  }
  .timeline-icon {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    margin: 0;
  }
  .timeline-content {
    width: 90%;
    margin-top: 3.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    transform: none !important;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
  }
  .timeline-content:hover {
    transform: translateY(-10px) !important;
    box-shadow: 0 10px 30px rgba(82, 39, 255, 0.15);
  }

  /* --- 3. WHAT CAN I DO (Flip -> Bento Grid) --- */
  .flip-section {
    height: auto !important;
    min-height: 100vh;
    padding: 8rem 0;
    perspective: none !important;
    overflow: visible !important;
    display: block !important;
    background-color: #0f0f0f;
  }
  .flip-card {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    height: auto !important;
    position: static !important;
  }
  .flip-card-inner {
    transform: none !important;
    transform-style: flat !important;
    width: 100%;
    height: auto !important; /* AGGIUNTO !important per vincere sul 100% mobile */
    display: block !important; /* Assicura che si comporti come un blocco solido */
  }
  .flip-card-front {
    display: none !important;
  }
  .flip-card-back {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;

    /* LE RIGHE MANCANTI CHE CAUSANO IL TAGLIO: */
    height: auto !important; /* Costringe il fondo ad allungarsi */
    overflow: visible !important; /* Disabilita il taglio ereditato dal mobile */
    min-height: 100vh; /* Opzionale: assicura che copra almeno lo schermo */
  }
  .flip-card-back::before,
  .flip-card-back::after,
  .spotlight-layer {
    display: none !important;
  }

  .back-content {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    padding: 0 2rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
  }
  .back-title {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 5rem;
    color: #fff;
    margin-bottom: 5rem;
  }
  .back-separator {
    display: none;
  }

  /* CARD MOSAICO (Geometria 8 Item) */
  /* --- MAGIC BENTO CARD (Desktop Only) --- */
  @media (min-width: 720px) {
    /* Container della griglia - deve permettere il passaggio del mouse */
    .back-content {
      /* ... tue regole esistenti (grid, gap, ecc) ... */
      padding: 2rem; /* Assicurati che ci sia spazio per muovere il mouse */
    }

    /* --- MAGIC BENTO GRID REFINED (Desktop Only) --- */
    @media (min-width: 720px) {
      .back-content {
        display: grid;
        grid-template-columns: repeat(12, 1fr);
        grid-auto-rows: minmax(120px, auto); /* Altezza minima uniforme */
        gap: 1.5rem;
        padding: 2rem;
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
      }

      .back-item {
        position: relative;
        /* Sfondo scurissimo, quasi nero (stile screenshot 2) */
        background: rgba(10, 10, 12, 0.85);
        border-radius: 16px;
        /* Bordo base quasi invisibile */
        border: 1px solid rgba(255, 255, 255, 0.08);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 1.5rem;
        transition: transform 0.2s ease, border-color 0.3s ease;

        /* Variabili init */
        --mouse-x: -1000px;
        --mouse-y: -1000px;
      }

      /* --- 1. SPOTLIGHT EFFECT (La torcia) --- */
      /* Usa un gradiente radiale che segue il mouse */
      .back-item::before {
        content: "";
        position: absolute;
        inset: 0;
        /* Gradiente Viola scuro molto soft */
        background: radial-gradient(
          600px circle at var(--mouse-x) var(--mouse-y),
          rgba(82, 39, 255, 0.15),
          transparent 40%
        );
        z-index: 0;
        opacity: 0;
        transition: opacity 0.3s;
      }

      /* Bordo luminoso che segue il mouse */
      .back-item::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: 16px;
        padding: 1px;
        background: radial-gradient(
          400px circle at var(--mouse-x) var(--mouse-y),
          rgba(255, 255, 255, 0.4),
          transparent 40%
        );
        -webkit-mask: linear-gradient(#fff 0 0) content-box,
          linear-gradient(#fff 0 0);
        -webkit-mask-composite: xor;
        mask-composite: exclude;
        z-index: 1;
        opacity: 0;
      }

      /* Attiva luci su hover del container */
      .back-content:hover .back-item::before,
      .back-content:hover .back-item::after {
        opacity: 1;
      }

      /* --- 2. CONTENUTO CARD --- */
      .back-item > * {
        position: relative;
        z-index: 2; /* Sopra le luci */
      }

      /* --- 3. SPARKLES (Le particelle generate da JS) --- */
      .bento-sparkle {
        position: absolute;
        border-radius: 50%;
        pointer-events: none;
        z-index: 1;
        /* Animazione di uscita */
        animation: floatAndFade 1s ease-out forwards;
        box-shadow: 0 0 6px currentColor; /* Effetto glow */
      }

      @keyframes floatAndFade {
        0% {
          opacity: 1;
          transform: scale(0) translate(0, 0);
        }
        50% {
          opacity: 1;
          transform: scale(1);
        }
        100% {
          opacity: 0;
          transform: scale(0) translate(var(--dest-x, 10px), -20px); /* Sale verso l'alto */
        }
      }

      /* --- 4. LAYOUT BENTO (Ripristino dimensioni) --- */
      /* Riga 1 */
      .back-item:nth-child(2) {
        grid-column: span 7;
      }
      .back-item:nth-child(4) {
        grid-column: span 5;
      }

      /* Riga 2 */
      .back-item:nth-child(6) {
        grid-column: span 4;
      }
      .back-item:nth-child(8) {
        grid-column: span 4;
      }
      .back-item:nth-child(10) {
        grid-column: span 4;
      }

      /* Riga 3 */
      .back-item:nth-child(12) {
        grid-column: span 4;
      }
      .back-item:nth-child(14) {
        grid-column: span 4;
      }
      .back-item:nth-child(16) {
        grid-column: span 4;
      }

      /* Tipografia interna per il look "Clean" */
      .back-line .highlight {
        color: #e6edf3; /* Bianco sporco invece di oro puro */
        text-shadow: 0 0 10px rgba(82, 39, 255, 0.4);
      }

      .emoji {
        filter: drop-shadow(0 0 15px rgba(255, 216, 77, 0.2));
      }
    }
    .back-line {
      flex: 1;
      min-width: 0;
    }
    .back-line .highlight {
      font-size: 1.3rem;
      margin-bottom: 0.3rem;
      display: block;
    }
    .back-line .rest {
      font-size: 0.95rem;
      line-height: 1.4;
    }
    .back-item:hover {
      transform: translateY(-5px);
      background: rgba(255, 255, 255, 0.08);
    }
    .flip-card-back.back-animate .back-title,
    .flip-card-back.back-animate .back-item {
      animation: none !important;
    }

    /* --- 4. MY PROJECTS --- */
    .ongoing-section {
      display: grid;
      grid-template-columns: repeat(12, 1fr);
      padding: 6rem 2rem;
      width: 100%;
      max-width: 1400px;
      margin: 0 auto;
      align-items: start;
    }
    .ongoing-title {
      grid-column: 1 / -1;
      font-size: 5rem;
      margin-bottom: 5rem;
      display: block !important; /* Disabilita la colonna flex mobile */
      text-align: center !important;
    }

    .ongoing-title span {
      display: inline !important; /* Forza lo span a stare sulla stessa riga */
    }

    .tech-tags {
      display: flex;
      gap: 0.8rem;
      flex-wrap: wrap;
    }

    .tech-tags span {
      font-size: 0.8rem;
      color: rgba(255, 255, 255, 0.6);
      background: rgba(255, 255, 255, 0.03);
      padding: 4px 10px;
      border-radius: 6px;
      font-family: monospace; /* Tocco "Developer" */
      border: 1px solid rgba(255, 255, 255, 0.05);
    }

    /* --- 5. CONTACT & ABOUT --- */
    .contact-cta {
      display: grid;
      grid-template-columns: repeat(12, 1fr);
      padding: 4rem 2rem 8rem;
      width: 100%;
      max-width: 1400px;
      margin: 0 auto;
      align-items: center;
      position: relative;
      z-index: 1;
    }

    #sparkCanvas {
      position: absolute;
      top: -20px;
      left: -150px;
      width: 150% !important;
      height: 800% !important;
      grid-column: 1 / -1;
      grid-row: 1 / -1;
      z-index: -1;
      pointer-events: none;
      transform: none !important;
    }

    .cta-split-title {
      grid-column: 1 / -1;
      text-align: center;
      align-items: center;
      font-size: 5rem;
      margin-bottom: 4rem;
    }
    .cta-buttons {
      grid-column: 1 / -1;
      display: flex;
      flex-direction: row;
      justify-content: center;
      margin-bottom: 10rem;
      align-items: center !important; /* Assicura allineamento verticale perfetto */
      gap: 2rem !important; /* Spazio pulito tra i due */
    }
    .cta-btn {
      width: 320px !important; /* Forza entrambi alla stessa larghezza esatta */
      max-width: 320px !important; /* Evita espansioni */
      justify-content: center !important;
      padding: 1.8rem 0 !important;
    }

    .cta-btn:hover {
      /* Blocchiamo il gap! 
       Impediamo che lo spazio tra testo e icona si allarghi durante il movimento */
      gap: 0.9rem !important;

      /* Manteniamo solo il movimento verticale pulito */
      transform: translateY(-6px) !important;
    }

    /* Opzionale: Se vuoi che solo l'icona si muova un po', è più elegante */
    .cta-btn:hover .btn-icon {
      transform: translateX(6px) !important;
    }
    .about-quote {
      grid-column: 1 / -1;
      text-align: center;
      font-size: 4rem;
      margin-top: 2rem;
      margin-bottom: 4rem;
    }
    /* =========================================
     DEV CARD LAYOUT "PASSPORT" (Desktop)
     ========================================= */

    /* ... dentro @media (min-width: 720px) ... */

    /* 1. CONFIGURAZIONE CARD (Start: Trasparente e Senza Bordi) */
    /* ... dentro @media (min-width: 720px) ... */

    .dev-card {
      /* --- Layout Grid --- */
      grid-column: 1 / -1 !important;
      justify-self: center !important;
      display: grid !important;
      grid-template-columns: 280px 1fr !important;
      grid-template-rows: auto 1fr !important;
      width: 95% !important;
      max-width: 1100px !important;
      margin: 0 auto !important;
      margin-top: 1rem !important;
      box-sizing: border-box !important;
      position: relative !important;
      z-index: 50 !important;

      /* --- RESET TOTALE --- */
      background: transparent !important; /* Inizialmente trasparente */
      border: none !important;
      box-shadow: none !important;
      color: transparent; /* Testo invisibile all'inizio */

      /* Fondamentale: Il raggio deve essere applicato qui per i figli */
      border-radius: 24px;

      /* Transizione per il riempimento finale dello sfondo */
      transition: background-color 0.5s ease 1s,
        /* Ritardo 1s (dopo i laser) */ box-shadow 0.5s ease 1s,
        color 0.5s ease 1s;
      /* ... le tue regole esistenti ... */

      /* Aggiungi questo pattern a griglia sottile sopra il colore di fondo */
      background-image: linear-gradient(
          rgba(255, 255, 255, 0.03) 1px,
          transparent 1px
        ),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
      background-size: 40px 40px; /* Dimensione dei quadrati */
      background-position: center center;
    }

    /* --- I DUE LASER (Pseudo-elementi) --- */
    /* Usiamo ::before e ::after per creare i bordi curvi perfetti */

    .dev-card::before,
    .dev-card::after {
      content: "";
      position: absolute;
      inset: 0; /* Copre tutta la card */
      border-radius: 24px; /* SEGUE LA CURVA PERFETTAMENTE */
      padding: 2px; /* SPESSORE DEL LASER */

      /* TRUCCO PER IL BORDO GRADIENTE CURVO */
      /* Maschera il centro per lasciare solo il bordo */
      -webkit-mask: linear-gradient(#fff, #fff) content-box,
        linear-gradient(#fff, #fff);
      -webkit-mask-composite: xor;
      mask-composite: exclude;

      pointer-events: none;
      opacity: 1;
    }

    /* 1. LASER VIOLA (Parte Alta + Sinistra) */
    .dev-card::before {
      /* Gradiente continuo: Viola -> Bianco -> Viola */
      background: linear-gradient(
        135deg,
        #5227ff 0%,
        #ffffff 50%,
        #5227ff 100%
      );

      /* PARTENZA: Nascosto nell'angolo in alto a sinistra */
      /* Tagliamo via tutto tranne l'angolo 0,0 */
      clip-path: inset(0 100% 100% 0);

      /* Preparazione animazione */
      transition: clip-path 1.2s cubic-bezier(0.19, 1, 0.22, 1);
      z-index: 1;
    }

    /* 2. LASER ORO (Parte Bassa + Destra) */
    .dev-card::after {
      /* Gradiente continuo: Oro -> Bianco -> Oro */
      background: linear-gradient(
        135deg,
        #ffd84d 0%,
        #ffffff 50%,
        #ffd84d 100%
      );

      /* PARTENZA: Nascosto nell'angolo in basso a destra */
      clip-path: inset(100% 0 0 100%);

      /* Preparazione animazione */
      transition: clip-path 1.2s cubic-bezier(0.19, 1, 0.22, 1);
      z-index: 1;
    }

    /* --- GESTIONE CONTENUTO INTERNO --- */
    /* Nascondiamo figli (testi/foto) finché i laser non hanno finito */
    .dev-card > * {
      opacity: 0;
      transform: scale(0.98);
      transition: opacity 0.5s ease 1s, transform 0.5s ease 1s; /* Delay 1s */
    }

    /* ==============================================
   QUANDO IL JS AGGIUNGE LA CLASSE .active
   ============================================== */
    /* --- SOSTITUISCI QUESTO BLOCCO (circa riga 1515) --- */
    /* Sostituisci questo blocco in style.css (nella sezione Desktop) */
    .dev-card.active {
      /* SOLUZIONE 1: Usa un colore molto scuro (quasi nero) con alta opacità (0.9 o 0.95) */
      /* Questo scurisce lo sfondo e fa risaltare il contenuto */
      background-color: rgba(10, 12, 16, 0.95) !important;

      box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6) !important; /* Ombra leggermente più forte */
      color: #e6edf3;

      /* SOLUZIONE 2: Griglia color ORO (il tuo #ffd84d) ma molto trasparente (0.1) */
      background-image: linear-gradient(
          rgba(255, 216, 77, 0.1) 1px,
          transparent 1px
        ),
        linear-gradient(90deg, rgba(255, 216, 77, 0.1) 1px, transparent 1px) !important;

      background-size: 40px 40px !important;
      background-position: center center !important;
      background-repeat: repeat !important;
    }

    /* Animazione Laser: Si aprono coprendo tutto il perimetro */
    .dev-card.active::before {
      /* Rivela tutto il bordo Viola (Top/Left dominant) */
      clip-path: inset(0 0 0 0);
    }

    .dev-card.active::after {
      /* Rivela tutto il bordo Oro (Bottom/Right dominant) */
      clip-path: inset(0 0 0 0);
    }

    /* Apparizione contenuto */
    .dev-card.active > * {
      opacity: 1;
      transform: scale(1);
    }

    /* --- COLONNA SINISTRA (Header + Laser Verticale) --- */
    /* Questa parte rimane uguale perché funzionava bene */
    /* --- HEADER & LINEA DIVISORIA (FIX DEFINITIVO) --- */

    /* 1. Contenitore Header */
    .dev-header {
      grid-column: 1;
      grid-row: 1 / 5;
      display: flex !important;
      flex-direction: column !important;
      align-items: center !important;
      justify-content: center !important; /* Centrato verticalmente è più elegante */
      margin: 0 !important;
      padding: 0 !important;
      padding-right: 2rem !important; /* Spazio dalla linea */
      border-right: none !important;
      position: relative !important; /* FONDAMENTALE per ancorare la linea */
    }

    /* 2. La Linea Divisoria (Unica, pulita e sfumata) */
    /* Sostituisce sia il ::before che il ::after che avevi prima */
    .dev-header::after {
      content: "";
      position: absolute;

      /* Posizionamento: A destra, ma staccata dai bordi sopra/sotto */
      top: 0%;
      bottom: 10%;
      right: 0;

      width: 3px; /* Sottile */

      /* IL GRADIENTE: Invisibile alle estremità, colorato al centro */
      background: linear-gradient(
        to bottom,
        rgba(82, 39, 255, 0) 0%,
        /* Inizio trasparente */ #5227ff 20%,
        /* Viola */ #ffd84d 80%,
        /* Oro */ rgba(255, 216, 77, 0) 100% /* Fine trasparente */
      );

      /* Stato Iniziale: Invisibile (schiacciata) */
      transform: scaleY(0);
      transform-origin: top; /* Si srotola dall'alto */
      opacity: 0.7; /* Leggermente trasparente per non disturbare */

      /* Transizione CSS (più fluida dei keyframes) */
      transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    }

    /* 3. L'attivazione (Quando la CARD diventa active) */
    .dev-card.active .dev-header::after {
      transform: scaleY(1); /* Si allunga al 100% */

      /* Parte DOPO che i laser della card hanno finito il giro */
      transition-delay: 1.2s;
    }

    @keyframes drawLine {
      0% {
        transform: scaleY(0);
      }
      100% {
        transform: scaleY(1);
      }
    }
    @keyframes laserStrike {
      0% {
        transform: scaleY(0);
        opacity: 1;
      }
      40% {
        transform: scaleY(1);
        opacity: 1;
      }
      70% {
        transform: scaleY(1);
        opacity: 1;
      }
      100% {
        transform: scaleY(1);
        opacity: 0;
      }
    }

    /* --- Ritocchi Contenuto --- */
    .photo-container {
      width: 180px !important;
      height: 180px !important;
      margin-bottom: 2rem !important;
    }
    .dev-name {
      font-size: 2.2rem !important;
      text-align: center !important;
      line-height: 1.1;
    }
    .dev-role {
      font-size: 1.1rem !important;
      text-align: center !important;
      margin-top: 0.5rem !important;
      opacity: 0.8 !important;
    }
    .dev-label {
      order: 5 !important;
      margin-top: 2rem !important;
      opacity: 0.3 !important;
    }
    .dev-tabs {
      grid-column: 2;
      padding-left: 3rem !important;
      justify-content: flex-start !important;
      margin-bottom: 2rem !important;
    }
    .dev-panels-wrapper {
      grid-column: 2;
      padding-left: 3rem !important;
    }
    .dev-list {
      grid-column: 2;
    }
    .dev-panel p {
      font-size: 1.1rem !important;
      line-height: 1.8 !important;
      max-width: 600px;
    }
  }

  /* =================================================================
   🚀 4K PERFORMANCE BOOSTER (FINAL OPTIMIZATION)
   ================================================================= */

  /* 1. Isolamento del Layout (Fondamentale per lo scroll) */
  /* Impedisce che un'animazione in una sezione forzi il ricalcolo di tutta la pagina */
  .home,
  .approach,
  .ongoing-section,
  .flip-section,
  .contact-cta {
    contain: content; /* Isola il rendering della sezione */
    content-visibility: auto; /* Se fuori schermo, smette di renderizzare */
    contain-intrinsic-size: 100vh; /* Previene saltelli della scrollbar */
  }

  /* 2. Ottimizzazione Backdrop Filter (Il killer delle GPU in 4K) */
  .timeline-content,
  .ongoing-card,
  .dev-card,
  .timeline-icon,
  .cta-btn {
    /* Promuove l'elemento su un livello GPU separato */
    will-change: transform, opacity;
    transform: translateZ(0);
  }

  /* Su schermi ad alta risoluzione, riduciamo la qualità del blur per salvare frame */
  @media (min-width: 720px), (-webkit-min-device-pixel-ratio: 2) {
    .timeline-content,
    .ongoing-card,
    .dev-card {
      /* 14px di blur su 4K sono troppi calcoli. 
       8px visivamente rendono uguale perché i pixel sono densi. */
      backdrop-filter: blur(8px) saturate(120%) !important;
      -webkit-backdrop-filter: blur(8px) saturate(120%) !important;
    }

    /* Disabilitiamo ombre pesanti su elementi in movimento */
    .timeline-item.visible .timeline-icon {
      box-shadow: 0 0 15px rgba(255, 216, 77, 0.5); /* Glow semplificato */
    }
  }

  /* 3. Fix Canvas My Approach */
  #approachParticles {
    /* Assicuriamoci che non intercetti MAI il mouse, risparmiando eventi */
    pointer-events: none;
    touch-action: none;
    /* Hardware acceleration per il canvas */
    transform: translateZ(0);
  }

  /* 4. Disabilita effetti superflui mentre si scrolla (opzionale ma utile) */
  .is-scrolling .ongoing-card,
  .is-scrolling .dev-card {
    backdrop-filter: none !important; /* Toglie il vetro mentre scrolli veloce */
    box-shadow: none !important;
  }

  /* 5. Fix Black Hole (Contact) */
  .glow-dynamic,
  .glow-static {
    /* Riduce l'area di rendering dell'effetto sfocato */
    will-change: transform;
    filter: blur(6px) !important; /* Ridotto da 12px a 6px per performance */
  }
}

/* --- FOOTER BOTTOM AGGIORNATO --- */
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem; /* Spazio tra le due righe */
}

/* Riga principale (Brand + Location) */
.copyright-main {
  font-size: 0.95rem;
  color: var(--text);
  opacity: 0.9;
  margin: 0;
}

/* Nota legale (Gabriele Scarpitta) - Più sottile */
.legal-note {
  font-size: 0.8rem;
  color: rgba(230, 237, 243, 0.5); /* Grigio più spento */
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* Mobile: riduciamo leggermente il testo se necessario */
@media (max-width: 768px) {
  .copyright-main {
    font-size: 0.9rem;
  }
  .legal-note {
    font-size: 0.75rem;
  }
}

/* --- SMART CONTACT PILL (Mobile Header Version - Optimized) --- */

/* DESKTOP: NASCOSTA */
@media (min-width: 720px) {
  .contact-pill {
    display: none !important;
  }
}

/* MOBILE: VISIBILE */
@media (max-width: 719px) {
  .contact-pill {
    position: fixed;
    top: 2.2rem;
    right: 1.5rem;

    display: flex;
    align-items: center;
    /* Gap animabile per fluidità */
    gap: 10px;

    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);

    /* Padding Expanded */
    padding: 6px 16px 6px 6px; /* Meno padding a sinistra per l'icona cerchio */
    border-radius: 50px;
    height: 42px;

    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;

    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);

    /* ANIMAZIONE FLUIDA (Liquid Effect) */
    /* Transition su gap, padding e width */
    transition: gap 0.6s cubic-bezier(0.22, 1, 0.36, 1),
      padding 0.6s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.3s ease;

    transform-origin: right center;
    overflow: hidden; /* Fondamentale per nascondere il testo */
  }

  /* ICONA (Sempre Bianca) */
  .pill-icon {
    width: 30px; /* Dimensione fissa container icona */
    height: 30px;
    background: rgba(255, 255, 255, 0.1); /* Cerchietto leggero dietro icona */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Non si schiaccia mai */
  }

  .pill-icon svg {
    width: 16px;
    height: 16px;
    display: block;
    color: #ffffff; /* BIANCO PURO */
  }

  /* TESTO (Animazione Reveal) */
  .pill-text {
    white-space: nowrap;
    opacity: 1;
    max-width: 100px; /* Larghezza massima prevista */

    /* Animiamo max-width invece di width per fluidità */
    transition: max-width 0.6s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.4s ease 0.1s; /* Delay leggero sull'opacità */
  }

  /* --- STATO "SHRUNK" (Chiusa) --- */
  .contact-pill.shrink {
    gap: 0;
    padding: 6px; /* Padding uniforme (diventa 42x42) */
    background: rgba(15, 15, 15, 0.4); /* Più trasparente quando chiusa */
  }

  .contact-pill.shrink .pill-text {
    opacity: 0;
    max-width: 0; /* Collassa il testo a zero */
    transition: max-width 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease; /* Veloce a sparire */
  }
}

/* =========================================
   GDPR COOKIE BANNER (Glass Island)
   ========================================= */

.cookie-banner {
  position: fixed;
  bottom: calc(1.5rem + var(--safe-bottom)); /* Rispetta la safe area */
  left: 1.5rem;
  right: 1.5rem;
  z-index: 2000; /* Sopra a tutto, anche alla contact pill */

  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.2rem;

  /* GLASSMORPHISM PREMIUM */
  background: rgba(15, 15, 15, 0.85); /* Un po' più scuro per leggibilità */
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);

  border-radius: 20px;

  /* Stato iniziale per animazione */
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  visibility: hidden;
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.5s;
}

/* Quando attivo (via JS) */
.cookie-banner.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

/* Icona Decorativa */
.cookie-icon {
  position: absolute;
  top: -12px;
  left: 20px;
  background: linear-gradient(135deg, #5227ff, #3a1bad);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(82, 39, 255, 0.4);
}

.cookie-icon svg {
  width: 16px;
  height: 16px;
  color: #fff;
}

/* Testo */
.cookie-content {
  margin-top: 0.5rem;
  padding-right: 0.5rem;
}

.cookie-text {
  font-size: 0.9rem;
  color: #e6edf3;
  line-height: 1.5;
  margin: 0;
}

.cookie-link {
  color: #ffd84d;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 216, 77, 0.3);
  transition: border-color 0.2s;
}
.cookie-link:hover {
  border-bottom-color: #ffd84d;
}

/* Bottoni */
.cookie-actions {
  display: flex;
  gap: 0.8rem;
}

.cookie-btn {
  flex: 1;
  padding: 0.7rem 0;
  border-radius: 12px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.cookie-btn:active {
  transform: scale(0.96);
}

/* Decline (Ghost) */
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Accept (Primary Gradient) */
.btn-primary {
  background: linear-gradient(135deg, #5227ff 0%, #704dfc 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(82, 39, 255, 0.3);
}
.btn-primary:hover {
  filter: brightness(1.1);
}

/* --- DESKTOP OPTIMIZATION (min-width: 720px) --- */
@media (min-width: 720px) {
  .cookie-banner {
    left: 2rem; /* Angolo sinistro */
    right: auto; /* Non prende tutta la larghezza */
    bottom: 2rem;
    width: 340px; /* Larghezza fissa compatta */
    padding: 1.5rem;
    gap: 1.2rem;
    background: rgba(10, 10, 12, 0.9); /* Più scuro su desktop per contrasto */
  }

  .cookie-text {
    font-size: 0.85rem;
  }

  .cookie-icon {
    top: -10px;
    left: -10px; /* Icona "pop out" a sinistra */
  }

  /* Hover effect sulla card intera per desktop */
  .cookie-banner:hover {
    border-color: rgba(82, 39, 255, 0.3);
  }
}

/* =========================================
   CUSTOM SELECTION & SCROLLBAR (Stealth Version)
   ========================================= */

/* --- 1. CUSTOM SELECTION (Il testo evidenziato) --- */

::selection {
  /* Grigio "Ghiaccio" molto trasparente */
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff; /* Bianco puro */
  text-shadow: none; /* Rimosso il glow per massima pulizia */
}

/* Supporto Firefox */
::-moz-selection {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* --- 2. CUSTOM SCROLLBAR (La barra laterale) --- */

/* Larghezza */
::-webkit-scrollbar {
  width: 10px;
}

/* Il binario (Sfondo scuro, identico al sito) */
::-webkit-scrollbar-track {
  background: #0e141b;
  border-left: 1px solid rgba(255, 255, 255, 0.03); /* Linea quasi impercettibile */
}

/* Il pollice (Stato Normale - Scuro) */
::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1); /* Grigio scuro molto sottile */
  border-radius: 5px;
  border: 2px solid #0e141b; /* Margine interno per staccarlo */
  transition: background-color 0.2s ease;
}

/* Il pollice (Hover - Diventa un po' più visibile, ma resta grigio) */
::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.25); /* Grigio medio */
  box-shadow: none; /* Niente neon */
}

/* Il pollice (Active - Quando clicchi) */
::-webkit-scrollbar-thumb:active {
  background-color: rgba(
    255,
    255,
    255,
    0.4
  ); /* Grigio chiaro per feedback tattile */
}

/* Firefox */
html {
  scrollbar-width: thin;
  /* Colore Pollice (Grigio scuro) | Colore Binario (Sfondo) */
  scrollbar-color: rgba(255, 255, 255, 0.15) #0e141b;
}

/* =========================================
   ONGOING PROJECTS SECTION (LAYOUT 4 COLONNE)
   ========================================= */

/* 1. SEZIONE GENITORE */
.ongoing-section {
  width: 100%;
  padding: 6rem 0; /* Tolto padding laterale qui, lo gestisce la lista */
  position: relative;
  display: block;
  text-align: center;
}

.ongoing-title {
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 700;
  margin-bottom: 4rem;
  color: var(--text);
  line-height: 1.1;
}

/* =========================================
   ONGOING PROJECTS SECTION (4 COLONNE + SUPERCOMBO GLOW)
   ========================================= */

/* 1. GRIGLIA 4 COLONNE (Desktop) */
.ongoing-list {
  display: grid;
  width: 100%;

  /* SETUP DESKTOP: 4 COLONNE FISSE */
  grid-template-columns: repeat(4, 1fr);

  gap: 1.5rem; /* Spazio ridotto tra le card per farcene stare 4 */
  max-width: 1600px; /* Molto largo per occupare tutto lo schermo */
  margin: 0 auto;
  padding: 0 2rem; /* Margine di sicurezza laterale */
}

/* 2. CARD STYLE BASE */
.ongoing-card {
  position: relative; /* Necessario per il blob */
  display: flex;
  flex-direction: column;
  justify-content: space-between;

  min-height: 480px;
  padding: 2rem;
  border-radius: 24px;

  /* SFONDO SCURO SOLIDO */
  background: linear-gradient(
    145deg,
    rgba(20, 22, 27, 0.95) 0%,
    rgba(5, 5, 5, 0.98) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.08);

  /* Ombra base scura */
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);

  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden; /* Mantiene il blob dentro */
  text-align: left;
  z-index: 0; /* Stack context per i glow */
}

/* --- FIX Z-INDEX (Per leggere il testo sopra la luce) --- */
.card-top-row,
.card-content,
.card-footer {
  position: relative;
  z-index: 2; /* Sopra al blob luminoso */
}

/* --- LOGO OPTIMIZATION (Fix Icona Quadrata) --- */
.company-logo-small {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  flex-shrink: 0;
}

/* --- SUPERCOMBO GLOW EFFECTS (Bordo + Blob) --- */

/* 🟣 VIOLA (Kubogreen / Santa Rosalia) */
.ongoing-card.glow-purple {
  /* 1. Bordo + Neon Esterno */
  border-color: rgba(163, 133, 255, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6),
    /* Ombra profonda */ 0 0 15px rgba(82, 39, 255, 0.2),
    /* Glow bordo */ 0 0 40px rgba(82, 39, 255, 0.1); /* Alone esterno */
}

/* 2. Blob Interno (Luce ambientale) */
.ongoing-card.glow-purple::before {
  content: "";
  position: absolute;
  top: -100px;
  right: -100px;
  width: 350px;
  height: 350px;
  background: radial-gradient(
    circle,
    rgba(120, 80, 255, 0.25) 0%,
    transparent 65%
  );
  filter: blur(60px);
  z-index: 1;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* HOVER VIOLA */
.ongoing-card.glow-purple:hover {
  transform: translateY(-8px);
  border-color: rgba(163, 133, 255, 0.8);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7), 0 0 20px rgba(82, 39, 255, 0.5),
    0 0 60px rgba(82, 39, 255, 0.3);
}
.ongoing-card.glow-purple:hover::before {
  opacity: 1;
  transform: scale(1.1);
}

/* 🟢 VERDE (GiesseStack / Parrocchia) */
.ongoing-card.glow-green {
  /* 1. Bordo + Neon Esterno */
  border-color: rgba(29, 191, 115, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 15px rgba(29, 191, 115, 0.2),
    0 0 40px rgba(29, 191, 115, 0.1);
}

/* 2. Blob Interno */
.ongoing-card.glow-green::before {
  content: "";
  position: absolute;
  top: -100px;
  right: -100px;
  width: 350px;
  height: 350px;
  background: radial-gradient(
    circle,
    rgba(29, 191, 115, 0.2) 0%,
    transparent 65%
  );
  filter: blur(60px);
  z-index: 1;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* HOVER VERDE */
.ongoing-card.glow-green:hover {
  transform: translateY(-8px);
  border-color: rgba(29, 191, 115, 0.8);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7), 0 0 20px rgba(29, 191, 115, 0.5),
    0 0 60px rgba(29, 191, 115, 0.3);
}
.ongoing-card.glow-green:hover::before {
  opacity: 1;
  transform: scale(1.1);
}

/* --- CONTENUTO INTERNO (Tipografia) --- */
.card-top-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.project-overline {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #ffd84d;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.company-name-large {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 1rem 0;
  line-height: 1.2;
}

.project-desc-aligned {
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(230, 237, 243, 0.7);
  margin-bottom: 1rem;
}

.card-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.tech-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.tech-tags span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: monospace;
}

/* =========================================
   RESPONSIVITÀ
   ========================================= */

/* TABLET (Sotto i 1200px -> 2 colonne) */
@media (max-width: 1200px) {
  .ongoing-list {
    grid-template-columns: repeat(2, 1fr);
    max-width: 900px;
  }
}

/* MOBILE (Sotto i 768px -> 1 colonna) */
@media (max-width: 768px) {
  .ongoing-list {
    grid-template-columns: 1fr;
    padding: 0 1rem;
  }
  .ongoing-card {
    min-height: auto;
    padding: 1.5rem;
  }
}

/* =========================================
   CONTACT MODAL (Glassmorphism)
   ========================================= */

/* Lo sfondo scuro che copre tutto il sito */
.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 12, 16, 0.6); /* Scuro ma vedi sotto */
  backdrop-filter: blur(8px); /* Sfocatura sfondo sito */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

/* Quando è aperto */
.contact-modal.open {
  opacity: 1;
  visibility: visible;
}

/* La finestra vera e propria */
/* Modifica questo blocco esistente */
.modal-glass {
  width: 90%;
  max-width: 500px;
  background: rgba(20, 22, 27, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;

  /* MODIFICA 1: Padding dinamico (meno spazio su mobile) */
  padding: 1.5rem;

  position: relative;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);

  /* MODIFICA 2: Gestione altezza per schermi piccoli/tastiera aperta */
  max-height: 85vh; /* Non supera mai l'85% dello schermo */
  overflow-y: auto; /* Abilita lo scroll interno se serve */

  /* Animazione */
  transform: scale(0.95) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Aggiungi questa Media Query subito sotto per ristabilire lo spazio su Desktop */
@media (min-width: 720px) {
  .modal-glass {
    padding: 2.5rem; /* Torna spazioso su desktop */
    max-height: none; /* Nessun limite altezza su desktop */
    overflow-y: visible; /* Lascia che i dropdown escano fuori dal box */
  }
}

@media (max-width: 719px) {
  .glass-form {
    padding-bottom: 2rem; /* Spazio extra in fondo per far respirare lo scroll su mobile */
  }

  /* Riduciamo un po' il titolo su mobile */
  .modal-title {
    font-size: 1.5rem;
  }

  .modal-close-btn {
    top: 1rem;
    right: 1rem;
  }
}

.contact-modal.open .modal-glass {
  transform: scale(1) translateY(0);
}

/* Tasto Chiudi (X) */
.modal-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.3s;
}
.modal-close-btn:hover {
  color: #fff;
}

/* Header Gerarchia */
.modal-header {
  margin-bottom: 2rem;
  text-align: center;
}

.modal-subtitle {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #ffd84d; /* ORO: Prima cosa che l'occhio nota */
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.modal-title {
  font-size: 2rem;
  color: #fff;
  margin: 0;
  font-weight: 700;
}

/* Form Styles */
.glass-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.input-group label {
  font-size: 0.85rem;
  color: rgba(230, 237, 243, 0.7);
  margin-bottom: 0.6rem;
  font-weight: 500;
}

/* Input & Select & Textarea */
.glass-form input,
.glass-form select,
.glass-form textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem;
  font-size: 1rem;
  color: #fff;
  font-family: "Inter", sans-serif;
  transition: border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
  outline: none;
}

/* Focus State (Glow Viola) */
.glass-form input:focus,
.glass-form select:focus,
.glass-form textarea:focus {
  border-color: #5227ff;
  background-color: rgba(82, 39, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(82, 39, 255, 0.1);
}

/* Custom Select Arrow Fix */
.select-wrapper {
  position: relative;
}
.glass-form select {
  appearance: none;
  cursor: pointer;
}
.select-arrow {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  font-size: 0.8rem;
}

/* Submit Button */
.modal-submit-btn {
  margin-top: 1rem;
  padding: 1.2rem;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #5227ff 0%, #704dfc 100%);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s;
}

.modal-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(82, 39, 255, 0.3);
}

.modal-submit-btn:active {
  transform: scale(0.98);
}

/* Shine effect sul bottone */
.btn-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transform: skewX(-20deg);
  transition: left 0.5s;
}
.modal-submit-btn:hover .btn-shine {
  left: 150%;
  transition: left 0.7s ease-in-out;
}

/* =========================================
   CUSTOM SELECT (Glass & Rounded)
   ========================================= */

.custom-select-wrapper {
  position: relative; /* Fondamentale per posizionare la lista */
  user-select: none;
}

/* --- CUSTOM SELECT "INSTANT" (Fake Glass Optimization) --- */

/* IL TRIGGER (Input) */
.custom-select-trigger {
  touch-action: manipulation; /* Nessun ritardo su mobile */
  width: 100%;

  /* Sfondo leggermente più solido per reattività */
  background: rgba(20, 22, 27, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem;
  font-size: 1rem;
  color: #fff;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;

  /* Rimuoviamo transizioni pesanti sul box model, teniamo solo colori */
  transition: background 0.1s, border-color 0.1s;
}

.custom-select-trigger:active {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(0.99);
}

/* IL MENU (Lista Opzioni) */
.custom-options {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 9999; /* Z-index altissimo per evitare conflitti */

  /* --- FIX PERFORMANCE QUI --- */
  /* 1. Rimuoviamo il blur reale (costoso) */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;

  /* 2. Usiamo un colore solido "quasi" nero (simula il vetro scuro) */
  background: #13151a;
  /* Oppure se vuoi micro-trasparenza senza lag: rgba(19, 21, 26, 0.98) */

  border: 1px solid rgba(255, 255, 255, 0.15); /* Bordo leggermente più visibile */
  border-radius: 16px;

  /* Ombra forte per staccarlo dallo sfondo */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);

  /* STATO CHIUSO */
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.99);

  /* Animazione rapidissima (sotto i 200ms è percepita come istantanea) */
  transition: opacity 0.15s ease-out,
    transform 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* Dice al browser di non preoccuparsi di renderizzare finché non cambia */
  will-change: opacity, transform;
}

/* STATO APERTO */
.custom-select-wrapper.open .custom-options {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* LE OPZIONI */
.custom-option {
  padding: 1rem 1.2rem;
  font-size: 0.95rem;
  color: rgba(230, 237, 243, 0.9);
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-option:hover {
  background: rgba(82, 39, 255, 0.2); /* Feedback immediato */
  color: #fff;
}

.custom-option:last-child {
  border-bottom: none;
}
.custom-option.selected {
  background: rgba(82, 39, 255, 0.3);
  color: #ffd84d;
  font-weight: 600;
}

/* Rotazione Freccina */
.select-arrow {
  transition: transform 0.3s ease;
}
.custom-select-wrapper.open .select-arrow {
  transform: rotate(180deg);
}
