@import '../../styles/common';

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

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

.PopoverOverlay {
  will-change: opacity;
  opacity: 0;
  transition: opacity duration() easing(in);
}

.PopoverOverlay-open {
  opacity: 1;
}

.PopoverOverlay-exiting {
  opacity: 0;
  transition-timing-function: easing(out);
}

.measuring:not(.PopoverOverlay-exiting) {
  opacity: 0;
}

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

  .Content {
    max-width: none;
  }
}

.measuring {
  .Content {
    display: block;
  }
}

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

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

.Wrapper {
  position: relative;
  overflow: hidden;
  background-color: color('white');
  border-radius: border-radius();
  @media (-ms-high-contrast: active) {
    box-shadow: inset 0 0 0 border-width(base) ms-high-contrast-color('text');
  }
}

.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;
  }
}

.Content-fullHeight {
  max-height: none;
}

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

  + .Pane {
    border-top: border();
  }
}

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

.Section {
  padding: spacing();

  + .Section {
    border-top: border();
  }
}

.FocusTracker {
  @include visually-hidden;
}
