$timetable_count: 15;

#timetable {
  width: 100%;
  height: 110vh;
  position: relative;
  overflow: hidden;
  &.active {
    height: 100%;
    overflow: visible;
  }
}

.timetable__button {
  opacity: 0;
  position: fixed;
  bottom: 150px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  transition: opacity 0.5s $easeOutQuad, transform 0.5s $easeOutQuad;
  #timetable[data-active="0"] & {
    opacity: 1;
  }
  img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 20px;
    margin-left: -20px;
  }
  &.reveal {
    transform: translateX(-50%) scale(1.2);
  }
  @media screen and (max-width: $huge_breakpoint) {
    bottom: 130px;
  }
  @media screen and (max-width: $large_breakpoint) {
    bottom: 120px;
  }
}

.timetable__pswp .pswp__top-bar {
  opacity: 1;
  background: transparent;
}

.timetable__clock__frame {
  position: fixed;
  top: 40%;
  transform: translateY(-50%);
  width: 30%;
  left: 35%;
  z-index: 560;
  transition: top 0.5s $easeOutQuad, transform 0.5s $easeOutQuad;
  @media screen and (max-width: $medium_breakpoint) {
    top: em(50px);
    width: 300%;
    left: 50%;
    max-width: 40vh;
    transform: translateX(-50%) translateY(14%);
//    #timetable[data-active="0"] & {
//      top: 50%;
//      transform: translateX(-50%) translateY(-50%);
//    }
  }
}

.timetable__clock__main {
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  position: relative;
}

.timetable__clock {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  &.reveal {
    transform: scale(1.2);
  }
}

.timetable__start {
  position: absolute;
  left: 7%;
  width: 86%;
  border-radius: 50%;
  z-index: -1;
  background: $green;
  pointer-events: none;
  overflow: hidden;
  top: 0;
  height: 0;
  transform: scale(5);
  opacity: 1;
  transition: transform 1s $easeInOutQuart, opacity 1s $easeInOutQuart, top 0s 1s, height 0s 1s;
  #timetable[data-active="0"] & {
    transition-delay: 0.9s;
    top: 7%;
    height: 86%;
    opacity: 0.95;
    transform: none;
    &.reveal {
      transform: scale(1.2);
    }
  }
}

.timetable__clock__progress {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(90deg);
  opacity: 1;
  transition: opacity 0s 1s;
  circle {
    transition: stroke-dashoffset 1.5s $easeOutExpo;
  }
  #timetable[data-active="0"] & {
    opacity: 0;
  }
}

.timetable__clock__design {
  display: block;
  position: absolute;
  top: 4.5%;
  left: 4.5%;
  width: 91%;
  height: 91%;
  z-index: 5;
  .border {
    fill: $light_gray;
  }
  .line {
    fill: $gray;
    opacity: 0.25;
    transition: fill 0.5s 1s;
    #timetable[data-active="0"] & {
      transition-delay: 0.5s;
      fill: $white;
    }
  }
  .dot {
    fill: $medium_light_gray;
    transition: fill 0.5s 1s;
    #timetable[data-active="0"] & {
      transition-delay: 0.5s;
      fill: $white;
    }
  }
}

.timetable__clock__digital {
  position: absolute;
  top: 50%;
  left: 0;
  margin-top: -3.5vw;
  color: $near_black;
  width: 100%;
  font-size: 5.5vw;
  line-height: 7vw;
  text-align: center;
  transform: none;
  transition: color 1s 1s, transform 1s 1s;
  #timetable[data-active="0"] & {
    transition-delay: 0s;
    color: $white;
  }
  @media screen and (max-width: $medium_breakpoint) {
    margin-top: -1vh;
    font-size: 5.5vh;
    line-height: 8vh;
    transform: translateY(-3vh);
    #timetable[data-active="0"] & {
      transform: none;
    }
  }
}

.timetable__clock__digital__intro, .timetable__clock__digital__outro {
  position: absolute;
  bottom: 100%;
  left: 20%;
  width: 60%;
  font-size: 1.25vw;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.5s 1s;
  #timetable[data-active="0"] & {
    transition-delay: 0.5s;
    opacity: 1;
  }
  @media screen and (max-width: $medium_breakpoint) {
    font-size: 2.2vh;
  }
}

.timetable__clock__digital__outro {
  top: 100%;
  bottom: auto;
}

#timetable__clock__digital__time span {
  display: inline-block;
  position: relative;
  top: -0.5vw;
  @media screen and (max-width: $medium_breakpoint) {
    top: -0.5vh;
  }
}

.timetable__start__background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-size: cover;
  background-position: center;
  z-index: 6;
  opacity: 0;
  height: 0;
  transition: opacity 0s 1s, height 0s 1s;
  &.reveal {
    transform: none;
  }
  &:after {
    content: '';
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to bottom, rgba($black, 0), rgba($black, 0.3));
  }
  #timetable[data-active="0"] & {
    height: 100%;
    opacity: 1;
  }
}

.timetable__start__door {
  position: fixed;
  width: 50%;
  background: $green;
  z-index: 551;
  left: 0;
  top: 0;
  opacity: 1;
  pointer-events: none;
  height: 0;
  transform: translateX(-100%);
  will-change: transform;
  transition: opacity 0s 1s, transform 1s $easeInOutQuart 1s, height 0s 2s;
  #timetable[data-active="0"] & {
    transition: opacity 0s 1s, transform 1s $easeInOutQuart, height 0s;
    transform: none;
    opacity: 0;
    height: 100%;
  }
}

