.megaMenuContent {
  display: grid;
}

.seeAllLink {
  display: flex;
  padding: var(--Spacing-x2) var(--Spacing-x3);
  align-items: center;
  gap: var(--Spacing-x1);
  background-color: var(--Base-Surface-Secondary-light-Normal);
}

.submenus {
  list-style: none;
  display: grid;
}

.submenuTitle {
  padding-left: var(--Spacing-x1);
}

.submenu {
  list-style: none;
}

.submenuItem {
  display: flex;
}

.submenusItem {
  display: grid;
  gap: var(--Spacing-x1);
  align-content: start;
}

.linkIcon {
  display: none;
}

.link:not(:hover) .arrow {
  opacity: 0;
}

.arrow {
  flex-shrink: 0;
}

.backWrapper {
  padding: var(--Spacing-x2);
}

.backButton {
  background-color: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--Spacing-x1);
  width: 100%;
}

@media screen and (max-width: 767px) {
  .megaMenu {
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  .megaMenuContent {
    flex-grow: 1;
    grid-template-rows: max-content 1fr;
    gap: var(--Spacing-x2);
    align-items: start;
  }
  .megaMenuContent:has(.cardWrapper) {
    grid-template-rows: max-content 1fr max-content;
  }

  .submenus {
    padding: var(--Spacing-x2);
  }

  .submenusItem:first-child {
    padding-bottom: var(--Spacing-x2);
    border-bottom: 1px solid var(--Primary-Light-On-Surface-Divider-subtle);
  }
  .submenusItem:last-child {
    padding-top: var(--Spacing-x3);
  }

  .cardWrapper {
    background-color: var(--Base-Surface-Secondary-light-Normal);
    padding: var(--Spacing-x4) var(--Spacing-x2);
  }
}

@media screen and (min-width: 768px) {
  .megaMenuContent {
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "seeAllLink"
      "submenus";
    width: 600px;
    max-width: calc(100vw - var(--Spacing-x4));
  }

  .megaMenuContent:has(.cardWrapper) {
    width: 900px;
    grid-template-columns: repeat(3, 1fr);
    grid-template-areas:
      "seeAllLink seeAllLink card"
      "submenus submenus card";
  }

  .seeAllLink {
    grid-area: seeAllLink;
  }

  .submenus {
    grid-area: submenus;
    grid-template-columns: repeat(2, 1fr);
    padding: var(--Spacing-x2) var(--Spacing-x3);
  }

  .submenusItem:first-child {
    padding-right: var(--Spacing-x5);
    border-right: 1px solid var(--Primary-Light-On-Surface-Divider-subtle);
  }
  .submenusItem:last-child {
    padding-left: var(--Spacing-x5);
  }

  .cardWrapper {
    grid-area: card;
  }

  .cardWrapper .card {
    border-radius: 0;
  }
}
