html {
  box-sizing: border-box;
  scroll-behavior: smooth;
}
*,
*::before,
*::after {
  box-sizing: inherit;
}

h1,
h2,
h3,
p,
code {
  margin-block: unset;
}

code {
  font-family: "VT323", monospace;
  font-weight: 400;
  font-style: normal;
  background-color: hsl(91, 33%, 17%);
  border-style: solid;
  border-width: 1px;
  border-color: hsl(91, 33%, 22%);
  padding: 0px 5px;
  border-radius: 5px;
  font-size: 0.9em;
}

body {
  margin: 0px;
  background-color: hsl(91, 33%, 27%);
  text-shadow: rgba(0, 0, 0, 0.6) 4px 4px 27px;
}

/* @keyframes blur-25 {
  from {
    filter: blur(0px);
  }
  to {
    filter: blur(25px);
  }
} */

header#root-header {
  /* Size */
  width: 100%;
  min-height: 100dvh;
  margin-bottom: 100px;
  /* Layout */
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  /* Background */
  background-image: url(/img/res/light/hero-bg.png);
  background-size: cover;
  image-rendering: pixelated;
  /* Animation */
  /* TODO: This does not work as expected */
  /* To attempt to fix this, uncomment this
  and the appropriate keyframe (Line 30) */
  /* animation-name: blur-25;
  animation-duration: 1s;
  animation-timing-function: linear;
  animation-timeline: view();
  animation-range: entry 0% exit 100%; */

  * {
    /* Animation */
    animation-duration: 1s;
    animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
    animation-name: fadein-down;
  }

  section#root-hero {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    max-width: calc(100% - 100px);
    height: 100dvh;
    gap: 50px;
    padding: 0px 50px;

    img {
      -webkit-mask-image: url(/img/res/frame/1.png);
      -webkit-mask-position: center;
      -webkit-mask-size: 350px 350px;
      mask-image: url(/img/res/frame/1.png);
      mask-position: center;
      mask-size: 350px 350px;
      box-shadow: 10px 5px 5px red;
    }

    #root-hero-text {
      /* Font */
      font-family: "Pixelify Sans", sans-serif;
      font-optical-sizing: auto;
      font-style: normal;
      /* Layout */
      display: flex;
      flex-direction: column;
      flex-basis: auto;
      flex-wrap: wrap;
      text-align: left;
      column-gap: 50px;
      /* Text styling */
      color: #c9f2ce;

      h1 {
        font-size: 128px;
        font-weight: 700;
      }

      p {
        font-size: 64px;
        font-weight: 500;
      }
    }
  }
}

@keyframes fadein-down {
  0% {
    transform: translateY(-10%);
    opacity: 40%;
  }
  100% {
    transform: translateX(0);
    opacity: 100%;
  }
}

picture#down-arrow {
  image-rendering: pixelated;
  bottom: calc(4dvh + 2dvh);
  position: absolute;
  animation-name: bounce-hint-down;
  animation-duration: 2000ms;
  animation-delay: 500ms;
  animation-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
  animation-iteration-count: infinite;
  cursor: pointer;
  scale: 90%;
  filter: opacity(40%);
}

@keyframes bounce-hint-down {
  0% {
    transform: translateY(0dvh);
    filter: opacity(40%);
    scale: 90%;
  }
  40% {
    transform: translateY(4dvh);
    filter: opacity(100%);
    scale: 100%;
  }
  60% {
  }
  100% {
    transform: translateY(0dvh);
    filter: opacity(40%);
    scale: 90%;
  }
}

