/*
 * Games list pages (4c-T9): layout only — head, pins bar, filter column beside the results. The parts keep their own
 * files (tq-core chips-bar / sort-select / card / row slider, filters.css). Colours from the tokens only (R5).
 * Breakpoint 769px = the filter view's own (sheet below it, sidebar from it; live 5178 css :3294).
 */
.tq-list {
	padding-block: var(--tq-gap-l) calc(var(--tq-gap-l) * 2);
}

.tq-list__head {
	margin-block-end: var(--tq-gap-l);
}

.tq-list__head .archive-title {
	margin: 0;
}

.tq-list__head > * + * {
	margin-block-start: var(--tq-gap-l);
}

/* the gap under the back chip is the shared tq-core rule (.s-cats.tq-back, --tq-back-gap); the title adds none */
.tq-list__head > .tq-back + .archive-title {
	margin-block-start: 0;
}

/* pins bar: «فلترة» first, same size as a chip, colour only (L6) */
.tq-list__bar {
	display: flex;
	align-items: center;
	gap: var(--tq-gap-s);
	margin-block-end: var(--tq-gap-l);
}

.tq-list__bar .tq-chips {
	flex: 1;
	min-width: 0;
	margin: 0;
}

.tq-list__bar .tq4-fall {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: var(--tq-gap-s);
	height: 32px;
	padding-inline: 12px;
	border: 0;
	border-radius: 999px;
	background: var(--tq-accent);
	color: var(--tq-plate);
	font: 700 13px/1 var(--tq-font-meta);
	cursor: pointer;
}

.tq-list__bar .tq4-fcount {
	min-width: 18px;
	padding-inline: 4px;
	border-radius: 999px;
	background: var(--tq-plate);
	color: var(--tq-accent);
	font-size: 11px;
	line-height: 18px;
	text-align: center;
}

/* filter column beside the results */
.tq-list__body {
	display: grid;
	gap: var(--tq-gap-l);
}

.tq-list__main {
	min-width: 0;
}

.tq-list__main > * + * {
	margin-block-start: var(--tq-gap-l);
}

.tq-list .tq4-topbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--tq-gap-m);
}

.tq-list .tq4-tb-chips {
	flex: 1;
	min-width: 0;
}

.tq-list .tq4-topbar .tq-sort {
	margin-inline-start: auto;
}

/* the app anchors take a whole row of the grid when the app shows them */
.tq-list .tq-cards > .tq-list__anchor {
	grid-column: 1 / -1;
}

.tq-list .pagination-wrap {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--tq-gap-xs);
}

@media (min-width: 769px) {
	.tq-list__bar .tq4-fall {
		display: none;
	}

	.tq-list__body {
		grid-template-columns: 260px minmax(0, 1fr);
		align-items: start;
	}
}

/* group pin «المنصة ▾» (L38): the caret turns while its popover is open (live 5178 .tq4-pin[data-type="group"]) */
.tq-list__bar .tq-chip[data-tq-group] .tq-icon {
	transition: transform 0.2s;
}

.tq-list__bar .tq-chip[data-tq-group][aria-expanded="true"] {
	color: var(--tq-accent);
	box-shadow: inset 0 0 0 1px var(--tq-accent);
}

.tq-list__bar .tq-chip[data-tq-group][aria-expanded="true"] .tq-icon:last-child {
	transform: rotate(180deg);
}

/* the popover of a group pin (live 5178 .tq4-dd): 360px under the pin, on the desktop only; it sits in <body> */
.tq-list-dd {
	position: absolute;
	z-index: 99990;
	width: 360px;
	max-width: calc(100vw - 24px);
	padding: 4px 16px 0;
	border: 1px solid var(--tq-line);
	border-radius: var(--tq-radius);
	background: var(--tq-surface);
	box-shadow: var(--tq-shade);
	color: var(--tq-text);
}

.tq-list-dd .tq4-dd-list {
	max-height: 320px;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
}

.tq-list-dd .tq4-dd-row {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	margin: 0;
	font: 600 15px/1.3 var(--tq-font-meta);
	cursor: pointer;
}

.tq-list-dd .tq4-dd-row input[type="checkbox"] {
	position: relative;
	flex: none;
	width: 22px;
	min-width: 22px;
	height: 22px;
	margin: 0;
	border: 1.5px solid var(--tq-muted);
	border-radius: 6px;
	background: var(--tq-surface);
	cursor: pointer;
	appearance: none;
}

.tq-list-dd .tq4-dd-row input[type="checkbox"]:checked {
	border-color: var(--tq-accent);
	background: var(--tq-accent);
}

.tq-list-dd .tq4-dd-row input[type="checkbox"]::after {
	content: "";
	position: absolute;
	inset-block-start: 2px;
	inset-inline-start: calc(50% - 4px);
	width: 5px;
	height: 11px;
	box-sizing: content-box;
	border: solid var(--tq-plate);
	border-width: 0 2.5px 2.5px 0;
	opacity: 0;
	transform: rotate(45deg);
}

.tq-list-dd .tq4-dd-row input[type="checkbox"]:checked::after {
	opacity: 1;
}

.tq-list-dd :is(input, button):focus-visible {
	outline: 3px solid var(--tq-accent);
	outline-offset: 2px;
}

