/* ==========================================================================
   Header / Navigation - Glassmorphic floating nav
   ========================================================================== */

.header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  width: fit-content;
  font-family: var(--font-body);
  animation: fadeInDown var(--duration-slow) var(--ease-out) both;
  position: relative;
  z-index: 100;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Logo */
.header h1 {
  margin: 0;
  font-size: 1rem;
  line-height: 1;
}

.header .logo {
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  color: #5eb0f7;
  transition: filter var(--duration-normal) var(--ease-out);
  padding-inline: var(--space-xs);
}

.header .logo:hover {
  filter: brightness(1.3);
}

/* Nav buttons */
.header button,
.header .button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: var(--space-xs) var(--space-md);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.header button::before,
.header .button::before {
  display: none;
}

.header button:hover,
.header .button:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  border-color: var(--color-border);
  transform: none;
  box-shadow: none;
}

/* Alignment for header children */
.header button,
.header > h1,
.header input {
  margin: 0;
}

/* Header input */
.header input {
  border-radius: var(--radius-full);
  padding: var(--space-xs) var(--space-md);
  font-size: 0.85rem;
  margin-bottom: 0;
}

/* Dark mode switch in header */
.header .dark-mode-switch {
  margin-inline-start: var(--space-xs);
}

/* Search container */
.search-container {
  height: 100%;
}

/* Dark mode header adjustments */
body.dark-mode .header {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .header button:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Responsive */
@media (max-width: 640px) {
  .header {
    margin: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    gap: var(--space-xs);
  }

  .header .logo {
    font-size: 1rem;
  }

  .header button,
  .header .button {
    font-size: 0.8rem;
    padding: var(--space-xs) var(--space-sm);
  }
}

@media (max-width: 640px) {
  .header {
    max-width: calc(100% - 2 * var(--space-sm));
    flex-wrap: wrap;
  }
}

/* Small phones: tighten spacing so logo, three tabs and the toggle fit on one line */
@media (max-width: 420px) {
  .header {
    gap: 2px;
    padding-inline: var(--space-xs);
  }

  .header button,
  .header .button {
    padding: var(--space-xs) 0.45rem;
  }

  .header .dark-mode-switch {
    margin-inline-start: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .header {
    animation: none;
  }
}