/* ------------------------------------------------------------------
   Trading page of Taallem France: Paris stocks, crypto, currencies, learn.
   Loaded after pays.css, on that page only. Every colour is a token of
   pays.css, so the page follows the light and the dark theme.
   ------------------------------------------------------------------ */

.page-trading {
	--up: var(--green);
	--down: #f87171;
	--up-bg: rgb(74 222 128 / 0.14);
	--down-bg: rgb(248 113 113 / 0.14);
}

:root[data-theme='light'] .page-trading {
	--down: #b91c1c;
	--up-bg: rgb(21 128 61 / 0.1);
	--down-bg: rgb(185 28 28 / 0.08);
}

.risk-line {
	max-width: 44rem;
	margin-top: 1.25rem;
	padding-left: 0.9rem;
	border-left: 3px solid var(--orange);
	color: var(--body);
	font-size: 0.92rem;
}

.trading .sub {
	margin-top: 2rem;
}

.trading .sub:first-child {
	margin-top: 0;
}

/* The photo on top of each tab. */
.trade-banner {
	position: relative;
	height: clamp(9rem, 20vw, 14rem);
	overflow: hidden;
	border-radius: 4px;
	background: var(--surface-2);
}

.trade-banner img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.trade-banner::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(to right, rgb(3 7 18 / 0.78), rgb(3 7 18 / 0.2) 60%, transparent);
}

.trade-banner-text {
	position: absolute;
	bottom: 1.25rem;
	left: clamp(1rem, 3vw, 2rem);
	z-index: 1;
}

.trade-banner-name {
	color: #fff;
	font-family: var(--serif);
	font-size: clamp(1.9rem, 4.2vw, 3rem);
	line-height: 1.05;
}

.trade-banner-meta {
	margin-top: 0.3rem;
	color: rgb(255 255 255 / 0.9);
	font-size: 0.95rem;
}

.trade-banner + .note,
.trade-banner + .empty {
	margin-top: 1rem;
}

.risk-note {
	padding: 0.65rem 0.9rem;
	border: 1px solid var(--line);
	border-left: 3px solid var(--orange);
	border-radius: 4px;
	background: var(--surface);
	color: var(--body);
}

/* Up or down: an arrow, a signed figure, a tint. */
.delta {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.15rem 0.5rem;
	border-radius: 999px;
	background: var(--surface-2);
	color: var(--muted);
	font-size: 0.85rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.delta > span {
	font-size: 0.6rem;
}

.delta.up {
	background: var(--up-bg);
	color: var(--up);
}

.delta.down {
	background: var(--down-bg);
	color: var(--down);
}

.spark {
	display: block;
	width: 100%;
	height: 2.6rem;
	overflow: visible;
}

.spark polyline {
	fill: none;
	stroke: var(--blue);
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
}

/* ---------- stocks: TradingView frames, then the companies by sector ---------- */

.tv-frame {
	position: relative;
	margin-top: 0.75rem;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 4px;
	background: var(--surface);
}

.tv-wait {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: var(--muted);
	font-size: 0.95rem;
}

.tv-frame + .note {
	margin-top: 0.75rem;
}

.stock-groups {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
	gap: 0.6rem;
	margin-top: 0.75rem;
}

.stock-group {
	--edge: #f97316;
	padding: 1rem 1.1rem;
	border: 1px solid var(--line);
	border-top: 4px solid var(--edge);
	border-radius: 4px;
	background: var(--surface);
}

.stock-group:nth-child(4n + 2) {
	--edge: #3b82f6;
}

.stock-group:nth-child(4n + 3) {
	--edge: #10b981;
}

.stock-group:nth-child(4n + 4) {
	--edge: #a855f7;
}

.stock-group h4 {
	margin-bottom: 0.5rem;
	color: var(--ink);
	font-size: 0.95rem;
	font-weight: 600;
}

.stock-group ul {
	display: grid;
	gap: 0.3rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.stock-group li {
	display: flex;
	justify-content: space-between;
	gap: 0.75rem;
	color: var(--body);
	font-size: 0.92rem;
}

.stock-code {
	color: var(--muted);
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.04em;
}

/* ---------- crypto: metro tiles, then the day's biggest moves ---------- */

.coin-tiles {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 14.5rem), 1fr));
	gap: 0.6rem;
	margin-top: 0.75rem;
}

.coin-tiles:empty {
	display: none;
}

.coin {
	--edge: #f97316;
	display: grid;
	gap: 0.55rem;
	align-content: start;
	padding: 1.1rem;
	border: 1px solid var(--line);
	border-top: 4px solid var(--edge);
	border-radius: 4px;
	background: var(--surface);
}

.coin:nth-child(4n + 2) {
	--edge: #3b82f6;
}

.coin:nth-child(4n + 3) {
	--edge: #10b981;
}

.coin:nth-child(4n + 4) {
	--edge: #a855f7;
}

.coin-head {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	min-width: 0;
}

.coin-logo {
	flex: none;
	border-radius: 50%;
}

.coin-initial {
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	background: var(--surface-2);
	color: var(--ink);
	font-weight: 700;
}

.mover .coin-initial {
	width: 1.75rem;
	height: 1.75rem;
	font-size: 0.8rem;
}

