/* site-header.css — Header global da Palatine, réplica do header do site
   institucional (Website/web/src/layouts/Layout.astro), injetado via
   wp_body_open() em todas as páginas do escola.pltn.com.br.

   O header e o rodapé padrão do Twenty Twenty-Four (template parts) são
   ocultados abaixo — esta folha assume o lugar do header em todas as telas. */

header.wp-block-template-part,
footer.wp-block-template-part {
  display: none !important;
}

/* O core do WP aplica margin-block-start entre irmãos consecutivos de
   .wp-site-blocks (.wp-site-blocks > * + *) independente do display do
   irmão anterior — com o header padrão escondido (acima), esse espaço
   sobrava entre nosso header e o conteúdo (nem sempre é a tag <main>,
   por isso o seletor pega o irmão seguinte ao header oculto). */
.wp-site-blocks > header.wp-block-template-part + * {
  margin-block-start: 0 !important;
}

/* ── ANIMAÇÕES DE ENTRADA DO HEADER ─────────────────────────────────────── */
@keyframes logoShieldIn {
  from { opacity: 0; transform: scale(0.6) rotate(-10deg); }
  to   { opacity: 1; transform: scale(1)   rotate(0deg);   }
}

@keyframes logoNameIn {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0);     }
}

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

.logo-img   { animation: logoShieldIn 480ms cubic-bezier(0.23, 1, 0.32, 1)  60ms both; }
.logo-stack { animation: logoNameIn   480ms cubic-bezier(0.23, 1, 0.32, 1) 200ms both; }

.nav-list li:nth-child(1) { animation: navItemIn 360ms cubic-bezier(0.23, 1, 0.32, 1) 300ms both; }
.nav-list li:nth-child(2) { animation: navItemIn 360ms cubic-bezier(0.23, 1, 0.32, 1) 355ms both; }
.nav-list li:nth-child(3) { animation: navItemIn 360ms cubic-bezier(0.23, 1, 0.32, 1) 410ms both; }
.nav-list li:nth-child(4) { animation: navItemIn 360ms cubic-bezier(0.23, 1, 0.32, 1) 465ms both; }
.nav-list li:nth-child(5) { animation: navItemIn 360ms cubic-bezier(0.23, 1, 0.32, 1) 520ms both; }
.nav-list li:nth-child(6) { animation: navItemIn 360ms cubic-bezier(0.23, 1, 0.32, 1) 575ms both; }
.header-actions            { animation: navItemIn 360ms cubic-bezier(0.23, 1, 0.32, 1) 630ms both; }

@media (prefers-reduced-motion: reduce) {
  .logo-img, .logo-stack, .nav-list li, .header-actions {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ── HEADER ──────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background-color: oklch(14% 0.02 302 / 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--color-border-dark);
  height: 80px;
  display: flex;
  align-items: center;
}

/* Compensa a admin bar do WordPress para o header sticky não ficar atrás dela */
body.admin-bar .header {
  top: var(--wp-admin--admin-bar--height, 32px);
}

.palatine-header-container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── LOGO ────────────────────────────────────────────────────────────────── */
.logo-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  border-bottom: none;
}

.logo-img {
  width: 35px !important;
  height: 42px !important;
  max-width: none !important;
  aspect-ratio: 500 / 598;
  filter: drop-shadow(0 0 5px oklch(76% 0.14 80 / 0.2));
  transition: transform var(--transition-fast), filter var(--transition-fast);
  flex-shrink: 0;
}

.logo-link:hover .logo-img {
  transform: rotate(-6deg) scale(1.06);
  filter: drop-shadow(0 0 8px oklch(76% 0.14 80 / 0.4));
}

.logo-stack {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 42px;
  padding: 1px 0;
  box-sizing: border-box;
}

.logo-name {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--color-text-primary-dark);
  letter-spacing: 0.16em;
  line-height: 1;
}

.logo-sub {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--color-gold);
  letter-spacing: 0.16em;
  line-height: 1;
}

/* ── NAV DESKTOP ─────────────────────────────────────────────────────────── */
.nav-list {
  display: flex;
  list-style: none;
  gap: var(--space-md);
  align-items: center;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--color-text-secondary-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  border-bottom: none;
  position: relative;
  padding-bottom: 3px;
  transition: color var(--transition-fast);
}

/* Linha dourada sob o item — aparece no hover e na página ativa */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--color-gold);
  box-shadow: 0 0 6px oklch(76% 0.14 80 / 0.5);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-link:hover {
  color: var(--color-gold);
  border-bottom: none;
}

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

/* Página ativa: linha sempre visível + texto dourado */
.nav-link.active {
  color: var(--color-gold);
  border-bottom: none;
}

.nav-link.active::after {
  transform: scaleX(1);
}

/* ── DROPDOWN NAV ────────────────────────────────────────────────────────── */
.nav-has-dropdown { position: relative; }

/* Ponte invisível que cobre o gap entre o link e o painel,
   mantendo o :hover ativo enquanto o mouse traversa o espaço. */
