/**
 * Magazine layout.
 *
 * The catalogue layout leans on portrait cover art doing the visual work.
 * Article artwork is 16:9 and far less reliable — some posts have a good
 * photo, some have a screenshot, some have a logo on white. So the design
 * here carries itself with structure and type rather than depending on the
 * pictures: a clear size hierarchy, generous space, and one accent per
 * category.
 *
 * Every hover animates transform or opacity only.
 */

/* ==========================================================================
   Category chips
   ==========================================================================
   The hue comes from the term slug (see wpx_term_hue), so a category keeps
   one colour everywhere without anyone choosing it. Saturation and lightness
   are fixed at values that stay legible on both schemes.
   ========================================================================== */

.wpx-chip {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	padding: 3px var(--wpx-space-3);
	border-radius: var(--wpx-radius-sm);
	background: hsl(var(--wpx-chip-hue, 4) 62% 46%);
	color: #fff;
	font-size: 10px;
	font-weight: var(--wpx-weight-bold);
	text-transform: uppercase;
	letter-spacing: 0.1em;
	line-height: 1.6;
	text-decoration: none;
	white-space: nowrap;
	transition: filter var(--wpx-transition), transform var(--wpx-transition);
}

a.wpx-chip:hover {
	filter: brightness(1.15);
	transform: translateY(-1px);
	color: #fff;
}

/* ==========================================================================
   Mosaic
   ==========================================================================
   A lead story with a list of runners-up beside it.

   The earlier version put four image tiles in a 2x2 grid inside the right
   column. That column is about 420px wide, so each tile came out roughly
   205x265 — portrait. A 16:9 photo cannot sit in a portrait box without
   losing most of its width, which is why correctly-sized artwork still
   looked wrong. Compact rows instead: every thumbnail keeps its 16:9 shape,
   and the count no longer changes the geometry.
   ========================================================================== */

.wpx-banner--mosaic { padding-block-start: var(--wpx-space-5); }

.wpx-mosaic {
	display: grid;
	gap: var(--wpx-space-4);
	grid-template-columns: 1fr;
	align-items: stretch;
}

@media (min-width: 900px) {
	.wpx-mosaic { grid-template-columns: 1.7fr 1fr; }
}

/* --- Lead ---------------------------------------------------------------- */

.wpx-mosaic__lead { min-width: 0; }

.wpx-mosaic__link {
	position: relative;
	display: block;
	height: 100%;
	border-radius: var(--wpx-radius-lg);
	overflow: hidden;
	color: inherit;
	background: var(--wpx-surface-2);
	isolation: isolate;
}

.wpx-mosaic__media {
	display: block;
	height: 100%;
	background: var(--wpx-surface-3);
}

/* 16:9 on wide screens, a little taller on narrow ones so the headline has
   somewhere to sit. */
.wpx-mosaic__lead .wpx-mosaic__link { aspect-ratio: 16 / 9; }

@media (max-width: 899px) {
	.wpx-mosaic__lead .wpx-mosaic__link { aspect-ratio: 4 / 3; }
}

.wpx-mosaic__image {
	width: 100%;
	height: 100%;
	object-fit: cover;

	/* Artwork that is not 16:9 still gets cropped. Anchoring above centre
	   keeps titles and faces — which sit high on almost every cover — in
	   the frame. */
	object-position: center 32%;

	transition: transform 620ms var(--wpx-ease-out);
}

.wpx-mosaic__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(
		to top,
		rgb(from var(--wpx-bg) r g b / 0.96) 0%,
		rgb(from var(--wpx-bg) r g b / 0.78) 32%,
		rgb(from var(--wpx-bg) r g b / 0.12) 68%,
		transparent 100%
	);
	transition: opacity var(--wpx-duration) var(--wpx-ease);
}

.wpx-mosaic__body {
	position: absolute;
	z-index: 2;
	inset-inline: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	gap: var(--wpx-space-2);
	padding: var(--wpx-space-5);
}

