/*
Theme Name: BGD 2026
Theme URI: https://www.browsergames.directory/
Description: Lightweight theme for browsergames.directory. Replaces Gameleon + Elementor Pro templates. No page builder.
Version: 1.3.0
Requires at least: 6.3
Requires PHP: 7.4
Text Domain: bgd
*/

/* ---------- Fonts (self-hosted) ---------- */
@font-face { font-family: "Oswald"; src: url("assets/fonts/oswald.woff2") format("woff2"); font-weight: 200 700; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("assets/fonts/barlow-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("assets/fonts/barlow-400i.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("assets/fonts/barlow-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("assets/fonts/barlow-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
	--ink: #141316;          /* masthead, footer */
	--ink-2: #232126;
	--page: #f5f3ef;         /* warm paper */
	--surface: #ffffff;
	--text: #1c1b1f;
	--muted: #57545c;        /* 7.0:1 on --page */
	--line: #e2ded7;
	--red: #c8202a;          /* logo red, 5.4:1 on white */
	--red-deep: #9f1820;
	--red-tint: #fbe9e9;
	--on-ink: #f4f1ec;
	--on-ink-muted: #b9b4bd; /* 8.6:1 on --ink */

	--display: "Oswald", "Arial Narrow", sans-serif;
	--body: "Barlow", "Segoe UI", system-ui, sans-serif;

	--s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4.5rem;
	--radius: 10px;
	--shadow: 0 1px 2px rgb(20 19 22 / .06), 0 6px 18px -6px rgb(20 19 22 / .18);
	--shadow-lift: 0 2px 4px rgb(20 19 22 / .08), 0 16px 32px -10px rgb(20 19 22 / .32);
	--ease: cubic-bezier(.16, 1, .3, 1);
	--wrap: 1240px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
	margin: 0;
	background: var(--page);
	color: var(--text);
	font: 400 1.0625rem/1.6 var(--body);
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--red-deep); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.12; letter-spacing: -.005em; text-wrap: balance; margin: 0; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 4px; }
html { scrollbar-color: #b7b1a8 var(--page); }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.wrap--narrow { width: min(100% - 2.5rem, 760px); margin-inline: auto; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--surface); color: var(--text); padding: .6rem 1rem; border-radius: 6px; }
.skip-link:focus { top: 1rem; }

/* ---------- Masthead ---------- */
.masthead { position: relative; z-index: 10; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar__inner { display: flex; align-items: center; gap: var(--s5); min-height: 104px; padding-block: var(--s3); }
.brand { flex: none; display: block; margin-right: auto; }
.brand__logo { height: 84px; width: auto; }
.utility-nav ul { list-style: none; display: flex; gap: var(--s5); margin: 0; padding: 0; }
.utility-nav a { color: var(--muted); font-size: .95rem; font-weight: 600; text-decoration: none; }
.utility-nav a:hover { color: var(--red-deep); text-decoration: underline; }

.search { display: flex; align-items: center; background: var(--page); border: 1px solid var(--line); border-radius: 999px; padding-left: 1rem; transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.search:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgb(200 32 42 / .15); }
.search input { background: none; border: 0; color: var(--text); font: inherit; font-size: .98rem; width: 13rem; padding: .65rem 0; outline: none; caret-color: var(--red); }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.search button { background: none; border: 0; color: var(--text); padding: .6rem .9rem; cursor: pointer; display: grid; place-items: center; border-radius: 999px; }
.search button:hover { color: var(--red); }

.navbar { background: var(--ink); }
.primary-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0 var(--s1); margin: 0; padding: 0; }
.primary-nav a {
	display: block; padding: 1rem .9rem; position: relative;
	font: 500 1.02rem/1 var(--display); letter-spacing: .04em; text-transform: uppercase;
	color: var(--on-ink); text-decoration: none;
	transition: color .2s var(--ease), background-color .2s var(--ease);
}
.primary-nav a::after { content: ""; position: absolute; left: .9rem; right: .9rem; bottom: 0; height: 3px; background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
.primary-nav a:hover { color: #fff; background: var(--ink-2); }
.primary-nav a:hover::after, .primary-nav a[aria-current="page"]::after { transform: scaleX(1); }
.primary-nav a[aria-current="page"] { color: #fff; }

.nav-toggle { display: none; align-items: center; gap: .4rem; background: var(--ink); color: var(--on-ink); border: 0; border-radius: 8px; padding: .65rem .9rem; font: 500 .95rem/1 var(--display); text-transform: uppercase; letter-spacing: .04em; cursor: pointer; }

@media (max-width: 960px) {
	.utility-nav { display: none; }
	.search input { width: 9rem; }
}
@media (max-width: 720px) {
	.topbar__inner { flex-wrap: wrap; min-height: 0; gap: var(--s3); }
	.brand__logo { height: 60px; }
	.nav-toggle { display: inline-flex; }
	.search { order: 3; flex-basis: 100%; }
	.search input { width: 100%; }
	.navbar { display: none; }
	.navbar.is-open { display: block; }
	.primary-nav ul { display: grid; grid-template-columns: 1fr 1fr; padding-block: var(--s2); }
	.primary-nav a { padding: .9rem .6rem; }
	.primary-nav a::after { left: .6rem; right: .6rem; }
}

/* ---------- Intro / archive header ---------- */
.intro { background: var(--surface); border-bottom: 1px solid var(--line); padding-block: var(--s7) var(--s6); }
.intro__title { font-size: clamp(2.1rem, 1.4rem + 2.6vw, 3.6rem); font-weight: 600; letter-spacing: -.01em; }
.intro__lede { color: var(--muted); font-size: 1.15rem; max-width: 62ch; margin: var(--s3) 0 0; }
.intro__lede p { margin: 0; }
.intro--archive { padding-block: var(--s6) var(--s5); }
.intro--archive .intro__title { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.9rem); max-width: none; }

.genres { margin-top: var(--s5); }
.genres ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.genres a {
	display: inline-flex; align-items: center; gap: .45rem;
	padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 999px;
	background: var(--page); color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem;
	transition: border-color .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease);
}
.genres a:hover { border-color: var(--red); color: var(--red-deep); background: var(--red-tint); }
.genres a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.genres__count { font-variant-numeric: tabular-nums; font-weight: 400; color: var(--muted); font-size: .85rem; }
.genres a[aria-current="page"] .genres__count { color: var(--on-ink-muted); }

/* ---------- Shelves & cards ---------- */
.shelf { padding-block: var(--s7) 0; }
.shelf:last-child { padding-bottom: var(--s8); }
.shelf__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); }
.shelf__head h2 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); }
.shelf__more { font-weight: 600; white-space: nowrap; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s5) var(--s4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.cards--news { grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }

.card__link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; border-radius: var(--radius); }
.card__media {
	position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden;
	border-radius: var(--radius); background: var(--ink); box-shadow: var(--shadow);
	transition: box-shadow .35s var(--ease), transform .35s var(--ease);
}
/* Blurred copy of the art fills the frame so logos are never cropped. */
.card__media::before {
	content: ""; position: absolute; inset: -12%;
	background: var(--card-bg, none) center / cover no-repeat;
	filter: blur(18px) saturate(1.3) brightness(.7);
	transform: scale(1.05);
}
.card__img { position: relative; width: 100%; height: 100%; object-fit: contain; transition: transform .5s var(--ease); }
.card__body { display: flex; flex-direction: column; gap: .15rem; padding: var(--s3) .1rem 0; }
.card__title { font: 600 1.15rem/1.2 var(--display); letter-spacing: .005em; color: var(--text); transition: color .2s var(--ease); }
.card__meta { color: var(--muted); font-size: .9rem; }
.card__link:hover .card__media { box-shadow: var(--shadow-lift); transform: translateY(-3px); }
.card__link:hover .card__img { transform: scale(1.04); }
.card__link:hover .card__title { color: var(--red); }
.card__link:focus-visible { outline-offset: 4px; }

