/* style.css di base */
body { margin:0; font-family: 'Orbitron', 'Open Sans', sans-serif; color:#333; }
.hero { position: relative; height: 100vh; overflow: hidden; }
.hero-video { position: absolute; width: 100%; height: 100%; object-fit: cover; top:0; left:0; z-index: -1; }
.hero-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 80px; /* distanza dalla fine del div; regola se vuoi più/meno spazio */
  width: 100%;
  text-align: center;
  color: #fff;
  z-index: 2; /* sopra la sfumatura (::after ha z-index:1) */
}
.hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px; /* prima era 200px: prova 60–100px per una sfumatura più sottile */
  background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, #f9f9f9 100%);
  z-index: 1;
}

.btn {
  background: linear-gradient(180deg,#11249e 0%, #06186b 100%);
  color: #fff;
  padding: 14px 28px;
  text-decoration: none;
  border-radius: 8px;
  display: inline-block;
  position: relative;
  z-index: 3;

  /* tipografia */
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-size: 0.95rem;

  /* effetto 3D / shadow */
  box-shadow: 0 10px 20px rgba(6,24,107,0.25), 0 2px 0 rgba(0,0,0,0.25) inset;
  text-shadow: 0 1px 0 rgba(0,0,0,0.25);

  /* transizioni e animazione leggera */
  transition: transform 200ms cubic-bezier(.2,.9,.3,1), box-shadow 200ms ease, filter 200ms ease;
  animation: float 4s ease-in-out infinite;
  will-change: transform, box-shadow, filter;
}

/* pseudo-elemento per creare un bordo inferiore 'strato' che rafforza l'effetto 3D */
.btn::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: -8px;
  height: 8px;
  background: rgba(0,0,0,0.18);
  border-radius: 6px;
  z-index: -1;
  filter: blur(2px);
  transition: bottom 200ms ease, opacity 200ms ease;
}

/* hover / focus: solleva il bottone e aumenta l'ombra, rendendolo più evidente */
.btn:hover,
.btn:focus {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 20px 30px rgba(6,24,107,0.30), 0 4px 0 rgba(0,0,0,0.28) inset;
  outline: none;
  filter: saturate(1.05) brightness(1.03);
}
.btn:hover::after,
.btn:focus::after {
  bottom: -12px;
  opacity: 0.95;
}

/* animazione floating leggerissima */
@keyframes float {
  0% { transform: translateY(0) }
  50% { transform: translateY(-4px) }
  100% { transform: translateY(0) }
}

/* preferenze di riduzione movimento — disattiva animazioni se utente le preferisce ridotte */
@media (prefers-reduced-motion: reduce) {
  .btn { animation: none; transition: none; }
}

/* tweak responsive: evitare animazione eccessiva su schermi piccoli e ridurre dimensioni */
@media (max-width: 480px) {
  .btn { animation: none; padding: 12px 20px; font-size: 0.9rem; }
  .btn::after { display: none; }
}

/* sezioni con padding uniforme */
section { 
  padding: 35px 20px; /* ridotto da 60px a 35px */
  max-width: 1200px; 
  margin: auto;
}

/* Hero video mobile-friendly */
@media (max-width: 768px) {
  .hero {
    height: 60vh; /* riduce l'altezza su tablet e smartphone */
  }
  .hero-video {
    height: 100%;
    object-fit: cover; /* mantiene proporzioni senza deformare */
  }
  .hero-text {
    bottom: 40px; /* avvicina il testo al centro su mobile */
    padding: 0 10px; /* margine laterale */
  }
}

h1, h2{
  color: #06186b;
  text-align: center;
}

p {
  text-align: center;
}

/* riduzione spazio specifico tra about e skills */
#about {
  padding-bottom: 10px; /* ridotto padding bottom */
  text-align: center;
}

.astronaut-wrapper {
  position: relative;
  width: 100%;
  height: 150px; /* ridotta rispetto a prima */
  overflow: hidden; /* nasconde fuori dallo schermo */
}

