$arrow-size: rem(14px);
$visible-portion-of-arrow: rem(5px);
$content-max-height: rem(295px);
$content-max-width: rem(400px);

.Biblio-Popover {
  max-width: calc(100vw - #{2 * spacing()});
  margin: $visible-portion-of-arrow spacing(tight) spacing();
  opacity: 1;
  box-shadow: shadow(deep);
  border-radius: border-radius();
  will-change: opacity, left, top;
  transition: opacity duration() easing(in);
}

.Biblio-Popover--fullWidth {
  margin: 0;
  margin-top: $visible-portion-of-arrow;

  .Biblio-Popover__Content {
    max-width: none;
  }
}

.Biblio-Popover--measuring:not(.Biblio-Popover--exiting),
.Biblio-Popover--exiting {
  opacity: 0;
}

.Biblio-Popover--measuring {
  .Biblio-Popover__Content {
    display: block;
  }
}

.Biblio-Popover--exiting {
  transition-timing-function: easing(out);
}

.Biblio-Popover--positionedAbove {
  margin: spacing() 0 $visible-portion-of-arrow spacing(tight);

  &.Biblio-Popover--fullWidth {
    margin: 0 0 $visible-portion-of-arrow;
  }
}

.Biblio-Popover__Wrapper {
  position: relative;
  overflow: hidden;
  background-color: color('white');
  border-radius: border-radius();
}

.Biblio-Popover__Content {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: border-radius();
  max-width: $content-max-width;
  max-height: $content-max-height;

  &:focus {
    outline: none;
  }
}

.Biblio-Popover__Content--fullHeight {
  max-height: none;
}

.Biblio-Popover__Pane {
  flex: 1 1 0%;
  max-width: 100%;

  + .Biblio-Popover__Pane {
    border-top: border();
  }
}

.Biblio-Popover__Pane--fixed {
  overflow: visible;
  flex: 0 0 auto;
}

.Biblio-Popover__Section {
  padding: spacing();

  + .Biblio-Popover__Section {
    border-top: border();
  }
}

.Biblio-Popover__FocusTracker {
  @include visually-hidden;
}