.tq-list-dd .tq4-dd-n {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tq-list-dd .tq4-dd-c {
	flex: none;
	min-width: 28px;
	color: var(--tq-muted);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	text-align: end;
}

.tq-list-dd .tq4-dd-row input:checked ~ .tq4-dd-n {
	font-weight: 700;
}

.tq-list-dd .tq4-dd-foot {
	display: flex;
	align-items: center;
	min-height: 48px;
	border-block-start: 1px solid var(--tq-line);
}

.tq-list-dd .tq4-dd-clear {
	min-height: 44px;
	padding: 0 4px;
	border: 0;
	background: none;
	color: var(--tq-muted);
	font: 700 15px/1 var(--tq-font-meta);
	text-decoration: underline;
	cursor: pointer;
}

.tq-list-dd .tq4-dd-clear[hidden] {
	display: none;
}

/* Ticket 626: nothing picked = «مسح» hidden = no footer at all (no empty strip under a divider); the list's own bottom padding closes the box. */
.tq-list-dd .tq4-dd-foot:has(> .tq4-dd-clear[hidden]) {
	display: none;
}

.tq-list-dd:has(.tq4-dd-foot > .tq4-dd-clear[hidden]) {
	padding-block-end: 4px;
}

/* phone: the pin opens the sheet with that one group (live .tq4-solo), never the popover */
@media (max-width: 768px) {
	.tq-list-dd {
		display: none;
	}
}

.tq-filters .wpc-filters-section.tq4-solo-x {
	display: none;
}

.tq-filters .tq4-solo .tq4-acc .tq4-i {
	display: none;
}

.tq-filters .tq4-solo .wpc-filter-content.tq4-scroll {
	max-height: none;
	overflow: visible;
}

/*
 * 4c-T10. Sticky pins bar (L34, B1-18): one size, stuck or not; under the theme's sticky header while it shows
 * (--tq-list-top, set by router.js). Q2 (decision 197.5, Sherif 17/11): on the wide pages with the filter column the
 * bar scrolls away on the desktop and the filter widget stays in view instead (the side slot below it never sticks).
 */
.tq-list__bar {
	position: sticky;
	top: var(--tq-list-top, 0px);
	z-index: 20;
	padding-block: var(--tq-gap-xs);
	background: var(--tq-surface);
	transition: top 0.2s;
}

@media (min-width: 601px) {
	.admin-bar .tq-list__bar {
		top: max(var(--tq-list-top, 0px), var(--wp-admin--admin-bar--height, 0px));
	}
}

@media (min-width: 769px) {
	.tq-list:not(.tq-list--small) .tq-list__bar {
		position: static;
	}

	.tq-list:not(.tq-list--small) .tq-list__side {
		align-self: stretch;
	}

	/* Ticket 626 (Sherif 18/11): the filter column scrolls with the page, never inside itself (no sticky, no max-height). */
	.tq-list:not(.tq-list--small) .tq-list__side .widget_wpc_filters_widget {
		background: var(--tq-surface);
	}

	/* Cards beside the filter column: one size fewer columns than a full-width grid (4 / 6 / 8, all dividing 24). */
	.tq-list:not(.tq-list--small) .tq-list__body .tq-cards {
		--tq-cols: 4;
	}
}

@media (min-width: 1280px) {
	.tq-list:not(.tq-list--small) .tq-list__body .tq-cards {
		--tq-cols: 6;
	}
}

@media (min-width: 1700px) {
	.tq-list:not(.tq-list--small) .tq-list__body .tq-cards {
		--tq-cols: 8;
	}
}

/* No blink (D6): the router keeps the old regions on screen, height reserved, dimmed only if the answer is slow */
.tq-list__results > * + * {
	margin-block-start: var(--tq-gap-l);
}

.tq-list__results {
	scroll-margin-block-start: calc(var(--tq-list-top, 0px) + 64px);
}

.tq-list__results:focus {
	outline: 0;
}

[data-tq-region][aria-busy="true"] {
	opacity: 0.6;
	transition: opacity 0.15s 0.25s;
}

@media (prefers-reduced-motion: reduce) {
	.tq-list__bar,
	.tq-list__side .widget_wpc_filters_widget,
	[data-tq-region][aria-busy="true"] {
		transition: none;
	}
}

/* products: the type name over the groups of one of several picked types (live 5178 .tq277-th) */
.tq-filters .tq277-th {
	margin: 0;
	padding: 16px 0 2px;
	border-block-start: 2px solid var(--tq-line);
	color: var(--tq-muted);
	font-weight: 800;
	font-size: 13.5px;
	letter-spacing: .2px;
}

/* name search box and count (moved from filters.css; scoped to our list, never the old bar's same classes) */
.tq-list .tq431-search {
	margin: 0 0 14px;
}

.tq-list .tq431-side {
	display: none;
}

@media (min-width: 1024px) {
	.tq-list .tq431-side {
		display: block;
		margin: 0 0 18px;
	}

	.tq-list .tq431-side .tq431-search {
		margin: 0;
	}

	/* Ticket 626: one magnifier. The submit button already draws one (head snippet 15934), so the theme's leading icon goes. */
	.tq-list .tq431-side .search-form-icon {
		display: none;
	}

	.tq-list .tq431-side .search-form input[type="search"] {
		padding-block: 12px;
	}

	.tq-list:has(.tq431-side) .tq4-topbar .tq431-search {
		display: none;
	}
}

.tq-list .tq4-count {
	margin: 0;
	color: var(--tq-muted);
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
}

/* platform logos in their brand colours, the same tokens as the chips and cards (View_Options::MARK_BRANDS, A8;
   here, not in filters.css, which keeps its 12 KB cap) */
.tq-filters .tq-filters__mark--playstation {
	color: var(--tq-brand-playstation);
}

.tq-filters .tq-filters__mark--xbox {
	color: var(--tq-brand-xbox);
}

.tq-filters .tq-filters__mark--nintendo {
	color: var(--tq-brand-nintendo);
}

.tq-filters .tq-filters__mark--windows {
	color: var(--tq-brand-windows);
}

.tq-filters .tq-filters__mark--mobile {
	color: var(--tq-brand-mobile);
}
