/* ============================================
   FuseIoT — Header
   Fixed navigation with light/dark theme variants
   ============================================ */

/* --- Base Header --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 110px;
  padding: 0 5vw;
  z-index: var(--z-header, 100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* --- Logo --- */
.header__logo {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  text-decoration: none;
}

.header__logo img {
  height: 54px;
  width: auto;
  display: block;
}

/* --- Brand text next to the logo — wipes right→left on scroll --- */
.header__brand {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap;
  display: inline-block;
  transform-origin: left center;
  opacity: 1;
  transform: translateX(0);
  -webkit-clip-path: inset(0 0 0 0);
  clip-path: inset(0 0 0 0);
  transition:
    opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    clip-path 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    -webkit-clip-path 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.3s ease;
}

.header--scrolled .header__brand {
  opacity: 0;
  transform: translateX(-14px);
  -webkit-clip-path: inset(0 100% 0 0);
  clip-path: inset(0 100% 0 0);
  pointer-events: none;
}

/* --- Nav (right) --- */
.header__nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* --- CTA Pill --- */
.header__cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background 0.3s ease, color 0.3s ease;
}

.header__cta:hover {
  transform: none !important;
}

/* Circular hover fill — shared by CTA and menu */
.header__cta,
.header__menu {
  overflow: hidden;
}

/* --- Hover fill circle --- */
.hover-fill {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  will-change: transform;
}

/* CTA label stays above fill */
.header__cta-label {
  position: relative;
  z-index: 1;
}

/* Fill active: text goes white (header buttons) */
.header__cta.hover-fill-active .header__cta-label {
  color: #FFF;
}

.header__menu.hover-fill-active .header__menu-bars span {
  background: #FFF;
}

/* Fill active: ALL pills — text goes white */
.pill.hover-fill-active {
  color: #FFF !important;
}

/* ============================================
   Menu Button — circle with hamburger / X
   ============================================ */
.header__menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transition: background 0.3s ease;
  overflow: hidden;
  isolation: isolate;
}

/* --- Botão de som: a wave da música ambiente (js/ambient-music.js).
       Mesma anatomia do botão de menu — hover-fill cromático da fuse. --- */
.header__sound {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  background: #E8E8EA;
  color: #1A1A1A; /* a linha do canvas herda via currentColor */
  overflow: hidden;
  isolation: isolate;
}

/* a linha fica acima do fill, como as barras do menu */
.header__sound-wave {
  display: block;
  width: 26px;
  height: 14px;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

/* fill cromático cobrindo: a linha vira branca (currentColor) */
.header__sound.hover-fill-active {
  color: #FFF;
}

/* Container for the two bars — sits above the fill */
.header__menu-bars {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

/* Each bar — same thickness */
.header__menu-bars span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  transition: transform 0.5s cubic-bezier(0.35, 0, 0, 1),
              background 0.3s ease;
  transform-origin: center center;
}

/* X state */
.header__menu.is-open .header__menu-bars span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.header__menu.is-open .header__menu-bars span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

/* ============================================
   Light Theme (default)
   ============================================ */
.header__brand {
  color: #1A1A1A;
}

.header__cta {
  background: #1A1A1A;
  color: #FFF;
}

.header__menu {
  background: #E8E8EA;
}

/* Bar colors — light theme */
.header__menu-bars span {
  background: #1A1A1A;
}

/* ============================================
   Dark Theme
   ============================================ */
.header--dark .header__brand {
  color: #FFF;
}

.header--dark .header__cta {
  background: rgba(255, 255, 255, 0.15);
  color: #FFF;
}

.header--dark .header__cta:hover {
  background: rgba(255, 255, 255, 0.25);
}

.header--dark .header__menu {
  background: rgba(255, 255, 255, 0.1);
}

.header--dark .header__menu:hover {
  background: rgba(255, 255, 255, 0.18);
}

.header--dark .header__menu-bars span {
  background: #FFF;
}

.header--dark .header__sound {
  background: rgba(255, 255, 255, 0.1);
  color: #FFF;
}

/* --- Scrolled state — header stays transparent, just triggers brand wipe animation --- */
/* (background/blur intentionally removed so logo, CTA and menu float directly over content) */

/* --- Overlay state: header slides down from above --- */
@keyframes headerSlideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.header--overlay-entering {
  animation: headerSlideDown 0.5s cubic-bezier(0.35, 0, 0, 1) both;
}

@keyframes headerSlideUp {
  from { transform: translateY(0);     opacity: 1; }
  to   { transform: translateY(-100%); opacity: 0; }
}

.header--overlay-leaving {
  animation: headerSlideUp 0.35s cubic-bezier(0.35, 0, 0, 1) both;
}

/* ============================================
   Menu Overlay (fullscreen nav)
   Ref: 09-header-anatomy.md
   ============================================ */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: #0A0A0F;
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.menu-overlay__link {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 400;
  color: #FFFFFF;
  text-decoration: none;
  letter-spacing: -0.02em;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.3s ease;
}

.menu-overlay.is-open .menu-overlay__link {
  opacity: 1;
  transform: translateY(0);
}

/* nth-of-type counts only the <a> links — the hidden .menu-overlay__close
   <button> is the overlay's first child and must not consume a slot */
.menu-overlay.is-open a.menu-overlay__link:nth-of-type(1) { transition-delay: 0.1s; }
.menu-overlay.is-open a.menu-overlay__link:nth-of-type(2) { transition-delay: 0.15s; }
.menu-overlay.is-open a.menu-overlay__link:nth-of-type(3) { transition-delay: 0.2s; }
.menu-overlay.is-open a.menu-overlay__link:nth-of-type(4) { transition-delay: 0.25s; }
.menu-overlay.is-open a.menu-overlay__link:nth-of-type(5) { transition-delay: 0.3s; }
.menu-overlay.is-open a.menu-overlay__link:nth-of-type(6) { transition-delay: 0.35s; }
.menu-overlay.is-open a.menu-overlay__link:nth-of-type(7) { transition-delay: 0.4s; }

.menu-overlay__link:hover {
  color: var(--orange);
}

/* Current page (subpages set aria-current="page" on their own link) */
.menu-overlay__link[aria-current="page"] {
  color: var(--orange);
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.menu-overlay__link[aria-current="page"]::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  flex: none;
}

/* 7 links at full size can overflow short viewports (landscape phones) */
@media (max-height: 700px) {
  .menu-overlay {
    gap: 14px;
  }

  .menu-overlay__link {
    font-size: clamp(1.5rem, 5vh, 2.5rem);
  }
}

/* Close button hidden — the header X handles closing */
.menu-overlay__close {
  display: none;
}

/* ============================================
   Logo dual (símbolo colorido + símbolo branco)
   O branco só aparece em páginas cinema com
   header escuro — o wipe do brand text é o mesmo.
   ============================================ */
/* o seletor leva o img junto para vencer o display:block de
   `.header__logo img` (0-1-1) — sem isso o símbolo branco vira um
   fantasma ao lado do colorido em TODOS os headers claros */
.header__logo img.header__logo-symbol--white {
  display: none;
}

.header--cinema.header--dark .header__logo-symbol--color {
  display: none;
}

.header--cinema.header--dark .header__logo-symbol--white {
  display: block;
}

/* When menu is open, header gets higher z-index */
.header.menu-is-open {
  z-index: 101;
}
