/* 2026-09-23 coordinated research-page polish */
:root{--dfh-sticky-table-top:0px}

/* Relationship rows: same compact label + bubbles treatment across expansions. */
.dfh-relation-value{display:flex;align-items:flex-start;gap:4px;flex-wrap:wrap;min-width:0}
.dfh-relation-value .tag{margin:0 3px 2px 0}

/* Page-owned vertical scrolling; horizontal scrolling stays with each table body. */
#page-people .table-viewport,
#page-places .table-viewport,
#page-sources .source-family-table-wrap,
#page-universities .universities-table-wrap{
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  overflow-x:auto!important;
  overflow-y:visible!important;
  overscroll-behavior-x:contain;
  overscroll-behavior-y:auto!important;
  scrollbar-gutter:stable;
}
/* Keep People on coordinated natural table height; Search retains its previous viewport. */
#page-people .table-viewport{min-height:0!important;max-height:none!important}

.dfh-sticky-composite{position:relative;max-width:100%;min-width:0;overflow:visible}
.dfh-sticky-header-viewport{
  position:sticky;
  top:var(--dfh-sticky-table-top);
  z-index:240;
  width:100%;
  max-width:100%;
  overflow:hidden;
  background:#fff;
}
.dfh-sticky-header-table{
  width:max-content;
  min-width:100%;
  border-collapse:separate;
  border-spacing:0;
  margin:0!important;
  transform:translateX(0);
  will-change:transform;
}
.dfh-sticky-header-table thead th{position:static!important;top:auto!important;box-sizing:border-box}
.dfh-sticky-header-table thead .expander-head,
.dfh-sticky-header-table thead .frozen-primary{position:relative!important;left:auto!important;will-change:transform}
.dfh-sticky-body-scroll{position:relative;z-index:1}

/* Keep EFP expansion anchored to the clicked reel rather than browser scroll anchoring. */
[data-source-family-section="EFP"] .source-family-table-wrap,
[data-source-family-section="EFP"] .source-directory-table,
[data-source-family-section="EFP"] tr{overflow-anchor:none}

/* Books + theses/dissertations: compress secondary columns so Actions remains visible. */
[data-source-family-section="BKS"] .source-directory-table,
[data-source-family-section="THS"] .source-directory-table{min-width:1180px;width:100%;table-layout:fixed}
[data-source-family-section="BKS"] .source-directory-table .expander-head,
[data-source-family-section="BKS"] .source-directory-table .expander-cell,
[data-source-family-section="THS"] .source-directory-table .expander-head,
[data-source-family-section="THS"] .source-directory-table .expander-cell{width:42px;min-width:42px;max-width:42px}
[data-source-family-section="BKS"] .source-directory-table .frozen-primary,
[data-source-family-section="THS"] .source-directory-table .frozen-primary{width:390px;min-width:390px;max-width:390px}
[data-source-family-section="BKS"] .source-directory-table .source-author-col,
[data-source-family-section="THS"] .source-directory-table .source-author-col{width:155px;min-width:155px;max-width:155px}
[data-source-family-section="BKS"] .source-directory-table .source-level-col,
[data-source-family-section="THS"] .source-directory-table .source-level-col{width:82px;min-width:82px;max-width:82px}
[data-source-family-section="BKS"] .source-directory-table .source-details-col,
[data-source-family-section="THS"] .source-directory-table .source-details-col{width:145px;min-width:145px;max-width:145px;white-space:normal;overflow-wrap:anywhere}
[data-source-family-section="BKS"] .source-directory-table .source-fact-col,
[data-source-family-section="THS"] .source-directory-table .source-fact-col{width:140px;min-width:140px;max-width:140px;white-space:normal}
[data-source-family-section="BKS"] .source-directory-table .source-actions-col,
[data-source-family-section="THS"] .source-directory-table .source-actions-col{width:226px;min-width:226px;max-width:226px;white-space:normal}
[data-source-family-section="BKS"] .source-actions,
[data-source-family-section="THS"] .source-actions{gap:4px}
[data-source-family-section="BKS"] .source-actions .action-btn,
[data-source-family-section="THS"] .source-actions .action-btn{padding:6px 7px;white-space:nowrap}

/* BKS browse table: denser rows and wider working columns.
   Keep Published intentionally narrow so long titles/credits/details/actions wrap less. */
