/* Crypto Pulse Widgets — front-end styles */

.cryptopulse {
	--cryptopulse-accent: #16c784;
	--cryptopulse-down-color: #ea3943;
	--cryptopulse-bg: #ffffff;
	--cryptopulse-border: rgba(128, 128, 128, 0.25);
	box-sizing: border-box;
	font-variant-numeric: tabular-nums;
	line-height: 1.4;
}

.cryptopulse *,
.cryptopulse *::before,
.cryptopulse *::after {
	box-sizing: inherit;
}

.cryptopulse-icon {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	vertical-align: -4px;
	margin-right: 6px;
}

.cryptopulse-symbol {
	font-weight: 600;
	opacity: 0.75;
	font-size: 0.85em;
	letter-spacing: 0.03em;
}

.cryptopulse-price {
	font-weight: 700;
}

.cryptopulse-change {
	font-size: 0.85em;
	font-weight: 600;
	white-space: nowrap;
}

.cryptopulse-change.cryptopulse-up {
	color: var(--cryptopulse-accent);
}

.cryptopulse-change.cryptopulse-down {
	color: var(--cryptopulse-down-color);
}

.cryptopulse-empty {
	padding: 8px 12px;
	font-size: 0.9em;
	opacity: 0.7;
}

/* ----- Ticker ----- */

.cryptopulse-ticker {
	overflow: hidden;
	white-space: nowrap;
	border: 1px solid var(--cryptopulse-border);
	border-radius: 8px;
	padding: 10px 0;
	position: relative;
}

.cryptopulse-ticker__track {
	display: inline-flex;
	will-change: transform;
	animation: cryptopulse-scroll var(--cryptopulse-duration, 40s) linear infinite;
}

.cryptopulse-ticker:hover .cryptopulse-ticker__track {
	animation-play-state: paused;
}

.cryptopulse-ticker__group {
	display: inline-flex;
	flex-shrink: 0;
}

.cryptopulse-ticker__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0 22px;
	border-right: 1px solid var(--cryptopulse-border);
}

@keyframes cryptopulse-scroll {
	to {
		transform: translateX(-50%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cryptopulse-ticker__track {
		animation: none;
	}
}

/* ----- Cards ----- */

.cryptopulse-cards {
	display: grid;
	grid-template-columns: repeat(var(--cryptopulse-columns, 3), minmax(0, 1fr));
	gap: 16px;
}

@media (max-width: 782px) {
	.cryptopulse-cards {
		grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	}
}

.cryptopulse-card {
	border: 1px solid var(--cryptopulse-border);
	border-radius: 12px;
	padding: 16px;
	background: var(--cryptopulse-bg);
	background: color-mix(in srgb, currentColor 3%, transparent);
}

.cryptopulse-card__head {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-bottom: 8px;
}

.cryptopulse-card__name {
	font-weight: 600;
}

.cryptopulse-card__price {
	font-size: 1.4em;
	margin-bottom: 6px;
}

.cryptopulse-card__meta {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px;
}

.cryptopulse-card__cap {
	font-size: 0.8em;
	opacity: 0.65;
}

/* ----- Table ----- */

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

.cryptopulse-table {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
}

.cryptopulse-table th,
.cryptopulse-table td {
	padding: 10px 12px;
	text-align: left;
	border-bottom: 1px solid var(--cryptopulse-border);
	white-space: nowrap;
}

.cryptopulse-table th {
	font-size: 0.8em;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	opacity: 0.7;
}

.cryptopulse-table__rank {
	opacity: 0.6;
	font-size: 0.85em;
}

/* ----- Inline label ----- */

.cryptopulse-label {
	display: inline-flex;
	align-items: baseline;
	gap: 5px;
}

/* ----- Widget list ----- */

ul.cryptopulse-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cryptopulse-list__item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 0;
	border-bottom: 1px solid var(--cryptopulse-border);
}

.cryptopulse-list__item:last-child {
	border-bottom: none;
}

.cryptopulse-list__right {
	margin-left: auto;
	display: flex;
	align-items: baseline;
	gap: 8px;
	text-align: right;
}

/* Flash on live price update */

.cryptopulse-price.cryptopulse-flash {
	animation: cryptopulse-flash 0.8s ease-out;
}

@keyframes cryptopulse-flash {
	0% {
		color: var(--cryptopulse-accent);
	}
}
