/* ============================================
   MEGA DROPDOWN - Chalets Image Tiles
   Target: #menu-item-2557 .sub-menu
   ============================================ */

/* Override the default sub-menu container */
#menu-item-2557 > .sub-menu.mega-dropdown-panel {
  width: 860px !important;
  padding: 16px !important;
  background: rgba(48, 43, 39, 0.97) !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45), 0 0 0 1px rgba(117,93,62,0.15) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  top: 100% !important;
  margin-top: 8px !important;
  opacity: 0;
  visibility: hidden;
  display: block !important;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
  transform: translateY(10px) !important;
  /* left is set dynamically by JS to center in viewport */
}

/* Show state when Superfish adds sfHover */
#menu-item-2557.sfHover > .sub-menu.mega-dropdown-panel {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  pointer-events: auto;
}

/* Always display:block - let opacity handle visibility */
#menu-item-2557 > .sub-menu.mega-dropdown-panel,
#menu-item-2557.sfHover > .sub-menu.mega-dropdown-panel {
  display: block !important;
}

/* Remove Superfish arrow */
#menu-item-2557 > a.sf-with-ul::after {
  display: none !important;
}

/* ---- Grid Layout ---- */
.mega-dropdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
}

/* ---- Individual Tile Card ---- */
.mega-tile {
  position: relative;
  display: block;
  width: 100%;
  height: 230px;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none !important;
  cursor: pointer;
  float: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: #2a2623 !important;
}

.mega-tile:hover {
  background: #2a2623 !important;
}

/* ---- Image Layer (stacked for crossfade) ---- */
.mega-tile-images {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
}

.mega-tile-img {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
  will-change: opacity;
}

.mega-tile-img.active {
  opacity: 1;
}

/* ---- Bottom Gradient Overlay ---- */
.mega-tile-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60%;
  background: linear-gradient(to top, rgba(26,23,20,0.9) 0%, rgba(26,23,20,0.5) 40%, transparent 100%);
  z-index: 2;
  pointer-events: none;
}

/* ---- Label at bottom ---- */
.mega-tile-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 3;
  padding: 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mega-tile-name {
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #ddd5c9 !important;
  text-transform: none !important;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
  line-height: 1.3;
}

.mega-tile-arrow {
  font-size: 18px;
  color: #998367;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ---- Hover Effects on Tile ---- */
.mega-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
  z-index: 4;
  pointer-events: none;
}

.mega-tile:hover::after {
  border-color: rgba(117, 93, 62, 0.6);
}

.mega-tile:hover .mega-tile-name {
  color: #fff !important;
}

.mega-tile:hover .mega-tile-arrow {
  opacity: 1;
  transform: translateX(0);
}

.mega-tile:hover .mega-tile-img.active {
  transform: scale(1.05);
  transition: opacity 1.2s ease-in-out, transform 8s ease-out;
}

/* ---- Override inherited sf-menu link styles ---- */
#menu-item-2557 > .sub-menu.mega-dropdown-panel a.mega-tile,
#menu-item-2557 > .sub-menu.mega-dropdown-panel .mega-tile {
  color: #ddd5c9 !important;
  text-transform: none !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
  padding: 0 !important;
  margin: 0 !important;
  float: none !important;
  display: block !important;
  border: none !important;
  border-bottom: none !important;
  background: #2a2623 !important;
  height: 230px;
  position: relative;
}

#menu-item-2557 > .sub-menu.mega-dropdown-panel a.mega-tile:hover {
  background: #2a2623 !important;
  color: #fff !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Hide original list items if any remain */
#menu-item-2557 > .sub-menu.mega-dropdown-panel > li {
  display: none !important;
}


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

/* Tablet: 2x2 grid */
@media (max-width: 1100px) {
  #menu-item-2557 > .sub-menu.mega-dropdown-panel {
    width: 480px !important;
  }
  .mega-dropdown-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .mega-tile,
  #menu-item-2557 > .sub-menu.mega-dropdown-panel a.mega-tile {
    height: 180px;
  }
}

/* Mobile: hidden - site uses separate modal menu */
@media (max-width: 991px) {
  #menu-item-2557 > .sub-menu.mega-dropdown-panel {
    display: none !important;
  }
}
