/* ==========================================================================
   lists.css
   The browse page, a list page, the "Your Lists" section of a game page and
   the list section of a profile.
   ========================================================================== */

/* ==========================================================================
   Browse page
   ========================================================================== */

/* The width every other page on the site uses: a max-width with the
   gutters on the sides, so the page is centred rather than stretched
   edge to edge. */
.lists-page {
	max-width: var(--container);
	margin: 0 auto;
	padding: var(--s-4) var(--s-6) var(--s-10);
}

.lists-page__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--s-5);
	flex-wrap: wrap;
	margin-bottom: var(--s-7);
}

.lists-page__heading {
	min-width: 0;
}

.lists-page__meta {
	display: flex;
	align-items: center;
	gap: var(--s-3);
	flex-wrap: wrap;
	font-size: var(--text-sm);
	color: var(--text-2);
	margin: 0 0 var(--s-3);
}

.lists-page__meta a {
	color: var(--text-2);
	text-decoration: none;
}

.lists-page__meta a:hover {
	color: var(--text);
	text-decoration: underline;
}

.lists-page__description {
	font-size: var(--text-base);
	color: var(--text-2);
	line-height: var(--leading-relaxed);
	margin: 0;
	max-width: 62ch;
}

.lists-page__actions {
	display: flex;
	align-items: center;
	gap: var(--s-2);
	flex-shrink: 0;
}

/* A button_to renders a form, so the actions row has to undo the form
   margins to keep the buttons on one line. */
.lists-page__actions form {
	margin: 0;
}

.lists-page__section-title {
	display: flex;
	align-items: center;
	gap: var(--s-2);
	font-size: var(--text-lg);
	font-weight: 700;
	letter-spacing: var(--tracking-tight);
	margin: 0 0 var(--s-4);
}

.lists-page__count {
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--text-3);
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--r-full);
	padding: 1px var(--s-2);
}

.lists-page__own,
.lists-page__public,
.lists-page__add,
.lists-page__games {
	margin-bottom: var(--s-9);
}

.lists-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: var(--s-4);
}

/* ==========================================================================
   List card (browse grid)
   ========================================================================== */

.lists-card {
	display: flex;
	flex-direction: column;
	gap: var(--s-2);
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--r-lg);
	padding: var(--s-4);
	box-shadow: var(--inner-hi);
	text-decoration: none;
	color: inherit;
	transition:
		transform var(--dur) var(--ease),
		border-color var(--dur) var(--ease),
		box-shadow var(--dur) var(--ease);
}

.lists-card:hover {
	transform: translateY(-2px);
	border-color: var(--border-strong);
	box-shadow:
		var(--inner-hi),
		var(--shadow),
		0 0 24px color-mix(in srgb, var(--violet) 12%, transparent);
	text-decoration: none;
	color: inherit;
}

.lists-card:focus-visible {
	border-color: var(--border-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 20%, transparent);
}

.lists-card__header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--s-3);
}

.lists-card__title {
	font-size: var(--text-base);
	font-weight: 700;
	letter-spacing: var(--tracking-tight);
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lists-card__count {
	flex-shrink: 0;
	font-size: var(--text-xs);
	font-weight: 600;
	color: var(--text-3);
}

.lists-card__description {
	font-size: var(--text-sm);
	color: var(--text-2);
	line-height: var(--leading-snug);
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.lists-card__owner {
	font-size: var(--text-xs);
	color: var(--text-3);
	margin: 0;
}

/* ==========================================================================
   A list page
   ========================================================================== */

.lists-page--single .lists-page__header {
	border-bottom: 1px solid var(--border);
	padding-bottom: var(--s-5);
}

/* The form is a name, a description and a checkbox. Stretched across the
   whole page they read as a search form rather than as the three fields
   they are, so the form keeps a readable measure of its own. */
.lists-page--form .form {
	max-width: 560px;
}

/* ==========================================================================
   The rows of a list
   ========================================================================== */

.lists-items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--s-2);
}

.lists-items__row {
	display: flex;
	align-items: center;
	gap: var(--s-4);
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--r-md);
	padding: var(--s-2) var(--s-3);
	transition: border-color var(--dur) var(--ease);
}

