/* ---------------------------------------------------------------------
   Game Hub — the `page-game-hub` template (inc/game-hub-view.php).

   Enqueued on a Hub Page only (see that file's wp_enqueue_scripts hook), and
   every selector below is `.gnp-hub*`-scoped, so no other page, archive,
   article or the homepage is affected. It adds no design tokens of its own
   beyond a few hero values: surfaces, text, borders, radii and the type scale
   all come from theme.json / style.css, so the light/dark switch (the
   `--wp--preset--color--*` redefinitions in style.css) repaints the Hub with
   no Hub-specific dark-mode logic. Only the hero is a fixed dark panel (like
   the homepage hero), independent of the colour scheme.

   Mobile-first: the base rules are the phone layout; min-width queries add
   tablet (>=700px) and laptop/desktop (>=1000px, >=1280px) enhancements.
   Images adapt with aspect-ratio + object-fit; no image size is requested
   beyond what the media library already holds (IMAGE STORAGE RULE).
   ------------------------------------------------------------------ */

.gnp-hub {
	--gnp-hub-hero-bg: #050507;
	--gnp-hub-gap: 1.5rem;
	padding: 1.5rem var(--gnp-gutter) var(--wp--preset--spacing--50);
}

.gnp-hub ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.gnp-hub a {
	text-decoration: none;
}

/* ---- Hero ----------------------------------------------------------- */

.gnp-hub-hero {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--lg);
	background: var(--gnp-hub-hero-bg);
	color: var(--wp--preset--color--on-dark);
	/* In dark mode the page itself is near-black; a hairline keeps the panel's edge. */
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Stacked (phone / tablet): artwork first and prominent, text below. */
.gnp-hub-hero__art {
	order: -1;
	position: relative;
	aspect-ratio: 16 / 9;
	max-height: 26rem;
	overflow: hidden;
	-webkit-mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
	mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
}

.gnp-hub-hero__art .gnp-hub-hero__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 40%;
}

.gnp-hub-hero__body {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.25rem clamp(1.25rem, 5vw, 2rem) clamp(1.25rem, 5vw, 2rem);
}

.gnp-hub-hero--no-art .gnp-hub-hero__body {
	padding-top: clamp(1.25rem, 5vw, 2rem);
}

.gnp-hub-tag {
	margin: 0;
	padding: 0.28rem 0.8rem;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--gnp-badge-articles);
	color: var(--wp--preset--color--on-accent);
	font-size: 0.8125rem;
	font-weight: 800;
	letter-spacing: 0.05em;
	line-height: 1.3;
	text-transform: uppercase;
}

.gnp-hub-hero__title {
	margin: 0;
	max-width: 22ch;
	color: var(--wp--preset--color--on-dark);
	font-size: var(--wp--preset--font-size--hero);
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.04;
	text-wrap: balance;
}

.gnp-hub-hero__text {
	margin: 0;
	max-width: 33.5rem;
	color: rgba(245, 245, 247, 0.88);
	font-size: 1.0625rem;
	line-height: 1.5;
	text-wrap: pretty;
}

.gnp-hub-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-top: 0.35rem;
}

.gnp-hub-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 2.5rem;
	padding: 0 1.1rem;
	border-radius: var(--wp--custom--radius--pill);
	background: rgba(255, 255, 255, 0.13);
	color: var(--wp--preset--color--on-dark);
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
}

.gnp-hub-pill--icon {
	padding-left: 0.9rem;
}

.gnp-hub-pill__icon {
	display: inline-flex;
}

.gnp-hub-pill__icon svg {
	width: 1.25rem;
	height: 1.25rem;
	fill: currentColor;
}

/* The shared stroke glyphs (PC, Nintendo) are outlines: never fill them. */
.gnp-hub-pill__icon svg[stroke] {
	fill: none;
}

/* ---- Layout --------------------------------------------------------- */

.gnp-hub-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 2rem;
	margin-top: 1.75rem;
}

.gnp-hub-main {
	display: flex;
	flex-direction: column;
	gap: 1.75rem;
	min-width: 0;
}

.gnp-hub-aside {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.25rem;
	align-content: start;
	min-width: 0;
}

/* ---- Sections + cards ---------------------------------------------- */

.gnp-hub-section__head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 0.35rem 1rem;
	margin-bottom: 0.85rem;
}

.gnp-hub-section__titles {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 0.85rem;
	row-gap: 0.1rem;
	flex: 1 1 auto;
	min-width: 0;
}

.gnp-hub-section__title {
	margin: 0;
	color: var(--wp--preset--color--contrast);
	font-size: clamp(1.375rem, 1.1rem + 0.7vw, 1.5625rem);
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.15;
}

.gnp-hub-section__summary {
	margin: 0;
	color: var(--wp--preset--color--muted);
	font-size: 0.9375rem;
	line-height: 1.4;
}

.gnp-hub-viewall {
	flex-shrink: 0;
	margin: 0;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
}

.gnp-hub-viewall a {
	color: var(--wp--preset--color--contrast);
}

.gnp-hub-viewall a:hover {
	color: var(--wp--preset--color--accent);
}

/* Post cards are the site's own `.gnp-card` component (style.css: 16:10 media
   tile, scrim, category + date badges, overlay title) - nothing of it is
   redefined here. Only the grid and one crop rule are Hub-specific. The grid
   follows the same rhythm as the homepage / archive grids (1 column on phones,
   2 from 700px, gap 1.5rem). */
.gnp-hub-cards {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.5rem;
}

.gnp-hub-item {
	margin: 0;
	list-style: none;
}

