/* Header styles for Learn English Huub */

.leh-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: rgba(246, 249, 252, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.leh-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-3);
  gap: var(--space-4);
}

.leh-header__branding {
  display: flex;
  align-items: center;
}

.leh-header__logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-gray-900);
}

.leh-header__logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong));
  box-shadow: var(--shadow-sm);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.05rem;
}

.leh-header__logo-text {
  display: flex;
  flex-direction: column;
}

.leh-header__logo-name {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.leh-header__logo-tagline {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* Navigation */

.leh-header__nav {
  display: flex;
  align-items: center;
}

.leh-header__nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

.leh-header__nav-link {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-gray-700);
  padding: 0.35rem 0.2rem;
  border-radius: var(--radius-pill);
  position: relative;
}

.leh-header__nav-link::after {
  content: "";
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.15rem;
  height: 2px;
  border-radius: 999px;
  background-color: var(--color-primary-soft);
  transform-origin: center;
  transform: scaleX(0);
  transition: transform var(--transition-normal);
}

.leh-header__nav-link:hover {
  color: var(--color-primary-strong);
}

.leh-header__nav-link:hover::after {
  transform: scaleX(1);
}

.leh-header__nav-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.leh-header__nav-item--highlight .leh-header__nav-link {
  padding-inline: 0.9rem;
}

.leh-header__nav-link--primary {
  border-radius: var(--radius-pill);
  background-color: var(--color-primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.leh-header__nav-link--primary::after {
  display: none;
}

.leh-header__nav-link--primary:hover {
  background-color: var(--color-primary-strong);
  color: #ffffff;
}

/* Mobile toggle */

.leh-header__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid var(--color-gray-200);
  background-color: #ffffff;
  color: var(--color-gray-800);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}

.leh-header__toggle:hover {
  background-color: var(--color-gray-50);
}

.leh-header__toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.leh-header__toggle-icon {
  display: inline-flex;
  flex-direction: column;
  gap: 0.22rem;
}

.leh-header__toggle-bar {
  width: 1.1rem;
  height: 2px;
  border-radius: 999px;
  background-color: var(--color-gray-800);
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

/* Toggle animation when active */

.leh-header__toggle.is-active .leh-header__toggle-bar:nth-child(1) {
  transform: translateY(4px) rotate(45deg);
}

.leh-header__toggle.is-active .leh-header__toggle-bar:nth-child(2) {
  opacity: 0;
}

.leh-header__toggle.is-active .leh-header__toggle-bar:nth-child(3) {
  transform: translateY(-4px) rotate(-45deg);
}

/* Responsive behavior */

@media (max-width: 768px) {
  .leh-header__inner {
    padding-block: var(--space-2);
  }

  .leh-header__logo-tagline {
    display: none;
  }

  .leh-header__nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    background-color: rgba(246, 249, 252, 0.98);
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    transform-origin: top;
    transform: scaleY(1);
  }

  .leh-header__nav-list {
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-3) var(--container-padding-x) var(--space-4);
    gap: var(--space-2);
  }

  .leh-header__nav-link {
    padding-block: 0.6rem;
    padding-inline: 0.3rem;
  }

  .leh-header__nav-item--highlight .leh-header__nav-link {
    text-align: center;
  }

  /* Initially visible for non-JS users, hidden via JS using a class on body */
  body.leh-nav-collapsed .leh-header__nav {
    display: none;
  }

  body.leh-nav-open .leh-header__nav {
    display: block;
  }

  .leh-header__toggle {
    display: inline-flex;
  }
}

@media (min-width: 769px) {
  .leh-header__toggle {
    display: none;
  }

  .leh-header__nav {
    position: static;
  }
}
