/* ============================================================
   SWS events — shared parts of the regatta page, the season list and the "Als Nächstes" card
   (AUDIT P2-1: the page, list and card each load their own file on top of this one).
   Flag-code chips, buttons, the Signalmast (race-day status), media fallbacks. Tokens only, .sws-* only.
   ============================================================ */

.sws-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.sws-event-page a:focus-visible,
.sws-event-page summary:focus-visible,
.sws-overview a:focus-visible,
.sws-overview summary:focus-visible,
.sws-next a:focus-visible,
.sws-hpnews a:focus-visible {
	outline: var(--wp--custom--focus-ring);
	outline-offset: 2px;
}

/* ---------- Flag-code chip (DESIGN-POLISH §0): flag 14 px + wide label ---------- */
.sws-chip {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 0.45rem;
	min-height: 1.75rem;
	padding: 0.2rem 0.65rem 0.2rem 0.4rem;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--label);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
	color: var(--wp--preset--color--ink);
	text-decoration: none;
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius--button);
}

.sws-chip__flag {
	display: inline-flex;
	flex: none;
	align-items: center;
}

.sws-chip__flag svg {
	display: block;
	width: auto;
	height: 14px;
}

/* Blue flag: the race committee boat at the finishing line (RRS Race Signals) — "Resultate" / "Vorbei". */
.sws-chip__flag--finish {
	width: 17px;
	height: 12px;
	background: var(--wp--preset--color--navy);
	box-shadow: 0 0 0 1px var(--wp--preset--color--white);
}

.sws-chip__flag--none {
	width: 8px;
	height: 8px;
	margin-inline: 0.25rem;
	border: 1.5px solid currentColor;
	border-radius: 50%;
}

.sws-chip .sws-icon {
	width: 0.95rem;
	height: 0.95rem;
	margin-left: -0.15rem;
}

.sws-chip--upcoming {
	color: var(--wp--preset--color--navy);
	border-color: color-mix(in srgb, var(--wp--preset--color--navy) 45%, var(--wp--preset--color--white));
}

.sws-chip--live {
	color: var(--wp--preset--color--white);
	background: var(--wp--preset--color--red);
	border-color: var(--wp--preset--color--red);
}

.sws-chip--soon {
	color: var(--wp--preset--color--ink-soft);
	border-style: dashed;
	border-color: var(--wp--preset--color--line-strong);
}

.sws-chip--tbc {
	color: var(--wp--preset--color--ink-soft);
	background: var(--wp--preset--color--bg-alt);
}

.sws-chip--cancelled {
	color: var(--wp--preset--color--red-hover);
	background: color-mix(in srgb, var(--wp--preset--color--red) 6%, var(--wp--preset--color--white));
	border-color: color-mix(in srgb, var(--wp--preset--color--red) 30%, var(--wp--preset--color--white));
}

.sws-chip--past {
	color: var(--wp--preset--color--navy);
	border-color: color-mix(in srgb, var(--wp--preset--color--navy) 45%, var(--wp--preset--color--white));
}

/* Over without results to link: the same blue finish flag, no grey (Eric 28.10.). */
.sws-chip--done {
	color: var(--wp--preset--color--navy);
	border-color: color-mix(in srgb, var(--wp--preset--color--navy) 25%, var(--wp--preset--color--white));
}

/* The results chip is the strongest element of a past row. */
a.sws-chip--past {
	color: var(--wp--preset--color--white);
	background: var(--wp--preset--color--navy);
	border-color: var(--wp--preset--color--navy);
}

a.sws-chip--past:hover {
	color: var(--wp--preset--color--white);
	background: var(--wp--preset--color--navy-deep);
	border-color: var(--wp--preset--color--navy-deep);
}

a.sws-chip--past .sws-chip__flag--finish {
	background: var(--wp--preset--color--navy);
}

/* ---------- Buttons ---------- */
.sws-ev-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 2.75rem;
	padding: 0.55rem 1.1rem;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--base);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
	text-decoration: none;
	border: 1.5px solid transparent;
	border-radius: var(--wp--custom--radius--button);
	cursor: pointer;
}

