/**
 * @file leaderboard.css
 * @brief ggsp leaderboard + player-profile feature styles, themed via theme.css tokens.
 * @copyright Copyright (c) 2026 hoff.industries
*/

/* mirrors the index .page_columns: leaderboard grows, latest sizes to content */
.leaderboard_container {
	display: grid;
	grid-template-areas: 'leaderboard latest';
	gap: 1.5em;
	max-width: 98vw;
	margin: 0.6em auto 0;
}

#div-leaderboard-section {
	grid-area: leaderboard;
	/* shrink-wrap to the widest row; the portrait media query overrides this */
	width: max-content;
	margin-left: 0.6vw;
	margin-right: 0.6vw;
}

#div-latest-completion {
	grid-area: latest;
	align-self: start;
	margin-left: 0.6vw;
	margin-right: 0.6vw;
	width: fit-content;
}

#div-map-times {
	grid-area: leaderboard;
	width: 50vw;
}

.latest-line {
	margin-top: 0px;
	padding: 0px;
	font-size: 1.4em;
	margin-bottom: var(--line-spacing);
}

.latest-date {
	margin-left: 2em;
	margin-bottom: 0.8em;
	font-size: 1.3em;
}

.latest-item,
.leaderboard-item {
	margin-top: 0px;
	padding: 0px;
	font-size: 1.3em;
	margin-left: 2em;
	margin-bottom: var(--line-spacing);
}

.leaderboard-item {
	display: block;
}

.leaderboard-table {
	border: none;
	vertical-align: top;
}

.leaderboard-button,
.leaderboard-more {
	cursor: pointer;
	background: none;

	font-family: var(--font-body);
	font-size: 1.4em;
	font-weight: bold;
	color: var(--text);
	border: none;
	display: block;
	margin-bottom: 0.5em;
}

.leaderboard-more {
	margin-left: 1em;
}

.leaderboard-first,
.leaderboard-second,
.leaderboard-third,
.leaderboard-misc,
.rank-one-text {
	text-decoration: none;
}

.leaderboard-first { color: var(--rank-1); }
.leaderboard-second { color: var(--rank-2); }
.leaderboard-third { color: var(--rank-3); }
.leaderboard-misc { color: var(--rank-misc); }
.rank-one-text { color: var(--text); }

/* frosted bar: the opt-in BOARD.card and the whole latest / top-players column */
.board-card,
#div-latest-completion {
	/* match the index page's .bar: 0.5rem side padding */
	padding: 0.6em 0.5rem;
	border: var(--border-width) solid var(--accent);
	border-radius: var(--radius);
	background: rgba(0, 0, 0, 0.7);
	backdrop-filter: blur(20px);
}

/* fills the shrink-wrapped section, so every card matches the longest row */
.board-card {
	box-sizing: border-box;
	/* fill the section so every card is the same width as the longest row */
	width: 100%;
	margin-bottom: 1.2em;
}

.board-card .leaderboard-item {
	margin-left: 0;
}

/* the gap lives on the rows block so it vanishes with them when the card collapses,
   instead of leaving the button's bottom margin dangling */
.board-card .leaderboard-button {
	margin-bottom: 0;
}

.board-card-rows {
	margin-top: 0.5em;
}

.profile_layout {
	gap: 0.2rem;
}

.profile_metadata {
	padding: 0.8rem;
	border: var(--border-width) solid var(--accent);
	border-radius: var(--radius);
	background: rgba(0, 0, 0, 0.7);
	backdrop-filter: blur(20px);
	flex-shrink: 0;
}

.profile_top_maps_container {
	width: 100%;
	padding: 0px;
	background-size: cover;
	background-repeat: no-repeat;
	border: var(--border-width) solid var(--accent);
	border-radius: var(--radius);
}

.profile_top_maps {
	backdrop-filter: blur(20px);
	background: rgba(0, 0, 0, 0.7);
	border-radius: 0.2em;

	padding-left: 2em;
	padding-bottom: 1em;
	padding-right: 5em;
	padding-top: 0.6em;
	width: fit-content;
}

.profile-top-map-item {
	font-weight: bold;
	font-size: 1.4em;
}

@media (max-aspect-ratio: 1 / 1) {
	/* everything fills the 90% centered container, so bars are evenly inset on both
	   sides instead of hugging content and sitting to the left */
	.leaderboard_container {display: block; max-width: 90vw;}
	#div-leaderboard-section {width: auto; margin: 0;}
	#div-latest-completion {width: auto; margin: 0;}
	/* fill the wide bar: rank + name left, time pushed right, keeping padding even */
	.board-card .leaderboard-item {display: flex; align-items: baseline;}
	.board-card .leaderboard-item > a:last-child {margin-left: auto;}
	#div-map-times {grid-area: 2 / 1; width: auto;}

	.profile_layout {
		min-height: 50vh;
	}

	.profile_metadata h2 {
		margin-top: 0.25em;
		margin-bottom: 0.25em;
	}
}
