/*
 * ChallengeEU Stream Gate. Everything lives under .cesg. The reset goes through :where() so it never
 * beats the plugin's own classes; colours that must win over the theme (Elementor kit) carry the
 * section prefix (0-2-0).
 *
 * Brand: orange #F16E22 for surfaces, rays and dots; #B0510E where orange is small text (4.6:1 on cream);
 * ink #2A2C37 text on the orange button (4.6:1); Alegreya for headings, Source Sans 3 for text.
 * The symbol is never rotated: its nine rays slide in to assemble.
 */

@font-face {
	font-family: "CESG Alegreya";
	src: url(../fonts/alegreya-latin.woff2) format("woff2");
	font-weight: 500 800;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "CESG Alegreya";
	src: url(../fonts/alegreya-latin-ext.woff2) format("woff2");
	font-weight: 500 800;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "CESG Source";
	src: url(../fonts/sourcesans-latin.woff2) format("woff2");
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "CESG Source";
	src: url(../fonts/sourcesans-latin-ext.woff2) format("woff2");
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

.cesg {
	--cesg-orange: #f16e22;
	--cesg-orange-text: #b0510e;
	--cesg-orange-light: #f58a45;
	--cesg-orange-tint: #fdebdf;
	--cesg-ink: #2a2c37;
	--cesg-cream: #f2f0eb;
	--cesg-paper: #ffffff;
	--cesg-line: #cfcac0;
	--cesg-muted: #5c5f6b;
	--cesg-muted-on-ink: #a9a7a0;
	--cesg-danger: #b3261e;
	--cesg-serif: "Alegreya", "CESG Alegreya", Georgia, "Times New Roman", serif;
	--cesg-sans: "Source Sans 3", "CESG Source", system-ui, -apple-system, "Segoe UI", sans-serif;
	--cesg-radius: 18px;
	--cesg-field-radius: 10px;
	--cesg-ease: cubic-bezier(0.16, 1, 0.3, 1);

	container-type: inline-size;
	box-sizing: border-box;
	max-width: 1040px;
	margin: 0 auto 2.5em;
	color: var(--cesg-ink);
	font-family: var(--cesg-sans);
	font-size: clamp(15px, 1rem, 18px);
	line-height: 1.5;
	text-align: left;
}

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

.cesg :where(h2, h3, p, ul, li, form, fieldset, legend, details, summary, label) {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: inherit;
	line-height: inherit;
	letter-spacing: normal;
	text-transform: none;
}

/* Every element toggled with the hidden attribute also gets a display from its class. */
.cesg [hidden] {
	display: none !important;
}

.cesg .cesg-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.cesg .cesg-editor-note {
	margin: 0 0 1em;
	padding: 0.75em 1em;
	border: 1px dashed var(--cesg-danger);
	border-radius: var(--cesg-field-radius);
	background: #fff8f7;
	color: var(--cesg-danger);
	font-size: 0.875em;
}

/* ---------------------------------------------------------------- heading */

.cesg .cesg-head {
	margin: 0 0 1.1em;
}

.cesg .cesg-kicker {
	display: flex;
	align-items: center;
	gap: 0.55em;
	margin: 0 0 0.4em;
	color: var(--cesg-orange-text);
	font-family: var(--cesg-sans);
	font-size: 0.8125em;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.cesg .cesg-dot {
	width: 0.62em;
	height: 0.62em;
	border-radius: 50%;
	background: var(--cesg-orange);
	box-shadow: 0 0 0 0 rgba(241, 110, 34, 0.5);
	animation: cesg-pulse 2.4s ease-out infinite;
}

@keyframes cesg-pulse {
	0% { box-shadow: 0 0 0 0 rgba(241, 110, 34, 0.45); }
	70%, 100% { box-shadow: 0 0 0 0.6em rgba(241, 110, 34, 0); }
}

.cesg .cesg-title {
	margin: 0;
	color: var(--cesg-ink);
	font-family: var(--cesg-serif);
	font-size: clamp(1.6em, 4.6cqi, 2.5em);
	font-weight: 700;
	line-height: 1.08;
	letter-spacing: -0.005em;
	text-wrap: balance;
}

/* ---------------------------------------------------------------- screen */

.cesg .cesg-screen {
	position: relative;
	display: grid;
	aspect-ratio: 16 / 9;
	border-radius: var(--cesg-radius);
	background: var(--cesg-ink);
	color: var(--cesg-cream);
}

.cesg .cesg-lock {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 100%;
	overflow: hidden;
	border-radius: var(--cesg-radius);
}

.cesg .cesg-lock-text {
	position: relative;
	z-index: 1;
	display: grid;
	gap: 0.55em;
	max-width: 58%;
	padding: clamp(1.4em, 5.5cqi, 3.25em);
}

.cesg .cesg-lock-title {
	color: var(--cesg-cream);
	font-family: var(--cesg-serif);
	font-size: clamp(1.7em, 6.2cqi, 3.4em);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

.cesg .cesg-lock-note {
	max-width: 26em;
	color: var(--cesg-muted-on-ink);
	font-size: 1em;
}

.cesg .cesg-lock-when {
	margin-top: 0.35em;
	color: var(--cesg-cream);
	font-size: 0.95em;
}

.cesg .cesg-lock-when time {
	font-weight: 700;
}

.cesg .cesg-countdown {
	color: var(--cesg-orange);
	font-weight: 600;
	white-space: nowrap;
}

/* The symbol bleeds off the right edge, a quarter of it cropped by the screen. */
.cesg .cesg-burst {
	position: absolute;
	top: 50%;
	right: -9%;
	width: auto;
	height: 112%;
	max-width: none;
	transform: translateY(-50%);
	overflow: visible;
	pointer-events: none;
}

.cesg .cesg-ray {
	fill: var(--cesg-orange);
}

.cesg.is-waiting .cesg-ray {
	opacity: 0;
	transform: translate(var(--dx), var(--dy));
}

.cesg.is-in .cesg-ray {
	animation: cesg-ray 1.1s var(--cesg-ease) backwards;
	animation-delay: calc(var(--n) * 55ms + 120ms);
}

@keyframes cesg-ray {
	from {
		opacity: 0;
		transform: translate(var(--dx), var(--dy));
	}
}

.cesg .cesg-player {
	position: absolute;
	inset: 0;
	overflow: hidden;
	border-radius: var(--cesg-radius);
	background: #000;
	outline: none;
}

.cesg .cesg-player iframe,
.cesg .cesg-player > div {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.cesg .cesg-player .cesg-wait {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 1.5em;
	background: var(--cesg-ink);
	color: var(--cesg-cream);
	text-align: center;
}

/* ---------------------------------------------------------------- viewer line */

.cesg .cesg-viewer {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.25em 1em;
	margin: 0.8em 0 0;
	color: var(--cesg-muted);
	font-size: 0.95em;
}

.cesg .cesg-viewer strong {
	color: var(--cesg-ink);
	font-weight: 700;
}

.cesg .cesg-link,
.cesg .cesg-link:hover,
.cesg .cesg-link:focus {
	min-height: 0;
	margin: 0;
	padding: 0.25em 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: var(--cesg-orange-text);
	font: inherit;
	font-weight: 700;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.22em;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
}

.cesg .cesg-link:hover {
	text-decoration-thickness: 2px;
}

.cesg .cesg-link:focus-visible {
	outline: 2px solid var(--cesg-ink);
	outline-offset: 3px;
}

.cesg .cesg-closed {
	margin: 1em 0 0;
	padding: 1.1em 1.35em;
	border-radius: var(--cesg-radius);
	background: var(--cesg-cream);
	color: var(--cesg-ink);
	font-weight: 600;
}

/* ---------------------------------------------------------------- form */

.cesg .cesg-form {
	display: grid;
	gap: 1.25em;
	margin: 1.1em 0 0;
	padding: clamp(1.25em, 4.5cqi, 2.5em);
	border-radius: var(--cesg-radius);
	background: var(--cesg-cream);
}

.cesg.is-checking .cesg-form,
.cesg.is-checking .cesg-closed {
	visibility: hidden;
}

.cesg .cesg-form-title {
	margin: 0 0 0.15em;
	color: var(--cesg-ink);
	font-family: var(--cesg-serif);
	font-size: 1.55em;
	font-weight: 700;
	line-height: 1.15;
}

.cesg .cesg-form-lead {
	color: var(--cesg-muted);
}

.cesg .cesg-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 15em), 1fr));
	gap: 1.25em;
}

