/* Regatta Duisburg – Upcoming Regattas
 * Corporate Design: Deep Blue #14206c, Fresh Blue #2e6cf1, Clean Blue #6eebfc,
 * Color #d9ff03, Activ Orange #ff5929, Green #00ff7a.
 * Headlines: MADE Outer Sans · Body: DM Sans.
 *
 * Colours and fonts are taken from the regatta-duisburg.com theme variables
 * (--color-*, --font-*) and fall back to the CD values when used elsewhere.
 * Override in Customizer → Additional CSS, e.g. .rde-events { --rde-kanu: #00ff7a; }
 */
.rde-events {
	--rde-navy: var(--color-dark, #14206c);
	--rde-primary: var(--color-primary, #2e6cf1);
	--rde-accent: var(--color-accent, #ff5929);
	--rde-lime: var(--color-secondary, #d9ff03);
	--rde-cyan: var(--color-1, #6eebfc);
	--rde-text: var(--color-dark, #14206c);
	--rde-rudern: var(--color-primary, #2e6cf1);
	--rde-kanu: var(--color-accent, #ff5929);
	--rde-font-heading: var(--font-heading, "made_outer_sans_alt", "DM Sans", sans-serif);
	--rde-font-body: var(--font-body, "DM Sans", sans-serif);
	--rde-media-bg: #e0e0e0;
	--rde-radius: 20px;
	--rde-media-height: 190px;
	--rde-gap: 20px;
	--rde-cols: 3;

	display: grid;
	grid-template-columns: repeat(var(--rde-cols), minmax(0, 1fr));
	gap: var(--rde-gap);
	margin: 0 0 1.5em;
	padding: 0;
	color: var(--rde-text);
	font-family: var(--rde-font-body);
}

.rde-events.rde-cols-1 { --rde-cols: 1; }
.rde-events.rde-cols-2 { --rde-cols: 2; }
.rde-events.rde-cols-3 { --rde-cols: 3; }
.rde-events.rde-cols-4 { --rde-cols: 4; }

/* Responsive columns based on the space the widget actually has (content area, sidebar …). */
.rde-events-wrap {
	container-type: inline-size;
	container-name: rde;
}

@container rde (max-width: 960px) {
	.rde-events.rde-cols-4 { --rde-cols: 2; }
}

@container rde (max-width: 700px) {
	.rde-events.rde-cols-3 { --rde-cols: 2; }
}

@container rde (max-width: 520px) {
	.rde-events.rde-cols-2,
	.rde-events.rde-cols-3,
	.rde-events.rde-cols-4 { --rde-cols: 1; }
}

/* Fallback for browsers without container queries: use the viewport width. */
@supports not (container-type: inline-size) {
	@media (max-width: 1000px) {
		.rde-events.rde-cols-3,
		.rde-events.rde-cols-4 { --rde-cols: 2; }
	}

	@media (max-width: 640px) {
		.rde-events { --rde-cols: 1 !important; }
	}
}

.rde-events--empty {
	display: block;
	color: var(--color-dark, #14206c);
	font-family: var(--font-body, "DM Sans", sans-serif);
}

/* ------------------------------------------------------------------ Card */
.rde-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	overflow: hidden;
	border-radius: var(--rde-radius);
	background: #fff;
	box-shadow: 0 0 0 1px rgba(20, 32, 108, 0.06), 0 12px 32px rgba(20, 32, 108, 0.08);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rde-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 0 0 1px rgba(20, 32, 108, 0.06), 0 18px 40px rgba(20, 32, 108, 0.14);
}

/* Media: image/logo on light grey (like the news cards), no overlay */
.rde-card__media {
	position: relative;
	height: var(--rde-media-height);
	overflow: hidden;
	background: var(--rde-media-bg);
}

.rde-card__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	object-position: center;
	border-radius: 0;
	transition: transform 0.4s ease;
}

.rde-card:hover .rde-card__img {
	transform: scale(1.03);
}

/* Logo mode: whole logo visible, with configurable padding (Klein / Mittel / Groß).
 * The bottom padding additionally reserves room for the date badge. */
.rde-card__media {
	--rde-logo-pad: 26px;
}

.rde-card__media.rde-pad-s { --rde-logo-pad: 14px; }
.rde-card__media.rde-pad-m { --rde-logo-pad: 26px; }
.rde-card__media.rde-pad-l { --rde-logo-pad: 40px; }

.rde-card__media--contain .rde-card__img {
	box-sizing: border-box;
	padding: var(--rde-logo-pad) calc(var(--rde-logo-pad) * 1.25) calc(var(--rde-logo-pad) + 44px);
	object-fit: contain;
}

.rde-card:hover .rde-card__media--contain .rde-card__img {
	transform: none;
}

/* No image: Deep Blue → Fresh Blue */
.rde-card__media:not(:has(.rde-card__img)) {
	background:
		radial-gradient(120% 90% at 100% 0%, rgba(110, 235, 252, 0.35) 0%, rgba(110, 235, 252, 0) 60%),
		linear-gradient(160deg, var(--rde-primary) 0%, var(--rde-navy) 100%);
}

/* Date badge – CD "Color" as eyecatcher */
.rde-card__date {
	position: absolute;
	left: 16px;
	bottom: 16px;
	z-index: 2;
	display: flex;
	flex-direction: column;
	padding: 9px 13px 8px;
	border-radius: 12px;
	background: var(--rde-lime);
	color: var(--rde-navy);
	line-height: 1.1;
}

.rde-card__days {
	font-family: var(--rde-font-heading);
	font-size: 20px;
	font-weight: 400;
	letter-spacing: -0.02em;
}

.rde-card__month {
	margin-top: 3px;
	font-family: var(--rde-font-body);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* ------------------------------------------------------------------ Body */
.rde-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
	padding: 22px 24px 24px;
}

/* Category line (like "Nicht kategorisiert" on the news cards) */
.rde-events .rde-card__sport {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 10px;
	color: var(--rde-primary);
	font-family: var(--rde-font-body);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.3;
}

.rde-card__sport::before {
	content: "";
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--rde-rudern);
}

.rde-card--kanu .rde-card__sport::before {
	background: var(--rde-kanu);
}

.rde-events .rde-card__title {
	margin: 0 0 12px;
	padding: 0;
	color: var(--rde-navy);
	font-family: var(--rde-font-heading);
	font-size: 22px;
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: -0.02em;
	text-transform: none;
}

/* Long words (e.g. German compounds) wrap/hyphenate instead of overflowing the card. */
.rde-events .rde-card__title,
.rde-events .rde-card__desc {
	max-width: 100%;
	overflow-wrap: anywhere;
	word-break: normal;
	-webkit-hyphens: auto;
	hyphens: auto;
	-webkit-hyphenate-limit-before: 5;
	-webkit-hyphenate-limit-after: 5;
	hyphenate-limit-chars: 12 5 5; /* only hyphenate long words (e.g. German compounds) */
}

.rde-events .rde-card__desc {
	margin: 0 0 20px;
	color: var(--rde-text);
	font-family: var(--rde-font-body);
	font-size: 16px;
	line-height: 1.5;
}

/* Button – like the "Zur Webseite" button (Activ Orange pill) */
.rde-events .rde-card__button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	max-width: 100%;
	margin-top: auto;
	padding: 14px 22px;
	border: 0;
	border-radius: 100px;
	background: var(--rde-accent);
	color: #fff;
	font-family: var(--rde-font-body);
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.2s ease, transform 0.2s ease;
}

.rde-events .rde-card__button:hover,
.rde-events .rde-card__button:focus {
	background: color-mix(in srgb, var(--rde-accent) 85%, black);
	color: #fff;
	text-decoration: none;
}

.rde-events .rde-card__button span {
	transition: transform 0.2s ease;
}

.rde-events .rde-card__button:hover span {
	transform: translateX(3px);
}

.rde-events .rde-card__button:focus-visible {
	outline: 3px solid var(--rde-primary);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.rde-card,
	.rde-card__img,
	.rde-card__button,
	.rde-card__button span { transition: none; }
	.rde-card:hover,
	.rde-card:hover .rde-card__img { transform: none; }
}

/* ---------------------------------------------------------------------------
 * Equal alignment across a row: category, titles, descriptions and buttons line up,
 * no matter how long each title is (CSS subgrid – all modern browsers).
 * ------------------------------------------------------------------------ */
@supports (grid-template-rows: subgrid) {
	.rde-events {
		row-gap: 0;
	}

	.rde-card {
		display: grid;
		grid-row: span 5; /* media | category | title | description | button */
		grid-template-rows: subgrid;
		row-gap: 0;
		margin-bottom: var(--rde-gap);
	}

	.rde-card__media {
		grid-row: 1;
	}

	.rde-card__body {
		display: grid;
		grid-row: 2 / span 4;
		grid-template-rows: subgrid;
		row-gap: 0;
		align-items: start;
		justify-items: start;
	}

	.rde-events .rde-card__sport  { grid-row: 1; }
	.rde-events .rde-card__title  { grid-row: 2; width: 100%; }
	.rde-events .rde-card__desc   { grid-row: 3; width: 100%; }
	.rde-events .rde-card__button { grid-row: 4; align-self: end; margin-top: 0; }
}

/* Fallback for very old browsers: reserve two title lines. */
@supports not (grid-template-rows: subgrid) {
	.rde-events .rde-card__title {
		min-height: 2.4em;
	}
}
