/* FPPTI Jabar Theme 1.10.0
 * Journal masthead alignment: journal title and account controls share one desktop row.
 * Keep this file versioned to avoid stale browser/proxy/CDN caches.
 */

@media (min-width: 901px) {
  html body.openlib-journal-page .openlib_journal_header {
    position: relative !important;
  }

  /* The utility row becomes the single, slightly taller masthead row. */
  html body.openlib-journal-page .openlib_journal_header__utility {
    position: relative !important;
    z-index: 3 !important;
    background: linear-gradient(105deg, #F2F7FF 0%, #FFFFFF 72%) !important;
    border-bottom: 0 !important;
  }
  html body.openlib-journal-page .openlib_journal_header__utility_inner {
    min-height: 94px !important;
    padding: 10px 0 !important;
    justify-content: flex-end !important;
  }
  html body.openlib-journal-page .openlib_journal_header__account {
    position: relative !important;
    z-index: 5 !important;
    align-self: center !important;
    flex: 0 0 auto !important;
  }

  /* Overlay the identity on the same masthead row without creating a second band. */
  html body.openlib-journal-page .openlib_journal_header__identity {
    position: absolute !important;
    z-index: 4 !important;
    top: 4px !important;
    left: 0 !important;
    right: 0 !important;
    background: transparent !important;
    border: 0 !important;
    pointer-events: none !important;
  }
  html body.openlib-journal-page .openlib_journal_header__identity_inner {
    min-height: 94px !important;
    padding: 10px 0 !important;
    align-items: center !important;
  }
  html body.openlib-journal-page .openlib_journal_identity_stack {
    width: calc(100% - 300px) !important;
    max-width: calc(100% - 300px) !important;
    pointer-events: none !important;
  }
  html body.openlib-journal-page .openlib_journal_brand {
    width: 100% !important;
    max-width: 100% !important;
    pointer-events: auto !important;
  }
  html body.openlib-journal-page .openlib_journal_brand__title,
  html body.openlib-journal-page .openlib_journal_brand__logo {
    pointer-events: auto !important;
  }
  html body.openlib-journal-page .openlib_journal_brand__title {
    max-width: 920px !important;
  }

  /* The nav begins immediately after the shared masthead row. */
  html body.openlib-journal-page .openlib_journal_header__navrow {
    position: relative !important;
    z-index: 6 !important;
  }

  /* Guest account order: Dark | Login | Register. */
  html body.openlib-journal-page .openlib_journal_header__account .pkp_navigation_user {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  html body.openlib-journal-page .openlib_journal_header__account .pkp_navigation_user > li {
    margin: 0 !important;
    padding: 0 !important;
  }
  html body.openlib-journal-page .openlib_journal_header__account .pkp_navigation_user > li:has(> a[href*="/login"]) {
    order: 1 !important;
  }
  html body.openlib-journal-page .openlib_journal_header__account .pkp_navigation_user > li:has(> a[href*="/register"]) {
    order: 2 !important;
  }
}

/* Preserve the same combined masthead treatment in dark mode. */
@media (min-width: 901px) {
  html[data-openlib-color-mode="dark"] body.openlib-journal-page .openlib_journal_header__utility {
    background: linear-gradient(105deg, #22324A 0%, #1C2B40 58%, #172338 100%) !important;
    border-color: #33465F !important;
  }
  html[data-openlib-color-mode="dark"] body.openlib-journal-page .openlib_journal_header__identity {
    background: transparent !important;
  }
}

/* Tablet/mobile: keep the safer stacked header so long journal titles and account menus never collide. */
@media (max-width: 900px) {
  html body.openlib-journal-page .openlib_journal_header__utility_inner {
    min-height: 40px !important;
    padding: 0 !important;
  }
  html body.openlib-journal-page .openlib_journal_header__identity {
    position: static !important;
    pointer-events: auto !important;
  }
  html body.openlib-journal-page .openlib_journal_header__identity_inner {
    min-height: 80px !important;
    padding: 12px 0 !important;
  }
  html body.openlib-journal-page .openlib_journal_identity_stack {
    width: 100% !important;
    max-width: 100% !important;
    pointer-events: auto !important;
  }
  html body.openlib-journal-page .openlib_journal_header__account .pkp_navigation_user {
    display: flex !important;
    align-items: center !important;
  }
}
