/*
 * Crucial 2: Refresh — server pages.
 *
 * The palette is the underground the server is played in: cool pale stone,
 * slate text, lapis for anything structural, moss for "someone is here".
 */

:root {
	--stone:       #e4e6e1;
	--stone-panel: #edeeea;
	--stone-deep:  #cfd3cc;
	--slate:       #2b3138;
	--slate-soft:  #5d666f;
	--lapis:       #2c5aa0;
	--moss:        #4f7a3e;

	--rule: 1px solid var(--stone-deep);

	--measure: 64ch;
	--gap: 1.5rem;

	--face: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
	:root {
		--stone:       #1e242b;
		--stone-panel: #262d35;
		--stone-deep:  #3a434d;
		--slate:       #dfe3e6;
		--slate-soft:  #98a3ae;
		--lapis:       #7aa5e0;
		--moss:        #8ec272;
	}
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--stone);
	color: var(--slate);
	font-family: var(--face);
	font-size: 1rem;
	line-height: 1.55;
}

a { color: var(--lapis); }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
	outline: 2px solid var(--lapis);
	outline-offset: 2px;
}

.wrap {
	width: 100%;
	max-width: 62rem;
	margin: 0 auto;
	padding-inline: 1.25rem;
}

/* ---- top strip ------------------------------------------------------- */

.strip {
	border-bottom: var(--rule);
	background: var(--stone-panel);
}

.strip-inner {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	align-items: baseline;
	justify-content: space-between;
	padding-block: 0.7rem;
}

.wordmark {
	font-weight: 650;
	letter-spacing: -0.015em;
	color: inherit;
	text-decoration: none;
}

.strip-meta {
	font-size: 0.9rem;
	color: var(--slate-soft);
	font-variant-numeric: tabular-nums;
}

/* ---- join: the one loud thing on the page ---------------------------- */

.banner {
	display: block;
	width: 100%;
	border-bottom: var(--rule);
	background: var(--stone-panel);
}

.banner img {
	display: block;
	width: 100%;
	height: clamp(8rem, 18vw, 14rem);
	object-fit: cover;
	object-position: center;
}

.join {
	padding-block: clamp(2rem, 5vw, 3.25rem) clamp(2rem, 5vw, 3rem);
	border-bottom: var(--rule);
}

.join h1 {
	margin: 0 0 1.75rem;
	font-size: clamp(1.9rem, 5.5vw, 3rem);
	line-height: 1.1;
	letter-spacing: -0.03em;
	font-weight: 680;
	max-width: 18ch;
}

.address-row {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 0.6rem;
	margin-bottom: 1.25rem;
}

.address {
	flex: 1 1 14ch;
	min-width: 0;
	font-family: var(--mono);
	font-size: clamp(1.15rem, 4.2vw, 1.8rem);
	font-weight: 600;
	letter-spacing: -0.01em;
	padding: 0.7rem 0.9rem;
	background: var(--stone-panel);
	border: 2px solid var(--slate);
	border-radius: 2px;
	overflow-x: auto;
	white-space: nowrap;
	display: flex;
	align-items: center;
}

.copy {
	flex: none;
	font: inherit;
	font-weight: 600;
	padding: 0.7rem 1.1rem;
	color: var(--stone-panel);
	background: var(--slate);
	border: 2px solid var(--slate);
	border-radius: 2px;
	cursor: pointer;
}

.copy:hover { background: var(--lapis); border-color: var(--lapis); }
.copy[data-copied="yes"] { background: var(--moss); border-color: var(--moss); }

.requires {
	margin: 0;
	max-width: var(--measure);
	color: var(--slate-soft);
}

.requires strong { color: var(--slate); font-weight: 600; }

/* ---- sections -------------------------------------------------------- */

section.band { padding-block: clamp(2rem, 5vw, 3rem); border-bottom: var(--rule); }

.band > h2 {
	margin: 0 0 0.35rem;
	font-size: 1.3rem;
	letter-spacing: -0.02em;
	font-weight: 650;
}