.timetable__start__door--right {
  left: auto;
  right: 0;
  transform: translateX(100%);
}

.timetable__next {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-decoration: none;
  color: $green;
  text-align: center;
  height: em(100px);
  z-index: 10;
  opacity: 0;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 2s $reveal_timing_function, color 0s 1s !important;
  &.hidden {
    opacity: 0;
    pointer-events: none;
  }
  #timetable[data-active="0"] & {
    color: $white;
    opacity: 1;
    &:before {
      opacity: 1;
    }
  }
  &.reveal {
    transform: none;
  }
}

@keyframes opacity {
  0% {
    opacity: 0.2;
  }
  30% {
    opacity: 1;
  }
  60% {
    opacity: 0.2;
  }
  100% {
    opacity: 0.2;
  }
}

.timetable__next__icon {
  display: block;
  margin: em(15px) auto;
  width: em(25px);
  span {
    display: block;
    width: em(25px);
    height: em(25px);
    margin-top: em(-12px);
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    animation: opacity 1.2s infinite ease-in-out;
    &.data_id_1 {
      animation-delay: 0.2s;
    }
    &.data_id_2 {
      animation-delay: 0.4s;
    }
  }
  #timetable[data-active="0"] & {
    color: $white;
  }
}

.timetable__intro__placeholder {
  width: 100%;
  height: 50%;
}

.timetable__item {
  position: relative;
  z-index: 5;
  opacity: 1;
  &.even {
    .timetable__item__main {
      &.reveal {
        .timetable__item__image {
          transform: translateY(em(150px));
        }
        .timetable__item__content {
          transform: translateY(em(300px));
        }
      }
    }
    .timetable__item__image {
      transition-delay: 0s;
    }
    .timetable__item__image__main {
      transform: translateY(em(-150px));
    }
    .timetable__item__content {
      transition-delay: 0.2s;
    }
    .timetable__item__content__frame {
      padding-left: 40%;
    }
  }
  &.odd {
    .timetable__item__main {
      direction: rtl;
    }
    .timetable__item__content__frame {
      padding-right: 40%;
    }
  }
  #timetable[data-active="0"] & {
    opacity: 0;
    transition: opacity 0s 1s;
  }
}

.timetable__item__after {
  width: 100%;
  height: 50%;
  &.last {
    height: 25%;
  }
}

.timetable__item__main {
  display: block;
  width: 100%;
  white-space: nowrap;
  font-size: 0;
  &.reveal {
    transform: none;
  }
  @media screen and (max-width: $medium_breakpoint) {
    padding: 0 em(30px);
    white-space: normal;
  }
}

.timetable__item__image {
  display: inline-block;
  width: 50%;
  transform: none;
  opacity: 1;
  vertical-align: top;
  transition: transform 1.5s $easeOutQuart 0.2s, opacity 1.5s $easeOutQuart 0.2s;
  .reveal & {
    opacity: 0;
    transform: translateY(em(300px));
  }
  @media screen and (max-width: $medium_breakpoint) {
    width: 100%;
    transition-delay: 0s !important;
    margin-bottom: em(40px);
  }
}

.timetable__item__image__frame {
  position: relative;
  width: 100%;
  padding-bottom: 65%;
  overflow: hidden;
}

.timetable__item__image__main {
  background-position: top center;
  background-size: cover;
  position: absolute;
  top: -10%;
  left: 0;
  right: 0;
  bottom: -5%;
  transform: translateY(em(-300px));
}

.timetable__item__content {
  display: inline-block;
  width: 50%;
  transform: none;
  vertical-align: top;
  opacity: 1;
  direction: ltr;
  white-space: normal;
  transition: transform 1.5s $easeOutQuart, opacity 1.5s $easeOutQuart;
  .reveal & {
    transform: translateY(em(150px));
    opacity: 0;
  }
  @media screen and (max-width: $medium_breakpoint) {
    width: 100%;
    transition-delay: 0.2s !important;
  }
}

.timetable__item__content__frame {
  padding: 0 em(100px);
  hyphens: auto;
  @media screen and (max-width: $huge_breakpoint) {
    padding: 0 em(70px);
  }
  @media screen and (max-width: $large_breakpoint) {
    padding: 0 em(30px);
  }
  @media screen and (max-width: $medium_breakpoint) {
    padding: 0 !important;
  }
}

.timetable__item__title {
  font-size: 30px;
  font-weight: 700;
}

.timetable__item__text {
  font-weight: 300;
  line-height: 1.6;
}

.timetable__titles {
  .section__title {
    height: auto;
    margin: 0;
    position: fixed;
    left: -10%;
    width: auto;
    right: -10%;
    bottom: 0;
    overflow: hidden;
    transform: translateX(200%);
    mask-image: linear-gradient(to right, rgba($black, 0) 0%, $black 10%, $black 90%, rgba($black, 0) 100%);
    opacity: 0;
    transition: transform 1.5s $easeInOutQuart, opacity 1.5s $easeInOutQuart;
    @for $i from 1 through $timetable_count {
      #timetable[data-active="#{$i}"] & {
        transform: translateX(-200%);
        &.data_id_#{$i} {
          transform: none;
          opacity: 1;
        }
        &.data_id_#{$i} ~ .section__title {
          transform: translateX(200%);
        }
      }
    }
  }
  .section__title__main {
    transform: translateY(40%);
  }
}