/**
 * CRO Restaurant Brands
 *
 * This file sets layout only. It never sets a font-family or a text/link color, so the
 * section picks up each site's own heading font, body font and link color automatically.
 *
 * Per-site tweaks (Appearance → Customize → Additional CSS), for example:
 *   .cro-brands { --cro-brands-max-width: 1200px; --cro-brands-name-size: 2rem; --cro-brands-radius: 6px; }
 */

.cro-brands {
	--cro-brands-max-width: 1100px;
	--cro-brands-gap: clamp(1.5em, 4vw, 3.5em);
	--cro-brands-row-gap: clamp(2.75em, 6vw, 5em);
	--cro-brands-name-size: clamp(1.5em, 1.1em + 1.4vw, 2.1em);
	--cro-brands-name-transform: uppercase;
	--cro-brands-radius: 0;

	box-sizing: border-box;
	width: 100%;
	margin: clamp(2em, 5vw, 4em) auto;
	padding: 0;
	container-type: inline-size;
	container-name: cro-brands;
}

/* Block themes cap post content at a narrow reading width with a low-specificity rule; this wins
   over it so the two-column layout has room (never wider than the container). Themes with stricter
   rules keep their own width and the section simply stacks; use align="wide" there.
   Wide/full alignment is left entirely to the theme. */
.cro-brands.cro-brands:not(.alignwide):not(.alignfull) {
	max-width: var(--cro-brands-max-width);
}

.cro-brands.cro-brands.alignfull {
	padding-inline: clamp(1em, 4vw, 3em);
}

.cro-brands *,
.cro-brands *::before,
.cro-brands *::after {
	box-sizing: inherit;
}

/* Section title and subtitle ------------------------------------------------ */

.cro-brands .cro-brands__header {
	max-width: 46em;
	margin: 0 auto var(--cro-brands-row-gap);
	text-align: center;
}

.cro-brands .cro-brands__title {
	margin: 0 0 0.45em;
}

.cro-brands .cro-brands__subtitle {
	margin: 0;
}

/* Rows ---------------------------------------------------------------------- */

.cro-brands .cro-brands__list {
	display: grid;
	gap: var(--cro-brands-row-gap);
	margin: 0;
	padding: 0;
}

.cro-brands .cro-brands__item {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	align-items: center;
	gap: var(--cro-brands-gap);
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
}

/* Alternate sides: image left, then right, then left... */
.cro-brands--zigzag .cro-brands__item:nth-child(even) .cro-brands__media {
	order: 2;
}

.cro-brands .cro-brands__media {
	min-width: 0;
	margin: 0;
}

.cro-brands .cro-brands__media-link {
	display: block;
	overflow: hidden;
	border: 0;
	border-radius: var(--cro-brands-radius);
	box-shadow: none;
	text-decoration: none;
}

.cro-brands .cro-brands__img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	margin: 0;
	aspect-ratio: 560 / 395;
	object-fit: cover;
	border-radius: var(--cro-brands-radius);
	transition: transform 0.5s ease;
}

.cro-brands .cro-brands__media-link:hover .cro-brands__img {
	transform: scale(1.035);
}

/* Shown when a brand has no image yet. */
.cro-brands .cro-brands__placeholder {
	display: grid;
	place-items: center;
	aspect-ratio: 560 / 395;
	padding: 1em;
	border-radius: var(--cro-brands-radius);
	background: rgba(128, 128, 128, 0.12);
	font-size: var(--cro-brands-name-size);
	letter-spacing: 0.08em;
	text-align: center;
	text-transform: uppercase;
}

.cro-brands .cro-brands__body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
	max-width: 34em;
}

/* Tagline comes after the name in the HTML (better for screen readers) but shows above it. */
.cro-brands .cro-brands__tagline {
	order: -1;
	margin: 0 0 0.65em;
	padding: 0;
	font-size: 0.8125em;
	line-height: 1.5;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	opacity: 0.75;
}

.cro-brands .cro-brands__name {
	margin: 0 0 0.5em;
	padding: 0;
	font-size: var(--cro-brands-name-size);
	line-height: 1.15;
	letter-spacing: 0.02em;
	text-transform: var(--cro-brands-name-transform);
	overflow-wrap: anywhere;
}

.cro-brands .cro-brands__name a {
	border-bottom: 0;
	box-shadow: none;
	text-decoration: none;
}

.cro-brands .cro-brands__name a:hover,
.cro-brands .cro-brands__name a:focus-visible {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.cro-brands .cro-brands__desc {
	width: 100%;
}

.cro-brands .cro-brands__desc p {
	margin: 0 0 1em;
}

.cro-brands .cro-brands__desc > :last-child {
	margin-bottom: 0;
}

.cro-brands .cro-brands__link {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	margin-top: 1.25em;
	font-size: 0.875em;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
}

.cro-brands .cro-brands__link:hover,
.cro-brands .cro-brands__link:focus-visible {
	text-decoration: underline;
	text-underline-offset: 0.25em;
}

.cro-brands .cro-brands__arrow {
	display: inline-block;
	transition: transform 0.2s ease;
}

.cro-brands .cro-brands__link:hover .cro-brands__arrow {
	transform: translateX(0.25em);
}

/* Optional accent color from Our Brands → Settings. */
.cro-brands.has-accent .cro-brands__name a,
.cro-brands.has-accent .cro-brands__link {
	color: var(--cro-brands-accent);
}

.cro-brands .cro-brands__sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Card grid layout ---------------------------------------------------------- */

.cro-brands--grid {
	--cro-brands-name-size: clamp(1.25em, 1em + 0.6vw, 1.5em);
}

.cro-brands--grid .cro-brands__list {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 16em), 1fr));
	gap: var(--cro-brands-gap);
}

.cro-brands--grid .cro-brands__item {
	grid-template-columns: minmax(0, 1fr);
	align-items: start;
	align-content: start;
	gap: 1.1em;
}

.cro-brands--grid .cro-brands__body {
	max-width: none;
}

/* Narrow spaces: stack image above text. Based on the section's own width, so it also
   works inside narrow theme columns, not just on phones. ----------------------- */

@container cro-brands (max-width: 700px) {
	.cro-brands--zigzag .cro-brands__item {
		grid-template-columns: minmax(0, 1fr);
		gap: 1.25em;
	}

	.cro-brands--zigzag .cro-brands__item:nth-child(even) .cro-brands__media {
		order: 0;
	}

	.cro-brands--zigzag .cro-brands__body {
		max-width: none;
	}
}

@supports not (container-type: inline-size) {
	@media (max-width: 760px) {
		.cro-brands--zigzag .cro-brands__item {
			grid-template-columns: minmax(0, 1fr);
			gap: 1.25em;
		}

		.cro-brands--zigzag .cro-brands__item:nth-child(even) .cro-brands__media {
			order: 0;
		}

		.cro-brands--zigzag .cro-brands__body {
			max-width: none;
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	.cro-brands .cro-brands__img,
	.cro-brands .cro-brands__arrow {
		transition: none;
	}

	.cro-brands .cro-brands__media-link:hover .cro-brands__img,
	.cro-brands .cro-brands__link:hover .cro-brands__arrow {
		transform: none;
	}
}
