@import url(./font/stylesheet.css);

$text: #333333;
$primary: #007dbc;
$secondary: #30458e;
$bg: #f5fcff;
$bg-secondary: #fafafa;
$modal-top: #f2f5ff;
$modal-bottom: #fff6fd;

@mixin pageWithFooter {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@mixin modal {
  border-radius: 10px;
  max-width: 380px;
  padding: 1rem;
  position: absolute;
  display: none;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes scale-display {
  0% {
    opacity: 0;
    transform: scale(0);
    -webkit-transform: scale(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    -webkit-transform: scale(1);
  }
}

@keyframes scale-display--reversed {
  0% {
    display: block;
    opacity: 1;
    transform: scale(1);
    -webkit-transform: scale(1);
  }
  100% {
    display: none;
    opacity: 0;
    transform: scale(0);
    -webkit-transform: scale(0);
  }
}

:root {
  --fs-1: clamp(1rem, calc(0.85rem + 0.1vw), 1.125rem);
  --fs-2: clamp(1.25rem, calc(1.2rem + 0.25vw), 1.25rem);
  --fs-3: clamp(1.5rem, calc(1.48rem + 0.44vw), 1.5rem);
  --fs-4: clamp(1.9rem, calc(1.81rem + 0.71vw), 2rem);
}

* {
  font-family: Rubik;
}

html {
  scroll-behavior: smooth;
}

body {
  color: $text;
  margin: 0;
}

header {
  background-color: $bg;
  padding: 1rem;

  #menu {
    position: absolute;
    right: 2rem;
    gap: 16px;
  }
}

footer {
  background-color: $bg;
  color: #888888;
  margin-top: auto;
  padding: 0.5rem;
  font-size: 0.7rem;
}

h1 {
  font-size: var(--fs-4);
}

h2 {
  font-size: var(--fs-3);
  font-weight: 500;
}

h3 {
  font-size: var(--fs-2);
  font-weight: 500;
}

p {
  font-size: var(--fs-1);
  font-weight: 500;
}

a {
  color: $primary;
}

textarea {
  border-radius: 10px;
  border-color: transparent;
  min-height: 100px;
  padding: 10px;
  width: 100%;
  resize: none;
}

hr {
  margin: 1.5rem 0;
}

.hide {
  animation: show 250ms;
  display: none;
}

.is-hidden {
  visibility: hidden; 
  opacity: 0;
  pointer-events: none;
}

.show {
  display: block;
}

.h-100 {
  height: 100vh;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.flex-col {
  flex-direction: column;
}

.text-center {
  text-align: center;
}

.title {
  color: $primary;
  margin: 0;
  text-transform: uppercase;

  &.title-alt {
    color: $secondary;
  }
}

.btn {
  all: unset;
  background-color: $primary;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  text-transform: uppercase;
  padding: 0.7rem;
  font-weight: 600;
}

.factor-icon {
  max-width: 40px;
}

#app {
  overflow-x: hidden;

  #video-container {
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    position: fixed;
    top: 0;
    left: 0;
    background-color: black;

    section {
      height: calc(100vw * 9 / 16);

      video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
      }

      &.show {
        animation: scale-display 0.5s;
        display: block;
      }

      &.hide {
        animation: scale-display--reversed 0.5s;
        animation-fill-mode: forwards;
      }

      .close {
        position: absolute;
        right: 32px;
        top: 32px;
        width: 40px;
        height: 40px;
        cursor: pointer;
        background-color: white;
        border-radius: 100%;
        z-index: 1;
      }

      .close:before,
      .close:after {
        position: absolute;
        left: 18px;
        top: 0;
        bottom: 0;
        margin: auto 0;
        content: " ";
        height: 26px;
        width: 4px;
        background-color: $primary;
      }

      .close:before {
        transform: rotate(45deg);
      }

      .close:after {
        transform: rotate(-45deg);
      }
    }
  }
}

#home {
  animation: fadeIn ease 3s;
  animation-iteration-count: 1;
  animation-fill-mode: forwards;

  &.fadeOut {
    animation: fadeOut ease 3s;
  }

  img {
    max-width: 300px;
  }
}

#intro {
  max-width: 1200px;
  margin: 0 auto;
  gap: 2rem;

  .intro-img-mobile {
    display: none;
  }

  .title + .flex {
    gap: 2rem;
    padding: 0 2rem;

    img {
      max-width: 600px;
      width: 100%;
    }

    p {
      font-size: 1.25rem;
      margin-bottom: 2rem;
    }
  }
}