.lists-items__row:hover {
	border-color: var(--border-strong);
}

.lists-items__link {
	display: flex;
	align-items: center;
	gap: var(--s-3);
	flex: 1;
	min-width: 0;
	text-decoration: none;
	color: inherit;
}

.lists-items__link:hover .lists-items__title {
	color: var(--text);
}

.lists-items__image {
	width: 92px;
	height: 46px;
	object-fit: cover;
	border-radius: var(--r-sm);
	background: var(--surface-2);
	flex-shrink: 0;
}

.lists-items__placeholder {
	width: 92px;
	height: 46px;
	border-radius: var(--r-sm);
	background: var(--surface-2);
	flex-shrink: 0;
}

.lists-items__title {
	font-size: var(--text-base);
	font-weight: 600;
	color: var(--text-2);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lists-items__controls {
	display: flex;
	align-items: center;
	gap: var(--s-2);
	flex-shrink: 0;
}

.lists-items__controls form {
	margin: 0;
}

.lists-items__move,
.lists-items__remove {
	font-size: var(--text-xs);
	font-weight: 700;
	line-height: 1;
	padding: var(--s-2) var(--s-3);
	color: var(--text-2);
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--r-sm);
	cursor: pointer;
	transition:
		color var(--dur-fast) var(--ease),
		border-color var(--dur-fast) var(--ease),
		background var(--dur-fast) var(--ease);
}

.lists-items__move:hover,
.lists-items__remove:hover {
	color: var(--text);
	border-color: var(--border-strong);
	background: var(--surface-3);
}

.lists-items__remove:hover {
	color: var(--danger);
	border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}

/* ==========================================================================
   The "Add to list" control on a game page
   ========================================================================== */

.lists-picker {
	margin-bottom: var(--s-3);
}

/* The summary is a disclosure, so it needs the marker taken off it and a
   display of its own before it can look like the buttons around it. */
.lists-picker__summary {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--s-2);
	width: 100%;
	list-style: none;
	font-size: var(--text-xs);
	font-weight: 700;
	line-height: 1;
	padding: var(--s-2) var(--s-3);
	color: var(--text-2);
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--r-sm);
	cursor: pointer;
	transition:
		color var(--dur-fast) var(--ease),
		border-color var(--dur-fast) var(--ease),
		background var(--dur-fast) var(--ease);
}

.lists-picker__summary::-webkit-details-marker {
	display: none;
}

.lists-picker__summary:hover {
	color: var(--text);
	border-color: var(--border-strong);
	background: var(--surface-3);
}

.lists-picker__summary:focus-visible {
	border-color: var(--border-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 20%, transparent);
}

/* Open, the control says so: the accent border is the same signal the
   "In list" toggles carry. */
.lists-picker[open] .lists-picker__summary {
	color: var(--text);
	border-color: var(--border-accent);
	background: color-mix(in srgb, var(--violet) 10%, transparent);
}

/* ==========================================================================
   The panel that drops out of it
   ========================================================================== */

.lists-panel {
	margin-top: var(--s-2);
	padding: var(--s-2);
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--r-md);
}

.lists-panel__empty {
	font-size: var(--text-xs);
	color: var(--text-3);
	margin: 0;
	padding: var(--s-1) var(--s-2);
}

.lists-panel__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--s-1);
}

.lists-panel__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--s-2);
}

.lists-panel__name {
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--text-2);
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lists-panel__name:hover {
	color: var(--text);
	text-decoration: underline;
}

.lists-panel__toggle {
	flex-shrink: 0;
	font-size: var(--text-xs);
	font-weight: 700;
	line-height: 1;
	padding: var(--s-2) var(--s-3);
	color: var(--text-2);
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--r-sm);
	cursor: pointer;
	transition:
		color var(--dur-fast) var(--ease),
		border-color var(--dur-fast) var(--ease),
		background var(--dur-fast) var(--ease);
}

.lists-panel__toggle:hover {
	color: var(--text);
	border-color: var(--border-strong);
	background: var(--surface-3);
}

