@use "./styles/fonts.scss";
@use "./styles/reset.scss";
@use "./styles/variables.scss" as vars;
@use "./styles/defaults.scss" as media;

// THIS SCSS CODE IS RUSHED AND SUPER BAD PLEASE DON'T LOOK AT IT LOOOOL

$themes: (
  light: (
    base-dark-purple: #6c3f7c,
    base-purple: #6e5e9c,
    base-purple-200: #cdb3d6,
    base-pink: #eedfe4,
    base-light-purple: #ead7ef,
    header-text: #6c3f7c,
    text: #020202,
    svgs: #6e5e9c,
  ),
  dark: (
    base-dark-purple: #ddd6d6,
    base-purple: #2a0f4e,
    base-purple-200: #62416d,
    base-pink: #8b4e62,
    base-light-purple: #401d49,
    header-text: #e6dede,
    text: #e6dede,
    svgs: #e6dede,
  ),
);

// Theme mixins
@mixin themed() {
  @each $theme, $map in $themes {
    .#{$theme}-theme & {
      $theme-map: () !global;
      @each $key, $value in $map {
        $theme-map: map-merge(
          $theme-map,
          (
            $key: $value,
          )
        ) !global;
      }
      @content;
      $theme-map: null !global;
    }
  }
}

@function t($key) {
  @return map-get($theme-map, $key);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  overflow: hidden;
}

:root {
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

// Experience
#experience {
  position: fixed;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  overflow: hidden;

  #experience-canvas {
    height: 100%;
    width: 100%;
    z-index: 2;
  }
}

// Text styles
h1,
h2 {
  font-family: "Motley Forces";
}

p,
ul,
li {
  font-family: "Shifty Notes";
}

ul {
  list-style: none;
  padding-left: 2rem;

  li {
    position: relative;
    margin-bottom: 1rem;

    &:before {
      content: "•";
      position: absolute;
      left: -1.5rem;
      color: vars.$base-purple;
      font-size: 1.5em;
    }

    // Nested lists
    ul {
      margin-top: 0.5rem;

      li:before {
        content: "◦";
        font-size: 1.2em;
      }

      // Third level nesting
      ul li:before {
        content: "▪";
        font-size: 1em;
      }
    }
  }

  // Hover effect
  li:hover {
    &:before {
      color: vars.$base-dark-purple;
      transform: scale(1.2);
      transition: all 0.2s ease;
    }
  }
}

// Image Styles

.image-wrapper {
  width: 100%;
  height: 550px;
  overflow: hidden;
  margin-bottom: 12px;
  @include media.media("<=tablet") {
    height: auto;
  }
}

.base-image {
  height: 100%;
  width: 100%;
  border-radius: 24px;
  object-fit: cover;
  border: 6px solid vars.$base-purple;
}

.work-image-wrapper {
  width: 100%;
  height: 350px;
  overflow: hidden;
  margin-bottom: 12px;
}

.work-base-image {
  height: 100%;
  width: 100%;
  border-radius: 24px;
  object-fit: cover;
  border: 6px solid vars.$base-purple;
}

