/**
 * @file
 * Program
 *
 * Contains styles for programs and program view modes.
 */

@use '_helper' as *;

#program-list {
  margin-bottom: rem(75px);

  @media screen and (min-width: $break-large) {
    margin-bottom: rem(154px);
  }
}

.program-finder {
  &__filter {
    @include swipe($type: "blue", $direction: "right");
    color: $color-white;
    padding-bottom: rem(46px);

    @media screen and (min-width: $break-medium) {
      padding-bottom: rem(60px);
    }

    @media screen and (min-width: $break-large) {
      @include swipe($type: "blue", $direction: "right", $vertPosOffset: -70px);
      padding-bottom: rem(70px);
    }

    a,
    button:not([type="submit"]),
    input {
      @include focus-light($offset: 4px);
    }
  }
}

.program__filters {
  display: none;
  border: none;
  padding: 0;
  margin: 0 !important;

  @media (min-width: $break-medium) {
    display: block;
  }

  @media screen and (min-width: $break-large) {
    max-width: calc($content-max - 58px * 2);
    margin: 0 auto !important;
  }

  &__open {
    @media (min-width: $break-medium) {
      display: none;
    }
  }

  &__fieldset {
    border: 0;
    padding: rem(13px);
    border-radius: rem(10px);
    margin: rem(6.8px) 0 0 0;
    background: $color-blue-light;
    color: $color-black;

    legend {
      @include element-invisible;
      font-weight: 700;
    }
  }

  &__field {
    padding: 0 0 0 25px;
    margin: 0 0 rem(4.6px);
    position: relative;
    display: flex;

    label {
      &:before {
        content: "";
        width: 15px;
        height: 15px;
        border: 1px solid;
        border-radius: 100px;
        display: inline-block;
        vertical-align: middle;
        position: absolute;
        left: 0;
        top: 3px;

        @media (min-width: $break-large) {
          top: 7px;
        }
      }
    }

    .program-type__input-wrap {
      display: flex;
      align-items: center;

      input {
        outline: 0;

        &:focus {
          +label::before {
            outline: solid 1px $color-black;
            outline-offset: 4px;
          }
        }

        &:checked {
          &+label::before {
            background-color: $color-blue-dark;
            border-color: $color-blue-dark;
          }

          &+label::after {
            opacity: 1;
          }
        }
      }

      label {
        cursor: pointer;
      }

      input+label {
        display: flex;
        align-items: center;
        gap: 10px;

        @media screen and (min-width: $break-large) {
          gap: 10px;
        }

        &::before {
          content: '';
          display: block;
          width: 14px;
          height: 14px;
          border: solid 1px $color-black-50;
          border-radius: 2px;
          box-sizing: border-box;
        }

        &::after {
          content: '';
          display: block;
          position: absolute;
          opacity: 0;
        }
      }

      input+label {
        &::before {
          border-radius: 100%;
        }

        &::after {
          border: solid 3px $color-white;
          border-radius: 100%;
          top: 7px;
          left: 4px;
          box-sizing: content-box;

          @media screen and (min-width: $break-large) {
            top: 11px;
          }
        }
      }
    }
  }

  &__bottom {
    display: flex;
    gap: rem(23px);

    @media screen and (min-width: $break-medium) {
      gap: rem(15px);
    }

    @media screen and (min-width: $break-large) {
      margin-top: rem(20px);
      gap: rem(25px);
      max-width: calc($content-max - 58px * 2);
      margin-left: auto;
      margin-right: auto;
    }
  }

  &__submit {
    @include ctaButton($darkBG: true);
  }

  &__reset {
    color: $color-white;
    font-family: $font-dm-sans;
    font-size: rem(16px);
    font-style: normal;
    font-weight: 700;
    line-height: 1.5;
    text-decoration-line: underline;
    padding: 0;
    background: transparent;
    border: none;

    @media screen and (min-width: $break-large) {
      font-size: rem(18px);
    }

    svg {
      position: relative;
      top: 3px;
      margin-right: 5px;
      transform: rotate(-41deg);

      @media screen and (min-width: $break-large) {
        margin-right: 8px;
      }

      path {
        fill: $color-white;
      }
    }
  }

  .search {
    margin: 0 0 rem(30px);

    @media screen and (min-width: $break-large) {
      flex: 0 0 100%;
      margin: 0;
    }

    &__wrapper {
      position: relative;

      input {
        @media screen and (max-width: $break-medium - 1) {
          height: 53px;
        }
      }
    }

    &__submit {
      position: absolute;
      top: 50%;
      right: rem(13px);
      width: rem(30px);
      height: rem(30px);
      transform: translateY(-50%);
      border: none;
      color: $color-blue-dark;
      background: transparent;
      transition: opacity 0.3s ease;

      @media screen and (min-width: $break-medium) {
        right: rem(5px);
      }

      @media screen and (min-width: $break-large) {
        right: rem(15px);
      }

      @media (forced-colors: active) and (prefers-color-scheme: dark) {
        color: $color-white;
      }

      &:hover {
        opacity: 0.5;
      }

      svg {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
      }
    }

    label {
      display: block;
      font-family: $font-roboto-slab;
      font-size: rem(24px);
      font-style: normal;
      font-weight: 500;
      line-height: 1.25;
      margin: 0 0 rem(20px);

      @media screen and (min-width: $break-medium) {
        font-size: rem(28px);
      }

      @media screen and (min-width: $break-large) {
        font-size: rem(32px);
      }
    }

    input {
      width: 100%;
      padding: rem(9px) rem(80px) rem(9px) rem(14px);

      @media screen and (min-width: $break-large) {
        padding: rem(12px) rem(80px) rem(12px) rem(14px);
      }
    }
  }

  .dropdown {
    margin: 0 0 rem(20px);

    @media screen and (min-width: $break-large) {
      flex: 0 0 calc((100% - (22px * 2)) / 3);
      margin: 0;
    }

    &__title {
      font-family: $font-dm-sans;
      font-size: rem(16px);
      font-style: normal;
      font-weight: 900;
      line-height: 1.5;
      margin: 0 0 rem(10px);

      @media screen and (min-width: $break-large) {
        font-size: rem(18px);
      }
    }

    &__button {
      position: relative;
      font-size: rem(16px);
      font-style: normal;
      font-weight: 400;
      line-height: 1.5;
      text-align: left;
      width: 100%;
      padding: rem(9px) rem(80px) rem(9px) rem(14px);
      color: $color-black;
      background: $color-white;
      border-radius: 5px;
      border: none;

      &[aria-expanded="true"] {
        .dropdown__icon {
          transform: translateY(-50%) scaleY(-1);
        }
      }

      @media (forced-colors: active) {
        border: solid 1px;
      }
    }

    &__icon {
      position: absolute;
      top: 50%;
      right: rem(5px);
      width: rem(30px);
      height: rem(30px);
      transform: translateY(-50%);
      border: none;
      background: transparent;
      pointer-events: none;

      @media screen and (min-width: $break-large) {
        right: rem(15px);
      }

      svg {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
      }
    }
  }
}

