/*
 * header.css
 * Styles for the site-header component.
 * Three-column: left nav | center logo | right nav + actions.
 * Transparent by default, white + shadow when .site-header--scrolled.
 */


/* ─── Root ───────────────────────────────────────────────────────────────── */

:root {
  --site-header-strip-height: 14px;
  --site-header-row-height: 92px;
}

.site-header {
  position:   fixed;
  top:        0;
  left:       0;
  right:      0;
  z-index:    var(--z-header);
  isolation:  isolate;
  transition:
    background-color 0.3s ease,
    backdrop-filter  0.3s ease,
    box-shadow       0.3s ease,
    border-color     0.3s ease,
    color            0.3s ease;

  /* Transparent default */
  background-color: transparent;
  color:            var(--color-beige);
  border-bottom:    1px solid transparent;
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: var(--site-header-strip-height);
  background: linear-gradient(90deg, rgba(52, 41, 34, 0.92), rgba(26, 10, 0, 0.94));
}

.site-header--scrolled {
  background-color: rgba(252, 248, 242, 0.84);
  backdrop-filter:  blur(18px) saturate(120%);
  box-shadow:       0 18px 44px rgba(26, 10, 0, 0.08);
  border-bottom-color: rgba(84, 55, 41, 0.08);
  color:            var(--color-primary);
}

body:not(.page-front) .site-header {
  background-color: rgba(252, 248, 242, 0.9);
  backdrop-filter:  blur(18px) saturate(120%);
  box-shadow:       0 18px 44px rgba(26, 10, 0, 0.08);
  border-bottom:    1px solid rgba(84, 55, 41, 0.08);
  color:            var(--color-primary);
}

body:not(.page-front) .site-header::before {
  background: rgba(34, 31, 29, 0.94);
}


/* ─── Inner row ──────────────────────────────────────────────────────────── */

.site-header__inner {
  position: relative;
  display:         grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:     center;
  min-height:      calc(var(--site-header-row-height) + var(--site-header-strip-height));
  padding-top:     var(--site-header-strip-height);
  gap:             clamp(2rem, 4vw, 5rem);
}


/* ─── Left nav ───────────────────────────────────────────────────────────── */

.site-header__nav--left {
  display:     flex;
  align-items: center;
  justify-self: start;
}


/* ─── Shared nav menu ────────────────────────────────────────────────────── */

.site-header__menu {
  display:    flex;
  align-items: center;
  gap:         clamp(1.6rem, 2.8vw, 3rem);
  list-style:  none;
  margin:      0;
  padding:     0;
}

.site-header__menu a {
  font-family:     var(--font-sans);
  position:        relative;
  font-size:       0.82rem;
  font-weight:     400;
  letter-spacing:  0.22em;
  text-transform:  uppercase;
  text-decoration: none;
  color:           currentColor;
  opacity:         0.82;
  transition:
    opacity 0.2s ease,
    color   0.2s ease,
    transform 0.2s ease;
}

.site-header__menu a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.45rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  opacity: 0.5;
  transition: transform 0.25s ease;
}

.site-header__menu a:hover,
.site-header__menu .current-menu-item > a {
  opacity: 1;
  transform: translateY(-1px);
}

.site-header__menu a:hover::after,
.site-header__menu .current-menu-item > a::after {
  transform: scaleX(1);
}


/* ─── Logo (center column) ───────────────────────────────────────────────── */

.site-header__logo {
  display:         flex;
  align-items:     center;
  justify-content: center;
  align-self:      center;
  text-decoration: none;
  color:           currentColor;
}

.site-header__logo img {
  height:  48px;
  width:   auto;
  display: block;
}

.site-header__logo-text {
  font-family:    var(--font-serif);
  font-size:      clamp(2.15rem, 2.8vw, 2.85rem);
  font-weight:    300;
  letter-spacing: -0.03em;
  line-height:    1;
  white-space:    nowrap;
}


/* ─── Right column ───────────────────────────────────────────────────────── */

.site-header__right {
  display:         flex;
  align-items:     center;
  justify-content: flex-end;
  justify-self:    end;
  gap:             var(--space-md);
}

