/* Shared navigation — load after the page stylesheet */

@keyframes nav-logo-spin {
  0% { transform: rotate(0deg); }
  16% { transform: rotate(180deg); }
  50% { transform: rotate(360deg); }
  100% { transform: rotate(360deg); }
}

.nav {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 1320px);
  min-height: 72px;
  height: auto;
  background-color: rgba(255, 255, 255, 0.7);
  border: 1px solid transparent;
  border-radius: 10px;
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2), 0 10px 20px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 18px;
  box-sizing: border-box;
}

.nav > a {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.nav img {
  display: block;
  height: 64px;
  width: auto;
  max-height: 72px;
  margin: 0;
}

.nav .logo {
  filter: blur(0);
  animation-name: nav-logo-spin;
  animation-duration: 4s;
}

.nav .logo:hover {
  filter: blur(1px);
}

.nav ul.nav-list {
  list-style: none;
  margin: 0;
  margin-left: auto;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: clamp(12px, 2.5vw, 40px);
  font-size: clamp(0.92rem, 1.7vw, 1.45rem);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-list a {
  text-decoration: none;
  color: rgb(85, 85, 85);
  font-weight: 500;
  font-family: Georgia, "Times New Roman", Times, serif;
}

.nav-list a:hover {
  color: black;
}

.nav .login {
  margin-left: 0;
}

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  margin-left: auto;
  padding: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.nav-toggle:focus-visible {
  outline: 2px solid #f39c12;
  outline-offset: 2px;
}

.nav-toggle-bar {
  display: block;
  width: 26px;
  height: 3px;
  background: #444;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav.nav-open .nav-toggle .nav-toggle-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.nav.nav-open .nav-toggle .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav.nav-open .nav-toggle .nav-toggle-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Logged-in area */
.user-menu {
  position: relative;
  margin-left: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.user-menu img {
  max-height: 44px;
  width: auto;
  vertical-align: middle;
}

.username {
  color: rgb(0, 0, 0);
  font-weight: 500;
  font-family: Georgia, "Times New Roman", Times, serif;
  text-decoration: none;
}

.dropdown-menu {
  display: none;
  position: absolute;
  background-color: #f39c12;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  padding: 10px;
  top: 100%;
  margin-top: 8px;
  right: 0;
  z-index: 1001;
  min-width: 160px;
}

.dropdown-menu a {
  display: block;
  text-decoration: none;
  color: white;
  font-weight: 500;
  font-family: Georgia, "Times New Roman", Times, serif;
  padding: 5px 10px;
}

.dropdown-menu a:hover {
  background-color: rgba(0, 0, 0, 0.1);
  color: black;
}

.user-menu:hover .dropdown-menu,
.user-menu:focus-within .dropdown-menu {
  display: block;
}

@media (max-width: 992px) {
  .nav ul.nav-list {
    gap: clamp(10px, 2vw, 24px);
    font-size: clamp(0.85rem, 2.4vw, 1.15rem);
  }
}

@media (max-width: 768px) {
  .nav > a:first-of-type {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
  }

  .nav-toggle {
    display: flex;
  }

  .nav ul.nav-list {
    display: none;
    width: 100%;
    flex: 1 1 100%;
    flex-direction: column;
    align-items: center;
    margin-left: 0;
    padding: 14px 0 10px;
    gap: 16px;
  }

  .nav.nav-open ul.nav-list {
    display: flex;
  }

  .dropdown-menu {
    position: static;
    margin-top: 8px;
    transform: none;
    left: auto;
    right: auto;
  }

  .user-menu {
    flex-direction: column;
  }

  .user-menu:hover .dropdown-menu,
  .user-menu:focus-within .dropdown-menu {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
}

@media (min-width: 769px) {
  .nav-toggle {
    display: none !important;
  }

  .nav ul.nav-list {
    display: flex !important;
  }

  /* Logo left; links grouped in the horizontal center of the bar */
  .nav {
    justify-content: center;
  }

  .nav > a:first-of-type {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
  }

  .nav ul.nav-list {
    margin-left: 0;
    justify-content: center;
  }
}