/* Face-safe crop. The tile is 16:10, so a typical 16:9 photo loses almost
   nothing sideways; the little that is cropped vertically comes off the bottom
   (faces and key subjects sit in the upper part of a frame), never the middle.
   No face detection, no new image size - object-position only. */
.gnp-hub .gnp-card .gnp-media-frame img {
	object-position: 50% 24%;
}

/* Latest News "Load More" (assets/js/game-hub-load-more.js). The control is
   server-rendered `hidden` and revealed by the script, so a no-JS visitor never
   sees a dead button. The button is the shared .gnp-btn component; the status
   line is a polite live region that is only visible while an error is showing. */
.gnp-hub-more {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	margin-top: var(--gnp-hub-gap);
}

.gnp-hub-more[hidden] {
	display: none;
}

.gnp-hub-more__button[aria-busy="true"] {
	opacity: 0.7;
	cursor: progress;
}

.gnp-hub-more__status {
	margin: 0;
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.gnp-hub-more.is-error .gnp-hub-more__status {
	position: static;
	width: auto;
	height: auto;
	overflow: visible;
	clip: auto;
	white-space: normal;
	color: var(--wp--preset--color--muted);
	font-size: 0.875rem;
	text-align: center;
}

.gnp-hub-empty {
	margin: 0;
	padding: 2rem 1.25rem;
	border: 1px dashed var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--md);
	color: var(--wp--preset--color--muted);
	text-align: center;
}

/* ---- Right column: What to Know -------------------------------------- */

.gnp-hub-panel {
	padding: 1.1rem 1.25rem 1.25rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--preset--color--surface);
}

.gnp-hub-panel__title {
	margin: 0;
	font-size: 1.3125rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.2;
}

.gnp-hub-know__summary {
	margin: 0.6rem 0 0;
	color: var(--wp--preset--color--contrast);
	font-size: 1rem;
	line-height: 1.5;
}

.gnp-hub-facts {
	display: grid;
	gap: 0.95rem;
	margin: 1.1rem 0 0;
}

.gnp-hub-fact dt {
	display: grid;
	grid-template-columns: 1.5rem minmax(0, 1fr);
	column-gap: 0.85rem;
	align-items: start;
	font-size: 0.9375rem;
	font-weight: 800;
	line-height: 1.3;
}

.gnp-hub-fact__icon {
	display: inline-flex;
	padding-top: 0.05rem;
	color: var(--wp--preset--color--contrast);
}

.gnp-hub-fact__icon svg {
	width: 1.3rem;
	height: 1.3rem;
}

.gnp-hub-fact dd {
	margin: 0;
	padding-left: 2.35rem;
	color: var(--wp--preset--color--muted);
	font-size: 0.9375rem;
	line-height: 1.35;
}

/* ---- Related Coverage: a full-width feed section ---------------------- */

/* Printed after the main/sidebar layout (not inside the narrow right column,
   where a stack of cards ran far past the main column and left a large empty
   area beside it). It is an ordinary `.gnp-hub-section` - same heading row, same
   `.gnp-card` grid as Latest News - spanning the whole Hub width. */
.gnp-hub-section--related {
	margin-top: 2.25rem;
}

/* ---- Tablet: two columns of cards ------------------------------------ */

@media (min-width: 700px) {
	.gnp-hub-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.gnp-hub-aside {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		align-items: start;
	}

	.gnp-hub-aside > :only-child {
		grid-column: 1 / -1;
	}
}

/* ---- Desktop: split hero, main + right column ------------------------ */

@media (min-width: 1000px) {
	.gnp-hub {
		padding-top: 1.5rem;
	}

	.gnp-hub-hero {
		min-height: 17.25rem;
		flex-direction: row;
		align-items: center;
	}

	.gnp-hub-hero__body {
		flex: 0 1 44%;
		gap: 0.7rem;
		padding: 2rem 0 2rem 2rem;
	}

	.gnp-hub-hero__text {
		font-size: 1.125rem;
	}

	.gnp-hub-hero__art {
		position: absolute;
		inset: 0 0 0 auto;
		order: 0;
		width: 58.6%;
		max-height: none;
		aspect-ratio: auto;
		-webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 16%);
		mask-image: linear-gradient(90deg, transparent 0%, #000 16%);
	}

	.gnp-hub-hero--no-art .gnp-hub-hero__body {
		flex-basis: 100%;
		padding: 2rem;
	}

	.gnp-hub-layout {
		grid-template-columns: minmax(0, 1fr) clamp(19rem, 26.5%, 28.75rem);
		column-gap: 2rem;
		align-items: start;
		margin-top: 1.5rem;
	}

	.gnp-hub-aside {
		grid-template-columns: minmax(0, 1fr);
	}

	/* One column only (no sections yet, or no facts / related rows): it takes the full width. */
	.gnp-hub-layout--solo {
		grid-template-columns: minmax(0, 1fr);
	}

	.gnp-hub-layout--solo .gnp-hub-aside {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.gnp-hub-layout--solo .gnp-hub-aside > :only-child {
		grid-column: 1 / -1;
	}

	/* Related Coverage spans the full width, so three columns fit from here. */
	.gnp-hub-section--related {
		margin-top: 2.5rem;
	}

	.gnp-hub-section--related .gnp-hub-cards {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1280px) {
	.gnp-hub-cards {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 1.75rem;
	}
}

/* Wide desktop: a fixed three columns would make the full-width Related cards ~40%
   larger than the Latest News cards above. Fit as many as keep them about that
   size - five cards sit in one balanced row, and a shorter list stretches to fill
   it (auto-fit). */
@media (min-width: 1400px) {
	.gnp-hub-section--related .gnp-hub-cards {
		grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
	}
}
