@import url('https://fonts.googleapis.com/css2?family=Didot&display=swap');

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

/* BODY */
body {
  font-family: 'Didot', serif;
  background-color: #fff;
  color: #000;
  overflow-x: hidden;
  opacity: 0;
  transition: opacity 0.6s ease;
}
body.fade-in { opacity: 1; }

/* COLORI MENU PAGINE INTERNE / HOMEPAGE */
body nav a,
body nav span,
body nav .submenu a {
  color: #fff !important;
}
body:not(.internal-page) .submenu a:hover { color: #ccc; }

/* HEADER */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  background: white;
  border-bottom: 1px solid #000;
}

.logo {
  font-size: calc(1.4rem * 1.4);
  letter-spacing: 1px;
  text-decoration: none;
  color: #000;
}

/* === PRELOADER === */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 1s ease;
}

#preloader.fade-out {
  opacity: 0;
  pointer-events: none;
}

.preloader-content h1 {
  font-family: 'Didot', serif;
  font-size: 3.5rem;
  color: #fff;
  letter-spacing: 3px;
  opacity: 0;
  text-transform: uppercase;
  animation: fadeInText 2.4s ease forwards;
}

@keyframes fadeInText {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}


/* MENU HAMBURGER */
.menu-toggle {
  width: 35px;
  height: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  z-index: 3000;
  position: relative;
}
.menu-toggle div,
.bar {
  height: 3px;
  width: 100%;
  background-color: #000;
  border-radius: 2px;
  transition: all 0.3s ease;
}
.menu-toggle.active .bar:nth-child(1) { transform: rotate(45deg) translate(5px, 6px); }
.menu-toggle.active .bar:nth-child(2) { opacity: 0; }
.menu-toggle.active .bar:nth-child(3) { transform: rotate(-45deg) translate(5px, -6px); }

/* MENU */
.menu a,
.menu span,
.submenu a {
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 1);
  transition: color 0.3s ease;
  font-family: "Didot", serif;
  text-transform: uppercase;
}
.menu a:hover, .submenu a:hover { color: #ccc; }

/* NAV */
nav {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 90vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 50px;
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1), opacity 0.4s ease;
  z-index: 2000;
}
nav.active { transform: translateX(0); opacity: 1; pointer-events: all; }
nav ul { list-style: none; padding: 0; margin: 0; }

/* OVERLAY MENU */
#menu-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
}
#menu-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* MENU VOCI */
nav a,
nav span {
  font-family: 'Didot', serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
  text-decoration: none;
  font-size: 1.72rem;
  margin: 0 !important;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  width: 100%;
  text-shadow: 0 2px 4px rgba(0,0,0,1);
}
nav.active a, nav.active span {
  opacity: 1;
  transform: translateY(0);
}

/* SOTTOMENU */
.has-submenu { display: flex; flex-direction: column; row-gap: 8px; }
.submenu {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding-left: 20px;
  margin: 0 !important;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.35s ease, transform 0.35s ease, max-height 0.35s ease;
}
.has-submenu:hover .submenu,
.has-submenu.open .submenu {
  max-height: 600px;
  opacity: 1;
  transform: translateY(0);
}

/* HERO */
.hero {
  height: 100vh;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.hero video {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  min-width: 100%; min-height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease-out;
}

/* === GRIGLIA PREVIEW BASE === */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  grid-auto-rows: 250px;
  grid-auto-flow: dense;
  gap: 20px;
  padding: 80px 40px;
}
.grid-item {
  position: relative;
  overflow: hidden;
  background-color: #f2f2f2;
  opacity: 0;
  transform: translateY(40px);
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}
.grid-item.visible {
  opacity: 1;
  transform: translateY(0);
}
.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
  cursor: pointer;
}
.grid-item:hover img { transform: scale(1.05); }
.grid-item:hover { box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); }

/* === LAYOUT ASIMMETRICO ATTIVABILE SOLO CON CLASSE .asymmetric === */
.grid.asymmetric .grid-item:nth-child(2n) { grid-row: span 2; }
.grid.asymmetric .grid-item:nth-child(3n) { grid-column: span 2; }

