firefox-apps {
  --backgroundColor: rgb(249, 249, 250);
  --bentoHoverBgColor: rgb(97, 90, 115);
  --bentoClickBgColor: rgb(142, 137, 154);
  --bentoButtonHeight: 25px;
  --zIndex: 10000;
  --appIconHeight: 16px;
  --textColor: rgb(32, 18, 58);
  --bentoPadding: 24px;

  display: flex;
  margin: auto 32px;
  position: relative;
  text-align: center;
  z-index: var(--zIndex);
  font-size: 12px;
  width: var(--bentoButtonHeight);
  min-height: var(--bentoButtonHeight);
  color: var(--textColor);
  background: url("/static/images/fx-bento-sprites.png");
  background-position-x: -215.5px;
  background-position-x: -224px;
  background-size: auto var(--bentoButtonHeight);
  border-radius: 2px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0);
}

firefox-apps.fx-bento-open,
firefox-apps:hover {
  box-shadow: 0 0 0 4px var(--bentoHoverBgColor);
  background-color: var(--bentoHoverBgColor);
}

firefox-apps:focus,
firefox-apps:focus-within {
  box-shadow: 0 0 0 4px var(--bentoHoverBgColor);
  background-color: var(--bentoHoverBgColor);
}

firefox-apps:active {
  box-shadow: 0 0 0 4px var(--bentoClickBgColor);
  background-color: var(--bentoClickBgColor);
}

