/*
 * The downloads on a Ren'Py game's pages.
 *
 * On the pre-game page they are a panel of their own under the description: a
 * row of identical buttons, one per platform, each with its icon, size and file
 * type. On the play page the same markup sits inside the theme's dark .game-cn
 * band and becomes a single row of pills under the game.
 *
 * No platform is styled differently from another - the site cannot know which
 * one a visitor wants.
 *
 * Colours are the theme's own: navy #2D3E58 and teal #16C4BB from create.css.
 * Everything is scoped under .im3d-rg-downloads so nothing else on the page
 * changes, and the selectors carry the link element so they outrank the theme's
 * a and a:hover colours.
 */

.im3d-rg-downloads {
	background: #f7f8fa;
	border: 1px solid #e3e6eb;
	clear: both;
	display: grid;
	gap: 14px;
	margin: 25px 0;
	padding: 16px;
	text-align: left;
}

/* A download-only game has nothing else to offer, so its panel comes first. */
.im3d-rg-downloads.is-download-only {
	margin-top: 0;
}

.im3d-rg-downloads .im3d-rg-dl-head {
	align-items: baseline;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
	justify-content: space-between;
}

.im3d-rg-downloads .im3d-rg-dl-head h3 {
	color: #2d3e58;
	font-size: 13px;
	font-weight: 800;
	letter-spacing: 0.08em;
	margin: 0;
	text-transform: uppercase;
}

.im3d-rg-downloads .im3d-rg-dl-head small,
.im3d-rg-downloads .im3d-rg-dl-help {
	color: #8a8f97;
	font-size: 12px;
}

.im3d-rg-downloads .im3d-rg-dl-help {
	margin: 0;
}

.im3d-rg-downloads ul {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.im3d-rg-downloads li {
	margin: 0;
	min-width: 0;
	padding: 0;
}

.im3d-rg-downloads li::before,
.im3d-rg-downloads li::marker {
	content: none;
}

/* ---- the buttons ---- */

.im3d-rg-downloads a.im3d-rg-download {
	align-items: stretch;
	background: #2d3e58;
	color: #fff;
	display: flex;
	height: 100%;
	min-height: 50px;
	text-decoration: none;
	transition: background-color 0.2s;
}

.im3d-rg-downloads a.im3d-rg-download:hover,
.im3d-rg-downloads a.im3d-rg-download:focus-visible {
	background: #22314a;
	color: #fff;
}

.im3d-rg-downloads a.im3d-rg-download:focus-visible {
	outline: 2px solid #16c4bb;
	outline-offset: 2px;
}

.im3d-rg-downloads .im3d-rg-icon {
	background: #16c4bb;
	display: grid;
	flex: none;
	place-items: center;
	transition: background-color 0.2s;
	width: 50px;
}

.im3d-rg-downloads a.im3d-rg-download:hover .im3d-rg-icon {
	background: #12aaa2;
}

.im3d-rg-downloads .im3d-rg-icon svg {
	height: 22px;
	width: 22px;
}

.im3d-rg-downloads .im3d-rg-text {
	align-content: center;
	display: grid;
	line-height: 1.3;
	min-width: 0;
	padding: 6px 14px;
}

.im3d-rg-downloads .im3d-rg-label {
	font-size: 14px;
	font-weight: 700;
}

.im3d-rg-downloads .im3d-rg-size {
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	opacity: 0.75;
	white-space: nowrap;
}

/*
 * ---- on the play page ----
 *
 * Inside the theme's navy band, where a navy button would vanish into the
 * background. One row: a short label, then the platforms as identical
 * translucent pills.
 *
 * Shaded and centred like the theme's .game-ctrl toolbar just above it, so it
 * reads as part of the page's controls rather than of the game window.
 */

.game-cn .im3d-rg-downloads {
	align-items: center;
	background: rgba(0, 0, 0, 0.2);
	border: 0;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
	display: flex;
	flex-wrap: wrap;
	gap: 10px 14px;
	justify-content: center;
	margin: 0;
	padding: 10px 50px;
}

.game-cn .im3d-rg-downloads .im3d-rg-dl-head {
	display: grid;
	gap: 0;
	line-height: 1.3;
	margin-right: 4px;
}

.game-cn .im3d-rg-downloads .im3d-rg-dl-head h3 {
	color: #fff;
	letter-spacing: 0;
	text-transform: none;
}

.game-cn .im3d-rg-downloads .im3d-rg-dl-head small {
	color: rgba(255, 255, 255, 0.65);
}

.game-cn .im3d-rg-downloads .im3d-rg-dl-help {
	display: none;
}

.game-cn .im3d-rg-downloads ul {
	display: flex;
	flex-wrap: wrap;
}

.game-cn .im3d-rg-downloads a.im3d-rg-download {
	align-items: center;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.18);
	gap: 8px;
	min-height: 0;
	padding: 6px 12px 6px 10px;
	transition: background-color 0.2s, border-color 0.2s;
}

.game-cn .im3d-rg-downloads a.im3d-rg-download:hover,
.game-cn .im3d-rg-downloads a.im3d-rg-download:focus-visible {
	background: rgba(255, 255, 255, 0.16);
	border-color: rgba(255, 255, 255, 0.35);
}

.game-cn .im3d-rg-downloads .im3d-rg-icon,
.game-cn .im3d-rg-downloads a.im3d-rg-download:hover .im3d-rg-icon {
	background: none;
	width: auto;
}

.game-cn .im3d-rg-downloads .im3d-rg-icon svg {
	height: 16px;
	width: 16px;
}

.game-cn .im3d-rg-downloads .im3d-rg-text {
	align-items: baseline;
	display: flex;
	gap: 8px;
	padding: 0;
}

.game-cn .im3d-rg-downloads .im3d-rg-label {
	font-size: 13px;
}

/* On a phone every button takes a full row. */
@media (max-width: 480px) {
	.im3d-rg-downloads,
	.game-cn .im3d-rg-downloads {
		padding: 12px;
	}

	.im3d-rg-downloads ul {
		grid-template-columns: 1fr;
	}

	.game-cn .im3d-rg-downloads ul,
	.game-cn .im3d-rg-downloads li {
		flex: 1 1 100%;
	}

	.game-cn .im3d-rg-downloads .im3d-rg-text {
		flex: 1;
		justify-content: space-between;
	}
}

/*
 * While the script checks which region's copy to download - up to a few
 * seconds - the button says so, so a visitor does not click again.
 */
.im3d-rg-downloads a.im3d-rg-download[aria-busy="true"] {
	cursor: progress;
	opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
	.im3d-rg-downloads a.im3d-rg-download,
	.im3d-rg-downloads .im3d-rg-icon {
		transition: none;
	}
}