[data-source-family-section="BKS"] .source-directory-table{min-width:1530px}
[data-source-family-section="BKS"] .source-directory-table .frozen-primary{
  width:455px!important;min-width:455px!important;max-width:455px!important;
}
[data-source-family-section="BKS"] .source-directory-table .source-author-col{
  width:220px!important;min-width:220px!important;max-width:220px!important;
}
[data-source-family-section="BKS"] .source-directory-table .source-pub-col{
  width:74px!important;min-width:74px!important;max-width:74px!important;
  padding-left:6px!important;padding-right:6px!important;
}
[data-source-family-section="BKS"] .source-directory-table .source-level-col{
  width:74px!important;min-width:74px!important;max-width:74px!important;
}
[data-source-family-section="BKS"] .source-directory-table .source-details-col{
  width:225px!important;min-width:225px!important;max-width:225px!important;
}
[data-source-family-section="BKS"] .source-directory-table .source-fact-col{
  width:130px!important;min-width:130px!important;max-width:130px!important;
}
[data-source-family-section="BKS"] .source-directory-table .source-actions-col{
  width:310px!important;min-width:310px!important;max-width:310px!important;
}
[data-source-family-section="BKS"] .source-directory-table tbody td{
  padding:5px 8px;
  line-height:1.22;
}
[data-source-family-section="BKS"] .source-directory-table tbody .expander-cell{
  padding:4px!important;
}
[data-source-family-section="BKS"] .source-directory-table .source-row-note{margin-top:1px;line-height:1.2}
[data-source-family-section="BKS"] .source-directory-table .source-status-badge{padding:1px 4px}
[data-source-family-section="BKS"] .source-actions{gap:4px;flex-wrap:nowrap}
[data-source-family-section="BKS"] .source-actions .action-btn{padding:4px 6px}

/* Sources sticky header: sit flush against the site header and mask any fractional-pixel
   seam so scrolling rows cannot peek above the table heading. */
#page-sources .dfh-sticky-header-viewport{
  top:calc(var(--dfh-sticky-table-top) - 2px);
  box-shadow:0 -2px 0 #fff;
}


/* People sticky overlay: preserve the real table structure and column geometry. */
#page-people #peopleTable thead th{
  position:static!important;
  top:auto!important;
}
.people-sticky-overlay{
  position:fixed;
  z-index:950;
  overflow:hidden;
  background:#fff;
  display:none;
  border-bottom:1px solid #9aa8b5;
}
.people-sticky-overlay.visible{display:block}
.people-sticky-overlay-table{
  width:max-content;
  min-width:0;
  border-collapse:separate;
  border-spacing:0;
  margin:0!important;
  font-family:Arial,sans-serif;
  font-size:13px;
  transform:translateX(0);
}
.people-sticky-overlay-table thead th{
  position:relative!important;
  left:auto!important;
  top:auto!important;
  z-index:auto!important;
  box-sizing:border-box;
  background:#e9eef2;
}
.people-sticky-overlay-table thead th:nth-child(1),
.people-sticky-overlay-table thead th:nth-child(2){
  z-index:2!important;
}
.people-sticky-overlay-table .col-resizer{display:none!important}


/* People uses the exact same header box model as Facts.
   Sortable THs have no padding; their button supplies the standard 9px/10px padding. */
#page-people #peopleTable thead th,
.people-sticky-overlay-table thead th{
  white-space:nowrap!important;
  line-height:normal!important;
}
#page-people #peopleTable thead th.sortable,
.people-sticky-overlay-table thead th.sortable{
  padding:0!important;
}
#page-people #peopleTable thead th:not(.sortable),
.people-sticky-overlay-table thead th:not(.sortable){
  padding:9px 10px!important;
}
#page-people #peopleTable .th-sort,
.people-sticky-overlay-table .th-sort{
  min-height:0!important;
  height:auto!important;
  padding:9px 10px!important;
  white-space:nowrap!important;
  line-height:normal!important;
}
.people-sticky-overlay{
  z-index:1001;
}


/* Facts sticky overlay: never moves the real THEAD or changes table geometry. */
.facts-sticky-overlay{
  position:fixed;
  z-index:1001;
  overflow:hidden;
  background:#fff;
  display:none;
  border-bottom:1px solid #9aa8b5;
}
.facts-sticky-overlay.visible{display:block}
.facts-sticky-overlay-table{
  width:max-content;
  min-width:0;
  border-collapse:separate;
  border-spacing:0;
  margin:0!important;
  font-family:Arial,sans-serif;
  font-size:13px;
  transform:translateX(0);
}
.facts-sticky-overlay-table thead th{
  position:relative!important;
  left:auto!important;
  top:auto!important;
  z-index:auto!important;
  box-sizing:border-box;
  background:#e9eef2;
}
.facts-sticky-overlay-table thead th:nth-child(1),
.facts-sticky-overlay-table thead th:nth-child(2){
  z-index:2!important;
}
.facts-sticky-overlay-table .col-resizer{display:none!important}


/* Mobile only: let the full site header and Research Context filters scroll out of
   the viewport so the page body can use the screen. Desktop sticky behavior is unchanged. */
@media (max-width:900px){
  .site-header{
    position:static!important;
    top:auto!important;
  }
  .context-strip{
    position:relative!important;
    top:auto!important;
  }
  :root{
    --dfh-sticky-table-top:0px;
  }
  .dfh-sticky-header-viewport,
  #page-sources .dfh-sticky-header-viewport{
    top:0!important;
  }
}