.coin-name {
	overflow: hidden;
	color: var(--ink);
	font-size: 1.02rem;
	font-weight: 600;
	line-height: 1.2;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.coin-code {
	color: var(--muted);
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.04em;
}

.coin-price {
	color: var(--ink);
	font-family: var(--serif);
	font-size: 1.7rem;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

.coin-deltas {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 0.9rem;
}

.coin-delta {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.coin-delta-label {
	color: var(--muted);
	font-size: 0.78rem;
}

.coin-cap {
	display: flex;
	justify-content: space-between;
	gap: 0.5rem;
	padding-top: 0.55rem;
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 0.82rem;
}

.coin-cap strong {
	color: var(--ink);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.movers {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
	gap: 0.6rem;
	margin-top: 0.75rem;
}

.mover-col {
	padding: 1rem 1.1rem;
	border: 1px solid var(--line);
	border-top: 4px solid var(--up);
	border-radius: 4px;
	background: var(--surface);
}

.mover-col.down {
	border-top-color: var(--down);
}

.mover-col h4 {
	margin-bottom: 0.4rem;
	color: var(--ink);
	font-size: 0.95rem;
	font-weight: 600;
}

.mover-col ol {
	margin: 0;
	padding: 0;
	list-style: none;
}

.mover {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto auto;
	align-items: center;
	gap: 0.7rem;
	padding: 0.55rem 0;
	border-top: 1px solid var(--line);
}

.mover:first-child {
	border-top: 0;
}

.mover-name {
	overflow: hidden;
	color: var(--ink);
	font-weight: 500;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mover-code {
	color: var(--muted);
	font-size: 0.78rem;
	font-weight: 600;
}

.mover-price {
	color: var(--body);
	font-size: 0.9rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.movers + .note {
	margin-top: 1rem;
}

/* ---------- currencies ---------- */

.fx-tiles {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
	gap: 0.6rem;
	margin-top: 0.75rem;
}

.fx {
	--edge: #3b82f6;
	display: grid;
	gap: 0.3rem;
	align-content: start;
	padding: 1.1rem;
	border: 1px solid var(--line);
	border-top: 4px solid var(--edge);
	border-radius: 4px;
	background: var(--surface);
}

.fx:nth-child(4n + 2) {
	--edge: #10b981;
}

.fx:nth-child(4n + 3) {
	--edge: #a855f7;
}

.fx:nth-child(4n + 4) {
	--edge: #f97316;
}

.fx-code {
	color: var(--muted);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.08em;
}

.fx-name {
	color: var(--ink);
	font-size: 1rem;
	font-weight: 600;
}

.fx-rate {
	color: var(--ink);
	font-family: var(--serif);
	font-size: 1.9rem;
	font-variant-numeric: tabular-nums;
	line-height: 1.15;
}

.fx-trend {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.3rem;
}

.fx-trend .meta {
	margin: 0;
	font-size: 0.8rem;
}

.fx-convert {
	margin-top: 2rem;
	padding: 1.25rem;
	border: 1px solid var(--line);
	border-radius: 4px;
	background: var(--surface);
}

.fx-convert[hidden] {
	display: none;
}

.fx-convert .sub {
	margin-top: 0;
}

.fx-convert-row {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 0.9rem 1.25rem;
	margin-top: 0.9rem;
}

.fx-convert label {
	display: grid;
	gap: 0.35rem;
	color: var(--muted);
	font-size: 0.85rem;
}

.fx-convert input,
.fx-convert select {
	min-width: 11rem;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--line-2);
	border-radius: 4px;
	background: var(--field);
	color: var(--ink);
	font: 500 1rem var(--sans);
}

.fx-result {
	color: var(--ink);
	font-family: var(--serif);
	font-size: 1.8rem;
	font-variant-numeric: tabular-nums;
	line-height: 1.2;
}

.fx-convert + .note,
.fx-tiles + .note {
	margin-top: 1rem;
}

/* ---------- learn: four guides with their photograph, then the course ---------- */

.guides {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
	gap: 0.6rem;
	margin-top: 0.75rem;
}

.guide {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 4px;
	background: var(--surface);
}

.guide img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.guide-body {
	display: grid;
	gap: 0.5rem;
	align-content: start;
	padding: 1.1rem;
}

.guide-body h4 {
	color: var(--ink);
	font-size: 1.1rem;
	font-weight: 600;
}

.guide-body p {
	color: var(--body);
	font-size: 0.93rem;
}

.course {
	margin-top: 2rem;
}

/* ---------- before investing ---------- */

.rules-list {
	display: grid;
	gap: 0.4rem;
	padding-left: 1.2rem;
	color: var(--body);
}

.rules-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

@media (max-width: 520px) {
	.mover {
		grid-template-columns: auto minmax(0, 1fr) auto;
	}

	.mover-price {
		display: none;
	}

	.fx-convert input,
	.fx-convert select {
		min-width: 0;
		width: 100%;
	}

	.fx-convert label {
		flex: 1 1 100%;
	}
}

/* ---------- right to left (Arabic pages) ---------- */

html[dir='rtl'] .risk-line {
	padding-right: 0.9rem;
	padding-left: 0;
	border-right: 3px solid var(--orange);
	border-left: 0;
}

html[dir='rtl'] .risk-note {
	border-right: 3px solid var(--orange);
	border-left: 1px solid var(--line);
}

html[dir='rtl'] .trade-banner::after {
	background: linear-gradient(to left, rgb(3 7 18 / 0.78), rgb(3 7 18 / 0.2) 60%, transparent);
}

html[dir='rtl'] .trade-banner-text {
	right: clamp(1rem, 3vw, 2rem);
	left: auto;
}

html[dir='rtl'] .rules-list {
	padding-right: 1.2rem;
	padding-left: 0;
}
