/**
 * Animation Addons — trial signup page.
 *
 * Everything is scoped under .aae-trial-body / .aae-trial because the template
 * draws the whole document and no theme stylesheet is loaded to reset against.
 */

/* On the body rather than :root, so these short names never leak into
   whatever plugin CSS wp_head() still brings along. */
.aae-trial-body {
	--peach: #f6d8ba;
	--paper: #fff8f1;
	--ink: #1c1612;
	--ink-soft: #2a221c;
	--text: #1c1612;
	--muted: #6b5e55;
	--muted-dark: #b9aca2;
	--line: rgba(28, 22, 18, 0.10);
	--line-dark: rgba(255, 248, 241, 0.12);
	--orange: #ff6b35;
	--pink: #ff3f7f;
	--error: #c2331f;
	--grad: linear-gradient(100deg, var(--orange), var(--pink));
	--serif: "Fraunces", Georgia, "Times New Roman", serif;
	--sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	/* Fast off the mark, long soft landing. Used by all the entrance motion. */
	--ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.aae-trial-body {
	margin: 0;
	/* Explicit, because the page inherits nothing it can trust: wp_head() used
	   to hand it the theme's global styles, which set body copy to weight 300. */
	font-family: var(--sans);
	font-weight: 400;
	color: var(--text);
	background: var(--peach);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

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

/* :where() keeps this reset at element weight, so .aae-sub, .aae-alt and the
   rest can still set their own margins. */
:where(.aae-trial) :is(h1, h2, h3, p) {
	margin: 0;
}

.aae-trial [hidden] {
	display: none !important;
}

.aae-trial {
	min-height: 100vh;
	display: grid;
	/* minmax(0, …) so the track is always the viewport, never the card's
	   content width — otherwise width: 100% below has nothing to cap it. */
	grid-template-columns: minmax(0, 1fr);
	place-items: center;
	padding: 80px 24px;
}

.aae-trial__card {
	width: min(1120px, 100%);
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
	background: var(--paper);
	border-radius: 28px;
	overflow: hidden;
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 40px 90px -30px rgba(92, 52, 20, 0.35);
}

/* ---------- left: offer + form ---------- */

.aae-panel--form {
	padding: 64px 64px 56px;
}

.aae-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 56px;
}

.aae-mark {
	display: block;
	flex: none;
	width: 36px;
	height: 36px;
	border-radius: 10px;
}

.aae-brand__name {
	font-weight: 600;
	font-size: 15px;
	letter-spacing: -0.01em;
}

.aae-brand__name span {
	color: var(--muted);
	font-weight: 400;
}

.aae-title {
	font-family: var(--serif);
	font-weight: 400;
	font-size: clamp(38px, 4.2vw, 54px);
	line-height: 1.02;
	letter-spacing: -0.025em;
	font-variation-settings: "opsz" 144;
	max-width: 16ch;
}

.aae-title:focus {
	outline: none;
}

.aae-sub {
	margin-top: 20px;
	max-width: 44ch;
	font-size: 17px;
	line-height: 1.6;
	color: var(--muted);
	/* The done step quotes the visitor's address back, which has no spaces. */
	overflow-wrap: break-word;
}

/* Why the visitor bounced back here: a stale link or a failed confirmation. */
.aae-notice {
	margin-top: 28px;
	max-width: 520px;
	padding: 12px 18px;
	border: 1px solid rgba(255, 107, 53, 0.30);
	border-radius: 16px;
	background: rgba(255, 107, 53, 0.08);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
	color: var(--text);
}

.aae-form {
	margin-top: 40px;
	max-width: 520px;
}

.aae-notice + .aae-form {
	margin-top: 20px;
}

/* Visually hidden, still read out for the input. */
.aae-label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.aae-field {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px;
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 999px;
	transition: border-color 0.2s, box-shadow 0.2s;
}

/* Error ring. A conic gradient masked down to a 2px ring over the border:
   faint red all round, with a brighter streak that trial.js sets running
   (.is-invalid) while an error is showing. Without @property support the
   streak simply stands still. */
@property --aae-angle {
	syntax: "<angle>";
	inherits: false;
	initial-value: 0deg;
}

.aae-field::before {
	content: "";
	position: absolute;
	inset: -1px;
	padding: 2px;
	border-radius: inherit;
	background: conic-gradient(
		from var(--aae-angle),
		rgba(194, 51, 31, 0.22) 0turn,
		rgba(194, 51, 31, 0.22) 0.55turn,
		rgba(255, 107, 53, 0.9) 0.8turn,
		var(--error) 0.9turn,
		rgba(194, 51, 31, 0.22) 1turn
	);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
	opacity: 0;
	transition: opacity 0.3s;
	pointer-events: none;
}

.aae-field.is-invalid::before {
	opacity: 1;
}

.aae-field.is-invalid:focus-within {
	box-shadow: 0 0 0 4px rgba(194, 51, 31, 0.12);
}

.aae-field:focus-within {
	border-color: rgba(255, 107, 53, 0.55);
	box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.12);
}

