@import url("https://fonts.googleapis.com/css?family=Ubuntu%20Mono:700|Inter:400|Inter:700&display=swap");

:root {
  --transition-fast: 0.1s ease-out;
  --transition-slow: 0.25s ease-out;
  --page-padding: 1rem 4rem;

  --text-light: 9, 16, 21;
  --background-light: 220, 231, 239;
  --primary-light: 48, 76, 105;
  --secondary-light: 173, 140, 202;
  --accent-light: 176, 108, 188;

  --text-dark: 234, 241, 246;
  --background-dark: 16, 27, 35;
  --primary-dark: 150, 178, 207;
  --secondary-dark: 86, 53, 115;
  --accent-dark: 135, 67, 147;
}

@media only screen and (max-width: 992px) {
  :root {
    --page-padding: 1rem 2rem;
  }
}

@media (prefers-color-scheme: light) {
  :root {
    --text: var(--text-light);
    --background: var(--background-light);
    --primary: var(--primary-light);
    --secondary: var(--secondary-light);
    --accent: var(--accent-light);
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: var(--text-dark);
    --background: var(--background-dark);
    --primary: var(--primary-dark);
    --secondary: var(--secondary-dark);
    --accent: var(--accent-dark);
  }
}

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgb(var(--primary)) transparent;
}

body {
  background-color: rgb(var(--background));
  color: rgb(var(--text));
  font-family: "Inter", sans-serif;
  font-weight: 400;
}

h1,
h2,
h3,
h4,
h5,
.heading-1,
.heading-2,
.heading-3,
.heading-4,
.heading-5 {
  font-family: "Ubuntu Mono", monospace;
  font-weight: 700;
  display: block;
}

h1,
.heading-1 {
  font-size: 4.21rem;
}

h2,
.heading-2 {
  font-size: 3.158rem;
}

h3,
.heading-3 {
  font-size: 2.369rem;
}

h4,
.heading-4 {
  font-size: 1.777rem;
}

h5,
.heading-5 {
  font-size: 1.333rem;
}

p {
  line-height: 2rem;
}

a {
  color: rgb(var(--text));
  text-decoration: none;
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  height: 2rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.5rem;
  background-color: rgba(var(--secondary), 0.1);
  color: rgb(var(--text));
  font-family: "Inter", sans-serif;
  font-weight: 400;
  scrollbar-width: thin;
}

textarea {
  height: auto;
  resize: none;
}

section,
main {
  position: relative;
  width: 100vw;
  max-width: 100%;
  min-height: 100vh;
  padding: var(--page-padding);
}

.heading-underline {
  position: relative;
  display: inline-block;
}

.heading-underline::before {
  content: "";
  position: absolute;
  bottom: 0.25rem;
  left: 0;
  width: 100%;
  height: 1rem;
  background-color: rgb(var(--secondary));
  z-index: -1;
}

.hidden {
  display: none !important;
}

/**************** Buttons ****************/

.btn-primary {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 2rem;
  border: none;
  border-radius: 0.5rem;
  background-color: rgb(var(--primary));
  color: rgb(var(--background));
  text-align: center;
  transition: var(--transition-fast);
}

@media (hover: hover) {
  .btn-primary:hover {
    transform: scale(1.1);
    color: rgb(var(--text));
    background: rgb(var(--accent));
    box-shadow: 0 0 16px rgb(var(--accent));
  }
}

/**************** Particle Effect ****************/

.particle-btn {
  position: relative;
  overflow: hidden;
  cursor: none;
}

@media (hover: hover) {
  .particle {
    position: absolute;
    width: 0.25rem;
    height: 0.25rem;
    filter: blur(1px);
    border-radius: 50%;
    background-color: rgb(var(--text-dark));
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.05); /* Prevents pixels from being left behind during animation */
    pointer-events: none;
  }
}

/**************** Navbar ****************/

header {
  position: fixed;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100vw;
  padding: var(--page-padding);
  background-color: transparent;
  z-index: 1;
  transition: var(--transition-slow);
}

header.scrolled {
  background-color: rgba(var(--background));
}

#name {
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.05); /* Prevents pixels from being left behind during animation */
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4rem;
}