.program--list {
  margin-top: 2rem;

  @media screen and (min-width: $break-large) {
    margin-top: rem(83px);
  }

  &__sort {
    display: none;

    @media (min-width: $break-large) {
      float: right;
    }
  }

  &__top {
    margin: 0 0 rem(30px);

    @media screen and (min-width: $break-large) {
      margin: 0 0 rem(18px);
    }
  }

  &__items {
    padding: 0;
    margin: 0;

    @media screen and (min-width: $break-medium) {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: rem(20px);
    }

    @media screen and (min-width: $break-large) {
      grid-template-columns: 1fr 1fr 1fr;
    }

    li {
      @media screen and (max-width: $break-medium - 1) {
        margin-bottom: rem(20px)
      }

      @media screen and (min-width: $break-medium) {
        margin: 0;
      }

      &.featured {
        @media screen and (min-width: $break-medium) {
          display: flex;
          grid-column-start: span 2;
        }

        >.featured-content,
        >.programlisting-item {
          @media screen and (min-width: $break-medium) {
            flex: 0 0 50%;
          }
        }

        .programlisting-item .background-wrapper {
          border-radius: 0 0 rem(15px) rem(15px);

          @media screen and (min-width: $break-medium) {
            border-radius: 0 rem(15px) rem(15px) 0;
          }
        }
      }

      &:before {
        content: none;
      }
    }

    .featured-content {
      width: 100%; // overwrite default from swipe mixin
      margin: 0 !important; // overwrite default from swipe mixin
      left: 0; // overwrite default from swipe mixin
      display: flex;
      justify-content: space-between;
      flex-direction: column;
      padding: rem(25px);
      background: $color-blue;
      border-radius: rem(15px) rem(15px) 0 0;
      overflow: hidden;

      @media screen and (min-width: $break-medium) {
        border-radius: rem(15px) 0 0 rem(15px);
        padding: rem(25px) rem(25px) rem(37px);
      }

      @media screen and (min-width: $break-large) {
        width: 100%; // overwrite default from swipe mixin
        margin: 0 !important; // overwrite default from swipe mixin
        left: 0; // overwrite default from swipe mixin
        padding: rem(25px) !important; // overwrite default from swipe mixin
      }

      &__body {
        @include swipe($type: "blue", $direction: "right", $vertPosOffset: -23svw);
        width: 100%; // overwrite default from swipe mixin
        margin: 0 !important; // overwrite default from swipe mixin
        left: 0; // overwrite default from swipe mixin
        display: flex;
        justify-content: space-between;
        flex-direction: column;
        background: $color-blue;
        padding: 0;

        @media screen and (min-width: $break-medium) {
          padding: 0;
          border-radius: rem(15px) 0 0 rem(15px);
        }

        @media screen and (min-width: $break-large) {
          padding: 0;
          width: 100%; // overwrite default from swipe mixin
          margin: 0 !important; // overwrite default from swipe mixin
          left: 0; // overwrite default from swipe mixin
        }

        &::before,
        &::after {
          width: calc(100% + 50px);
          top: unset;
          right: unset;
          left: -25px;
          z-index: 0;
          transform: unset;
        }

        &::before {
          bottom: calc(100% - 50px);

          @media screen and (min-width: $break-medium) {
            bottom: calc(100% - 37px);
          }

          @media screen and (min-width: $break-large) {
            bottom: calc(100% - 50px);
          }
        }

        &::after {
          height: calc(100% - 25px);
          bottom: -25px;

          @media screen and (min-width: $break-medium) {
            height: calc(100% + 37px);
            bottom: -37px;
          }

          @media screen and (min-width: $break-large) {
            height: calc(100% - 25px);
            bottom: -25px;
          }
        }
      }

      h3 {
        @include h6;
        margin: 0;
        padding-right: 10px;
        position: relative;
        z-index: 1;
        color: $color-white;
        text-transform: unset;

        @media screen and (max-width: ($break-medium - 1)) {
          margin-bottom: 10%;
        }
      }

      p {
        color: $color-white;
        font-size: rem(14px);
        font-style: normal;
        font-weight: 400;
        line-height: 1.5;
        z-index: 1;

        @media screen and (min-width: $break-large) {
          font-size: rem(15.164px);
        }
      }
    }
  }

  &__wrapper {
    @media screen and (min-width: $break-large) {
      display: flex;
      flex-wrap: wrap;
      gap: rem(30px) rem(22px);
    }
  }

  h2 {
    margin: 0;
  }

  &__block {
    margin-bottom: 3rem;
  }

  &__no-results {
    font-size: rem(30px);
    margin: rem(80px) 0 rem(250px);
  }
}

