.header {
  background: var(--color-bg-headerfooter);
  color: var(--color-text-second);
  position: sticky;
  padding-top: 10px;
  z-index: 100;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu {
  display: flex;
  align-items: center;
  font-size: 20px;
  z-index: 1000;
  gap: 1.5rem;
}

.menu img {
  width: 80px;
}

.menu a {
  font-family: var(--font-main);
  font-weight: 500;
}

.menu a:hover {
  color: var(--color-accent);
}

.auth-slot {
  z-index: 2;
}

#authSlot .guest-only {
  display: inline-flex;
  gap: 0.5rem;
}

#authSlot .user-only {
  display: none;
}

body.is-auth #authSlot .guest-only {
  display: none;
}

body.is-auth #authSlot .user-only {
  display: flex;
}

.user-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ellipse-user-btn {
  width: 50px;
  height: 50px;
  background-color: var(--color-accent);
  border: 2px solid var(--color-accent);
  display: grid;
  place-items: center;
  border-radius: 50%;
  z-index: 2;
  cursor: pointer;
  padding: 0;
  outline: none;
  margin-right: 40px;
}

.ellipse-user-btn:hover {
  background-color: var(--color-accent-second);
  border: 2px solid var(--color-accent-second);
}

.ellipse-user-btn img {
  width: 24px;
  height: auto;
}

.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 180px;
  background-color: var(--color-bg-headerfooter);
  color: var(--color-bg);
  border: 1px solid var(--color-accent);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 3;
}

.user-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 19px;
  width: 10px;
  height: 10px;
  background: var(--color-bg-headerfooter);
  border-top: 1px solid var(--color-accent);
  border-right: 1px solid var(--color-accent);
  transform: rotate(-45deg);
  pointer-events: none;
}

.user-btn.open .user-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.user-menu-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.user-menu-item:hover {
  background-color: var(--color-accent);
  color: var(--color-bg);
  outline: none;
}

.user-menu-item:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  background: transparent;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hamburger {
  display: none;
  background: transparent;
  border: 0;
  padding: 0.5rem;
  border-radius: 0.75rem;
  cursor: pointer;
  line-height: 0;
  color: inherit;
  z-index: 1001;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 82vw;
  max-width: 380px;
  background: var(--color-bg-headerfooter);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  z-index: 9999;
  display: grid;
  grid-template-rows: auto 1fr;
  isolation: isolate;
}

.mobile-drawer::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.28s ease;
  z-index: 0;
}

.mobile-drawer > * {
  position: relative;
  z-index: 1;
}

.mobile-drawer .drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.75rem 1.25rem;
  border-bottom: 1px solid #eee;
}

.mobile-drawer .drawer-body {
  padding: 1rem 1.25rem;
  overflow: auto;
  display: grid;
  grid-auto-rows: min-content;
  gap: 0.75rem;
}

.mobile-drawer .drawer-nav a {
  display: block;
  padding: 0.75rem 0;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--color-text-second);
  border-bottom: 1px dashed #eee;
}

.mobile-drawer .drawer-nav a:last-child {
  border-bottom: 0;
}

.mobile-drawer .drawer-sep {
  height: 1px;
  background: #eee;
  margin: 0.5rem 0 1rem;
  display: none;
}

.mobile-drawer .drawer-auth {
  display: grid;
  gap: 0.75rem;
}

.mobile-drawer .drawer-auth .guest-only {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.mobile-drawer .drawer-user-block {
  display: grid;
  gap: 0.5rem;
}

.mobile-drawer .drawer-user-block .ellipse-user-btn {
  width: 60px;
  height: 60px;
  justify-self: center;
}

.mobile-drawer .drawer-user-links {
  display: flex;
  flex-direction: column;
  color: var(--color-bg);
}

.mobile-drawer .drawer-user-links .user-menu-item {
  display: block;
  padding: 0.75rem 0;
  text-align: left;
}

.mobile-drawer .close-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--color-text-second, #222);
}

.mobile-drawer .close-btn svg {
  display: block;
}

.mobile-drawer .close-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.mobile-drawer.is-open {
  transform: translateX(0);
}

.mobile-drawer.is-open::before {
  opacity: 1;
}

@media (max-width: 1023px) {
  .hamburger {
    display: inline-flex;
    align-items: center;
  }
  .menu {
    gap: 1rem;
  }
  .menu a {
    display: none;
  }
  .auth-slot {
    display: none;
  }
}
