@import url("https://fonts.googleapis.com/css?family=Poppins:400,500,700&display=swap");

:root {
  --base-bg: #161a23;
  --text-main: #b3bbc5; /* #f0f0f0; */
  --text-secondary: #f0f0f0;
  --glow-color: #ffe600;
  --press-duration: 300ms;
  --shadow: rgba(0,0,0,0.3);
  --content-width: clamp(380px, 90vw, 1000px);
  --avatar-size: 380px;
  --radius: 16px;
  --padding: 32px;
  --card-vertical-padding: 40px;
  --profile-name-size: 3rem;
  --profile-role-size: 1rem;
  --social-font-size: 1rem;
  --player-width: clamp(300px, calc(90vw - 6.25vw), 750px);
  --player-aspect: 0.24;
  --glow-hover: 0 0 10px var(--accent), 0 0 20px var(--accent), 0 0 30px var(--accent);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

* {
  -webkit-tap-highlight-color: transparent; /* rimuove quadrati grigi quando tappo su mobile i pulsanti*/
}

html, body {
  font-family: 'Poppins', sans-serif;
  background: #0f111a;
  color: var(--text-main);
  width: 100%;
  overflow-x: hidden;
  padding: 5px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes backgroundFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}


img {
  max-width: 100%;
  height: auto;
}

/* ——— PROFILE CARD ——— */

.profile-card {
  width: var(--content-width);
  padding: var(--padding);
  margin: calc(var(--avatar-size) / 2 + 10px) auto 5px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;

  background-color: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px) saturate(160%);
  border-radius: var(--radius);
  box-shadow: 0 12px 24px var(--shadow);
  position: relative;
  overflow: visible; /* importante! permette alla foto di uscire sopra */
  border: none;
}


/* Profilo parte superiore "interna" ma visivamente fuori */
.profile-photo {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  overflow: hidden;
  background-color: #0f111a; /* Scuro quando spento */
  box-shadow:
    inset 5px 5px 15px rgba(0, 0, 0, 0.6),
    inset -5px -5px 15px rgba(255, 255, 255, 0.03),
    0 6px 12px rgba(0, 0, 0, 0.7);
  z-index: 10;
  border: none;
  transition: background-color 0.3s ease;
}

.profile-photo.on {
  background: 
    radial-gradient(
      circle,
      rgba(255, 230, 0, 0.25) 0%,
      rgba(255, 230, 0, 0.1) 40%,
      rgba(15, 17, 26, 1) 70%
    ),
    #0f111a; /* fallback opaco per eliminare la trasparenza */
}

#profile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ——— INFORMAZIONI CENTRATE ——— */
.profile-info.centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: calc(var(--avatar-size) / 2.4); /* Margine foto nome*/
}

.profile-info {
  font-size: calc(var(--profile-name-size) * 1.05); /* aumentato il font */
  color: var(--text-main);
}

.name-toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.profile-name {
  font-size: 4rem;
  font-weight: 700;
   /* colore "spento" chiaro per visibilità */
  text-align: center;
  letter-spacing: 1px;

  color: #e0e0e0;
  text-shadow:
    1px 1px 2px #000000cc,
    2px 2px 4px #00000099;

  transition:
    color 0.4s ease,
    text-shadow 0.4s ease,
    transform 0.4s ease,
    filter 0.4s ease;
}

.profile-name.on {
  color: #0f111a; /* blu-nero, come richiesto */
  transform: translateY(-6px); /* sollevamento */
  text-shadow:
    0 0 6px #ffe066,
    0 0 12px #ffd43b,
    0 0 24px #fab005,
    2px 2px 6px #00000088; /* profondità mantenuta */
  filter: brightness(1.15);
}


.bulb-wrapper {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 4rem;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 19;
}

/* Disco alla base */
.bulb-base {
  position: absolute;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background-color:#0f111a; /* colore più chiaro */
  z-index: 18;
  transform: translateY(6px);
}

/* Bottone centrato sopra */
.bulb-btn {
  width: 3.2rem;
  height: 3.2rem;
  border: none;
  border-radius: 50%;
  background-color: #1a1d2a;
  color: #888; /* icona neutra */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 20;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  box-shadow: 0 6px 0 #888; /* ombra solo in basso */
}

