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

html {
  scroll-behavior: smooth;
}

body {
  --nav-bg: rgba(61, 61, 61, 0.8);
  --sections-bg: rgba(33, 33, 33, 1);
  --main-fg: rgba(255, 255, 255, 0.9);
  --light-fg: rgba(255, 255, 255, 0.2);

  font-family: "Montserrat", sans-serif;
  color: var(--main-fg);
}

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

/* ---------- Navbar ---------- */

#navbar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: var(--nav-bg);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 10;
}

#links {
  display: flex;
  justify-content: center;
  align-items: center;
}

.nav-link {
  padding: 1rem 1rem;
  transition: background-color 200ms ease-in-out, border-bottom-color 200ms ease;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}

.nav-link:hover {
  background-color: var(--light-fg);
}

.nav-link.selected {
  border-bottom-color: var(--main-fg);
}

.nav-icon {
  height: 1.75rem;
  transition: filter 200ms ease-in-out;
}

.nav-icon:hover {
  cursor: pointer;
  filter: brightness(60%);
}

@keyframes to-sun {
  30% {
    opacity: 0;
  }

  80% {
    background-image: url(../images/theme-icons/sun.svg);
  }

  100% {
    background-image: url(../images/theme-icons/sun.svg);
    transform: rotate(360deg);
    opacity: 1;
  }
}

@keyframes to-moon {
  30% {
    opacity: 0;
  }

  80% {
    background-image: url(../images/theme-icons/moon.svg);
  }

  100% {
    background-image: url(../images/theme-icons/moon.svg);
    transform: rotate(-360deg);
    opacity: 1;
  }
}

.theme-icon {
  width: 2rem;
  height: 2rem;
  transition: transform 1s ease-in-out, filter 200ms ease-in-out;
  background-size: cover;
  animation-duration: 1.5s;
  animation-play-state: paused;
  user-select: none;
}

.theme-icon[data-theme="dark"] {
  background-image: url(../images/theme-icons/moon.svg);
  animation-name: to-sun;
}

.theme-icon[data-theme="light"] {
  background-image: url(../images/theme-icons/sun.svg);
  animation-name: to-moon;
}

.hidden { display: none; }

#switch {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#switch img {
  height: 1.75rem;
  transition: filter 200ms ease-in-out;
}

#switch img:hover, .theme-icon:hover {
  cursor: pointer;
  filter: brightness(60%);
}

#nav-toggle {
  display: none;
  position: fixed;
  right: 1.5rem;
  top: 1.5rem;
  height: 2rem;
  z-index: 11;
}

/* ---------- Sections ---------- */

.section {
  background-color: var(--sections-bg);
  min-height: calc(100vh + 4px);
  width: 100%;
  display: grid;
  place-items: center;
  border-bottom: 4px solid var(--light-fg);
  padding: 3rem 0;
}

h2 {
  font-size: 3rem;
  text-align: center;
  font-weight: 800;
}

#projects {
  border: none;
}

.section-content {
  width: 100%;
  max-width: 1000px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 3rem;
}

/* ---------- About me section ---------- */

#me-img {
  border-radius: 50%;
  background-color: var(--nav-bg);
  margin-right: 3rem;
  height: 300px;
}

#about-me .section-text p {
  margin: 2rem 0;
  font-size: 1.2rem;
}

#about-me .section-text h2 {
  text-align: initial;
}

#find-me {
  padding: 0.5rem 0.75rem;
  width: max-content;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--nav-bg);
  border-radius: 5px;
  transition: background-color 200ms ease-in-out;
}

#about-me #find-me p {
  margin: 0;
  font-size: 1rem;
}

#find-me:hover {
  background-color: var(--light-fg);
}

.github-icon {
  height: 2rem;
}

/* ---------- Technologies section ---------- */

#techs { padding-top: 4rem; }

#techs .section-content {
  flex-direction: column;
}

#techs .section-content h2 {
  margin-bottom: 2rem;
}

.tech-section {
  width: 100%;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 2.5rem;
}

.tech-section img {
  height: 6rem;
}

.rounded-icon {
  border-radius: 7px;
}

.light-bg-icon {
  background-color: var(--main-fg);
  padding: 0.4rem;
}

.tech-section figure {
  display: flex;
  align-items: center;
  flex-direction: column;
}

.tech-section figure figcaption {
  margin-top: 0.25rem;
  font-size: 1.2rem;
  opacity: 0;
  transition: opacity 200ms ease-in-out;
}

