:root {
  /*
    === BREAKPOINTS (Reference only) ===
    Mobile: width < 32em
    Tablet/Laptop: width >= 32em
    Desktop: width >= 64em
  */

  /* === COLORS === */
  --text-color: white;
  --background-color: #3C3C3C;
  --primary-color: #252526;
  --secondary-color: #4F4F4F;
  --tertiary-color: #363636;
  --hover-color: paleturquoise;

  /*
    === TYPOGRAPHY SCALE (Fluid via Utopia.fyi) ===
    --step-n2: Chevron-down icon size.
    --step-n1: Small text (nav texts / projects texts).
    --step-1: Big text (nav page logo).
    --step-icon: Icon sizing.
  */
  --step-n2: clamp(0.7813rem, 0.7297rem + 0.1717vw, 0.88rem);
  --step-n1: clamp(0.9375rem, 0.8527rem + 0.2826vw, 1.1rem);
  --step-0: clamp(1.125rem, 0.9946rem + 0.4348vw, 1.375rem);
  --step-1: clamp(1.35rem, 1.1576rem + 0.6413vw, 1.7188rem);
  --step-2: clamp(1.62rem, 1.3443rem + 0.919vw, 2.1484rem);
  --step-3: clamp(1.944rem, 1.5571rem + 1.2896vw, 2.6855rem);
  --step-4: clamp(2.3328rem, 1.7985rem + 1.7811vw, 3.3569rem);
  --step-5: clamp(2.7994rem, 2.0706rem + 2.4292vw, 4.1962rem);
  --step-icon: clamp(1.125rem, 1.3152rem + -0.2174vw, 1.25rem);

  /* --- SPACING & UI --- */
  --nav-padding-mobile: 1.5625rem;
  --nav-padding-fluid: clamp(0.9375rem, -0.9926rem + 6.4338vw, 3.125rem);
  --nav-height: 5rem;
}

/* Global: general. */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.resize-animation-stopper * {
  transition: none !important;
  animation: none !important;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: Poppins, sans-serif;
  color: var(--text-color);
  overflow-x: hidden;
  position: relative;
  background-color: var(--background-color);
  width: 100%;
  transition: color 0.2s ease, background-color 0.2s ease;
}

body.light-mode {
  --text-color: black;
  --background-color: white;
  --primary-color: paleturquoise;
  --secondary-color: azure;
  --tertiary-color: lightcyan;
  --hover-color: #00CED1;
}

main {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0 auto;
}

main section {
  width: 100%;
  min-height: 32rem;
  padding: 0 var(--nav-padding-mobile);
}

/* Global: Customzie scrollbar. */
.y-scrollable::-webkit-scrollbar {
  width: 8px;
  background: transparent;
}