.aae-form:has(.aae-error:not([hidden])) .aae-field {
	border-color: rgba(194, 51, 31, 0.45);
}

/* Signed in: the field is filled in and shut, so the row reads as a statement
   of who you are rather than as an input waiting for you. */
.aae-field.is-locked {
	background: rgba(255, 255, 255, 0.55);
}

.aae-field.is-locked .aae-input {
	color: var(--muted);
}

.aae-input {
	flex: 1;
	min-width: 0;
	/* Ignored for layout (flex wins), but it drops the input's built-in
	   ~20-character width from the field's minimum, so the row can shrink. */
	width: 100%;
	height: 50px;
	border: 0;
	outline: 0;
	background: transparent;
	padding: 0 18px;
	font: 400 16px var(--sans);
	color: var(--text);
}

.aae-input::placeholder {
	color: #a3968c;
	opacity: 1;
}

.aae-input[disabled] {
	cursor: default;
}

.aae-btn--primary {
	position: relative;
	height: 50px;
	padding: 0 26px;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	background: var(--grad);
	color: #fff;
	font: 600 15px var(--sans);
	white-space: nowrap;
	overflow: hidden;
	transition: filter 0.2s, transform 0.2s, opacity 0.2s;
}

.aae-btn--primary:hover {
	filter: brightness(1.05);
}

.aae-btn--primary:active {
	transform: scale(0.98);
}

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

.aae-btn--primary:disabled {
	cursor: default;
	opacity: 0.55;
}

/* The label and the spinner swap places, so the button never changes width
   mid-submit and the layout does not jump. trial.js adds .is-busy. */
.aae-spinner {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	opacity: 0;
	animation: aae-spin 0.7s linear infinite;
}

.aae-btn--primary.is-busy {
	opacity: 1;
}

/* Label roll. trial.js splits the label into one span per character; each
   carries its own copy one line below (the text-shadow), and the row is
   clipped to a single line. On hover the characters lift, one after another,
   and the copies roll up into place. The plain text is kept once in .aae-sr
   for screen readers. */
.aae-btn__label {
	display: inline-block;
	vertical-align: middle;
}

.aae-roll {
	display: block;
	height: 1.4em;
	line-height: 1.4em;
	overflow: hidden;
	white-space: nowrap;
}

.aae-roll__char {
	display: inline-block;
	text-shadow: 0 1.4em currentColor;
}

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

.aae-btn--primary.is-busy .aae-btn__label {
	visibility: hidden;
}

.aae-btn--primary.is-busy .aae-spinner {
	opacity: 1;
}

@keyframes aae-spin {
	to {
		transform: rotate(360deg);
	}
}

.aae-error {
	margin-top: 12px;
	padding-left: 20px;
	font-size: 14px;
	font-weight: 500;
	color: var(--error);
}

.aae-note {
	margin-top: 14px;
	padding-left: 20px;
	font-size: 13px;
	color: var(--muted);
}

/* Off-screen instead of hidden: a bot that skips display:none still fills it. */
.aae-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.aae-checks {
	list-style: none;
	margin: 36px 0 0;
	padding: 28px 0 0;
	border-top: 1px solid var(--line);
	display: flex;
	flex-wrap: wrap;
	gap: 12px 28px;
	font-size: 14px;
	font-weight: 500;
}

.aae-checks li {
	display: flex;
	align-items: center;
	gap: 8px;
}

.aae-checks svg {
	flex: none;
	color: var(--orange);
}

.aae-alt {
	margin-top: 28px;
	font-size: 14px;
	color: var(--muted);
}

