/* Regatta Duisburg – "Regattastrecke": schematic 2000 m course with traffic rules.
 * Colours follow the theme variables (--color-*, --font-*). Override e.g. .rdc { --rdc-water: #6eebfc; }
 */
.rdc {
	--rdc-navy: var(--color-dark, #14206c);
	--rdc-ground: #121d63;
	--rdc-water: var(--color-primary, #2e6cf1);
	--rdc-island: #14206c;
	--rdc-place: #ff6a00;
	--rdc-lime: var(--color-secondary, #d9ff03);
	--rdc-text: #fff;
	--rdc-muted: rgba(255, 255, 255, 0.68);
	--rdc-font-heading: var(--font-heading, "made_outer_sans_alt", "DM Sans", sans-serif);
	--rdc-font-body: var(--font-body, "DM Sans", sans-serif);
	--rdc-radius: 24px;

	container-type: inline-size;
	box-sizing: border-box;
	min-width: 0;
	max-width: 100%;
	padding: clamp(20px, 4cqi, 48px);
	border-radius: var(--rdc-radius);
	background:
		radial-gradient(120% 80% at 80% 0%, rgba(46, 108, 241, 0.25), transparent 60%),
		var(--rdc-ground);
	color: var(--rdc-text);
	font-family: var(--rdc-font-body);
	line-height: 1.4;
}

.rdc *,
.rdc *::before,
.rdc *::after {
	box-sizing: border-box;
}

.rdc__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.rdc .rdc__title {
	margin: 0;
	color: var(--rdc-lime);
	font-family: var(--rdc-font-heading);
	font-size: clamp(22px, 4cqi, 40px);
	font-weight: 400;
	line-height: 1;
	text-transform: uppercase;
}

.rdc__note {
	margin: 8px 0 14px;
	color: var(--rdc-muted);
	font-size: 13px;
}

.rdc__export {
	margin-left: auto;
}

.rdc__toggle {
	display: grid;
	flex: 0 0 auto;
	place-items: center;
	width: 38px;
	height: 38px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
	color: var(--rdc-lime);
	cursor: pointer;
}

.rdc__toggle:hover,
.rdc__toggle:focus-visible {
	background: var(--rdc-lime);
	color: var(--rdc-navy);
	outline: none;
}

.rdc__toggle svg { width: 18px; height: 18px; fill: currentColor; }
.rdc__toggle .rdc-i-play { display: none; }
.rdc.is-paused .rdc__toggle .rdc-i-play { display: block; }
.rdc.is-paused .rdc__toggle .rdc-i-pause { display: none; }

.rdc__svg {
	display: block;
	width: 100%;
	height: auto;
}

/* Phones: vertical course (start at the top), like the printed traffic rules. */
.rdc__svg--v {
	display: none;
}

@container (max-width: 600px) {
	.rdc__svg--h {
		display: none;
	}

	.rdc__svg--v {
		display: block;
		max-width: 460px;
		margin: 0 auto;
	}
}

.rdc__svg--v .rdc__dist {
	text-anchor: end;
	dominant-baseline: central;
}

/* ------------------------------------------------------------ Course drawing (2000 units wide) */
.rdc__water {
	fill: var(--rdc-water);
	stroke: var(--rdc-island);
	stroke-linejoin: round;
}

.rdc__island { fill: var(--rdc-island); }
.rdc__lime { fill: var(--rdc-lime); }

.rdc__lane,
.rdc__marker {
	stroke: var(--rdc-lime);
	stroke-width: 3.6;
}

.rdc__lane-num,
.rdc__dist {
	font-family: var(--rdc-font-body);
	font-weight: 700;
}

.rdc__lane-num {
	fill: var(--rdc-lime);
	font-size: 22px;
	text-anchor: middle;
	dominant-baseline: central;
}

.rdc__dist {
	fill: #fff;
	font-size: 26px;
	text-anchor: middle;
}

.rdc__dist.is-edge { fill: var(--rdc-lime); }

/* ------------------------------------------------------------ Traffic rules */
.rdc-arrow {
	transition: opacity 0.2s ease;
}

.rdc-arrow__line {
	fill: none;
	stroke: var(--rdc-c, #fff);
	stroke-width: 5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.rdc-arrow__head {
	fill: var(--rdc-c, #fff);
}

.rdc__marks > g {
	transition: opacity 0.2s ease;
}

/* Notes on arrows / boats: wider hit area, small "i" marker, tooltip */
.rdc__body {
	position: relative;
}

.rdc-arrow__hit {
	fill: none;
	stroke: transparent;
	stroke-width: 28;
	stroke-linecap: round;
	stroke-linejoin: round;
}

[data-rdc-note] {
	cursor: help;
	outline: none;
}

.rdc-info circle {
	fill: var(--rdc-lime);
	stroke: var(--rdc-navy);
	stroke-width: 2;
}

.rdc-info text {
	fill: var(--rdc-navy);
	font: 700 16px var(--rdc-font-body);
	text-anchor: middle;
}

[data-rdc-note].is-tip .rdc-arrow__line {
	stroke-width: 7;
}

[data-rdc-note]:focus-visible .rdc-mark,
[data-rdc-note]:focus-visible .rdc-arrow__line {
	filter: drop-shadow(0 0 4px var(--rdc-lime));
}

.rdc__tip {
	position: absolute;
	z-index: 3;
	left: 0;
	top: 0;
	max-width: min(320px, 80%);
	padding: 7px 12px;
	border-radius: 10px;
	background: var(--rdc-lime);
	color: var(--rdc-navy);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	pointer-events: none;
	transform: translate(-50%, calc(-100% - 12px));
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.rdc__tip[hidden] {
	display: none;
}

/* Legend */
.rdc .rdc__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 10px;
	margin: 14px 0 0;
	padding: 0;
	list-style: none;
}

.rdc .rdc__legend li {
	margin: 0;
	padding: 0;
}

.rdc-key {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	margin: 0;
	padding: 4px 12px 4px 8px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 999px;
	background: transparent;
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.rdc-key:hover,
.rdc-key:focus-visible,
.rdc-key.is-active {
	border-color: var(--rdc-lime);
	background: rgba(217, 255, 3, 0.12);
	outline: none;
}

.rdc-key[aria-pressed="true"] {
	background: var(--rdc-lime);
	color: var(--rdc-navy);
}

/* Icons on water blue – the colour all arrows are drawn on (keeps e.g. navy arrows visible). */
.rdc-key__icon {
	flex: 0 0 auto;
	width: 40px;
	height: 22px;
	padding: 3px 4px;
	border-radius: 6px;
	background: var(--rdc-water);
	overflow: visible;
}

/* Highlight one type: dim the other arrows and boats. */
.rdc.has-active .rdc-arrow:not(.is-active),
.rdc.has-active .rdc__marks > g:not(.is-active) {
	opacity: 0.18;
}

.rdc.has-active .rdc-arrow.is-active .rdc-arrow__line {
	stroke-width: 7;
}

/* Blocked areas: red hatching */
.rdc-hatch__bg { fill: rgba(227, 0, 27, 0.22); }
.rdc-hatch__line { fill: rgba(227, 0, 27, 0.7); }

.rdc-area__line {
	fill: none;
	stroke: #e3001b;
	stroke-width: 3;
	stroke-linejoin: round;
}

.rdc__areas > g {
	transition: opacity 0.2s ease;
}

.rdc.has-active .rdc__areas > g:not(.is-active) {
	opacity: 0.18;
}

[data-rdc-note].is-tip .rdc-area__line,
[data-rdc-note]:focus-visible .rdc-area__line {
	stroke-width: 5;
}

/* Text boxes: plain text in the colour of the lane numbers */
.rdc-textbox text {
	fill: var(--rdc-lime);
	font-family: var(--rdc-font-body);
	font-weight: 700;
	text-anchor: middle;
}

.rdc.has-active .rdc__texts {
	opacity: 0.18;
	transition: opacity 0.2s ease;
}

/* ------------------------------------------------------------ Racing boats (loop; duration and direction per lane inline) */
.rdc-boat__hull { fill: #fff; opacity: 0.85; }
.rdc-boat__oars { stroke: var(--rdc-lime); stroke-width: 1.4; stroke-linecap: round; }

.rdc-boat {
	animation: rdc-race 11s cubic-bezier(0.3, 0.1, 0.4, 1) infinite;
}

@keyframes rdc-race {
	0% { transform: translateX(0); opacity: 0; }
	4% { opacity: 1; }
	92% { transform: translateX(var(--rdc-dist)); opacity: 1; }
	100% { transform: translateX(var(--rdc-dist)); opacity: 0; }
}

.rdc.is-paused .rdc-boat {
	animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
	.rdc *,
	.rdc *::before,
	.rdc *::after {
		transition: none !important;
	}
}
