/* scrolly.css defines the styles for scrollytelling elements */

.scrolly-container {
  position: relative;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  padding: 1rem;
}

/* increase margin for larger screens */
@media (min-width: 1024px) {
  .scrolly-container {
    margin: 2rem;
  }
  .sticky-container {
    margin-left: 1rem;
  }
}

.scrolly-container > * {
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 0 0 auto;
}

/* CSS properties common to all sticky content */
.sticky-container {
  position: -webkit-sticky;
  position: sticky;
  z-index: 0;
  top: 12.5vh;
  height: 75vh;
  width: 67%;
  /* The opacity transition will fade the content in/out when it gets replaced, 
  so set the opacity to 1 when fading in and 0 when fading out */
  transition: opacity 0.5s linear;
}

/* Keep sticky content vertically centered in the usable viewport 
  above the timeline footer. The calc values are the total screen height minus 
  the timeline footer height, thus the total available height for the sticky content.
  If we set the height to 80% of the available height, and the top of the content to 10%, we'll
  have top/bottom margin of 10% of the available height
    */
body.has-fixed-timeline .sticky-container {
  top: calc((100vh - var(--timeline-footer-height)) * 0.1);
  height: calc((100vh - var(--timeline-footer-height)) * 0.8);
}

.sticky-image-container {
  margin: 0;

  /* Center everything inside */
  align-items: center;
  justify-content: center;
  display: none; /* hide by default, let meta data decide when to display */
  height: 100%; /* fill space provided by sticky-container parent */
  width: 100%; /* fill space provided by sticky-container parent */
  overflow: hidden;
}

.sticky-image-container img {
  padding: 0rem;
  object-position: center;
  width: 100%;
  height: 100%;
  /* by default, "object-fit: cover" works better for images that are more horizontally oriented,
   fits more of the horizontal width of the image (though not entirely -- we don't display the full
   width, because it will be letterboxed if it doesn't fit).
   This will switch to "object-fit: contain" when the user specifices the image is more vertically
   oriented, which will ensure the full height of the image is displayed */
  object-fit: cover;
}

.sticky-map-container {
  display: none; /* hide by default, let meta data decide when to display */
  z-index: 1; /* Ensure map displays above other content */
  height: 100%; /* fill space provided by sticky-container parent */
  width: 100%; /* fill space provided by sticky-container parent */
}

.sticky-video-container {
  width: 100%;
  height: 100%;
}

/* videos have an iframe inserted inside them so need an extra layer of width/height specification */
.sticky-video-container * {
  width: 100%;
  height: 100%;
}

.sticky-container img {
  /* eases transition when zoomming an image */
  transition:
    transform 1s linear,
    opacity 0.5s linear;
}

.sticky-container video,
map {
  /* eases transition when zooming an image or video */
  transition: opacity 0.5s linear;
}

.steps-container {
  position: relative;
  padding: 0 0rem;
  width: 33%;
  transition: width 0.5s ease-in-out;
}

.step {
  margin: 0rem 1rem 10rem 0rem;
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0%;
  transform: translateZ(
    0
  ); /* fixes apple/Safari bug where transitions don't work properly */

  /* Ensure an inactive step takes up at least 25% of the viewport width, otherwise
  if an active step is at 0 width (full size for the sticky content), the previous
  (now inactive) step's content is redrawn so that it has a lot of vertical space, which
  pushes the previous step's text into the active step, and we get into an infinite
  loop that keeps bouncing between two steps as active */
  min-width: 40vw;
}

.no-left-margin {
  margin-left: 0;
}

.step-content {
  padding: 1rem;
  filter: drop-shadow(lightgray 0.5rem 0.5rem 10px);
  font-size: 1.25rem;
  font-size: clamp(10px, 3.5vw, 24px);
}

.step-content-hidden {
  margin-left: 0;
  visibility: hidden;
  opacity: 0;
}

.step:first-child {
  margin-top: 5rem;
}
.step:last-child {
  margin-bottom: 0;
}

.step.is-active {
  opacity: 100%;
  transition: opacity 1s linear;
  min-width: 0; /* reset active step to have no minimum width so it can shrink fully if specified to be 0 */
}

.text-content {
  width: 75%;
  margin: 5rem auto 5rem auto;
  font-size: 1.25rem;
  font-size: clamp(10px, 3.5vw, 24px);
}

.text-content * {
  text-align: left;
  margin-bottom: 1rem;
}
