.mega-menu {
  position: static;
}

.mega-menu__content {
  background-color: rgb(var(--color-background));
  border-left: 0;
  border-radius: 0;
  border-right: 0;
  left: 0;
  overflow-y: auto;
  padding-bottom: 3rem;
  padding-top: 3rem;
  position: absolute;
  right: 0;
  top: 100%;
  overflow: hidden;
}

/* .shopify-section-header-sticky .mega-menu__content {
  max-height: calc(100vh - var(--header-bottom-position-desktop, 20rem) - 4rem);
} */

@media (min-width: 750px) {
  .mega-menu__item {
    margin-bottom: 1rem;
  }
}

.header-wrapper--border-bottom .mega-menu__content {
  border-top: 0;
}

.js .mega-menu__content {
  opacity: 0;
  transform: translateY(-0.2rem);
  /* overflow: auto; */
  /* max-height: calc(100vh - var(--header-height)); */
}

.mega-menu[open] .mega-menu__content {
  opacity: 1;
  transform: translateY(0);
}

.mega-menu__content[aria-expanded='true'] {
  z-index: 10;
}

.mega-menu__list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  list-style: none;
}

.mega-menu__list > li {
  padding: 0 2.5rem;
}

/* .mega-menu__list > li:first-child {
  padding-left: 0;
} */

.mega-menu__list > li:last-child {
  padding-right: 0;
}

.mega-menu__link {
  color: rgb(var(--color-foreground));
  display: flex;
  line-height: calc(1 + 0.3 / var(--font-body-scale));
  padding-bottom: 0.6rem;
  padding-top: 0.6rem;
  text-decoration: none;
  transition: all 0.1s ease-in-out;
  word-wrap: break-word;
  gap: 1rem;
  align-items: center;
}

.mega-menu__link--level-2 {
  font-weight: bold;
}

.link__image {
  display: block;
  width: 4rem;
  height: 4rem; /* Default 1:1 ratio */
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: all 0.2s ease-in-out;
}

/* Aspect ratio variations */
.mega-menu__content[style*="--link-image-ratio: 1/1"] .link__image,
[style*="--link-image-ratio: 1/1"] .link__image {
  height: 4rem; /* 1:1 ratio */
}

.mega-menu__content[style*="--link-image-ratio: 3/4"] .link__image,
[style*="--link-image-ratio: 3/4"] .link__image {
  height: 5.333rem; /* 4rem / 3 * 4 = 5.333rem for 3:4 ratio */
}

.mega-menu__content[style*="--link-image-ratio: 4/3"] .link__image,
[style*="--link-image-ratio: 4/3"] .link__image {
  height: 3rem; /* 4rem / 4 * 3 = 3rem for 4:3 ratio */
}

/* Modern browser support with aspect-ratio */
@supports (aspect-ratio: 1) {
  .link__image {
    height: auto;
    aspect-ratio: var(--link-image-ratio);
  }
}

.mega-menu__link:hover .link__image {
  box-shadow: 0 0 0 0.1rem rgba(var(--color-link-hover), 0.45);
}

.link__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.header--top-center .mega-menu__list {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  column-gap: 0;
}

.header--top-center .mega-menu__list > li {
  width: 16%;
  padding-right: 2.4rem;
}

.mega-menu__link:hover,
.mega-menu__link--active {
  color: rgb(var(--color-link-hover));
}

.mega-menu__link--active:hover {
  text-decoration-thickness: 0.2rem;
}

.mega-menu .mega-menu__list--condensed {
  display: block;
}

.mega-menu__list--condensed .mega-menu__link {
  font-weight: normal;
}
