@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap');

/* RESET DI BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  display: flex;
  flex-direction: column;
}

body {
  font-family: 'Nunito', sans-serif;
  background: #f4f5f7;
  color: #2c2c2c;
  line-height: 1.7;
  transition: background 0.3s ease, color 0.3s ease;
  flex: 1;
}

/* HEADER */
header {
  color: #0d6efd;
  padding: 12px 15px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: #ffffffcc;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 20px -10px rgba(13, 110, 253, 0.2);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

h1 {
  margin: 10px;
  font-size: 35px;
}

h2 {
  color: #0d6efd;
  text-align: center;
}

p {
  font-size: 1.1rem;
  margin-bottom: 5px;
}

nav {
  padding: 25px 0;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 35px;
  flex-wrap: wrap;
}

nav a {
  text-decoration: none;
  color: #0d6efd;
  font-weight: 600;
  font-size: 1.2rem;
  transition: all 0.2s ease;
  position: relative;
}

nav a::after {
  content: '';
  position: absolute;
  width: 0%;
  height: 2px;
  bottom: -3px;
  left: 0;
  background: #0d6efd;
  transition: width 0.3s ease;
}

nav a:hover::after {
  width: 100%;
}

nav a:hover {
  color: #0a58ca;
}

/* CONTENUTO PRINCIPALE */
main {
  max-width: 1600px;
  margin: 40px auto;
  padding: 0 40px;
  flex: 1;
}

/* GALLERIA RESPONSIVE */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  width: 100%;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  background: #fff;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.12);
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.4s ease, filter 0.4s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
  filter: brightness(1.07);
}

/* LIGHTBOX */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 40px;
  box-sizing: border-box;
}

.lightbox img {
  max-width: 92%;
  max-height: 92%;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.3s ease-in-out;
}

.close-lightbox {
  position: absolute;
  top: 25px;
  right: 35px;
  font-size: 2.2rem;
  color: #fff;
  cursor: pointer;
  z-index: 1001;
  transition: color 0.3s ease;
}

.close-lightbox:hover {
  color: #0d6efd;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 3rem;
  cursor: pointer;
  user-select: none;
  transition: color 0.3s ease, transform 0.2s ease;
  z-index: 1002;
}

.lightbox-arrow:hover {
  color: #0d6efd;
  transform: translateY(-50%) scale(1.1);
}

.lightbox-arrow.prev { left: 50px; }
.lightbox-arrow.next { right: 50px; }

/* FOOTER */
footer {
  background: #0d6efd;
  color: #fff;
  text-align: center;
  padding: 25px;
  width: 100%;
  font-size: 1rem;
  box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.15);
  margin-top: auto;
}

/* ANIMAZIONI */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* MOBILE OPTIMIZATION */
@media (max-width: 768px) {
  h1 {
    font-size: 28px;
  }

  nav {
    flex-direction: column;
    align-items: center;      
    justify-content: center; 
    gap: 15px;
    padding: 20px 0;
  }

  nav a {
    display: block;
    width: 60%;
    text-align: center;
    background: #f4f4f4;
    border: 1px solid #0d6efd;
    border-radius: 10px;
    padding: 8px;
    text-decoration: none;
    color: #0d6efd;
    font-weight: 600;
    text-align: center;
    transition: background 0.3s, color 0.3s;
  }

  main {
    padding: 0 20px;
    margin: 20px auto;
  }

  .gallery {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .gallery-item {
    border-radius: 12px;
  }

  .lightbox img {
    max-width: 95%;
    max-height: 80%;
  }

  .lightbox-arrow.prev { left: 20px; }
  .lightbox-arrow.next { right: 20px; }
}