/* Våra hästar. Colours follow the theme; sizes can be changed with the custom properties.
   --arlabs-horses-columns is the most per row (set from the settings or the block);
   a row never gets narrower cells than --arlabs-horses-size, so small screens get fewer. */
.arlabs-horses {
	--arlabs-horses-columns: 4;
	--arlabs-horses-size: 128px;
	--arlabs-horses-image: 130px;
	--arlabs-horses-gap: 40px;
	--arlabs-horses-accent: currentColor;
}

.arlabs-horses__heading {
	margin: 1.5em 0 .6em;
}

.arlabs-horses__group:first-child .arlabs-horses__heading,
.arlabs-horses__letters:first-child .arlabs-horses__heading {
	margin-top: 0;
}

/* Image grid */
.arlabs-horses__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(max(var(--arlabs-horses-size), calc((100% - (var(--arlabs-horses-columns) - 1) * var(--arlabs-horses-gap)) / var(--arlabs-horses-columns))), 1fr));
	gap: calc(var(--arlabs-horses-gap) * 1.1) var(--arlabs-horses-gap);
	list-style: none;
	margin: 0 0 1em;
	padding: 0;
}

.arlabs-horses__card {
	margin: 0;
	text-align: center;
}

.arlabs-horses__card a {
	display: block;
	text-decoration: none;
}

/* The name keeps the text colour, also once visited (themes colour a:visited). */
.arlabs-horses .arlabs-horses__card a:is(:link, :visited, :hover, :focus, :active),
.arlabs-horses .arlabs-poll__winners a:is(:link, :visited, :hover, :focus, :active) {
	color: inherit;
}

.arlabs-horses__image {
	display: block;
	width: 100%;
	max-width: var(--arlabs-horses-image);
	height: auto;
	aspect-ratio: 1;
	margin: 0 auto .4em;
	border-radius: 50%;
	object-fit: cover;
	transition: transform .15s ease, box-shadow .15s ease;
}

.arlabs-horses__image--none {
	background: color-mix(in srgb, currentColor 12%, transparent);
}

.arlabs-horses__card a:hover .arlabs-horses__image,
.arlabs-horses__card a:focus-visible .arlabs-horses__image {
	transform: scale(1.04);
	box-shadow: 0 4px 14px rgb(0 0 0 / .18);
}

.arlabs-horses__name {
	display: block;
	margin-top: .5em;
	font-weight: 600;
}

.arlabs-horses__card a:hover .arlabs-horses__name {
	text-decoration: underline;
}

/* Name lists */
.arlabs-horses__names {
	list-style: none;
	margin: 0 0 1em;
	padding: 0;
	columns: 12rem auto;
	column-gap: var(--arlabs-horses-gap);
}

.arlabs-horses__names li {
	margin: 0 0 .2em;
	break-inside: avoid;
}

/* Weight tables */
.arlabs-horses__weights {
	width: 100%;
	max-width: 32rem;
	margin: 0 0 1.5em;
	border-collapse: collapse;
}

.arlabs-horses__weights th,
.arlabs-horses__weights td {
	padding: .35em .6em;
	border-bottom: 1px solid color-mix(in srgb, currentColor 18%, transparent);
	text-align: left;
}

.arlabs-horses__weights th:last-child,
.arlabs-horses__weights td:last-child {
	width: 40%;
}

/* Fact box */
.arlabs-horses__facts {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: .25em 1em;
	margin: 0 0 1.5em;
}

.arlabs-horses__fact {
	display: contents;
}

.arlabs-horses__facts dt {
	font-weight: 600;
}

.arlabs-horses__facts dt::after {
	content: ":";
}

.arlabs-horses__facts dd {
	margin: 0;
}

.arlabs-horses__credit {
	font-size: .875em;
	opacity: .75;
}

.arlabs-horses__editor-note {
	padding: 1em;
	border: 1px dashed currentColor;
	opacity: .7;
}