nav a {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

nav a::after {
  --height: 0.125rem;

  content: "";
  position: absolute;
  bottom: calc(-1 * var(--height));
  left: 0;
  width: 0;
  height: var(--height);
  background-color: rgb(var(--primary));
  transition: var(--transition-fast);
}

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

@media only screen and (max-width: 992px) {
  nav {
    position: fixed;
    top: 0.5rem;
    right: -100%;
    flex-direction: column;
    gap: 0;
    width: 80%;
    max-width: 18rem;
    min-height: calc(100% - 2 * 1rem);
    padding: 4rem 1rem 1rem 1rem;
    border-radius: 0.5rem;
    background-color: rgb(var(--primary));
    opacity: 0;
    transition: opacity var(--transition-fast);
  }

  #menu-toggle:checked ~ nav {
    right: 1rem;
    opacity: 1;
  }

  nav a {
    width: 100%;
    height: 4rem;
    color: rgb(var(--background));
  }

  #contact-btn {
    margin-top: auto;
    background-color: rgb(var(--background));
    color: rgb(var(--text));
  }
}

/**************** Menu Icon ****************/

#menu-btn,
#menu-close {
  display: none;
}

#menu-close svg {
  fill: rgb(var(--background));
}

#menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  display: none;
  width: 100vw;
  height: 100vh;
}

@media only screen and (max-width: 992px) {
  #menu-btn,
  #menu-close {
    display: flex;
  }

  #menu-btn {
    position: relative;
    width: 2rem;
    height: 2rem;
    z-index: 1;
  }

  #menu-btn span {
    position: absolute;
    left: 0;
    transform: translateY(-50%);
    width: 2rem;
    height: 0.1875rem;
    border-radius: 0.1875rem;
    background-color: rgb(var(--text));
    transition: var(--transition-fast);
  }

  #menu-btn span:nth-child(1) {
    top: 20%;
  }

  #menu-btn span:nth-child(2) {
    top: 50%;
  }

  #menu-btn span:nth-child(3) {
    top: 80%;
  }

  #menu-toggle:checked ~ #menu-btn span {
    background-color: rgb(var(--background));
  }

  #menu-toggle:checked ~ #menu-btn span:nth-child(1) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
  }

  #menu-toggle:checked ~ #menu-btn span:nth-child(2) {
    left: 50%;
    width: 0;
  }

  #menu-toggle:checked ~ #menu-btn span:nth-child(3) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
  }

  #menu-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
  }

  #menu-toggle:checked ~ #menu-overlay {
    display: block;
  }
}

/**************** Hero Section ****************/

#hero-glow {
  --size: 60vmin;

  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: linear-gradient(135deg, rgb(var(--accent)), rgb(var(--primary)));
  filter: blur(calc(var(--size) / 2));
}

#hero-typewriter {
  --animation-speed: 3s;
  --font-size: 8rem;
  --num-words: 3;
  --max-word-length: 12;
  --cursor-blink-speed: 0.4s;

  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: var(--font-size);
  height: var(--font-size);
  overflow: hidden;
}

@media only screen and (max-width: 992px) {
  #hero-typewriter {
    --font-size: 5rem;
  }
}

@media only screen and (max-width: 768px) {
  #hero-typewriter {
    --font-size: 4rem;
  }
}

@media only screen and (max-width: 600px) {
  #hero-typewriter {
    --font-size: 3rem;
  }
}

#hero-typewriter span {
  position: relative;
  top: 0;
  display: block;
  width: 0;
  min-height: var(--font-size);
  border-right: 0.25rem solid rgb(var(--text));
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.05); /* Prevents pixels from being left behind during animation */
  font-size: var(--font-size);
  white-space: nowrap;
  overflow: hidden;
  animation: swap calc(2 * var(--num-words) * var(--animation-speed))
      steps(var(--num-words)) infinite,
    typing var(--animation-speed) steps(var(--max-word-length)) infinite
      alternate,
    cursor var(--cursor-blink-speed) step-end infinite alternate;
}

#scroll-indicator {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  transition: var(--transition-slow);
}

#scroll-indicator.scrolled {
  opacity: 0;
  pointer-events: none;
}

