/*
 * Directory modules — the routes from an article into the games directory.
 *
 * Deliberately built on the THEME's own custom properties, not on a palette of
 * our own. Foxiz switches on [data-theme='dark'] and redefines --meta-fcolor
 * (#666 -> #bbb) there, and it expresses its lines and panels as TRANSLUCENT
 * grey — --flex-gray-15 is #88888826, --flex-gray-7 is #88888812 — which read
 * correctly on a white page and on a dark one without being redefined at all.
 * Borrowing those means dark mode needs no second rule set here; a hard-coded
 * palette would have needed one and would have drifted from the theme.
 *
 * Everything is scoped under .cg-mod — see feedback_css_deploy_debugging, a
 * bare .tile or .chip would collide with the theme within a release or two.
 */

.cg-mod {
	--cg-accent: var(--g-color, #488cbf);
	--cg-ink: var(--body-fcolor, #333);
	--cg-muted: var(--meta-fcolor, #666);
	--cg-hair: var(--flex-gray-15, rgba(136, 136, 136, .15));
	--cg-surface: var(--flex-gray-7, rgba(136, 136, 136, .07));
	--cg-live: #2f9e68;
	--cg-soon: #b5623a;
	display: block;
	margin: 30px 0;
	font-family: var(--body-family, inherit);
	color: var(--cg-ink);
}

/*
 * ⚠️ Foxiz recolours EVERY link in the article body on hover:
 *   .rbct a:where(:not(.p-url)…:not(.no-link)…):hover { color: var(--g-color) }
 * That rule turned the solid button's label BLUE ON A BLUE BACKGROUND, and it
 * outranks a plain .cg-btn:hover on specificity, so the fix is not a stronger
 * colour here — it is the theme's OWN opt-out. Every anchor these modules print
 * carries `no-link` (see DirectoryModules). The states spelled out below are the
 * second line of defence, for the day something else tries the same thing.
 */
.cg-mod a { text-decoration: none; }
.cg-mod a:hover, .cg-mod a:focus { text-decoration: none; }
.cg-mod a:focus-visible { outline: 2px solid var(--cg-accent); outline-offset: 2px; }

.cg-mod-label {
	font-size: 11px;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--cg-muted);
	margin: 0 0 14px;
	font-weight: 600;
}

/* ---------- games in this article ---------- */

.cg-mod-games {
	border: 1px solid var(--cg-hair);
	border-left: 3px solid var(--cg-accent);
	border-radius: 8px;
	background: var(--cg-surface);
	padding: 17px 19px 19px;
}

.cg-game-card { display: flex; gap: 15px; align-items: flex-start; }
.cg-game-card + .cg-game-card {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--cg-hair);
}

/*
 * ⚠️ ShortPixel wraps every image it can serve in AVIF/WebP inside <picture>,
 * so the flex CHILD is the wrapper and the sizing on the <img> no longer holds
 * the column. This was invisible until the icons were fixed: a broken URL was
 * left as a bare <img>, and the moment it resolved the wrapper appeared and the
 * logo could squeeze. Size the wrapper as well.
 */
.cg-game-card > picture { display: block; flex: 0 0 56px; line-height: 0; }
.cg-gcard-thumb picture { display: block; line-height: 0; }

.cg-game-logo {
	width: 56px;
	height: 56px;
	flex: 0 0 56px;
	border-radius: 9px;
	object-fit: cover;
	border: 1px solid var(--cg-hair);
	background: var(--cg-surface);
}

.cg-game-main { min-width: 0; flex: 1; }

.cg-game-name {
	font-family: var(--heading-family, inherit);
	font-weight: 800;
	font-size: 17px;
	line-height: 1.25;
	color: var(--cg-ink);
	display: inline-block;
}
/* The owner asked for this: the name keeps its reading colour on hover and
 * signals the link with a line instead of turning blue. */
.cg-mod a.cg-game-name, .cg-mod a.cg-game-name:hover { color: var(--cg-ink); }
.cg-mod a.cg-game-name:hover { text-decoration: underline; text-underline-offset: 2px; }

.cg-game-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 9px; }

.cg-chip {
	font-size: 10px;
	letter-spacing: .06em;
	text-transform: uppercase;
	font-weight: 600;
	border: 1px solid var(--cg-hair);
	border-radius: 4px;
	padding: 3px 7px;
	color: var(--cg-muted);
	white-space: nowrap;
}
.cg-chip-live { color: var(--cg-live); border-color: rgba(47, 158, 104, .4); }
.cg-chip-soon { color: var(--cg-soon); border-color: rgba(181, 98, 58, .4); }

.cg-game-desc {
	font-size: 14.5px;
	line-height: 1.55;
	color: var(--cg-ink);
	opacity: .85;
	margin: 0 0 13px;
}

.cg-game-acts { display: flex; flex-wrap: wrap; gap: 9px; }

