/**
 * Header — GeneratePress Luxe
 *
 * Three-zone layout: [hamburger] [logo/brand] [icons]
 * The header overrides GeneratePress' default header via hooks (see hooks.php).
 *
 * @package GP_Luxe
 */

/* =========================================================================
   1. Header shell
   ========================================================================= */

.luxe-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  height: var(--luxe-header-height);
  border-bottom: var(--luxe-border-light);
  /* Subtle backdrop blur for frosted-glass feel on scroll */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background-color var(--luxe-duration-base) var(--luxe-ease-out),
              border-color var(--luxe-duration-base) var(--luxe-ease-out);
}

/* When page is scrolled, deepen the header background slightly */
.luxe-header.is-scrolled {
  border-bottom-color: rgba(49, 22, 3, 0.14);
}

/* Transparent header variant — for use on hero-top pages */
.luxe-header--transparent {
  background-color: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  position: absolute;
}

.luxe-header--transparent .luxe-hamburger__bar,
.luxe-header--transparent .luxe-brand__name,
.luxe-header--transparent .luxe-header-icon {
  color: var(--luxe-white);
}

/* =========================================================================
   2. Three-zone inner layout
   ========================================================================= */

.luxe-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--luxe-space-6);
}

/* Left zone */
.luxe-header__zone--left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

/* Center zone */
.luxe-header__zone--center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Right zone */
.luxe-header__zone--right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--luxe-space-5);
}

/* =========================================================================
   3. Hamburger button
   ========================================================================= */

.luxe-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  position: relative;
  z-index: 1;

  /* Extend click area without changing visual size */
  margin: -8px;
  padding: 8px;
}

.luxe-hamburger__bar {
  display: block;
  height: 1px;
  background-color: var(--luxe-black);
  transition: transform var(--luxe-duration-base) var(--luxe-ease-out),
              opacity var(--luxe-duration-base) var(--luxe-ease-out),
              width var(--luxe-duration-base) var(--luxe-ease-out);
  transform-origin: center;
}

.luxe-hamburger__bar:nth-child(1) { width: 22px; }
.luxe-hamburger__bar:nth-child(2) { width: 16px; }  /* Shorter middle bar — editorial detail */
.luxe-hamburger__bar:nth-child(3) { width: 22px; }

/* Animate to X when menu is open */
.luxe-hamburger[aria-expanded="true"] .luxe-hamburger__bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
  width: 22px;
}
.luxe-hamburger[aria-expanded="true"] .luxe-hamburger__bar:nth-child(2) {
  opacity: 0;
  width: 0;
}
.luxe-hamburger[aria-expanded="true"] .luxe-hamburger__bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
  width: 22px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .luxe-hamburger__bar {
    transition: none;
  }
}

/* Focus ring */
.luxe-hamburger:focus-visible {
  outline: 2px solid var(--luxe-black);
  outline-offset: 2px;
  border-radius: 2px;
}

/* =========================================================================
   4. Brand / Logo
   ========================================================================= */

.luxe-brand__link {
  display: block;
  text-decoration: none;
}

.luxe-brand__link:hover {
  opacity: 1;
}

.luxe-brand__logo {
  max-height: 40px;
  display: block;
  transition: opacity var(--luxe-duration-fast) var(--luxe-ease-out);
}

.luxe-brand__logo:hover {
  opacity: 0.7;
}

.luxe-brand__name {
  display: block;
  font-family: var(--luxe-font-serif);
  font-size: var(--luxe-text-lg);
  font-weight: 300;
  letter-spacing: var(--luxe-tracking-wider);
  text-transform: uppercase;
  color: var(--luxe-black);
  white-space: nowrap;
  transition: opacity var(--luxe-duration-fast) var(--luxe-ease-out);
}

.luxe-brand__name:hover {
  opacity: 0.7;
}

/* =========================================================================
   5. Header utility icons (cart, account, lang)
   ========================================================================= */

