/**
 * Antivig Engine — the public pick record.
 *
 * Same tokens and the same table treatment as board.css, on purpose: the board
 * is the argument and this is the evidence, and a visitor should not have to
 * wonder whether they are still on the same site. The --avb-* tokens are the
 * engine's own, declared in board.css and repeated below so this file also
 * stands up alone — the membership plugin's stylesheet is not loaded on engine
 * pages, and borrowing its tokens painted light colours onto a dark page.
 *
 * The table rules are repeated here rather than inherited from board.css
 * because this stylesheet is registered with no dependency on it — see
 * Frontend\LedgerShortcode::register_assets(). A dependency that is not
 * registered makes WordPress print nothing at all.
 */

:root {
	--avb-surface: #ffffff;
	--avb-surface-alt: #f4f6f3;
	--avb-line: #dfe4e9;
	--avb-ink: #0e1a2b;
	--avb-ink-soft: #3c4a5c;
	--avb-ink-faint: #5a6b80;
	--avb-accent: #f2a900;
	--avb-win: #1f9d5b;
	--avb-loss: #d1453b;
	--avb-radius: 12px;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-bs-theme="light"]) {
		--avb-surface: #111d2e;
		--avb-surface-alt: #0e1928;
		--avb-line: #22314a;
		--avb-ink: #e8edf2;
		--avb-ink-soft: #b3bfcc;
		--avb-ink-faint: #8b9aab;
		--avb-win: #3bbe7a;
		--avb-loss: #ee6a5f;
	}
}

:root[data-bs-theme="dark"] {
	--avb-surface: #111d2e;
	--avb-surface-alt: #0e1928;
	--avb-line: #22314a;
	--avb-ink: #e8edf2;
	--avb-ink-soft: #b3bfcc;
	--avb-ink-faint: #8b9aab;
	--avb-win: #3bbe7a;
	--avb-loss: #ee6a5f;
}


.av-ledger-wrap {
	display: grid;
	gap: 1.25rem;
	margin: 1.5rem 0;
}

/* ------------------------------------------------------------- Summary */

.av-ledger__summary {
	background: var(--avb-surface);
	border: 1px solid var(--avb-line);
	border-radius: var(--avb-radius);
	padding: 1.1rem;
}

.av-ledger__title {
	margin: 0 0 .9rem;
	font-size: 1.25rem;
	line-height: 1.2;
}

.av-ledger__stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	gap: 1rem;
	margin: 0;
}

.av-stat dt {
	font-size: .6875rem;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--avb-ink-faint);
}

.av-stat dd {
	margin: .2rem 0 0;
}

.av-stat__value {
	display: block;
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
	color: var(--avb-ink);
}

/* The caveat is part of the number, not a footnote under it. */
.av-stat__note {
	display: block;
	margin-top: .15rem;
	font-size: .75rem;
	color: var(--avb-ink-faint);
}

/* --------------------------------------------------------------- Chain */

.av-ledger__chain {
	margin-top: 1.1rem;
	padding-top: .9rem;
	border-top: 1px solid var(--avb-line);
}

.av-ledger__chain-head {
	margin: 0;
	font-size: .6875rem;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--avb-ink-faint);
}

/* A hash a reader cannot copy in full is decoration, so it wraps rather than
   truncating, and it never scrolls out of reach on a phone. */
.av-hash code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .8125rem;
	line-height: 1.4;
	overflow-wrap: anywhere;
	word-break: break-all;
	color: var(--avb-ink-soft);
}

.av-ledger__chain .av-hash {
	margin: .25rem 0 0;
}

/* --------------------------------------------------------------- Proof */

.av-ledger__proof {
	background: var(--avb-surface-alt);
	border: 1px solid var(--avb-line);
	border-radius: var(--avb-radius);
	padding: 1.1rem;
	font-size: .875rem;
	color: var(--avb-ink-soft);
}

.av-ledger__proof h3 {
	margin: 0 0 .5rem;
	font-size: 1rem;
	color: var(--avb-ink);
}

.av-ledger__proof p {
	margin: 0 0 .6rem;
}

.av-ledger__proof p:last-child {
	margin-bottom: 0;
}

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

.av-ledger__scroll {
	overflow-x: auto;
	background: var(--avb-surface);
	border: 1px solid var(--avb-line);
	border-radius: var(--avb-radius);
}

.av-ledger {
	width: 100%;
	min-width: 52rem;
	border-collapse: collapse;
}

.av-ledger th {
	font-size: .6875rem;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--avb-ink-faint);
	text-align: right;
	padding: .6rem 1.1rem;
	background: var(--avb-surface-alt);
	border-bottom: 1px solid var(--avb-line);
	white-space: nowrap;
}

.av-ledger td {
	padding: .7rem 1.1rem;
	text-align: right;
	border-bottom: 1px solid var(--avb-line);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.av-ledger th:first-child,
.av-ledger td:first-child {
	text-align: left;
}

.av-ledger tbody tr:last-child td {
	border-bottom: 0;
}

/* An open pick is still a published pick: dimming it would be a way of hiding
   pending losers in plain sight. It is marked, not faded. */
.av-ledger tbody tr.is-open {
	background: var(--avb-surface-alt);
}

.av-ledger td.av-game-cell,
.av-ledger td.av-team {
	font-weight: 600;
	font-variant-numeric: normal;
}

.av-ledger td.av-market,
.av-ledger td.av-model,
.av-ledger td.av-when {
	color: var(--avb-ink-faint);
	font-variant-numeric: normal;
}

/* The price we actually took is the one number on this table worth the accent. */
.av-ledger td.av-best {
	font-weight: 600;
	box-shadow: inset 0 -3px 0 var(--avb-accent);
}

.av-book-note {
	display: block;
	font-size: .75rem;
	font-weight: 400;
	color: var(--avb-ink-faint);
}

.av-ledger td.av-hash {
	text-align: left;
}

.av-ledger td.av-hash code {
	word-break: normal;
}

.av-ledger .av-win  { color: var(--avb-win); }
.av-ledger .av-loss { color: var(--avb-loss); }

.av-ledger .av-open,
.av-ledger .av-none {
	color: var(--avb-ink-faint);
}

/* ---------------------------------------------------------------- Empty */

.av-ledger-empty {
	background: var(--avb-surface-alt);
	border: 1px dashed var(--avb-line);
	border-radius: var(--avb-radius);
	padding: 1.5rem;
	color: var(--avb-ink-soft);
}

.av-ledger-empty__head {
	margin: 0 0 .35rem;
	font-weight: 600;
	color: var(--avb-ink);
}

.av-ledger-empty p:last-child,
.av-ledger-foot p:last-child {
	margin-bottom: 0;
}

/* ----------------------------------------------------------------- Foot */

.av-ledger__truncated,
.av-ledger-foot {
	font-size: .8125rem;
	color: var(--avb-ink-faint);
}

.av-ledger__truncated {
	margin: 0;
}

@media (max-width: 40rem) {
	.av-ledger__stats {
		grid-template-columns: 1fr 1fr;
	}
}


/* Breakdowns: the same table, narrower, because five columns need less room. */
.av-ledger__breakdowns {
	margin: 1.5rem 0;
}

.av-ledger__breakdowns-note {
	max-width: 65ch;
}

.av-ledger--breakdown {
	min-width: 30rem;
	margin-bottom: 1.25rem;
}

.av-ledger--breakdown caption {
	text-align: left;
	font-weight: 600;
	padding: .25rem 0 .5rem;
}