.grid-item.wide { grid-column: span 2; }
.grid-item.tall { grid-row: span 2; }
.grid-item.big  { grid-column: span 2; grid-row: span 2; }

@media (max-width: 768px) {
  .grid-item.wide,
  .grid-item.tall,
  .grid-item.big {
    grid-column: span 1;
    grid-row: span 1;
  }
  .grid { padding: 60px 20px; gap: 15px; }
}

/* DIDASCALIA */
.caption {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.4s ease;
  text-transform: uppercase;
}
.grid-item:hover .caption { opacity: 1; }

/* ===== MODAL ===== */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 5vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 1000;
}
.modal.active { opacity: 1; pointer-events: all; }
.modal-content {
  max-width: 90%;
  max-height: 90vh;
  background: transparent;
  border: none;
  padding: 0;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.modal-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  display: block;
}
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  transition: transform 0.3s ease, color 0.3s ease;
}
.nav-btn:hover {
  color: #ccc;
  transform: translateY(-50%) scale(1.2);
}
.prev { left: -60px; }
.next { right: -60px; }
@media (max-width: 768px) {
  .prev { left: 10px; }
  .next { right: 10px; }
}
.close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 2rem;
  cursor: pointer;
}

/* === POPUP VIDEO FULLSCREEN === */
.video-popup {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.9);
  justify-content: center;
  align-items: center;
  z-index: 3000;
}
.video-popup.active { display: flex; }
.video-popup-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.video-popup video {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}
.close-popup {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.close-popup:hover { transform: scale(1.2); }

/* === Pulsante Mute / Unmute === */
#mute-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}
#mute-btn:hover { transform: scale(1.2); }
#mute-btn .icon {
  display: block;
  width: 32px;
  height: 32px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: brightness(0) invert(1);
}
#mute-btn .icon.mute   { background-image: url('icons/mute.png'); }
#mute-btn .icon.unmute { background-image: url('icons/volume.png'); }

/* ============================
   STILI SPECIFICI PAGINA VIDEO
=============================== */
.video-page .grid.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-auto-rows: 300px;
  grid-auto-flow: dense;
  gap: 10px;
  padding: 60px 20px;
}
.video-page .grid-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: none;
}
.video-page .grid-item.wide  { grid-column: span 2; }
.video-page .grid-item.tall  { grid-row: span 2; }
.video-page .grid-item.big   { grid-column: span 2; grid-row: span 2; }
.video-page .grid-item {
  position: relative;
  overflow: hidden;
  background-color: #000;
  opacity: 0;
  transform: translateY(40px);
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}
.video-page .grid-item.visible {
  opacity: 1;
  transform: translateY(0);
}
.video-page .grid-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
  pointer-events: none;
}
.video-page .grid-item:hover video { transform: scale(1.05); }

/* Didascalia */
.video-page .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: 'Didot', serif;
  font-size: 1.2rem;
  letter-spacing: 0.5px;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.video-page .grid-item:hover .caption { opacity: 1; }
.video-page .caption .alt-font {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  letter-spacing: 0;
}

@media (max-width: 768px) {
  .video-page .grid-item.wide,
  .video-page .grid-item.tall,
  .video-page .grid-item.big {
    grid-column: span 1;
    grid-row: span 1;
  }
  .video-page .grid.video-grid { padding: 60px 20px; gap: 15px; }
  .video-page .caption { font-size: 1rem; }
}
/* HERO fullbleed affidabile su mobile */
:root { --vh: 1vh; }

.hero {
  position: relative;
  width: 100vw;
  height: calc(var(--vh) * 100); /* fix iOS 100vh */
  overflow: hidden;
}

/* il video è centrato e copre sempre */
.hero video {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%); /* su mobile resta fisso (no parallax) */
  width: 100vw;
  height: calc(var(--vh) * 100);
  object-fit: cover;
  object-position: center;
  display: block;
}

/* il bottone mute resta come prima (se avevi già gli stili, non servono cambi) */
/* ...altri tuoi stili restano invariati */