.programlisting-item {
  height: 100%;
  padding: 30px 20px;
  position: relative;
  @include cardArrowCornerHover;

  @media screen and (min-width: $break-medium) {
    padding: 30px;
    min-height: 270px;
  }

  &:hover {
    color: $color-white;

    .programlisting-item__degree {
      border-bottom-color: rgba(255, 255, 255, 0.5);
    }

    a {
      color: $color-white;
    }

    .background-wrapper {
      background-color: $color-blue-dark;
    }
  }

  .background-wrapper {
    border-radius: 15px;
    background-color: $color-blue-light;
    transition: all .1s;
  }

  &__short-message {
    color: $color-blue-dark;
    font-size: rem(12px);
    padding: 2px 7px;
    border: 1px solid $color-blue;
    position: absolute;
    top: 0;
    transform: translateY(-50%);
    border-radius: 3px;
    background-color: $color-blue-light;

    @media screen and (min-width: $break-large) {
      font-size: rem(14px);
    }
  }

  &__degree {
    display: flex;
    flex-direction: column;
    align-items: baseline;
    gap: 0 8px;
    @include body-small();
    border-bottom: 1px solid rgba(0, 0, 0, 0.5);
    padding-bottom: 20px;
    margin-bottom: 20px;

    >span {
      margin: 0 0 rem(5px);
    }

    &__abbr {
      @include program-chip-card();
      background-color: $color-blue;
      color: $color-white;
      padding: 0 7px;
      border-radius: 3px;
      height: 18px;
      display: inline-block;

      @media screen and (min-width: $break-large) {
        height: 24px;
        min-width: 50px;
        text-align: center;
      }
    }
  }

  h3 {
    margin: 0 0 10px;
    @include program-card();

    a {
      font: inherit;
      color: $color-black;
      text-decoration: none;

      &:before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: calc(100% + 1px);
        height: calc(100% + 1px);
        z-index: 1;
      }
    }
  }
}

.program-type {
  font-family: $font-dm-sans;
  font-size: rem(18px);
  font-style: normal;
  font-weight: 900;
  line-height: 1.5;
  display: inline-flex;
  padding: 0 rem(7px);
  margin: 0 auto rem(10px) 0;
  justify-content: center;
  align-items: center;
  border-radius: 3px;
  background: $color-blue;

  @media screen and (min-width: $break-large) {
    font-size: rem(24px);
    padding: 0 rem(10px);
  }
}