/* =================================
   RESET AND VARIABLES
================================= */

:root {
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Onest", system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 110px;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--body);
  line-height: 1.6;
}

body.menu-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

img {
  display: block;
  max-width: 100%;
}

/* =================================
   TYPOGRAPHY
================================= */

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;

  font-variation-settings:
    "wdth" 100,
    "opsz" 48;
}

/* =================================
   NAVBAR
================================= */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;

  width: 100%;
  padding: 16px 5%;

  background: transparent;

  transition:
    transform 0.35s ease,
    opacity 0.35s ease;
}

.navbar.nav-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-120%);
}

/* Connected navbar */

.container {
  width: fit-content;
  max-width: calc(100vw - 40px);
  min-height: 58px;
  margin: 0 auto;
  padding: 6px;

  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;

  background: var(--nav-background, rgba(20, 22, 25, 0.9));
  border: 1px solid var(--border);
  border-radius: 100px;
  box-shadow: 0 10px 28px var(--shadow);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  transition:
    width 0.35s ease,
    background-color 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease;
}

/* Navbar groups */

.nav-brand,
.navbar_menu,
.nav-actions {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 100px;
  box-shadow: none;
}

/* =================================
   LOGO
================================= */

.nav-brand {
  padding: 5px;

  display: grid;
  place-items: center;
}

#nav_logo {
  width: 45px;
  height: 45px;

  display: block;
  object-fit: contain;
  border-radius: 50%;

  transition: transform 0.3s ease;
}

#nav_logo:hover {
  transform: scale(1.08) rotate(5deg);
}

/* =================================
   DESKTOP NAVIGATION
================================= */

.navbar_menu {
  padding: 5px 12px;

  display: flex;
  align-items: center;
  justify-self: center;
  gap: 8px;

  list-style: none;
}

.item {
  list-style: none;
}

.nav_link {
  position: relative;

  display: inline-block;
  padding: 12px 11px;

  color: var(--text);
  font-family: var(--body);
  font-size: 0.9rem;
  font-weight: 500;

  transition: color 0.3s ease;
}

.nav_link::after {
  content: "";

  position: absolute;
  right: 11px;
  bottom: 7px;
  left: 11px;

  height: 2px;

  background: var(--accent);
  border-radius: 100px;

  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.nav_link:hover {
  color: var(--accent);
}

.nav_link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* =================================
   CONTACT BUTTON
================================= */

.nav-actions {
  padding: 5px;

  display: flex;
  align-items: center;
}

.nav_button {
  padding: 12px 19px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  background: var(--accent);
  border-radius: 100px;

  color: white;
  font-family: var(--body);
  font-size: 0.85rem;
  font-weight: 500;

  transition:
    background-color 0.3s ease,
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.nav_button:hover {
  background: var(--accent-hover, #b90000);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(255, 32, 32, 0.28);
}

/* =================================
   NAVBAR AFTER SCROLLING
================================= */

.navbar.scrolled .container {
  width: fit-content;
  padding: 0;
  gap: 50px;

  background: transparent;
  border-color: transparent;
  box-shadow: none;

  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.navbar.scrolled .nav-brand,
.navbar.scrolled .navbar_menu,
.navbar.scrolled .nav-actions {
  background: var(--nav-background, rgba(20, 22, 25, 0.9));
  border-color: var(--border);
  box-shadow: 0 8px 22px var(--shadow);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* =================================
   HAMBURGER BUTTON
================================= */

.navbar_toggle {
  width: 44px;
  height: 44px;
  padding: 11px;

  display: none;

  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.navbar_toggle .bar {
  width: 100%;
  height: 2px;
  margin: 5px 0;

  display: block;

  background: currentColor;
  border-radius: 10px;

  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

.navbar_toggle.active .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.navbar_toggle.active .bar:nth-child(2) {
  opacity: 0;
}

.navbar_toggle.active .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* =================================
   SECTION TRANSITIONS
================================= */

.home,
.education-section,
.about,
.projects-section,
.site-footer,
.education-card,
.skill-set {
  border-color: var(--border);

  transition:
    background-color 0.35s ease,
    color 0.35s ease,
    border-color 0.35s ease,
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

/* =================================
   SECTION DIVIDERS
================================= */

.section-divider {
  width: min(1180px, calc(100% - 48px));
  height: 1px;
  margin: 42px auto;

  background: linear-gradient(
    to right,
    transparent,
    var(--border) 20%,
    var(--accent) 50%,
    var(--border) 80%,
    transparent
  );
}

@media (max-width: 600px) {
  .section-divider {
    width: calc(100% - 24px);
    margin: 28px auto;
  }
}

/* =================================
   ACCESSIBILITY
================================= */

.nav-brand:focus-visible,
.nav_link:focus-visible,
.nav_button:focus-visible,
.navbar_toggle:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* =================================
   MOBILE NAVBAR
================================= */

@media (max-width: 925px) {
  .navbar {
    padding: 12px 14px;
  }

  .navbar .container,
  .navbar.scrolled .container {
    width: 100%;
    max-width: 100%;
    min-height: 58px;
    padding: 6px 10px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;

    background: var(--nav-background, rgba(20, 22, 25, 0.9));
    border: 1px solid var(--border);
    border-radius: 100px;
    box-shadow: 0 10px 28px var(--shadow);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .nav-brand {
    padding: 5px;

    display: flex;
    align-items: center;
  }

  .nav-actions {
    display: none;
  }

  .navbar_toggle {
    display: block;
    margin-left: auto;
    flex-shrink: 0;
    z-index: 1100;
  }

  /* Mobile menu */

  .navbar_menu,
  .navbar.scrolled .navbar_menu {
    width: min(320px, calc(100vw - 28px));
    height: auto;
    padding: 18px;

    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;

    position: fixed;
    top: 88px;
    right: -110%;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 18px 38px var(--shadow);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    transition: right 0.35s ease;
  }

  .navbar_menu.active,
  .navbar.scrolled .navbar_menu.active {
    right: 14px;
  }

  .navbar_menu .item {
    width: 100%;
  }

  .nav_link {
    width: 100%;
    padding: 14px 16px;

    border-radius: 10px;
    font-family: var(--body);
    font-size: 1rem;
  }

  .nav_link::after {
    right: 16px;
    left: 16px;
  }

  .nav_link:hover {
    background: var(--card);
  }
}

/* =================================
   SMALL PHONES
================================= */

@media (max-width: 500px) {
  .navbar {
    padding: 10px;
  }

  .navbar .container,
  .navbar.scrolled .container {
    min-height: 54px;
    padding: 5px 8px;
  }

  #nav_logo {
    width: 42px;
    height: 42px;
  }

  .navbar_toggle {
    width: 42px;
    height: 42px;
  }

  .navbar_menu,
  .navbar.scrolled .navbar_menu {
    top: 78px;
    width: calc(100vw - 20px);
  }

  .navbar_menu.active,
  .navbar.scrolled .navbar_menu.active {
    right: 10px;
  }

  h1,
  h2,
  h3 {
    font-variation-settings:
      "wdth" 100,
      "opsz" 40;
  }
}

/* =================================
   REDUCED MOTION
================================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
