/*
Theme Name: Kauferbay Games
Theme URI: https://example.com
Author: Your Name
Description: A responsive WordPress theme for an HTML5 game platform — homepage discovery sections (featured, popular, new, categories, recently played, leaderboard), and a game page template with an embedded player, fullscreen, ratings, and high scores.
Version: 1.0.0
Requires at least: 5.9
Requires PHP: 7.4
License: GPL v2 or later
Text Domain: game-hub
*/

/* ============================================================
   Design tokens
   ============================================================ */
:root {
	--bg: #12172B;
	--bg-elevated: #1B2140;
	--bg-elevated-2: #232B52;
	--accent-cyan: #3AD9C8;
	--accent-magenta: #FF3E7F;
	--text: #EDEFF7;
	--text-dim: #9AA1C4;
	--border: rgba(255, 255, 255, 0.08);
	--radius-sm: 8px;
	--radius-md: 14px;
	--radius-lg: 22px;
	--font-display: 'Rajdhani', sans-serif;
	--font-body: 'Inter', sans-serif;
	--max-width: 1240px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-body);
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
	font-family: var(--font-display);
	font-weight: 700;
	margin: 0 0 0.4em;
	letter-spacing: 0.01em;
}

.gh-wrap {
	max-width: var(--max-width);
	margin: 0 auto;
	padding: 0 20px;
}

:focus-visible {
	outline: 3px solid var(--accent-cyan);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   Header
   ============================================================ */
.gh-header {
	position: sticky;
	top: 0;
	z-index: 40;
	background: rgba(18, 23, 43, 0.92);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--border);
}

.gh-header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 0;
	gap: 20px;
}

.gh-logo {
	font-family: var(--font-display);
	font-size: 1.5rem;
	font-weight: 700;
	display: flex;
	align-items: center;
	gap: 8px;
}

.gh-logo-mark {
	width: 30px;
	height: 30px;
	border-radius: 8px;
	background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
	display: inline-block;
}

.gh-nav-toggle {
	display: none;
	background: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text);
	padding: 8px 10px;
	font-size: 1.1rem;
	cursor: pointer;
}

.gh-nav {
	display: flex;
	gap: 26px;
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 1.02rem;
}

.gh-nav a {
	color: var(--text-dim);
	transition: color 0.15s ease;
}
.gh-nav a:hover, .gh-nav a.current { color: var(--accent-cyan); }

@media (max-width: 780px) {
	.gh-nav-toggle { display: inline-flex; }
	.gh-nav {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: var(--bg-elevated);
		flex-direction: column;
		gap: 0;
		border-bottom: 1px solid var(--border);
	}
	.gh-nav.is-open { display: flex; }
	.gh-nav a { display: block; padding: 14px 20px; border-top: 1px solid var(--border); }
}

/* ============================================================
   Section scaffolding
   ============================================================ */
.gh-section {
	padding: 46px 0;
	border-bottom: 1px solid var(--border);
}

.gh-section-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 22px;
	gap: 16px;
}

.gh-section-head h2 { font-size: 1.6rem; }

.gh-section-link {
	font-family: var(--font-display);
	font-weight: 600;
	color: var(--accent-cyan);
	white-space: nowrap;
}

/* ============================================================
   Featured hero — asymmetric split, not a centered banner
   ============================================================ */
.gh-hero {
	display: grid;
	grid-template-columns: 1.6fr 1fr;
	gap: 20px;
}

.gh-hero-main {
	position: relative;
	border-radius: var(--radius-lg);
	overflow: hidden;
	min-height: 360px;
	background: var(--bg-elevated);
	display: flex;
	align-items: flex-end;
}

.gh-hero-main img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.gh-hero-main::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(0deg, rgba(10,12,25,0.92) 0%, rgba(10,12,25,0.15) 55%, transparent 100%);
}

.gh-hero-content {
	position: relative;
	padding: 30px;
	z-index: 1;
}

