/**
 * Market filter strip above a content table (#410). Behaviour and the reasons
 * for it: assets/js/table-market-filter.js and inc/table-market-filter.php.
 *
 * The pill itself is the filter bar's `.pfg-fbar__filterbtn`, loaded as this
 * sheet's dependency, and the selected chip is its `.is-set`: accent tint,
 * border and label, no solid fill, so the market dot stays visible. This file
 * adds only what a pill on its own does not have: the strip, the dot, the
 * count, and the dashed state for a market with no rows.
 */

/* Without script the chips cannot do anything, so they are not shown. The
   script adds .is-ready once the strip is built and wired. */
[data-market-filter]:not(.is-ready) {
	display: none;
}

.pfg-mfilter {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0 0 14px;
}

/* A label belongs on the edge of the thing it labels. Page and hub bodies
   cap prose at the document column but give a table the full container, so
   a strip at the column's edge would sit hundreds of pixels in from the
   table under it. Same release the column grants a table. */
.wp-block-post-content > [data-market-filter].pfg-mfilter {
	max-width: none;
	margin-inline: 0;
}

/* A <button> does not inherit type or colour from the page; the toplist's
   pills are <summary> and never needed this. */
.pfg-mfilter__chip {
	font-family: inherit;
	color: var(--wp--preset--color--text-1, #F2F3F8);
	transition: border-color 150ms ease;
}

.pfg-mfilter__chip:not(.is-set):not(:disabled):hover {
	border-color: var(--border-strong, rgba(255, 255, 255, 0.14));
}

/* A market is identified by a dot, never by painting the chip. */
.pfg-mfilter__dot {
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	/* Any market without an accent of its own. Stocks has one since 13 Oct
	   (coral, #385); this grey is for a market nobody has coloured yet. */
	background: var(--wp--preset--color--text-4, #838A9D);
}

.pfg-mfilter__dot--forex {
	background: var(--v-forex, #B14BFF);
}

.pfg-mfilter__dot--futures {
	background: var(--v-futures, #E6FF00);
}

.pfg-mfilter__dot--crypto {
	background: var(--v-crypto, #00F0D0);
}

.pfg-mfilter__dot--stocks {
	background: var(--v-stocks, #FF6B8B);
}

.pfg-mfilter__count {
	color: var(--wp--preset--color--text-3, #979CAD);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* No rows for this market: shown, dashed, legible, not pressable. The same
   treatment the filter bar gives an option the catalogue cannot fill. */
.pfg-mfilter__chip.is-empty {
	border-style: dashed;
	cursor: not-allowed;
}

.pfg-mfilter__chip.is-empty .pfg-fbar__filtervalue,
.pfg-mfilter__chip.is-empty .pfg-mfilter__count {
	color: var(--wp--preset--color--text-4, #838A9D);
}

.pfg-mfilter__status {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Theme table rules may set display on rows; a hidden row stays hidden. */
table[data-market-ready] tr[hidden] {
	display: none !important;
}

@media (prefers-reduced-motion: reduce) {
	.pfg-mfilter__chip {
		transition: none;
	}
}