@media (max-width: 480px) {
	.arlabs-horses {
		--arlabs-horses-size: 96px;
	}

	/* The settings set the gap on the element itself, so it is capped here instead. */
	.arlabs-horses__grid {
		gap: min(var(--arlabs-horses-gap), 20px);
	}

	.arlabs-horses__facts {
		grid-template-columns: 1fr;
		gap: 0;
	}

	.arlabs-horses__facts dd {
		margin-bottom: .4em;
	}
}

/* Awards */
.arlabs-horses__frame {
	position: relative;
	display: block;
	width: 100%;
	max-width: var(--arlabs-horses-image);
	margin: 0 auto;
}

.arlabs-horses__frame .arlabs-horses__image {
	box-shadow: 0 0 0 3px #c9a227;
}

.arlabs-horses__frame .arlabs-horses__trophy {
	position: absolute;
	right: 2%;
	bottom: 10%;
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #c9a227;
	color: #fff;
	box-shadow: 0 0 0 2px #fff;
}

.arlabs-horses__award {
	display: block;
	font-size: .8em;
	opacity: .8;
}

.arlabs-horses__ribbon {
	display: inline-flex;
	align-items: center;
	gap: .4em;
	margin: 0 0 1em;
	padding: .35em .9em .35em .5em;
	border-radius: 999px;
	background: color-mix(in srgb, #c9a227 18%, transparent);
	font-weight: 600;
}

.arlabs-horses__ribbon .arlabs-horses__trophy {
	display: grid;
	place-items: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #c9a227;
	color: #fff;
}

/* Poll */
.arlabs-poll__category {
	margin: 0 0 1.5em;
	padding: 0;
	border: 0;
}

.arlabs-poll__legend {
	margin: 0 0 .6em;
	padding: 0;
	font-size: 1.25em;
	font-weight: 700;
}

.arlabs-poll__choice {
	display: block;
	position: relative;
	cursor: pointer;
}

.arlabs-poll__choice input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.arlabs-poll__choice .arlabs-horses__image {
	transition: box-shadow .15s ease, transform .15s ease;
}

.arlabs-poll__choice:hover .arlabs-horses__image {
	transform: scale(1.04);
}

.arlabs-poll__choice input:focus-visible + .arlabs-horses__image {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}

.arlabs-poll__choice input:checked + .arlabs-horses__image {
	box-shadow: 0 0 0 4px #c9a227;
}

.arlabs-poll__choice input:checked ~ .arlabs-horses__name::before {
	content: "✓ ";
}

.arlabs-poll__voted {
	font-weight: 600;
}

.arlabs-poll__message:empty {
	display: none;
}

.arlabs-poll__winners {
	display: flex;
	flex-wrap: wrap;
	gap: var(--arlabs-horses-gap);
	list-style: none;
	margin: 0 0 1em;
	padding: 0;
	--arlabs-horses-size: 180px;
}

.arlabs-poll__winners .arlabs-horses__card {
	width: var(--arlabs-horses-size);
}

.arlabs-poll__winners a {
	color: inherit;
	text-decoration: none;
}

.arlabs-poll__places {
	list-style: none;
	margin: 0 0 1.5em;
	padding: 0;
}

.arlabs-poll__place {
	display: inline-block;
	min-width: 2em;
	font-variant-numeric: tabular-nums;
}

.arlabs-poll__count {
	display: block;
	font-size: .875em;
	opacity: .75;
}

.arlabs-poll__places .arlabs-poll__count {
	display: inline;
}

.arlabs-poll__places .arlabs-poll__count::before {
	content: "– ";
}

.arlabs-horses__card--award a:hover .arlabs-horses__image,
.arlabs-horses__card--award a:focus-visible .arlabs-horses__image {
	box-shadow: 0 0 0 3px #c9a227, 0 4px 14px rgb(0 0 0 / .18);
}

/* Roll of honour */
.arlabs-awards__table {
	width: 100%;
	max-width: 40rem;
	border-collapse: collapse;
}

.arlabs-awards__table th,
.arlabs-awards__table td {
	padding: .35em .6em;
	border-bottom: 1px solid color-mix(in srgb, currentColor 18%, transparent);
	text-align: left;
	vertical-align: top;
}

.arlabs-awards__horses {
	margin: 0;
	padding-left: 1.2em;
}
