/**
 * Tours & Destinations mega menu — container-width dropdown
 * Prefix: nav-mega-*
 */

/* ── Trigger in nav pill ── */
.nav-v2-item--mega {
  position: relative;
}

.nav-v2-mega-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.25;
}

.nav-v2-mega-chevron {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-v2-mega-trigger[aria-expanded="true"] .nav-v2-mega-chevron {
  transform: rotate(180deg);
}

.nav-v2-links .nav-v2-mega-trigger[aria-expanded="true"] {
  background: #fff;
  color: #0d1117;
  font-weight: 600;
}

.nav-v2-wrap--scrolled .nav-v2-mega-trigger[aria-expanded="true"],
.nav-v2-wrap.is-scrolled .nav-v2-mega-trigger[aria-expanded="true"] {
  background: #0d1117;
  color: #fff;
}

/* ── Container-width dropdown shell ── */
.nav-mega-backdrop {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(13, 17, 23, 0.28);
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
}

.nav-mega-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.nav-mega-backdrop[hidden] {
  display: none;
}

.nav-mega {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  z-index: 999;
  width: calc(100% - 2rem);
  max-width: 1280px;
  max-height: min(480px, 68vh);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 20px 56px rgba(13, 17, 23, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-8px) scale(0.98);
  transform-origin: top center;
  transition:
    opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.28s;
  pointer-events: none;
}

.nav-mega.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
  pointer-events: auto;
}

.nav-mega[hidden] {
  display: block;
}

.nav-mega[hidden]:not(.is-open) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.nav-mega-inner {
  display: grid;
  gap: 0;
  padding: 0 1rem 1.25rem;
  max-height: min(480px, 68vh);
  overflow-y: auto;
}

@media (min-width: 1024px) {
  .nav-mega {
    width: calc(100% - 3rem);
  }

  .nav-mega-inner {
    grid-template-columns: 220px minmax(0, 1fr) 240px;
    gap: 1.5rem;
    padding: 1.5rem 1.5rem 1.75rem;
  }
}

@media (min-width: 1280px) {
  .nav-mega-inner {
    grid-template-columns: 240px minmax(0, 1fr) 260px;
    gap: 2rem;
    padding: 1.75rem 1.5rem 2rem;
  }
}

/* ── Sidebar categories ── */
.nav-mega-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #c4694a;
}

.nav-mega-title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #0d1117;
}

.nav-mega-cats {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-mega-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-mega-cat svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.45;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-mega-cat:hover {
  background: rgba(13, 17, 23, 0.04);
  color: #0d1117;
  transform: translateX(2px);
}

.nav-mega-cat.is-active {
  background: #0d1117;
  color: #fff;
  font-weight: 600;
  transform: translateX(0);
}

.nav-mega-cat.is-active svg {
  opacity: 0.85;
}

.nav-mega-all-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 1rem;
  font-size: 13px;
  font-weight: 600;
  color: #c4694a;
  text-decoration: none;
  transition: gap 0.25s ease, color 0.2s ease;
}

.nav-mega-all-link:hover {
  gap: 10px;
  color: #9e5238;
}

.nav-mega-all-link svg {
  width: 14px;
  height: 14px;
  transition: transform 0.25s ease;
}

.nav-mega-all-link:hover svg {
  transform: translateX(2px);
}

/* ── Tour panels ── */
.nav-mega-panels {
  position: relative;
  min-height: 200px;
  min-width: 0;
  overflow: hidden;
  border-left: 1px solid #e8ecf2;
  padding-left: 1.25rem;
}

@media (max-width: 1023px) {
  .nav-mega-panels {
    border-left: 0;
    padding-left: 0;
    min-height: 160px;
  }
}

