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

body {
  font-family: Arial, sans-serif;
}

/* --- Hamburger button --- */
.hamburger {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 30px;
  height: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  z-index: 1001;
}
.hamburger div {
  height: 4px;
  background-color: #ffffff;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

/* --- Overlay --- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(27, 27, 27, 0.884);
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.8s, visibility 0.8s;
  z-index: 1000;
}
.overlay.active {
  visibility: visible;
  opacity: 1;
}

/* --- Animation keyframes for sliding in nav items --- */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --- Menu container layout --- */
.menu {
  display: flex;
  gap: 30px;
  justify-content: center;
  align-items: center;
  width: 90%;
  max-width: 1800px;
}

/* --- Container for each nav item (base) --- */
.menu-item-container {
  flex: 1;
  min-width: 100px;
  min-height: 700px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(175, 54, 227, 0.391);
  border-radius: 8px;
  /* initial hidden state; slideIn animation will override */
  opacity: 0;
  transform: translateX(-50px);
  /* only animate flex, filter on hover; no delays here */
  transition: flex 0.8s ease, filter 0.8s ease, transform 0.3s ease;
}

/* Staggered slide-in animations when overlay opens */
.overlay.active .menu-item-container:nth-child(1) {
  animation: slideIn 0.8s ease 0.1s forwards;
}
.overlay.active .menu-item-container:nth-child(2) {
  animation: slideIn 0.8s ease 0.2s forwards;
}
.overlay.active .menu-item-container:nth-child(3) {
  animation: slideIn 0.8s ease 0.3s forwards;
}
.overlay.active .menu-item-container:nth-child(4) {
  animation: slideIn 0.8s ease 0.4s forwards;
}

/* Exit: fade-out when overlay closes */
.overlay:not(.active) .menu-item-container {
  /* use transitions to animate back */
  animation: none;
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 1.5s ease, transform 1.5s ease;
}

/* --- Background images on the containers --- */
.menu-item-container.home {
  background-image: url("/assets/images/Home-Screenshot.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.menu-item-container.rules {
  background-image: url("/assets/images/Rules-Screenshot.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.menu-item-container.contact {
  background-image: url("/assets/images/Contact-Screenshot.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* --- Hover image overlays fade effect --- */
.menu-item-container::before {
  content: "";
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.8s ease;
  z-index: 1;
}
.menu-item-container.home::before {
  background-image: url("/assets/images/Home-Screenshot.webp");
}
.menu-item-container.rules::before {
  background-image: url("/assets/images/Rules-Screenshot.webp");
}
.menu-item-container.contact::before {
  background-image: url("/assets/images/Contact-Screenshot.webp");
}
.menu-item-container:hover::before {
  opacity: 1;
}

/* --- The link itself --- */
.menu-link {
  margin-top: 500px;
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  color: white;
  padding: 12px 16px;
  padding-left: 30px;
  padding-right: 30px;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  position: bottom;
  z-index: 2;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.3s ease;
}

.menu-link:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.617);
  filter: brightness(1.05);
}

/* --- Hover effect on the container (grow & brighten) --- */
.menu-item-container:hover {
  flex: 2;
  filter: brightness(1.1);
  transform: translateY(0);
}

/* === Hamburger active state === */
.hamburger.active div:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.hamburger.active div:nth-child(2) {
  opacity: 0;
}
.hamburger.active div:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* Desaturate siblings on hover */
.menu:hover .menu-item-container:not(:hover) {
  /* reduce saturation of non-hovered items */
  filter: grayscale(100%);
  transition: flex 0.8 ease 0.8 filter 0.3s ease;
}

/* Add short hover delay for container transitions */
.menu-item-container {
  /* First three values control slide-in animations unaffected by this rule, 
     then add delay for flex, filter, transform triggered on hover */
  transition: flex 0.8s ease 0.2s, filter 0.8s ease 0.2s,
    transform 0.8s ease 0.2s;
}

/* Add short hover delay for overlay opacity on hover */
.menu-item-container::before {
  transition: opacity 0.8s ease 0.2s;
}