.cg-btn {
	font-size: 13.5px;
	font-weight: 700;
	padding: 8px 15px;
	border-radius: 5px;
	border: 1px solid var(--cg-accent);
	color: var(--cg-accent);
	white-space: nowrap;
	line-height: 1.3;
}
.cg-btn-solid { background: var(--cg-accent); color: #fff; }
.cg-btn:hover { opacity: .88; }

/* Held through hover and focus — equal specificity, so solid comes last. */
.cg-mod a.cg-btn, .cg-mod a.cg-btn:hover, .cg-mod a.cg-btn:focus { color: var(--cg-accent); }
.cg-mod a.cg-btn-solid, .cg-mod a.cg-btn-solid:hover, .cg-mod a.cg-btn-solid:focus { color: #fff; }

/* ---------- top games, in the sidebar ---------- */

/* No panel around the cards: a box inside a box reads as clutter in a 320px
 * column, and the cards are the objects the reader is meant to see. */
.cg-mod-rail {
	padding: 0;
	margin: 24px 0 0;
}

.cg-rail-head {
	font-family: var(--heading-family, inherit);
	font-weight: 800;
	font-size: 15px;
	margin: 0 0 2px;
	color: var(--cg-ink);
}

.cg-rail-sub {
	font-size: 11px;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--cg-muted);
	margin: 0 0 12px;
}

.cg-pulse {
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--cg-live);
	margin-right: 6px;
	vertical-align: 1px;
}
@media (prefers-reduced-motion: no-preference) {
	.cg-pulse { animation: cg-pulse 2.4s ease-in-out infinite; }
	@keyframes cg-pulse {
		0%, 100% { box-shadow: 0 0 0 0 rgba(47, 158, 104, .45); }
		50%      { box-shadow: 0 0 0 4px rgba(47, 158, 104, 0); }
	}
}

/* One card per game, the rank on the artwork rather than in a number column. */
.cg-gcard {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px;
	border: 1px solid var(--cg-hair);
	border-radius: 10px;
	background: var(--cg-surface);
	transition: border-color .15s ease, transform .15s ease;
}
.cg-gcard + .cg-gcard { margin-top: 8px; }
.cg-gcard:hover { border-color: var(--cg-accent); transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) {
	.cg-gcard { transition: none; }
	.cg-gcard:hover { transform: none; }
}

.cg-gcard-thumb { position: relative; flex: 0 0 46px; }

.cg-gcard-logo {
	display: block;
	width: 46px;
	height: 46px;
	border-radius: 10px;
	object-fit: cover;
	border: 1px solid var(--cg-hair);
	background: var(--cg-surface);
}

/* Solid accent, not the page's ink: there is no theme token that flips with
 * light/dark for a background, and white on the accent reads in both. */
.cg-gcard-rank {
	position: absolute;
	left: -5px;
	top: -5px;
	min-width: 19px;
	height: 19px;
	padding: 0 5px;
	border-radius: 6px;
	background: var(--cg-accent);
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	line-height: 19px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.cg-gcard-txt { min-width: 0; }

.cg-gcard-name {
	display: block;
	font-size: 14.5px;
	font-weight: 700;
	line-height: 1.25;
	color: var(--cg-ink);
}
.cg-gcard:hover .cg-gcard-name { text-decoration: underline; text-underline-offset: 2px; }

.cg-gcard-meta {
	display: block;
	font-size: 11.5px;
	color: var(--cg-muted);
	margin-top: 3px;
}
.cg-gcard-live { color: var(--cg-live); font-weight: 700; }
.cg-gcard-soon { color: var(--cg-soon); font-weight: 700; }

.cg-rail-cta {
	display: block;
	text-align: center;
	margin-top: 14px;
	padding: 9px;
	font-size: 13px;
	font-weight: 700;
	border-radius: 5px;
	border: 1px solid var(--cg-hair);
	color: var(--cg-accent);
}
.cg-rail-cta:hover { border-color: var(--cg-accent); }

/* ---------- three doors out ---------- */

.cg-tiles {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
}

.cg-tile {
	display: block;
	border: 1px solid var(--cg-hair);
	border-radius: 8px;
	background: var(--cg-surface);
	padding: 17px;
}
.cg-tile:hover { border-color: var(--cg-accent); }

.cg-tile-n {
	display: block;
	font-family: var(--heading-family, inherit);
	font-size: 28px;
	font-weight: 900;
	letter-spacing: -.03em;
	line-height: 1.05;
	font-variant-numeric: tabular-nums;
	color: var(--cg-ink);
}

.cg-tile-l {
	display: block;
	font-size: 13.5px;
	line-height: 1.45;
	color: var(--cg-ink);
	opacity: .8;
	margin-top: 5px;
}

.cg-tile-go {
	display: block;
	font-size: 11px;
	letter-spacing: .09em;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--cg-accent);
	margin-top: 12px;
}

@media (max-width: 620px) {
	.cg-tiles { grid-template-columns: 1fr; }
	.cg-game-card { gap: 12px; }
	.cg-game-card > picture { flex-basis: 46px; }
	.cg-game-logo { width: 46px; height: 46px; flex-basis: 46px; }
}