@keyframes cursor {
  50% {
    border-color: transparent;
  }
}

@keyframes typing {
  0% {
    display: none;
    width: 0;
    padding-right: 0;
  }

  1% {
    display: block;
    padding-right: 0.25rem;
  }

  40% {
    width: 100%;
  }

  100% {
    width: 100%;
  }
}

@keyframes swap {
  100% {
    top: calc(-2 * var(--num-words) * var(--font-size));
  }
}

/**************** About Section ****************/

#about {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4rem;
  background-color: rgb(var(--background));
}

#who-am-i {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2rem;
  width: 50%;
  max-width: 37.5rem;
}

#who-am-i p a {
  color: rgb(var(--primary));
  font-weight: 700;
  text-decoration: underline;
}

#skills-container {
  --skill-diameter: 7rem;
  padding: calc(1 / 7 * var(--skill-diameter)) 0;
}

#skills-container div {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: calc(-1 / 7 * var(--skill-diameter)) 0;
}

.skill {
  --skill-background: var(--primary);
  --skill-color: var(--background);

  display: flex;
  justify-content: center;
  align-items: center;
  width: var(--skill-diameter);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  text-align: center;
  color: rgb(var(--skill-color));
  background-color: rgb(var(--skill-background));
  transition: var(--transition-slow);
}

.skill-secondary {
  --skill-background: var(--secondary);
  --skill-color: var(--text);
}

.skill-accent {
  --skill-background: var(--accent);
  --skill-color: var(--text);
}

@media only screen and (max-width: 1200px) {
  #skills-container {
    --skill-diameter: 5rem;
  }
}

@media only screen and (max-width: 992px) {
  #about {
    flex-direction: column;
    padding-top: 5rem;
  }

  #who-am-i {
    align-items: center;
    width: 100%;
    max-width: none;
  }
}

@media only screen and (max-width: 464px) {
  #skills-container {
    --skill-diameter: 3.75rem;

    font-size: 0.75rem;
  }
}

/**************** Projects Section ****************/

#projects {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4rem;
  padding: var(--page-padding);
  padding-top: 4rem;
  padding-bottom: 4rem;
  background: rgba(var(--secondary), 0.1);
}

.project-list {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
}

.project-card {
  position: relative;
  height: 40vw;
  max-height: 80vh;
  aspect-ratio: 2 / 3;
  border-radius: 0.75rem;
  color: rgb(var(--text-dark));
  overflow: hidden;
}

.project-card img {
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
}

.project-blur-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.project-card h1 {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.project-description {
  position: absolute;
  bottom: -100%;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 2rem;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
  transition: var(--transition-fast);
}

.project-card:focus-within .project-description,
.project-card:hover .project-description {
  bottom: 0;
}

@media only screen and (max-width: 1200px) {
  .project-card h1 {
    font-size: 3.158rem;
  }
}

@media only screen and (max-width: 1100px) {
  .project-list {
    flex-direction: column;
    gap: 2rem;
  }

  .project-card {
    width: 80%;
  }
}

@media only screen and (max-width: 768px) {
  .project-card {
    width: 100%;
    height: 30rem;
  }
}

@media only screen and (max-width: 400px) {
  .project-card {
    height: 36rem;
    max-height: none;
  }

  .project-card h2 {
    font-size: 2.369rem;
  }
}

@media (hover: none) {
  .project-card h1,
  .project-blur-overlay {
    display: none;
  }

  .project-description {
    bottom: 0;
  }
}

/**************** Contact Section ****************/

#contact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4rem;
  padding: var(--page-padding);
}

.contact-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 31.25rem;
}

#contact form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  width: 40%;
  min-width: 30rem;
  max-width: 45rem;
}

#contact form > div {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: start;
  gap: 0.5rem;
  width: 100%;
}

#contact form > div > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

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

#formResult {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  text-align: center;
}

@media only screen and (max-width: 600px) {
  .contact-container {
    width: 100%;
  }

  #contact form {
    width: 100%;
    min-width: auto;
  }

  #contact form > div > div {
    flex-direction: column;
    gap: 2rem;
  }
}
