@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Archivo:ital,wght@0,100..900;1,100..900&display=swap');

:root {
  --bg: hsl(210, 60%, 5%);
  --shadow: hsl(210, 20%, 30%);
  --text: hsl(0, 0%, 90%);
  --text-muted: hsl(0, 0%, 45%);
  --accent: hsl(60, 80%, 60%);
}

*,
*::before,
*::after {
  box-sizing: border-box;

  &:focus-visible {
    outline: 1px dashed var(--accent);
    outline-offset: 4px;
  }

  &::selection {
    background-color: var(--text);
    color: var(--bg);
  }
}

html {
  font-size: 1.25rem;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Archivo', sans-serif;

  &.loading,
  &.nav-drawer-open,
  &.theme-drawer-open {
    overflow-y: hidden;
  }
}

h1,
h2,
h3 {
  font-family: 'Archivo Black', sans-serif;
  margin: 0;
}

p {
  margin: 0;
  max-width: 65ch;
  text-wrap: balance;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  transition: color 0.3s ease-out;

  &::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -0.25rem;
    height: calc(100% + 0.5rem);
    width: 0;
    background-color: var(--accent);
    z-index: -1;
    transition: left 0.3s ease-out, width 0.3s ease-out;
  }

  body:not(.touch) &:hover {
    color: var(--bg);
  }

  body:not(.touch) &:hover::before {
    left: -0.25rem;
    width: calc(100% + 0.5rem);
  }
}

button {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Archivo', sans-serif;
  font-size: 0.9375rem;
  border: 1px solid var(--accent);
  background-color: transparent;
  color: var(--accent);
  border-radius: 100vmax;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease-out, color 0.3s ease-out;

  body:not(.touch) &:hover {
    background-color: var(--accent);
    color: var(--bg);
  }

  &:focus-visible {
    outline: none;
    background-color: var(--accent);
    color: var(--bg);
  }
}

a,
button,
label {
  -webkit-tap-highlight-color: transparent;
}

img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

noscript {
  position: fixed;
  inset: 0;
  padding: 1rem;
  display: grid;
  place-items: center;
  background-color: hsl(210, 60%, 5%);
  color: hsl(0, 0%, 90%);
  text-align: center;
  z-index: 200;
}

.loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background-color: hsl(210, 60%, 5%);
  z-index: 150;
  transition: opacity 0.6s 0.45s;

  img {
    transition: opacity 0.6s, transform 0.45s;
  }

  body:not(.loading) & {
    pointer-events: none;
    opacity: 0;

    img {
      opacity: 0;
      transform: scale(0.9);
    }
  }
}

nav {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: var(--bg);
  z-index: 100;
  transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;

  &.nav-hidden {
    transform: translateY(-125%);
  }

  &.nav-shadow {
    box-shadow: 0 0 16px var(--shadow);
  }
}

.nav-container {
  display: flex;
  gap: 2rem;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto;
  padding: 1rem;
  max-width: 1024px;

  @media (min-width: 640px) {
    padding: 1rem 2rem;
  }
}

.brand {
  font-size: 1.25rem;
  font-weight: bold;

  &::before {
    content: none;
  }

  body:not(.touch) &:hover {
    color: var(--accent);
  }
}

.nav-links {
  display: none;
  align-items: center;
  margin: 0;
  padding: 0;

  @media (min-width: 640px) {
    display: flex;
    gap: 1rem;
  }

  a {
    color: var(--text);
  }
}

.nav-menu,
.nav-close,
.theme-close {
  border: none;
  color: var(--accent);
  padding: 0;
  font-size: 1.25rem;
  aspect-ratio: 1 / 1;

  body:not(.touch) &:hover,
  &:focus-visible {
    background-color: var(--bg);
    color: var(--accent);
  }

  &:focus-visible {
    outline: 1px dashed var(--accent);
    border-radius: unset;
  }
}

.nav-menu {
  @media (min-width: 640px) {
    display: none;
  }
}

.nav-drawer,
.theme-drawer {
  --drawer-width: min(320px, 75vw);

  position: fixed;
  bottom: 0;
  right: calc(var(--drawer-width) * -1.25);
  width: var(--drawer-width);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  box-shadow: 0 0 16px var(--shadow);
  z-index: 110;
  transition: right 0.3s ease-out;
}

.nav-drawer {
  @media (min-width: 640px) {
    display: none;
  }

  body.nav-drawer-open & {
    right: 0;
  }
}

.theme-drawer {
  body.theme-drawer-open & {
    right: 0;
  }
}

.nav-close-container,
.theme-close-container {
  display: flex;
  align-self: flex-end;
  padding: 1rem;
}

.nav-drawer-links,
.themes {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-grow: 1;
  padding: 2rem;
}

.theme {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;

  .theme-label {
    cursor: pointer;
    position: relative;

    &::before {
      content: '';
      position: absolute;
      left: -0.25rem;
      top: -0.25rem;
      height: calc(100% + 0.5rem);
      width: calc(100% + 0.5rem);
      background-color: var(--accent);
      z-index: -1;
      opacity: 0;
      transition: opacity 0.3s ease-out;
    }

    body:not(.touch) &:hover::before {
      opacity: 1;
    }

    input {
      position: absolute;
      opacity: 0;
      margin: 0;

      &:checked ~ .theme-img::before,
      &:checked ~ .theme-img::after {
        display: block;
      }

      &:focus-visible ~ .theme-img {
        outline: 1px dashed var(--accent);
        outline-offset: 4px;
      }
    }

    .theme-img {
      display: grid;
      grid-template-columns: 3fr 1fr;
      border: 1px solid var(--bg);
      box-shadow: 0 0 0 1px var(--text-muted);
      position: relative;

      &::before,
      &::after {
        font-family: Phosphor;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        color: var(--accent);
        pointer-events: none;
        display: none;
      }

      &::before {
        content: '\E13A';
        left: -1.5rem;
      }

      &::after {
        content: '\E138';
        right: -1.5rem;
      }

      span {
        height: 2rem;
        min-width: 1rem;
      }
    }
  }

  .theme-name {
    font-size: 0.85rem;
    color: var(--text-muted);
  }
}