.y-scrollable::-webkit-scrollbar-thumb {
  background: rgb(0 0 0 / 20%);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.y-scrollable::-webkit-scrollbar-thumb:hover {
  background: rgb(0 0 0 / 40%);
}

.y-scrollable::-webkit-scrollbar-button {
  display: none;
}

/* Global: nav bar. */
header {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  background-color: transparent;
  position: absolute;
  top: 0;
  z-index: 1000;
}

header.slidedown {
  background-color: var(--primary-color);
  position: fixed;
  animation: slidedown .4s forwards;
}

/* Animation starting from -100% of the nav bar to 0. */
@keyframes slidedown {
  from {
    transform: translateY(-100%);
  }
  
  to {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgb(0 0 0 / 20%);
  }
}

nav {
  display: flex;
  max-width: 90em;
  width: 100%;
  align-items: center;
  height: var(--nav-height);
  padding: 0 var(--nav-padding-mobile);
  margin: 0 auto;
  position: relative;
}

nav li {
  display: flex;
  width: 100%;
  justify-content: center;
}

nav a {
  display: flex;
  text-decoration: none;
  color: var(--text-color);
  transition: background-color 0.2s ease;
}

nav button {
  color: var(--text-color);
  background: none;
  border: none;
  cursor: pointer;
}

.hero-li {
  margin-right: auto;
  transition: margin 0.2s ease;
}

.hero-li a {
  font-size: var(--step-1);
  font-weight: 600;
}

.nav-item {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  transition: color 0.2s ease;
}

.nav-item:focus-visible {
  color: var(--hover-color);
}

.nav-item i {
  font-size: var(--step-icon);
}

.nav-item span {
  font-size: var(--step-n1);
  font-weight: 400;
  display: inline-block;
}

.nav-divider {
  width: 1px;
  height: var(--step-1);
  background-color: var(--text-color);
  opacity: 0.15;
  margin-left: 1.5rem;
  margin-right: 0.5rem;
  display: none;
  vertical-align: middle;
}

.nav-item.nav-cta {
  color: var(--text-color);
  background-color: transparent;
  padding: 0;
  border-radius: 0;
}

.projects-container {
  position: relative;  /* https://i.ytimg.com/vi/F0ifZxhlTUI/maxresdefault.jpg */
  display: flex;
  flex-direction: column;
}

.projects-list a {
  background-color: var(--secondary-color);
  min-height: 44px;
  display: flex;            /* Display each link vertically. */
  justify-content: center;  /* Horizontally align. */
  align-items: center;      /* Vertically align. */
  margin: 0;
  font-size: var(--step-n1);
  font-weight: 400;
  width: 100%;
  padding: 0.5rem 1rem;
}

/* Mobile: nav sidebar toggle. */
.sidebar-btn {
  display: inline-block;
  min-height: 44px;
  min-width: 44px;
  margin-left: auto;
  position: relative;  /* Enables icon stacking. */
  transition: color 0.2s ease;
}

.sidebar-btn i {
  color: var(--text-color);
  font-size: var(--step-icon);
  position: absolute;  /* Stack icons. */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);  /* Center the icons. */
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar-btn:focus-visible i {
  color: var(--hover-color);
}

.nav-hamburger {
  opacity: 1;
}

.nav-close {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-90deg);
}

.sidebar-btn.show .nav-hamburger {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg);
}

.sidebar-btn.show .nav-close {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg);
}

.nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  flex-direction: column;
  width: 100%;
  height: calc(100dvh - var(--nav-height));
  position: absolute;
  right: -100%;
  top: var(--nav-height);
  z-index: 10;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: right 0.3s ease-in-out;
  background-color: var(--tertiary-color);
}

.nav-list.show {
  right: 0;
}

/* Global: Projects dropdown icon. */
.projects-btn .dropdown-icons {
  display: flex;
  position: relative;
  justify-content: center;
  align-items: center;
}

.projects-btn .dropdown-icons i {
  font-size: var(--step-n2);
  transition: opacity 0.4s ease;
}

.dropdown-icon-up {
  opacity: 0;
}

.dropdown-icon-down {
  position: absolute;
  left: 0;
  opacity: 1;
}

.projects-btn[aria-expanded="true"] .dropdown-icon-up {
  opacity: 1;
}

.projects-btn[aria-expanded="true"] .dropdown-icon-down {
  opacity: 0;
}

/* Global: focus. */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--text-color);
  outline-offset: 4px;
  border-radius: 4px;
}

.projects-list a:focus-visible {
  outline: none;
  color: var(--background-color);
  background-color: var(--hover-color);
}

/* Mobile: general. */
body.no-scroll {
  overflow: hidden;
  height: 100dvh;
}

/* Global: Theme button. */
.theme-btn {
  display: flex;
  justify-content: center;
  align-items: center;
}

.theme-btn .fa-sun {
  color: #eeda68;
}

.theme-btn .fa-moon {
  position: absolute;
  color: mediumslateblue;
  opacity: 0;
}

.theme-btn[aria-pressed="true"] .fa-sun {
  opacity: 0;
}

.theme-btn[aria-pressed="true"] .fa-moon {
  opacity: 1;
}


/* Mobile: projects menu. */
.projects-list {
  display: flex;
  flex-direction: column;
  position: static;
  top: auto;
  left: auto;
  z-index: 10;
  width: 100%;
  max-height: 0;
  pointer-events: none;
  overflow-y: hidden;
  transition: max-height 0.4s ease-in-out, color 0.2s ease;
}