#wheel {
  @include pageWithFooter;

  .content {
    position: relative;
    flex-grow: 1;

    #modal {
      &.top-left,
      &.top-right {
        background-color: $modal-top;
        top: 2rem;

        .title {
          color: #093caf;
        }
      }

      &.top-left {
        left: 2rem;
      }

      &.top-right {
        right: 2rem;
      }

      &.bottom-left,
      &.bottom-right {
        background-color: $modal-bottom;
        bottom: 2rem;

        .title {
          color: #c7158a;
        }
      }

      &.bottom-left {
        left: 2rem;
      }

      &.bottom-right {
        right: 2rem;
      }

      .factor-type {
        display: none;
      }
    }
  }
}

#modal {
  @include modal;

  .factor-icon {
    margin: 1rem;
  }

  &.show {
    animation: scale-display 0.5s;
    display: block;
  }

  &.hide {
    animation: scale-display--reversed 0.5s;
    animation-fill-mode: forwards;
  }

  .factor-type {
    margin: 1rem;
    margin-bottom: 2rem;

    span {
      border-radius: 10px;
      padding: 1rem;
      text-transform: uppercase;
      font-weight: 500;

      &.external-factors {
        background-color: #eef2ff;
        color: #30458e;
      }

      &.internal-factors {
        background-color: #fff6fd;
        color: #c7158a;
      }
    }
  }
}

#wheel-container {
  max-width: 750px;
  height: 750px;
  margin: 0 auto;
  width: 100%;
  position: relative;

  #factor-wheel {
    display: block;
    width: 100%;
  }

  #svg-overlay {
    position: absolute;
    top: 0;
    width: 100%;

    svg {
      width: 100%;
      height: auto;

      [data-factor] {
        cursor: pointer;
        opacity: 0;
        transition: 0.5s;

        &.active {
          opacity: 1;
          position: relative;
        }
      }

      [data-tick] {
        opacity: 0;

        &.active {
          opacity: 1;
        }
      }
    }
  }
}

#question {
  @include pageWithFooter;

  .content {
    flex: 1;

    #wheel-container {
      max-width: 600px;
    }

    #modal {
      margin-top: 1rem;
      max-width: 70%;
      position: relative;
    }

    & > div {
      flex: 1;
      padding: 1rem 2rem;
    }

    #question-container {
      background-color: $bg-secondary;

      .title {
        .factor-icon {
          display: block;
          margin-bottom: 1rem;
        }
      }

      .tab {
        overflow: hidden;
        background-color: white;
        border-bottom: 1px solid #d9dde1;
        gap: 4rem;

        button {
          all: unset;
          background-color: inherit;
          font-size: var(--fs-2);
          font-weight: 500;
          text-transform: uppercase;
          float: left;
          border: none;
          outline: none;
          cursor: pointer;
          padding: 1rem 2rem;
          position: relative;

          &:hover,
          &.active {
            color: $primary;
          }

          &:hover:not(.active)::after,
          &.active::after {
            content: "";
            position: absolute;
            left: 0;
            bottom: 0;
            border-bottom: 5px solid $primary;
            width: 100%;
          }
        }
      }

      .tabcontent {
        display: none;
        padding: 1rem 2rem;
        margin-top: 1rem;

        .question {
          [class*="question-"] {
            font-weight: 500;
          }
        }

        &#Resources {
          background-color: white;

          .resource {
            img {
              width: 60%;
            }

            video {
              width: 60%;
              height: auto;
            }
          }
        }
      }
    }
  }

  #scroll-to-top {
    cursor: pointer;
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    max-width: 36px;

    &.show {
      animation: scale-display 0.5s;
      display: block;
    }

    &.hide {
      animation: scale-display--reversed 0.5s;
      animation-fill-mode: forwards;
    }
  }
}

#credits {
  background-color: $bg;
  gap: 5rem;

  img {
    max-width: 250px;
  }
}

#export {
  @include pageWithFooter;

  .content {
    #report {
      background-color: #fafafa;
      background-image: url("data:image/svg+xml,%3csvg width=%27100%25%27 height=%27100%25%27 xmlns=%27http://www.w3.org/2000/svg%27%3e%3crect width=%27100%25%27 height=%27100%25%27 fill=%27none%27 stroke=%27%23BDBDBDFF%27 stroke-width=%274%27 stroke-dasharray=%2712%27 stroke-dashoffset=%270%27 stroke-linecap=%27square%27/%3e%3c/svg%3e");
      max-width: 850px;
      margin: 2rem auto;
      padding: 1rem 2rem;

      div:first-child {
        gap: 2rem;

        .title {
          color: $text;

          span {
            display: block;
            font-size: smaller;
            font-weight: 500;
            margin-top: 1rem;
            text-transform: capitalize;
          }
        }

        img {
          max-width: 250px;
        }
      }

      div:nth-child(2) {
        margin: 2rem 0;
      }

      [class*="factor-"] {
        .question {
          [class*="answer-"] {
            background-color: #fff;
            border-radius: 10px;
            border-color: transparent;
            min-height: 100px;
            padding: 10px;
            width: 100%;
            resize: none;
          }
        }
      }
    }

    div:first-child {
      .title {
        color: $text;

        span {
          display: block;
          font-size: smaller;
          font-weight: 500;
          margin-top: 1rem;
          text-transform: capitalize;
        }
      }

      img {
        max-width: 250px;
      }
    }

    div:nth-child(2) {
      margin-top: 2rem;

      .question {
        textarea {
          pointer-events: none;
        }
      }
    }
  }
}

