/* Header and Navigation */
header {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  padding: 1.5rem 0;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark-mode header {
  background: linear-gradient(
    135deg,
    #1e2127,
    #282c34
  );
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.header-name {
  position: absolute;
  left: 2rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bg-white);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

body.dark-mode .header-name,
html.dark-mode-init body .header-name {
  color: #ffffff;
}

.header-name.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Hamburger Menu */
.hamburger {
  display: none;
  position: absolute;
  left: 1rem;
  flex-direction: column;
  justify-content: space-around;
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 101;
}

.hamburger span {
  width: 2rem;
  height: 0.25rem;
  background: var(--bg-white);
  border-radius: 10px;
  transition: all 0.3s linear;
  position: relative;
  transform-origin: 1px;
}

body.dark-mode .hamburger span {
  background: #ffffff;
}

.hamburger:focus {
  outline: none;
}

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

/* Mobile Overlay */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 98;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile Navigation */
.mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: linear-gradient(
    180deg,
    var(--primary-color),
    var(--secondary-color)
  );
  z-index: 99;
  padding: 5rem 1.5rem 2rem;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  transition: left 0.3s ease;
  overflow-y: auto;
}

.mobile-nav.open {
  left: 0;
}

body.dark-mode .mobile-nav {
  background: linear-gradient(
    180deg,
    #1e2127,
    #282c34
  );
}

.mobile-nav-item {
  display: block;
  width: 100%;
  padding: 1rem 1.5rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  color: var(--bg-white);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(5px);
}

.mobile-nav-item:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Desktop Navigation */
nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  gap: 2rem;
  justify-content: center;
}

nav button {
  color: var(--bg-white);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
}

body.dark-mode nav button,
html.dark-mode-init body nav button {
  color: #ffffff;
}

nav button::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--accent-color);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

nav button:hover::after {
  width: 80%;
}

nav button:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

nav button:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
  position: absolute;
  right: 2rem;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.dark-mode-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.dark-mode-toggle:active {
  transform: scale(0.95) rotate(15deg);
}

.dark-mode-toggle:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
}

.dark-mode-toggle img {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
  transition: all 0.3s ease;
}

.dark-mode-toggle .sun-icon {
  position: absolute;
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.dark-mode-toggle .moon-icon {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

body.dark-mode .dark-mode-toggle .sun-icon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

body.dark-mode .dark-mode-toggle .moon-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

body.dark-mode .dark-mode-toggle {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .dark-mode-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}
