/*
 * ICF World Championship entry form -- front end.
 *
 * Everything is scoped under .icf-ef-wrap and uses its own custom properties,
 * so a theme's styles cannot bleed in and this cannot bleed out. Override the
 * palette by redefining the variables on .icf-ef-wrap in the theme.
 */

.icf-ef-wrap {
	--icf-bg: #faf5ec;
	--icf-card: #fffdf8;
	--icf-ink: #241f1b;
	--icf-muted: #6f6558;
	--icf-accent: #9c2a1c;
	--icf-accent-soft: #f3e4df;
	--icf-line: #e6dccb;
	--icf-line-strong: #d3c5ad;
	--icf-field: #fffefb;
	--icf-ok: #1f6b3a;
	--icf-radius: 12px;

	max-width: 56rem;
	margin: 0 auto;
	padding: 2rem 1.25rem 3rem;
	background: var(--icf-bg);
	color: var(--icf-ink);
	font-size: 1rem;
	line-height: 1.6;
	box-sizing: border-box;
}

.icf-ef-wrap *,
.icf-ef-wrap *::before,
.icf-ef-wrap *::after {
	box-sizing: inherit;
}

/* ------------------------------------------------------------------ Header */

.icf-ef-head {
	text-align: center;
	margin-bottom: 2rem;
}

.icf-ef-head__mark,
.icf-ef-head__logo {
	display: block;
	width: 68px;
	height: 68px;
	margin: 0 auto 1rem;
	color: var(--icf-accent);
}

.icf-ef-head__eyebrow {
	margin: 0 0 0.35rem;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--icf-accent);
}

.icf-ef-head__title {
	margin: 0 0 0.5rem;
	font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
	font-size: clamp(2rem, 5vw, 3rem);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.01em;
	color: var(--icf-ink);
}

.icf-ef-head__meta {
	margin: 0;
	font-size: 1rem;
	color: var(--icf-muted);
}

.icf-ef-head__place {
	font-weight: 600;
	color: var(--icf-ink);
}

.icf-ef-head__place + .icf-ef-head__dates::before {
	content: "";
	display: inline-block;
	width: 1.75rem;
}

/* -------------------------------------------------------------------- Card */

.icf-ef,
.icf-ef__success {
	background: var(--icf-card);
	border: 1px solid var(--icf-line);
	border-radius: var(--icf-radius);
	padding: clamp(1.25rem, 4vw, 2.5rem);
	box-shadow: 0 1px 2px rgba(60, 40, 20, 0.04), 0 8px 24px rgba(60, 40, 20, 0.05);
}

.icf-ef__intro {
	margin: 0 0 1.75rem;
	color: var(--icf-muted);
}

/* ---------------------------------------------------------------- Sections */

.icf-ef__section + .icf-ef__section {
	margin-top: 2.25rem;
}

/* Small-caps label with a rule running to the right edge. */
.icf-ef__legend {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	margin: 0 0 1.25rem;
	padding: 0;
	border: 0;
	font-family: inherit;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--icf-accent);
}

.icf-ef__legend::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--icf-line-strong);
}

/* ------------------------------------------------------------------ Fields */

.icf-ef__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 1.5rem;
}

@media (max-width: 640px) {
	.icf-ef__grid {
		grid-template-columns: 1fr;
	}
}

.icf-ef__field {
	margin: 0 0 1.35rem;
	padding: 0;
	border: 0;
	min-width: 0;
}

.icf-ef__field > label,
.icf-ef__field > legend {
	display: block;
	float: none;
	width: auto;
	margin: 0 0 0.4rem;
	padding: 0;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--icf-ink);
}

.icf-ef__req {
	color: var(--icf-accent);
	font-weight: 700;
}

.icf-ef__optional {
	display: block;
	margin: -0.25rem 0 0.4rem;
	font-size: 0.82rem;
	color: var(--icf-muted);
}

.icf-ef__field input[type="text"],
.icf-ef__field input[type="email"],
.icf-ef__field input[type="password"],
.icf-ef__field input[type="tel"],
.icf-ef__field input[type="date"],
.icf-ef__field textarea {
	display: block;
	width: 100%;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--icf-line-strong);
	border-radius: 8px;
	background: var(--icf-field);
	color: var(--icf-ink);
	font: inherit;
	line-height: 1.4;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.icf-ef__field textarea {
	min-height: 8.5rem;
	resize: vertical;
	line-height: 1.6;
}

.icf-ef__field input::placeholder,
.icf-ef__field textarea::placeholder {
	color: #a89b89;
}

.icf-ef__field input:hover,
.icf-ef__field textarea:hover {
	border-color: var(--icf-muted);
}