.overlay {
  position: fixed;
  inset: 0;
  backdrop-filter: blur(8px) brightness(0.5);
  pointer-events: none;
  z-index: 105;
  opacity: 0;
  transition: opacity 0.3s ease-out;

  body.nav-drawer-open &,
  body.theme-drawer-open & {
    opacity: 1;
    pointer-events: all;
  }
}

main section {
  margin: 0 auto;
  padding-block: 1rem;
  max-width: 1024px;
  display: flex;
  align-items: center;
  position: relative;

  &::after {
    font-family: Phosphor;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    color: var(--accent);
    opacity: 0.25;
  }
}

.section-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
  padding-block: 5rem;
  padding-inline: 1rem;
  width: 100%;
  overflow-x: hidden;

  @media (min-width: 640px) {
    padding-inline: 2rem;
  }

  h3 {
    padding-left: 1.35rem;
    position: relative;

    &::before {
      font-family: Phosphor;
      position: absolute;
      content: '\E03C';
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      color: var(--accent);
      font-size: 75%;
      width: 1rem;
    }
  }
}

.hero {
  justify-content: flex-start;
  height: 100dvh;

  &::after {
    content: '\E1F2';
  }
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;

  h2 {
    font-family: 'Archivo', sans-serif;
  }

  p {
    color: var(--text-muted);
  }
}

.about {
  justify-content: flex-start;

  &::after {
    content: '\E1F8';
  }
}

.about-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2rem;

  @media (min-width: 768px) {
    flex-direction: row;
  }

  .about-text {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    color: var(--text-muted);
  }

  .highlight {
    color: var(--text);
  }

  .about-picture {
    display: flex;
    justify-content: center;
    max-width: 300px;
    margin: 0 auto;
  }

  img {
    border-radius: 1rem;
    width: 80%;

    @media (min-width: 640px) {
      width: 100%;
    }
  }
}

.skills {
  justify-content: stretch;

  &::after {
    content: '\E1F6';
  }
}

.skills-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;

  .primary-skills {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1rem;

    @media (min-width: 412px) {
      grid-template-columns: repeat(2, 1fr);
    }

    @media (min-width: 640px) {
      grid-template-columns: repeat(3, 1fr);
    }
  }

  .skill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
    border: 1px solid var(--text-muted);
    border-radius: 0.5rem;
    max-width: 180px;
    aspect-ratio: 2 / 3;
    transition: border 0.3s ease-out;
    overflow: hidden;
    position: relative;

    &::before {
      content: '';
      position: absolute;
      inset: 0;
      z-index: -1;
      background-size: 1rem 1rem;
      background-position: center;
      background-image: radial-gradient(circle, var(--text-muted) 2px, transparent 1px);
      opacity: 0;
      scale: 1.25;
      transition: opacity 0.3s ease-out, scale 0.3s ease-out;
    }

    .skill-logo {
      display: grid;
      place-items: center;
      background-color: #fcfcfc;
      border-radius: 0.25rem;
      aspect-ratio: 1 / 1;

      img {
        width: 65%;
        aspect-ratio: 1 / 1;
      }
    }

    span {
      padding-bottom: 1rem;
    }

    body:not(.touch) &:hover {
      border-color: var(--text);

      &::before {
        opacity: 0.5;
        scale: 1;
      }
    }

    @media (min-width: 412px) {
      max-width: 240px;
    }
  }

  .secondary-skills-container {
    overflow: hidden;
    opacity: 0;
    max-height: 0;
    transition: opacity 0.3s ease-out, max-height 0.3s ease-out;

    &.secondary-skills-shown {
      opacity: 1;

      ~ .toggle-secondary-skills i {
        rotate: 180deg;
      }
    }
  }

  .secondary-skills {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1rem;

    @media (min-width: 640px) {
      grid-template-columns: repeat(2, 1fr);
    }

    span {
      border: 1px solid var(--text-muted);
      border-radius: 0.5rem;
      padding: 0.75rem 1.25rem;
      text-align: center;
    }
  }

  .toggle-secondary-skills {
    margin-top: 2rem;

    i {
      transition: rotate 0.3s ease-out;
    }
  }
}

.projects {
  justify-content: flex-start;

  &::after {
    content: '\E1F0';
  }
}

.projects-content {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1rem;

  @media (min-width: 640px) {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 1fr;
  }

  .project {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid var(--text-muted);
    border-radius: 0.5rem;
    padding: 1rem;
    overflow: hidden;

    img {
      width: 100%;
      aspect-ratio: 4 / 3;
      object-fit: cover;
      border-radius: 0.25rem;
      filter: saturate(1.25);
    }

    .project-info {
      display: flex;
      flex-direction: column;
      gap: 1rem;

      .project-title {
        font-weight: bold;
      }

      .project-description {
        color: var(--text-muted);
      }
    }

    .project-links {
      display: flex;
      gap: 1rem;
    }
  }
}

.links {
  justify-content: center;
}

.links-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin: 0 auto;
}
