/* ==========================================================================
   Newsletter opt-in — v10 "Night Sky"
   --------------------------------------------------------------------------
   Behaviour unchanged: same fields, honeypot, time trap, consent checkbox and
   double opt-in. Only the appearance is redesigned: a dark field with a gold
   focus ring, a drawn gold checkbox and a gold pill button. One look for all
   three contexts — the front-page Star Letter panel, the sidebar and the
   modal — because every one of them now sits on the same night ground.
   ========================================================================== */

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

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

.st-optin__input {
	width: 100%;
	padding: 0.95rem 1.3rem;
	border: 1px solid var(--line);
	border-radius: var(--r-pill);
	background: rgba(0, 0, 0, 0.28);
	color: var(--ink);
	font-family: var(--sans);
	font-size: 1rem;
	font-weight: 300;
	line-height: 1.4;
	transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease), background var(--speed) var(--ease);
}

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

.st-optin__input:focus {
	outline: none;
	border-color: var(--gold);
	background: rgba(0, 0, 0, 0.4);
	box-shadow: 0 0 0 3px rgba(216, 180, 106, 0.18);
}

/* Chrome paints autofilled fields pale yellow; keep them on the night. */
.st-optin__input:-webkit-autofill {
	-webkit-text-fill-color: var(--ink);
	-webkit-box-shadow: 0 0 0 40px #10153A inset;
	caret-color: var(--ink);
}

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

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

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

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

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

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

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

.st-optin__consent-text::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.05rem;
	width: 1.15rem;
	height: 1.15rem;
	border: 1px solid var(--line-strong);
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.28);
	transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}

.st-optin__consent-text::after {
	content: "";
	position: absolute;
	left: 0.41rem;
	top: 0.25rem;
	width: 0.3rem;
	height: 0.55rem;
	border: solid var(--night);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg) scale(0);
	transform-origin: center;
	transition: transform 160ms var(--ease);
}

.st-optin__checkbox:checked + .st-optin__consent-text::before {
	background: linear-gradient(135deg, var(--gold-2), var(--gold));
	border-color: var(--gold);
	box-shadow: 0 0 12px rgba(216, 180, 106, 0.4);
}

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

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

.st-optin__consent-text a {
	color: var(--gold-2);
	text-decoration: underline;
	text-decoration-color: var(--line-strong);
}

.st-optin__consent-text a:hover { text-decoration-color: currentColor; }

/* ── Submit ──────────────────────────────────────────────────────────── */
.st-optin__submit {
	align-self: stretch;
	padding: 1rem 1.8rem;
	border: 1px solid var(--gold);
	border-radius: var(--r-pill);
	background: linear-gradient(135deg, var(--gold-2), var(--gold));
	color: var(--night);
	font-family: var(--sans);
	font-size: 0.8rem;
	font-weight: 500;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	cursor: pointer;
	transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease), opacity var(--speed) var(--ease);
}

.st-optin__submit::before { content: "✦"; margin-right: 0.55rem; font-size: 0.85em; }

.st-optin__submit:hover,
.st-optin__submit:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 10px 36px rgba(216, 180, 106, 0.35);
}

.st-optin__submit:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

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

/* ── Status line ─────────────────────────────────────────────────────── */
.st-optin__message {
	margin: 0;
	padding: 0.75rem 1rem;
	border: 1px solid var(--line-soft);
	border-radius: 14px;
	background: var(--panel);
	color: var(--muted);
	font-size: 0.85rem;
	line-height: 1.5;
}

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

.st-optin__message.is-success {
	border-color: rgba(143, 214, 180, 0.35);
	background: rgba(143, 214, 180, 0.08);
	color: var(--ok);
}

.st-optin__message.is-error {
	border-color: rgba(242, 160, 160, 0.35);
	background: rgba(242, 160, 160, 0.08);
	color: var(--err);
}

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

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

.st-optin__support { color: inherit; text-decoration-color: var(--line-soft); }

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

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

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

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

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

.st-modal__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(5, 7, 20, 0.75);
	-webkit-backdrop-filter: blur(5px);
	backdrop-filter: blur(5px);
}

.st-modal__dialog {
	position: relative;
	width: min(31rem, 100%);
	max-height: calc(100vh - 2 * var(--gutter));
	max-height: calc(100dvh - 2 * var(--gutter));
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: clamp(1.75rem, 5vw, 2.75rem);
	border: 1px solid var(--line);
	border-radius: var(--r-xl);
	background:
		radial-gradient(circle at 50% 0%, rgba(216, 180, 106, 0.22), transparent 55%),
		linear-gradient(170deg, var(--deep-2), var(--night));
	box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
	text-align: center;
	animation: st-modal-rise 320ms var(--ease) both;
}

.st-modal__dialog .st-optin { text-align: left; }

@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__close {
	position: absolute;
	top: 0.9rem;
	right: 0.9rem;
	display: grid;
	place-items: center;
	width: 2.4rem;
	height: 2.4rem;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 50%;
	background: var(--panel);
	color: var(--gold-2);
	font-size: 1.4rem;
	line-height: 1;
	transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease);
}

.st-modal__close:hover,
.st-modal__close:focus-visible { background: var(--gold-wash); border-color: var(--gold); }

.st-modal__glyph {
	display: inline-grid;
	place-items: center;
	width: 3.4rem;
	height: 3.4rem;
	margin-bottom: 1rem;
	border: 1px solid var(--line);
	border-radius: 50%;
	background: radial-gradient(circle, rgba(243, 222, 168, 0.25), transparent 70%);
	color: var(--gold-2);
	font-size: 1.2rem;
	text-shadow: 0 0 16px var(--gold-glow);
}

.st-modal__kicker {
	margin: 0 0 0.5rem;
	color: var(--gold);
	font-size: 0.7rem;
	letter-spacing: 0.3em;
	text-transform: uppercase;
}

.st-modal__title {
	margin: 0 auto;
	max-width: 16ch;
	font-family: var(--serif);
	font-size: clamp(2rem, 6vw, 2.6rem);
	font-weight: 500;
	line-height: 1.08;
	color: var(--ink);
}

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