/* ==========================================================================
   Newsletter opt-in — v11 "Cream & Elements"
   --------------------------------------------------------------------------
   Behaviour unchanged: same fields, honeypot, time trap, consent checkbox and
   double opt-in. Appearance follows the reference: a cream pill field, a
   drawn checkbox and an ink pill button that warms to terracotta on hover.
   Two grounds: cream (modal, sidebar) by default, and the terracotta
   Star Letter panel on the landing page (.news).
   ========================================================================== */

.st-optin {
	display: flex;
	flex-direction: column;
	gap: .9rem;
	width: 100%;
	text-align: left;
}

.st-optin__field { display: block; width: 100%; }

.st-optin__input {
	width: 100%;
	padding: 15px 22px;
	border: 2px solid var(--line);
	border-radius: var(--r-pill);
	background: var(--paper);
	color: var(--ink);
	font-family: var(--sans);
	font-size: 1rem;
	line-height: 1.4;
	transition: border-color var(--speed), box-shadow var(--speed);
}

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

.st-optin__input:focus {
	outline: none;
	border-color: var(--terra);
	box-shadow: 0 0 0 4px rgba(196, 98, 61, .15);
}

.st-optin__input:-webkit-autofill {
	-webkit-text-fill-color: var(--ink);
	-webkit-box-shadow: 0 0 0 40px var(--paper) inset;
	caret-color: var(--ink);
}

.st-optin__input:not(:placeholder-shown):invalid,
.has-error .st-optin__input { border-color: var(--err); }

.st-optin__field-error {
	display: block;
	margin-top: .4rem;
	padding-left: 1.2rem;
	color: var(--err);
	font-size: .8rem;
	font-weight: 500;
}

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

/* ── Consent ─────────────────────────────────────────────────────────── */
.st-optin__consent-label { position: relative; display: flex; align-items: flex-start; gap: .6rem; cursor: pointer; }

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

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

.st-optin__consent-text::before {
	content: "";
	position: absolute;
	left: 0;
	top: .05rem;
	width: 1.2rem;
	height: 1.2rem;
	border: 2px solid var(--sand-2);
	border-radius: 6px;
	background: var(--paper);
	transition: background var(--speed), border-color var(--speed);
}

.st-optin__consent-text::after {
	content: "";
	position: absolute;
	left: .44rem;
	top: .27rem;
	width: .32rem;
	height: .6rem;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg) scale(0);
	transition: transform 160ms var(--ease);
}

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

.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: 2px solid var(--terra); outline-offset: 2px; }

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

.st-optin__consent-text a { color: var(--terra-d); text-decoration: underline; text-underline-offset: 2px; }

/* ── Submit ──────────────────────────────────────────────────────────── */
.st-optin__submit {
	align-self: stretch;
	padding: 15px 28px;
	border: 2px solid var(--ink);
	border-radius: var(--r-pill);
	background: var(--ink);
	color: var(--cream);
	font-family: var(--sans);
	font-size: .98rem;
	font-weight: 500;
	cursor: pointer;
	transition: background var(--speed), border-color var(--speed), transform var(--speed) var(--ease), opacity var(--speed);
}

.st-optin__submit::after { content: " →"; }

.st-optin__submit:hover,
.st-optin__submit:focus-visible { background: var(--terra); border-color: var(--terra); transform: translateY(-2px); }

.st-optin__submit:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.is-loading .st-optin__submit { opacity: .7; }

/* ── Status line ─────────────────────────────────────────────────────── */
.st-optin__message {
	margin: 0;
	padding: .8rem 1rem;
	border-radius: 14px;
	background: var(--sand);
	color: var(--ink);
	font-size: .88rem;
	line-height: 1.5;
}

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

.st-optin__message.is-success { background: #e3ead2; color: var(--ok); }

.st-optin__message.is-error { background: #f6ddd3; color: var(--err); }

/* ── Compliance footer ───────────────────────────────────────────────── */
.st-optin__footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .25rem .6rem;
	color: var(--faint);
	font-size: .72rem;
	line-height: 1.5;
}

.st-optin__company { font-weight: 700; color: var(--muted); }

.st-optin__support { color: inherit; }

.st-optin__support:hover { color: var(--terra); }

.st-optin__hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ── On the terracotta Star Letter panel ─────────────────────────────── */
.news .st-optin__input { border-color: transparent; background: var(--cream); }

.news .st-optin__input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(43, 35, 29, .15); }

.news .st-optin__consent-text,
.news .st-optin__footer,
.news .st-optin__company { color: rgba(247, 240, 228, .9); }

.news .st-optin__consent-text a { color: var(--cream); }

.news .st-optin__consent-text::before { border-color: rgba(247, 240, 228, .7); background: transparent; }

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

.news .st-optin__checkbox:focus-visible + .st-optin__consent-text::before { outline-color: var(--cream); }

.news .st-optin__submit:hover,
.news .st-optin__submit:focus-visible { background: var(--olive); border-color: var(--olive); }

.news .st-optin__field-error { color: var(--cream); }

.news .has-error .st-optin__input { border-color: var(--ink); }

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

.news .st-optin__support:hover { color: var(--cream); }

/* ── The modal ───────────────────────────────────────────────────────── */
.st-modal {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: grid;
	place-items: center;
	padding: 16px;
	overflow-y: auto;
}

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

.st-modal__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(43, 35, 29, .55);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
}

.st-modal__dialog {
	position: relative;
	width: min(31rem, 100%);
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: clamp(1.75rem, 5vw, 2.75rem);
	border-radius: var(--r-lg);
	background: var(--cream);
	box-shadow: 0 40px 100px -30px rgba(43, 35, 29, .6);
	text-align: center;
	animation: st-modal-rise 320ms var(--ease) both;
}

.st-modal__dialog::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 8px;
	background: linear-gradient(90deg, var(--fire) 0 25%, var(--earth) 25% 50%, var(--air) 50% 75%, var(--water) 75%);
}

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

.st-modal__close {
	position: absolute;
	top: 1.1rem;
	right: 1.1rem;
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border-radius: 50%;
	background: var(--sand);
	color: var(--ink);
	font-size: 1.5rem;
	line-height: 1;
	transition: background var(--speed), color var(--speed);
}

.st-modal__close:hover,
.st-modal__close:focus-visible { background: var(--ink); color: var(--cream); }

.st-modal__glyph {
	display: inline-grid;
	place-items: center;
	width: 3.6rem;
	height: 3.6rem;
	margin: .4rem 0 1rem;
	border-radius: 50%;
	background: var(--terra);
	color: #fff;
	font-size: 1.3rem;
}

.st-modal__kicker {
	margin: 0 0 .5rem;
	color: var(--terra);
	font-size: .72rem;
	font-weight: 700;
	letter-spacing: .2em;
	text-transform: uppercase;
}

.st-modal__title {
	max-width: 16ch;
	margin: 0 auto;
	font-size: clamp(2rem, 6vw, 2.7rem);
}

.st-modal__title em { color: var(--terra); font-weight: 400; }

.st-modal__sub {
	max-width: 26rem;
	margin: .85rem auto 1.6rem;
	color: var(--muted);
	font-size: .98rem;
	line-height: 1.6;
}

/* Sidebar panel heading emphasis */
.panel__heading em { color: var(--terra); font-weight: 400; }
