/*
 * References (inc/references.php): a row of logos under a page head and the logo cards with two tabs.
 * Logos sit on white cards in every section tone, so a brand colour never meets the dark band.
 */

/* Strip ------------------------------------------------------------------------------------------- */

.dg-refstrip {
	display: grid;
	gap: var(--dg-space-4);
}

.dg-refstrip__label {
	margin: 0;
	font-size: var(--dg-fs-sm, 0.9375rem);
	font-weight: 600;
	color: var(--dg-muted);
}

.dg-refstrip__logos {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--dg-space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* On a phone two rows are enough: the strip sits above the content the visitor came for. */
@media (max-width: 599px) {
	.dg-refstrip__item:nth-child(n+5) {
		display: none;
	}
}

@media (min-width: 600px) {
	.dg-refstrip__logos {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (min-width: 1000px) {
	.dg-refstrip__logos {
		grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	}
}

.dg-refstrip__item {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 76px;
	margin: 0;
	padding: var(--dg-space-3) var(--dg-space-4);
	border: 1px solid var(--dg-line);
	border-radius: 12px;
	background: #fff;
}

.dg-refstrip__item .dg-ref__logo {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 48px;
	object-fit: contain;
}

/* Grid with tabs ------------------------------------------------------------------------------------ */

.dg-refgrid__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: var(--dg-space-3);
	margin-block-end: var(--dg-space-5);
}

.dg-refgrid__tab {
	display: inline-flex;
	align-items: center;
	gap: var(--dg-space-3);
	min-height: var(--dg-tap, 48px);
	padding: var(--dg-space-2) var(--dg-space-3) var(--dg-space-2) var(--dg-space-4);
	border: 1px solid var(--dg-line);
	border-radius: 999px;
	background: #fff;
	color: var(--dg-ink);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.dg-refgrid__tab[aria-selected="true"] {
	border-color: var(--dg-ink);
	box-shadow: inset 0 0 0 1px var(--dg-ink);
}

.dg-refgrid__tab:focus-visible {
	outline: none;
	box-shadow: var(--dg-focus);
}

.dg-refgrid__count {
	min-width: 2em;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--dg-bg-soft);
	font-size: 0.8125rem;
	text-align: center;
}

.dg-refgrid__tab[aria-selected="true"] .dg-refgrid__count {
	background: var(--theme-palette-color-1);
	color: var(--dg-ink);
}

/* Without the script both lists show, each under its own heading; with it the tab names the list. */
.dg-refgrid__panel + .dg-refgrid__panel {
	margin-block-start: var(--dg-space-6);
}

.dg-refgrid.is-ready .dg-refgrid__panel + .dg-refgrid__panel {
	margin-block-start: 0;
}

.dg-refgrid__panel-title {
	margin: 0 0 var(--dg-space-4);
	font-size: var(--dg-fs-lg);
}

.dg-refgrid.is-ready .dg-refgrid__panel-title {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.dg-refgrid:not(.is-ready) .dg-refgrid__tabs {
	display: none;
}

.dg-refgrid__panel[hidden] {
	display: none;
}

.dg-refgrid__cards {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--dg-space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 600px) {
	.dg-refgrid__cards {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1000px) {
	.dg-refgrid__cards {
		grid-template-columns: repeat(6, minmax(0, 1fr));
		gap: var(--dg-space-4);
	}
}

/* Phones: six cards (three rows), the rest behind the button. Without the script every card shows. */
.dg-refgrid__more {
	display: none;
}

@media (max-width: 599.98px) {
	.dg-refgrid.is-ready .dg-refgrid__panel:not(.is-open) .dg-refgrid__card:nth-child(n + 7) {
		display: none;
	}

	.dg-refgrid.is-ready .dg-refgrid__more {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		min-height: var(--dg-tap, 48px);
		margin-top: var(--dg-space-3);
		padding: var(--dg-space-2) var(--dg-space-4);
		border: 1px solid var(--dg-line);
		border-radius: 999px;
		background: #fff;
		color: var(--dg-text);
		font: inherit;
		font-size: 0.9375rem;
		font-weight: 600;
		cursor: pointer;
	}

	.dg-refgrid.is-ready .dg-refgrid__more:focus-visible {
		outline: none;
		box-shadow: var(--dg-focus);
	}
}

.dg-refgrid__panel {
	scroll-margin-top: var(--dg-space-4);
}

.dg-refgrid__card {
	display: flex;
	flex-direction: column;
	margin: 0;
	overflow: hidden;
	border: 1px solid var(--dg-line);
	border-radius: 12px;
	background: #fff;
}

.dg-refgrid__logo {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: center;
	min-height: 104px;
	padding: var(--dg-space-4);
}

.dg-refgrid__logo .dg-ref__logo {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 64px;
	object-fit: contain;
}

.dg-refgrid__name {
	padding: var(--dg-space-3);
	border-top: 1px solid var(--dg-line);
	background: var(--dg-bg-softer, #fafafa);
	color: var(--dg-text);
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.35;
	text-align: center;
}