main {
  section {
    margin: 100px 0px;
    width: calc(100% - 100px);
    max-width: 1600px;
    margin: 0 auto;
    padding: 50px 0px;
    display: flex;
    flex-direction: column;
    font-family: "Pixelify Sans", sans-serif;
    color: #c9f2ce;

    h2 {
      font-weight: 700;
      font-size: clamp(3rem, 2.4444rem + 2.963vw, 6rem);
    }

    h3 {
      font-weight: 600;
      font-size: clamp(2rem, 1.6296rem + 1.9753vw, 4rem);
    }

    p {
      font-weight: 400;
      font-size: clamp(1.25rem, 1.1111rem + 0.7407vw, 2rem);

      &.subtitle {
        font-size: clamp(0.75rem, 0.6111rem + 0.7407vw, 1.5rem);
      }

      a,
      span.inline-button {
        font-size: inherit;
        cursor: pointer;
      }
    }

    a,
    span.inline-button {
      font-size: clamp(1rem, 0.8148rem + 0.9877vw, 2rem);
      font-weight: 500;
      color: #e6e6e6;
      transition: color 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
      width: fit-content;
      text-decoration: none;

      &:hover {
        color: #aaaaaa;
        text-decoration: underline;
      }

      &:active {
        transition: color 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
        color: #787878;
      }
    }

    &.title-subtitles {
      gap: 10px;
      align-items: center;
      text-align: center;
    }

    div.title-subtitles {
      display: flex;
      flex-direction: column;
      gap: 15px;
      align-items: center;
      justify-content: center;
      text-align: center;
      max-width: min-content;
    }

    &.column {
      display: flex;
      flex-direction: column;
      gap: 50px;
      align-items: center;
      justify-content: center;

      div.contents {
        display: flex;
        justify-content: center;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 50px;

        div.item {
          width: 100%;
          display: flex;
          max-width: 500px;
          flex-direction: column;
          gap: 15px;
        }
      }
    }

    &.column.vertical {
      flex-direction: row;
      align-items: start;

      div.title-subtitles {
        align-items: start;
        position: sticky;
        top: 0%;

        p {
          text-align: start;
        }
      }

      div.contents {
        justify-content: start;
        flex-direction: column;

        div.item {
          max-width: initial;
        }
      }
    }
  }
}

@media (max-height: 670px) {
  picture#down-arrow {
    bottom: calc(1vh + 2vh);
  }

  @keyframes bounce-hint-down {
    0% {
      transform: translateY(0%);
      filter: opacity(40%);
      scale: 90%;
    }
    40% {
      transform: translateY(1vh);
      filter: opacity(100%);
      scale: 100%;
    }
    60% {
    }
    100% {
      transform: translateY(0%);
      filter: opacity(40%);
      scale: 90%;
    }
  }
}

@media (max-width: 1699px) {
  main {
    section {
      &.column.vertical {
        max-width: 1050px;
      }
    }
  }
}

@media (max-width: 1200px) {
  header#root-header {
    section#root-hero {
      gap: 30px;

      img {
        scale: 0.8;
      }

      #root-hero-text {
        h1 {
          font-size: 96px;
        }
        p {
          font-size: 48px;
        }
      }
    }
  }
}

@media (max-width: 1149px) {
  main {
    section {
      &.column.vertical {
        flex-direction: column;
        align-items: center;

        div.title-subtitles {
          align-items: center;
          position: initial;
          top: unset;

          p {
            text-align: center;
          }
        }

        div.contents {
          flex-direction: column;
          justify-content: center;

          div.item {
            max-width: 500px;
          }
        }
      }
    }
  }
}

@media (max-width: 830px) {
  header#root-header {
    section#root-hero {
      gap: 30px;

      img {
        scale: 0.8;
      }

      #root-hero-text {
        h1 {
          font-size: 64px;
        }

        p {
          font-size: 32px;
        }
      }
    }
  }
}

@media (orientation: portrait) {
  header#root-header {
    section#root-hero {
      flex-direction: column;

      #root-hero-text {
        text-align: center;
      }
    }
  }
}

@media (max-width: 830px) {
  img {
    scale: 1;
  }
}

@media (max-width: 680px) and (orientation: landscape) {
  header#root-header {
    section#root-hero {
      gap: 30px;

      img {
        scale: 0.7;
      }

      #root-hero-text {
        h1 {
          font-size: 48px;
        }

        p {
          font-size: 28px;
        }
      }
    }
  }
}

@media (max-width: 480px) {
  main {
    section {
      h2 {
        font-size: clamp(2.5rem, 1.6296rem + 1.9753vw, 4.5rem);
      }
    }
  }
}

@media (max-width: 320px) or (max-height: 580px) {
  header#root-header {
    section#root-hero {
      gap: 10px;

      img {
        scale: 0.7;
      }

      #root-hero-text {
        h1 {
          font-size: 36px;
        }

        p {
          font-size: 24px;
        }
      }
    }
  }

  picture#down-arrow {
    top: calc(2vh + 2px);
  }

  @keyframes bounce-hint-down {
    0% {
      transform: translateY(0%);
      filter: opacity(40%);
    }
    40% {
      transform: translateY(2px);
      filter: opacity(100%);
    }
    60% {
    }
    100% {
      transform: translateY(0%);
      filter: opacity(40%);
    }
  }
}

@media (prefers-color-scheme: dark) {
  body {
    background-color: #04192e;
  }

  code {
    background-color: hsl(210, 84%, 0%);
    border-color: hsl(210, 84%, 5%);
  }

  header#root-header {
    background-image: url(/img/res/dark/hero-bg.png);

    section#root-hero {
      #root-hero-text {
        color: #9ec9f0;
      }
    }
  }

  main {
    section {
      color: #9ec9f0;
    }
  }
}
