/* ============================================
   HEADER.CSS — Studio Cambria
   Floating header + Fluid mobile menu
   Liquid glass aesthetic
   ============================================ */

.site-header {
  position: fixed;
  top: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: calc(100% - var(--space-8));
  max-width: 900px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(13, 27, 42, 0.45);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: background var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal), opacity 0.4s ease, transform 0.4s ease;
}

.site-header.header-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-100%);
  pointer-events: none;
}

.site-header.scrolled {
  background: rgba(13, 27, 42, 0.65);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.18),
    0 1px 2px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 6px 20px;
  gap: var(--space-4);
}

/* Logo — text only */
.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  padding: var(--space-1) 0;
  transition: opacity var(--transition-fast);
}

.logo:hover {
  opacity: 0.85;
}

.logo-text {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-white);
  letter-spacing: 0.01em;
}

/* Navigation center */
.nav-center {
  display: flex;
  flex: 1;
  justify-content: center;
  position: relative;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  position: relative;
  z-index: 1;
}

.nav-link {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: rgba(253, 250, 246, 0.65);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  transition: color var(--transition-fast);
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-white);
}

/* Sliding background indicator */
.nav-slider {
  position: absolute;
  height: 30px;
  border-radius: var(--radius-md);
  background: rgba(253, 250, 246, 0.1);
  transition: left 0.25s ease, width 0.25s ease, opacity 0.2s ease;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  top: 50%;
  transform: translateY(-50%);
}

.nav-slider.visible {
  opacity: 1;
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ── Theme toggle (header desktop) ── */
.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(253, 250, 246, 0.06);
  color: rgba(253, 250, 246, 0.7);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.theme-toggle:hover {
  background: rgba(253, 250, 246, 0.12);
  border-color: rgba(201, 137, 42, 0.4);
  color: var(--color-accent);
  transform: scale(1.08);
}

/* Sun/Moon icon visibility */
.theme-toggle-sun,
.theme-toggle-moon {
  transition: opacity 0.3s ease, transform 0.3s ease;
  position: absolute;
}

.theme-toggle-sun {
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
}

.theme-toggle-moon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

html[data-theme="night"] .theme-toggle-sun {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

html[data-theme="night"] .theme-toggle-moon {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
}

/* Desktop CTA button */
.header-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 9999px;
  background: var(--color-accent);
  color: var(--color-white);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-decoration: none;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(201, 137, 42, 0.3);
}

.header-cta-btn:hover {
  background: var(--color-accent-light);
  transform: scale(1.03);
  box-shadow: 0 0 20px rgba(201, 137, 42, 0.5);
}

.header-cta-btn i {
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
}

@keyframes ctaGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(201, 137, 42, 0.3); }
  50% { box-shadow: 0 0 22px rgba(201, 137, 42, 0.55); }
}

.header-cta-btn {
  animation: ctaGlow 2.5s ease-in-out infinite;
}

.header-cta-btn:hover {
  animation: none;
}

/* Mobile WhatsApp icon — hidden on desktop */
.header-wa-mobile {
  display: none;
}

/* Fluid menu — hidden on desktop */
.fluid-menu {
  display: none;
}

/* ============================================
   RESPONSIVE — Mobile
   ============================================ */

@media (max-width: 1024px) {
  .nav-center {
    display: none;
  }

  /* Hide desktop CTA */
  .header-cta-btn {
    display: none;
  }

  /* Show mobile WhatsApp icon */
  .header-wa-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #25D366;
    text-decoration: none;
    transition: background var(--transition-fast);
  }

  .header-wa-mobile:hover {
    background: rgba(253, 250, 246, 0.08);
  }

  /* Hide desktop theme toggle on mobile */
  #theme-toggle-header {
    display: none;
  }

  /* ── Fluid circular menu ── */
  .fluid-menu {
    display: block;
    position: relative;
  }

  .fluid-menu-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(253, 250, 246, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    position: relative;
    z-index: 51;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    transition: background var(--transition-fast), border-color var(--transition-fast);
  }

  .fluid-menu.open .fluid-menu-toggle {
    background: rgba(253, 250, 246, 0.12);
    border-color: rgba(201, 137, 42, 0.4);
  }

  /* Hamburger ↔ X transition */
  .fluid-icon-open,
  .fluid-icon-close {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .fluid-icon-close {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }

  .fluid-menu.open .fluid-icon-open {
    opacity: 0;
    transform: scale(0) rotate(180deg);
  }

  .fluid-menu.open .fluid-icon-close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }

  /* Menu items — pills with icon + label */
  .fluid-menu-item {
    position: absolute;
    right: 0;
    top: 0;
    height: 44px;
    padding: 0 16px 0 12px;
    border-radius: 9999px;
    background: rgba(13, 27, 42, 0.4);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow:
      0 4px 16px rgba(0, 0, 0, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(253, 250, 246, 0.85);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(0) scale(0.8);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease,
                background var(--transition-fast),
                border-color var(--transition-fast);
    z-index: 40;
  }

  .fluid-menu-item i {
    font-size: 1.1rem;
    color: var(--color-accent);
  }

  .fluid-menu-item:hover,
  .fluid-menu-item:active {
    background: rgba(201, 137, 42, 0.15);
    border-color: rgba(201, 137, 42, 0.3);
    color: var(--color-white);
  }

  /* Open state — stagger each item */
  .fluid-menu.open .fluid-menu-item {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
  }

  .fluid-menu.open .fluid-menu-item:nth-child(2) {
    transform: translateY(52px) scale(1);
    transition-delay: 0.03s;
  }
  .fluid-menu.open .fluid-menu-item:nth-child(3) {
    transform: translateY(104px) scale(1);
    transition-delay: 0.06s;
  }
  .fluid-menu.open .fluid-menu-item:nth-child(4) {
    transform: translateY(156px) scale(1);
    transition-delay: 0.09s;
  }
  .fluid-menu.open .fluid-menu-item:nth-child(5) {
    transform: translateY(208px) scale(1);
    transition-delay: 0.12s;
  }
  .fluid-menu.open .fluid-menu-item:nth-child(6) {
    transform: translateY(260px) scale(1);
    transition-delay: 0.15s;
  }
  .fluid-menu.open .fluid-menu-item:nth-child(7) {
    transform: translateY(312px) scale(1);
    transition-delay: 0.18s;
  }

  /* Mobile theme toggle inside fluid menu — reset button defaults */
  button.fluid-menu-item.theme-toggle-mobile {
    cursor: pointer;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
  }

  .theme-toggle-mobile .theme-toggle-sun,
  .theme-toggle-mobile .theme-toggle-moon {
    position: static;
    transform: none;
    flex-shrink: 0;
  }

  .theme-toggle-mobile .theme-toggle-sun {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }

  .theme-toggle-mobile .theme-toggle-moon {
    opacity: 1;
    color: var(--color-accent);
  }

  html[data-theme="night"] .theme-toggle-mobile .theme-toggle-sun {
    opacity: 1;
    width: 18px;
    color: var(--color-accent);
  }

  html[data-theme="night"] .theme-toggle-mobile .theme-toggle-moon {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }

  /* Backdrop overlay when menu is open */
  .fluid-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
}

@media (max-width: 480px) {
  .site-header {
    top: var(--space-3);
    width: calc(100% - var(--space-6));
  }

  .header-container {
    padding: 5px 5px 5px 16px;
  }

  .logo-text {
    font-size: var(--text-base);
  }
}
