/* Open Library: reliable sticky search + small visual fixes. Loaded last. */
:root{
  --ols-red:#DC2626;
  --ols-header-h:0px;
  --ols-search-left:0px;
  --ols-search-width:100%;
}

/* The portal header stays clean/white; a stronger red top accent keeps it identifiable. */
html body.openlib-site-index .openlib_site_header{
  border-top:3px solid var(--ols-red) !important;
}

/* JS uses fixed positioning because OJS parent overflow can defeat position:sticky. */
html body.openlib-site-index .openlib_search_panel--primary{
  box-sizing:border-box !important;
}
html body.openlib-site-index .openlib_search_sticky_placeholder{
  display:none;
  width:100%;
  margin:0;
  padding:0;
  border:0;
}
html body.openlib-site-index.openlib-search-is-fixed .openlib_search_sticky_placeholder{
  display:block;
}
html body.openlib-site-index.openlib-search-is-fixed .openlib_search_panel--primary{
  position:fixed !important;
  top:calc(var(--ols-header-h) + 10px) !important;
  left:var(--ols-search-left) !important;
  right:auto !important;
  z-index:1290 !important;
  width:var(--ols-search-width) !important;
  max-width:none !important;
  margin:0 !important;
  background:rgba(255,255,255,.98) !important;
  border-color:#FCA5A5 !important;
  box-shadow:0 10px 28px rgba(15,23,42,.11) !important;
  -webkit-backdrop-filter:blur(10px) !important;
  backdrop-filter:blur(10px) !important;
}
html[data-openlib-color-mode="dark"] body.openlib-site-index.openlib-search-is-fixed .openlib_search_panel--primary{
  background:rgba(17,24,39,.98) !important;
  border-color:#7F1D1D !important;
  box-shadow:0 10px 28px rgba(0,0,0,.30) !important;
}

/* Avoid the old sticky rule fighting the fixed state. */
html body.openlib-site-index:not(.openlib-search-is-fixed) .openlib_search_panel--primary{
  position:relative !important;
  top:auto !important;
}

/* Page-range chip already contains an inline book icon. Remove the older generated one. */
html body.openlib-journal-page .obj_article_summary .openlib_article_pages_action .pages::before{
  content:none !important;
  display:none !important;
}

@media(max-width:700px){
  html body.openlib-site-index.openlib-search-is-fixed .openlib_search_panel--primary{
    top:calc(var(--ols-header-h) + 6px) !important;
  }
}
