/**
 * Header — logo (esquerda), links (direita); mobile: hamburger
 * Sem scroll: bg gradiente (preto → transparente). Com scroll: preto 80% + blur.
 */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 0;
  background: linear-gradient(to bottom, rgba(10, 10, 10, 1) 0%, rgba(10, 10, 10, 0) 100%);
  backdrop-filter: none;
  border-bottom: none;
  transition: background 0.35s ease, backdrop-filter 0.35s ease;
}

.header.is-scrolled {
  background: rgba(10, 10, 10, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(var(--primary-rgb), 0.25);
}

.header__inner {
  width: min(calc(100% - (var(--container-gutter) * 2)), var(--container-max));
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Links à direita */
.header__nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.header__nav-close,
.header__nav-footer {
  display: none;
}

.header__list {
  display: flex;
  align-items: center;
  gap: 6px 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.header__link {
  display: inline-block;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  border-radius: 999px;
  transition: color 0.25s ease, background 0.25s ease;
}

.header__link:hover {
  color: var(--light);
  background: rgba(var(--primary-rgb), 0.08);
}

.header__link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Logo à esquerda — maior sem scroll, menor ao scrollar */
.header__logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.header__logo-image {
  display: block;
  width: auto;
  height: 42px;
  object-fit: contain;
  transition: height 0.35s ease;
}

.header__logo:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.header.is-scrolled .header__logo-image {
  height: 34px;
}

/* Botão hamburger — só no mobile */
.header__hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  border-radius: 12px;
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--primary);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.header__hamburger:hover {
  background: rgba(var(--primary-rgb), 0.15);
  border-color: rgba(var(--primary-rgb), 0.5);
}

.header__hamburger[aria-expanded="true"] .header__hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.header__hamburger[aria-expanded="true"] .header__hamburger-bar:nth-child(2) {
  opacity: 0;
}

.header__hamburger[aria-expanded="true"] .header__hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.header__hamburger-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 24px;
  height: 20px;
}

.header__hamburger-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

/* Mobile */
@media (max-width: 768px) {
  .header__hamburger {
    display: flex;
  }

  .header .header__nav {
    display: none;
  }

  .header__inner {
    position: relative;
  }

  .header__logo {
    margin-right: auto;
  }

  /* Menu mobile abre de cima, abaixo do header */
  .header__nav-panel {
    position: fixed;
    top: var(--header-height, 80px);
    left: 0;
    right: 0;
    width: 100%;
    max-height: 0;
    padding: 0;
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.96) 0%, rgba(10, 10, 10, 0.96) 100%);
    border-top: 1px solid rgba(var(--primary-rgb), 0.18);
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.18);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    transition: max-height 0.35s ease, visibility 0s linear 0.35s;
    z-index: 99;
  }

  .header__nav-panel.is-open {
    max-height: 420px;
    visibility: visible;
    pointer-events: auto;
    transition: max-height 0.35s ease, visibility 0s linear 0s;
  }

  .header__nav-panel-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .header__nav-panel .header__link {
    display: block;
    padding: 14px var(--container-gutter);
    font-size: 1rem;
    border-radius: 0;
  }
}

/* Overlay e painel do menu — escondidos só no desktop */
@media (min-width: 769px) {
  .header__overlay,
  .header__nav-panel {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .header__overlay {
    display: none;
  }

  /* Navegação por âncora: deixa espaço para o header fixo (títulos não cortados) */
  html {
    scroll-padding-top: 88px;
  }
}