.gh-hero-content .gh-card-tag { position: static; display: inline-flex; margin-bottom: 10px; }

.gh-hero-content h3 {
	font-size: 2.1rem;
	margin-bottom: 10px;
}

.gh-hero-cta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 14px;
	background: var(--accent-magenta);
	color: #fff;
	font-family: var(--font-display);
	font-weight: 700;
	padding: 11px 22px;
	border-radius: 999px;
}

.gh-hero-side {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.gh-hero-side-item {
	display: flex;
	gap: 12px;
	align-items: center;
	background: var(--bg-elevated);
	border-radius: var(--radius-md);
	padding: 10px;
	border: 1px solid var(--border);
	flex: 1;
}

.gh-hero-side-item img, .gh-hero-side-item .gh-card-thumb-fallback {
	width: 74px;
	height: 74px;
	border-radius: var(--radius-sm);
	object-fit: cover;
	flex-shrink: 0;
}

.gh-hero-side-item h4 { font-size: 1rem; margin: 0 0 4px; }
.gh-hero-side-item .gh-card-rating { font-size: 0.85rem; color: var(--text-dim); }

@media (max-width: 860px) {
	.gh-hero { grid-template-columns: 1fr; }
}

/* ============================================================
   Cards + horizontal rows (Popular, Recently Played, Similar)
   ============================================================ */
.gh-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 18px;
}

.gh-row {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	padding-bottom: 8px;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
}
.gh-row .gh-card { flex: 0 0 180px; scroll-snap-align: start; }

.gh-card {
	display: block;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	overflow: hidden;
	transition: transform 0.15s ease, border-color 0.15s ease;
}
.gh-card:hover { transform: translateY(-3px); border-color: var(--accent-cyan); }

.gh-card-thumb {
	position: relative;
	aspect-ratio: 4 / 3;
	background: var(--bg-elevated-2);
}
.gh-card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.gh-card-thumb-fallback {
	width: 100%; height: 100%;
	display: flex; align-items: center; justify-content: center;
	font-family: var(--font-display);
	font-size: 2.2rem;
	color: var(--text-dim);
}

.gh-card-tag {
	position: absolute;
	top: 8px;
	left: 8px;
	background: rgba(10,12,25,0.75);
	color: var(--accent-cyan);
	font-size: 0.7rem;
	font-weight: 600;
	padding: 3px 9px;
	border-radius: 999px;
}

.gh-card-body { padding: 12px; }
.gh-card-title { font-size: 1.02rem; margin-bottom: 4px; }
.gh-card-rating { font-size: 0.85rem; color: var(--accent-cyan); }

.gh-new-badge {
	position: absolute;
	top: 8px;
	right: 8px;
	background: var(--accent-magenta);
	color: #fff;
	font-size: 0.68rem;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 999px;
}

.gh-empty-note { color: var(--text-dim); font-style: italic; }

/* ============================================================
   Category tiles — colour-block grid, distinct from the card grid
   ============================================================ */
.gh-category-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 14px;
}

.gh-category-tile {
	border-radius: var(--radius-md);
	padding: 22px 16px;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.05rem;
	color: #fff;
	min-height: 96px;
	display: flex;
	align-items: flex-end;
}

/* ============================================================
   Leaderboard — a real table, not another card grid
   ============================================================ */
.gh-leaderboard {
	width: 100%;
	border-collapse: collapse;
}
.gh-leaderboard th, .gh-leaderboard td {
	text-align: left;
	padding: 12px 14px;
	border-bottom: 1px solid var(--border);
}
.gh-leaderboard th {
	font-family: var(--font-display);
	color: var(--text-dim);
	font-weight: 600;
	font-size: 0.85rem;
}
.gh-leaderboard td.gh-lb-score {
	font-variant-numeric: tabular-nums;
	color: var(--accent-cyan);
	font-weight: 600;
}
.gh-leaderboard tr:nth-child(-n+3) td.gh-lb-rank { color: var(--accent-magenta); font-weight: 700; }