.wpx-mosaic__title {
	margin: 0;
	color: #fff;
	font-size: var(--wpx-text-3xl);
	line-height: 1.14;
	text-shadow: 0 2px 18px rgb(0 0 0 / 0.55);
	transition: color var(--wpx-transition);

	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wpx-mosaic__excerpt {
	margin: 0;
	max-width: 56ch;
	color: rgb(255 255 255 / 0.82);
	font-size: var(--wpx-text-base);

	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wpx-mosaic__link:hover .wpx-mosaic__image,
.wpx-mosaic__link:focus-visible .wpx-mosaic__image { transform: scale(1.045); }

.wpx-mosaic__link:hover::after { opacity: 0.88; }
.wpx-mosaic__link:hover .wpx-mosaic__title { color: var(--wpx-accent-hover); }
.wpx-mosaic__link:focus-visible { outline: 2px solid var(--wpx-accent); outline-offset: 3px; }

/* --- The list beside it --------------------------------------------------- */

.wpx-mosaic__rest {
	list-style: none;
	margin: 0;
	padding: var(--wpx-space-3);
	display: flex;
	flex-direction: column;
	gap: var(--wpx-space-1);
	background: var(--wpx-surface-2);
	border: 1px solid var(--wpx-border);
	border-radius: var(--wpx-radius-lg);

	/* Never taller than the lead; a long list scrolls rather than stretching
	   the banner. */
	max-height: 100%;
	overflow-y: auto;
	scrollbar-width: thin;
}

.wpx-mosaic__item { margin: 0; }

.wpx-mosaic__item + .wpx-mosaic__item {
	border-block-start: 1px solid rgb(from var(--wpx-border) r g b / 0.7);
	padding-block-start: var(--wpx-space-1);
}

.wpx-mosaic__item-link {
	display: flex;
	gap: var(--wpx-space-3);
	align-items: flex-start;
	padding: var(--wpx-space-2);
	border-radius: var(--wpx-radius);
	color: inherit;
	transition: background var(--wpx-transition), transform 240ms var(--wpx-ease-out);
}

.wpx-mosaic__item-link:hover {
	background: var(--wpx-surface-3);
	transform: translateX(2px);
}

.wpx-mosaic__thumb {
	flex: none;
	width: 132px;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--wpx-radius-sm);
	background: var(--wpx-surface-3);
}

.wpx-mosaic__thumb-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 32%;
	transition: transform 420ms var(--wpx-ease-out);
}

.wpx-mosaic__item-link:hover .wpx-mosaic__thumb-image { transform: scale(1.07); }

.wpx-mosaic__item-body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	align-items: flex-start;
}

.wpx-mosaic__item-title {
	font-size: var(--wpx-text-sm);
	font-weight: var(--wpx-weight-medium);
	line-height: 1.35;
	color: var(--wpx-text);
	transition: color var(--wpx-transition);

	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wpx-mosaic__item-link:hover .wpx-mosaic__item-title { color: var(--wpx-accent); }

.wpx-mosaic__item .wpx-chip { font-size: 9px; padding-inline: var(--wpx-space-2); }

.wpx-mosaic__item .wpx-article-meta { color: var(--wpx-text-dim); font-size: 11px; }

@media (max-width: 899px) {
	.wpx-mosaic__body { padding: var(--wpx-space-4); }
	.wpx-mosaic__title { font-size: var(--wpx-text-2xl); }
	.wpx-mosaic__excerpt { display: none; }
	.wpx-mosaic__rest { max-height: none; overflow: visible; }
	.wpx-mosaic__thumb { width: 112px; }
}

@media (max-width: 480px) {
	.wpx-mosaic__title { font-size: var(--wpx-text-xl); }
	.wpx-mosaic__thumb { width: 96px; }
	.wpx-mosaic__item .wpx-chip { display: none; }
}

/* ==========================================================================
   Article cards
   ========================================================================== */

.wpx-shape-wide .wpx-grid {
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: var(--wpx-space-5);
}

.wpx-acard {
	display: flex;
	flex-direction: column;
	background: transparent;
	border: 0;
	padding: 0;
}

.wpx-acard__media {
	display: block;
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--wpx-radius);
	background: var(--wpx-surface-3);
}

.wpx-acard__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 520ms var(--wpx-ease-out);
}

/* A line that draws itself across the image on hover — the one flourish
   these cards get. */
.wpx-acard__media::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	height: 3px;
	background: linear-gradient( 90deg, var(--wpx-accent), var(--wpx-secondary) );
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 420ms var(--wpx-ease-out);
}

.wpx-acard:hover .wpx-acard__image { transform: scale(1.05); }
.wpx-acard:hover .wpx-acard__media::after { transform: scaleX(1); }

.wpx-acard__body {
	display: flex;
	flex-direction: column;
	gap: var(--wpx-space-2);
	padding-block-start: var(--wpx-space-3);
}

.wpx-acard__title {
	margin: 0;
	font-size: var(--wpx-text-lg);
	line-height: 1.28;
}