.band > .lede {
	margin: 0 0 1.5rem;
	max-width: var(--measure);
	color: var(--slate-soft);
}

/* ---- world facts ----------------------------------------------------- */

.facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
	gap: 1px;
	background: var(--stone-deep);
	border: var(--rule);
}

.facts div { background: var(--stone); padding: 0.9rem 1rem; }

.facts dt { color: var(--slate-soft); font-size: 0.9rem; }

.facts dd {
	margin: 0.15rem 0 0;
	font-size: 1.35rem;
	font-weight: 640;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

/* ---- roster ---------------------------------------------------------- */

.roster { width: 100%; border-collapse: collapse; }

.roster th, .roster td {
	text-align: right;
	padding: 0.7rem 0.5rem;
	border-bottom: var(--rule);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.roster th:first-child, .roster td:first-child { text-align: left; padding-left: 0; }
.roster th:last-child, .roster td:last-child { padding-right: 0; }

.roster thead th {
	padding: 0;
	border-bottom: 2px solid var(--slate);
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--slate-soft);
}

.roster thead button {
	font: inherit;
	color: inherit;
	background: none;
	border: 0;
	padding: 0.6rem 0.5rem;
	width: 100%;
	text-align: inherit;
	cursor: pointer;
}

.roster thead th:first-child button { padding-left: 0; }
.roster thead th:last-child button { padding-right: 0; }
.roster thead button:hover { color: var(--lapis); }
.roster th[aria-sort] button { color: var(--slate); }

.roster th[aria-sort] button::after {
	content: "\2193";
	margin-left: 0.35em;
	color: var(--lapis);
}

.roster th[aria-sort="ascending"] button::after { content: "\2191"; }

.roster tbody tr:hover { background: var(--stone-panel); }

.who { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; }

.here {
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	background: var(--moss);
	flex: none;
}

.dim { color: var(--slate-soft); font-weight: 400; }

/* ---- activity feed --------------------------------------------------- */

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

.feed li {
	padding: 0.75rem 0 0.75rem 1rem;
	border-bottom: var(--rule);
	border-left: 3px solid var(--stone-deep);
	padding-left: 1rem;
}

.feed li[data-kind="death"] { border-left-color: var(--slate-soft); }
.feed li[data-kind="playing"] { border-left-color: var(--moss); }

.feed p { margin: 0; }
.meta, .feed .meta { color: var(--slate-soft); font-size: 0.9rem; }
.feed b { font-weight: 640; }

/* ---- player page ----------------------------------------------------- */

.back { display: inline-block; margin-block: 1.25rem 0; }

.player-head { padding-block: 1.5rem 0; }

.player-head h1 {
	margin: 0;
	font-size: clamp(1.75rem, 5vw, 2.5rem);
	letter-spacing: -0.03em;
	font-weight: 680;
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
}

.player-head .meta { margin: 0.4rem 0 0; color: var(--slate-soft); }

.badge {
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0;
	padding: 0.2rem 0.5rem;
	border-radius: 2px;
	background: var(--moss);
	color: var(--stone);
}

.kv { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1px; background: var(--stone-deep); border: var(--rule); }
.kv > div { background: var(--stone); padding: 0.8rem 1rem; }
.kv dt { color: var(--slate-soft); font-size: 0.9rem; }
.kv dd { margin: 0.1rem 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Ranked lists: the bar is the comparison, the number is the fact. */
.bars { margin: 0; padding: 0; list-style: none; }

.bars li {
	display: grid;
	grid-template-columns: minmax(7rem, 1fr) minmax(0, 2fr) auto;
	align-items: center;
	gap: 0.75rem;
	padding: 0.35rem 0;
}

.bars .label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
}

.bars .label-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Minecraft textures ---------------------------------------------- */

/*
 * Textures are 16px art. Nearest-neighbour keeps the pixels square instead of
 * blurring them, which is the whole point of showing the real thing.
 */
.icon {
	--icon-size: 1.5rem;
	width: var(--icon-size);
	height: var(--icon-size);
	flex: none;
	background-repeat: no-repeat;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}

/*
 * Square item and block textures fill the box. Animated blocks (water, fire,
 * portals) ship as a vertical strip of frames, so anchoring to the top shows
 * frame one rather than squashing the whole film.
 */
.icon.flat {
	background-size: 100% auto;
	background-position: top center;
}

/*
 * A mob face is a rectangle inside its entity sheet. Scaling the sheet so the
 * head's longer edge equals the icon box, then shifting the crop into view,
 * avoids cutting up the texture files themselves.
 */
.icon.mob {
	background-size:
		calc(var(--sheet-w) / var(--unit) * var(--icon-size))
		calc(var(--sheet-h) / var(--unit) * var(--icon-size));
	background-position:
		calc((var(--inset-x) - var(--x)) / var(--unit) * var(--icon-size))
		calc((var(--inset-y) - var(--y)) / var(--unit) * var(--icon-size));
}

/* No vanilla texture exists for modded content. */
.icon.none {
	display: grid;
	place-items: center;
	font-size: 0.8rem;
	font-weight: 650;
	color: var(--slate-soft);
	background: var(--stone-deep);
	border-radius: 2px;
}

.bars .track { height: 0.6rem; background: var(--stone-deep); border-radius: 1px; }

.bars .fill { display: block; height: 100%; background: var(--lapis); border-radius: 1px; }

.bars .value { font-variant-numeric: tabular-nums; font-weight: 600; }

.more-button {
	font: inherit;
	font-weight: 600;
	margin-top: 1rem;
	padding: 0.6rem 1.1rem;
	color: var(--lapis);
	background: none;
	border: 2px solid var(--stone-deep);
	border-radius: 2px;
	cursor: pointer;
}

.more-button:hover:not(:disabled) { border-color: var(--lapis); }
.more-button:disabled { color: var(--slate-soft); cursor: default; }

details.more { margin-top: 1.5rem; border-top: var(--rule); padding-top: 1rem; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--lapis); }
details.more[open] summary { margin-bottom: 0.75rem; }

