// ==========================================================================
// calendar.scss - calendar styles
// ==========================================================================

.calendar {
  &-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: .5rem 0;
    border-color: transparent;
    margin-top: .5rem;
    vertical-align: top;
    &--left {
      border-right-color: $body-color;
      border-right-width: .625rem;
      margin-right: 2rem;
      @include media-breakpoint-down(lg) {
        margin-right: 1rem;
      }
    }
    &--right {
      border-left-color: $body-color;
      border-left-width: .625rem;
      margin-left: 2rem;
      @include media-breakpoint-down(lg) {
        margin-left: 1rem;
      }
    }
    @include media-breakpoint-down(xs) {
      margin-top: .25rem;
    }
  }
  &-btn {
    @include media-breakpoint-down(sm) {
      display: block;
      padding-bottom: 1rem;
      padding-top: 1rem;
      width: 100%;
    }
  }
  &-container {
    background: $body-bg;
    border: 1px solid #e0e0e0;
    border-top: .625rem solid $brand-primary;
    margin-bottom: 2.625rem;
    position: relative;
    &:before {
      background: #e0e0e0;
      bottom: -5px;
      content: "";
      left: 5px;
      position: absolute;
      right: -5px;
      top: 0;
      z-index: 1;
      @include media-breakpoint-down(sm) {
        content: none;
      }
    }
    @include media-breakpoint-down(sm) {
      border-width: 0;
      border-top-width: .625rem;
      margin-bottom: 1.125rem;
    }
  }
  &-form {
    margin-bottom: 1rem;
    &-col {
      &:not(:last-child) {
        padding-right: .3125rem !important;
      }
    }
  }
  &-heading {
    font-size: 1.75rem;
    @include media-breakpoint-down(xs) {
      font-size: 1.25rem;
    }
  }
  &-inner-wrapper {
    background: inherit;
    padding: 2rem 1.25rem;
    position: relative;
    z-index: 2;
    @include media-breakpoint-down(sm) {
      padding: .25rem 0 1.5rem;
    }
  }
  &-legend {
    align-items: flex-start;
    background: $white;
    border-top: 1px solid $gray;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    list-style: none;
    margin: 0;
    padding: 2rem .25rem 1.25rem;
    position: relative;
    z-index: 2;
    &-item {
      flex-basis: 10%;
      font-family: $font-family-secondary;
      font-size: .625rem;
      font-weight: bold;
      letter-spacing: .025em;
      line-height: 1.2;
      padding-left: 1.3125rem;
      position: relative;
      text-transform: uppercase;
      width: 10%;
      &:before {
        border: none;
        content: "";
        display: block;
        height: 10px;
        left: 0;
        margin: 0;
        position: absolute;
        top: 0;
        transform: none;
        width: 10px;
      }
      @each $item in map-keys($color-scheme) {
        &.theme-#{$item}:before {
          background-color: map-get($color-scheme, $item);
        }
      }
      @include media-breakpoint-down(md) {
        flex-basis: percentage(9/40);
        width: percentage(9/40);
      }
      @include media-breakpoint-down(sm) {
        margin-bottom: 1.1875rem;
        flex-basis: percentage(1/3);
        width: percentage(1/3);
      }
      @include media-breakpoint-down(xs) {
        font-size: .5rem;
        padding-left: 1rem;
      }
    }
    @include media-breakpoint-down(sm) {
      justify-content: flex-start;
      padding: 1.125rem 0 0;
    }
  }
  &-list {
    background: #dedede;
    min-height: 20rem;
    padding: 1.5rem 4.5%;
    position: relative;
    &:before {
      color: mix(#9e9e9e, $white, 60%);
      content: attr(data-day);
      font-family: $font-family-secondary;
      font-size: 26.125rem;
      font-weight: bold;
      left: 1.25rem;
      line-height: 0;
      position: absolute;
      top: 9.75rem;
    }
    &-heading {
      font-size: 1.25rem;
      text-transform: uppercase;
    }
    &-item {
      color: $body-color;
      display: block;
      line-height: 1.357;
      margin-bottom: .375rem;
      padding: .3125rem 1.75rem;
      position: relative;
      transition: $link-transition;
      &-place {
        font-size: .6875rem;
        font-weight: 700;
        text-transform: uppercase;
      }
      &-subtitle {
        color: mix($black, $white, 35%);
        font-size: .75rem;
        font-weight: 600;
        text-transform: uppercase;
        transition: $link-transition;
        @include media-breakpoint-down(sm) {
          font-size: .6125rem;
        }
      }
      &-time {
        font-size: $font-size-sm;
        font-weight: 300;
        @include media-breakpoint-down(sm) {
          font-size: $font-size-xs;
        }
      }
      &-title {
        font-size: .875rem;
        font-weight: 600;
        @include media-breakpoint-down(sm) {
          font-size: $font-size-xs;
        }
      }
      &:after {
        content: "";
        margin-top: -4px;
        position: absolute;
        right: .75rem;
        top: 50%;
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 5px 0 5px 6px;
        border-color: transparent transparent transparent $body-color;
        transition: border-color .2s;
        @include media-breakpoint-down(sm) {
          right: 0;
        }
      }
      &:before {
        bottom: 0;
        content: "";
        left: 0;
        opacity: .2;
        position: absolute;
        right: 100%;
        top: 0;
        transition: right .6s;
      }
      .theme-marker {
        transition: width .4s;
        width: .4375rem;
      }
      @include hover-focus {
        color: $white;
        &:after {
          border-left-color: $white;
          transition: border-color .2s .4s;
        }
        &:before {
          right: 0;
          transition: right .4s;
        }
        .calendar-list-item-subtitle {
          color: $white;
        }
        .theme-marker {
          transition: width .6s;
          width: 100%;
        }
      }
      @each $theme in map-keys($color-scheme) {
        &--theme-#{$theme} {
          &:before {
            background: map-get($color-scheme, $theme);
          }
        }
      }
    }
    @include media-breakpoint-down(md) {
      padding-left: 1rem;
      padding-right: 1rem;
    }
  }
  &-table {
    border-collapse: separate;
    border-spacing: .25rem .625rem;
    font-family: $font-family-secondary;
    font-size: $font-size-sm;
    font-weight: bold;
    th,
    td {
      border: none;
      letter-spacing: .1em;
      padding: 0;
      text-align: center;
      vertical-align: middle;
    }
    thead th {
      border: none;
      vertical-align: middle;
    }
    td {
      background: mix($gray-light, $white, 50%);
      &.past {
        background: #e0e0e0;
        opacity: .45;
      }
      &.active {
        .calendar-table-item {
          &:before {
            border-color: $gray-darker;
          }
          @each $theme in map-keys($color-scheme) {
            &-theme-#{$theme}:before {
              border-color: map-get($color-scheme, $theme);
            }
          }
        }
      }
    }
    &-item {
      display: block;
      height: 100%;
      overflow: hidden;
      padding: .4375rem .75rem;
      position: relative;
      width: 100%;
      z-index: 1;
      &:after {
        background: $body-color;
        content: "";
        height: 200%;
        left: 50%;
        opacity: 0;
        position: absolute;
        transform: translate(-50%, -50%) rotate(45deg) translate(0%, -85%);
        transition: all .4s;
        top: 50%;
        width: 200%;
        z-index: -2;
      }
      &:before {
        border: 2px solid transparent;
        bottom: 0;
        content: "";
        left: 0;
        position: absolute;
        right: 0;
        top: 0;
        z-index: -1;
      }
      @at-root a.calendar-table-item {
        color: $body-color;
        @include hover-focus-active {
          color: $white;
          &:after {
            opacity: 1;
            transform: translate(-50%, -50%) rotate(0deg) translate(0%, 0%);
          }
        }
      }
      @each $theme in map-keys($color-scheme) {
        @at-root {
          #{&}-theme-#{$theme}:after {
            background: map-get($color-scheme, $theme);
            opacity: 1;
          }
        }
      }
      @include media-breakpoint-only(xl) {
        padding: .375rem .5rem;
      }
    }
  }
  &.calendar-full-size {
    .calendar-table {
      border-spacing: 1rem .625rem;
      font-size: 3.4375rem;
      line-height: .63636363;
      margin-left: -.5rem;
      margin-right: -.5rem;
      &-item {
        border: none;
        color: mix(#9e9e9e, $white, 60%);
        padding-bottom: .375rem;
        padding-top: .375rem;
        @include media-breakpoint-down(xs) {
          padding-left: .375rem;
          padding-right: .375rem;
        }
        &:not(:hover):after {
          transform: translate(-50%, -50%) rotate(45deg) translate(0%, -120%);
        }
      }
      th {
        font-size: 1.125rem;
        padding-bottom: 1rem;
        @include media-breakpoint-down(xs) {
          font-size: .875rem;
          padding-bottom: .5rem;
        }
      }
      td {
        background: mix($gray-light, $white, 50%);
        opacity: 1;
      }
      @include media-breakpoint-down(lg) {
        font-size: 2.75rem;
      }
      @include media-breakpoint-down(md) {
        font-size: 2rem;
      }
      @include media-breakpoint-down(sm) {
        font-size: 1.375rem;
        margin-left: 0;
        margin-right: 0;
      }
      @include media-breakpoint-down(xs) {
        border-spacing: .5rem .4375rem;
        font-size: .875rem;
      }
    }
  }
}
