/**
 * B&B Instrument Register — table and flag styling.
 *
 * Reuses the colour tokens defined in bb-library.css (both stylesheets load
 * on the same page, this one enqueued after at priority 999) rather than
 * redefining them, so the register matches the citation apparatus in both
 * themes without a second token block to keep in sync by hand. Fallback
 * values are given for each var() in case this file is ever loaded alone.
 */

.bb-instrument-register,
.bb-numbering-series {
	width: 100%;
	border-collapse: collapse;
	margin: 1.6rem 0;
	font-size: 0.92rem;
	line-height: 1.4;
	/* Eight columns (six for the numbering series) do not fit a 390px
	   viewport no matter how the text wraps — the browser's table layout
	   will not shrink a column below its content's min-content width. Left
	   alone that stretches the table itself past the viewport with no
	   containing element to catch it, which drags the whole page into
	   horizontal scroll (the same failure mode bb-census.css's
	   .bb-census__table already guards against with this exact pattern).
	   display:block turns the table into a block-level scroll container of
	   its own, so the overflow stops here instead of at the page body. */
	display: block;
	overflow-x: auto;
}

.bb-instrument-register th,
.bb-instrument-register td,
.bb-numbering-series th,
.bb-numbering-series td {
	padding: 0.5em 0.7em;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid var(--bb-rule, #e3ded5);
}

.bb-instrument-register thead th,
.bb-numbering-series thead th {
	font-size: 0.7rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--bb-muted, #79726b);
	border-bottom: 2px solid var(--bb-rule, #e3ded5);
}

.bb-instrument-register tbody tr:last-child td,
.bb-numbering-series tbody tr:last-child td {
	border-bottom: none;
}

/* --- sortable column headers (instrument_register only) --- */

.bb-sortable thead th {
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
}

.bb-sortable thead th:hover {
	color: var(--bb-accent, #8c3a22);
}

.bb-sortable thead th[data-dir="asc"]::after {
	content: " \25B2";
	font-size: 0.8em;
}

.bb-sortable thead th[data-dir="desc"]::after {
	content: " \25BC";
	font-size: 0.8em;
}

/* --- honesty markers --- */

/* Owner-submitted rows: visible on sight, never quietly folded in with
   documented ones. */
.bb-owner-submitted {
	background: var(--bb-flag-bg, #f8f1e2);
}

.bb-flag {
	display: inline-block;
	font-size: 0.85em;
	font-weight: 600;
	padding: 0.05em 0.5em;
	border-radius: 3px;
	white-space: nowrap;
}

.bb-flag--owner {
	color: var(--bb-flag, #8a5a1f);
	background: var(--bb-flag-bg, #f8f1e2);
}

/* The monotonicity break is the reason numbering_series exists — it gets the
   loudest marker on the page, the same treatment bb-library.css gives a
   missing source. */
.bb-flag--inversion {
	color: var(--bb-miss, #8c2f2f);
	background: var(--bb-miss-bg, #f9ecec);
}

.bb-inversion {
	background: var(--bb-miss-bg, #f9ecec);
}

.bb-inversion td {
	color: var(--bb-miss, #8c2f2f);
}

.bb-instrument-register .bb-nosource,
.bb-numbering-series .bb-nosource {
	color: var(--bb-miss, #8c2f2f);
	font-size: 0.9em;
}

.bb-instrument-register .bb-caveat {
	display: inline-block;
	color: var(--bb-flag, #8a5a1f);
	margin-left: 0.4em;
}

.bb-instrument-register .bb-caveat::before {
	content: "— ";
}

.bb-empty {
	color: var(--bb-muted, #79726b);
	font-style: italic;
}

@media print {

	.bb-sortable thead th[data-dir]::after {
		content: "";
	}

	.bb-inversion {
		background: none;
		outline: 1px solid var(--bb-miss, #8c2f2f);
	}
}

/* --- evidence figures --- */

/* A label facsimile attached to an instrument record is a citation, not an
   illustration, and its caption is the provenance line that makes it one.
   The markup is a stock core image block carrying this one class — nothing
   plugin-side renders it — so a general image-attachment mechanism can adopt
   the class or replace the block without touching PHP here. Caption colour is
   the same --bb-soft the citation apparatus uses: 8.9:1 on the light ground,
   and the token pair keeps it above 4.5:1 in the dark theme too. */
.bb-evidence-figure img {
	max-width: 100%;
	height: auto;
	border: 1px solid var(--bb-rule, #e3ded5);
}

.bb-evidence-figure figcaption {
	margin-top: 0.6rem;
	font-size: 0.9rem;
	line-height: 1.55;
	color: var(--bb-soft, #4a443d);
	text-align: left;
}

/* A caveat sits in its own full-width row beneath the entry it qualifies,
   because prose in a narrow table cell wraps to one word per line. */
.bb-instrument-note td {
	padding-top: 0;
	padding-bottom: 0.9rem;
	border-top: 0;
	font-size: 0.9em;
	line-height: 1.5;
}

.bb-instrument-register td {
	vertical-align: top;
}
