/* ==========================================================================
   Newsletter opt-in — v10 "Calm & Vital"
   --------------------------------------------------------------------------
   Behaviour is unchanged (fields, honeypot, time trap, consent, double
   opt-in); only the appearance is new.

   Three contexts, one component:
     default          on sand or a pale plum plate (sidebar widget, modal)
     --on-accent      on the plum signup band — cream on plum
     inside .st-modal the dialog, with a plum aside on wide screens
   ========================================================================== */

.st-optin {
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: 100%;
}

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

/* ── Email ─────────────────────────────────────────────────────────────── */
.st-optin__field {
	display: block;
	width: 100%;
}

.st-optin__input {
	width: 100%;
	min-height: 50px;
	padding: 13px 16px;
	border: 1.5px solid var(--rule);
	border-radius: 2px;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--ff-body);
	font-size: 16px; /* 16px keeps iOS from zooming on focus */
	line-height: 1.3;
	transition: border-color .2s, box-shadow .2s;
	-webkit-appearance: none;
	appearance: none;
}
.st-optin__input::placeholder { color: var(--ink3); }
.st-optin__input:focus {
	outline: none;
	border-color: var(--plum);
	box-shadow: 0 0 0 3px rgba(139, 107, 138, .2);
}

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

.st-optin__checkbox {
	position: absolute;
	top: 1px;
	left: 0;
	width: 20px;
	height: 20px;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.st-optin__consent-text {
	position: relative;
	display: block;
	padding-left: 32px;
	font-size: 12.5px;
	line-height: 1.55;
	color: var(--ink2);
}
.st-optin__consent-text::before {
	content: "";
	position: absolute;
	top: 1px;
	left: 0;
	width: 20px;
	height: 20px;
	border: 1.5px solid var(--ink3);
	border-radius: 2px;
	background: var(--paper);
	transition: background-color .15s, border-color .15s;
}
.st-optin__consent-text::after {
	content: "";
	position: absolute;
	top: 6px;
	left: 7px;
	width: 6px;
	height: 10px;
	border: solid var(--cream);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg) scale(0);
	transition: transform .15s;
}
.st-optin__checkbox:checked + .st-optin__consent-text::before {
	background: var(--plum);
	border-color: var(--plum);
}
.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(--plum);
	outline-offset: 2px;
}

.st-optin__consent-text a {
	color: var(--plum-deep);
	text-decoration: underline;
	text-underline-offset: 2px;
}
.st-optin__consent-text a:hover { color: var(--ink); }

/* ── Submit ────────────────────────────────────────────────────────────── */
.st-optin__submit {
	min-height: 50px;
	padding: 14px 24px;
	border: 1.5px solid var(--plum);
	border-radius: 2px;
	background: var(--plum);
	color: var(--cream);
	font-family: var(--ff-mono);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 2.5px;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color .2s, color .2s, opacity .2s;
}
.st-optin__submit:hover {
	background: var(--plum-deep);
	border-color: var(--plum-deep);
}
.st-optin__submit:focus-visible {
	outline: 2px solid var(--plum);
	outline-offset: 3px;
}
.st-optin__submit:disabled { opacity: .6; cursor: wait; }

