/* Front styles for the reference blocks (Unterstützer / Zertifikate / Kooperationspartner). */

/*
 * Logo grid (Unterstützer / Zertifikate), following the design: white boxes with a thin gray
 * border, three per row, the grid slightly wider than the text column.
 *
 * These rules mirror `.logos` / `.logo` in awo-blocks/assets/kita-landing.css, which style the
 * design's own example markup on the same page. Both have to be changed together; the block keeps
 * its own copy so it does not depend on a stylesheet from the other plugin.
 */
.awo-logos {
	list-style: none;
	padding: 0;
	margin: 32px 0 0;    /* collapses with the heading's margin-bottom, as in the design */
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 21px;
	max-width: 68.5%;    /* 3 x 235.5px + 2 x 21px against the design's container */
}

.awo-logos__item {
	background: #fff;
	border: 1px solid #b7b7b7;
	aspect-ratio: 1.586;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	/* The automatic minimum of a grid item is its content's intrinsic width, so an image
	 * wider than its column stretches it. On the page the logos are served at the size the
	 * design asks for and it never shows; the editor loads the original -- 1114px for one of
	 * them -- and the column grew from 235 to 248, the row from 148 to 156. Setting the
	 * minimum lets the column keep the width the grid gives it, which is what the page draws. */
	min-width: 0;
}

.awo-logos__item a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

/*
 * A logo that links somewhere says so on hover and on keyboard focus: the box darkens its border
 * and the logo lifts a little, the same restrained language the cards use elsewhere. A logo
 * without a link stays inert, so the two are told apart before clicking.
 */
.awo-logos__item:has(a):hover,
.awo-logos__item:focus-within {
	border-color: var(--ink, #171717);
}

.awo-logos__item a img {
	transition: transform .25s ease;
}

.awo-logos__item a:hover img,
.awo-logos__item a:focus-visible img {
	transform: scale(1.05);
}

.awo-logos__item a:focus-visible {
	outline: 2px solid var(--ink, #171717);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.awo-logos__item a img {
		transition: none;
	}

	.awo-logos__item a:hover img,
	.awo-logos__item a:focus-visible img {
		transform: none;
	}
}

/*
 * Both axes stay automatic. A logo carries width and height attributes, and constraining only one
 * axis leaves the other pinned to the attribute, which stretches the image -- the same trap that
 * distorted the news cards. object-fit is the belt to that braces.
 */
.awo-logos__item img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

/* Entries without a logo: the name, styled like the placeholder the design draws in the box. */
.awo-logos__name {
	color: #707070;
	font-weight: 700;
	font-size: 0.9rem;
	text-align: center;
}

.awo-koop {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 1.5rem;
}

.awo-koop__item {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.awo-koop__logo img {
	max-width: 100%;
	height: auto;
}

.awo-koop__name {
	margin: 0;
	font-size: 1.1rem;
}

.awo-koop__info {
	margin: 0;
}

.awo-koop__link {
	align-self: flex-start;
	font-weight: 600;
}

/* The picker in the block sidebar: the numbered list of what is selected, read against the order
 * the section renders. The canvas itself draws the section, so nothing here styles a preview.
 */
.awo-ref-picker {
	list-style: none;
	margin: 0;
	padding: 0;
}

.awo-ref-picker__item {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
}

.awo-ref-picker__index {
	min-width: 18px;
	font-size: 11px;
	color: #757575;
	text-align: right;
}

.awo-ref-picker__name {
	flex: 1;
}

/* Phone: two per row across the full width, and a wider box, as the mobile artboard draws it. */
@media (max-width: 860px) {
	.awo-logos {
		grid-template-columns: repeat(2, 1fr);
		gap: 16px;
		max-width: none;
		margin-top: 64px;
	}

	.awo-logos__item {
		aspect-ratio: 1.72;
	}
}