.sws-ev-btn .sws-icon {
	width: 1.1rem;
	height: 1.1rem;
}

a.sws-ev-btn--primary {
	color: var(--wp--preset--color--white);
	background: var(--wp--preset--color--red);
	border-color: var(--wp--preset--color--red);
}

a.sws-ev-btn--primary:hover {
	color: var(--wp--preset--color--white);
	background: var(--wp--preset--color--red-hover);
	border-color: var(--wp--preset--color--red-hover);
}

a.sws-ev-btn--ghost {
	color: var(--wp--preset--color--navy);
	background: transparent;
	border-color: color-mix(in srgb, var(--wp--preset--color--navy) 40%, transparent);
}

a.sws-ev-btn--ghost:hover {
	color: var(--wp--preset--color--navy-deep);
	border-color: var(--wp--preset--color--navy);
	background: var(--wp--preset--color--white);
}

a.sws-ev-btn:active {
	transform: translateY(1px);
}

/* ---------- Media: photo, or the venue's lake chart on paper ---------- */
.sws-ev-media {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: var(--wp--preset--color--paper-deep);
}

.sws-ev-media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sws-ev-media--chart {
	background: var(--wp--preset--color--bg-alt);
}

.sws-ev-media--chart .sws-lake {
	display: block;
	width: 100%;
	height: 100%;
	padding: 8%;
}

/* ---------- Swiss Tour teaser (sws_events_teaser_html(), Eric 29.11.2026) ----------
   The square poster of the old site as markup: the photo full-bleed, the «Swiss Tour» lettering top centre (58.5 %
   wide), «Windsurfing Fin & Foil» below it, at the bottom the club logo and the Swiss Sailing logo on white tiles with
   spot and lake between them. Every measure is in cqi (% of the square's width), so it reads the same at 300 and
   at 660 px — and stays sharp, because nothing is baked into a JPEG. */
.sws-ev-media--teaser {
	height: auto;
	background: var(--wp--preset--color--navy-deep);
}

.sws-teaser {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 1;
	overflow: hidden;
	container-type: inline-size;
	font-family: var(--wp--preset--font-family--body);
	line-height: 1.1;
	text-align: center;
	color: var(--wp--preset--color--white);
	text-shadow: var(--wp--custom--hero--text-shadow);
}

.sws-teaser,
.sws-teaser * {
	box-sizing: border-box;
}

.sws-teaser > * {
	position: absolute;
	z-index: 2;
}

.sws-ev-media .sws-teaser .sws-teaser__photo {
	inset: 0;
	z-index: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Scrim: a little navy behind the lettering and the class line, more behind the foot — the photo stays a photo. */
.sws-teaser::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background:
		linear-gradient(
			180deg,
			color-mix(in srgb, var(--wp--preset--color--navy-deep) 16%, transparent) 0%,
			color-mix(in srgb, var(--wp--preset--color--navy-deep) 6%, transparent) 40%,
			transparent 55%,
			transparent 72%,
			color-mix(in srgb, var(--wp--preset--color--navy-deep) 42%, transparent) 100%
		);
	pointer-events: none;
}

/* Outside the Swiss Tour (render-overview.php, tour = false): no lettering on top, so only the foot gets a scrim. */
.sws-teaser--plain::after {
	background:
		linear-gradient(
			180deg,
			transparent 0%,
			transparent 72%,
			color-mix(in srgb, var(--wp--preset--color--navy-deep) 42%, transparent) 100%
		);
}

.sws-ev-media .sws-teaser .sws-teaser__mark {
	top: 4.5cqi;
	left: 20.75cqi;
	width: 58.5cqi;
	height: auto;
	object-fit: contain;
	filter: drop-shadow(0 0.3cqi 1.2cqi color-mix(in srgb, var(--wp--preset--color--navy-deep) 35%, transparent));
}

