/* Leology theme · design system 1.2.0 · the early-access form (D-071): template-parts/early-access-form.php.
   Loaded on the homepage, /arena/ and /learn/ (inc/ds.php: leology_ds_landing_assets()). Class selectors only, prefix
   .leo-ea, in layer `ds` (wins over style.css, which is in `legacy`). Every value is a token.

   Two tones, chosen by the page that places the form:
   - light (white / paper): ink text, the design's input (white, 52 px, a 2 px line-strong frame, square corners; focus
     an Ultramarine frame + the 3 px Sun ring, as the account screens), Danger for errors;
   - dark (Ultramarine field): white text, white inputs, Sun for focus, the chosen chip, the checked box and errors
     (Danger red does not reach AA on Ultramarine; an error is never colour alone: icon + text + aria).
   One Sun primary (the submit). Nothing moves; colour transitions only when motion is welcome. */

@layer ds {
	.leo-ea {
		--ea-fg: var(--ds-color-ink);
		--ea-muted: var(--ds-color-ink-3);
		--ea-frame: var(--ds-color-line-strong);
		--ea-frame-hover: var(--ds-color-ultramarine);
		--ea-focus: var(--ds-focus-on-light);
		--ea-error: var(--ds-color-danger);
		--ea-link: var(--ds-color-ultramarine);
		--ea-chip-bg: var(--ds-color-paper);
		--ea-chip-fg: var(--ds-color-ultramarine);
		--ea-on-bg: var(--ds-color-ultramarine);
		--ea-on-fg: var(--ds-color-paper);
		--ea-done-bg: var(--ds-color-grey);
		position: relative;
		max-width: 760px;
		color: var(--ea-fg);
		font: var(--ds-type-text-body-weight) var(--ds-type-text-body-size) / var(--ds-type-text-body-leading) var(--ds-font-family-text);
		text-align: left;
	}

	.leo-ea--dark {
		--ea-fg: var(--ds-color-paper);
		--ea-muted: var(--ds-color-on-dark-muted);
		--ea-frame: var(--ds-color-on-dark-frame);
		--ea-frame-hover: var(--ds-color-paper);
		--ea-focus: var(--ds-focus-on-dark);
		--ea-error: var(--ds-color-sun);
		--ea-link: var(--ds-color-paper);
		--ea-chip-bg: transparent;
		--ea-chip-fg: var(--ds-color-paper);
		--ea-on-bg: var(--ds-color-sun);
		--ea-on-fg: var(--ds-color-ink);
		--ea-done-bg: var(--ds-color-ultramarine-deep);
	}

	.leo-ea :focus-visible { outline: var(--ds-focus-width) solid var(--ea-focus); outline-offset: var(--ds-focus-offset); }
	/* Focus moved by the script (the first refused field, the confirmation) lands below the sticky bar, not under it. */
	.leo-ea__input, .leo-ea__box, .leo-ea__chip input, .leo-ea__done { scroll-margin-top: var(--ds-size-scroll-offset); }

	.leo-ea__form { margin: 0; }

	/* The honeypot: off-screen, out of the tab order, hidden from assistive technology. */
	.leo-ea__trap { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

	/* ---- Name + email --------------------------------------------------------------------------------- */
	.leo-ea__grid { display: grid; gap: var(--ds-space-5); margin: 0 0 var(--ds-space-6); }
	@media (min-width: 640px) { .leo-ea__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

	.leo-ea__field { min-width: 0; }
	.leo-ea__label {
		display: block; margin: 0 0 var(--ds-space-2); padding: 0; color: var(--ea-fg);
		font: var(--ds-font-weight-bold) 15px/1.4 var(--ds-font-family-text);
	}
	.leo-ea__optional { margin-left: var(--ds-space-1); color: var(--ea-muted); font-weight: var(--ds-font-weight-medium); font-size: var(--ds-type-text-meta-size); }

	.leo-ea__input {
		box-sizing: border-box; display: block; width: 100%; min-height: var(--ds-size-button); margin: 0; padding: var(--ds-space-3) var(--ds-space-4);
		border: var(--ds-border-base) solid var(--ea-frame); border-radius: var(--ds-radius-none); background: var(--ds-color-paper); box-shadow: none;
		color: var(--ds-color-ink); font: var(--ds-font-weight-regular) 17px/1.4 var(--ds-font-family-text);
	}
	.leo-ea__input:hover { border-color: var(--ea-frame-hover); }
	.leo-ea__input:focus { outline: none; border-color: var(--ds-color-ultramarine); box-shadow: var(--ds-ring-input-focus); }
	.leo-ea--dark .leo-ea__input:focus { border-color: var(--ds-color-sun); }
	.leo-ea__field.is-invalid .leo-ea__input { border-color: var(--ea-error); }

	/* ---- Interest: three chips; the radio fills its chip, so the whole chip is the target -------------- */
	.leo-ea__choice { min-width: 0; margin: 0 0 var(--ds-space-6); padding: 0; border: 0; }
	.leo-ea__choice > legend { float: none; width: auto; padding: 0; }
	.leo-ea__chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ds-space-2); }
	.leo-ea__chip { position: relative; display: block; margin: 0; cursor: pointer; }
	.leo-ea__chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
	.leo-ea__chip span {
		display: flex; align-items: center; justify-content: center; min-height: 48px; padding: var(--ds-space-2) var(--ds-space-2); text-align: center;
		border: var(--ds-border-thin) solid var(--ea-frame); border-radius: var(--ds-radius-none); background: var(--ea-chip-bg); color: var(--ea-chip-fg);
		font: var(--ds-font-weight-bold) 16px/1.2 var(--ds-font-family-text);
	}
	.leo-ea--light .leo-ea__chip:hover span { background: var(--ds-color-sun); border-color: var(--ds-color-sun); color: var(--ds-color-ink); }
	.leo-ea--dark .leo-ea__chip:hover span { border-color: var(--ds-color-paper); }
	.leo-ea__chip input:checked + span { background: var(--ea-on-bg); border-color: var(--ea-on-bg); color: var(--ea-on-fg); }
	.leo-ea__chip input:focus-visible + span { outline: var(--ds-focus-width) solid var(--ea-focus); outline-offset: var(--ds-focus-offset); }

	/* ---- Consent + news: a square box and its sentence ------------------------------------------------- */
	.leo-ea__check { display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: var(--ds-space-3); align-items: start; margin: 0 0 var(--ds-space-4); }
	.leo-ea__box {
		appearance: none; -webkit-appearance: none; box-sizing: border-box; display: block; width: 24px; height: 24px; margin: 1px 0 0; padding: 0;
		border: var(--ds-border-base) solid var(--ea-frame); border-radius: var(--ds-radius-none); background: var(--ds-color-paper) center / 16px 16px no-repeat; cursor: pointer;
	}
	.leo-ea__box:hover { border-color: var(--ea-frame-hover); }
	.leo-ea__box:checked {
		border-color: var(--ea-on-bg); background-color: var(--ea-on-bg);
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3.2' stroke-linecap='square'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
	}
	.leo-ea--dark .leo-ea__box:checked {
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B0E2E' stroke-width='3.2' stroke-linecap='square'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
	}
	.leo-ea__check.is-invalid .leo-ea__box { border-color: var(--ea-error); }
	.leo-ea__checklabel { color: var(--ea-fg); font: var(--ds-font-weight-regular) var(--ds-type-text-small-size) / var(--ds-type-text-small-leading) var(--ds-font-family-text); cursor: pointer; }
	.leo-ea__checklabel a { color: var(--ea-link); font-weight: var(--ds-font-weight-semibold); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
	.leo-ea__checklabel a:hover { color: var(--ea-fg); text-decoration-thickness: 2.5px; }
	.leo-ea__check .leo-ea__error { grid-column: 2; }

	/* ---- Errors: an icon, the words, the control's frame ----------------------------------------------- */
	.leo-ea__error {
		display: flex; align-items: flex-start; gap: var(--ds-space-2); margin: var(--ds-space-2) 0 0; color: var(--ea-error);
		font: var(--ds-font-weight-semibold) 14px/1.5 var(--ds-font-family-text);
	}
	.leo-ea__error::before {
		content: "!" / ""; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-top: 1px;
		background: var(--ea-error); color: var(--ds-color-paper); font: var(--ds-font-weight-extrabold) 13px/1 var(--ds-font-family-text);
	}
	.leo-ea--dark .leo-ea__error::before { color: var(--ds-color-ink); }

	/* ---- Submit + the honest note ---------------------------------------------------------------------- */
	.leo-ea__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-4) var(--ds-space-6); margin-top: var(--ds-space-6); }
	.leo-ea .leo-ea__submit { display: inline-flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; }
	.leo-ea .leo-ea__submit[aria-disabled="true"] { cursor: progress; opacity: .72; }
	.leo-ea--dark .leo-ea__submit:hover, .leo-ea--dark .leo-ea__submit:focus-visible { background: var(--ds-color-paper); color: var(--ds-color-ink); border-color: var(--ds-color-paper); }
	.leo-ea__note { flex: 1 1 16rem; margin: 0; color: var(--ea-muted); font: var(--ds-font-weight-regular) var(--ds-type-text-meta-size-lg) / var(--ds-type-text-meta-leading) var(--ds-font-family-text); }
	@media (max-width: 599.98px) {
		.leo-ea__actions { flex-direction: column; align-items: stretch; }
		.leo-ea .leo-ea__submit { width: 100%; }
		.leo-ea__note { flex: none; }
	}

	/* ---- Status (sending, a refusal) and the confirmation --------------------------------------------- */
	.leo-ea__status { margin: var(--ds-space-5) 0 0; padding: var(--ds-space-1) 0 var(--ds-space-1) var(--ds-space-3); border-left: 4px solid var(--ea-frame); color: var(--ea-fg); font: var(--ds-font-weight-semibold) 15px/1.5 var(--ds-font-family-text); }
	.leo-ea__status.is-error { border-left-color: var(--ea-error); }

	.leo-ea__done { padding: var(--ds-space-6); border-left: 6px solid var(--ds-color-sun); background: var(--ea-done-bg); color: var(--ea-fg); }
	.leo-ea__done-title {
		margin: 0 0 var(--ds-space-2); color: inherit; text-transform: uppercase;
		font-family: var(--ds-font-family-display); font-stretch: var(--ds-font-stretch-display); font-weight: var(--ds-font-weight-extrabold);
		font-size: clamp(26px, 2.6vw, 34px); line-height: 1.02;
	}
	.leo-ea__done-title:lang(vi) { line-height: 1.14; }
	.leo-ea__done-body { margin: 0; max-width: 40rem; font: var(--ds-font-weight-medium) var(--ds-type-text-body-lg-size) / var(--ds-type-text-body-lg-leading) var(--ds-font-family-text); }

	@media (prefers-reduced-motion: no-preference) {
		.leo-ea__input, .leo-ea__box, .leo-ea__chip span { transition: border-color var(--ds-motion-duration-state) var(--ds-motion-ease-press), background-color var(--ds-motion-duration-state) var(--ds-motion-ease-press), color var(--ds-motion-duration-state) var(--ds-motion-ease-press), box-shadow var(--ds-motion-duration-state) var(--ds-motion-ease-press); }
	}

	/* ---- A signed-in member (User Journey & Access Control, 15/11/2026): the account's verified identity, read-only,
	   in place of the name + email inputs; a status line; and the state box (verify, waiting, reviewed, ended, paused),
	   which reuses the confirmation's box. Nothing new to look at: the form's own label, text and frame values. ---- */
	.leo-ea__statusline { margin: 0 0 var(--ds-space-5); padding: var(--ds-space-1) 0 var(--ds-space-1) var(--ds-space-3); border-left: 4px solid var(--ds-color-sun); color: var(--ea-fg); font: var(--ds-font-weight-semibold) 15px/1.5 var(--ds-font-family-text); }
	.leo-ea__who { margin: 0 0 var(--ds-space-6); padding: var(--ds-space-4) var(--ds-space-5); border: var(--ds-border-thin) solid var(--ea-frame); }
	.leo-ea__who > p { margin: 0; }
	.leo-ea__who-name { color: var(--ea-fg); font: var(--ds-font-weight-bold) 18px/1.4 var(--ds-font-family-text); overflow-wrap: anywhere; }
	.leo-ea__who-email { color: var(--ea-fg); font: var(--ds-font-weight-regular) 16px/1.5 var(--ds-font-family-text); overflow-wrap: anywhere; }
	.leo-ea__who-tag { display: inline-block; margin-left: var(--ds-space-1); color: var(--ea-muted); font: var(--ds-font-weight-medium) var(--ds-type-text-meta-size) / 1.4 var(--ds-font-family-text); }
	.leo-ea__state-actions { margin: var(--ds-space-5) 0 0; }
	.leo-ea__state-note { margin-top: var(--ds-space-4); }
	.leo-ea--dark .leo-ea__verify:hover, .leo-ea--dark .leo-ea__verify:focus-visible { background: var(--ds-color-paper); color: var(--ds-color-ink); border-color: var(--ds-color-paper); }

	/* `hidden` must win over every display rule above (they set display on the same elements). */
	.leo-ea [hidden] { display: none; }
}
