/* Live Oil Prices */

.lop {
	--lop-bg: #ffffff;
	--lop-fg: #15191e;
	--lop-muted: #5d6874;
	--lop-border: #e2e6ea;
	--lop-row: #f1f3f5;
	--lop-up: #0b7a45;
	--lop-down: #c2312b;
	--lop-up-flash: rgba(11, 122, 69, 0.14);
	--lop-down-flash: rgba(194, 49, 43, 0.14);
	--lop-live: #12a150;

	box-sizing: border-box;
	container-type: inline-size;
	color: var(--lop-fg);
	background: var(--lop-bg);
	font-size: 15px;
	line-height: 1.35;
	font-variant-numeric: tabular-nums;
}

.lop *,
.lop *::before,
.lop *::after {
	box-sizing: border-box;
}

.lop--theme-dark {
	--lop-bg: #12161b;
	--lop-fg: #eef1f4;
	--lop-muted: #9aa5b1;
	--lop-border: #28303a;
	--lop-row: #1d232a;
	--lop-up: #3ccf8a;
	--lop-down: #ff6f62;
	--lop-up-flash: rgba(60, 207, 138, 0.18);
	--lop-down-flash: rgba(255, 111, 98, 0.18);
	--lop-live: #3ccf8a;
}

@media (prefers-color-scheme: dark) {
	.lop--theme-auto {
		--lop-bg: #12161b;
		--lop-fg: #eef1f4;
		--lop-muted: #9aa5b1;
		--lop-border: #28303a;
		--lop-row: #1d232a;
		--lop-up: #3ccf8a;
		--lop-down: #ff6f62;
		--lop-up-flash: rgba(60, 207, 138, 0.18);
		--lop-down-flash: rgba(255, 111, 98, 0.18);
		--lop-live: #3ccf8a;
	}
}

/* ---- Shared pieces ---- */

.lop__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
}

.lop .lop__title {
	margin: 0;
	padding: 0;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--lop-muted);
	line-height: 1.2;
	border: 0;
}

.lop__badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: none;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--lop-muted);
}

.lop__dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--lop-live);
	box-shadow: 0 0 0 0 var(--lop-live);
	animation: lop-pulse 2.4s ease-out infinite;
}

.lop__badge--demo .lop__dot {
	background: #d99a1e;
	animation: none;
}

.lop.is-stale .lop__dot {
	background: var(--lop-muted);
	animation: none;
}

@keyframes lop-pulse {
	0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--lop-live) 55%, transparent); }
	70% { box-shadow: 0 0 0 6px transparent; }
	100% { box-shadow: 0 0 0 0 transparent; }
}

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

.lop__name {
	font-weight: 600;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lop__unit {
	font-weight: 400;
	font-size: 0.8em;
	color: var(--lop-muted);
}

.lop__price {
	font-weight: 700;
	white-space: nowrap;
	border-radius: 4px;
	transition: background-color 1.2s ease;
}

.lop__price.is-flash-up { background: var(--lop-up-flash); transition: none; }
.lop__price.is-flash-down { background: var(--lop-down-flash); transition: none; }

.lop__change {
	font-size: 0.82rem;
	white-space: nowrap;
	color: var(--lop-muted);
}

.lop__change--up { color: var(--lop-up); }
.lop__change--down { color: var(--lop-down); }

.lop--no-change .lop__change { display: none; }

.lop__spark { line-height: 0; color: var(--lop-muted); }
.lop__spark-svg { display: block; width: 100%; height: 28px; }
.lop__spark-svg--up { color: var(--lop-up); }
.lop__spark-svg--down { color: var(--lop-down); }

.lop__empty {
	margin: 0;
	font-size: 0.9rem;
	color: var(--lop-muted);
}

.lop__foot {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-top: 10px;
	font-size: 0.75rem;
	color: var(--lop-muted);
}

.lop .lop__credit {
	color: inherit;
	text-decoration: none;
}

.lop .lop__credit:hover { text-decoration: underline; }

/* ---- Card ---- */

.lop--card,
.lop--compact {
	border: 1px solid var(--lop-border);
	border-radius: 12px;
	padding: 14px 16px;
}

.lop--card .lop__item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 96px auto;
	grid-template-areas:
		"name spark price"
		"change spark price";
	align-items: center;
	column-gap: 14px;
	row-gap: 2px;
	padding: 10px 0;
	border-top: 1px solid var(--lop-border);
}

.lop--card .lop__item:first-child { border-top: 0; padding-top: 2px; }
.lop--card .lop__name { grid-area: name; }
.lop--card .lop__change { grid-area: change; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lop--card .lop__spark { grid-area: spark; }
.lop--card .lop__price { grid-area: price; font-size: 1.35rem; padding: 0 4px; margin-right: -4px; text-align: right; }

.lop--card.lop--no-spark .lop__item {
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas: "name price" "change price";
}

.lop--card.lop--no-spark .lop__spark { display: none; }

/* Narrow spots such as sidebars: drop the sparkline to keep text readable. */
@container (max-width: 380px) {
	.lop--card .lop__item {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas: "name price" "change price";
	}
	.lop--card .lop__spark { display: none; }
}

@container (max-width: 260px) {
	.lop--card .lop__price { font-size: 1.15rem; }
}

/* ---- Compact list ---- */

.lop--compact .lop__item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto;
	align-items: baseline;
	column-gap: 10px;
	padding: 6px 0;
	border-top: 1px solid var(--lop-border);
}

.lop--compact .lop__item:first-child { border-top: 0; }
.lop--compact .lop__price { padding: 0 3px; }
.lop--compact .lop__change { text-align: right; min-width: 4.5em; }

@container (max-width: 240px) {
	.lop--compact .lop__item { grid-template-columns: minmax(0, 1fr) auto; }
	.lop--compact .lop__change { grid-column: 1 / -1; text-align: left; }
}

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

.lop--ticker {
	display: flex;
	align-items: center;
	gap: 18px;
	padding: 8px 16px;
	font-size: 0.85rem;
	border-bottom: 1px solid var(--lop-border);
	overflow-x: auto;
	scrollbar-width: none;
}

.lop--ticker::-webkit-scrollbar { display: none; }

.lop--ticker .lop__list {
	display: flex;
	align-items: center;
	gap: 22px;
	white-space: nowrap;
}

.lop--ticker .lop__item {
	display: flex;
	align-items: baseline;
	gap: 7px;
}

.lop--ticker .lop__name {
	font-weight: 500;
	color: var(--lop-muted);
	overflow: visible;
}

.lop--ticker .lop__price { padding: 0 3px; }
.lop--ticker .lop__change { font-size: 0.8rem; }
.lop--ticker .lop__empty { white-space: nowrap; }

.lop-ticker-bar {
	position: relative;
	z-index: 50;
	width: 100%;
}

.lop-home {
	margin: 0 0 1.5em;
}

/* Printed around a posts loop, outside the theme's padded content box. */
@media (max-width: 600px) {
	.lop-home--loop { padding: 0 16px; }
}

/* Shown inside the theme's own widget wrapper: don't double the frame. */
.widget .lop--card,
.widget .lop--compact {
	max-width: 100%;
}

@media (prefers-reduced-motion: reduce) {
	.lop__dot { animation: none; }
	.lop__price { transition: none; }
}
