/* FEAT-000083 + FEAT-000084 + FEAT-000086
   Shared layering, fact-date wrapping, and context-aware compact Sources layout. */

/* F83: page-filter popovers must sit above every cloned/sticky table header,
   while the site header remains the top page chrome. */
.local-filters{z-index:300!important;overflow:visible!important}
.local-filters .filter-anchor{z-index:310!important}
.local-filters .filter-popover{z-index:320!important}
.dfh-sticky-header-viewport,
.people-sticky-overlay,
.facts-sticky-overlay{z-index:240!important}

/* F84: long historical dates/ranges wrap inside Date instead of crossing into People. */
#searchTable td.fact-date-cell{
  white-space:normal!important;
  overflow-wrap:anywhere;
  word-break:normal;
  line-height:1.3;
}

/* F86: one compact Research context column only where the family/root level
   actually uses it; child-only context may stay inside Details. */
#page-sources .source-directory-table .source-context-col{
  min-width:220px;
  max-width:260px;
  white-space:normal!important;
  overflow-wrap:anywhere;
  line-height:1.3;
}
.source-context-lines{display:grid;gap:4px;min-width:0}
.source-context-line{min-width:0;overflow-wrap:anywhere}
.source-context-label{
  display:inline;
  margin-right:4px;
  font:700 10px/1.25 Arial,sans-serif;
  color:#526676;
  text-transform:uppercase;
  letter-spacing:.03em;
}
.source-inline-context{
  margin-top:6px;
  padding-top:5px;
  border-top:1px solid #e5e9ed;
  color:#405466;
}

/* Compact Sources geometry. Prefer vertical wrapping to wide horizontal tables. */
#page-sources .source-directory-table .expander-head,
#page-sources .source-directory-table .expander-cell{
  width:40px!important;min-width:40px!important;max-width:40px!important;
}
#page-sources .source-directory-table .frozen-primary{
  width:280px!important;min-width:280px!important;max-width:280px!important;
  white-space:normal!important;overflow-wrap:anywhere;
}
#page-sources .source-directory-table .source-author-col{
  width:150px!important;min-width:150px!important;max-width:170px!important;
  white-space:normal!important;overflow-wrap:anywhere;
}
#page-sources .source-directory-table .source-pub-col{
  width:72px!important;min-width:72px!important;max-width:72px!important;
  white-space:normal!important;
}
#page-sources .source-directory-table .source-level-col{
  width:92px!important;min-width:92px!important;max-width:105px!important;
  white-space:normal!important;overflow-wrap:anywhere;
}
#page-sources .source-directory-table .source-details-col{
  width:165px!important;min-width:165px!important;max-width:220px!important;
  white-space:normal!important;overflow-wrap:anywhere;line-height:1.3;
}
#page-sources .source-directory-table .source-fact-col{
  width:130px!important;min-width:130px!important;max-width:155px!important;
  white-space:normal!important;
}
#page-sources .source-directory-table .source-actions-col{
  width:190px!important;min-width:190px!important;max-width:220px!important;
  white-space:normal!important;
}
#page-sources .source-actions{gap:4px!important;flex-wrap:wrap!important}
#page-sources .source-actions .action-btn{
  padding:5px 6px!important;
  white-space:normal!important;
  line-height:1.15;
}

/* BKS is the widest routine family: keep it inside a normal desktop viewport. */
[data-source-family-section="BKS"] .source-directory-table{
  min-width:1160px!important;
}
[data-source-family-section="BKS"] .source-directory-table .frozen-primary{
  width:300px!important;min-width:300px!important;max-width:300px!important;
}
[data-source-family-section="BKS"] .source-directory-table .source-author-col{
  width:175px!important;min-width:175px!important;max-width:175px!important;
}
[data-source-family-section="BKS"] .source-directory-table .source-level-col{
  width:80px!important;min-width:80px!important;max-width:80px!important;
}
[data-source-family-section="BKS"] .source-directory-table .source-details-col{
  width:160px!important;min-width:160px!important;max-width:160px!important;
}
[data-source-family-section="BKS"] .source-directory-table .source-fact-col{
  width:125px!important;min-width:125px!important;max-width:125px!important;
}
[data-source-family-section="BKS"] .source-directory-table .source-actions-col{
  width:210px!important;min-width:210px!important;max-width:210px!important;
}

/* THS gains governed research context, so reclaim width from bibliographic columns. */
[data-source-family-section="THS"] .source-directory-table{
  min-width:1240px!important;
}
[data-source-family-section="THS"] .source-directory-table .frozen-primary{
  width:285px!important;min-width:285px!important;max-width:285px!important;
}
[data-source-family-section="THS"] .source-directory-table .source-author-col{
  width:150px!important;min-width:150px!important;max-width:150px!important;
}
[data-source-family-section="THS"] .source-directory-table .source-context-col{
  width:220px!important;min-width:220px!important;max-width:220px!important;
}
[data-source-family-section="THS"] .source-directory-table .source-actions-col{
  width:185px!important;min-width:185px!important;max-width:185px!important;
}

/* Find sources is heterogeneous: keep research context inside Details instead
   of adding another universal physical column. */
#page-sources .source-search-table{
  min-width:1240px!important;
}
#page-sources .source-search-table .frozen-primary,
#page-sources .source-search-table th:first-child,
#page-sources .source-search-table td:first-child{
  width:300px!important;min-width:300px!important;max-width:300px!important;
}
#page-sources .source-search-table th:nth-child(2),
#page-sources .source-search-table td:nth-child(2){
  width:160px!important;min-width:160px!important;max-width:160px!important;
  white-space:normal!important;
}
#page-sources .source-search-table th:nth-child(3),
#page-sources .source-search-table td:nth-child(3){
  width:140px!important;min-width:140px!important;max-width:140px!important;
  white-space:normal!important;overflow-wrap:anywhere;
}
#page-sources .source-search-table th:nth-child(4),
#page-sources .source-search-table td:nth-child(4){
  width:230px!important;min-width:230px!important;max-width:230px!important;
  white-space:normal!important;overflow-wrap:anywhere;
}
#page-sources .source-search-table th:nth-child(5),
#page-sources .source-search-table td:nth-child(5){
  width:100px!important;min-width:100px!important;max-width:100px!important;
  white-space:normal!important;
}
#page-sources .source-search-table th:nth-child(6),
#page-sources .source-search-table td:nth-child(6){
  width:130px!important;min-width:130px!important;max-width:130px!important;
  white-space:normal!important;
}
#page-sources .source-search-table th:last-child,
#page-sources .source-search-table td:last-child{
  width:180px!important;min-width:180px!important;max-width:180px!important;
  white-space:normal!important;
}
