:root {
  --font-sans: "Inter", sans-serif;
  --font-mono: "Ubuntu Mono", monospace;
  --white-color: #fff;
  --black-color: #141314;
  --link-color: #004bee;
  --darker-gray-color: #313235;
  --dark-gray-color: #3c3d40;
  --light-gray-color: #f5f5f5;
  --js-yellow-color: #ffd600;
  --font-size: 1.2rem;
}

* {
  box-sizing: border-box;
}

.dark-mode {
  color: var(--white-color);
  background-color: var(--black-color);

  code {
    color: var(--light-gray-color);
  }

  pre {
    color: var(--light-gray-color);
    background-color: var(--dark-gray-color);
  }

  .clipboard-btn {
    color: var(--white-color);
    background-color: var(--darker-gray-color);
  }

  article a,
  footer a {
    color: var(--link-color);
  }
}

body {
  display: grid;
  grid-template-columns: 250px minmax(500px, 800px);
  height: 100vh;
  color: var(--black-color);
  background-color: var(--white-color);
  font-family: var(--font-sans);
  font-size: var(--font-size);
  line-height: 1.6rem;
}

section {
  padding-bottom: 1rem;
}

pre,
button {
  border-radius: 5px;
}

nav {
  position: fixed;
  padding-left: 2rem;
  height: fit-content;

  .title-container {
    display: flex;
    align-items: center;
  }

  h1 {
    display: flex;
    align-items: center;
    margin-right: 1rem;
  }

  h1::before {
    display: inline-block;
    content: "";
    width: 50px;
    height: 50px;
    background-image: url(../assets/js-static.svg);
    background-size: cover;
    margin-right: 10px;
  }

  .toggle-theme-btn {
    width: 50px;
    height: 50px;
    margin-right: 1rem;
    background: unset;
    border: none;
    font-family: "Material Symbols Rounded";
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    font-size: 2rem;
  }

  .toggle-theme-btn:hover {
    background-color: unset;
    color: unset;
    cursor: pointer;
  }

  .toggle-theme-btn:after {
    content: "dark_mode";
  }

  .toggle-theme-btn.light-mode-icon::after {
    content: "light_mode";
    color: var(--white-color);
  }

  .nav-hover::before {
    background-image: url(../assets/js-animated.svg);
  }

  ul {
    list-style-type: none;
    padding: 0;
    font-weight: 600;
  }

  li {
    margin-bottom: 1rem;
  }

  a {
    padding: 0.5rem;
    color: unset;
    position: relative;
    text-decoration: none;
  }

  a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--js-yellow-color);
    transition: width 0.3s ease-in-out;
  }

  a:hover::after {
    width: 100%;
  }
}

main {
  position: relative;
  padding: 2rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

.scroll-to-top-container {
  position: absolute;
  right: 5rem;
}

.scroll-to-top-btn {
  display: none;
  position: fixed;
  right: unset;
  bottom: 0;
  width: 50px;
  height: 50px;
  padding: 0.8rem;
  border: none;
  color: var(--black-color);
  background-color: var(--js-yellow-color);
  transform: translateY(-3rem);
  z-index: 10;
  font-size: 1.5rem;
  font-family: "Material Symbols Rounded";
  border: none;
  box-shadow: 1px 1px 2px 2px solid rgba(0, 0, 0, 0.312);
  transition: color 0.3s;
}

.scroll-to-top-btn::after {
  content: "keyboard_arrow_up";
}

.scroll-to-top-btn:hover {
  cursor: pointer;
}

article {
  line-height: 2rem;
  word-spacing: 0.1rem;

  h2 {
    line-height: 2rem;
  }

  ul {
    padding-left: 1.5rem;
  }
}

strong {
  font-weight: bold;
}

pre {
  font-size: 1.1rem;
  font-family: var(--font-mono);
  color: var(--dark-gray-color);
  background-color: var(--light-gray-color);
  white-space: pre-wrap;
  overflow-x: hidden;
}

code {
  color: var(--dark-gray-color);
  padding: 0.2rem;
}

pre {
  display: block;
  padding: 1rem;
  white-space: pre-line;
}

.container-code {
  position: relative;
}

.clipboard-btn {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  padding: 0.5rem;
  background-color: #d4d4d4;
  font-family: var(--font-sans);
  font-size: 1rem;
  border: none;
}

.clipboard-btn:hover {
  cursor: pointer;
}

.external-link:after {
  font-family: "Material Symbols Rounded";
  content: "open_in_new";
}

footer {
  display: flex;
  justify-content: space-evenly;
  font-size: 0.9rem;
  margin-left: 1rem;
  margin-right: 1rem;

  span {
    margin-right: 1rem;
  }

  a {
    text-decoration: none;
  }
}

@media (max-width: 768px) {
  body {
    grid-template-columns: 100%;
    grid-template-rows: 100% 100%;
  }

  .title-container {
    justify-content: space-between;
  }

  nav {
    position: relative;

    a:hover::after {
      width: 0%;
    }
  }

  footer {
    text-align: center;
    line-height: 1.1;

    span {
      display: block;
      margin-bottom: 0.5rem;
    }

    a {
      display: block;
    }
  }
}