.fx-bento-hide-overflow {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.fx-bento-content-wrapper {
  position: absolute;
  top: calc(var(--bentoButtonHeight) + 10px);
  min-width: 260px;
  z-index: calc(var(--zIndex) + 1);
  box-shadow: 0 7px 12px -3px rgba(28, 28, 29, 0.502);
  right: -18px;
  background: var(--backgroundColor);
  border-radius: 8px;
  transform: translateY(0);
  display: none;
  border: 1px solid transparent;
}

.fx-bento-content {
  display: flex;
  flex-direction: column;
  padding: var(--bentoPadding) 0 0 0;
}

.fx-bento-enable-scrolling {
  overflow-y: scroll;
}

.active .fx-bento-content-wrapper {
  display: block;
  height: auto;
  transform: translateY(12px);
  animation: fxBentoAppear ease 0.3s;
  -webkit-animation: fxBentoAppear ease 0.3s;
  -moz-animation: fxBentoAppear ease 0.3s;
}

.active .fx-bento-content-wrapper::after { /* tool tip top notch */
  display: block;
  content: "";
  height: 12px;
  width: 12px;
  position: absolute;
  top: -7px;
  right: 23px;
  margin: auto;
  transform: rotate(45deg);
  border-top-left-radius: 1px;
  background-color: rgb(249, 249, 250);
  border-top: 1px solid transparent; /* creates outline in high-contrast mode */
  border-left: 1px solid transparent; /* creates outline in high-contrast mode */
  z-index: -1;
}

.fx-bento-logo {
  background: url("/static/images/fx-bento-sprites.png");
  background-repeat: no-repeat;
  background-size: cover;
  height: 40px;
  width: 40px;
  margin: auto auto 8px auto;
  background-position-x: -90px;
}

.fx-bento-headline {
  font-size: 16px;
  font-family: "Metropolis", sans-serif;
  line-height: 20px;
  font-weight: 600;
  margin-right: auto;
  margin-left: auto;
  max-width: 270px;
  display: block;
  padding-left: 20px;
  padding-right: 20px;
}

.fx-bento-bottom-link {
  color: rgb(0, 96, 223);
  text-decoration: underline;
  padding: 10px var(--bentoPadding);
  margin: 14px auto;
  width: 100%;
}

a.fx-bento-app-link {
  background-color: rgba(255, 255, 255, 0);
  text-align: left;
}

.fx-bento-app-link-span {
  display: block;
  padding: 10px var(--appIconHeight) 10px calc(var(--appIconHeight) + 32px);
  color: var(--textColor);
  position: relative;
  margin-right: auto;
  margin-left: auto;
  max-width: 410px;
  pointer-events: none;
}

.fx-bento-app-link-span::before {
  display: block;
  position: absolute;
  left: var(--bentoPadding);
  top: 0;
  bottom: 0;
  margin: auto;
  height: var(--appIconHeight);
  min-height: var(--appIconHeight);
  width: var(--appIconHeight);
  background: url("/static/images/fx-bento-sprites.png");
  background-size: auto var(--appIconHeight);
  content: "";
}

.fx-bento-app-link-span.pocket::before {
  background-position-x: -18px;
}

.fx-bento-app-link-span.fx-monitor::before {
  background-position-x: -88px;
}

.fx-bento-app-link-span.fx-mobile::before {
  background-position-x: -104px;
}

.fx-bento-link:hover,
.fx-bento-link:focus {
  background-color: rgb(230, 230, 230);
  opacity: 1 !important;
}

.fx-bento-button {
  width: 100%;
  border: 1px solid transparent; /* Creates outline in high-contrast modes */
  pointer-events: all;
  background: transparent;
}

.fx-bento-button:hover,
.fx-bento-button:focus,
.fx-bento-button:active {
  outline: 0;
  box-shadow: none;
  border: 1px solid transparent;
}

.fx-bento-button:hover::-moz-focus-inner, /* hide dotted line */
.fx-bento-button:focus::-moz-focus-inner {
  border: 0;
  outline: 0;
}

button.fx-bento-mobile-close {
  display: none; /* button is only displayed on smaller screen sizes */
  position: absolute;
  right: var(--appIconHeight);
  top: var(--appIconHeight);
  height: var(--bentoPadding);
  min-height: var(--bentoPadding);
  width: var(--bentoPadding);
  max-width: var(--bentoPadding);
  min-width: var(--bentoPadding);
  background-color: rgb(55, 54, 111);
  background-image: url("/static/images/fx-bento-sprites.png");
  background-size: auto 20px;
  background-repeat: no-repeat;
  background-position-x: -150.5px;
  padding: 0 !important;
  border: none !important;
  border-radius: 50%;
  background-position-y: 2px;
}

.fx-bento-app-link:first-of-type {
  margin-top: var(--appIconHeight);
}

.fx-bento-fade-out {
  opacity: 0;
  transform: translateY(0) !important;
  pointer-events: none !important;
}

a.fx-bento-link,
a.fx-bento-link:hover,
a.fx-bento-link:focus,
.fx-bento-button,
.fx-bento-button:hover,
.fx-bento-button:focus,
.fx-bento-fade-out,
firefox-apps,
firefox-apps:hover,
firefox-apps:focus-within {
  transition: 0.2s ease-in-out;
}

body.hide-bento firefox-apps {
  background: none !important;
  visibility: hidden !important;
  width: 0;
}

body.hide-bento firefox-apps > button {
  visibility: hidden !important;
}

@media screen and (max-width: 900px) {
  firefox-apps {
    margin: 0 var(--bentoPadding);
  }

  .fx-bento-button {
    transform: scale(0.9);
  }
}

@media screen and (max-width: 500px) {
  firefox-apps {
    --appIconHeight: var(--bentoPadding);
    --mobileClickableCloseArea: 12vh;

    position: inherit;
    margin: 0 var(--appIconHeight);
  }

  button.fx-bento-mobile-close { /* Unhide purple "X" button */
    display: block;
  }

  .fx-bento-hide-overflow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 100vh;
    overflow-y: scroll;
    overflow-x: scroll;
  }

  .fx-bento-mobile-close::after { /* create pseudo element to increase the clickable area of .fx-bento-mobile-close button */
    content: "";
    display: block;
    position: fixed;
    right: 0;
    top: 0;
    left: 0;
    height: var(--mobileClickableCloseArea);
  }

  .fx-bento-content-wrapper {
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
    transform: translateY(0) !important;
  }

  .fx-bento-logo {
    height: 48px;
    width: 48px;
    min-height: 48px;
    margin-top: var(--mobileClickableCloseArea);
    background-position-x: -108px;
  }

  .fx-bento-headline {
    font-size: 20px;
    line-height: var(--bentoPadding);
    padding-left: 0;
    padding-right: 0;
  }

  .fx-bento-bottom-link {
    margin-bottom: auto;
    margin-top: var(--bentoPadding);
  }

  .fx-bento-bottom-link,
  .fx-bento-app-link {
    font-size: 16px;
  }

  .active .fx-bento-content-wrapper {
    transform: translateY(0) !important;
    animation: none !important;
    -webkit-animation: none !important;
  }

  .active .fx-bento-content-wrapper::after {
    display: none;
  }

  a.fx-bento-app-link {
    line-height: 23px;
  }

  .fx-bento-app-link-span {
    max-width: 342px;
    padding-left: calc(var(--appIconHeight) + 40px);
    padding-left: calc(var(--appIconHeight) + 40px);
  }

  .fx-bento-app-link-span.pocket::before {
    background-position-x: -26px;
  }

  .fx-bento-app-link-span.fx-monitor::before {
    background-position-x: -132px;
  }

  .fx-bento-app-link-span.fx-mobile::before {
    background-position-x: -157px;
    margin-left: 1px;
  }
}

@keyframes fxBentoAppear {
  0% {
    opacity: 0;
    transform: translateY(0);
  }

  100% {
    opacity: 1;
    transform: translateY(12px);
  }
}