/* Stato attivo: icona accesa, bordo e alone giallo */
.bulb-btn.active {
  box-shadow:
    0 6px 0 var(--glow-color),
    0 8px 12px rgba(255, 230, 0, 0.35); /* alone giallo */
  background-color: #1a1d2a; /* puoi anche schiarire */
}

.bulb-btn.active i {
  color: var(--glow-color);
  text-shadow: 0 0 6px rgba(255, 230, 0, 0.6);
}

/* Pressione simulata (discesa) */
.bulb-btn.clicked {
  transform: translateY(4px);
  box-shadow: 0 0px 0 #06070d;
}

.language-wrapper {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 4rem;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 18;
}

.language-base {
  position: absolute;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background-color: #0f111a;
  transform: translateY(6px);
  z-index: 18;
}

.lang-btn img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  border-radius: 50%;
  border: 0.08rem solid #1a1d2a; /* bordo sottile e coerente */
  background-color: transparent;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
}

/* Click visivo */
.lang-btn.clicked {
  transform: translateY(4px);
  box-shadow: 0 0px 0 #06070d;
}

/* Stato attivo (scocca) */
body.on .lang-btn {
  box-shadow:
    0 6px 0 var(--glow-color),
    0 8px 12px rgba(255, 230, 0, 0.35);
  background-color: #1a1d2a;
}

/* Bandiera disattiva il glow su body.on */
body.on .lang-btn img {
  filter: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

/* Click visivo in modalità ON */
body.on .lang-btn.clicked {
  transform: translateY(4px);
  box-shadow: 0 0px 0 #06070d;
}

.profile-info .role {
  font-size: calc(var(--profile-role-size) * 1.8);
  color: #81878f; /* grigio chiaro, leggibile su sfondo scuro */
  margin-top: -0.5rem;
  text-align: center;
  letter-spacing: 0.6px;
  transition: color 0.4s ease;
}

body.on .profile-info .role {
  color: #ffffff; /* bianco candido */
}

/* ——— SOCIAL LINKS ——— */
.link-buttons.minimal {
  display: flex;
  justify-content: center;
  gap: 60px;
  margin-top: 0;
}

/* .accent-line {
  height: 3px;
  background-color: #0f111a;
  margin: 6px auto 0 auto;
  border-radius: 3px;
  width: 0;
  max-width: 300px;
  transition: width 0.5s ease;
  transform-origin: center;
  box-shadow:
    0 1px 0 var(--glow-color),
    0 0 12px rgba(255, 230, 0, 0.35); /* alone giallo */
/* } */

/* Quando il body è in stato ON (lampadina accesa) */
/* body.on .accent-line {
  width: calc(100% - 40px);
} */ 




.social-wrapper {
  position: relative;
  width: 3.6rem;
  height: 3.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.5rem;
  z-index: 1;
}

/* Disco piatto alla base */
.social-base {
  position: absolute;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 20%;
  background-color: #0f111a;
  z-index: 0;
  transform: translateY(6px);
}

/* Bottone sopra */
.social-btn {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 20%;
  border: none;
  background-color: #1a1d2a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 0 #888;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  z-index: 1;
  cursor: pointer;
}

/* Effetto click (spento): ombra nera */
body:not(.on) .social-btn.clicked,
body:not(.on) .social-btn:active {
  transform: translateY(6px);
  box-shadow: 0 0px 0 #06070d;
}

/* Effetto click (acceso): glow attenuato */
body.on .social-btn.clicked,
body.on .social-btn:active {
  transform: translateY(6px);
  box-shadow: 0 0 8px rgba(255, 230, 0, 0.15);
}


/* Icona al centro */
.icon {
  width: 30px;
  height: 30px;
  pointer-events: none;
  fill: #888; /* colore neutro base */
  transition: fill 0.3s ease;
}

/* SOCIAL BUTTON accesi */
body.on .social-btn {
  box-shadow:
    0 6px 0 var(--glow-color),
    0 6px 12px rgba(255, 230, 0, 0.35); /* alone giallo */
  background-color: #1a1d2a; /* puoi anche schiarire */
}

/* ICONA dentro il bottone accesa */
body.on .social-btn .icon {
  fill: var(--glow-color); /* giallo brillante in modalità "on" */
}






/* —— About Me —— */
.profile-about {
  position: relative;
  width: var(--content-width);
  background-color: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px) saturate(160%);
  border-radius: var(--radius);
  padding: var(--padding);
  box-shadow: 0 12px 24px rgba(0,0,0,0.2);
  text-align: center;
  margin: 40px auto;
  overflow: hidden; /* Facoltativo, per evitare che il glow esca dai bordi */
  cursor: default;
  /* border-left: 4px solid #47e0c0; */
  padding-left: 1.6rem;
}