.site-header__nav--right {
  display:     flex;
  align-items: center;
}


/* ─── Actions (search / account / cart) ─────────────────────────────────── */

.site-header__action {
  display:         inline-flex;
  align-items:     center;
  gap:             4px;
  font-family:     var(--font-sans);
  font-size:       var(--text-sm);
  font-weight:     400;
  letter-spacing:  var(--tracking-wide);
  text-transform:  uppercase;
  text-decoration: none;
  color:           currentColor;
  background:      none;
  border:          none;
  padding:         0;
  cursor:          pointer;
  opacity:         0.8;
  transition:      opacity 0.2s ease;
  white-space:     nowrap;
}

.site-header__action:hover {
  opacity: 1;
}

/* Cart count — inline "(0)" style */
.site-header__cart-count {
  opacity: 0.7;
}

.site-header__cart-count.is-empty {
  /* still visible as "(0)" — hide only if you want */
}

/* Mobile toggle — always visible in right column; hidden on desktop via responsive rules */
.site-header__mobile-toggle {
  display:     flex;
  align-items: center;
  background:  none;
  border:      none;
  color:       currentColor;
  cursor:      pointer;
  padding:     6px;
  flex-shrink: 0;
  opacity:     0.9;
  border-radius: 999px;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.site-header__mobile-toggle:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}


/* ─── Mobile drawer ──────────────────────────────────────────────────────── */

/* Drawer lives outside <header> in the DOM — no stacking-context interference */
.site-header__mobile-menu {
  position:         fixed;
  top:              0;
  right:            0;
  bottom:           0;
  width:            min(360px, 85vw);
  background-color: var(--color-primary);
  z-index:          400;           /* hard value, above everything */
  display:          flex;
  flex-direction:   column;
  padding:          var(--space-xl) var(--space-lg);
  transform:        translateX(100%);
  opacity:          0;
  pointer-events:   none;
  transition:
    transform 0.35s ease,
    opacity   0.35s ease;
}

.site-header__mobile-menu.is-open {
  transform:      translateX(0);
  opacity:        1;
  pointer-events: auto;
}

/* Backdrop */
.site-header__backdrop {
  display:          none;
  position:         fixed;
  inset:            0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index:          399;
}

.site-header__backdrop.is-open {
  display: block;
}

/* Close button inside drawer */
.site-header__mobile-close {
  display:         flex;
  align-items:     center;
  justify-content: flex-end;
  margin-bottom:   var(--space-lg);
  background:      none;
  border:          none;
  color:           var(--color-beige);
  cursor:          pointer;
  padding:         4px;
  align-self:      flex-end;
  opacity:         0.7;
  transition:      opacity 0.2s ease;
}

.site-header__mobile-close:hover {
  opacity: 1;
}

.site-header__mobile-menu-inner {
  display:        flex;
  flex-direction: column;
  gap:            var(--space-md);
}

.site-header__mobile-nav {
  list-style: none;
  margin:     0;
  padding:    0;
  display:    flex;
  flex-direction: column;
  gap:        var(--space-md);
}

.site-header__mobile-nav a {
  font-family:    var(--font-serif);
  font-size:      var(--text-3xl);
  font-weight:    300;
  color:          var(--color-beige);
  text-decoration: none;
  transition:     opacity 0.2s ease;
}

.site-header__mobile-nav a:hover {
  opacity: 0.7;
}


/* ─── Search overlay ─────────────────────────────────────────────────────── */

.site-header__search-overlay {
  position:         fixed;
  inset:            0;
  background-color: rgba(26, 10, 0, 0.96);
  z-index:          calc(var(--z-header) + 20);
  display:          flex;
  align-items:      center;
  justify-content:  center;
  padding:          var(--space-md);
  transition:       opacity 0.25s ease;
}

.site-header__search-overlay[aria-hidden="true"] {
  opacity:        0;
  pointer-events: none;
}

.site-header__search-overlay[aria-hidden="false"] {
  opacity: 1;
}

