/* ==========================================================================
   Game List (template-parts/game-list.php)
   Shown above Gaming Providers, before the footer; managed in
   Theme Settings → Game List. Inline vars from the template:
     --gl-cols-d / --gl-cols-m   cards per row (desktop / mobile)
     --gl-mt-* / --gl-mb-*       top / bottom margin
     --gl-max                    desktop grid width inside the side padding
                                 (unset = full width; mobile = full)
     --gl-side-d / --gl-side-m   left / right padding. Desktop only applies
                                 while the container is narrower than max
                                 width + both sides (as in Post Navigation)
   The grid itself is the max width, so it lines up with the blocks around
   it; the arrows sit outside it on screens ≥ 1240px, inside it below.
   ========================================================================== */

.reelzappy-games {
	--gl-cols: var(--gl-cols-d, 8);
	--gl-gap: 16px;
	--gl-arrow: 36px;

	margin-block: var(--gl-mt-d, 0) var(--gl-mb-d, 0);
	color: var(--color-text, #F5F5FA);
}

.reelzappy-games__inner {
	--gl-side: var(--gl-side-d, 16px);
	--gl-maxw: var(--gl-max, 100%);
	--gl-side-eff: clamp(0px, (var(--gl-maxw) + var(--gl-side) * 2 - 100%) * 1000, var(--gl-side));

	box-sizing: border-box;
	max-width: calc(var(--gl-maxw) + var(--gl-side-eff) * 2);
	margin: 0 auto;
	padding-inline: var(--gl-side-eff);
}

/* Grid ------------------------------------------------------------------ */

.reelzappy-games__body {
	position: relative;
}

.reelzappy-games--paging-arrows .reelzappy-games__body {
	padding-inline: var(--gl-arrow);
}

/*
 * Flex-wrap instead of grid so a short row (fewer games than cards per row)
 * is centred rather than left-aligned. Each card is still exactly one
 * column wide: (100% - gaps) / cards per row.
 */
.reelzappy-games__grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--gl-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.reelzappy-games__item {
	flex: 0 0 calc((100% - (var(--gl-cols) - 1) * var(--gl-gap)) / var(--gl-cols));
	min-width: 0;
}

.reelzappy-games__item[hidden] {
	display: none;
}

.reelzappy-games.is-ready .reelzappy-games__item:not([hidden]) {
	animation: reelzappy-games-in 0.25s ease both;
}

@keyframes reelzappy-games-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

/* Card ------------------------------------------------------------------ */

.reelzappy-games__card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	color: inherit;
	text-decoration: none;
}

.reelzappy-games__thumb {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 6px;
	aspect-ratio: 3 / 4;
	background: transparent;
}

.reelzappy-games__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.25s ease;
}

a.reelzappy-games__card:hover .reelzappy-games__image,
a.reelzappy-games__card:focus-visible .reelzappy-games__image {
	transform: scale(1.04);
}

a.reelzappy-games__card:focus-visible {
	outline: 2px solid var(--color-link, #F8F503);
	outline-offset: 3px;
	border-radius: 6px;
}

.reelzappy-games__button {
	display: block;
	padding: 8px 10px;
	border-radius: 999px;
	background: var(--color-button-primary-background, #F8F503);
	font-family: var(--font-family-heading, 'Archivo Black', sans-serif);
	font-size: 12px;
	line-height: 1.2;
	text-align: center;
	text-transform: uppercase;
	overflow-wrap: break-word; /* long text wraps instead of being cut off */
	color: var(--color-button-primary-text, #000000);
	transition: background-color 0.2s ease;
}

a.reelzappy-games__card:hover .reelzappy-games__button {
	background: var(--color-button-primary-hover-background, #FFFF73);
}

/* Plain game title (no button), wraps onto as many lines as needed. */
.reelzappy-games__title {
	display: block;
	font-family: var(--font-family-subheading, 'Archivo', sans-serif);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	overflow-wrap: break-word;
	color: var(--color-text, #F5F5FA);
}

a.reelzappy-games__card:hover .reelzappy-games__title {
	color: var(--color-link, #F8F503);
}

/* Arrows ---------------------------------------------------------------- */

.reelzappy-games__arrow {
	position: absolute;
	top: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--gl-arrow);
	padding: 0;
	border: 0;
	background: transparent;
	color: #FFFFFF;
	cursor: pointer;
	transition: color 0.2s ease;
}

.reelzappy-games__arrow[hidden] {
	display: none;
}

.reelzappy-games__arrow--prev {
	left: 0;
}

.reelzappy-games__arrow--next {
	right: 0;
}

.reelzappy-games__arrow:hover,
.reelzappy-games__arrow:focus-visible {
	color: var(--color-link, #F8F503);
}

.reelzappy-games__arrow:focus-visible {
	outline: 2px solid var(--color-link, #F8F503);
	outline-offset: -2px;
}

/* Wide screens: arrows outside the grid. */
@media (min-width: 1240px) {
	.reelzappy-games--paging-arrows .reelzappy-games__body {
		padding-inline: 0;
	}

	.reelzappy-games__arrow--prev {
		left: calc(var(--gl-arrow) * -1);
	}

	.reelzappy-games__arrow--next {
		right: calc(var(--gl-arrow) * -1);
	}
}

/* Numbered pagination --------------------------------------------------- */

.reelzappy-games__pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-top: 32px;
}

.reelzappy-games__pagination[hidden] {
	display: none;
}

.reelzappy-games__page {
	min-width: 40px;
	height: 40px;
	padding: 0 8px;
	border: 1px solid var(--color-link, #F8F503);
	border-radius: 8px;
	background: transparent;
	font-family: var(--font-family-subheading, 'Archivo', sans-serif);
	font-size: 16px;
	font-weight: 700;
	color: var(--color-link, #F8F503);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.reelzappy-games__page:hover:not(:disabled),
.reelzappy-games__page.is-current {
	background: var(--color-button-primary-background, #F8F503);
	color: var(--color-button-primary-text, #000000);
}

.reelzappy-games__page--prev,
.reelzappy-games__page--next {
	border-color: transparent;
	background: #000000;
	color: #FFFFFF;
}

.reelzappy-games__page:disabled {
	opacity: 0.5;
	cursor: default;
}

.reelzappy-games__page:focus-visible {
	outline: 2px solid #FFFFFF;
	outline-offset: 2px;
}

.reelzappy-games__page-gap {
	color: var(--color-text, #F5F5FA);
}

@media (prefers-reduced-motion: reduce) {
	.reelzappy-games.is-ready .reelzappy-games__item:not([hidden]) {
		animation: none;
	}

	.reelzappy-games__image {
		transition: none;
	}
}

/* Mobile ---------------------------------------------------------------- */

@media (max-width: 768px) {
	.reelzappy-games {
		--gl-cols: var(--gl-cols-m, 3);
		--gl-gap: 10px;
		--gl-arrow: 28px;

		margin-block: var(--gl-mt-m, 0) var(--gl-mb-m, 0);
	}

	.reelzappy-games__inner {
		max-width: 100%; /* Full width on mobile. */
		padding-inline: var(--gl-side-m, 16px); /* Mobile side padding always applies. */
	}

	.reelzappy-games__button {
		padding: 6px 8px;
		font-size: 10px;
	}

	.reelzappy-games__title {
		font-size: 12px;
	}

	.reelzappy-games__pagination {
		gap: 6px;
		margin-top: 24px;
	}

	.reelzappy-games__page {
		min-width: 34px;
		height: 34px;
		font-size: 14px;
	}
}