.profile-about::before {
  content: "";
  position: absolute;
  top: var(--y, 50%);
  left: var(--x, 50%);
  transform: translate(-50%, -50%);
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: top 0.05s, left 0.05s, opacity 0.3s ease, background 0.3s ease;
  z-index: 0;
  mix-blend-mode: screen;
  cursor: default;
}

.profile-about.hovering::before {
  opacity: 1;
}

body.on .profile-about::before {
  background: radial-gradient(circle, rgba(255, 255, 0, 0.35) 0%, transparent 70%);
}

.profile-about h2 {
  font-size: 3rem;
  margin-bottom: 16px;
  color: #e0e0e0;
  text-shadow:
    1px 1px 2px #000000cc,
    2px 2px 4px #00000099;
}

body.on .profile-about h2 {
  color: #ffffff; /* bianco candido */
}



.profile-about p {
  max-width: 90%;
  margin: 0 auto;
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: justify;
}


.cv-button-container {
  display: flex;
  margin-top: 2rem;
  justify-content: center;
  align-items: center;
  gap:0.75;
}

.cv-card {
  width: var(--content-width);
  max-width: 90%;
  margin: 2.5rem auto;
  padding: 14px 25px 26px 25px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;

  background: #0f111a;
  border-radius: 16px;
  backdrop-filter: blur(6px);
  box-shadow:
    inset 0 0 25px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(71, 224, 192, 0.05);
}



/* === Contenitore bottoni View + Download === */
.cv-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}


.cv-button,
.cv-toggle {
  display: inline-block;
  border: none;
  padding: 0;
  background: #888;
  cursor: pointer;
  transition: transform var(--press-duration, 300ms) ease;
  transform: translateY(6px);
  position: relative;
  border-radius: 16px;
}

/* === View: rettangolare === */
.cv-button.view {
  height: 44px;
  width: auto;
  border-radius: 16px;
}

/* === Download e Toggle: circolari === */
.cv-button.download,
.cv-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

/* === Parte frontale === */
.cv-button .front,
.cv-toggle .front {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Poppins', sans-serif;
  font-size: 1.1rem;
  color: #888;
  background: #2b2f40;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transform: translateY(-6px);
  transition: transform var(--press-duration) cubic-bezier(.3, .7, .4, 1); /* solo transform */
}

.cv-button.view .front{
  padding: 0 1rem;
}


/* === Click attivo === */
.cv-button:active .front,
.cv-toggle:active .front,
.cv-button.clicked .front,
.cv-toggle.clicked .front {
  transform: translateY(0);
  transition: transform 34ms;
}

/* === Stato "PULLED" → background trasparente + niente ombra === */
.cv-button.pulled,
.cv-toggle.pulled {
  background-color: transparent !important;
  box-shadow: none !important;
}

body.on .cv-button.pulled,
body.on .cv-toggle.pulled {
  background-color: transparent !important;
  box-shadow: 0 0px 6px rgba(255, 230, 0, 0.15) !important; /* alone minimo */
}

/* === Glow attivo === */
body.on .cv-button,
body.on .cv-toggle {
  background: var(--glow-color);
  box-shadow:
    0 0px 16px rgba(255, 230, 0, 0.35);
}

body.on .cv-button .front,
body.on .cv-toggle .front {
  color: var(--glow-color);
}

/* === Effetto Hover (disattivato per ora) === */
/*
.cv-button:hover,
.cv-toggle:hover {
  background-color: rgba(255, 255, 255, 0.08);
}
*/

/* === Contenitore display CV === */
.cv-display-container {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 0.75rem;
}

/* === Display scorrevole === */
.cv-display {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  flex: 1;
  height: 44px;
  padding: 0 1rem;
  border-radius: 16px;
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  background-color: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px) saturate(160%);
  box-shadow:
    inset 0 0 10px rgba(255, 255, 255, 0.1),
    inset 0 0 25px rgba(255, 255, 255, 0.05),
    0 0 2px rgba(0, 0, 0, 0.5);
  color: #dee2e6;
  text-shadow: 0 0 3px rgba(255,255,255,0.15);
  transform: translateY(6px); /* Effetto simile ai bottoni */
}