/* Lead shelf: first card larger on wide screens. */
@media (min-width: 900px) {
	.cards--lead { grid-template-columns: repeat(4, 1fr); }
	.cards--lead > li:first-child { grid-column: span 2; grid-row: span 2; }
	.cards--lead > li:first-child .card__media { aspect-ratio: auto; flex: 1; min-height: 300px; }
	.cards--lead > li:first-child .card__title { font-size: 1.6rem; }
}

@media (min-width: 900px) { .cards--three { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Top 10 banner ---------- */
.banner {
	margin-top: var(--s7); display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--s2) var(--s6);
	padding: var(--s6) var(--s6); border-radius: 14px; background: var(--ink); color: var(--on-ink); text-decoration: none;
	position: relative; overflow: hidden;
}
.banner::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgb(200 32 42 / .55), transparent 70%); pointer-events: none; }
.banner__title { font: 600 clamp(1.5rem, 1.1rem + 1.4vw, 2.2rem)/1.1 var(--display); grid-column: 1; color: #fff; }
.banner__text { color: var(--on-ink-muted); grid-column: 1; }
.banner__cta { grid-column: 2; grid-row: 1 / span 2; display: inline-flex; align-items: center; gap: .5rem; background: var(--red); color: #fff; padding: .85rem 1.3rem; border-radius: 8px; font-weight: 700; position: relative; z-index: 1; transition: background-color .2s var(--ease); }
.banner:hover { color: var(--on-ink); }
.banner:hover .banner__cta { background: var(--red-deep); }
@media (max-width: 640px) { .banner { grid-template-columns: 1fr; padding: var(--s5); } .banner__cta { grid-column: 1; grid-row: auto; justify-self: start; margin-top: var(--s3); } }

/* ---------- Game header ---------- */
.game-head { background: var(--ink); color: var(--on-ink); padding-block: var(--s5) var(--s7); }
.crumbs { display: flex; gap: .55rem; font-size: .9rem; color: var(--on-ink-muted); margin-bottom: var(--s5); }
.crumbs a { color: var(--on-ink-muted); text-decoration: none; }
.crumbs a:hover { color: #fff; text-decoration: underline; }
.game-head__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--s7); align-items: center; }
.game-head__title { font-size: clamp(2.4rem, 1.6rem + 3vw, 4.25rem); font-weight: 600; letter-spacing: -.012em; color: #fff; }
.game-head__date { color: var(--on-ink-muted); margin: var(--s3) 0 0; }
.entry--news .game-head__actions { margin-top: var(--s5); }
.game-head__note { margin: var(--s4) 0 0; padding: var(--s3) var(--s4); border-left: 3px solid var(--red); background: var(--ink-2); border-radius: 0 8px 8px 0; color: var(--on-ink); max-width: 52ch; }
.game-head__note a { color: #fff; text-decoration: underline; }

.facts { list-style: none; margin: var(--s5) 0 0; padding: 0; display: grid; gap: .55rem; }
.facts li { display: grid; grid-template-columns: 6.5rem 1fr; gap: var(--s4); padding-bottom: .55rem; border-bottom: 1px solid #2f2c33; }
.facts__k { color: var(--on-ink-muted); font-size: .92rem; }
.facts__v { font-weight: 600; }

.tags { list-style: none; margin: var(--s4) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tags a { display: inline-block; padding: .3rem .7rem; border: 1px solid #3a373e; border-radius: 999px; color: var(--on-ink); font-size: .85rem; text-decoration: none; text-transform: lowercase; }
.tags a:hover { border-color: var(--red); color: #fff; }

.game-head__actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }
.btn { display: inline-flex; align-items: center; gap: .55rem; padding: .95rem 1.4rem; border-radius: 8px; font: 700 1.02rem/1 var(--body); text-decoration: none; cursor: pointer; border: 2px solid transparent; transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease); }
.btn--play { background: var(--red); color: #fff; box-shadow: 0 6px 20px -6px rgb(200 32 42 / .7); }
.btn--play:hover { background: var(--red-deep); color: #fff; transform: translateY(-1px); }
.btn--ghost { border-color: #46424b; color: var(--on-ink); }
.btn--ghost:hover { border-color: var(--on-ink); color: #fff; }
.btn:active { transform: translateY(1px); }

.game-head__art { margin: 0; border-radius: 14px; overflow: hidden; box-shadow: 0 30px 60px -24px rgb(0 0 0 / .8); background: var(--ink-2); }
.game-head__art img { width: 100%; height: auto; max-height: 440px; object-fit: contain; }

.entry--news .game-head { padding-bottom: var(--s6); }
.entry--news .game-head__grid { grid-template-columns: 1fr; }
.entry--news .game-head__art { max-width: 760px; }

@media (max-width: 900px) {
	.game-head__grid { grid-template-columns: 1fr; gap: var(--s5); }
	.game-head__art { order: -1; }
	.game-head { padding-bottom: var(--s6); }
}

/* ---------- Article body ---------- */
.entry__layout { padding-block: var(--s7) 0; }
.entry__layout--aside { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s7); }
.prose { max-width: 70ch; font-size: 1.125rem; line-height: 1.7; }
.entry__layout:not(.entry__layout--aside) .prose { margin-inline: auto; }
.prose > * + * { margin-top: 1.1em; }
.prose p { margin: 0; }
.prose h2 { font-size: 1.85rem; margin-top: 2em; }
.prose h3 { font-size: 1.4rem; margin-top: 1.7em; }
.prose h2 + *, .prose h3 + * { margin-top: .6em; }
.prose ul, .prose ol { padding-left: 1.3em; margin-bottom: 0; }
.prose li + li { margin-top: .35em; }
.prose img { border-radius: 8px; }
.prose blockquote { margin-inline: 0; padding: var(--s4) var(--s5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-style: italic; }
.prose table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 1rem; }
.prose th, .prose td { padding: .6rem .7rem; border-bottom: 1px solid var(--line); text-align: left; }
.prose .alignleft { float: left; margin: .3em 1.4em .8em 0; max-width: 45%; }
.prose .alignright { float: right; margin: .3em 0 .8em 1.4em; max-width: 45%; }
.prose .aligncenter { margin-inline: auto; }
.prose .wp-caption-text, .prose figcaption { color: var(--muted); font-size: .9rem; margin-top: .4rem; }

/* Galleries: classic [gallery] and block gallery. */
.prose .gallery, .prose .wp-block-gallery { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; }
.prose .gallery br { display: none; }
.prose .gallery .gallery-item { margin: 0 !important; width: auto !important; max-width: none !important; }
.prose .gallery img, .prose .wp-block-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 0 !important; border-radius: 8px; transition: opacity .2s var(--ease); }
.prose .gallery a:hover img { opacity: .85; }

/* Table of Contents Plus */
.prose #toc_container { background: var(--surface) !important; border: 1px solid var(--line) !important; border-radius: var(--radius); padding: var(--s4) var(--s5) !important; width: auto !important; display: block !important; }
.prose #toc_container .toc_title { font-family: var(--display); font-size: 1.1rem; text-align: left !important; }

.endcap { margin-top: var(--s7) !important; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s5); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.endcap__text { margin: 0 !important; font-size: 1.15rem; }
.clearfix::after, .prose::after { content: ""; display: table; clear: both; }

.entry__aside .widget { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5); }
.entry__aside .widget + .widget { margin-top: var(--s4); }
.widget__title { font-size: 1.15rem; margin-bottom: var(--s3); }
@media (max-width: 900px) { .entry__layout--aside { grid-template-columns: 1fr; } }

/* ---------- Ad slots ---------- */
.ad-slot { display: block; margin: var(--s6) auto; max-width: 970px; text-align: center; }
.ad-slot__label { display: block; margin-bottom: .35rem; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ad-slot .adsbygoogle { min-height: 250px; background: rgb(20 19 22 / .03); border-radius: 8px; }
.ad-slot--inarticle { max-width: 100%; margin-block: 2em !important; }
.ad-slot--after { margin-top: var(--s7); max-width: 728px; }
.ad-slot--home { margin-top: var(--s7); margin-bottom: 0; }
.cards__ad { grid-column: 1 / -1; }
.cards__ad .ad-slot { margin-block: var(--s2); }
/* Collapse slots Google could not fill. */
.ad-slot:has(.adsbygoogle[data-ad-status="unfilled"]) { display: none; }
@media (max-width: 600px) { .ad-slot .adsbygoogle { min-height: 280px; } }

/* ---------- Comments ---------- */
.comments { padding-block: var(--s7) var(--s8); }
.comments__title, .comment-reply-title { font-size: 1.6rem; margin-bottom: var(--s4); }
.comments__list { list-style: none; padding: 0; margin: 0 0 var(--s6); }
.comments__list .comment { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4) var(--s5); margin-bottom: var(--s3); }
.comments__list .children { list-style: none; padding-left: var(--s5); margin-top: var(--s3); }
.comment-meta { display: flex; align-items: center; gap: .6rem; font-size: .92rem; color: var(--muted); }
.comment-meta img { border-radius: 50%; }
.comment-form { display: grid; gap: var(--s3); }
.comment-form label { display: block; font-weight: 600; margin-bottom: .3rem; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
	width: 100%; font: inherit; padding: .7rem .85rem; border: 1px solid #cfc9c0; border-radius: 8px; background: var(--surface); color: var(--text);
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgb(200 32 42 / .18); }
.comment-form .submit { background: var(--red); color: #fff; border: 0; border-radius: 8px; padding: .85rem 1.3rem; font: 700 1rem/1 var(--body); cursor: pointer; }
.comment-form .submit:hover { background: var(--red-deep); }

/* ---------- Pagination & empty ---------- */
.pagination { margin-top: var(--s7); }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.pagination .page-numbers { min-width: 2.6rem; padding: .6rem .85rem; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.pagination .page-numbers.current { background: var(--ink); border-color: var(--ink); color: #fff; }
.pagination a.page-numbers:hover { border-color: var(--red); color: var(--red-deep); }
.empty { padding: var(--s6); background: var(--surface); border: 1px dashed #cfc9c0; border-radius: var(--radius); color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--on-ink-muted); margin-top: var(--s8); padding-block: var(--s7); font-size: .95rem; }
.shelf:last-child + .site-footer, main:has(.shelf:last-child) + .site-footer { margin-top: 0; }
.site-footer__inner { display: grid; grid-template-columns: 1.3fr 2fr auto; gap: var(--s6); align-items: start; }
.site-footer__name { margin: 0 0 .3rem; font: 600 1.2rem/1.2 var(--display); color: var(--on-ink); }
.site-footer__text, .site-footer__copy { margin: 0; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; }
.site-footer a { color: var(--on-ink); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
@media (max-width: 800px) { .site-footer__inner { grid-template-columns: 1fr; } }

/* ---------- Motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