.tech-section figure:hover figcaption, .tech-section figure:active figcaption {
  opacity: 1;
}

#python-figcaption {
  background: rgb(54,113,162);
  background: linear-gradient(120deg, rgba(54,113,162,1) 20%, rgba(255,215,83,1) 100%); 
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#docker-figcaption { color: #066DA5; }

#html-figcaption, #git-figcaption { color: #F03C2E; }

#css-figcaption { color: #264DE4; }

#js-figcaption { color: #F7DF1E; }

#fastapi-figcaption { color: #05998B; }

#selenium-figcaption { color: #2CB134; }

#react-figcaption { color: #00D8FF; }

/* ---------- Projects section ---------- */

#projects { padding-top: 4rem; }

#projects .section-content {
  flex-direction: column;
}

#projects-slider-container {
  display: flex;
  align-items: center;
  flex-direction: column;
}

#projects-slider-container, #projects-slider, .project, .project-image, .project-description {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 20px;
}

#projects-slider {
  border-radius: 20px;
  border: 2px solid var(--main-fg);
}

#project-title {
  margin-bottom: 2rem;
  width: 95%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.title-icon {
  height: 2.5rem;
  transition: filter 200ms ease-in-out;
  cursor: pointer;
  margin-top: 0.5rem;
}

.title-icon:hover {
  filter: brightness(60%);
}

#prev-project {
  transform: rotate(180deg);
}

.project {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
}

.project-description {
  width: 100%;
  padding: 0 1rem;
  height: inherit;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 0;
  background-color: var(--nav-bg);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  z-index: -1;
  transition: opacity 200ms ease-in-out, z-index 300ms ease-in-out;
}

.project:hover .project-description {
  opacity: 1;
  z-index: 9;
}

.project-description h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.project-link-container {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.project-link-container a { display: flex; }

.project-link-icon {
  height: 2rem;
  transition: filter 200ms ease-in-out;
}

.external-icon { height: 1.9rem }

.project-link-icon:hover {
  filter: brightness(60%);
}

#other-projects {
  margin-top: 2rem;
  text-decoration: underline;
  transition: filter 200ms ease-in-out;
}

#other-projects:hover { filter: brightness(60%); }

/* ---------- Light theme ---------- */

body.light {
  --nav-bg: rgba(194, 194, 194, 0.8);
  --sections-bg: rgba(240, 240, 240, 1);
  --main-fg: rgba(0, 0, 0, 0.9);
  --light-fg: rgba(0, 0, 0, 0.2);
}

body.light .light-bg-icon { background-color: var(--sections-bg); }

body.light #django-figcaption { color: #092E20; }

body.light #find-me { transition: backdrop-filter 200ms ease-in-out; }
body.light #find-me:hover { backdrop-filter: brightness(90%); }

body.light :where(.github-icon, .project-link-icon, .title-icon, #nav-toggle) { filter: invert(1); }
body.light :where(.project-link-icon, .title-icon, #nav-toggle):hover { filter: brightness(40%); }

/* ---------- Media queries ---------- */

@media (max-width: 895px) {
  .section-content {
    width: 90%;
    padding: 0;
  }

  .section-content,
  #about-me .section-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  #me-img {
    height: 250px;
    margin-right: 0;
    margin-bottom: 1rem;
  }
}

@media (max-width: 520px) {
  html {
    font-size: 90%;
  }
  
  #navbar {
    height: 100vh;
    flex-direction: column;
    transition: opacity 200ms ease-in-out, z-index 300ms ease-in-out;
  }

  #links {
    flex-direction: column;
  }
  
  .nav-link {
    border: 3px solid transparent;
    border-radius: 10px;
    transition: border-color 200ms ease;
  }
  
  .nav-link.selected {
    border-color: var(--main-fg);
  }
  
  .theme-icon {
    width: 3rem;
    height: 3rem;
  }

  #switch {
    right: auto;
    bottom: 4rem;
  }

  #switch img {
    height: 2.5rem;
  }

  
  #nav-toggle {
    display: block;
  }
  
  .hidden-nav {
    opacity: 0;
    z-index: -1 !important;
  }

  .tech-section img {
    height: 5rem;
  }
}

@media all and (orientation:portrait) {
  #projects-slider {
    border: none;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  #project-title { justify-content: center; }
  
  .title-icon { display: none; }

  .project > * {
    border-radius: 5px;
  }
}