/* === Rigatura display === */
.cv-display::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 2px,
    rgba(0, 255, 180, 0.03) 3px
  );
  pointer-events: none;
}

/* === Stato acceso display === */
body.on .cv-display {
  background-color: rgba(255, 230, 0, 0.08);
  color: var(--glow-color);
  text-shadow: 0 0 6px var(--glow-color);
  box-shadow:
    inset 0 0 10px rgba(255, 230, 0, 0.1),
    inset 0 0 25px rgba(255, 230, 0, 0.1),
    0 0 4px rgba(255, 230, 0, 0.15);
}

/* === Testo scrollabile === */
#cv-scroll-text {
  display: inline-block;
  animation: scrollText 25s linear infinite;
  animation-play-state: running;
  padding-right: 2rem;
}

/* === Keyframes scrolling === */
@keyframes scrollText {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}



































/* —— Section Blocks —— */
.pub-title{
  font-size: 3rem;
  color: #e0e0e0;
  text-shadow:
    1px 1px 2px #000000cc,
    2px 2px 4px #00000099;
}

body.on .pub-title {
  color: #ffffff; /* bianco candido */
}

.section-block {
  width: var(--content-width);
  margin: 40px auto;
  background-color: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px) saturate(160%);
  border-radius: var(--radius);
  padding: var(--padding);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* —— Carousel —— */
.cards {
  width: calc(var(--content-width) * 0.60);
  max-width: var(--content-width);
  margin: 40px auto;
  position: relative;
  height: calc(calc(var(--content-width) * 0.60) * 1.41);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
}

.card {
  width: 100%;
  height: 100%;
  position: absolute;
  border-radius: 16px;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px) saturate(180%);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  transition: transform 0.3s, opacity 0.3s;
  transform-style: preserve-3d;
  z-index: 2;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translate3d(0, 0, 1px);
  will-change: transform;
  image-rendering: optimizeQuality;
}

/* .card::before {
  content: "";
  position: absolute;
  top: var(--y,50%);
  left: var(--x,50%);
  transform: translate(-50%,-50%);
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(255,255,255,0.15) 0%, transparent 100%);
  pointer-events: none;
  transition: top 0.05s, left 0.05s, opacity 0.2s;
  z-index: 3;
} */