.icf-ef__field input:focus,
.icf-ef__field textarea:focus,
.icf-ef__file:focus {
	outline: none;
	border-color: var(--icf-accent);
	box-shadow: 0 0 0 3px var(--icf-accent-soft);
}

/*
 * Only flag a field once the person has actually interacted with it.
 *
 * The previous rule used :not(:placeholder-shown), which matches whenever an
 * input has no placeholder attribute at all -- so every untouched required
 * field was outlined in red the moment the page loaded. :user-invalid fires
 * only after a blur or a submit attempt.
 */
.icf-ef__field input:user-invalid,
.icf-ef__field textarea:user-invalid {
	border-color: var(--icf-accent);
	box-shadow: 0 0 0 3px var(--icf-accent-soft);
}

/* ------------------------------------------------------ Password with toggle */

.icf-ef__pw {
	position: relative;
	display: block;
}

.icf-ef__pw input {
	/* Room for the toggle so a long password never runs under it. */
	padding-right: 3.25rem;
}

.icf-ef__pw-toggle {
	position: absolute;
	top: 50%;
	right: 0.4rem;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.4rem;
	height: 2.4rem;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--icf-muted);
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease;
}

.icf-ef__pw-toggle:hover {
	color: var(--icf-accent);
	background: var(--icf-accent-soft);
}

.icf-ef__pw-toggle:focus-visible {
	outline: 2px solid var(--icf-accent);
	outline-offset: 1px;
}

.icf-ef__pw-toggle svg {
	width: 20px;
	height: 20px;
	display: block;
}

.icf-ef__pw-toggle .icf-eye-off {
	display: none;
}

.icf-ef__pw-toggle[aria-pressed="true"] .icf-eye-on {
	display: none;
}

.icf-ef__pw-toggle[aria-pressed="true"] .icf-eye-off {
	display: block;
}

.icf-ef__hint {
	display: block;
	margin-top: 0.4rem;
	font-size: 0.85rem;
	line-height: 1.5;
	color: var(--icf-muted);
}

/* ------------------------------------------------------------ File uploads */

.icf-ef__file {
	display: block;
	width: 100%;
	padding: 0.75rem;
	border: 1px dashed var(--icf-line-strong);
	border-radius: 8px;
	background: var(--icf-field);
	color: var(--icf-muted);
	font: inherit;
	font-size: 0.92rem;
	cursor: pointer;
}

