/*
 * Astra header: sticky + shrink on scroll.
 * assets/js/header.js toggles .gyla-header--scrolled on #masthead.
 * Astra's own header rules use IDs, so these selectors do too.
 */

#masthead {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: #ffffff;
  transition: box-shadow 0.25s ease;
}

#masthead .ast-primary-header-bar {
  transition:
    padding-top 0.25s ease,
    padding-bottom 0.25s ease;
}

#masthead .site-primary-header-wrap {
  transition: min-height 0.25s ease;
}

#masthead .custom-logo {
  transition:
    width 0.25s ease,
    max-width 0.25s ease;
}

#masthead.gyla-header--scrolled {
  box-shadow: var(--gyla-shadow-sm);
}

/* Desktop shrink */
@media (min-width: 922px) {
  #masthead.gyla-header--scrolled #ast-desktop-header .ast-primary-header-bar {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  #masthead.gyla-header--scrolled #ast-desktop-header .site-primary-header-wrap {
    min-height: 60px;
  }

  #masthead.gyla-header--scrolled #ast-desktop-header .custom-logo {
    width: 100px;
    max-width: 100px;
    height: auto;
  }
}

/*
 * Narrow desktop (922–1100 px): Astra's default spacing wraps the menu onto a second row and splits the phone
 * number. A smaller logo, tighter links and a one-line button keep everything on one row down to 922 px.
 * (Moving Astra's header breakpoint instead doesn't work: Astra hides #ast-desktop-header with a fixed
 * tablet-breakpoint media query, so both headers show.)
 */
@media (min-width: 922px) and (max-width: 1100px) {
  #masthead #ast-desktop-header .custom-logo {
    width: 120px;
    max-width: 120px;
    height: auto;
  }

  #masthead #ast-desktop-header .main-header-menu > .menu-item > .menu-link {
    padding-right: 10px;
    padding-left: 10px;
    font-size: var(--gyla-text-small);
  }

  #masthead #ast-desktop-header .ast-custom-button {
    font-size: var(--gyla-text-body);
    white-space: nowrap;
  }
}

/* Mobile shrink */
@media (max-width: 921px) {
  #masthead.gyla-header--scrolled #ast-mobile-header .ast-primary-header-bar {
    padding-top: 0;
    padding-bottom: 0;
  }

  #masthead.gyla-header--scrolled #ast-mobile-header .site-primary-header-wrap {
    min-height: 56px;
  }

  #masthead.gyla-header--scrolled #ast-mobile-header .custom-logo {
    width: 68px;
    max-width: 68px;
    height: auto;
  }
}

/* WordPress admin bar */
.admin-bar #masthead {
  top: 32px;
}

@media (max-width: 782px) {
  .admin-bar #masthead {
    top: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #masthead,
  #masthead .ast-primary-header-bar,
  #masthead .site-primary-header-wrap,
  #masthead .custom-logo {
    transition: none;
  }
}