/* —— Player con retroilluminazione —— */
.player {
  width: calc(var(--content-width) * 0.85);
  height: clamp(120px, 30vw, 180px); /* ✅ dinamico */
  padding: 20px 28px;
  margin: 40px auto;
  /* background-color: rgba(255,255,255,0.04);
  backdrop-filter: blur(14px) saturate(180%); */
  background: #0f111a;
  backdrop-filter: blur(6px);
  box-shadow:
    inset 0 0 25px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(233, 238, 237, 0.05);
  border-radius: 16px;
  /* box-shadow: 0 0 0 transparent; */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.player:hover {
  /* transform: translateY(-4px); */
  box-shadow: 0 0 10px #d3d4dba1, 0 0 20px #d3dad860;
  background-color: #1f2230;
}

body.on .player{
  box-shadow:
    inset 0 0 25px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(255, 230, 0, 0.15);
}

body.on .player:hover {
  /* transform: translateY(-4px); */
  box-shadow: 0 0 10px  rgba(255, 230, 0, 0.35), 0 0 20px rgba(255, 230, 0, 0.35);
  background-color: #1f2230;
}


.info-area {
  width: 90%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.song-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
}

.song-info .title {
  font-weight: 100;
  font-size: 1.3rem; /* aumenta la dimensione, ad es. da 0.9rem a 1rem */
  line-height: 1.4rem; /* riduci leggermente l'interlinea */
  padding: 0.5rem;
  /* display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; */
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

/* .profile-about p,
.section-block p,
.song-info .title {
  font-size: clamp(0.9rem, 1.1vw, 1.2rem);
  line-height: 1.6;
} */

.sub-line {
  display: flex;
  justify-content: center;
  margin-top: 6px;
  margin-bottom: -2px;
  color: var(--text-secondary);
  font-size: 1rem;
}

.song-info .doi,
.song-info .doi a {
  font-weight: 100;
  word-break: break-word;
  text-align: center;
  font-size: 1rem;
}

.song-info .doi a{
  color: #888;
  text-decoration: underline;
}

body.on .song-info .doi a{
  color: var(--glow-color)
}

/* —— Modal —— */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: rgba(255,255,255,0.05);
  backdrop-filter: blur(16px) saturate(180%);
  width: 90%;
  max-width: 900px;
  height: 90vh;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-content iframe {
  width: 100%;
  height: 100%;
}

.close-button {
  color: white;
  align-self: flex-end;
  font-size: 1.5em;
  padding: 10px;
  cursor: pointer;
}





/* PROJECT CAROUSEL WRAPPER */
.proj-title{
  font-size: 3rem;
  color: #e0e0e0;
  text-shadow:
    1px 1px 2px #000000cc,
    2px 2px 4px #00000099;
}

body.on .proj-title {
  color: #ffffff; /* bianco candido */
}

.project-carousel {
  width: var(--content-width);
  height: calc(var(--content-width) * 1); /* A4 ratio */
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 32px; /* ← margine interno orizzontale */
  margin: 0 auto;
  box-sizing: border-box;
}

/* PROJECT CARD */
.project-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  width: 90%;
  height: 90%;

  padding: 2rem 2rem 3rem 2rem;
  pointer-events: none;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  gap: 1rem;

  background: #0f111a;
  backdrop-filter: blur(6px);
  box-shadow:
    inset 0 0 25px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(71, 224, 192, 0.05);
  border-radius: 16px;

  opacity: 0;
  filter: blur(2px);
  z-index: 0;
  transition: transform 0.6s ease, opacity 0.6s ease, filter 0.6s ease;
}

.project-card.active {
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  filter: blur(0);
  z-index: 2;
}

.project-card h4 {
  font-size: 2rem;
  color: #888;
}

body.on .project-card h4 {
  font-size: 2rem;
  color: var(--glow-color);
}

.project-card .media {
  width: 100%;
  height: 50%;
  background: rgba(0, 0, 0, 0);
  /* backdrop-filter: blur(6px);
  box-shadow:
    inset 0 0 25px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(71, 224, 192, 0.05); */

  backdrop-filter: blur(6px);
  border-radius: 16px;

  /* Solo ombra esterna */
  /* box-shadow: 0 12px 24px var(--shadow); */

  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}


.project-card .media img,
.project-card .media video,
.project-card .media canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.three-container {
  width: 100%;
  height: 100%;
  position: relative;
}

/* DESCRIZIONE */
.project-card p {
  flex-grow: 1;
  color: var(--text-secondary);
  text-align: justify;
  font-size: 0.95rem;
  line-height: 1.4;
}

/* FRECCE */
.project-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  background-color: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--accent);
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transition: background 0.3s ease;
}

.project-arrow:hover {
  background-color: rgba(24, 131, 231, 0.267);
}

.project-arrow.left {
  left: 16px; /* DENTRO la card */
}

.project-arrow.right {
  right: 16px; /* DENTRO la card */
}

.project-indicators {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 1.5rem;
  max-width: 300px; /* limite massimo */
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  flex-wrap: wrap; /* se troppi, vanno a capo */
}

