/**
 * Magazine Homepage Builder – Gamer Theme
 *
 * Modern, clean, light layout with soft gradients,
 * CTA highlights and rounded cards.
 *
 * @package MagazineHomepageBuilder
 * @since   1.2.0
 */

/* ─── Base ────────────────────────────────────── */

.mhb-gamer {
	max-width: 1120px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--mhb-text, #2d3436);
	background: var(--mhb-bg, #ffffff);
	line-height: 1.6;
}

.mhb-gamer *,
.mhb-gamer *::before,
.mhb-gamer *::after {
	box-sizing: border-box;
}

.mhb-gamer a {
	color: inherit;
	text-decoration: none;
}

.mhb-gamer img {
	max-width: 100%;
	height: auto;
	display: block;
}

.mhb-gamer .mhb-section {
	margin-bottom: var(--mhb-spacing, 40px);
}

/* ─── Badge ───────────────────────────────────── */

.gm-badge {
	display: inline-block;
	background: var(--mhb-primary, #6c5ce7);
	color: #fff;
	font-size: .8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .05em;
	padding: 5px 14px;
	border-radius: 20px;
	align-self: flex-start;
}

.gm-badge--small {
	font-size: .75rem;
	padding: 4px 12px;
}

/* ─── Featured Section (Hero + Sidebar) ───────── */

.gm-featured-section {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.gm-hero {
	position: relative;
	border-radius: var(--mhb-radius, 16px);
	overflow: hidden;
	background: #f0f0f0;
}

.gm-hero-link {
	display: block;
	position: relative;
}

.gm-hero-image {
	position: relative;
	width: 100%;
	aspect-ratio: var(--mhb-hero-ratio, 16/9);
	overflow: hidden;
}

.gm-hero-image img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	position: absolute !important;
	inset: 0 !important;
	max-width: none !important;
	display: block !important;
}

.gm-hero-gradient {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, var(--mhb-overlay-max, 0.7)) 0%,
		rgba(0, 0, 0, var(--mhb-overlay-mid, 0.4)) 40%,
		rgba(0, 0, 0, 0) 100%
	);
	pointer-events: none;
	z-index: 1;
}

.gm-hero-content {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 24px;
	z-index: 2;
	color: #fff;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.gm-hero-title {
	font-weight: 800;
	line-height: 1.2;
	margin: 0;
	color: #fff;
}