.astronauta {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: -300px; /* parte fuori schermo a destra */
  width: 120px; /* ridotta, regolabile */
  /* rimosso opacity: l'immagine resta piena */
}






#skills {
  padding-top: 10px; /* ridotto padding top */
  text-align: center;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* aumentata larghezza minima */
    gap: 20px;
}
.portfolio-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); 
  gap: 24px; 
  align-items: start; 
}
#certifications { padding: 60px 20px; text-align: center; background: #f9f9f9; }
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  align-items: start;
  justify-items: center;
}
.cert-item {
  background: #06186b;       /* changed: dark blue background */
  color: #ffffff;            /* changed: ensure text in card is white */
  padding: 30px;             /* increased padding */
  border-radius: 12px;       /* a bit more rounded */
  box-shadow: 0 8px 20px rgba(0,0,0,0.08); /* stronger shadow */
  transition: transform 220ms ease, box-shadow 220ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;         /* larger card height */
  width: 100%;
  box-sizing: border-box;
}

.cert-item img {
  width: auto;
  height: 120px;             /* enlarged image height */
  max-width: 100%;
  object-fit: contain;
  margin-bottom: 14px;
  display: block;
}
.cert-item p { 
  color: #ffffff;  /* changed: white text */
  font-size: 0.9rem; 
}

/* ensure portfolio videos stay inside their card */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  align-items: start;
}

/* video container with fixed aspect ratio (16:9) */
.portfolio-thumb {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background: #000;
  overflow: hidden;    /* prevent video overflow */
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

/* make the video fill the container and use object-fit to crop if needed */
.portfolio-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* keeps video contained and visually neat */
  display: block;
  border: 0;
}

/* subtitle under the card */
.portfolio-title {
  margin: 12px;
  color: #06186b;
  font-weight: 700;
  text-align: left;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.95rem;
}

/* description line under the title */
.portfolio-desc {
  margin: 0 12px 16px;
  color: #555;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: left;
  font-family: 'Open Sans', sans-serif;
}

/* responsive: center text on small screens */
@media (max-width: 480px) {
  .portfolio-title { text-align: center; }
  .portfolio-desc { text-align: center; margin-left: 12px; margin-right: 12px; }
}

/* hover / focus states to indicate clickability (kept subtle) */
.portfolio-title .portfolio-link:hover,
.portfolio-title .portfolio-link:focus {
  text-decoration: underline;
  outline: none;
}

/* visible focus outline for keyboard users */
.portfolio-title .portfolio-link:focus {
  box-shadow: 0 0 0 3px rgba(6,24,107,0.12);
  border-radius: 6px;
}

/* ensure portfolio card wrapper has unified radius and clips children */
.portfolio-item {
  border-radius: 12px;
  overflow: hidden;
  background: #fff; /* keep card background */
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

/* make the thumbnail align with the card radius at the top */
.portfolio-thumb {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background: #000;
  overflow: hidden;
  border-radius: 12px 12px 0 0; /* top corners same as card */
}

/* responsive tweak */
@media (max-width: 480px) {
  .portfolio-grid { grid-template-columns: 1fr; }
  .portfolio-title { text-align: center; }
}

/* responsive tweak: su schermi piccoli alza leggermente il bottone per evitare sovrapposizione */
@media (max-width: 480px) {
  .hero-text { bottom: 60px; }
}

/* reduce vertical gap between intro and about */
.intro { padding-bottom: 20px; }
#about { padding-top: 30px; }

/* skill card with logo + label */
.skill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 25px;     /* aumentato padding */
  min-height: 200px; /* aumentata altezza minima */
  border-radius: 12px; /* unify radius to 12px for all cards */
  background: #06186b;
  box-shadow: 0 4px 10px rgba(6,24,107,0.18);
  color: #ffffff;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;

  /* added: allow shrinking and avoid overflow when column gets narrow */
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;

  /* Add pulse animation and pointer cursor */
  cursor: pointer;
  animation: skillPulse 2s ease-in-out infinite;
  transform-origin: center;
}