/* ── Messages ──────────────────────────────────────────────────────────── */
.st-optin__message {
	font-size: 14px;
	line-height: 1.5;
}
.st-optin__message:empty { display: none; }
.st-optin__message.is-success {
	padding: 12px 14px;
	border-left: 3px solid var(--sage);
	background: rgba(107, 140, 112, .12);
	color: #3F5A43;
}
.st-optin__message.is-error { color: #9A4A36; }

.st-optin__field-error {
	display: block;
	margin-top: 6px;
	font-size: 12.5px;
	color: #9A4A36;
}
.has-error .st-optin__input { border-color: #A0644F; }
.has-error .st-optin__consent-text::before { border-color: #A0644F; }

.st-optin.is-done .st-optin__field,
.st-optin.is-done .st-optin__submit { display: none; }

/* ── Legal footer ──────────────────────────────────────────────────────── */
.st-optin__footer {
	display: flex;
	flex-wrap: wrap;
	gap: 2px 12px;
	padding-top: 12px;
	border-top: 1px solid var(--rule);
	font-family: var(--ff-mono);
	font-size: 10px;
	line-height: 1.6;
	letter-spacing: .5px;
	color: var(--ink3);
}
.st-optin__footer:not(:has(*)) { display: none; }
.st-optin__support { text-decoration: underline; text-underline-offset: 2px; }
.st-optin__support:hover { color: var(--plum-deep); }

/* ── On the plum band ──────────────────────────────────────────────────── */
.st-optin--on-accent .st-optin__input {
	border-color: transparent;
	background: var(--cream);
}
.st-optin--on-accent .st-optin__input:focus {
	border-color: var(--cream);
	box-shadow: 0 0 0 3px rgba(246, 242, 236, .35);
}
.st-optin--on-accent .st-optin__consent-text { color: rgba(246, 242, 236, .86); }
.st-optin--on-accent .st-optin__consent-text::before {
	background: transparent;
	border-color: rgba(246, 242, 236, .8);
}
.st-optin--on-accent .st-optin__checkbox:checked + .st-optin__consent-text::before {
	background: var(--cream);
	border-color: var(--cream);
}
.st-optin--on-accent .st-optin__consent-text::after { border-color: var(--plum-deep); }
.st-optin--on-accent .st-optin__checkbox:focus-visible + .st-optin__consent-text::before { outline-color: var(--cream); }
.st-optin--on-accent .st-optin__consent-text a { color: var(--cream); }
.st-optin--on-accent .st-optin__submit {
	background: var(--ink);
	border-color: var(--ink);
	color: var(--cream);
}
.st-optin--on-accent .st-optin__submit:hover {
	background: transparent;
	border-color: var(--cream);
}
.st-optin--on-accent .st-optin__submit:focus-visible { outline-color: var(--cream); }
.st-optin--on-accent .st-optin__message,
.st-optin--on-accent .st-optin__message.is-error,
.st-optin--on-accent .st-optin__field-error { color: var(--cream); }
.st-optin--on-accent .st-optin__message.is-success {
	background: rgba(246, 242, 236, .14);
	border-left-color: var(--cream);
	color: var(--cream);
}
.st-optin--on-accent .has-error .st-optin__input { border-color: #F3D2C6; }
.st-optin--on-accent .st-optin__footer {
	border-top-color: rgba(246, 242, 236, .25);
	color: rgba(246, 242, 236, .72);
}
.st-optin--on-accent .st-optin__support:hover { color: var(--cream); }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.st-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.st-modal[hidden] { display: none; }

.st-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(28, 24, 20, .5);
	animation: st-fade .25s ease-out;
}

.st-modal__dialog {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 38fr) minmax(0, 62fr);
	width: 100%;
	max-width: 820px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--bg);
	border-radius: 4px;
	box-shadow: 0 30px 80px -30px rgba(28, 24, 20, .55);
	animation: st-rise .3s cubic-bezier(.2, .7, .2, 1);
}

.st-modal__aside {
	position: relative;
	display: flex;
	align-items: flex-end;
	padding: 36px 32px;
	overflow: hidden;
	background: var(--plum);
	color: var(--cream);
}
.st-modal__deco {
	position: absolute;
	top: -0.15em;
	left: 12px;
	font-family: var(--ff-display);
	font-size: 260px;
	font-weight: 600;
	line-height: 1;
	color: var(--cream);
	opacity: .14;
}
.st-modal__quote {
	position: relative;
	font-family: var(--ff-display);
	font-style: italic;
	font-size: 26px;
	font-weight: 300;
	line-height: 1.3;
}

.st-modal__main { padding: 44px 40px 32px; }

.st-modal__close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 2px;
	background: transparent;
	color: var(--ink);
	cursor: pointer;
	transition: background-color .2s;
}
.st-modal__close svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
}
.st-modal__close:hover { background: var(--surface); }
.st-modal__close:focus-visible { outline: 2px solid var(--plum); outline-offset: 2px; }

.st-modal__kicker {
	display: inline-block;
	margin-bottom: 18px;
	padding-left: 10px;
	border-left: 3px solid var(--plum);
	font-family: var(--ff-mono);
	font-size: 11px;
	letter-spacing: 2.5px;
	text-transform: uppercase;
	color: var(--ink3);
}

.st-modal__title {
	margin: 0 0 14px;
	font-family: var(--ff-display);
	font-size: clamp(32px, 4vw, 42px);
	font-weight: 300;
	line-height: 1.08;
	color: var(--ink);
}
.st-modal__title em {
	display: block;
	font-style: italic;
	color: var(--plum);
}

.st-modal__sub {
	margin: 0 0 24px;
	font-size: 15px;
	line-height: 1.6;
	color: var(--ink2);
}

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

@media (max-width: 720px) {
	.st-modal { align-items: flex-end; padding: 0; }

	.st-modal__dialog {
		grid-template-columns: minmax(0, 1fr);
		max-height: calc(100vh - 24px);
		max-height: calc(100dvh - 24px);
		border-radius: 6px 6px 0 0;
		border-top: 3px solid var(--plum);
		animation-name: st-sheet;
	}

	.st-modal__aside { display: none; }

	.st-modal__main { padding: 32px 20px 24px; }
}

@keyframes st-fade {
	from { opacity: 0; }
}
@keyframes st-rise {
	from { opacity: 0; transform: translateY(14px); }
}
@keyframes st-sheet {
	from { transform: translateY(100%); }
}

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