/* ============================================================
   Advertisement slots — honest, clearly labeled placeholders
   ============================================================ */
.gh-ad-slot { margin: 0 0 20px; }
.gh-ad-placeholder {
	border: 1px dashed var(--border);
	border-radius: var(--radius-md);
	min-height: 90px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-dim);
	font-size: 0.85rem;
}

/* ============================================================
   Single game page
   ============================================================ */
.gh-game-page {
	display: grid;
	grid-template-columns: 2.2fr 1fr;
	gap: 30px;
	padding: 34px 0;
}

@media (max-width: 920px) {
	.gh-game-page { grid-template-columns: 1fr; }
}

.gh-game-title { font-size: 2rem; margin-bottom: 6px; }
.gh-game-meta { color: var(--text-dim); font-size: 0.92rem; margin-bottom: 18px; display: flex; gap: 14px; flex-wrap: wrap; }
.gh-game-meta a { color: var(--accent-cyan); }

.gh-player {
	position: relative;
	background: #05070f;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 14px;
	margin-bottom: 22px;
}

.gh-player-frame-wrap {
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 3;
	border-radius: var(--radius-md);
	overflow: hidden;
	background: #000;
}

.gh-game-frame, .gh-player-frame-wrap iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.gh-fullscreen-btn {
	position: absolute;
	right: 14px;
	bottom: 14px;
	background: rgba(10,12,25,0.75);
	color: #fff;
	border: 1px solid rgba(255,255,255,0.25);
	border-radius: var(--radius-sm);
	padding: 8px 14px;
	font-family: var(--font-display);
	font-weight: 600;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 6px;
	z-index: 2;
}
.gh-fullscreen-btn:hover { border-color: var(--accent-cyan); }

.gh-embed-missing { padding: 40px; text-align: center; color: var(--text-dim); }

.gh-poster {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #05070f;
}
.gh-poster img { width: 100%; height: 100%; object-fit: cover; opacity: 0.55; }
.gh-poster .gh-card-thumb-fallback { position: absolute; inset: 0; font-size: 3rem; }

.gh-play-btn {
	position: relative;
	z-index: 1;
	background: var(--accent-magenta);
	color: #fff;
	border: none;
	border-radius: 999px;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.1rem;
	padding: 14px 30px;
	cursor: pointer;
}
.gh-play-btn:hover { background: var(--accent-cyan); }

.gh-panel {
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 20px;
	margin-bottom: 20px;
}
.gh-panel h2 { font-size: 1.2rem; }
.gh-panel .gh-instructions-body { color: var(--text-dim); }

/* Rating control */
.gh-rating { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gh-stars { display: flex; gap: 4px; }
.gh-star {
	background: none;
	border: none;
	font-size: 1.6rem;
	line-height: 1;
	color: var(--border);
	cursor: pointer;
	padding: 2px;
}
.gh-star.is-filled, .gh-star.is-hover { color: var(--accent-magenta); }
.gh-rating-summary { color: var(--text-dim); font-size: 0.9rem; }
.gh-rating-thanks { color: var(--accent-cyan); font-size: 0.9rem; }

/* High scores */
.gh-score-form { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.gh-score-form input {
	background: var(--bg-elevated-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 9px 12px;
	color: var(--text);
	flex: 1;
	min-width: 120px;
}
.gh-score-form button {
	background: var(--accent-cyan);
	border: none;
	border-radius: var(--radius-sm);
	padding: 9px 18px;
	font-family: var(--font-display);
	font-weight: 700;
	cursor: pointer;
}

/* Sidebar */
.gh-sidebar-heading { font-size: 1rem; color: var(--text-dim); font-family: var(--font-display); margin-bottom: 12px; }

/* ============================================================
   Footer
   ============================================================ */
.gh-footer {
	padding: 30px 0 50px;
	color: var(--text-dim);
	font-size: 0.9rem;
	text-align: center;
}