.cesg .cesg-field {
	display: grid;
	gap: 0.4em;
	min-width: 0;
}

.cesg .cesg-field > label,
.cesg .cesg-status legend {
	color: var(--cesg-ink);
	font-size: 0.95em;
	font-weight: 700;
}

.cesg .cesg-status legend {
	margin: 0 0 0.45em;
	padding: 0;
}

/* The "Other" field belongs to the status question: keep it close to the options. */
.cesg .cesg-status-other {
	margin-top: -0.45em;
}

/* A line of guidance between a label and its field. */
.cesg .cesg-hint {
	margin-top: -0.2em;
	color: var(--cesg-muted);
	font-size: 0.875em;
}

.cesg .cesg-input {
	display: block;
	width: 100%;
	min-height: 3em;
	margin: 0;
	padding: 0.6em 0.9em;
	border: 1px solid var(--cesg-line);
	border-radius: var(--cesg-field-radius);
	background: var(--cesg-paper);
	box-shadow: none;
	color: var(--cesg-ink);
	font: inherit;
	line-height: 1.4;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cesg .cesg-select {
	appearance: none;
	padding-right: 2.6em;
	background-image:
		linear-gradient(45deg, transparent 50%, var(--cesg-ink) 50%),
		linear-gradient(135deg, var(--cesg-ink) 50%, transparent 50%);
	background-position: calc(100% - 1.3em) 52%, calc(100% - 0.95em) 52%;
	background-size: 0.35em 0.35em, 0.35em 0.35em;
	background-repeat: no-repeat;
}

.cesg .cesg-input:hover {
	border-color: #a8a297;
}

.cesg .cesg-input:focus,
.cesg .cesg-input:focus-visible {
	border-color: var(--cesg-ink);
	outline: none;
	box-shadow: 0 0 0 3px rgba(241, 110, 34, 0.4);
}

/* Four statuses: 2 × 2 or one row, never 3 + 1 with an orphan. */
.cesg .cesg-options {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.55em;
}

@container (min-width: 40em) {
	.cesg .cesg-options {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.cesg .cesg-option {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.6em;
	min-height: 3em;
	margin: 0;
	padding: 0.55em 0.9em;
	border: 1px solid var(--cesg-line);
	border-radius: var(--cesg-field-radius);
	background: var(--cesg-paper);
	color: var(--cesg-ink);
	font-size: 0.98em;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cesg .cesg-option:hover {
	border-color: #a8a297;
}

.cesg .cesg-option input,
.cesg .cesg-check input {
	flex: none;
	width: 1.15em;
	height: 1.15em;
	margin: 0;
	accent-color: var(--cesg-orange-text);
}

.cesg .cesg-option:has(input:checked) {
	border-color: var(--cesg-orange);
	background: var(--cesg-orange-tint);
	box-shadow: inset 0 0 0 1px var(--cesg-orange);
}

.cesg .cesg-option:has(input:focus-visible) {
	outline: 2px solid var(--cesg-ink);
	outline-offset: 2px;
}

/* Privacy notice */

.cesg .cesg-notice {
	border-radius: var(--cesg-field-radius);
	background: var(--cesg-paper);
	font-size: 0.9em;
}

.cesg .cesg-notice summary {
	display: flex;
	align-items: center;
	gap: 0.55em;
	padding: 0.8em 1.05em;
	border-radius: var(--cesg-field-radius);
	color: var(--cesg-ink);
	font-weight: 700;
	cursor: pointer;
	list-style: none;
}

.cesg .cesg-notice summary:focus {
	outline: none;
}

.cesg .cesg-notice summary:focus-visible {
	outline: 2px solid var(--cesg-ink);
	outline-offset: 2px;
}

.cesg .cesg-notice summary::-webkit-details-marker {
	display: none;
}

.cesg .cesg-notice summary::before {
	content: "";
	flex: none;
	width: 0.45em;
	height: 0.45em;
	border-right: 2px solid var(--cesg-orange-text);
	border-bottom: 2px solid var(--cesg-orange-text);
	transform: rotate(-45deg);
	transition: transform 0.15s ease;
}

.cesg .cesg-notice[open] summary::before {
	transform: rotate(45deg);
}

.cesg .cesg-notice-body {
	display: grid;
	gap: 0.75em;
	padding: 0 1.1em 1.1em 2.1em;
	color: var(--cesg-muted);
}

/* The consent label is a direct child of a field too: outrank the bold field-label rule (0-2-1). */
.cesg .cesg-field > .cesg-check {
	display: flex;
	align-items: flex-start;
	gap: 0.7em;
	color: var(--cesg-ink);
	font-size: 0.95em;
	font-weight: 400;
	cursor: pointer;
}

.cesg .cesg-check input {
	margin-top: 0.2em;
}

/* Errors */

.cesg .cesg-error,
.cesg .cesg-form-error {
	color: var(--cesg-danger);
	font-size: 0.875em;
	font-weight: 600;
}

.cesg .cesg-field.has-error .cesg-input,
.cesg .cesg-field.has-error .cesg-option {
	border-color: var(--cesg-danger);
}

.cesg .cesg-summary {
	padding: 0.9em 1.1em;
	border: 1px solid rgba(179, 38, 30, 0.35);
	border-radius: var(--cesg-field-radius);
	background: #fff6f5;
	color: var(--cesg-ink);
	font-size: 0.95em;
	outline: none;
}

.cesg .cesg-summary:focus-visible {
	box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.25);
}

.cesg .cesg-summary p {
	margin: 0 0 0.35em;
	font-weight: 700;
}

.cesg .cesg-summary ul {
	margin: 0;
	padding: 0 0 0 1.1em;
	list-style: disc;
}

.cesg .cesg-summary a {
	color: var(--cesg-danger);
	text-decoration: underline;
	cursor: pointer;
}

/* Button: ink on orange (4.6:1). Hover lightens, because darker orange takes contrast from the ink. */

.cesg .cesg-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75em 1.25em;
}

.cesg .cesg-btn,
.cesg .cesg-btn:hover,
.cesg .cesg-btn:focus {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 3.1em;
	margin: 0;
	padding: 0.75em 1.9em;
	border: 0;
	border-radius: 999px;
	background: var(--cesg-orange);
	box-shadow: none;
	color: var(--cesg-ink);
	font-family: var(--cesg-sans);
	font-size: 1.02em;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.01em;
	text-transform: none;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.12s var(--cesg-ease);
}

.cesg .cesg-btn:hover {
	background: var(--cesg-orange-light);
}

.cesg .cesg-btn:active {
	transform: translateY(1px) scale(0.99);
}

.cesg .cesg-btn:focus-visible {
	outline: 3px solid var(--cesg-ink);
	outline-offset: 3px;
}

.cesg .cesg-btn:disabled {
	opacity: 0.7;
	cursor: progress;
}

/* Bot trap: off screen, not display:none, which some bots check for. */
.cesg .cesg-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Narrow: the symbol moves to the top right corner and the text sits below it. */
@container (max-width: 34em) {
	.cesg .cesg-lock {
		align-items: flex-end;
		min-height: 15em;
	}

	.cesg .cesg-lock-text {
		max-width: none;
		padding-top: 5.5em;
	}

	.cesg .cesg-burst {
		top: -22%;
		right: -16%;
		height: 72%;
		transform: none;
	}

	.cesg .cesg-lock-note {
		display: none;
	}

	.cesg .cesg-btn {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cesg .cesg-dot,
	.cesg.is-in .cesg-ray {
		animation: none;
	}

	.cesg .cesg-input,
	.cesg .cesg-option,
	.cesg .cesg-btn,
	.cesg .cesg-notice summary::before {
		transition: none;
	}
}