/* The game is already in the list: the button says so and reads as a
   state rather than an action, so it is tinted with the accent instead of
   the neutral surface. */
.lists-panel__toggle--on {
	color: var(--violet);
	border-color: var(--border-accent);
	background: color-mix(in srgb, var(--violet) 12%, transparent);
}

.lists-panel__toggle--on:hover {
	color: var(--text);
	background: color-mix(in srgb, var(--violet) 20%, transparent);
}

.lists-panel__create {
	display: block;
	margin-top: var(--s-2);
	padding-top: var(--s-2);
	border-top: 1px solid var(--border);
	font-size: var(--text-xs);
	font-weight: 600;
	color: var(--violet);
	text-decoration: none;
}

.lists-panel__create:hover {
	text-decoration: underline;
}

/* ==========================================================================
   The published lists a game is on
   ========================================================================== */

.lists-public__label {
	font-size: var(--text-xs);
	color: var(--text-3);
	margin: 0 0 var(--s-2);
}

.lists-public__chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s-1);
}

.lists-public__chip {
	font-size: var(--text-xs);
	font-weight: 600;
	color: var(--text-2);
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--r-full);
	padding: 2px var(--s-3);
	text-decoration: none;
	transition:
		color var(--dur-fast) var(--ease),
		border-color var(--dur-fast) var(--ease);
}

.lists-public__chip:hover {
	color: var(--text);
	border-color: var(--border-strong);
	text-decoration: none;
}

/* ==========================================================================
   The "add a game" box on a list page
   ========================================================================== */

.lists-search {
	display: flex;
	align-items: center;
	gap: var(--s-2);
	margin-bottom: var(--s-4);
}

.lists-search .form-input {
	flex: 1;
	min-width: 0;
}

.lists-search__results {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--s-1);
}

.lists-search__result {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--s-3);
	padding: var(--s-2) var(--s-3);
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--r-sm);
}

.lists-search__result form {
	margin: 0;
}

.lists-search__name {
	font-size: var(--text-sm);
	color: var(--text-2);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ==========================================================================
   The list section of a profile
   ========================================================================== */

.profile-lists {
	margin-top: var(--s-8);
}

.profile-lists__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--s-1);
}

.profile-lists__row {
	display: flex;
	align-items: center;
	gap: var(--s-3);
	padding: var(--s-2) var(--s-3);
	background: var(--surface-1);
	border: 1px solid var(--border);
	border-radius: var(--r-sm);
}

.profile-lists__name {
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--text-2);
	text-decoration: none;
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.profile-lists__name:hover {
	color: var(--text);
	text-decoration: underline;
}

.profile-lists__count {
	font-size: var(--text-xs);
	color: var(--text-3);
	margin-left: auto;
	flex-shrink: 0;
}

.profile-lists__edit {
	flex-shrink: 0;
	font-size: var(--text-xs);
	font-weight: 600;
	color: var(--text-3);
	text-decoration: none;
}

.profile-lists__edit:hover {
	color: var(--text);
	text-decoration: underline;
}

/* A published list announces itself the way the other positive states do:
   the same green the free-and-lowest badges use. */
.badge--published {
	color: var(--green-soft);
	background: rgba(34, 197, 94, 0.16);
	border: 1px solid rgba(34, 197, 94, 0.3);
}

/* ==========================================================================
   Narrow screens
   ========================================================================== */

@media (max-width: 640px) {
	.lists-page {
		padding: var(--s-3) var(--s-4) var(--s-8);
	}

	.lists-page__header {
		flex-direction: column;
		align-items: stretch;
	}

	.lists-items__row {
		flex-wrap: wrap;
	}

	.lists-items__controls {
		width: 100%;
		justify-content: flex-end;
	}

	.lists-picker__summary {
		justify-content: flex-start;
	}

	.lists-search {
		flex-direction: column;
		align-items: stretch;
	}
}

@media (prefers-reduced-motion: reduce) {
	.lists-card,
	.lists-items__move,
	.lists-items__remove,
	.lists-picker__summary,
	.lists-panel__toggle,
	.lists-public__chip {
		transition: none;
	}

	.lists-card:hover {
		transform: none;
	}
}
