/* ==========================================================================
   Newsletter opt-in — v11 "Sunpop"
   --------------------------------------------------------------------------
   Behaviour is unchanged (fields, honeypot, time trap, consent, double
   opt-in). Only the look is redesigned.

   The email field is a white pill with the coral submit sitting inside its
   right edge, so the whole thing reads as one friendly object. The consent
   box is drawn (a rounded coral square with a white tick) so it matches the
   palette in every browser.

   Contexts set a handful of custom properties rather than overriding rules:
     default         on cream or a white panel (sidebar)
     .cta__panel     on the pink/coral gradient panel — light text
     .st-modal       inside the modal plate
   ========================================================================== */

.st-optin {
	--o-text: var(--ink-2);
	--o-link: var(--coral-deep);
	--o-field: #fff;
	--o-field-line: rgba(232, 67, 28, 0.18);
	--o-box: #fff;
	--o-box-line: rgba(27, 31, 51, 0.25);

	display: flex;
	flex-direction: column;
	gap: 0.9rem;
	width: 100%;
	position: relative;
}

/* ── The joined field ──────────────────────────────────────────────────
   The field carries the pill; the submit is laid over its right end. */
.st-optin__field {
	position: relative;
	margin: 0;
}

.st-optin__field:has(.st-optin__input) {
	display: block;
}

.st-optin__input {
	display: block;
	width: 100%;
	height: 3.6rem;
	padding: 0 9.5rem 0 1.4rem;
	border: 2px solid var(--o-field-line);
	border-radius: 999px;
	background: var(--o-field);
	color: var(--ink);
	font: 500 1rem/1 var(--font-body);
	box-shadow: 0 8px 22px -12px rgba(232, 67, 28, 0.35);
	transition: border-color 160ms ease, box-shadow 160ms ease;
	-webkit-appearance: none;
	appearance: none;
}

.st-optin__input::placeholder {
	color: var(--ink-3);
}

.st-optin__input:focus {
	outline: none;
	border-color: var(--coral);
	box-shadow: 0 0 0 4px rgba(240, 78, 35, 0.18);
}

.st-optin__input:not(:placeholder-shown):invalid {
	border-color: var(--berry);
}

/* The submit sits inside the field, vertically centred on it. The form is
   a column, so the button follows the field in the DOM; it is lifted into
   place with a negative margin rather than absolute positioning, which
   keeps it in the tab order and the flow if the field wraps an error. */
.st-optin__submit {
	align-self: flex-end;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	height: 2.9rem;
	margin: calc(-3.6rem - 0.9rem + 0.35rem) 0.35rem 0 0;
	padding: 0 1.3rem;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--coral) 0%, var(--pink) 100%);
	color: #fff;
	font: 700 0.8rem/1 var(--font-display);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
	position: relative;
	z-index: 1;
	order: 0;
	transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
	box-shadow: 0 8px 18px -8px rgba(232, 67, 28, 0.7);
}

.st-optin__submit-icon {
	width: 1rem;
	height: 1rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.6;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: transform 160ms ease;
}

.st-optin__submit:hover {
	transform: translateY(-1px);
	filter: saturate(1.1) brightness(1.03);
}

.st-optin__submit:hover .st-optin__submit-icon {
	transform: translateX(3px);
}

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

.st-optin__submit:disabled {
	opacity: 0.6;
	cursor: progress;
	transform: none;
}

/* DOM order is field, consent, submit, message. The submit is pulled up
   onto the email field by ordering: field first, submit second, consent
   and message after. */
.st-optin > .st-optin__field:not(.st-optin__consent) { order: -2; }
.st-optin > .st-optin__submit { order: -1; }
.st-optin > .st-optin__consent { order: 1; }
.st-optin > .st-optin__message { order: 2; }

.st-optin.is-loading .st-optin__submit-label::after {
	content: "…";
}

/* ── Consent ────────────────────────────────────────────────────────── */
.st-optin__consent-label {
	display: block;
	position: relative;
	cursor: pointer;
}