.project-indicators .indicator {
  width: 28px;
  height: 6px;
  border-radius: 3px;
  background-color: rgba(255, 255, 255, 0.2);
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.project-indicators .indicator.active {
  background-color: #ffffff;
  transform: scale(1.3);
}

body.on .project-indicators .indicator.active {
  background-color: var(--glow-color);
}

.viewer-controls {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #2b2f40;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: 0.6rem;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.viewer-controls button {
  width: 3rem;
  height: 3rem;
  font-size: 2rem;
  border-radius: 0.4rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: #111;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.viewer-legend {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: #2b2f40; /* sfondo leggero, coerente */
  padding: 8px 10px;
  border-radius: 8px;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.viewer-toggle {
  top: 0;
  left: 0.5rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  color: #e0faff;
  user-select: none;
}

.viewer-toggle input {
  display: none;
}

.viewer-toggle .checkmark {
  width: 18px;
  height: 18px;
  background-color: #0f111a;
  border: 2px solid #0f111a;
  border-radius: 4px;
  display: inline-block;
  margin-right: 8px;
  position: relative;
  transition: all 0.2s ease;
}

.viewer-toggle input:checked + .checkmark::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.viewer-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.viewer-label .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* SPINNER VISUALE GLOBALE */
.viewer-spinner {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background-color: rgba(15, 17, 26, 0.9); /* sfondo scuro trasparente */
  color: #09f; /* testo coerente col bordo top */
  font-family: 'Segoe UI', sans-serif;
  font-size: 1rem;
  z-index: 999;
  pointer-events: none;
}

/* Se applicato direttamente al body, usa uno sfondo fallback giallo */
body.on viewer-spinner {
  background-color: #fff7d1;
  color: #222;
}

/* Cerchio animato */
.viewer-spinner .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #2a2e3a;
  border-top-color: #09f;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

/* Testo di caricamento opzionale */
.viewer-spinner .loading-text {
  font-weight: 500;
  letter-spacing: 0.05em;
  text-align: center;
  opacity: 0.8;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


.viewer-controls button:hover {
  background: #1e1e1e;
}

/* Colori per A, C, S */
.viewer-controls button.anterior {
  color: #e74c3c;
}

.viewer-controls button.superior {
  color: #2ecc71;
}

.viewer-controls button.operative {
  color: #f1c40f;
}

.viewer-controls button.active.anterior {
  background-color: #e74c3c;
  color: white;
}

.viewer-controls button.active.superior {
  background-color: #2ecc71;
  color: white;
}

.viewer-controls button.active.operative {
  background-color: #f1c40f;
  color: white;
}

.viewer-controls button.rotate i {
  color: white;
}

.viewer-controls button.rotate.rotating i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}














/* —— Scroll To Top —— */
#scrollToTopBtn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: none;
  border-radius: 6px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  display: none;
  cursor: pointer;
  z-index: 999;
  transition: all 0.3s ease;
}

#scrollToTopBtn:hover {
  background: var(--accent);
  color: var(--base-bg);
  box-shadow: var(--glow-hover);
  transform: translateY(-2px);
}

/* —— Typography Responsive —— */
h1 {
  font-size: clamp(1.8rem, 2.8vw, 2.8rem);
}
h2 {
  font-size: clamp(1.6rem, 2.4vw, 2.4rem);
}
h3 {
  font-size: clamp(1.5rem, 2.2vw, 2.2rem);
}