.nav-has-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: -16px;
  right: -16px;
  height: 14px;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.nav-chevron {
  transition: transform 220ms cubic-bezier(0.23, 1, 0.32, 1);
  flex-shrink: 0;
  opacity: 0.6;
}

.nav-has-dropdown:hover .nav-chevron,
.nav-has-dropdown:focus-within .nav-chevron {
  transform: rotate(180deg);
  opacity: 1;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 180px;
  background-color: oklch(14% 0.02 302 / 0.97);
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(16px);
  padding: 0.4rem 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 200;
  box-shadow: 0 12px 32px oklch(10% 0.01 302 / 0.65);
}

.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background-color: oklch(14% 0.02 302 / 0.97);
  border-left: 1px solid var(--color-border-dark);
  border-top: 1px solid var(--color-border-dark);
}

.nav-has-dropdown:hover .nav-dropdown,
.nav-has-dropdown:focus-within .nav-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-list { list-style: none; margin: 0; padding: 0; }

.nav-dropdown-list a {
  display: block;
  padding: 0.5rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-secondary-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  border-bottom: none;
  transition: color 150ms ease, background-color 150ms ease;
  white-space: nowrap;
}

.nav-dropdown-list a:hover {
  color: var(--color-gold);
  background-color: oklch(76% 0.14 80 / 0.06);
  border-bottom: none;
}

/* ── MOBILE ACADEMIA ACCORDION ───────────────────────────────────────────── */
.mobile-acad-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 600;
  color: var(--color-text-primary-dark);
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  transition: color var(--transition-fast);
}

.mobile-acad-toggle:hover,
.mobile-acad-toggle[aria-expanded="true"] { color: var(--color-gold); }

.mobile-acad-chevron {
  transition: transform 250ms ease;
}

.mobile-acad-toggle[aria-expanded="true"] .mobile-acad-chevron {
  transform: rotate(180deg);
}

.mobile-acad-sub {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0;
  padding: 0;
  transition: max-height 380ms cubic-bezier(0.23, 1, 0.32, 1), opacity 300ms ease, margin-top 300ms ease;
}

.mobile-acad-sub.is-open {
  max-height: 480px;
  opacity: 1;
  margin-top: var(--space-sm);
}

.mobile-acad-sub a {
  font-family: var(--font-sans) !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  color: var(--color-text-secondary-dark) !important;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom: none !important;
  transition: color var(--transition-fast);
}

.mobile-acad-sub a:hover { color: var(--color-gold) !important; }

/* ── ACTIONS (Entrar / Minha Conta + hamburger) ──────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn-header {
  padding: 0.45rem 1.1rem;
  font-size: var(--text-sm);
  letter-spacing: 0.1em;
}

.btn-icon {
  gap: 0.45rem;
}

.btn-icon svg {
  flex-shrink: 0;
}

.header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--color-purple);
  border: 1px solid var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gold);
  text-decoration: none;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
  box-shadow: 0 0 8px oklch(76% 0.14 80 / 0.15);
  flex-shrink: 0;
}

.header-avatar:hover {
  transform: scale(1.05);
  border-color: var(--color-gold-hover);
  background-color: var(--color-purple-light);
}

.header-avatar-img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover;
  border-radius: 50%;
}

.btn-logout-icon {
  background: none;
  border: none;
  color: var(--color-text-secondary-dark);
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-bottom: none;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.btn-logout-icon:hover {
  color: oklch(65% 0.18 28);
  transform: translateX(2px);
  border-bottom: none;
}

/* ── HAMBURGER ───────────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 1.5px;
  background-color: var(--color-text-primary-dark);
  border-radius: 1px;
  transform-origin: center;
  transition:
    transform 250ms cubic-bezier(0.23, 1, 0.32, 1),
    opacity   200ms cubic-bezier(0.23, 1, 0.32, 1);
}

.hamburger.is-open .hamburger-line:nth-child(1) { transform: rotate(45deg)  translate(4.5px, 4.5px);  }
.hamburger.is-open .hamburger-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.is-open .hamburger-line:nth-child(3) { transform: rotate(-45deg) translate(4.5px, -4.5px); }

/* ── OVERLAY MOBILE ──────────────────────────────────────────────────────── */
.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background-color: oklch(11% 0.015 302 / 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
}

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

.mobile-nav-list {
  list-style: none;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin: 0;
  padding: 0;
}

.mobile-nav-list li {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity   300ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 300ms cubic-bezier(0.23, 1, 0.32, 1);
  transition-delay: calc(var(--i) * 60ms);
}

.mobile-overlay.is-open .mobile-nav-list li { opacity: 1; transform: translateY(0); }

.mobile-nav-list a,
.mobile-logout-btn {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 600;
  color: var(--color-text-primary-dark);
  letter-spacing: 0.05em;
  border-bottom: none;
  transition: color var(--transition-fast);
}

.mobile-nav-list a:hover,
.mobile-nav-list a.mobile-active { color: var(--color-gold); border-bottom: none; }

/* ── RESPONSIVIDADE ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header { height: 64px; }
  .nav    { display: none; }
  .btn-header { display: none; }
  .hamburger  { display: flex; }
}