.sws-teaser__class {
	top: 45.6cqi;
	right: 0;
	left: 0;
	font-size: 3.45cqi;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.sws-teaser__foot {
	right: 3.4cqi;
	bottom: 3.4cqi;
	left: 3.4cqi;
	display: grid;
	grid-template-columns: minmax(10.6cqi, 1fr) auto minmax(10.6cqi, 1fr); /* Equal sides: the place stays centred. */
	align-items: end;
	gap: 1.5cqi;
}

/* The tiles are 10.6cqi squares, as on the old teasers; a wide logo (Silvaplana, render-overview.php) gets a wider
   tile of the same height, so it does not shrink to a sliver. */
.sws-teaser__tile {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 10.6cqi;
	height: 10.6cqi;
	padding: 1cqi;
	background: var(--wp--preset--color--white);
	box-shadow: 0 0.2cqi 1cqi color-mix(in srgb, var(--wp--preset--color--navy-deep) 30%, transparent);
}

.sws-teaser__tile--club {
	justify-self: start;
}

.sws-teaser__tile--wide {
	width: auto;
	min-width: 10.6cqi;
	max-width: 100%;
}

.sws-teaser__tile--empty {
	visibility: hidden;
}

.sws-teaser__tile--sui {
	justify-self: end;
	padding: 1.15cqi 1.4cqi;
}

.sws-ev-media .sws-teaser .sws-teaser__logo {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.sws-ev-media .sws-teaser .sws-teaser__tile--wide .sws-teaser__logo {
	width: auto;
	max-width: 100%;
}

.sws-teaser__place {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5cqi;
	min-width: 0;
	margin-bottom: -0.6cqi; /* The caps of the lake line sit on the bottom edge of the tiles. */
	text-transform: uppercase;
}

.sws-teaser__spot {
	font-size: 3.2cqi;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.06em;
	overflow-wrap: anywhere;
}

.sws-teaser__lake {
	font-size: 3.3cqi;
	font-weight: 400;
	line-height: 1;
	letter-spacing: 0.08em;
}

.sws-cal-icon {
	display: block;
	flex-shrink: 0;
}

/* ============================================================
   SIGNALMAST — race-day status (inc/racestatus.php): regatta hero and "Als Nächstes" card
============================================================ */
.sws-race {
	--sws-race-accent: var(--wp--preset--color--white);
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--50);
	width: fit-content;
	max-width: 46rem;
	margin-bottom: var(--wp--preset--spacing--50);
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--60) var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
	color: var(--wp--preset--color--white);
	background: color-mix(in srgb, var(--wp--preset--color--navy-deep) 80%, transparent);
	border-radius: var(--wp--custom--radius--card);
	box-shadow: var(--wp--preset--shadow--card-hover);
	backdrop-filter: blur(6px);
}

.sws-race p {
	margin: 0;
}

.sws-race--go {
	--sws-race-accent: var(--wp--preset--color--red);
}

.sws-race--done {
	--sws-race-accent: var(--wp--preset--color--navy-tint);
}

.sws-race--stop {
	background: color-mix(in srgb, var(--wp--preset--color--red) 94%, transparent);
}

/* The mast: a white pole with its truck, the flags hoisted off it. */
.sws-race__mast {
	position: relative;
	display: flex;
	flex-shrink: 0;
	align-self: stretch;
	align-items: flex-start;
	min-height: 4.75rem;
	padding: var(--wp--preset--spacing--20) 0 0 var(--wp--preset--spacing--20);
	border-left: 3px solid color-mix(in srgb, var(--wp--preset--color--white) 85%, transparent);
}

.sws-race__mast::before {
	content: "";
	position: absolute;
	top: -6px;
	left: -6px;
	width: 9px;
	height: 9px;
	background: var(--wp--preset--color--white);
	border-radius: 50%;
}

.sws-race__kicker {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	margin-bottom: var(--wp--preset--spacing--10);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--wp--preset--color--white) 85%, transparent);
}

.sws-race__when {
	white-space: nowrap;
	color: color-mix(in srgb, var(--wp--preset--color--white) 72%, transparent);
}

.sws-race__dot {
	width: 9px;
	height: 9px;
	background: var(--sws-race-accent);
	border-radius: 50%;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--sws-race-accent) 30%, transparent);
}

