header.menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  padding-top: 30px;
  padding-bottom: 30px;
  text-align: center;
  background: var(--color-bg);
}

body::before {
  content: "";
  display: block;
  height: 80px; /* 60px header padding + 20px menu-btn height */
  width: 100%;
}

.menu-checkbox {
  display: none;
}

.menu-btn {
  position: relative;
  margin: 0 auto;
  width: 26px;
  height: 20px;
  cursor: pointer;
  display: block;
  z-index: 1001;
}

.menu-btn:before,
.menu-btn:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-text-accent);
  transition: all 0.3s ease 0s;
}

.menu-btn:after {
  top: auto;
  bottom: 0;
}

.menu-btn span {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-text-accent);
  margin-top: -1px;
  transition: all 0.3s ease 0s;
}

header .menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  text-align: center;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease 0s, visibility 0.3s ease 0s;
}

header .menu-overlay ul {
  list-style: none;
  padding: 80px 0 0; /* Top padding to account for header height, bottom padding for spacing */
  margin: 0;
}

header .menu-overlay ul li {
  display: block;
  margin: 2rem 0;
}

header .menu-overlay ul li a {
  text-decoration: none;
  transition: color 0.3s ease, text-decoration 0.3s ease;
  display: inline-block;
  font-weight: normal;
  color: var(--color-text-base);
}

header .menu-overlay ul li a:hover {
  text-decoration: underline;
  font-weight: bold;
  color: var(--color-text-accent);
}

#menu-toggle:checked ~ header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: var(--color-bg);
  z-index: 1000;
}

#menu-toggle:checked ~ header .menu-btn:before {
  opacity: 0;
}

#menu-toggle:checked ~ header::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px; /* Match the body::before height */
  background: var(--color-bg);
  z-index: 1000;
}

#menu-toggle:checked ~ header .menu-btn {
  position: fixed;
  top: 30px; /* Match the header padding-top */
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
}

#menu-toggle:checked ~ header .menu-btn:after {
  top: auto;
  bottom: 9px !important;
  transform: rotate(-45deg);
}

#menu-toggle:checked ~ header .menu-btn span {
  transform: rotate(45deg);
}

#menu-toggle:checked ~ header .menu-overlay {
  opacity: 1;
  visibility: visible;
}