.aae-alt strong {
	color: var(--text);
	font-weight: 600;
	/* A long address has no spaces to break on. */
	overflow-wrap: anywhere;
}

.aae-fine {
	margin-top: 8px;
	font-size: 13px;
	color: var(--muted);
}

.aae-link {
	font: inherit;
	color: var(--text);
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	background: none;
	border: 0;
	padding: 0;
	border-bottom: 1px solid currentColor;
}

.aae-link--quiet {
	font-weight: 500;
	color: var(--muted);
}

.aae-link:focus-visible {
	outline: 2px solid var(--orange);
	outline-offset: 3px;
	border-radius: 2px;
}

/* Swap the "Log in" / "Create" line with the current mode. */
.aae-trial[data-current="login"] .aae-alt--signup,
.aae-trial:not([data-current="login"]) .aae-alt--login {
	display: none;
}

/* Done step */
.aae-check {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	margin-bottom: 28px;
	background: var(--grad);
	color: #fff;
}

.aae-step--done .aae-sub {
	max-width: 40ch;
}

/* ---------- right: how it works ---------- */

.aae-panel--pitch {
	padding: 64px 56px 56px;
	background:
		radial-gradient(120% 70% at 100% 0%, rgba(255, 107, 53, 0.16), transparent 60%),
		var(--ink);
	color: var(--paper);
	display: flex;
	flex-direction: column;
	position: relative;
	isolation: isolate;
	overflow: hidden;
}

/* A second, pinker glow that drifts slowly behind the content. It fades to
   transparent inside its own box, so its edges never show. */
.aae-panel--pitch::before {
	content: "";
	position: absolute;
	z-index: -1;
	top: -25%;
	right: -20%;
	width: 70%;
	aspect-ratio: 1;
	background: radial-gradient(closest-side, rgba(255, 63, 127, 0.13), transparent);
	pointer-events: none;
}

.aae-how {
	font-family: var(--serif);
	font-weight: 400;
	font-size: 30px;
	letter-spacing: -0.02em;
	font-variation-settings: "opsz" 72;
}

.aae-steps {
	list-style: none;
	margin: 40px 0 0;
	padding: 0;
	position: relative;
}

.aae-steps::before {
	content: "";
	position: absolute;
	left: 21px;
	top: 30px;
	bottom: 30px;
	width: 1px;
	background: linear-gradient(var(--line-dark), rgba(255, 107, 53, 0.5), var(--line-dark));
}

.aae-steps li {
	display: grid;
	grid-template-columns: 44px 1fr;
	gap: 20px;
	padding-bottom: 30px;
	position: relative;
}

.aae-steps li:last-child {
	padding-bottom: 0;
}

.aae-num {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: var(--ink-soft);
	border: 1px solid var(--line-dark);
	font: 500 20px/1 var(--serif);
}

.aae-num span {
	background: var(--grad);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.aae-steps h3 {
	font-size: 16px;
	font-weight: 600;
	margin-top: 4px;
	letter-spacing: -0.01em;
}

.aae-steps p {
	margin-top: 6px;
	font-size: 14px;
	line-height: 1.55;
	color: var(--muted-dark);
}

.aae-included {
	margin-top: auto;
	padding-top: 44px;
}

.aae-included h3 {
	font-size: 13px;
	font-weight: 500;
	color: var(--muted-dark);
	margin-bottom: 14px;
}

.aae-included ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	border-top: 1px solid var(--line-dark);
}

.aae-included li {
	padding: 14px 0;
	border-bottom: 1px solid var(--line-dark);
	font-size: 14px;
	font-weight: 500;
}

.aae-included li:nth-child(odd) {
	padding-right: 16px;
	border-right: 1px solid var(--line-dark);
}

.aae-included li:nth-child(even) {
	padding-left: 16px;
}

.aae-included b {
	/* inline-block so trial.js can hold it at its final width while the
	   digits count up, and the label beside it does not shuffle along. */
	display: inline-block;
	font: 500 18px var(--serif);
	font-variant-numeric: tabular-nums;
	margin-right: 6px;
}

/* ---------- narrow ---------- */

