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

/* mirror the index page's .page_columns: centered with margin auto + max-width,
   and columns that fill (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 so all bars match the longest; the portrait
	   media query overrides this. side margin = the index .bar 0.6vw offset. */
	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 rounded bar: the opt-in card (BOARD.card) wrapping each item's button +
   rows, 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);
}

/* the card fills the shrink-wrapped section so every card shares one width tied to
   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 title's gap to its rows lives on the rows block, so it vanishes with them
   when the card collapses (a display:none element contributes no margin) 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) {
	/* the container is 90% wide and centered (margin auto from the base rule), and
	   everything inside fills it - so the bars are 90% wide and 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, so the padding stays
	   even instead of leaving a gap on the right */
	.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;
	}
}
