.output {
  composes: abs-fill from '../../lib/util.scss';

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    opacity: 0;
    transition: opacity 500ms ease;
  }

  &.alt-background::before {
    opacity: 0.6;
  }
}

.two-up {
  composes: abs-fill from '../../lib/util.scss';
  --accent-color: var(--button-fg);
}

.pinch-zoom {
  composes: abs-fill from '../../lib/util.scss';
  outline: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pinch-target {
  // This fixes a severe painting bug in Chrome.
  // We should try to remove this once the issue is fixed.
  // https://bugs.chromium.org/p/chromium/issues/detail?id=870222#c10
  will-change: auto;
  // Prevent the image becoming misshapen due to default flexbox layout.
  flex-shrink: 0;
}

.controls {
  position: absolute;
  display: flex;
  justify-content: center;
  top: 0;
  left: 0;
  right: 0;
  padding: 9px 84px;
  overflow: hidden;
  flex-wrap: wrap;
  contain: content;

  // Allow clicks to fall through to the pinch zoom area
  pointer-events: none;
  & > * {
    pointer-events: auto;
  }

  @media (min-width: 860px) {
    padding: 9px;
    top: auto;
    left: 320px;
    right: 320px;
    bottom: 0;
    flex-wrap: wrap-reverse;
  }
}

.zoom-controls {
  display: flex;

  & :not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: 0;
  }
  & :not(:last-child) {
    margin-right: 0;
    border-right-width: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

.button,
.zoom {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  margin: 4px;
  background-color: #fff;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 5px;
  line-height: 1;
  white-space: nowrap;
  height: 36px;
  padding: 0 8px;
  cursor: pointer;

  @media (min-width: 600px) {
    height: 48px;
    padding: 0 16px;
  }

  &:focus {
    box-shadow: 0 0 0 2px var(--button-fg);
    outline: none;
    z-index: 1;
  }
}

.button {
  color: var(--button-fg);

  &:hover {
    background-color: #eee;
  }

  &.active {
    background: #34B9EB;
    color: #fff;

    &:hover {
      background: #32a3ce;
    }
  }
}

.zoom {
  color: #625E80;
  cursor: text;
  width: 6em;
  font: inherit;
  text-align: center;
  justify-content: center;

  &:focus {
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.2), 0 0 0 2px var(--button-fg);
  }
}

.zoom-value {
  position: relative;
  top: 1px;
  margin: 0 3px 0 0;
  color: #888;
  border-bottom: 1px dashed #999;
}

.back {
  position: absolute;
  top: 0;
  left: 0;
  padding: 9px;
}

.buttons-no-wrap {
  display: flex;
  pointer-events: none;

  & > * {
    pointer-events: auto;
  }
}
