/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

.arrowPanelAnchor {
  position: absolute;
  z-index: 5;
  top: 75%;
  left: 50%;
}

.arrowPanel {
  --internal-offset-from-right: var(--offset-from-right, 60px);
  --internal-offset-from-top: 15px;
  --internal-width: var(--width, initial);
  --internal-button-height: 30px;

  position: absolute;
  top: var(--internal-offset-from-top);
  right: calc(var(--internal-offset-from-right) * -1);
  min-width: var(--internal-width);
  border: 0.5px solid rgb(0 0 0 / 0.25);
  border-radius: 5px;
  background: hsl(0deg 0% 97%);
  background-clip: padding-box;
  box-shadow: 0 8px 12px rgb(0 0 0 / 0.35);
  color: black;
  line-height: 1.3;
  text-align: left;
  transform-origin: calc(100% - var(--internal-offset-from-right))
    calc(var(--internal-offset-from-top) * -1);
}

.arrowPanel:not(.open) {
  opacity: 0;
  pointer-events: none;

  /* The visibility is set to hidden after the panel closing transition. */
  transition:
    opacity 200ms ease-out,
    visibility 0s 200ms;

  /* visibility: hidden hides the panel from the accessibility tree when it's closed */
  visibility: hidden;
}

.arrowPanel.open {
  animation: arrowPanelAppear 200ms cubic-bezier(0.07, 0.95, 0, 1);
}

@media (prefers-reduced-motion) {
  .arrowPanel.open {
    animation: none;
    opacity: 1;
  }
}

@keyframes arrowPanelAppear {
  from {
    opacity: 0;
    transform: translateY(-25px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.arrowPanelArrow {
  position: absolute;
  top: calc(var(--internal-offset-from-top) * -1);
  right: 0;
  left: 0;
  overflow: hidden;
  height: var(--internal-offset-from-top);
}

.arrowPanelArrow::before {
  position: absolute;
  top: 0;
  left: calc(100% - var(--internal-offset-from-right));
  display: block;
  width: calc(1.42 * var(--internal-offset-from-top));
  height: calc(1.42 * var(--internal-offset-from-top));
  border: 0.5px solid rgb(0 0 0 / 0.25);
  background: hsl(0deg 0% 97%);
  background-clip: padding-box;
  content: '';
  transform: rotate(45deg);
  transform-origin: top left;
}

.arrowPanelContent {
  overflow: auto;
  max-height: calc(
    100vh - var(--internal-approx-distance-from-top) -
      var(--internal-button-height) - var(--internal-approx-distance-to-bottom)
  );
  padding: 16px;

  --internal-approx-distance-from-top: 60px;
  --internal-approx-distance-to-bottom: 100px;
}
