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

/* ------------------- TIPOLOGIA ------------------- */
body {
  font-family: Segoe, Segoe UI, Helvetica Neue, sans-serif;
  background-color: #f4f4f4;
  color: #333;
}

h1 {
  font-size: 2.5em;
  margin-top: 20px;
}

h2 {
  font-size: 2em;
  margin-bottom: 10px;
  color: #EE0000;
}

h3 {
  font-size: 1.5em;
  margin-top: 15px;
  margin-bottom: 6px;
  color: #4472c4;
}

h4 {
  font-size: 1.2em;
  margin-top: 6px;  /* elimina spazio extra sopra il titolo */
  margin-bottom: 6px;
  color: #2c3e50;
}

p, ul li {
  font-size: 1.2em;
  line-height: 1.5;
}

ul + p {
  margin-top: 0.6em;
}

/* ------------------- LISTE ------------------- */
ul:not(.elenco-grid2):not(.qualifiche) {
  list-style-type: disc;
  padding-left: 20px;
}

.qualifiche {
  list-style-type: disc;
  padding-left: 20px;
  margin: 0;
}

.elenco-grid2 {
  display: grid;
  grid-template-columns: 200px auto;
  column-gap: 40px;
  row-gap: 2px;
  list-style: none;
  padding-left: 0;
  margin-top: 10px;
  margin-bottom: 10px;
}

.elenco-grid2 li {
  font-size: 1.2em;
  line-height: 1.5;
}

/* ------------------- LAYOUT GENERALE ------------------- */
html, body {
  max-width: 100%;
}

section {
  margin: 40px auto;
  width: 90%;
  padding: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

/* ------------------- HEADER ------------------- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #c40000;
  padding: 15px 20px;
  color: white;
  position: relative;
  z-index: 1000;
  width: 100%;
}

.logo img {
  max-width: 220px;
}

.navbar ul {
  list-style: none;
  display: flex;
  gap: 10px;
}

.navbar ul li {
  display: inline;
}

.navbar a {
  text-decoration: none;
  color: white;
  background-color: #c40000;
  padding: 10px 5px;
  border-radius: 5px;
  transition: background-color 0.3s;
}

.navbar a:hover {
  background-color: #a50000;
}

.language-selection {
  display: flex;
  gap: 10px;
}

.language-button {
  text-decoration: none;
  background-color: #f44336;
  color: white;
  padding: 8px 12px;
  border-radius: 5px;
  transition: background-color 0.3s;
}

.language-button:hover {
  background-color: #a50000;
}

.menu-toggle {
  display: none;
  font-size: 2rem;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  margin-left: 10px;
}

/* ------------------- HERO ------------------- */
.hero {
  position: relative;
  width: 100%;
  height: 200px; /*25vh;*/
  min-height: 200px; /* Altezza minima per evitare schiacciamento */
  overflow: hidden;  
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  text-align: center;
  z-index: 2;
  background-color: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  width: 100%;
  max-width: 800px;
  box-sizing: border-box;
  animation: fadeInUp 1.2s ease-out forwards;
}

/* ------------------- PERSONA ------------------- */
.la-persona-flex {
  display: flex;
  align-items: center;
  gap: 32px;
}

.contenuto-testo {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.foto-persona {
  width: 109px;
  height: auto;
  flex-shrink: 0;
  max-width: 100%;
}

/* ------------------- ATTIVITÀ ------------------- */
.project {
  display: flex;
  flex-direction: row;        /* testo a sinistra, immagine a destra */
  align-items: flex-start;    /* immagine allineata in alto */
  gap: 2rem;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
  max-width: 1200px;
}

.project-text {
  flex: 1 1 60%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.project-img {
  flex: 1 1 40%;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.project-img img {
  width: 100%;
  height: auto;
  max-width: 450px;
  border-radius: 0px;
  margin-top: 1.8em;
}

/* ------------------- FOOTER ------------------- */
.footer {
  text-align: center;
  padding: 20px;
  background-color: #c40000;
  color: white;
  margin-top: 40px;
  font-size: 0.8em;
  width: 100%;
}

/* ------------------- RESPONSIVE / MOBILE ------------------- */
@media (max-width: 1023px) {

  .logo {
    order: 0;
  }

  .hero-text h1 {
    font-size: 1.5rem;
    padding: 0 1rem;
  }
  .language-selection {
    order: 2; /* Va sempre dopo hamburger */
    margin-left: auto; /* Spinge la selezione lingua a destra */
  
    flex-shrink: 0; /* Impedisce di tagliare i pulsanti */
    display: flex;
    flex-wrap: wrap; /* Se serve, vanno a capo */
    gap: 5px;
  }

  .language-button {
    font-size: 0.9em; /* Leggermente più piccolo */
    padding: 6px 10px;
    max-width: 100%;
  }


  .elenco-grid2 {
    grid-template-columns: 1fr;
    column-gap: 0;
  }

  .la-persona-flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .project {
    flex-direction: column;
    text-align: left;
  }

  .project-img {
    margin-top: 1rem;
    justify-content: flex-start;
  }

  .project-img img {
    max-width: 100%;
  }

  section {
    width: 95% !important;
    margin: 20px auto !important;
    padding: 20px !important;
  }

  .menu-toggle {  
    display: block;
    order: 1; /* Subito dopo il logo */
    margin-left: 20px;
  }

  .navbar {
    display: none;
    width: 250px; /* 100vw; auto;*/
    max-width: 100%;
    text-align: center;
    background-color: #c40000;
    position: absolute;
    top: 100%; /* 60px; */
    left: 0;
    padding: 10px 10px;
    z-index: 1050; /* sotto il pulsante, sopra la hero */
    overflow-x: hidden; /* evita lo scroll orizzontale */
  }

  .navbar.active {
    display: block;
  }
  .navbar ul {
    flex-direction: column;
    padding: 0;
    gap: 4px;
    width: 100%;
  }

  .navbar ul li {
    padding: 5px 0;
    width: 100%;
  }

  .navbar a {
    display: block;
    padding: 8px 15px;
    font-size: 1.1em;
    width: 100%;
    box-sizing: border-box;
  }
}

/* ------------------- ANIMAZIONI ------------------- */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}