.gm-hero-excerpt {
	font-size: var(--mhb-fs-excerpt, 14px);
	line-height: 1.5;
	color: rgba(255, 255, 255, .9);
	margin: 0;
	max-width: 60ch;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mhb-gamer .gm-hero .mhb-meta {
	color: rgba(255, 255, 255, .7);
}

/* ─── Height Lock support ─────────────────────── */

.gm-featured-section.mhb-height-lock-ratio .gm-hero-link,
.gm-featured-section.mhb-height-lock-fixed .gm-hero-link {
	height: 100%;
}

.gm-featured-section.mhb-height-lock-ratio .gm-hero-image,
.gm-featured-section.mhb-height-lock-fixed .gm-hero-image {
	aspect-ratio: unset;
	height: 100%;
}

.gm-featured-section.mhb-height-lock-fixed {
	height: var(--mhb-top-height, 480px);
}

.gm-featured-section.mhb-height-lock-fixed .gm-hero,
.gm-featured-section.mhb-height-lock-fixed .gm-sidebar {
	height: 100%;
	overflow: hidden;
}

/* ─── Sidebar ─────────────────────────────────── */

.gm-sidebar {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.gm-sidebar-card {
	display: flex;
	gap: 14px;
	align-items: center;
	padding: 12px;
	background: var(--gm-card-bg, #ffffff);
	border: 1px solid #e5e7eb;
	border-radius: var(--mhb-radius, 16px);
	transition: background .2s, box-shadow .2s;
}

.gm-sidebar-card:hover {
	background: var(--gm-card-hover-bg, #f8f9fa);
	box-shadow: 0 4px 16px rgba(0, 0, 0, .06);
}

.gm-sidebar-thumb {
	flex-shrink: 0;
	width: 80px;
	height: 64px;
	border-radius: calc(var(--mhb-radius, 16px) - 4px);
	overflow: hidden;
}

.gm-sidebar-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.gm-sidebar-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.gm-sidebar-title {
	font-size: var(--mhb-fs-sidebar-title, 14px);
	font-weight: 600;
	line-height: 1.3;
	margin: 0;
	color: var(--mhb-text, #2d3436);
}

.gm-sidebar-date {
	font-size: var(--mhb-fs-meta, 12px);
	color: #999;
}

/* ─── CTA Highlights ─────────────────────────── */

.gm-highlights {
	padding: 0;
}

.gm-highlights-track {
	display: flex;
	gap: 20px;
	overflow-x: auto;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	padding: 4px 0 12px;

	/* Hide scrollbar for clean look */
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.gm-highlights-track::-webkit-scrollbar {
	display: none;
}

.gm-highlight-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
	text-decoration: none;
}

.gm-highlight-ring {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	padding: 3px;
	background: linear-gradient(135deg, var(--mhb-primary, #6c5ce7), var(--mhb-secondary, #00cec9));
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .25s, box-shadow .25s;
}

.gm-highlight-item:hover .gm-highlight-ring {
	transform: scale(1.08);
	box-shadow: 0 4px 20px rgba(108, 92, 231, .3);
}

.gm-highlight-ring img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	border: 2px solid #fff;
}

.gm-highlight-placeholder {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background: #e9ecef;
	border: 2px solid #fff;
}

.gm-highlight-label {
	font-size: 12px;
	font-weight: 600;
	color: var(--mhb-text, #2d3436);
	max-width: 80px;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ─── Section Title ──────────────────────────── */

.gm-section-title {
	font-size: var(--mhb-fs-section-title, 22px);
	font-weight: 700;
	margin: 0 0 20px;
	padding-bottom: 12px;
	border-bottom: 3px solid var(--mhb-primary, #6c5ce7);
	color: var(--mhb-text, #2d3436);
}

/* ─── Grid Cards ─────────────────────────────── */

.gm-posts-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--mhb-grid-gap, 24px);
}

.gm-card {
	border-radius: var(--mhb-radius, 16px);
	overflow: hidden;
	background: var(--gm-card-bg, #ffffff);
	border: 1px solid #e5e7eb;
	transition: transform .25s, box-shadow .25s;
}

.gm-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 30px rgba(0, 0, 0, .08);
}

.gm-card-link {
	display: block;
}

.gm-card-image {
	aspect-ratio: 16 / 10;
	overflow: hidden;
}

.gm-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .35s;
}

.gm-card:hover .gm-card-image img {
	transform: scale(1.04);
}

.gm-card-body {
	padding: 18px 20px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.gm-card-title {
	font-size: var(--mhb-fs-grid-title, 16px);
	font-weight: 700;
	line-height: 1.3;
	margin: 0;
	color: var(--mhb-text, #2d3436);
}

.gm-card-excerpt {
	font-size: var(--mhb-fs-excerpt, 14px);
	color: #636e72;
	line-height: 1.5;
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mhb-gamer .mhb-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	font-size: var(--mhb-fs-meta, 12px);
	color: #999;
}

/* ─── Pagination ─────────────────────────────── */

.gm-pagination {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 32px;
}

.gm-pagination a,
.gm-pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 500;
	transition: background .2s, color .2s;
}

.gm-pagination a {
	background: var(--gm-card-bg, #fff);
	border: 1px solid #e5e7eb;
	color: var(--mhb-text, #2d3436);
}

.gm-pagination a:hover {
	background: var(--mhb-primary, #6c5ce7);
	color: #fff;
	border-color: var(--mhb-primary, #6c5ce7);
}

.gm-pagination .current {
	background: var(--mhb-primary, #6c5ce7);
	color: #fff;
	border: 1px solid var(--mhb-primary, #6c5ce7);
}

/* ─── Lazy Load ──────────────────────────────── */

.mhb-gamer .mhb-lazy {
	opacity: 0;
	transition: opacity .4s ease;
}

.mhb-gamer .mhb-lazy.loaded {
	opacity: 1;
}

/* ─── Ad Slots ───────────────────────────────── */

.mhb-gamer .mhb-ad-slot {
	display: flex;
	justify-content: center;
	margin-bottom: var(--mhb-spacing, 40px);
}

.mhb-gamer .mhb-ad-slot--grid {
	grid-column: 1 / -1;
	margin: 8px 0;
	padding: 16px;
	background: #f9fafb;
	border-radius: var(--mhb-radius, 16px);
}

/* ─── Responsive: Mobile compact hero ────────── */

@media (max-width: 599px) {
	.mhb-gamer.mhb-homepage {
		--mhb-fs-hero-title: clamp(16px, 4.2vw, 20px);
	}

	.gm-hero-content {
		padding: 16px;
		gap: 6px;
	}

	.mhb-gamer .gm-hero-title {
		line-height: 1.25;
		-webkit-line-clamp: 3;
		line-clamp: 3;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.gm-hero-excerpt {
		-webkit-line-clamp: 2;
		line-clamp: 2;
		font-size: 13px;
	}
}

/* ─── Responsive: Tablet ─────────────────────── */

@media (min-width: 600px) {
	.mhb-gamer {
		padding-left: 24px;
		padding-right: 24px;
	}

	.gm-posts-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ─── Responsive: Desktop ────────────────────── */

@media (min-width: 960px) {
	.mhb-gamer {
		padding-left: 32px;
		padding-right: 32px;
	}

	.gm-featured-section {
		flex-direction: row;
		align-items: stretch;
	}

	.gm-hero {
		flex: 0 0 var(--mhb-hero-width, 60%);
		max-width: var(--mhb-hero-width, 60%);
	}

	.gm-hero-link {
		height: 100%;
	}

	.gm-sidebar {
		flex: 1 1 var(--mhb-sidebar-width, 38%);
		max-width: var(--mhb-sidebar-width, 38%);
		justify-content: center;
	}

	.gm-posts-grid.gm-grid--cols-3 {
		grid-template-columns: repeat(3, 1fr);
	}

	.gm-posts-grid.gm-grid--cols-4 {
		grid-template-columns: repeat(4, 1fr);
	}
}