/* ensure stacked absolute children follow the same rounded corners */
.skill-content,
.skill-details {
  border-radius: inherit;
  overflow: hidden;
}

/* logo inside skill — allow it to scale down and stay centered */
.skill-logo {
  width: auto;                 /* flexible width */
  height: 96px;
  max-width: 40%;              /* don't exceed a portion of the card */
  max-height: 96px;
  object-fit: contain;
  border-radius: 12px;
  flex-shrink: 1;              /* permit shrinking to avoid overflow */
  display: block;
  margin: 0 auto;

  /* changed: remove visible frame / contrast background */
  background: transparent;      /* no background so div color shows through */
  padding: 0;                   /* remove inner padding that created bands */
  box-shadow: none;             /* remove shadow that looked like a frame */
  border: none;
}

/* ensure the label can shrink/wrap correctly and stays centered */
.skill > span {
  display: block;
  text-align: center;
  line-height: 1;
  flex: 1 1 auto;
  min-width: 0; /* allow text to truncate/wrap inside constrained space */
  padding: 0 6px; /* small inner padding to avoid touching edges */
}

/* responsive: stack icon above text on very small widths for stability */
@media (max-width: 420px) {
  .skills-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .skill {
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    min-height: auto;
    text-align: center;
  }
  .skill-logo {
    width: 64px;
    height: 64px;
    max-width: 64px;
    max-height: 64px;
  }
}

/* Add glow keyframes animation */
@keyframes skillPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 12px 30px rgba(6,24,107,0.25);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 20px 40px rgba(17,36,158,0.45), 0 0 15px rgba(255,255,255,0.1);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 12px 30px rgba(6,24,107,0.25);
  }
}

.skill:hover {
  animation-play-state: paused;
  transform: scale(1.05);
  box-shadow: 0 25px 50px rgba(17,36,158,0.5), 0 0 20px rgba(255,255,255,0.15);
}

/* Disable animation for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .skill {
    animation: none;
  }
}

/* headings color */
h1, h2 {
  color: #06186b;
}

/* Transizione e stato alternativo per le skill */
.skill-content, .skill-details {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  transition: transform 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.skill-details {
    transform: translateX(100%);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;        /* ridotto il font size */
    background: #06186b;
    padding: 30px;             /* padding aumentato */
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.skill-details span {
    display: block;
    max-width: 100%;
    padding: 10px;
    line-height: 1.4;
    overflow-wrap: break-word;
    word-wrap: break-word;
    text-align: center;
}

.skill.active .skill-content {
  transform: translateX(-100%);
}

.skill.active .skill-details {
  transform: translateX(0);
}

/* contact form centered layout and styling */
#contact {
  text-align: center;
}

#contact form {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

#contact {
  position: relative; /* crea un contesto di posizionamento */
  overflow: hidden; /* evita scroll o elementi che “escono” */
}

.robot {
  position: fixed; /* cambia da absolute a fixed */
  bottom: 20%;
  left: -200px;
  opacity: 0;
  width: 120px;
  transition: left 2s ease-out, opacity 1s ease-out;
  z-index: 50;
}






footer {
  background-color: #06186b;
  color: #ffffff;
  text-align: center;
  padding: 30px 0;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

footer a {
  color: #ffffff;          /* colore bianco */
  text-decoration: underline;
  font-weight: 500;
  transition: opacity 0.3s ease;
}

footer a:hover {
  opacity: 0.8;            /* leggero effetto al passaggio */
}

/* Skills responsive */
@media (max-width: 768px) {
  .skills-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); /* colonne più strette su tablet e smartphone */
    gap: 15px;
  }
  .skill {
    padding: 12px; /* aumenta area cliccabile */
  }
  .skill-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .skill-logo {
    width: 80px; /* scala le immagini, regolabile */
    height: auto;
    margin-bottom: 8px;
  }
}