/* Mobile: Right side buttons (menu/theme). */
.nav-right-btns {
  display: flex;
}

/* Global: tap/click to expand. */
.projects-list.show {
  max-height: 60vh;
  pointer-events: auto;
  color: var(--hover-color);
}

/* Global: Light mode settings. */
body.light-mode .nav-divider {
  background-color: var(--text-color);
  opacity: 0.2;
}

/* SECTION 1: Hero */
.hero {
  width: 100%;
  height: 100svh;
  background: linear-gradient(135deg,
      black 0%,
      var(--background-color) 100%);
}

.hero-container {
  max-width: 90em;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: var(--nav-height) auto;
  gap: 1rem;
}

.hero .headshot {
  flex: 1 1 16rem;
  max-width: 24rem;
  margin: auto;
}

.hero .headshot img {
  max-width: 24rem;
  width: 100%;
  height: auto;
  display: block;
}

.hero .text {
  flex: 1 1 16rem;
}

.hero .links {
  display: flex;
  margin-top: 0.5rem;
  gap: 1rem;
}

.hero .links a {
  text-decoration: none;
  color: var(--text-color);
  border: 2px solid var(--text-color);
  border-radius: 0.5rem;
  padding: 0.15em 0.25em;
}

/* Mobile: tap effects. */
@media (pointer: coarse) {
  .nav-item:active {
    color: var(--hover-color);
  }

  .sidebar-btn:active i {
    color: var(--hover-color);
  }

  .projects-list a:active {
    color: var(--hover-color);
  }
}

/* PC / Mouse: Hover and expand effects. */
@media (hover: hover) and (pointer: fine) {
  .projects-container:hover .projects-list {
    max-height: 60vh;
    pointer-events: auto;
  }

  .nav-item:not(.nav-cta, .theme-btn):hover {
    color: var(--hover-color);

    /* Add hover background color for mobile-size screens. */
    background-color: var(--background-color);
  }

  .nav-item.nav-cta:hover {
    color: var(--background-color);
    background-color: var(--hover-color);
  }

  .sidebar-btn:hover i {
    color: var(--hover-color);
  }

  .projects-list a:hover {
    color: var(--background-color);
    background-color: var(--hover-color);
  }

  .projects-btn:hover .dropdown-icon-up {
    opacity: 1;
  }

  .projects-btn:hover .dropdown-icon-down {
    opacity: 0;
  }
}

/* Format: Tablet / Laptops. */
@media screen and (width >= 32em) {
  body.no-scroll {
    overflow: visible;
    height: auto;
  }

  main section {
    padding: 0 var(--nav-padding-fluid);
  }

  nav {
    padding: 0 var(--nav-padding-fluid);
  }

  .nav-list {
    position: static;
    flex-direction: row;
    width: auto;
    height: auto;
    right: 0;
    overflow-y: visible;
    gap: 0.8em;
    background-color: transparent;
  }

  nav li {
    width: auto;
  }

  .nav-item {
    width: auto;
  }
  
  .nav-item:not(.nav-cta, .theme-btn):hover {
    /* Remove hover background color for non-mobile sized screens. */
    background-color: transparent;
  }

  .nav-item span {
    display: none;
  }

  .nav-divider {
    display: inline-block;
    align-self: center;
  }

  .projects-list {
    width: 10em;
    position: absolute;
    top: 100%;
    left: 0;
  }

  .sidebar-btn {
    display: none;
  }

  /* SECTION 1: Hero */
  .hero-container {
    flex-flow: wrap;
    flex-direction: row;
    gap: 2rem;
    justify-content: space-between;
  }
}

/* Format: Desktops. */
@media screen and (width >= 64em) {
  .nav-list {
    gap: 1.25em;
  }

  .nav-item span {
    display: inline-block;
  }

  .nav-item.nav-cta {
    color: var(--background-color);
    background-color: var(--text-color);
    padding: 0.3125rem 0.9375rem;
    border-radius: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  .nav-item.nav-cta:focus-visible {
    outline: none;
    color: var(--background-color);
    background-color: var(--hover-color);
  }
}