@media (max-width: 920px) {
	.aae-trial__card {
		grid-template-columns: minmax(0, 1fr);
	}

	.aae-panel--form {
		padding: 44px 28px 40px;
	}

	.aae-brand {
		margin-bottom: 40px;
	}

	.aae-panel--pitch {
		padding: 44px 28px;
	}
}

@media (max-width: 520px) {
	.aae-trial {
		padding: 24px 12px;
	}

	.aae-field {
		flex-direction: column;
		align-items: stretch;
		border-radius: 20px;
		padding: 8px;
	}

	.aae-input {
		height: 48px;
	}

	.aae-btn--primary {
		border-radius: 14px;
	}

	.aae-note,
	.aae-error {
		padding-left: 4px;
	}

	.aae-included ul {
		grid-template-columns: 1fr;
	}

	.aae-included li:nth-child(odd) {
		border-right: 0;
		padding-right: 0;
	}

	.aae-included li:nth-child(even) {
		padding-left: 0;
	}
}

/* ---------- motion ---------- */

/*
 * Entrance. Nothing is hidden unless the head script has marked <html> with
 * .aae-anim, which it skips for reduced motion and undoes if trial.js never
 * runs. trial.js then adds .aae-in (the card lands) and .is-in to each
 * [data-reveal] block as it comes on screen, with its stagger delay in --d:
 *
 *   up      the block rises out of a soft blur
 *   words   each word of the headline does, one after another
 *   stagger each child does, one after another (--i is the child's index)
 *   wipe    the dark panel opens out from the seam
 */
@media (prefers-reduced-motion: no-preference) {

	.aae-anim .aae-trial__card {
		opacity: 0;
		transform: translateY(32px) scale(0.985);
	}

	.aae-anim.aae-in .aae-trial__card {
		opacity: 1;
		transform: none;
		transition: opacity 0.7s ease, transform 1.2s var(--ease);
	}

	.aae-anim [data-reveal="up"],
	.aae-anim [data-reveal="stagger"] > *,
	.aae-anim [data-reveal="words"] .aae-word {
		opacity: 0;
		transform: translateY(18px);
		filter: blur(6px);
	}

	.aae-anim [data-reveal="words"] .aae-word {
		display: inline-block;
		transform: translateY(0.35em);
		filter: blur(8px);
	}

	.aae-anim [data-reveal="up"].is-in {
		--delay: var(--d, 0ms);
	}

	.aae-anim [data-reveal="stagger"].is-in > * {
		--delay: calc(var(--d, 0ms) + var(--i, 0) * 110ms);
	}

	.aae-anim [data-reveal="words"].is-in .aae-word {
		--delay: calc(var(--d, 0ms) + var(--i, 0) * 55ms);
	}

	.aae-anim [data-reveal="up"].is-in,
	.aae-anim [data-reveal="stagger"].is-in > *,
	.aae-anim [data-reveal="words"].is-in .aae-word {
		opacity: 1;
		transform: none;
		filter: none;
		transition:
			opacity 0.8s ease var(--delay),
			transform 1s var(--ease) var(--delay),
			filter 0.8s ease var(--delay);
	}

	/* The dark panel: a paper-coloured curtain over it pulls back toward the
	   far edge, so the panel opens out of the seam with the form. */
	.aae-anim [data-reveal="wipe"]::after {
		content: "";
		position: absolute;
		inset: 0;
		z-index: 2;
		background: var(--paper);
		transform-origin: right;
		pointer-events: none;
	}

	/* Ease in-out rather than --ease: a long ease-out tail leaves a sliver of
	   curtain crawling along the far edge. */
	.aae-anim [data-reveal="wipe"].is-in::after {
		transform: scaleX(0);
		transition: transform 1s cubic-bezier(0.65, 0, 0.35, 1) var(--d, 0ms);
	}

	/* The line through the step numbers draws itself downward. */
	.aae-anim .aae-steps::before {
		transform: scaleY(0);
		transform-origin: top;
	}

	.aae-anim .aae-steps.is-in::before {
		transform: none;
		transition: transform 1.4s var(--ease) calc(var(--d, 0ms) + 150ms);
	}

	/* Step numbers pop as their row arrives. */
	.aae-anim .aae-steps > li .aae-num {
		transform: scale(0.6);
	}

	.aae-anim .aae-steps.is-in > li .aae-num {
		transform: none;
		transition: transform 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) var(--delay);
	}

	/* Check marks draw in after their item. */
	.aae-anim .aae-checks path {
		stroke-dasharray: 24;
		stroke-dashoffset: 24;
	}

	.aae-anim .aae-checks.is-in path {
		stroke-dashoffset: 0;
		transition: stroke-dashoffset 0.6s var(--ease) calc(var(--delay) + 250ms);
	}

	/* One sheen across the button once the form has landed. */
	.aae-anim .aae-form.is-in .aae-btn--primary:not(:disabled)::after {
		content: "";
		position: absolute;
		inset: 0;
		background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
		transform: translateX(-120%);
		animation: aae-sheen 1.1s var(--ease) calc(var(--d, 0ms) + 900ms) both;
		pointer-events: none;
	}

	/* The pink glow on the dark panel drifts, slowly and forever. */
	.aae-panel--pitch::before {
		animation: aae-drift 16s ease-in-out infinite alternate;
	}

	/* After a submit: the done step rises in, the tick pops and draws. */
	.aae-step--done:not([hidden]) > * {
		animation: aae-rise 0.8s var(--ease) both;
	}

	.aae-step--done:not([hidden]) > :nth-child(2) { animation-delay: 0.1s; }
	.aae-step--done:not([hidden]) > :nth-child(3) { animation-delay: 0.18s; }
	.aae-step--done:not([hidden]) > :nth-child(4) { animation-delay: 0.26s; }

	.aae-step--done:not([hidden]) .aae-check {
		animation: aae-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
	}

	.aae-step--done:not([hidden]) .aae-check path {
		stroke-dasharray: 24;
		animation: aae-draw 0.6s var(--ease) 0.3s both;
	}

	/* Switching between sign-up and log-in, or starting over: trial.js
	   re-adds .aae-swap so the new copy settles in rather than snapping. */
	.aae-swap {
		animation: aae-rise 0.55s var(--ease) both;
	}

	.aae-roll__char {
		transition: transform 0.5s var(--ease) calc(var(--i, 0) * 18ms);
	}

	/* Keyboard focus rolls it too. */
	.aae-btn--primary:not(:disabled):focus-visible .aae-roll__char {
		transform: translateY(-1.4em);
	}

	/* Error: the streak runs round the field, the field shakes once, and the
	   message rises in. trial.js restarts the last two on every new error. */
	.aae-field.is-invalid::before {
		animation: aae-orbit 2.4s linear infinite;
	}

	.aae-field.is-shake {
		animation: aae-shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
	}

	.aae-error.is-shown {
		animation: aae-rise 0.45s var(--ease) both;
	}
}