.wpx-acard__title a {
	color: var(--wpx-text);
	text-decoration: none;
	background-image: linear-gradient( var(--wpx-accent), var(--wpx-accent) );
	background-size: 0 2px;
	background-position: 0 100%;
	background-repeat: no-repeat;
	transition: background-size 320ms var(--wpx-ease-out), color var(--wpx-transition);
}

.wpx-acard:hover .wpx-acard__title a {
	background-size: 100% 2px;
	color: var(--wpx-accent-hover);
}

.wpx-acard__excerpt {
	margin: 0;
	font-size: var(--wpx-text-sm);
	color: var(--wpx-text-muted);
	line-height: 1.6;

	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ==========================================================================
   Article meta
   ========================================================================== */

.wpx-article-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wpx-space-2);
	font-size: var(--wpx-text-xs);
	color: var(--wpx-text-dim);
}

.wpx-mosaic__body .wpx-article-meta { color: rgb(255 255 255 / 0.7); }

/* ==========================================================================
   Category rows
   ========================================================================== */

.wpx-row-cat + .wpx-row-cat { margin-block-start: var(--wpx-space-8); }

.wpx-row-cat__header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--wpx-space-4);
	margin-block-end: var(--wpx-space-5);
	padding-block-end: var(--wpx-space-3);
	border-block-end: 1px solid var(--wpx-border);
}

.wpx-row-cat__title {
	position: relative;
	margin: 0;
	padding-block-end: var(--wpx-space-3);
	font-size: var(--wpx-text-xl);
	letter-spacing: -0.01em;
}

/* The category's own colour, as a short rule under its name. */
.wpx-row-cat__title::after {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	bottom: -1px;
	width: 56px;
	height: 3px;
	border-radius: 3px;
	background: hsl(var(--wpx-chip-hue, 4) 62% 46%);
}

.wpx-row-cat__all {
	display: inline-flex;
	align-items: center;
	gap: var(--wpx-space-2);
	font-size: var(--wpx-text-sm);
	font-weight: var(--wpx-weight-medium);
	color: var(--wpx-text-dim);
	white-space: nowrap;
	transition: color var(--wpx-transition), gap var(--wpx-transition);
}

.wpx-row-cat__all:hover {
	color: var(--wpx-accent);
	gap: var(--wpx-space-3);
}

.wpx-row-cat__body {
	display: grid;
	gap: var(--wpx-space-5);
	grid-template-columns: 1fr;
}

@media (min-width: 800px) {
	.wpx-row-cat__body { grid-template-columns: 1.15fr 1fr; }
}

/* --- Lead story ------------------------------------------------------------ */

.wpx-feature__media {
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--wpx-radius);
	background: var(--wpx-surface-3);
}

.wpx-feature__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 560ms var(--wpx-ease-out);
}

.wpx-feature:hover .wpx-feature__image { transform: scale(1.04); }

.wpx-feature__body {
	display: flex;
	flex-direction: column;
	gap: var(--wpx-space-2);
	padding-block-start: var(--wpx-space-4);
}

.wpx-feature__title { margin: 0; font-size: var(--wpx-text-2xl); line-height: 1.2; }

.wpx-feature__title a {
	color: var(--wpx-text);
	transition: color var(--wpx-transition);
}

.wpx-feature__title a:hover { color: var(--wpx-accent-hover); }

.wpx-feature__excerpt {
	margin: 0;
	color: var(--wpx-text-muted);
	line-height: 1.65;

	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* --- The list beside it ----------------------------------------------------- */

.wpx-rowlist {
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: wpx-rank;
}

.wpx-rowlist__item + .wpx-rowlist__item {
	margin-block-start: var(--wpx-space-3);
	padding-block-start: var(--wpx-space-3);
	border-block-start: 1px solid var(--wpx-border);
}

.wpx-rowlist__link {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--wpx-space-3);
	color: inherit;
}

/* A large, quiet numeral behind the row. Enough to give the list a rhythm,
   faint enough not to compete with the headline. */
.wpx-rowlist__num {
	flex: none;
	width: 26px;
	font-size: var(--wpx-text-2xl);
	font-weight: var(--wpx-weight-bold);
	line-height: 1;
	color: transparent;
	-webkit-text-stroke: 1px var(--wpx-border-strong);
	transition: -webkit-text-stroke-color var(--wpx-transition), color var(--wpx-transition);
}