.luxe-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--luxe-black);
  text-decoration: none;
  transition: opacity var(--luxe-duration-fast) var(--luxe-ease-out);
  width: 36px;
  height: 36px;

  /* Extend click area */
  margin: -8px;
  padding: 8px;
}

.luxe-header-icon:hover {
  opacity: 0.55;
}

.luxe-header-icon:focus-visible {
  outline: 2px solid var(--luxe-black);
  outline-offset: 2px;
  border-radius: 2px;
}

.luxe-header-icon svg {
  display: block;
}

/* Cart count badge */
.luxe-cart-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  background: var(--luxe-black);
  color: var(--luxe-white);
  font-family: var(--luxe-font-sans);
  font-size: 9px;
  font-weight: 500;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 3px;
  pointer-events: none;
}

/* Language switcher — ET / EN toggle */
.luxe-lang {
  display: flex;
  align-items: center;
  gap: 0.35em;
  font-family: var(--luxe-font-sans);
  font-size: var(--luxe-text-xs);
  font-weight: 400;
  letter-spacing: var(--luxe-tracking-wider);
  text-transform: uppercase;
}

/* Header shows short code only, hides full name */
.luxe-lang__name {
  display: none;
}

.luxe-lang__link {
  color: var(--luxe-warm-grey);
  text-decoration: none;
  padding: 2px 0;
  transition: color var(--luxe-duration-fast) var(--luxe-ease-out);
}

.luxe-lang__link:hover {
  color: var(--luxe-black);
  opacity: 1;
}

.luxe-lang__link.is-active {
  color: var(--luxe-black);
  font-weight: 500;
}

.luxe-lang__sep {
  color: var(--luxe-warm-grey);
  font-weight: 300;
  user-select: none;
}

/* On transparent header, switch to light colours */
.luxe-header--transparent .luxe-lang__link {
  color: rgba(255, 255, 255, 0.55);
}

.luxe-header--transparent .luxe-lang__link.is-active {
  color: var(--luxe-white);
}

.luxe-header--transparent .luxe-lang__sep {
  color: rgba(255, 255, 255, 0.35);
}

/* =========================================================================
   6. GeneratePress default header — disable/reset
   Since we replaced the GP header hook, we still defensively reset
   any GP header CSS that might bleed through.
   ========================================================================= */

/* Remove GP's default header background/padding if our class is present */
.luxe-header.site-header {
  padding: 0 !important;
}

.luxe-header .site-header-wrap,
.luxe-header .inside-header {
  /* GP adds these. Neutralize them on our header. */
  display: none !important;
}

/* =========================================================================
   7. Cart icon — WooCommerce fragment update pulse
   ========================================================================= */

/* Brief scale-pulse on the cart icon when WooCommerce updates cart fragments.
   Class toggled in main.js on the 'wc_fragments_refreshed' event. */
.luxe-header-icon--cart.is-updated svg {
  animation: cartPulse 0.5s var(--luxe-ease-out);
}

@keyframes cartPulse {
  0%  { transform: scale(1); }
  40% { transform: scale(1.25); }
  70% { transform: scale(0.95); }
  100%{ transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .luxe-header-icon--cart.is-updated svg {
    animation: none;
  }
}

/* =========================================================================
   8. Mobile header adjustments
   ========================================================================= */

@media (max-width: 768px) {
  .luxe-header__inner {
    padding: 0 var(--luxe-space-4);
  }

  .luxe-brand__name {
    font-size: var(--luxe-text-md);
    letter-spacing: var(--luxe-tracking-wide);
  }

  .luxe-brand__logo {
    max-height: 32px;
  }

  /* Reduce icon gap on mobile */
  .luxe-header__zone--right {
    gap: var(--luxe-space-3);
  }
}

@media (max-width: 360px) {
  .luxe-header__inner {
    padding: 0 var(--luxe-space-3);
  }
}
