.output {
  display: contents;

  &[hidden] {
    display: none;
  }
}

.two-up {
  composes: abs-fill from global;
  --accent-color: var(--button-fg);
}

.pinch-zoom {
  composes: abs-fill from global;
  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 {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  grid-area: header;
  align-self: center;
  padding: 9px 66px;
  /* Had to disable containment because of the overflow menu. */
  /*
  contain: content;
  overflow: hidden;
  */
  transition: transform 500ms ease;

  /* Allow clicks to fall through to the pinch zoom area */
  pointer-events: none;

  & > * {
    pointer-events: auto;
  }

  @media (min-width: 860px) {
    padding: 9px;
    flex-wrap: wrap-reverse;
    grid-area: viewportOpts;
    align-self: end;
  }

  &[hidden] {
    visibility: visible;
    transform: translateY(-200%);

    @media (min-width: 860px) {
      transform: translateY(200%);
    }
  }
}

.zoom-controls {
  display: flex;
  position: relative;
  z-index: 100;

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

  & > :not(:nth-last-child(2)) {
    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: rgba(29, 29, 29, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.67);
  border-radius: 6px;
  line-height: 1.1;
  white-space: nowrap;
  height: 39px;
  padding: 0 8px;
  font-size: 1.2rem;
  cursor: pointer;

  &:focus {
    /* box-shadow: 0 0 0 2px var(--hot-pink); */
    box-shadow: 0 0 0 2px #fff;
    outline: none;
    z-index: 1;
  }
}

.button {
  color: #fff;

  &:hover {
    background: rgba(50, 50, 50, 0.92);
  }

  &.active {
    background: rgba(72, 72, 72, 0.92);
    color: #fff;
  }
}

.zoom {
  cursor: text;
  width: 7rem;
  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 #fff;
  }
}
span.zoom {
  color: #939393;
  font-size: 0.8rem;
  line-height: 1.2;
  font-weight: 100;
}
input.zoom {
  font-size: 1.2rem;
  letter-spacing: 0.05rem;
  font-weight: 700;
  text-indent: 3px;
  color: #fff;
}

.zoom-value {
  margin: 0 3px 0 0;
  padding: 0 2px;
  font-size: 1.2rem;
  letter-spacing: 0.05rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px dashed #999;
}

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

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

/** Three-dot menu */
.moreButton {
  padding: 0 4px;

  & > svg {
    transform-origin: center;
    transition: transform 200ms ease;
  }
}

[data-flyout-open] {
  .moreButton {
    background: rgba(82, 82, 82, 0.92);

    & > svg {
      transform: rotate(180deg);
    }
  }

  &:before {
    content: '';
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(50, 50, 50, 0.4);
    backdrop-filter: blur(2px) contrast(70%);
    animation: menuShimFadeIn 350ms ease forwards 1;
    will-change: opacity;
    z-index: -1;
  }
}

@keyframes menuShimFadeIn {
  0% {
    opacity: 0;
  }
}

.menu {
  button {
    margin: 8px 0;
    border-radius: 2rem;
    padding: 0 16px;

    & > svg {
      position: relative;
      left: -6px;
    }
  }

  h5 {
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #fff;
    margin: 8px 4px;
    padding: 10px 0 0;
  }
}