.site-header__search-inner {
  position:  relative;
  width:     100%;
  max-width: 600px;
}

.site-header__search-inner .search-form {
  display: flex;
  gap:     var(--space-sm);
}

.site-header__search-inner input[type="search"] {
  flex:          1;
  background:    transparent;
  border:        none;
  border-bottom: 1px solid rgba(245, 240, 232, 0.4);
  color:         var(--color-beige);
  font-family:   var(--font-serif);
  font-size:     var(--text-3xl);
  font-weight:   300;
  padding:       var(--space-sm) 0;
  outline:       none;
}

.site-header__search-inner input[type="search"]::placeholder {
  color: rgba(245, 240, 232, 0.3);
}

.site-header__search-close {
  position: absolute;
  top:      calc(-1 * var(--space-xl));
  right:    0;
  color:    var(--color-beige);
  opacity:  0.6;
  width:    36px;
  height:   36px;
  display:  flex;
  align-items:     center;
  justify-content: center;
  background: none;
  border:     none;
  cursor:     pointer;
  transition: opacity 0.2s ease;
}

.site-header__search-close:hover {
  opacity: 1;
}


/* ─── Page offset (push content below fixed header) ─────────────────────── */

.site-main {
  padding-top: calc(var(--site-header-row-height) + var(--site-header-strip-height));
}

body:not(.page-front) .site-main:has(> .wp-block-neirotti-hero:first-child),
body:not(.page-front) .site-main:has(> .wp-block-neirotti-page-hero:first-child),
body:not(.page-front) .site-main:has(> .wp-block-group:first-child > .wp-block-neirotti-hero:first-child),
body:not(.page-front) .site-main:has(> .wp-block-group:first-child > .wp-block-neirotti-page-hero:first-child) {
  padding-top: 0;
}

/* Hero bleeds under header */
.site-main > .wp-block-neirotti-hero:first-child {
  margin-top: calc(-1 * (var(--site-header-row-height) + var(--site-header-strip-height)));
}

.site-main > .wp-block-neirotti-page-hero:first-child {
  margin-top: calc(-1 * (var(--site-header-row-height) + var(--site-header-strip-height)));
}

.site-main > .wp-block-group:first-child > .wp-block-neirotti-hero:first-child,
.site-main > .wp-block-group:first-child > .wp-block-neirotti-page-hero:first-child {
  margin-top: calc(-1 * (var(--site-header-row-height) + var(--site-header-strip-height)));
}


/* ─── Responsive ─────────────────────────────────────────────────────────── */

/* Desktop: hide the hamburger toggle */
@media (min-width: 1025px) {
  .site-header__mobile-toggle {
    display: none;
  }
}

/* Tablet / mobile: hide desktop navs, collapse to 2-col grid */
@media (max-width: 1024px) {
  :root {
    --site-header-row-height: 80px;
  }

  .site-header__nav--left,
  .site-header__nav--right {
    display: none;
  }

  .site-header__inner {
    grid-template-columns: 1fr auto;
  }

  .site-header__logo {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  :root {
    --site-header-strip-height: 12px;
    --site-header-row-height: 68px;
  }

  .site-header__inner {
    gap: var(--space-md);
  }

  .site-header__logo-text {
    font-size: clamp(1.9rem, 9vw, 2.25rem);
  }

  .site-main {
    padding-top: calc(var(--site-header-row-height) + var(--site-header-strip-height));
  }

  .site-main > .wp-block-neirotti-hero:first-child {
    margin-top: calc(-1 * (var(--site-header-row-height) + var(--site-header-strip-height)));
  }

  .site-main > .wp-block-neirotti-page-hero:first-child {
    margin-top: calc(-1 * (var(--site-header-row-height) + var(--site-header-strip-height)));
  }

  .site-main > .wp-block-group:first-child > .wp-block-neirotti-hero:first-child,
  .site-main > .wp-block-group:first-child > .wp-block-neirotti-page-hero:first-child {
    margin-top: calc(-1 * (var(--site-header-row-height) + var(--site-header-strip-height)));
  }
}
