/* =========================
   ROOT VARIABLES
========================= */
:root {
  --primary-color: #004492;
  --secondary-color: #9e4141;
  --accent-color: #ffcc00;
  --text-color: #333333;
  --background-color: #ffffff;
  --hover-color: #3b7dd8;
  --font-family: 'Poppins', sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--secondary-color);
  background: none;
  position: relative;
  color: var(--text-color);
  line-height: 1.6;
}

/* =========================
   NAVBAR & MENU
========================= */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background-color: var(--background-color);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 5;
}

.logo img {
  width: 130px;
}

.menu {
  list-style: none;
  display: flex;
  gap: 20px;
}

.menu li {
  display: inline-block;
  position: relative;
}

.menu li a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 18px;
  position: relative;
  padding: 5px 0;
}

.menu li a::after {
  content: '';
  position: absolute;
  width: 0%;
  height: 2px;
  left: 0;
  bottom: 0;
  background-color: var(--primary-color);
  transition: width 0.3s ease;
}

.menu li a:hover::after {
  width: 100%;
}

.menu li a:hover {
  color: var(--primary-color);
}

/* Separatore automatico tra i menu */
.menu li:not(:last-child)::after {
  content: '|';
  position: absolute;
  margin: 0 10px;
  color: var(--text-color);
}

/* =========================
   HAMBURGER MENU
========================= */
.hamburger {
  display: none;
  width: 30px;
  height: 25px;
  position: relative;
  cursor: pointer;
  z-index: 10;
}

.hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: black;
  margin: 6px 0;
  transition: 0.4s;
}

/* Animazione hamburger attivo */
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Animazione apertura menu */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   VIDEO BACKGROUND
========================= */
.video-background {
  position: relative;
  width: 100%;
  height: 50vh;
  overflow: hidden;
  z-index: 1;
}

.video-background video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.overlay-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: clamp(1.5rem, 5vw, 3rem);
  text-align: center;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
  z-index: 2;
  transition: font-size 0.3s ease;
}

/* =========================
   CONTENUTO PRINCIPALE
========================= */
main {
  padding: 20px;
  max-width: 800px;
  margin: auto;
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.descrizione {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--text-color);
  line-height: 1.7;
  text-align: center;
}

h2, h3, h4 {
  text-align: center;
}

section > h2 {
  margin-bottom: 1rem;
  color: var(--primary-color);
  font-weight: 600;
}

section {
  margin-bottom: 20px;
}

p {
  text-align: center;
}

hr {
  margin: 50px;
}

.background-section.light {
  background-color: #f9f9f9;
  padding: 30px;
  border-radius: 12px;
  margin-bottom: 20px;
}

/* =========================
   CARD (BOX CONTENUTO)
========================= */
.card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--background-color);
  margin: 10px 0 30px;
  padding: 25px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-left 0.3s ease;
  border-left: 5px solid transparent;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  border-left: 5px solid var(--primary-color);
}

.card:nth-child(even) {
  flex-direction: row-reverse;
}

.card-content {
  flex: 1;
  padding: 20px;
}

.card-content h3 {
  margin-bottom: 15px;
  font-size: 24px;
  color: var(--primary-color);
}

.card-content p {
  line-height: 1.7;
  color: var(--text-color);
}

.card-image {
  text-align: center;
  flex: 1;
  padding: 20px;
}

.card-image img {
  width: 120px;
  border-radius: 12px;
  transition: transform 0.3s ease;
}

.card:hover .card-image img {
  transform: scale(1.05);
}

/* =========================
   FOOTER
========================= */
.footer {
  background-color: #222;
  color: #fff;
  padding: 40px 20px 20px;
  font-family: Arial, sans-serif;
}

.footer-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-section h3, .footer-section h4 {
  margin-bottom: 10px;
}

.footer-section p, .footer-section a {
  font-size: 14px;
  color: #ccc;
  text-decoration: none;
}

.footer-section a:hover {
  color: #fff;
}

.footer-map iframe {
  border-radius: 8px;
  width: 100%;
  height: 150px;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #444;
  font-size: 13px;
  color: #aaa;
}

/* =========================
   RESPONSIVE DESIGN
========================= */

/* Menu responsive */
@media (max-width: 768px) {
  .menu {
    display: none;
    flex-direction: column;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    position: absolute;
    top: 80px;
    left: 0;
    text-align: left;
    padding: 15px 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 8;
  }

  .menu.active {
    display: flex;
    animation: slideDown 0.3s ease-in-out forwards;
  }

  .menu li {
    margin: 10px 20px;
  }

  /* Rimuove i separatori nel menu mobile */
  .menu li:not(:last-child)::after {
    content: none;
  }

  .hamburger {
    display: block;
  }

  .logo img {
    width: 100px;
  }

  /* Card layout mobile */
  .card, .card:nth-child(even) {
    flex-direction: column;
    text-align: center;
  }

  .card-image img {
    width: 30%;
  }

  /* Layout servizi in 2 colonne */
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  /* Layout servizi in 1 colonna */
  .services-grid {
    grid-template-columns: 1fr;
  }
}