.icf-ef__file::file-selector-button {
	margin-right: 0.9rem;
	padding: 0.45rem 1rem;
	border: 1px solid var(--icf-line-strong);
	border-radius: 6px;
	background: #fff;
	color: var(--icf-ink);
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.icf-ef__file::file-selector-button:hover {
	background: var(--icf-accent-soft);
	border-color: var(--icf-accent);
}

.icf-ef__file.is-filled {
	border-style: solid;
	border-color: var(--icf-ok);
	background: #f4faf5;
	color: var(--icf-ink);
}

/* ------------------------------------------------------- Radio / check cards */

.icf-ef__choices {
	display: grid;
	gap: 0.65rem;
}

.icf-ef__choices--tight {
	gap: 0.5rem;
}

.icf-ef__choice {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.85rem 1rem;
	border: 1px solid var(--icf-line-strong);
	border-radius: 10px;
	background: var(--icf-field);
	font-weight: 400;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.icf-ef__choice:hover {
	border-color: var(--icf-muted);
	background: #fff;
}

.icf-ef__choice input {
	flex: none;
	width: 1.15rem;
	height: 1.15rem;
	margin: 0.15rem 0 0;
	accent-color: var(--icf-accent);
	cursor: pointer;
}

.icf-ef__choice:has(input:checked),
.icf-ef__choice.is-checked {
	border-color: var(--icf-accent);
	background: var(--icf-accent-soft);
	box-shadow: inset 0 0 0 1px var(--icf-accent);
}

.icf-ef__choice:focus-within {
	box-shadow: 0 0 0 3px var(--icf-accent-soft);
	border-color: var(--icf-accent);
}

.icf-ef__choice-body {
	display: block;
	min-width: 0;
}

.icf-ef__choice-title {
	display: block;
	font-weight: 600;
	line-height: 1.35;
}

.icf-ef__choice-hint {
	display: block;
	margin-top: 0.15rem;
	font-size: 0.85rem;
	line-height: 1.45;
	color: var(--icf-muted);
}

.icf-ef__check {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	margin-bottom: 0.9rem;
	padding: 0.9rem 1rem;
	border: 1px solid var(--icf-line);
	border-radius: 10px;
	background: var(--icf-field);
	font-size: 0.95rem;
	line-height: 1.55;
	cursor: pointer;
}

.icf-ef__check input {
	flex: none;
	width: 1.15rem;
	height: 1.15rem;
	margin: 0.2rem 0 0;
	accent-color: var(--icf-accent);
	cursor: pointer;
}

.icf-ef__check:focus-within {
	border-color: var(--icf-accent);
	box-shadow: 0 0 0 3px var(--icf-accent-soft);
}

/* ------------------------------------------------------- Conditional blocks */

/* The rail signals "this appeared because of your answer". */
.icf-ef__conditional:not([hidden]) {
	margin: 1.25rem 0 0;
	padding: 0.25rem 0 0.1rem 1.25rem;
	border-left: 3px solid var(--icf-accent);
	animation: icf-reveal 0.22s ease-out;
}

.icf-ef__conditional[hidden] {
	display: none;
}

@keyframes icf-reveal {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.icf-ef__conditional:not([hidden]) {
		animation: none;
	}
}

/* ------------------------------------------------------------------ Errors */

.icf-ef__errors {
	margin: 0 0 1.75rem;
	padding: 1.1rem 1.35rem;
	border: 1px solid var(--icf-accent);
	border-left-width: 4px;
	border-radius: 8px;
	background: #fdf4f2;
	color: #61180f;
}

.icf-ef__errors-title {
	margin: 0;
	font-weight: 700;
}

.icf-ef__errors ul {
	margin: 0.5rem 0 0;
	padding-left: 1.2rem;
}

.icf-ef__errors li {
	margin: 0.2rem 0;
}

.icf-ef__errors:focus-visible {
	outline: 2px solid var(--icf-accent);
	outline-offset: 3px;
}

/* ------------------------------------------------------------------ Submit */

.icf-ef__actions {
	margin-top: 1.75rem;
}

.icf-ef__submit {
	display: block;
	width: 100%;
	padding: 0.95rem 1.5rem;
	border: 0;
	border-radius: 8px;
	background: var(--icf-accent);
	color: #fff;
	font: inherit;
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.05s ease;
}

.icf-ef__submit:hover:not(:disabled) {
	background: #85210f;
}

.icf-ef__submit:active:not(:disabled) {
	transform: translateY(1px);
}

.icf-ef__submit:focus-visible {
	outline: 3px solid var(--icf-accent-soft);
	outline-offset: 2px;
}

.icf-ef__submit:disabled {
	opacity: 0.65;
	cursor: progress;
}

.icf-ef__note {
	margin: 1.1rem 0 0;
	text-align: center;
	font-size: 0.88rem;
	line-height: 1.55;
	color: var(--icf-muted);
}

/* Honeypot: off-screen rather than display:none, which some bots skip. */
.icf-ef__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ----------------------------------------------------------------- Success */

.icf-ef__success {
	text-align: center;
	padding: clamp(2rem, 6vw, 3.5rem);
}

.icf-ef__success-tick {
	width: 56px;
	height: 56px;
	margin: 0 auto 1.1rem;
	color: var(--icf-ok);
}

.icf-ef__success h2 {
	margin: 0 0 0.6rem;
	font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
	font-size: 1.7rem;
}

.icf-ef__success p {
	margin: 0 auto;
	max-width: 34rem;
	color: var(--icf-muted);
}

.icf-ef__success-more {
	margin-top: 0.9rem !important;
	font-size: 0.9rem;
}

/* -------------------------------------------------------------- Dark theme */

@media (prefers-color-scheme: dark) {
	.icf-ef-wrap {
		--icf-bg: #1a1715;
		--icf-card: #232019;
		--icf-ink: #f0e9df;
		--icf-muted: #a99e8e;
		--icf-accent: #e0705c;
		--icf-accent-soft: #3b2019;
		--icf-line: #3a342c;
		--icf-line-strong: #4d4539;
		--icf-field: #1e1b17;
		--icf-ok: #6fbf8a;
	}

	.icf-ef-wrap .icf-ef__errors {
		background: #2e1a16;
		color: #f4cfc7;
	}

	.icf-ef-wrap .icf-ef__file.is-filled {
		background: #1b2620;
	}

	.icf-ef-wrap .icf-ef__file::file-selector-button {
		background: #2c2822;
		color: var(--icf-ink);
	}

	.icf-ef-wrap .icf-ef__submit {
		color: #23140f;
	}
}

/* ------------------------------------------------------- Forced colours/print */

@media (forced-colors: active) {
	.icf-ef__choice,
	.icf-ef__check,
	.icf-ef__file {
		border: 1px solid CanvasText;
	}

	.icf-ef__choice:has(input:checked),
	.icf-ef__choice.is-checked {
		border: 2px solid Highlight;
	}
}
