html.handout #handout-container {
  margin: auto;
  overflow: unset;
  touch-action: pan-x pan-y pinch-zoom;
  scroll-behavior: smooth;
}

html.handout .reveal-viewport {
  overflow: auto;
}

/* hide standard reveal element in handout mode, since it consumes space
when switching to last slide through the menu */
html.handout :not(#handout-container).reveal {
  display: none;
}

html.handout .reveal .slides {
  display: block;
  width: var(--slide-width);
  transform: scale(var(--scale-factor));
  transform-origin: top center;
  translate: -50% 0;
  left: 50%;
  margin: 0;
}

html.handout .reveal .slides section {
  position: static;
  opacity: 1;
  pointer-events: auto;
  transition: none !important;
  transform: none !important;
  height: unset !important;
}

/* visualize central slide (DEBUG ONLY) */
html.handout .reveal .slides section.current {
  outline: 2px solid var(--primary-color);
}

html.handout .reveal .slides section .handoutBackground {
  grid-area: common;
  width: var(--slide-width);
  height: var(--slide-height);
  background-position: 50% 50%;
  background-repeat: no-repeat;
  background-size: contain;
  object-fit: contain;
  z-index: -1;
}

/* pass through mouse events to control video or interactive iframes */
html.handout .reveal .slides section[data-background-video] > .decker,
html.handout
  .reveal
  .slides
  section[data-background-interactive="1"]
  > .decker {
  pointer-events: none;
}

html.handout .reveal .slides section.stack {
  display: block !important;
}

html.handout .reveal .slides section:not(.stack) {
  display: grid !important;
  grid-template-areas: "common";
  min-height: var(--slide-height);
  align-items: start;
  border-bottom: 1px solid var(--shade3);
}

html.handout .reveal .slides section .decker {
  grid-area: common;
  min-height: var(--slide-height);
  width: var(--slide-width);
  height: unset;
}

html.handout .reveal .slides section .whiteboard {
  grid-area: common;
  position: relative;
}

html.handout .reveal .backgrounds {
  display: none;
}

html.handout .reveal .pause-overlay {
  display: none;
}

html.handout .reveal .stack > p {
  display: block;
}

html.handout .reveal .stack span.media {
  display: block;
}

html.handout .reveal .slides section .stack {
  counter-reset: stack-item;
}

html.handout .reveal .slides section .stack .fragment {
  position: relative;
  border: 1px solid var(--foreground-color);
  margin: 0.5rem;
}

html.handout .reveal .slides section .stack .fragment img {
  border: none;
}

html.handout .reveal .slides section .stack .fragment::before {
  counter-increment: stack-item;
  content: counter(stack-item);
  color: var(--foreground-color);
  background-color: var(--background-color);
  position: absolute;
  font-size: 0.7em;
  top: 0;
  left: 0;
  width: 1.5em;
  height: 1.5em;
  text-align: center;
  vertical-align: middle;
  z-index: 2;
}

html.handout .reveal .slides section .stack .fragment:not(.current-fragment) {
  visibility: visible;
}

html .decker-anchor #handout-plus,
html .decker-anchor #handout-minus {
  display: none;
}
html.handout .decker-anchor #handout-plus,
html.handout .decker-anchor #handout-minus {
  display: inline-block;
}

.handout .decker {
  position: relative;
}

.handout-feedback-container {
  text-align: center;
  background-color: var(--shade1);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5em;
  border: 2px solid var(--shade2);
  border-radius: 0 0 1em 1em;
  margin-bottom: 0.5em !important;
}

.handout-feedback-comments {
  width: 100%;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.5em;
  font-size: 1.5rem;
  margin-top: 0.5em;
}

.handout-feedback-answer,
.handout-feedback-comment {
  position: relative;
  font-size: 1em;
  font-weight: normal;
  padding: 0.5em;
  border-radius: 0.5em;
  text-align: left;
  box-sizing: border-box;
  background-color: var(--background-color);
}

.handout-feedback-comment {
  margin-right: 5em;
  margin-left: 3em;
  justify-content: flex-start;

  &:before {
    content: "🙄";
    font-size: 1.7em;
    position: absolute;
    left: -2em;
    top: 0;
    width: 1.5em;
    height: 1.5em;
    text-align: center;
    border: none;
  }

  &:after {
    content: "";
    position: absolute;
    top: 0.7em;
    left: -0.9em;
    bottom: auto;
    border-width: 0.6em 0.9em 0.6em 0;
    border-style: solid;
    border-color: transparent var(--background-color);
    display: block;
    width: 0;
  }
}

.handout-feedback-answer {
  margin-left: 5em;
  margin-right: 3em;
  justify-content: flex-end;

  &:before {
    content: "🤓";
    font-size: 1.7em;
    position: absolute;
    right: -2em;
    top: 0;
    width: 1.5em;
    height: 1.5em;
    text-align: center;
    border: none;
  }

  &:after {
    content: "";
    position: absolute;
    top: 0.7em;
    right: -0.9em;
    bottom: auto;
    border-width: 0.6em 0 0.6em 0.9em;
    border-style: solid;
    border-color: transparent var(--background-color);
    display: block;
    width: 0;
  }
}
