/**
 * InveShares frontend styles.
 *
 * Loaded only on pages that actually contain an InveShares shortcode, so no
 * other page on the site pays for it.
 *
 * Deliberately restrained: it inherits the theme's fonts and colours rather
 * than imposing a look, so it sits inside whatever theme the site is running
 * instead of fighting it.
 *
 * @package InveShares
 */

.inveshares-fe {
	--ivs-fe-line: rgba(128, 128, 128, .25);
	--ivs-fe-muted: rgba(128, 128, 128, 1);
	--ivs-fe-up: #1a7f37;
	--ivs-fe-down: #b32d2e;
	--ivs-fe-accent: #2271b1;
	--ivs-fe-radius: 6px;

	font-size: 1rem;
	line-height: 1.6;
}

.inveshares-fe-header h2 {
	margin-bottom: .2em;
}

.inveshares-fe-sub,
.inveshares-fe-note {
	color: var(--ivs-fe-muted);
	font-size: .9em;
}

/* ----------------------------------------------------------------- tiles */

.inveshares-fe-tiles {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	margin: 1.5em 0;
}

.inveshares-fe-tile {
	border: 1px solid var(--ivs-fe-line);
	border-radius: var(--ivs-fe-radius);
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 14px 16px;
}

.inveshares-fe-tile-label {
	color: var(--ivs-fe-muted);
	font-size: .75em;
	letter-spacing: .05em;
	text-transform: uppercase;
}

.inveshares-fe-tile-value {
	font-size: 1.6em;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	line-height: 1.2;
}

.inveshares-fe-tile-note {
	color: var(--ivs-fe-muted);
	font-size: .8em;
}

/* ---------------------------------------------------------------- tables */

/* Wraps the table so a wide grid scrolls inside its own box rather than
   pushing the whole page sideways on a phone. */
.inveshares-fe-scroll {
	-webkit-overflow-scrolling: touch;
	margin: 1em 0;
	overflow-x: auto;
}

.inveshares-fe-table {
	border-collapse: collapse;
	width: 100%;
}

.inveshares-fe-table th,
.inveshares-fe-table td {
	border-bottom: 1px solid var(--ivs-fe-line);
	padding: 10px 12px;
	text-align: left;
}

.inveshares-fe-table th {
	color: var(--ivs-fe-muted);
	font-size: .78em;
	letter-spacing: .04em;
	text-transform: uppercase;
	white-space: nowrap;
}

.inveshares-fe-num {
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

.inveshares-fe-positive {
	color: var(--ivs-fe-up);
}

.inveshares-fe-negative {
	color: var(--ivs-fe-down);
}

.inveshares-fe-rs {
	background: var(--ivs-fe-accent);
	border-radius: 4px;
	color: #fff;
	display: inline-block;
	font-size: .85em;
	font-weight: 600;
	min-width: 2.4em;
	padding: 2px 6px;
	text-align: center;
}

.inveshares-fe-unrated {
	color: var(--ivs-fe-muted);
	font-size: .8em;
	font-style: italic;
}

/* -------------------------------------------------------- empty states */

.inveshares-fe-empty,
.inveshares-fe-pending {
	border: 1px dashed var(--ivs-fe-line);
	border-radius: var(--ivs-fe-radius);
	margin: 1em 0;
	padding: 18px 20px;
}

.inveshares-fe-pending {
	border-style: solid;
	border-left-width: 3px;
	border-left-color: var(--ivs-fe-accent);
}

.inveshares-fe-empty p:last-child,
.inveshares-fe-pending p:last-child {
	margin-bottom: 0;
}

.inveshares-fe-disclaimer {
	border-top: 1px solid var(--ivs-fe-line);
	color: var(--ivs-fe-muted);
	font-size: .82em;
	margin-top: 2em;
	padding-top: 1em;
}

/* ------------------------------------------------------- filters, pages */

.inveshares-fe-filters {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 1em 0;
}

.inveshares-fe-filters label {
	color: var(--ivs-fe-muted);
	font-size: .85em;
}

.inveshares-fe-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 1em 0;
}

.inveshares-fe-page {
	border: 1px solid var(--ivs-fe-line);
	border-radius: 4px;
	display: inline-block;
	min-width: 2.2em;
	padding: 4px 8px;
	text-align: center;
	text-decoration: none;
}

.inveshares-fe-page.current {
	background: var(--ivs-fe-accent);
	border-color: var(--ivs-fe-accent);
	color: #fff;
}

/* ------------------------------------------------------------ a11y */

.inveshares-fe :focus-visible {
	outline: 2px solid var(--ivs-fe-accent);
	outline-offset: 2px;
}

@media screen and (max-width: 600px) {
	.inveshares-fe-tiles {
		grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	}

	.inveshares-fe-table th,
	.inveshares-fe-table td {
		padding: 8px;
	}

	.inveshares-fe-filters input {
		flex: 1 1 100%;
	}
}