// Overlay
.overlay {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 3;
  display: none;
  background-color: rgba(32, 32, 32, 0.2);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

//Modals
.modal {
  @include vars.centered;
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: 1200px;
  width: 90%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
  z-index: 9999;
  padding: 30px;
  border-radius: 25px;
  display: none;
  border: 8px solid vars.$base-purple;
}

.about {
  max-width: 800px;
}

.contact {
  max-width: 500px;
}

.modal-wrapper {
  @include vars.centered;
  width: 100%;
  flex-direction: column;
  gap: 24px;
}

.sm-margin-top {
  margin-top: 12px;
}

.modal-title {
  @include vars.centered;
  padding: 10px 80px;
  border-radius: 5rem;
  color: vars.$base-dark-purple;
  background-color: vars.$base-purple-200;
  box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
  @include media.media("<=tablet") {
    font-size: 1.5rem;
    padding: 10px 20px;
    width: 100%;
  }
}

.modal-paragraph-header {
  font-size: 1.5rem;
  margin-top: 24px;
  margin-bottom: 8px;
  @include media.media("<=tablet") {
    font-size: 1.3rem;
  }
}

.modal-paragraph-header-2 {
  border-top: 2px solid vars.$base-purple;
  font-size: 1.2rem;
  padding-top: 24px;
  margin-bottom: 8px;
  @include media.media("<=tablet") {
    font-size: 1.3rem;
  }
}

.modal-paragraph-text {
  font-size: 1.5rem;
  @include media.media("<=tablet") {
    font-size: 1.3rem;
  }
}

.list-text {
  font-size: 1.5rem;
  @include media.media("<=tablet") {
    font-size: 1.3rem;
  }
}

.list-text-2 {
  font-size: 1.2rem;
  @include media.media("<=tablet") {
    font-size: 1.3rem;
  }
}

.modal-content {
  width: 100%;
  height: 200px;
  overflow: hidden;
  position: relative;
  -webkit-overflow-scrolling: touch;

  @include media.media("<=tablet") {
    height: 350px;
  }
}

.work .modal-content {
  height: 550px;

  @include media.media("<=tablet") {
    height: 500px;
  }
}

.about .modal-content {
  height: 550px;
  @include media.media("<=tablet") {
    height: 500px;
  }
}

.contact .modal-content {
  height: 170px;
  overflow: visible;

  @include media.media("<=tablet") {
    overflow: visible;
    height: 170px;
  }
}

.modal-content-wrapper {
  height: 100%;
  overflow-y: auto;
  padding-right: 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;

  &::-webkit-scrollbar {
    width: 8px;
  }

  &::-webkit-scrollbar-track {
    width: 2px;
    border-radius: 4px;
    background-color: rgba(111, 73, 116, 0.2);
  }

  &::-webkit-scrollbar-thumb {
    background-color: vars.$base-dark-purple;
    border-radius: 4px;
  }
}

.work .modal-content-wrapper {
  @include vars.centered;
  flex-direction: row;
  gap: 18px;
  @include media.media("<=tablet") {
    justify-content: space-between;
    flex-direction: column;
  }
}

.work-project {
  padding-top: 16px;
  @include vars.centered;
  flex-direction: column;
  gap: 28px;
  width: 80%;
  justify-content: start;
  height: 100%;
  @include media.media("<=tablet") {
    height: auto;
    width: 100%;
    padding-bottom: 24px;
  }
}

.work-project-wrapper {
  width: 100%;
  height: auto;
}

.contact .modal-content-wrapper {
  overflow: visible;
}

.modal-exit-button {
  @include vars.centered;
  position: absolute;
  top: -2.3rem;
  left: -2.3rem;
  border: 8px solid vars.$base-purple;
  background-color: vars.$base-light-purple;
  padding: 15px;
  border-radius: 1.2rem;
  cursor: pointer;
  transform: rotate(-15deg);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;

  &:hover {
    transform: rotate(45deg) scale(1.3);
  }

  @include media.media("<=tablet") {
    // Reset the top and left positions
    top: auto;
    left: 50%;
    bottom: -3rem;
    transform: translateX(-50%);

    &:hover {
      transform: translateX(-50%) scale(1.3);
    }
  }
}

.exit-button-svg {
  width: 40px;
  height: 40px;
  color: vars.$base-purple;
  @include media.media("<=tablet") {
    width: 25px;
    height: 25px;
  }
}

.contact-button-wrapper {
  @include vars.centered;
  margin-top: 24px;
  justify-content: space-between;
}

.contact-svg {
  width: 40px;
  height: 40px;
  cursor: pointer;

  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.linkedin {
  width: 60px;
  height: 60px;
  &:hover {
    transform: rotate(15deg) scale(1.3);
  }
}

.github {
  width: 60px;
  height: 60px;
  &:hover {
    transform: rotate(-15deg) scale(1.3);
  }
}

.instagram {
  width: 63px;
  height: 63px;
  &:hover {
    transform: rotate(35deg) scale(1.3);
  }
}

.mail {
  width: 68px;
  height: 68px;
  &:hover {
    transform: rotate(-35deg) scale(1.3);
  }
}

.xsm-margin-top {
  margin: 12px;
}

// Toggle Button
.mute-toggle-button {
  position: fixed;
  top: 36px;
  right: 148px;
  z-index: 2;

  cursor: pointer;

  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  &:hover {
    transform: rotate(-5deg) scale(1.3);
  }

  @include media.media("<=tablet") {
    top: 30px;
    right: 96px;
  }
}

.sound-svg {
  width: 40px;
  height: 40px;

  stroke: vars.$base-purple;
  @include media.media("<=tablet") {
    width: 30px;
    height: 30px;
  }
}

.sound-off-svg {
  width: 40px;
  height: 40px;
  display: none;
  stroke: vars.$base-purple;
  @include media.media("<=tablet") {
    top: 30px;
    right: 96px;
  }
  @include media.media("<=tablet") {
    width: 30px;
    height: 30px;
  }
}

.toggle-buttons {
  @include vars.centered;
  border: 8px solid vars.$base-purple;
  background-color: vars.$base-light-purple;
  padding: 10px;
  color: vars.$base-purple;
  border-radius: 1.2rem;
  cursor: pointer;
  box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
}

.theme-toggle-button {
  position: fixed;
  top: 36px;
  right: 48px;
  z-index: 2;
  cursor: pointer;

  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  &:hover {
    transform: rotate(5deg) scale(1.3);
  }

  @include media.media("<=tablet") {
    top: 30px;
    right: 18px;
  }
}

.sun-svg {
  width: 40px;
  height: 40px;

  stroke: vars.$base-purple;
  @include media.media("<=tablet") {
    width: 30px;
    height: 30px;
  }
}

.moon-svg {
  width: 40px;
  height: 40px;
  stroke: vars.$base-purple;
  display: none;
  @include media.media("<=tablet") {
    width: 30px;
    height: 30px;
  }
}

.sm-font {
  font-size: 1.2rem;
}

ul {
  li {
    &:before {
      @include themed() {
        color: t("text");
      }
    }

    &:hover {
      &:before {
        @include themed() {
          color: t("base-purple");
        }
      }
    }
  }
}

.base-image {
  @include themed() {
    border-color: t("base-purple");
  }
}

.work-base-image {
  @include themed() {
    border-color: t("base-purple");
  }
}

.overlay {
  @include themed() {
    background-color: t("overlay-bg");
  }
}

.modal {
  @include themed() {
    border-color: t("base-purple");
    background-color: t("base-light-purple");
  }
}

.modal-title {
  @include themed() {
    color: t("header-text");
    background-color: t("base-purple-200");
  }
}

.modal-paragraph-header-2 {
  @include themed() {
    border-color: t("base-purple");
  }
}

.modal-content-wrapper {
  &::-webkit-scrollbar-track {
    @include themed() {
      background-color: t("scrollbar-track");
    }
  }

  &::-webkit-scrollbar-thumb {
    @include themed() {
      background-color: t("base-dark-purple");
    }
  }
}

.list-text,
.list-text-2,
.modal-paragraph-header,
.modal-paragraph-header-2,
.modal-paragraph-text {
  @include themed() {
    color: t("text");
  }
}

.modal-exit-button {
  @include themed() {
    border-color: t("base-purple");
    background-color: t("base-light-purple");
  }
}

.exit-button-svg {
  @include themed() {
    color: t("svgs");
  }
}

.toggle-buttons {
  @include themed() {
    border-color: t("base-purple");
    background-color: t("base-light-purple");
    color: t("base-purple");
  }
}

.sound-svg,
.sound-off-svg,
.sun-svg,
.github,
.linkedin,
.instagram,
.mail,
.moon-svg {
  @include themed() {
    stroke: t("svgs");
    color: t("svgs");
  }
}

.loading-screen {
  @include vars.centered;
  position: fixed;
  top: 50%;
  left: 50%;
  width: 108vw;
  height: 108vh;
  margin-left: -54vw;
  margin-top: -54vh;
  overflow: hidden;
  z-index: 999999;
  border: 8px solid vars.$base-purple;
  background-color: #2a0f4e;
  transform: perspective(1000px);
  border-radius: 48px;
}

.loading-screen-button {
  font-family: "Motley Forces";
  @include vars.centered;
  background-color: transparent;
  padding: 10px 40px;
  outline: none;
  color: #e6dede;
  border-radius: 1.2rem;
  border: none;
  font-size: 42px;

  @include media.media("<=tablet") {
    font-size: 32px;
  }
}

.no-sound-button {
  font-family: "Motley Forces";
  @include vars.centered;
  background-color: transparent;
  border: none;
  color: #c4bebe;

  position: absolute;
  bottom: 15%;
  left: 50%;
  font-size: 16px;
  transform: translate(-50%, -50%);

  &:hover {
    color: #e6dede;
    cursor: pointer;
  }
}

.instructions {
  @include vars.centered;
  position: absolute;
  bottom: 10%;
  left: 50%;
  max-width: 1200px;
  width: 90%;
  font-size: 28px;
  transform: translate(-50%, -50%);
  font-family: "Shifty Notes";
  color: #e6dede;
}

.desktop-instructions {
  @include media.media("<tablet") {
    display: none;
  }
}

.mobile-instructions {
  @include media.media(">=tablet") {
    display: none;
  }
  @include media.media("<=tablet") {
    font-size: 28px;
  }
}
