/* ==========================================================================
   Colitco — data post type components
   Companies, commodities, market instruments and videos.
   ========================================================================== */

/* Change badge ------------------------------------------------------------ */

.change {
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.change--up { color: var(--positive); }
.change--down { color: var(--negative); }

.price-headline {
	display: flex;
	align-items: baseline;
	gap: 0.75rem;
}

.price-headline b {
	font-size: 1.875rem;
}

/* Entity cards ------------------------------------------------------------ */

.entity-grid {
	display: grid;
	gap: 0.75rem;
}

@media (min-width: 768px) {
	.entity-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.entity-card {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1rem;
}

.entity-card__overlay {
	position: absolute;
	inset: 0;
	z-index: 0;
	border-radius: inherit;
}

.entity-card__name {
	font-size: 0.875rem;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.entity-card__meta {
	margin-top: 0.125rem;
	font-size: 0.6875rem;
	color: var(--muted-foreground);
}

.entity-card__quote {
	flex-shrink: 0;
	text-align: right;
}

.entity-card__price {
	font-size: 0.875rem;
	font-weight: 600;
}

.watch {
	position: relative;
	z-index: 10;
	color: var(--muted-foreground);
}

.watch.is-watched { color: var(--accent); }

/* Commodity and market cards ---------------------------------------------- */

.commodity-grid,
.market-grid {
	display: grid;
	gap: 1rem;
}

@media (min-width: 640px) {
	.commodity-grid,
	.market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
	.commodity-grid,
	.market-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.commodity-card,
.market-card {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	min-width: 0;
	padding: 1rem;
	transition: border-color 0.15s ease;
}

.commodity-card:hover,
.market-card:hover {
	border-color: var(--accent);
	color: inherit;
}

.commodity-card__name,
.market-card__name {
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--muted-foreground);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.commodity-card__row,
.market-card__row {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 0.5rem;
}

.commodity-card__row b,
.market-card__row b {
	font-size: 1.25rem;
}

.commodity-card__unit {
	font-size: 0.625rem;
	color: var(--muted-foreground);
}

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

.table-wrap {
	overflow-x: auto;
}

.data-table {
	width: 100%;
	min-width: 620px;
	border-collapse: collapse;
	text-align: left;
}

.data-table thead tr {
	border-bottom: 1px solid var(--border);
}

.data-table th[scope="col"] {
	padding: 0.75rem 1rem;
	font-size: 0.625rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--muted-foreground);
}

.data-table tbody tr {
	border-bottom: 1px solid var(--border);
	transition: background-color 0.15s ease;
}

.data-table tbody tr:last-child { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--secondary); }

.data-table td,
.data-table th[scope="row"] {
	padding: 0.75rem 1rem;
	font-size: 0.75rem;
}

.data-table th[scope="row"] {
	font-weight: 600;
}

.data-table .is-right {
	text-align: right;
}

/* The directory shows a table on desktop and cards on mobile. */
.company-cards { display: grid; }
.company-table { display: none; }

@media (min-width: 768px) {
	.company-table { display: block; }
	.company-cards { display: none; }
}

/* Statistics grid --------------------------------------------------------- */

.stat-grid {
	padding: 1.25rem 1.25rem 1.5rem;
}

.stat-grid__list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem 1.5rem;
	margin: 1rem 0 0;
}

@media (min-width: 640px) {
	.stat-grid__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.stat-grid__list dt {
	font-size: 0.625rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--muted-foreground);
}

.stat-grid__list dd {
	margin: 0.25rem 0 0;
	font-size: 0.875rem;
	font-weight: 600;
}

.sector-list {
	display: grid;
	gap: 0.5rem;
	margin-top: 1rem;
}

@media (min-width: 640px) {
	.sector-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.sector-list__row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 0.75rem;
	padding-block: 0.5rem;
	border-bottom: 1px solid var(--border);
	font-size: 0.75rem;
	font-weight: 600;
}

/* Entity overview panel --------------------------------------------------- */

.entity-overview {
	padding: 1.25rem 1.5rem 1.5rem;
}

.entity-overview__body {
	margin-top: 0.75rem;
	max-width: 80ch;
	font-size: 0.875rem;
	line-height: 1.6;
	color: var(--secondary-foreground);
}

.entity-overview__body > * + * { margin-top: 1rem; }

/* Filter bar -------------------------------------------------------------- */

.filter-bar {
	display: grid;
	gap: 0.75rem;
	align-items: end;
}

@media (min-width: 768px) {
	.filter-bar { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

.filter-bar label {
	display: block;
	margin-bottom: 0.25rem;
	font-size: 0.625rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--muted-foreground);
}

.filter-bar select,
.filter-bar input[type="search"] {
	min-height: 2.5rem;
	font-size: 0.75rem;
	font-weight: 600;
}

.filter-bar__actions {
	display: flex;
	gap: 0.5rem;
}

/* Edition tabs and chips -------------------------------------------------- */

.edition-tabs {
	display: flex;
	gap: 0.25rem;
	overflow-x: auto;
	border-bottom: 1px solid var(--border);
}

.edition-tabs__tab {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	padding: 0 1rem;
	border-bottom: 2px solid transparent;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--muted-foreground);
	white-space: nowrap;
}

.edition-tabs__tab.is-active {
	border-bottom-color: var(--accent);
	color: var(--accent);
}

.chip-row {
	display: flex;
	gap: 0.5rem;
	overflow-x: auto;
	padding-block: 0.25rem;
}

.chip-row .topic-chip { flex-shrink: 0; }

.topic-chip.is-active {
	border-color: var(--accent);
	color: var(--accent);
}

/* Videos ------------------------------------------------------------------ */

.video-grid {
	display: grid;
	gap: 1.5rem;
}

@media (min-width: 640px) {
	.video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
	.video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.video-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.video-card__overlay {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.video-thumb {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: calc(var(--radius) - 2px);
}

.video-thumb img {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.video-thumb__empty {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: var(--secondary);
}

.video-thumb__play {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	background: color-mix(in oklab, var(--primary) 25%, transparent);
	transition: background-color 0.15s ease;
}

.video-card:hover .video-thumb__play {
	background: color-mix(in oklab, var(--primary) 40%, transparent);
}

.video-thumb__play-inner {
	display: grid;
	place-items: center;
	width: 3rem;
	height: 3rem;
	border-radius: 999px;
	background: color-mix(in oklab, var(--card) 90%, transparent);
	color: var(--primary);
}

.video-thumb__play-inner .icon {
	width: 1.25rem;
	height: 1.25rem;
	fill: currentColor;
}

.video-thumb__duration {
	position: absolute;
	right: 0.5rem;
	bottom: 0.5rem;
	padding: 0.125rem 0.375rem;
	border-radius: 0.25rem;
	background: color-mix(in oklab, var(--primary) 85%, transparent);
	color: var(--primary-foreground);
	font-size: 0.625rem;
	font-weight: 700;
}

.video-card__title {
	margin-top: 0.25rem;
	font-family: var(--font-editorial);
	font-weight: 400;
	font-size: 1.1875rem;
	line-height: 1.18;
	transition: color 0.15s ease;
}

.video-card--lg .video-card__title { font-size: 1.75rem; }
.video-card:hover .video-card__title { color: var(--accent); }

.video-card__date {
	margin-top: 0.25rem;
	font-size: 0.6875rem;
	color: var(--muted-foreground);
}

.video-detail { overflow: hidden; }

.video-embed {
	position: relative;
	aspect-ratio: 16 / 9;
	background: var(--primary);
}

.video-embed iframe,
.video-embed video,
.video-embed img {
	width: 100%;
	height: 100%;
	border: 0;
	object-fit: cover;
}

.video-detail__body {
	display: grid;
	gap: 1rem;
	padding: 1.5rem;
}

.video-detail__summary {
	max-width: 80ch;
	font-size: 0.875rem;
	line-height: 1.6;
	color: var(--secondary-foreground);
}

.video-detail__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border);
	font-size: 0.75rem;
	color: var(--secondary-foreground);
}

/* Delayed data notice ----------------------------------------------------- */

.data-disclaimer {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	font-size: 0.6875rem;
	line-height: 1.4;
	color: var(--muted-foreground);
}

.data-disclaimer__stamp {
	font-weight: 600;
	color: var(--secondary-foreground);
}

.quote-stale {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.125rem 0.375rem;
	border: 1px solid var(--border);
	border-radius: 0.25rem;
	font-size: 0.625rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--muted-foreground);
}