.sws-race--go .sws-race__dot {
	animation: sws-pulse 1.6s ease-in-out infinite;
}

.sws-race--stop .sws-race__dot {
	background: var(--wp--preset--color--white);
}

.sws-race__label {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--h-3);
	font-weight: 800;
	line-height: var(--wp--custom--line-height--tight);
	text-transform: uppercase;
}

.sws-race__desc {
	margin-top: var(--wp--preset--spacing--10);
	font-size: var(--wp--preset--font-size--small);
	color: color-mix(in srgb, var(--wp--preset--color--white) 88%, transparent);
}

.sws-race__note {
	margin-top: var(--wp--preset--spacing--20);
	font-weight: 600;
}

/* Flags (sws_flag_svg() of the signals module, or text badges). */
.sws-flags {
	display: inline-flex;
	flex-direction: column;
	gap: 3px;
}

.sws-flags__flag {
	display: block;
	width: 3.25rem;
	transform-origin: left center;
}

.sws-flags__flag svg {
	display: block;
	width: 100%;
	height: auto;
}

.sws-flags--stack .sws-flags__flag {
	width: 2.75rem;
}

.sws-flags__badge {
	display: grid;
	place-items: center;
	aspect-ratio: 3 / 2;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 800;
	line-height: 1;
	color: var(--wp--preset--color--navy-deep);
	background: var(--wp--preset--color--white);
	border-radius: var(--wp--custom--radius--badge);
}

.sws-race--page .sws-flags__flag {
	animation: sws-flutter 3.4s ease-in-out infinite;
}

.sws-race--page .sws-flags__flag + .sws-flags__flag {
	animation-delay: -1.2s;
}

/* "Als Nächstes" card: one line under the venue, on paper. */
.sws-race--next {
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--10) var(--wp--preset--spacing--30);
	max-width: 100%;
	margin: 0;
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--40) var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--navy-deep);
	border-left: 3px solid var(--sws-race-accent);
	border-radius: 0 var(--wp--custom--radius--small) var(--wp--custom--radius--small) 0;
	box-shadow: none;
	backdrop-filter: none;
}

.sws-race--next.sws-race--stop {
	background: var(--wp--preset--color--red);
}

.sws-race--next .sws-race__line {
	font-size: var(--wp--preset--font-size--small);
}

.sws-race--next .sws-race__label {
	font-size: var(--wp--preset--font-size--base);
}

.sws-race--next .sws-race__time {
	margin-left: var(--wp--preset--spacing--10);
	color: color-mix(in srgb, var(--wp--preset--color--white) 80%, transparent);
	white-space: nowrap;
}

.sws-race--next .sws-race__note {
	flex-basis: 100%;
	margin-top: 0;
	font-size: var(--wp--preset--font-size--small);
}

.sws-flags--small .sws-flags__flag {
	width: 1.75rem;
}

.sws-flags--small.sws-flags--stack .sws-flags__flag {
	width: 1.5rem;
}

@keyframes sws-pulse {
	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0.55;
	}
}

@keyframes sws-flutter {
	0%,
	100% {
		transform: skewY(0deg) scaleX(1);
	}

	40% {
		transform: skewY(-3deg) scaleX(0.97);
	}

	70% {
		transform: skewY(1.5deg) scaleX(0.99);
	}
}

@media (max-width: 600px) {
	.sws-race {
		gap: var(--wp--preset--spacing--40);
		width: auto;
		padding-right: var(--wp--preset--spacing--40);
	}

	.sws-flags__flag {
		width: 2.5rem;
	}

	.sws-flags--stack .sws-flags__flag {
		width: 2.25rem;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.sws-ev-btn,
	.sws-chip {
		transition: background-color var(--wp--custom--transition), border-color var(--wp--custom--transition), color var(--wp--custom--transition), transform var(--wp--custom--transition);
	}

	.sws-chip:hover .sws-chip__flag svg {
		animation: sws-flutter 0.6s ease-in-out;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sws-race--go .sws-race__dot,
	.sws-race--page .sws-flags__flag,
	.sws-chip--live {
		animation: none;
	}
}