.nav-mega-panel {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-mega-panel.is-active {
  opacity: 1;
  transform: translateY(0);
}

.nav-mega-panel[hidden] {
  display: none;
}

.nav-mega-panel-title {
  margin: 0 0 0.875rem;
  font-size: 1rem;
  font-weight: 600;
  color: #0d1117;
}

.nav-mega-tours {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 1;
}

@media (min-width: 768px) {
  .nav-mega-tours {
    columns: 2;
    column-gap: 1.5rem;
  }
}

.nav-mega-tours li {
  break-inside: avoid;
  margin-bottom: 2px;
  opacity: 0;
  transform: translateY(4px);
  animation: nav-mega-link-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.nav-mega-panel.is-active .nav-mega-tours li:nth-child(1) { animation-delay: 0.02s; }
.nav-mega-panel.is-active .nav-mega-tours li:nth-child(2) { animation-delay: 0.05s; }
.nav-mega-panel.is-active .nav-mega-tours li:nth-child(3) { animation-delay: 0.08s; }
.nav-mega-panel.is-active .nav-mega-tours li:nth-child(4) { animation-delay: 0.11s; }
.nav-mega-panel.is-active .nav-mega-tours li:nth-child(5) { animation-delay: 0.14s; }
.nav-mega-panel.is-active .nav-mega-tours li:nth-child(6) { animation-delay: 0.17s; }
.nav-mega-panel.is-active .nav-mega-tours li:nth-child(7) { animation-delay: 0.2s; }
.nav-mega-panel.is-active .nav-mega-tours li:nth-child(8) { animation-delay: 0.23s; }

@keyframes nav-mega-link-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-mega-tours a {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  color: #4a5568;
  text-decoration: none;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.nav-mega-tours a:hover {
  background: rgba(196, 105, 74, 0.08);
  color: #0d1117;
  transform: translateX(3px);
}

.nav-mega-panel-more {
  display: inline-flex;
  margin-top: 0.875rem;
  font-size: 13px;
  font-weight: 600;
  color: #0d1117;
  text-decoration: none;
  border-bottom: 1px solid rgba(13, 17, 23, 0.2);
  transition:
    border-color 0.2s ease,
    color 0.2s ease,
    gap 0.2s ease;
}

.nav-mega-panel-more:hover {
  color: #c4694a;
  border-color: #c4694a;
}

/* ── Feature card ── */
.nav-mega-feature {
  position: relative;
  overflow: hidden;
  border-radius: 1.25rem;
  border: 1px solid #e8ecf2;
  min-height: 240px;
  opacity: 0;
  transform: translateX(8px);
  transition:
    opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.08s,
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.08s;
}

.nav-mega.is-open .nav-mega-feature {
  opacity: 1;
  transform: translateX(0);
}

.nav-mega-feature-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-mega-feature:hover .nav-mega-feature-img {
  transform: scale(1.04);
}

.nav-mega-feature-body {
  position: absolute;
  inset: auto 0 0;
  padding: 1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
}

.nav-mega-feature-tag {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}

.nav-mega-feature-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.nav-mega-feature-meta {
  margin: 4px 0 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.nav-mega-feature-cta {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: #0d1117;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-mega-feature-cta:hover {
  background: #f7f9fc;
  transform: translateY(-1px);
}

/* ── Mobile chrome ── */
.nav-mega-mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 1rem 0;
}

.nav-mega-back,
.nav-mega-close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
  transition: color 0.2s ease;
}

.nav-mega-back svg,
.nav-mega-close svg {
  width: 18px;
  height: 18px;
}

.nav-mega-close {
  width: 40px;
  height: 40px;
  justify-content: center;
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.05);
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-mega-close:hover {
  background: rgba(13, 17, 23, 0.08);
  transform: scale(1.04);
}

/* Mobile drill-down — still container-width, not fullscreen */
@media (max-width: 1023px) {
  .nav-mega {
    top: calc(100% + 6px);
    width: calc(100% - 1.5rem);
    max-height: min(420px, 62vh);
  }

  .nav-mega-inner {
    padding-top: 0.25rem;
  }

  .nav-mega[data-mobile-view="categories"] .nav-mega-panels,
  .nav-mega[data-mobile-view="categories"] .nav-mega-feature {
    display: none;
  }

  .nav-mega[data-mobile-view="tours"] .nav-mega-sidebar,
  .nav-mega[data-mobile-view="tours"] .nav-mega-feature {
    display: none;
  }

  .nav-mega[data-mobile-view="tours"] .nav-mega-panels {
    display: block;
  }

  .nav-mega-back[hidden] {
    display: none;
  }
}

@media (min-width: 1024px) {
  .nav-mega-mobile-head {
    display: none !important;
  }

  .nav-mega-cat svg {
    display: none;
  }
}

.nav-v2-wrap.is-mega-open {
  z-index: 1001;
}

/* Longer nav label */
@media (min-width: 1024px) and (max-width: 1240px) {
  .nav-v2-links .nav-v2-link,
  .nav-v2-mega-trigger {
    padding-left: 10px;
    padding-right: 10px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-mega,
  .nav-mega-backdrop,
  .nav-mega-panel,
  .nav-mega-feature,
  .nav-mega-tours li,
  .nav-v2-mega-chevron {
    transition: none;
    animation: none;
    transform: none;
    opacity: 1;
  }
}
