/* Accepted-names reference page. Loaded alongside style.css (for the shared
   --font-mono token and .lede) — just table/filter bits here. */

.names-page {
	padding-top: 1rem;
	padding-bottom: 3rem;
}

.names-filter {
	display: block;
	width: 100%;
	font-family: inherit;
	font-size: 1rem;
	padding: 0.7rem 0.9rem;
	margin-bottom: 1.25rem;
	color: var(--black);
	background: var(--white);
	border: 2px solid var(--gray-light);
	border-radius: 3px;
}

.names-filter:focus {
	outline: none;
	border-color: var(--accent-dark);
}

.names-filter:focus-visible {
	outline: 3px solid var(--accent-dark);
	outline-offset: 1px;
}

.names-table {
	width: 100%;
	margin: 0 auto;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.names-table th {
	text-align: left;
	font-size: 0.7rem;
	color: var(--gray);
	padding: 0 0.4rem 0.5rem;
	border-bottom: 1px solid var(--gray-light);
	white-space: nowrap;
}

/* Sortable header: the whole label is the click target (a real <button>
   for keyboard access), styled to look like the plain header text. */
.names-sort {
	font: inherit;
	color: inherit;
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	white-space: nowrap;
}

.names-sort:hover {
	color: var(--black);
}

.names-sort:focus-visible {
	outline: 2px solid var(--accent-dark);
	outline-offset: 2px;
}

/* Inactive columns hide the arrow with visibility rather than removing it,
   so the header doesn't shift width when the arrow moves between columns. */
.names-sort-arrow {
	display: inline-block;
	color: var(--accent-dark);
	margin-left: 0.3em;
	font-size: 0.85em;
}

.names-sort-arrow.hidden-arrow {
	visibility: hidden;
}

.names-table td {
	padding: 0.5rem 0.4rem;
	border-bottom: 1px solid var(--accent-light);
	vertical-align: top;
}

.names-table tbody tr:hover td {
	background: var(--accent-light);
}

.names-image-row td {
	padding: 0 0.4rem;
	text-align: center;
	cursor: default;
}

.names-table tbody tr.names-image-row:hover td {
	background: none;
}

/* Animates open/close via height + opacity (a <tr>'s own height doesn't
   animate reliably, so this inner wrapper does the work instead). All of
   the image row's vertical spacing lives in here too — via .names-inline
   -card-wrap's margin below — so a collapsed row is truly 0px tall
   instead of leaving a residual gap from padding elsewhere. */
.names-inline-collapse {
	height: 0;
	opacity: 0;
	overflow: hidden;
	transition: height 0.28s ease, opacity 0.28s ease;
}

.names-inline-collapse.open {
	opacity: 1;
}

/* .card (and .silhouette-img) is the same class the game itself uses —
   this makes the inline expansion here match the game's own card styling
   (just without the crop-mark corners the game version has). */
.names-inline-pair {
	display: flex;
	justify-content: center;
	gap: 1rem;
	max-width: 560px;
	margin: 0.75rem auto;
}

.names-inline-card-wrap {
	flex: 1 1 0;
	min-width: 0;
}

/* Matches the Best time column's own coloring (same washes the game uses
   for a resolved cell) — plain white when there's no ghost record at all,
   since that's not any of the three tiers. Same specificity as .card's own
   background, so cascade order (this file loads after style.css) decides. */
.card.card-bg-none { background: var(--white); }
.card.card-bg-correct { background: var(--accent-light); }
.card.card-bg-corrected { background: var(--warn-wash); }
.card.card-bg-wrong { background: var(--error-wash); }

/* .flashy-text lives in global.css (shared site-wide). */

.names-code {
	font-family: var(--font-mono);
	color: var(--accent-dark);
	white-space: nowrap;
	width: 3.5rem;
}

.names-alt-toggle {
	font: inherit;
	font-size: 0.8em;
	color: var(--accent);
	background: none;
	border: none;
	padding: 0 0.3rem;
	margin-left: 0.2rem;
	cursor: pointer;
	display: inline-block;
	transition: transform 0.2s ease;
}

.names-alt-toggle.open { transform: rotate(180deg); }

.names-alt-toggle:hover { color: var(--accent-dark); }

.names-alt-toggle:focus-visible {
	outline: 2px solid var(--accent-dark);
	outline-offset: 1px;
}

.names-alt-list {
	list-style: none;
	margin: 0;
	padding: 0;
	color: var(--black);
}

.names-alt-list li {
	margin: 0;
	padding: 0;
	/* global.css sets a sitewide `li { font-size: 1rem }` (for markdown
	   content lists) that would otherwise override the 0.9rem this table
	   inherits, making these read larger than the primary name above them. */
	font-size: inherit;
	line-height: inherit;
}

.names-score,
.names-ghost {
	font-family: var(--font-mono);
	color: var(--gray-dark);
	white-space: nowrap;
}

.names-ghost-none { color: var(--gray); }

/* The whole row is the click target for the replay dropdown. */
.names-table tbody tr[data-code] { cursor: pointer; }
.names-table tbody tr[data-code] a,
.names-table tbody tr[data-code] .names-alt-toggle { cursor: pointer; }

/* Data columns hug their content so extra width goes to Country; otherwise
   the Date column is much wider than its text and looks off-center between
   its neighbors. */
.names-table th[data-sort="score"],
.names-table th[data-sort="time"],
.names-table th[data-sort="diff"] { width: 1%; }

/* An empty "—" placeholder sits centered in its cell. */
.names-table td:has(> .names-ghost-none) { text-align: center; }

/* A record beaten by the last game's PB: still shown, but struck through. */
.names-beaten { text-decoration: line-through; }

/* Error rate: two fixed-width right-aligned columns so the percents line up
   across rows, with a gap sized to match the other columns' text length. */
.names-pct { display: inline-block; width: 4ch; text-align: right; }
.names-pct + .names-pct { margin-left: 1.5ch; }

/* Scores: the percent matching the most recent result. */
.names-score-last { text-decoration: underline; }

/* Round date + time above each replay card in the dropdown. */
.names-inline-date {
	margin-bottom: 0.4rem;
	min-height: 1.1em;
	text-align: center;
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--gray-dark);
}

.names-inline-ghost {
	margin-top: 0.5rem;
	min-height: 1.1em;
	text-align: center;
	font-family: var(--font-mono);
	font-size: 0.75rem;
	color: var(--accent-dark);
}

/* A caught mistake (a "<" in the recorded trace) turns the whole line
   yellow for the rest of that lap; a submission that was actually wrong
   overrides that to red — see playInlineGhost(). */
.names-inline-ghost.ghost-mistake { color: var(--warn); }
.names-inline-ghost.ghost-wrong { color: var(--error); }
.names-inline-ghost.ghost-submitted { text-decoration: underline; }
.names-empty {
	text-align: center;
	color: var(--gray);
	padding: 1.5rem 0.75rem;
}

.names-back {
	display: block;
	margin-top: 2rem;
	text-align: center;
}

.names-back-top {
	margin: 0 0 1.25rem;
	text-align: left;
}

@media (max-width: 480px) {
	.names-table { font-size: 0.8rem; }
}
