/**
 * CryptoFrame Crypto Markets — table, ticker and widget styles.
 */

/* -------------------------------------------------------------------------
 * Market table
 * ---------------------------------------------------------------------- */

.cfxcm-table-wrap {
	width: 100%;
}

.cfxcm-table__toolbar {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
	margin-bottom: 0.75rem;
}

.cfxcm-table__filter {
	flex: 1 1 12rem;
	max-width: 22rem;
}

.cfxcm-table__count {
	margin: 0;
	color: var(--cfxcm-muted, #6b7280);
	font-size: var(--cfx-fs-xs, 0.8125rem);
	white-space: nowrap;
}

/* A horizontally scrollable region needs to be focusable so it can be reached
   and scrolled from the keyboard. */
.cfxcm-table__scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.cfxcm-table__scroll:focus-visible {
	outline: 2px solid var(--cfxcm-accent, #2563eb);
	outline-offset: 2px;
}

.cfxcm-table {
	width: 100%;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.cfxcm-table__th {
	padding: 0.5rem 0.75rem;
	border-bottom: 2px solid var(--cfxcm-border, rgba(0, 0, 0, 0.1));
	color: var(--cfxcm-muted, #6b7280);
	font-size: var(--cfx-fs-xs, 0.8125rem);
	font-weight: 600;
	text-align: right;
	white-space: nowrap;
}

.cfxcm-table__th--rank,
.cfxcm-table__th--name {
	text-align: left;
}

.cfxcm-table__th[data-cfxcm-sort] {
	cursor: pointer;
	user-select: none;
}

.cfxcm-table__th[data-cfxcm-sort]::after {
	content: "";
	display: inline-block;
	width: 0.6em;
	margin-left: 0.35em;
	opacity: 0.35;
}

.cfxcm-table__th[aria-sort="ascending"]::after {
	content: "\2191";
	opacity: 1;
}

.cfxcm-table__th[aria-sort="descending"]::after {
	content: "\2193";
	opacity: 1;
}

.cfxcm-table__td {
	padding: 0.6rem 0.75rem;
	border-bottom: 1px solid var(--cfxcm-border, rgba(0, 0, 0, 0.08));
	text-align: right;
	white-space: nowrap;
}

.cfxcm-table__td--rank,
.cfxcm-table__td--name {
	text-align: left;
	font-weight: 400;
}

.cfxcm-table__td--rank {
	color: var(--cfxcm-muted, #6b7280);
	width: 3rem;
}

.cfxcm-table__td--spark {
	width: 130px;
}

.cfxcm-table__row[hidden] {
	display: none;
}

.cfxcm-table.is-compact .cfxcm-table__td,
.cfxcm-table.is-compact .cfxcm-table__th {
	padding: 0.4rem 0.5rem;
}

.cfxcm-table__pager {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-top: 0.75rem;
}

.cfxcm-table__pager[hidden] {
	display: none;
}

.cfxcm-table__pager-status {
	margin: 0;
	color: var(--cfxcm-muted, #6b7280);
	font-size: var(--cfx-fs-xs, 0.8125rem);
}

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

.cfxcm-ticker {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	overflow: hidden;
	padding: 0.5rem 0;
	border-block: 1px solid var(--cfxcm-border, rgba(0, 0, 0, 0.1));
}

.cfxcm-ticker__viewport {
	display: flex;
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}

.cfxcm-ticker__track {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 1.5rem;
	margin: 0;
	padding: 0 0.75rem;
	list-style: none;
	white-space: nowrap;
	animation: cfxcm-marquee 45s linear infinite;
}

.cfxcm-ticker.is-paused .cfxcm-ticker__track {
	animation-play-state: paused;
}

.cfxcm-ticker:hover .cfxcm-ticker__track,
.cfxcm-ticker:focus-within .cfxcm-ticker__track {
	animation-play-state: paused;
}

@keyframes cfxcm-marquee {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(-100%);
	}
}

.cfxcm-ticker__item {
	display: inline-flex;
	align-items: center;
}

.cfxcm-ticker__link {
	display: inline-flex;
	align-items: baseline;
	gap: 0.4rem;
	color: inherit;
	text-decoration: none;
}

.cfxcm-ticker__symbol {
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.cfxcm-ticker__price {
	font-variant-numeric: tabular-nums;
}

.cfxcm-ticker.is-compact {
	font-size: var(--cfx-fs-sm, 0.9375rem);
}

/* The pause control is a WCAG requirement for moving content, not an
   enhancement, so it is always rendered and never hidden on small screens. */
.cfxcm-ticker__pause {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: 1px solid var(--cfxcm-border, rgba(0, 0, 0, 0.1));
	border-radius: 50%;
	background: var(--cfxcm-surface, #fff);
	color: inherit;
	cursor: pointer;
}

.cfxcm-ticker__pause-icon {
	display: block;
	width: 0.65rem;
	height: 0.65rem;
	border-left: 3px solid currentColor;
	border-right: 3px solid currentColor;
}

.cfxcm-ticker__pause[aria-pressed="true"] .cfxcm-ticker__pause-icon {
	width: 0;
	height: 0;
	border-left: 0.65rem solid currentColor;
	border-right: 0;
	border-top: 0.4rem solid transparent;
	border-bottom: 0.4rem solid transparent;
}

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

	.cfxcm-ticker__viewport {
		overflow-x: auto;
	}
}

/* -------------------------------------------------------------------------
 * Dominance
 * ---------------------------------------------------------------------- */

.cfxcm-dominance {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cfxcm-dominance__row {
	display: grid;
	grid-template-columns: 4rem 1fr 4rem;
	align-items: center;
	gap: 0.75rem;
	padding: 0.35rem 0;
}

.cfxcm-dominance__symbol {
	font-weight: 700;
	text-transform: uppercase;
	font-size: var(--cfx-fs-sm, 0.9375rem);
}

.cfxcm-dominance__bar {
	display: block;
	height: 0.6rem;
	border-radius: 999px;
	background: var(--cfxcm-surface-alt, #f6f7f9);
	overflow: hidden;
}

.cfxcm-dominance__fill {
	display: block;
	height: 100%;
	width: var(--cfxcm-width, 0%);
	border-radius: inherit;
	background: var(--cfxcm-accent, #2563eb);
}

.cfxcm-dominance__row--other .cfxcm-dominance__fill {
	background: var(--cfxcm-muted, #6b7280);
}

.cfxcm-dominance__value {
	text-align: right;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

/* -------------------------------------------------------------------------
 * Sentiment gauge
 * ---------------------------------------------------------------------- */

.cfxcm-gauge {
	text-align: center;
}

.cfxcm-gauge__dial {
	max-width: 260px;
	margin: 0 auto;
}

.cfxcm-gauge__dial svg {
	display: block;
	width: 100%;
	height: auto;
}

.cfxcm-gauge__track {
	stroke: var(--cfxcm-surface-alt, #f6f7f9);
}

/* The arc length is 251 units for an 80-unit radius half circle; the dash
   offset walks it back proportionally to the index value. */
.cfxcm-gauge__arc {
	stroke: currentColor;
	stroke-dasharray: 251;
	stroke-dashoffset: calc(251 - (251 * var(--cfxcm-gauge-value, 0) / 100));
	transition: stroke-dashoffset 0.6s ease;
}

.cfxcm-gauge__needle {
	stroke: currentColor;
	transform: rotate(var(--cfxcm-gauge-angle, 0deg));
	transform-origin: 100px 100px;
	transition: transform 0.6s ease;
}

.cfxcm-gauge__hub {
	fill: currentColor;
}

.cfxcm-gauge--extreme-fear {
	color: var(--cfxcm-down, #dc2626);
}

.cfxcm-gauge--fear {
	color: #ea580c;
}

.cfxcm-gauge--neutral {
	color: #ca8a04;
}

.cfxcm-gauge--greed {
	color: #65a30d;
}

.cfxcm-gauge--extreme-greed {
	color: var(--cfxcm-up, #16a34a);
}

.cfxcm-gauge__value {
	margin: 0.25rem 0 0;
	font-size: var(--cfx-fs-xl, 1.5rem);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.cfxcm-gauge__scale {
	font-size: 0.6em;
	font-weight: 400;
	color: var(--cfxcm-muted, #6b7280);
}

.cfxcm-gauge__label {
	margin: 0;
	font-weight: 600;
}

.cfxcm-gauge__source {
	margin: 0.5rem 0 0;
	font-size: var(--cfx-fs-xs, 0.8125rem);
	color: var(--cfxcm-muted, #6b7280);
}

/* -------------------------------------------------------------------------
 * Converter
 * ---------------------------------------------------------------------- */

.cfxcm-converter__row {
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
	align-items: flex-end;
}

.cfxcm-converter__actions {
	margin-top: 0.75rem;
}

.cfxcm-converter__result {
	margin-top: 0.75rem;
	padding: 0.75rem;
	border-radius: var(--cfxcm-radius-sm, 6px);
	background: var(--cfxcm-surface-alt, #f6f7f9);
}

.cfxcm-converter__result p {
	margin: 0;
}

.cfxcm-converter__amount {
	font-size: var(--cfx-fs-lg, 1.125rem);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.cfxcm-converter__rate,
.cfxcm-converter__hint {
	color: var(--cfxcm-muted, #6b7280);
	font-size: var(--cfx-fs-xs, 0.8125rem);
}

.cfxcm-converter.is-compact .cfxcm-converter__row {
	flex-direction: column;
	align-items: stretch;
}

/* -------------------------------------------------------------------------
 * In-article and sidebar
 * ---------------------------------------------------------------------- */

.cfxcm-in-article {
	margin: 1.5rem 0;
}

.cfxcm-in-article__body {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.cfxcm-in-article__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
	margin-top: 0.6rem;
	padding-top: 0.6rem;
	border-top: 1px solid var(--cfxcm-border, rgba(0, 0, 0, 0.08));
}

.cfxcm-in-article__link {
	font-size: var(--cfx-fs-xs, 0.8125rem);
	font-weight: 600;
	text-decoration: none;
}

.cfxcm-in-article__foot .cfxcm-freshness {
	margin: 0;
}

.cfxcm-asset-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.cfxcm-asset-header__identity {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

@media (max-width: 600px) {
	.cfxcm-table__td--volume,
	.cfxcm-table__th--volume {
		display: none;
	}
}

/* -------------------------------------------------------------------------
 * Live update flash
 *
 * A brief tint when a polled value changes, so a reader notices the update
 * without the layout moving. Suppressed entirely under reduced motion.
 * ---------------------------------------------------------------------- */

.is-flash-up {
	animation: cfxcm-flash-up 0.7s ease-out;
}

.is-flash-down {
	animation: cfxcm-flash-down 0.7s ease-out;
}

@keyframes cfxcm-flash-up {
	from {
		color: var(--cfxcm-up, #16a34a);
	}
	to {
		color: inherit;
	}
}

@keyframes cfxcm-flash-down {
	from {
		color: var(--cfxcm-down, #dc2626);
	}
	to {
		color: inherit;
	}
}

/* -------------------------------------------------------------------------
 * Card grid layout
 *
 * An alternative to the table for narrow screens and for pages where the
 * assets are being browsed rather than compared. `auto-fit` with a minimum
 * track means the column count adapts to the space available, and the
 * configured maximum only ever caps it.
 * ---------------------------------------------------------------------- */

.cfxcm-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 0.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 900px) {
	.cfxcm-grid {
		grid-template-columns: repeat(var(--cfxcm-columns, 4), minmax(0, 1fr));
	}
}

.cfxcm-grid__item {
	min-width: 0;
}

.cfxcm-grid__card {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	height: 100%;
	padding: 0.85rem;
	border: 1px solid var(--cfxcm-border, rgba(0, 0, 0, 0.1));
	border-radius: var(--cfxcm-radius, 10px);
	background: var(--cfxcm-surface, #fff);
	color: inherit;
	text-decoration: none;
	transition: border-color 0.15s ease, transform 0.15s ease;
}

a.cfxcm-grid__card:hover,
a.cfxcm-grid__card:focus-visible {
	border-color: var(--cfxcm-accent, #2563eb);
	transform: translateY(-2px);
}

.cfxcm-grid__head {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.cfxcm-grid__logo {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	flex: 0 0 auto;
}

.cfxcm-grid__symbol {
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.cfxcm-grid__rank {
	margin-left: auto;
	color: var(--cfxcm-muted, #6b7280);
	font-size: var(--cfx-fs-xs, 0.8125rem);
}

.cfxcm-grid__name {
	margin: 0;
	color: var(--cfxcm-muted, #6b7280);
	font-size: var(--cfx-fs-xs, 0.8125rem);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cfxcm-grid__price {
	margin: 0;
	font-size: var(--cfx-fs-lg, 1.125rem);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.cfxcm-grid .cfxcm-sparkline {
	max-width: none;
	height: 40px;
}

.cfxcm-grid__cap {
	display: flex;
	justify-content: space-between;
	gap: 0.5rem;
	margin: auto 0 0;
	padding-top: 0.5rem;
	border-top: 1px solid var(--cfxcm-border, rgba(0, 0, 0, 0.08));
	font-size: var(--cfx-fs-xs, 0.8125rem);
}

.cfxcm-grid__cap-label {
	color: var(--cfxcm-muted, #6b7280);
}

.cfxcm-grid__cap-value {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.cfxcm-grid.is-compact .cfxcm-grid__card {
	padding: 0.6rem;
}

.cfxcm-grid.is-compact .cfxcm-grid__cap {
	display: none;
}

/* -------------------------------------------------------------------------
 * Headline price cards
 * ---------------------------------------------------------------------- */

.cfxcm-price-cards {
	display: flex;
	gap: 0.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.cfxcm-price-cards__item {
	flex: 1 1 0;
	min-width: 150px;
}

.cfxcm-price-cards__card {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	height: 100%;
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--cfxcm-border, rgba(0, 0, 0, 0.1));
	/* The accent edge repeats the direction the arrow and sign already carry,
	   so nothing depends on noticing the colour. */
	border-left-width: 3px;
	border-radius: var(--cfxcm-radius-sm, 6px);
	background: var(--cfxcm-surface, #fff);
	color: inherit;
	text-decoration: none;
}

.cfxcm-price-cards__item.cfxcm-change--up .cfxcm-price-cards__card {
	border-left-color: var(--cfxcm-up, #16a34a);
}

.cfxcm-price-cards__item.cfxcm-change--down .cfxcm-price-cards__card {
	border-left-color: var(--cfxcm-down, #dc2626);
}

.cfxcm-price-cards__item.cfxcm-change--flat .cfxcm-price-cards__card {
	border-left-color: var(--cfxcm-flat, #6b7280);
}

.cfxcm-price-cards__symbol {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	color: var(--cfxcm-muted, #6b7280);
	font-size: var(--cfx-fs-xs, 0.8125rem);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.cfxcm-price-cards__logo {
	width: 20px;
	height: 20px;
	border-radius: 50%;
}

.cfxcm-price-cards__price {
	font-size: var(--cfx-fs-lg, 1.125rem);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.cfxcm-price-cards .cfxcm-sparkline {
	max-width: none;
	height: 26px;
	margin-top: 0.2rem;
}

.cfxcm-price-cards.is-compact .cfxcm-price-cards__card {
	padding: 0.5rem 0.6rem;
}

/* -------------------------------------------------------------------------
 * Comparison table
 *
 * The metric column stays put while the asset columns scroll, so a reader on a
 * phone never loses track of which row they are reading.
 * ---------------------------------------------------------------------- */

.cfxcm-compare__table {
	min-width: 100%;
}

.cfxcm-compare__label,
.cfxcm-compare__corner {
	position: sticky;
	left: 0;
	z-index: 1;
	background: var(--cfxcm-surface, #fff);
	text-align: left;
	white-space: nowrap;
}

.cfxcm-compare__label {
	padding: 0.6rem 0.75rem;
	border-bottom: 1px solid var(--cfxcm-border, rgba(0, 0, 0, 0.08));
	color: var(--cfxcm-muted, #6b7280);
	font-size: var(--cfx-fs-sm, 0.9375rem);
	font-weight: 500;
}

.cfxcm-compare__asset {
	padding: 0.6rem 0.75rem;
	border-bottom: 2px solid var(--cfxcm-border, rgba(0, 0, 0, 0.1));
	text-align: right;
}

.cfxcm-compare__asset .cfxcm-asset {
	justify-content: flex-end;
}

.cfxcm-compare .cfxcm-table__td {
	text-align: right;
}

/* -------------------------------------------------------------------------
 * Full directory
 * ---------------------------------------------------------------------- */

.cfxcm-all-assets__summary {
	margin: 0 0 0.75rem;
	color: var(--cfxcm-muted, #6b7280);
	font-size: var(--cfx-fs-sm, 0.9375rem);
}
