/**
 * EasyApp header stability layer.
 * Loaded after the theme and the existing EasyApp global header stylesheet.
 */

:root {
  --ea-header-h: 56px;
  --ea-admin-offset: 0px;
}

html {
  scroll-padding-top: calc(var(--ea-header-h) + 14px);
}

body.admin-bar.easyapp-header-initial-load-fix {
  --ea-admin-offset: 32px;
}

body.easyapp-header-initial-load-fix {
  padding-top: var(--ea-header-h) !important;
}

/* Use the original navbar as the single fixed header from the first paint. */
body.easyapp-header-initial-load-fix #navbar.navbar,
body.easyapp-header-initial-load-fix #navbar.navbar.element-is-not-sticky,
body.easyapp-header-initial-load-fix #navbar.navbar.element-is-sticky,
body.easyapp-header-initial-load-fix #navbar.navbar.sticky-element-original {
  position: fixed !important;
  inset-inline: 0 !important;
  top: var(--ea-admin-offset) !important;
  bottom: auto !important;
  width: 100% !important;
  max-width: none !important;
  height: var(--ea-header-h) !important;
  min-height: var(--ea-header-h) !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  z-index: 2147480000 !important;
  border-bottom: 1px solid rgba(40, 44, 50, .07) !important;
  border-radius: 0 0 7px 7px !important;
  background: rgba(250, 250, 252, .82) !important;
  box-shadow: 0 1px 0 rgba(40, 44, 50, .07) !important;
  -webkit-backdrop-filter: saturate(180%) blur(18px) !important;
  backdrop-filter: saturate(180%) blur(18px) !important;
  transition: background-color .2s ease, box-shadow .2s ease !important;
}

/* Legacy mode can clone the sticky element. Keep only the original. */
body.easyapp-header-initial-load-fix #navbar.sticky-element-cloned {
  display: none !important;
}

body.easyapp-header-initial-load-fix #navbar.navbar > .container {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  height: var(--ea-header-h) !important;
  min-height: var(--ea-header-h) !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

body.easyapp-header-initial-load-fix #navbar.navbar .navbar-brand,
body.easyapp-header-initial-load-fix #navbar.navbar .navbar-brand > a {
  display: inline-flex !important;
  align-items: center !important;
  height: var(--ea-header-h) !important;
  min-height: var(--ea-header-h) !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

body.easyapp-header-initial-load-fix #navbar.navbar .navbar-brand img {
  width: auto !important;
  max-width: 160px !important;
  max-height: 34px !important;
  margin: 0 !important;
}

/* Desktop: use the same right-aligned navigation geometry on every page. */
@media (min-width: 1200px) {
  body.easyapp-header-initial-load-fix #navbar.navbar-expand-xl .navbar-collapse {
    display: flex !important;
    flex: 1 1 auto !important;
    align-items: center !important;
    justify-content: flex-end !important;
    height: var(--ea-header-h) !important;
    margin: 0 0 0 auto !important;
    padding: 0 !important;
  }

  body.easyapp-header-initial-load-fix #navbar.navbar-expand-xl #menu-main-menu.navbar-nav {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: auto !important;
    height: var(--ea-header-h) !important;
    margin: 0 0 0 auto !important;
    padding: 0 !important;
  }

  body.easyapp-header-initial-load-fix #navbar.navbar-expand-xl #menu-main-menu > li.level-1,
  body.easyapp-header-initial-load-fix #navbar.navbar-expand-xl #menu-main-menu > li.menu-item {
    flex: 0 0 auto !important;
    height: var(--ea-header-h) !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  body.easyapp-header-initial-load-fix #navbar.navbar-expand-xl #menu-main-menu > li.level-1 > a.nav-link,
  body.easyapp-header-initial-load-fix #navbar.navbar-expand-xl #menu-main-menu > li.menu-item > a {
    display: inline-flex !important;
    align-items: center !important;
    height: var(--ea-header-h) !important;
    min-height: var(--ea-header-h) !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    white-space: nowrap !important;
  }

  body.easyapp-header-initial-load-fix #navbar.navbar-expand-xl #menu-main-menu > li > .dropdown-menu {
    top: var(--ea-header-h) !important;
    margin-top: 0 !important;
  }
}

/* Remove only placeholders created by sticky scripts; normal layout elements are untouched. */
body.easyapp-header-initial-load-fix .easyapp-collapse-sticky-placeholder {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

/*
 * Version 1.0.0 inserted a fallback breadcrumb. Version 1.0.1 uses the
 * page's own breadcrumb instead. Keep the old generated node hidden even
 * when a full-page cache briefly serves stale HTML.
 */
.easyapp-line-breadcrumb {
  display: none !important;
}

/* Force only the existing LINE MINI App breadcrumb out of its pre-scroll hidden state. */
body.easyapp-line-mini-app-page .easyapp-original-breadcrumb-visible {
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  translate: none !important;
  filter: none !important;
  clip-path: none !important;
  animation: none !important;
  transition: none !important;
}

body.easyapp-line-mini-app-page .easyapp-original-breadcrumb-root {
  position: relative;
  z-index: 3;
}

@media (max-width: 1199.98px) {
  :root {
    --ea-header-h: 58px;
  }

  body.easyapp-header-initial-load-fix #navbar.navbar .navbar-brand img {
    max-width: 160px !important;
    max-height: 36px !important;
  }

  body.easyapp-header-initial-load-fix #navbar.navbar .navbar-toggler {
    display: grid !important;
    place-items: center !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

@media (max-width: 782px) {
  body.admin-bar.easyapp-header-initial-load-fix {
    --ea-admin-offset: 46px;
  }
}