.wpx-rowlist__link:hover .wpx-rowlist__num {
	-webkit-text-stroke-color: var(--wpx-accent);
}

.wpx-rowlist__media {
	flex: none;
	width: 96px;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--wpx-radius-sm);
	background: var(--wpx-surface-3);
}

.wpx-rowlist__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 420ms var(--wpx-ease-out);
}

.wpx-rowlist__link:hover .wpx-rowlist__image { transform: scale(1.08); }

.wpx-rowlist__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.wpx-rowlist__title {
	font-size: var(--wpx-text-sm);
	font-weight: var(--wpx-weight-medium);
	line-height: 1.35;
	color: var(--wpx-text);
	transition: color var(--wpx-transition);

	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wpx-rowlist__link:hover .wpx-rowlist__title { color: var(--wpx-accent); }

@media (max-width: 480px) {
	.wpx-rowlist__num { display: none; }
	.wpx-rowlist__media { width: 76px; }
	.wpx-feature__title { font-size: var(--wpx-text-xl); }
}

/* ==========================================================================
   Single article, magazine mode
   ========================================================================== */

.wpx-layout-magazine .wpx-game__lead { display: block; }

.wpx-layout-magazine .wpx-game__cover {
	float: none;
	max-width: none;
	margin: 0 0 var(--wpx-space-5);
}

.wpx-layout-magazine .wpx-game__cover img {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	border-radius: var(--wpx-radius);
}

/* The headline follows the same choice as the body. A cap here made a
   three-word title wrap over three lines while the column sat half empty. */
.wpx-prose-comfortable .wpx-game__title,
.wpx-prose-comfortable .wpx-page-title { max-width: 28ch; }

/* The measure is a choice, not a rule.

   72 characters is the readable width for running prose — past that the eye
   struggles to find the start of the next line. But a post built around spec
   tables and screenshots wants the whole column, and capping it just leaves
   a gap beside the text. Default is full; the narrow measure is opt-in. */
.wpx-prose-comfortable .wpx-prose { max-width: 72ch; }

/* Even at full width, tables and images should not be forced narrow. */
.wpx-prose-comfortable .wpx-prose > figure,
.wpx-prose-comfortable .wpx-prose > .wp-block-table,
.wpx-prose-comfortable .wpx-prose > .wp-block-image { max-width: none; }

/* ==========================================================================
   Light scheme adjustments
   ==========================================================================
   The mosaic scrim and card shadows are built for a dark page. On light,
   the same values look muddy.
   ========================================================================== */

[data-wpx-scheme="light"] .wpx-mosaic__link::after {
	background: linear-gradient(
		to top,
		rgb(0 0 0 / 0.88) 0%,
		rgb(0 0 0 / 0.62) 34%,
		rgb(0 0 0 / 0.1) 70%,
		transparent 100%
	);
}

[data-wpx-scheme="light"] .wpx-acard__media { background: #e6e6ea; }
[data-wpx-scheme="light"] .wpx-rowlist__num { -webkit-text-stroke-color: #c4c4cc; }

/* ==========================================================================
   Motion opt-out
   ========================================================================== */

.wpx-motion-off .wpx-mosaic__image,
.wpx-motion-off .wpx-acard__image,
.wpx-motion-off .wpx-feature__image,
.wpx-motion-off .wpx-rowlist__image { transition: none; transform: none !important; }

.wpx-motion-off .wpx-acard__media::after { display: none; }

@media (prefers-reduced-motion: reduce) {
	.wpx-mosaic__image,
	.wpx-acard__image,
	.wpx-feature__image,
	.wpx-rowlist__image { transition: none; }

	.wpx-mosaic__link:hover .wpx-mosaic__image,
	.wpx-acard:hover .wpx-acard__image,
	.wpx-feature:hover .wpx-feature__image,
	.wpx-rowlist__link:hover .wpx-rowlist__image { transform: none; }
}

/* ==========================================================================
   Mosaic lead — rotating
   ========================================================================== */

.wpx-mosaic__lead.is-rotating {
	position: relative;
	border-radius: var(--wpx-radius-lg);
	overflow: hidden;
	aspect-ratio: 16 / 9;
	background: var(--wpx-surface-2);
}

@media (max-width: 899px) {
	.wpx-mosaic__lead.is-rotating { aspect-ratio: 4 / 3; }
}

/* Slides stack; only the active one is painted. Opacity rather than display
   so the change can be eased. */
.wpx-lead-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 520ms var(--wpx-ease), visibility 520ms;
}

.wpx-lead-slide.is-active { opacity: 1; visibility: visible; }

.wpx-mosaic__lead.is-rotating .wpx-mosaic__link {
	aspect-ratio: auto;
	height: 100%;
	border-radius: 0;
}

/* A still lead keeps its own rounding; the rotating one is clipped by the
   wrapper instead. */
.wpx-mosaic__lead:not(.is-rotating) .wpx-mosaic__link { aspect-ratio: 16 / 9; }

@media (max-width: 899px) {
	.wpx-mosaic__lead:not(.is-rotating) .wpx-mosaic__link { aspect-ratio: 4 / 3; }
}

/* Leave room for the controls so a long headline does not run under them. */
.wpx-mosaic__lead.is-rotating .wpx-mosaic__body { padding-block-end: var(--wpx-space-7); }

/* --- Controls -------------------------------------------------------------- */

.wpx-lead-controls {
	position: absolute;
	z-index: 3;
	inset-inline-end: var(--wpx-space-4);
	bottom: var(--wpx-space-4);
	display: flex;
	align-items: center;
	gap: var(--wpx-space-2);
}

.wpx-lead-btn,
.wpx-lead-dot {
	appearance: none;
	-webkit-appearance: none;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	font-weight: 400;
}

.wpx-lead-btn {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: rgb(from var(--wpx-bg) r g b / 0.55);
	color: #fff;
	border: 1px solid rgb(255 255 255 / 0.14);
	border-radius: var(--wpx-radius-pill);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	transition: background var(--wpx-transition), transform var(--wpx-transition);
}

.wpx-lead-btn:hover {
	background: var(--wpx-accent);
	transform: scale(1.08);
	box-shadow: none;
	color: #fff;
}

.wpx-lead-dots { display: flex; gap: 6px; }

.wpx-lead-dot {
	width: 8px;
	height: 8px;
	padding: 0;
	background: rgb(255 255 255 / 0.4);
	border: 0;
	border-radius: var(--wpx-radius-pill);
	cursor: pointer;
	transition: background var(--wpx-transition), width var(--wpx-transition);
}

.wpx-lead-dot.is-active { width: 22px; background: var(--wpx-accent); }

@media (max-width: 480px) {
	.wpx-lead-controls { inset-inline-end: var(--wpx-space-3); bottom: var(--wpx-space-3); }
	.wpx-lead-btn { width: 28px; height: 28px; }
}

.wpx-motion-off .wpx-lead-slide { transition: none; }

@media (prefers-reduced-motion: reduce) {
	.wpx-lead-slide { transition: none; }
	.wpx-lead-btn:hover { transform: none; }
}

/* ==========================================================================
   Flat cards
   ==========================================================================
   The other treatment: no ribbon, no plate behind the cover, title under the
   image. Used by the light pack, where the ribbon reads as heavy.
   ========================================================================== */

.wpx-cards-flat .wpx-card {
	background: transparent;
	border: 0;
	padding: 0;
}

.wpx-cards-flat .wpx-card__media {
	border-radius: var(--wpx-radius);
	border: 1px solid var(--wpx-border);
}

.wpx-cards-flat .wpx-card__title {
	background: transparent;
	padding: var(--wpx-space-3) 0 0;
	margin: 0;
	text-align: start;
	font-size: var(--wpx-text-base);
}

.wpx-cards-flat .wpx-card__meta { padding-inline: 0; }

.wpx-cards-flat .wpx-card__views {
	background: transparent;
	padding-inline: 0;
	justify-content: flex-start;
}

.wpx-cards-flat .wpx-badges {
	inset-block-start: var(--wpx-space-2);
	inset-inline-start: var(--wpx-space-2);
	flex-direction: row;
	gap: var(--wpx-space-1);
}

.wpx-cards-flat .wpx-badge {
	width: auto;
	clip-path: none;
	padding: 3px var(--wpx-space-2);
	border-radius: var(--wpx-radius-sm);
}

.wpx-cards-flat .wpx-card:hover,
.wpx-cards-flat .wpx-card:focus-within {
	transform: translateY(-3px);
	background: transparent;
	box-shadow: none;
}

.wpx-cards-flat .wpx-card:hover .wpx-card__media {
	border-color: var(--wpx-accent);
	box-shadow: var(--wpx-shadow-lg);
}

.wpx-cards-flat .wpx-card:hover .wpx-card__title { background: transparent; color: var(--wpx-accent); }