.two-up { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: var(--gap); }

.two-up h3 { margin: 0 0 0.6rem; font-size: 1.05rem; font-weight: 640; }

.band h3 { margin: 0 0 0.2rem; font-size: 1.15rem; letter-spacing: -0.02em; font-weight: 650; }
.band h3 + .meta { margin: 0 0 1rem; }

/* ---- states ---------------------------------------------------------- */

.loading, .empty, .failed { color: var(--slate-soft); margin: 0; max-width: var(--measure); }

.failed { color: var(--slate); }

.failed b { display: block; font-weight: 640; }

.skeleton {
	display: block;
	height: 0.85rem;
	margin: 0.5rem 0;
	background: var(--stone-deep);
	border-radius: 2px;
	max-width: 22rem;
}

.skeleton:nth-child(2) { max-width: 16rem; }
.skeleton:nth-child(3) { max-width: 19rem; }

.footer {
	padding-block: 2rem 3rem;
	color: var(--slate-soft);
	font-size: 0.9rem;
}

.footer p { margin: 0; max-width: var(--measure); }

/* ---- narrow screens -------------------------------------------------- */

@media (max-width: 34rem) {
	/* The roster stops being a table and becomes one block per player. */
	.roster, .roster tbody, .roster tr, .roster td { display: block; width: 100%; }
	.roster thead { display: none; }

	.roster tr {
		border-bottom: var(--rule);
		padding-block: 0.85rem;
	}

	.roster td {
		border: 0;
		padding: 0.1rem 0;
		display: flex;
		justify-content: space-between;
		gap: 1rem;
		text-align: right;
		white-space: normal;
	}

	.roster td::before {
		content: attr(data-label);
		color: var(--slate-soft);
		font-size: 0.9rem;
		text-align: left;
	}

	.roster td:first-child {
		font-size: 1.1rem;
		padding-bottom: 0.4rem;
	}

	.roster td:first-child::before { content: none; }

	.bars li { grid-template-columns: 1fr auto; }
	.bars .track { display: none; }
	.icon { --icon-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