#menu-btn {
  position: absolute;
  top: -100%;
  left: -100%;
}

.menu-icon {
  visibility: hidden;
}

.menu {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 250px;
  margin-right: 2rem;
}

@media only screen and (max-width: 768px) {
  header {
    position: fixed;
    width: calc(100% - 1rem);
    z-index: 1;

    #menu {
      display: none;
      flex-direction: column;
      gap: 0 !important;
      top: 65px;
      right: 1.5rem !important;

      &.active {
        animation: scale-display 0.5s;
        display: flex;
      }

      .btn {
        width: 80%;
        text-align: center;

        &:first-child {
          border-radius: 4px 4px 0 0;
        }

        &:last-child {
          border-radius: 0 0 4px 4px;
        }
      }
    }

    #hamburger-menu {
      position: absolute;
      right: 2rem;

      .menu-btn {
        display: none;
      }

      .menu-icon {
        cursor: pointer;
        visibility: visible;
      }

      .navicon {
        background: $primary;
        display: block;
        height: 3px;
        width: 25px;
        position: relative;
      }

      .navicon:before {
        top: 6px;
      }

      .navicon:after {
        top: -6px;
      }

      .navicon:before,
      .navicon:after {
        background: $primary;
        display: block;
        width: 100%;
        height: 100%;
        content: "";
        position: absolute;
        transition: all 0.2s ease-out;
      }

      .menu-btn:checked ~ .menu-icon .navicon {
        background: transparent;
      }

      .menu-btn:checked ~ .menu-icon .navicon:before {
        transform: rotate(-45deg);
      }

      .menu-btn:checked ~ .menu-icon .navicon:after {
        transform: rotate(45deg);
      }

      .menu-btn:checked ~ .menu-icon .navicon:before,
      .menu-btn:checked ~ .menu-icon .navicon:after {
        top: 0;
      }
    }
  }

  .content {
    margin-top: 60px;
  }

  #wheel {
    .content {
      display: flex;

      & > .flex {
        justify-content: center;
        gap: 1rem;
        padding: 0 0.5rem;
      }
    }
  }

  #app {
    &:has(#intro) {
      background: #e2f5ff;
    }
  }

  #intro {
    gap: 0;
    justify-content: start;

    .intro-img-mobile {
      display: block;
      width: 100%;
      margin-top: -10%;
    }

    .title {
      text-align: center;
      margin-top: -4rem;
      padding: 0 1.5rem;
    }

    .title + .flex {
      flex-direction: column;
      padding: 0 1.5rem 2rem;

      .intro-img {
        display: none;
      }

      p {
        font-size: var(--fs-1);
      }

      div {
        text-align: center;
      }
    }
  }

  #question {
    .content {
      flex-direction: column;
      position: relative;

      & > div {
        padding: 1rem;
      }

      #modal {
        max-width: 100%;
        padding: 0;
      }

      #question-container {
        .title {
          display: none;
        }

        .tabcontent {
          padding: 0;
        }
      }
    }
  }

  #export {
    .content {
      #report {
        padding: 1rem;

        div:first-child {
          img {
            max-width: 100px;
          }
        }
      }

      [class*="factor-"]:not([class="factor-icon"]) {
        background-image: none;
        padding: 1rem;

        &:first-child {
          margin-top: 0;
        }

        div:first-child {
          gap: 2rem;

          .title {
            color: $text;

            span {
              display: block;
              font-size: smaller;
              font-weight: 500;
              margin-top: 1rem;
              text-transform: capitalize;
            }
          }

          img {
            max-width: 30%;
          }
        }

        div:nth-child(2) {
          margin-top: 2rem;

          .question {
            textarea {
              pointer-events: none;
            }
          }
        }
      }
    }
  }
}

@media only screen and (max-width: 480px) {
  p {
    font-size: 14px;
  }

  h1 {
    font-size: var(--fs-2);
  }

  h2 {
    font-size: var(--fs-1);
  }

  h3 {
    font-size: 16px;
  }

  #question {
    .content {
      #question-container {
        .tab {
          gap: 0;
          margin: 0 -1rem;

          button {
            font-size: 14px;
          }
        }
      }
    }
  }
}

@media (pointer: fine) {
  #wheel-container {
    #svg-overlay {
      svg {
        [data-factor] {
          &:hover {
            opacity: 1;
            position: relative;
          }
        }
      }
    }
  }
}