/* —— Media Query Mobile —— */
@media (max-width: 768px) {
  :root {
    --padding: 20px;
    --photo-size: 200px;
    --player-aspect: 0.5;
  }

  /* PROFILE CARD */
  
  .profile-card {
    width: 95%;
    padding: var(--padding);
    margin: calc(var(--avatar-size) / 2 + 5px) auto 2px auto;
    /* mantiene foto che "sporge" */
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .profile-photo {
    width: 350px;
    height: 350px;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    position: absolute;
  }

  .bulb-wrapper {
    top: 7.5rem;
    right: 1.5rem;
  }

  .bulb-base {
    width: 3.4rem;
    height: 3.4rem;
  }

  .bulb-btn {
    width: 2.4rem;
    height: 2.4rem;
  }


  .language-wrapper {
    top: 7.5rem;
    left: 1.5rem;
  }

  .language-base {
    width: 3.4rem;
    height: 3.4rem;
  }

  .lang-btn {
    width: 2.4rem;
    height: 2.4rem;
  }


  .profile-info.centered {
    margin-top: calc(var(--avatar-size) / 1.9); /* spazio tra foto e nome */
  }

  .profile-name {
    font-size: 3rem;
    line-height: 2.8rem; /* migliora quando va a capo */
    text-align: center;
  }

  .profile-info .role {
    font-size: 1.3rem;
    line-height: 1.4rem;
    margin-top: 0.8rem; /* spazio minimo ma leggibile */
    margin-bottom: 0.4rem;
    text-align: center;
    max-width: 22ch; /* limita la lunghezza su una sola colonna */
  }

  .link-buttons.minimal {
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0rem;
    margin-bottom: 0.8rem;
  }

  .social-base {
    width: 4rem;
    height: 4rem;
  }

  .social-btn {
    width: 2.6rem;
    height: 2.6rem;
  }

  /* ——— SOCIAL LINKS ——— */
  /* .link-buttons.minimal {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 0.8rem;
  } */
































  /* .social-square:hover {
    transform: none !important;
    box-shadow: none !important;
    background-color: rgba(255,255,255,0.04) !important;
  } */

  .profile-about,
  .section-block,
  .player {
    width: 95%;
    padding: var(--padding);
    margin: 40px auto;
  }

  .profile-about h2 {
    font-size: 2.5rem;
  }
  
  .profile-about p {
    font-size: 0.9rem;
    line-height: 1.1rem;
  }

  .card img {
    height: 100%;
    object-fit: cover;
  }

  .modal-content {
    width: 95%;
    height: 90vh;
  }

  #scrollToTopBtn {
    bottom: 20px;
    right: 20px;
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  /* a:focus,
  button:focus {
    outline: none !important;
    box-shadow: none !important;
  } */


  .cv-card {
    padding: 12px 18px 24px 18px; /* più compatto anche verticalmente */
    gap: 0; /* azzera lo spazio tra i blocchi interni */
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 0.8rem;
  }

  .cv-button-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0; /* rimuove spazio tra .cv-actions e .cv-display-container */
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 0; /* se serve compattare ancora */
  }

  .cv-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    order: 1;
    width: 100%;
    margin: 0;
    padding-bottom: 0.5rem;
    position: relative;
    isolation: isolate; /* evita interferenze da altri layer */
  }

  .cv-actions::before,
  .cv-actions::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #dee2e6);
    margin: 0 0.5rem;
    display: block;
  }
  .cv-actions::after {
    background: linear-gradient(to left, transparent, #dee2e6);
  }

  body.on .cv-actions::before {
    background: linear-gradient(to right, transparent, #ffe600);
  }

  body.on .cv-actions::after {
    background: linear-gradient(to left, transparent, #ffe600);
  }

  .cv-display-container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    order: 2;
    width: 100%;
    padding-top: 0.5rem;
  }

  .cv-display {
    flex: 1;
    min-width: 0;
    height: 33px;
    border-radius: 11px;
    font-size: 1rem;
  }

  .cv-toggle {
    width: 33px;
    height: 33px;
    font-size: 1rem;
  }

  .cv-button.view {
    height: 33px;
    border-radius: 11px;
    font-size: 1rem;
    gap: 6px;
  }

  .cv-button.download {
    width: 33px;
    height: 33px;
    font-size: 1rem;
  }

  #cv-scroll-text {
    padding-right: 1rem;
  }


  .pub-title{
    margin-bottom: 1.5rem;
  }

  .cards {
    width: calc(var(--content-width) * 0.60);
    max-width: var(--content-width);
    position: relative;
    height: calc(calc(var(--content-width) * 0.60) * 1.41);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
  }

  .player {
    margin-top: 4rem;
  }


  .info-area {
    width: 90%;
    margin: 0 0.5rem;
  }


  .song-info .title {
    font-weight: 100;
    font-size: 0.9rem; /* aumenta la dimensione, ad es. da 0.9rem a 1rem */
    line-height: 0.9rem; /* riduci leggermente l'interlinea */
    padding: 0;
    margin-bottom: 3px;
  }

  /* .profile-about p,
  .section-block p,
  .song-info .title {
    font-size: clamp(0.9rem, 1.1vw, 1.2rem);
    line-height: 1.6;
  } */

  .sub-line {
    margin-top: 4px;
    margin-bottom: -2px;
    font-size: 0.6rem;
  }

  .song-info .doi,
  .song-info .doi a {
    font-size: 0.6rem;
  }








  .section-block.projects h3 {
    margin-bottom: 1rem;
  }

  /* === PROJECT TITLE === */
  .proj-title {
    font-size: 2.2rem;
    color: #e0e0e0;
    text-shadow:
      1px 1px 2px #000000cc,
      2px 2px 4px #00000099;
    margin-bottom: 1rem;
    text-align: center;
  }

  body.on .proj-title {
    color: #ffffff;
  }

  /* === CAROUSEL === */
  .project-carousel {
    width: 100vw;
    max-width: var(--content-width);
    height: calc(100vw * 1.5); /* rapporto A4 leggermente ridotto */
    max-height: calc(var(--content-width) * 1.5);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    margin: 0 auto;
    box-sizing: border-box;
  }

  /* === PROJECT CARD === */
  .project-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 92%;
    height: 100%;
    padding: 1rem 1rem 1.5rem;
    pointer-events: none;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    gap: 0.8rem;

    background: #0f111a;
    backdrop-filter: blur(6px);
    box-shadow:
      inset 0 0 25px rgba(0, 0, 0, 0.6),
      0 0 20px rgba(71, 224, 192, 0.05);
    border-radius: 16px;
    opacity: 0;
    filter: blur(2px);
    z-index: 0;
    transition: transform 0.6s ease, opacity 0.6s ease, filter 0.6s ease;
    overflow: hidden;
  }

  .project-card.active {
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    filter: blur(0);
    z-index: 2;
  }

  .project-card h4 {
    font-size: 1.4rem;
    color: #888;
    margin: 0;
    line-height: 1.2;
  }

  body.on .project-card h4 {
    color: var(--glow-color);
  }

  /* === MEDIA === */
  .project-card .media {
    flex: 0 0 48%;
    max-height: 48%;
    min-height: 180px;
    width: 100%;
    background: rgba(0, 0, 0, 0);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
  }

  .project-card .media img,
  .project-card .media video,
  .project-card .media canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.5rem;
  }

  .three-container {
    width: 100%;
    height: 100%;
    position: relative;
  }

  /* === DESCRIZIONE === */
  .project-card p {
    flex: 1;
    overflow-y: auto;
    max-height: 45%;
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--text-secondary);
    text-align: justify;
    padding-right: 0.25rem;
  }

  /* === FRECCE === */
  .project-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    background-color: rgba(255, 255, 255, 0.06);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent);
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease;
  }

  .project-arrow:hover {
    background-color: rgba(24, 131, 231, 0.267);
  }

  .project-arrow.left {
    left: 12px;
  }

  .project-arrow.right {
    right: 12px;
  }

  /* === INDICATORI === */
  .project-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 1rem;
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
    flex-wrap: wrap;
  }

  .project-indicators .indicator {
    width: 22px;
    height: 5px;
    border-radius: 3px;
    background-color: rgba(255, 255, 255, 0.2);
    transition: background-color 0.3s ease, transform 0.3s ease;
  }

  .project-indicators .indicator.active {
    background-color: #ffffff;
    transform: scale(1.2);
  }

  body.on .project-indicators .indicator.active {
    background-color: var(--glow-color);
  }

  /* === VIEWER CONTROLS COMPATTI === */
  .viewer-controls {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    background: #2b2f40;
    padding: 0.3rem;
    border-radius: 0.4rem;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    max-width: 20%;
  }

  .viewer-controls button {
    width: 1.6rem;
    height: 1.6rem;
    font-size: 1rem;
    border-radius: 0.3rem;
    margin: 0.1rem 0;
    padding: 0.2rem;
    background: #111;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* === LEGENDA COMPATTA === */
  .viewer-legend {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    background-color:  rgba(43, 47, 64, 0.2);
    padding: 0.4rem 0.6rem;
    border-radius: 0.4rem;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    max-width: 60%;
  }

  .viewer-toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.65rem;
    color: #e0faff;
    user-select: none;
    line-height: 1;
  }

  .viewer-toggle input {
    display: none;
  }

  .viewer-toggle .checkmark {
    width: 10px;
    height: 10px;
    background-color: #0f111a;
    border: 1.2px solid #0f111a;
    border-radius: 2px;
    display: inline-block;
    margin-right: 4px;
    position: relative;
  }

  .viewer-toggle input:checked + .checkmark::after {
    content: "";
    position: absolute;
    left: 2px;
    top: 1px;
    width: 3px;
    height: 5px;
    border: solid #ffffff;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
  }

  .viewer-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    gap: 3px;
  }

  .viewer-label .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  /* === SPINNER (opzionale) === */
  .viewer-spinner {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(15, 17, 26, 0.9);
    color: #09f;
    font-size: 1rem;
    z-index: 999;
    pointer-events: none;
  }

  .viewer-spinner .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #2a2e3a;
    border-top-color: #09f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

  @keyframes spin {
    to { transform: rotate(360deg); }
  }

  .pub-title{
    font-size: 2.5rem;
    line-height: 2.1rem;
  }

}