/* Hover only where there is a real pointer: on touch, :hover sticks after a
   tap and would leave the label rolled. */
@media (prefers-reduced-motion: no-preference) and (hover: hover) {
	.aae-btn--primary:not(:disabled):hover .aae-roll__char {
		transform: translateY(-1.4em);
	}
}

@keyframes aae-orbit {
	to {
		--aae-angle: 360deg;
	}
}

@keyframes aae-shake {
	10%, 90% { transform: translateX(-1px); }
	20%, 80% { transform: translateX(3px); }
	30%, 50%, 70% { transform: translateX(-6px); }
	40%, 60% { transform: translateX(6px); }
}

@media (prefers-reduced-motion: no-preference) and (max-width: 920px) {
	/* Stacked: the dark panel opens downward from the form instead. */
	.aae-anim [data-reveal="wipe"]::after {
		transform-origin: bottom;
	}

	.aae-anim [data-reveal="wipe"].is-in::after {
		transform: scaleY(0);
	}
}

@keyframes aae-sheen {
	to {
		transform: translateX(120%);
	}
}

@keyframes aae-drift {
	to {
		transform: translate(-30%, 25%) scale(1.15);
	}
}

@keyframes aae-rise {
	from {
		opacity: 0;
		transform: translateY(16px);
		filter: blur(6px);
	}
}

@keyframes aae-pop {
	from {
		opacity: 0;
		transform: scale(0.4);
	}
}

@keyframes aae-draw {
	from {
		stroke-dashoffset: 24;
	}

	to {
		stroke-dashoffset: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.aae-trial * {
		transition: none !important;
	}

	.aae-spinner {
		animation-duration: 2s;
	}
}
