/* Open Library Publications — Red Dominant Polish — 2026-08-28 v2
 * Final UI polish loaded after all previous theme layers.
 * 1) Keep the floating/sticky global search visibly red.
 * 2) Separate Register from Login instead of showing two plain adjacent links.
 * 3) Keep the utility bar red in both light and dark mode.
 */

:root {
  --olp-red-deep: #86141c;
  --olp-red: #d8202a;
  --olp-red-bright: #ef3d46;
  --olp-red-soft: #fff1f2;
}

/* --------------------------------------------------------------------------
   Sticky/floating portal search: preserve the red frame when detached
   -------------------------------------------------------------------------- */
html body.openlib-site-index.openlib-search-is-fixed .openlib_search_panel--primary,
html[data-openlib-color-mode="dark"] body.openlib-site-index.openlib-search-is-fixed .openlib_search_panel--primary {
  overflow: hidden !important;
  padding: 10px !important;
  border: 1px solid rgba(255,255,255,.24) !important;
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 92% -80%, rgba(255,255,255,.22), transparent 18rem),
    linear-gradient(105deg, var(--olp-red-deep) 0%, #b51a24 46%, var(--olp-red-bright) 100%) !important;
  box-shadow: 0 16px 38px rgba(110, 18, 26, .24) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

html body.openlib-site-index.openlib-search-is-fixed .openlib_search_panel--primary:before {
  position: absolute !important;
  inset: 0 !important;
  z-index: 0 !important;
  border-radius: inherit !important;
  background: linear-gradient(90deg, rgba(255,255,255,.08), transparent 22%, transparent 78%, rgba(255,255,255,.08)) !important;
  content: "" !important;
  pointer-events: none !important;
}

html body.openlib-site-index.openlib-search-is-fixed .openlib_search_panel--primary .openlib_discovery__form {
  position: relative !important;
  z-index: 2 !important;
}

/* A little more red remains visible on the left/right edges while floating. */
html body.openlib-site-index.openlib-search-is-fixed .openlib_discovery__query,
html body.openlib-site-index.openlib-search-is-fixed .openlib_discovery__form > select,
html body.openlib-site-index.openlib-search-is-fixed .openlib_discovery__form > button {
  min-width: 0 !important;
  border-radius: 11px !important;
}

/* --------------------------------------------------------------------------
   Utility header: red in every color mode, never the old black/navy strip
   -------------------------------------------------------------------------- */
html body .openlib_site_header__utility,
html[data-openlib-color-mode="dark"] body .openlib_site_header__utility,
html body.openlib-journal-page .openlib_journal_header__utility,
html[data-openlib-color-mode="dark"] body.openlib-journal-page .openlib_journal_header__utility {
  border: 0 !important;
  background:
    radial-gradient(circle at 78% -180%, rgba(255,255,255,.20), transparent 20rem),
    linear-gradient(105deg, #781119 0%, #a81721 48%, #d92731 100%) !important;
  color: #fff !important;
}

html body .openlib_site_header__utility_inner,
html body .openlib_journal_header__utility_inner {
  min-height: 38px !important;
}

/* Login is a compact translucent action in the red utility strip. */
html body .openlib_utility_login {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  min-height: 28px !important;
  padding: 0 11px !important;
  border: 1px solid rgba(255,255,255,.28) !important;
  border-radius: 9px !important;
  background: rgba(255,255,255,.09) !important;
  color: #fff !important;
  font-size: 12px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07) !important;
  transition: background .16s ease, border-color .16s ease, transform .16s ease !important;
}

html body .openlib_utility_login:hover,
html body .openlib_utility_login:focus {
  border-color: rgba(255,255,255,.56) !important;
  background: rgba(255,255,255,.17) !important;
  color: #fff !important;
  text-decoration: none !important;
  transform: translateY(-1px) !important;
}

/* Theme toggle uses the same quiet glass treatment. */
html body .openlib_site_header__utility .openlib_color_mode_toggle,
html body.openlib-journal-page .openlib_journal_header__utility .openlib_color_mode_toggle,
html[data-openlib-color-mode="dark"] body .openlib_site_header__utility .openlib_color_mode_toggle,
html[data-openlib-color-mode="dark"] body.openlib-journal-page .openlib_journal_header__utility .openlib_color_mode_toggle {
  border-color: rgba(255,255,255,.28) !important;
  background: rgba(255,255,255,.09) !important;
  color: #fff !important;
}

html body .openlib_site_header__utility .openlib_color_mode_toggle:hover,
html body.openlib-journal-page .openlib_journal_header__utility .openlib_color_mode_toggle:hover {
  border-color: rgba(255,255,255,.56) !important;
  background: rgba(255,255,255,.17) !important;
  color: #fff !important;
}

/* --------------------------------------------------------------------------
   Register is moved away from Login and becomes a clear primary CTA
   -------------------------------------------------------------------------- */
html body .openlib_header_register_cta {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-height: 38px !important;
  padding: 0 15px !important;
  border: 1px solid #d9232e !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #c61d27 0%, #e72c35 100%) !important;
  color: #fff !important;
  font-size: 12.5px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  box-shadow: 0 7px 18px rgba(177, 23, 33, .16) !important;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease !important;
}

html body .openlib_header_register_cta:hover,
html body .openlib_header_register_cta:focus {
  color: #fff !important;
  text-decoration: none !important;
  transform: translateY(-1px) !important;
  filter: brightness(.98) !important;
  box-shadow: 0 10px 22px rgba(177, 23, 33, .21) !important;
}

html body .openlib_site_header__main_inner {
  gap: 18px !important;
}

html body .openlib_site_nav_menu {
  margin-left: auto !important;
}

/* Journal header: Register lives with page actions, not beside Login. */
html body .openlib_journal_nav_actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 9px !important;
  margin-left: auto !important;
}

html body .openlib_header_register_cta--journal {
  min-height: 34px !important;
  padding: 0 12px !important;
  border-radius: 9px !important;
  font-size: 12px !important;
}

/* Logged-in account menu remains readable in the red strip. */
html body .openlib_site_header__utility .pkp_navigation_user > li > a,
html body.openlib-journal-page .openlib_journal_header__utility .pkp_navigation_user > li > a,
html[data-openlib-color-mode="dark"] body .openlib_site_header__utility .pkp_navigation_user > li > a,
html[data-openlib-color-mode="dark"] body.openlib-journal-page .openlib_journal_header__utility .pkp_navigation_user > li > a {
  color: rgba(255,255,255,.94) !important;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  html body .openlib_site_header__main_inner {
    padding-right: 96px !important;
  }

  html body .openlib_header_register_cta:not(.openlib_header_register_cta--journal) {
    position: absolute !important;
    top: 50% !important;
    right: 48px !important;
    min-width: 38px !important;
    width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 !important;
    transform: translateY(-50%) !important;
  }

  html body .openlib_header_register_cta:not(.openlib_header_register_cta--journal) span:last-child {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
  }

  html body .openlib_header_register_cta:not(.openlib_header_register_cta--journal):hover,
  html body .openlib_header_register_cta:not(.openlib_header_register_cta--journal):focus {
    transform: translateY(-50%) !important;
  }

  html body .openlib_journal_nav_actions {
    gap: 6px !important;
  }

  html body .openlib_header_register_cta--journal span:last-child {
    display: none !important;
  }

  html body .openlib_header_register_cta--journal {
    width: 34px !important;
    min-width: 34px !important;
    padding: 0 !important;
  }

  html body.openlib-site-index.openlib-search-is-fixed .openlib_search_panel--primary {
    padding: 8px !important;
    border-radius: 14px !important;
  }
}