.st-optin__checkbox {
	position: absolute;
	top: 0.1rem;
	left: 0;
	width: 1.2rem;
	height: 1.2rem;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.st-optin__consent-text {
	display: block;
	position: relative;
	padding-left: 1.85rem;
	color: var(--o-text);
	font-size: 0.78rem;
	line-height: 1.55;
}

.st-optin__consent-text::before {
	content: "";
	position: absolute;
	top: 0.05rem;
	left: 0;
	width: 1.2rem;
	height: 1.2rem;
	border: 2px solid var(--o-box-line);
	border-radius: 6px;
	background: var(--o-box);
	transition: background 140ms ease, border-color 140ms ease;
}

.st-optin__consent-text::after {
	content: "";
	position: absolute;
	top: 0.28rem;
	left: 0.42rem;
	width: 0.34rem;
	height: 0.62rem;
	border: solid #fff;
	border-width: 0 2.5px 2.5px 0;
	transform: rotate(45deg) scale(0);
	transition: transform 140ms ease;
}

.st-optin__checkbox:checked + .st-optin__consent-text::before {
	background: var(--coral);
	border-color: var(--coral);
}

.st-optin__checkbox:checked + .st-optin__consent-text::after {
	transform: rotate(45deg) scale(1);
}

.st-optin__checkbox:focus-visible + .st-optin__consent-text::before {
	outline: 3px solid var(--coral);
	outline-offset: 2px;
}

.st-optin__consent-text a {
	color: var(--o-link);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.st-optin__consent-text a:hover {
	text-decoration-thickness: 2px;
}

/* ── Field errors and the status message ───────────────────────────── */
.st-optin__field.has-error .st-optin__input {
	border-color: var(--berry);
}

.st-optin__field.has-error .st-optin__consent-text::before {
	border-color: var(--berry);
}

.st-optin__field-error {
	display: block;
	margin-top: 0.4rem;
	padding-left: 1.4rem;
	color: var(--berry);
	font-size: 0.78rem;
	font-weight: 600;
}

.st-optin__consent .st-optin__field-error {
	padding-left: 1.85rem;
}

/* The email field's error hangs under the pill, and the field reserves room
   for it, so the submit (pulled up onto the pill) stays on the pill. */
.st-optin__field:has(.st-optin__input) .st-optin__field-error {
	position: absolute;
	top: calc(100% + 0.1rem);
	left: 0;
	margin: 0;
}

.st-optin__field.has-error:has(.st-optin__input) {
	margin-bottom: 1.4rem;
}

@media (min-width: 421px) {
	.st-optin:has(.st-optin__field.has-error .st-optin__input) .st-optin__submit {
		margin-top: calc(-3.6rem - 0.9rem - 1.4rem + 0.35rem);
	}
}

.st-optin__message {
	margin: 0;
	padding: 0.75rem 1rem;
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.7);
	color: var(--ink-2);
	font-size: 0.85rem;
	font-weight: 500;
	line-height: 1.5;
}

.st-optin__message:empty {
	display: none;
}

.st-optin__message.is-success {
	background: #E4F6EF;
	color: #0B6B5F;
}

.st-optin__message.is-error {
	background: #FFE4EA;
	color: #A3264C;
}

/* The honeypot: present and fillable, but off-screen. Not display:none —
   some bots skip those. */
.st-optin__hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ── Narrow: the button drops under the field ──────────────────────── */
@media (max-width: 420px) {
	.st-optin__input {
		padding-right: 1.4rem;
	}

	.st-optin__submit {
		align-self: stretch;
		margin: 0;
		height: 3.2rem;
	}
}

/* ── On the gradient CTA panel ─────────────────────────────────────── */
.cta__panel .st-optin {
	--o-text: rgba(255, 255, 255, 0.92);
	--o-link: #fff;
	--o-field-line: rgba(255, 255, 255, 0.6);
	--o-box: rgba(255, 255, 255, 0.2);
	--o-box-line: rgba(255, 255, 255, 0.75);
}

.cta__panel .st-optin__submit {
	background: var(--ink);
	box-shadow: 0 8px 18px -8px rgba(27, 31, 51, 0.6);
}

.cta__panel .st-optin__checkbox:checked + .st-optin__consent-text::before {
	background: #fff;
	border-color: #fff;
}

.cta__panel .st-optin__checkbox:checked + .st-optin__consent-text::after {
	border-color: var(--coral);
}

.cta__panel .st-optin__field-error {
	color: #fff;
}

.cta__panel .st-optin__checkbox:focus-visible + .st-optin__consent-text::before {
	outline-color: #fff;
}

/* ── The modal ─────────────────────────────────────────────────────── */
.st-modal {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: grid;
	place-items: center;
	padding: 1rem;
}

.st-modal[hidden] {
	display: none;
}

.st-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(40, 20, 20, 0.45);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.st-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 32rem;
	max-height: calc(100vh - 2rem);
	overflow-y: auto;
	padding: 2.6rem 2.2rem 2.2rem;
	border-radius: 32px;
	background:
		radial-gradient(circle at 100% 0%, rgba(255, 107, 154, 0.35) 0, transparent 45%),
		radial-gradient(circle at 0% 100%, rgba(255, 178, 63, 0.35) 0, transparent 45%),
		var(--cream);
	box-shadow: 0 40px 80px -30px rgba(120, 40, 20, 0.5);
	animation: st-modal-rise 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes st-modal-rise {
	from { opacity: 0; transform: translateY(18px) scale(0.98); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.st-modal__dialog { animation: none; }
}

.st-modal__sun {
	position: absolute;
	top: 1.2rem;
	right: 4.2rem;
	width: 2.6rem;
	height: 2.6rem;
	color: var(--sun);
}

.st-modal__spark {
	position: absolute;
	bottom: 1.4rem;
	right: 1.6rem;
	width: 1.4rem;
	height: 1.4rem;
	color: var(--pink);
}

.st-modal__close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	display: grid;
	place-items: center;
	width: 2.4rem;
	height: 2.4rem;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--ink);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 12px -4px rgba(27, 31, 51, 0.25);
	transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.st-modal__close:hover,
.st-modal__close:focus-visible {
	background: var(--coral);
	color: #fff;
	transform: rotate(90deg);
	outline: none;
}

.st-modal__kicker {
	display: inline-block;
	margin: 0 0 1rem;
	padding: 0.4rem 0.9rem;
	border: 1.5px solid rgba(217, 58, 116, 0.35);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.6);
	color: var(--pink-deep);
	font: 700 0.7rem/1 var(--font-display);
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.st-modal__title {
	margin: 0 0 0.9rem;
	color: var(--ink);
	font: 900 clamp(1.9rem, 6vw, 2.6rem)/0.95 var(--font-display);
	letter-spacing: -0.02em;
	text-transform: uppercase;
}

.st-modal__hot {
	color: var(--coral);
}

.st-modal__script {
	display: block;
	margin-top: 0.2rem;
	color: var(--pink);
	font: 400 clamp(1.7rem, 5vw, 2.2rem)/1 var(--font-script);
	text-transform: none;
	letter-spacing: 0;
}

.st-modal__sub {
	margin: 0 0 1.5rem;
	color: var(--ink-2);
	font-size: 0.95rem;
	line-height: 1.6;
}

body.st-modal-open {
	overflow: hidden;
}
