/* ==========================================================================
   Newsletter opt-in — v12 "Poster board"
   --------------------------------------------------------------------------
   The form is rendered by Contact Form 7 (inc/optin-form/cf7.php) with the
   theme's own classes on its fields; the rules below also neutralise CF7's
   default styles (list-item margins, red tips, bordered response box).

   One component in four places — the join band's panel, the sidebar widget,
   the modal and any [st_optin_form] shortcode — so there is a single
   treatment: a framed mono field, a square checkbox that fills with the
   signal colour, a full-width signal button, and the publisher's notice set
   small underneath.
   ========================================================================== */

.st-optin {
	display: flex;
	flex-direction: column;
	gap: 0.95rem;
	width: 100%;
}

.st-optin__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px; height: 1px;
	overflow: hidden;
}

.st-optin__field { position: relative; display: block; width: 100%; }

/* CF7 wrappers: make them transparent to the layout. */
.wpcf7:has(> .st-optin) { width: 100%; }
.st-optin .wpcf7-form-control-wrap { display: block; position: relative; }
.st-optin .wpcf7-list-item { display: block; margin: 0; }

/* ── Email field ──────────────────────────────────────────────────────── */
.st-optin__input {
	width: 100%;
	min-height: 56px;
	padding: 0.85rem 1rem 0.85rem 3.4rem;
	border: var(--bw, 2px) solid var(--ink);
	border-radius: 0;
	background: var(--field);
	color: var(--ink);
	font-family: var(--font-mono);
	font-size: 1rem; /* 16px keeps iOS from zooming on focus */
	line-height: 1.4;
	transition: box-shadow 0.15s var(--ease);
	-webkit-appearance: none;
	appearance: none;
}
/* An "@" on its own black tile at the start of the field. */
.st-optin__field--email::before {
	content: "@";
	position: absolute;
	z-index: 1;
	top: 0; left: 0; bottom: 0;
	width: 2.6rem;
	display: grid;
	place-items: center;
	background: var(--ink);
	color: var(--bg);
	font-family: var(--font-mono);
	font-size: 1.05rem;
	font-weight: 600;
	pointer-events: none;
}
.st-optin__input::placeholder { color: var(--muted); opacity: 1; }
.st-optin__input:focus {
	outline: none;
	box-shadow: 5px 5px 0 var(--mint);
}

/* ── Consent ──────────────────────────────────────────────────────────── */
.st-optin__consent-label,
.st-optin__consent .wpcf7-list-item > label {
	display: grid;
	grid-template-columns: 22px minmax(0, 1fr);
	gap: 0.7rem;
	align-items: start;
	cursor: pointer;
}
.st-optin__checkbox {
	-webkit-appearance: none;
	appearance: none;
	width: 22px; height: 22px;
	margin: 0.05rem 0 0;
	border: var(--bw, 2px) solid var(--ink);
	border-radius: 0;
	background: var(--surface);
	cursor: pointer;
	display: grid;
	place-content: center;
}
.st-optin__checkbox::after {
	content: "";
	width: 11px; height: 6px;
	margin-top: -3px;
	border-left: 3px solid var(--mint-ink);
	border-bottom: 3px solid var(--mint-ink);
	transform: rotate(-45deg) scale(0);
	transition: transform 0.15s var(--ease);
}
.st-optin__checkbox:checked { background: var(--mint); }
.st-optin__checkbox:checked::after { transform: rotate(-45deg) scale(1); }
.st-optin__checkbox:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }

.st-optin__consent-text,
.st-optin__consent .wpcf7-list-item-label {
	font-size: 0.8rem;
	line-height: 1.5;
	color: var(--ink-2);
}
.st-optin__consent .wpcf7-list-item-label a,
.st-optin__consent-text a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--mint); text-decoration-thickness: 2px; text-underline-offset: 2px; }
.st-optin__consent .wpcf7-list-item-label a:hover,
.st-optin__consent-text a:hover { background: var(--mint); color: var(--mint-ink); }

/* ── Submit ───────────────────────────────────────────────────────────── */
.st-optin__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.55rem;
	width: 100%;
	min-height: 56px;
	padding: 0.8rem 1.4rem;
	border: var(--bw, 2px) solid var(--ink);
	border-radius: 0;
	background: var(--mint);
	color: var(--mint-ink);
	font-family: var(--font-body);
	font-stretch: 80%;
	font-size: 1.02rem;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	cursor: pointer;
	transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.st-optin__submit svg {
	width: 18px; height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.4;
	stroke-linecap: square;
	stroke-linejoin: miter;
	transition: transform 0.25s var(--ease);
}
.st-optin__submit:hover { background: var(--ink); color: var(--bg); transform: translate(-3px, -3px); box-shadow: 3px 3px 0 var(--mint); }
.st-optin__submit:hover svg { transform: translateX(4px); }
.st-optin__submit:active { transform: none; box-shadow: none; }
.st-optin__submit:disabled { opacity: 0.6; cursor: progress; transform: none; box-shadow: none; }

/* While CF7 submits, the arrow is replaced by a turning "#". */
.st-optin.submitting .st-optin__submit svg { opacity: 0; }
.st-optin.submitting .st-optin__submit::after {
	content: "#";
	margin-left: -1.6rem;
	font-family: var(--font-mono);
	font-size: 1.1rem;
	animation: st-optin-spin 0.9s linear infinite;
}
@keyframes st-optin-spin { to { transform: rotate(360deg); } }
.st-optin .wpcf7-spinner { display: none; }

/* ── Messages ─────────────────────────────────────────────────────────── */
.wpcf7 form.st-optin.wpcf7-form .wpcf7-response-output {
	margin: 0;
	padding: 0.75rem 0.9rem;
	border: var(--bw, 2px) solid var(--ink);
	border-left: 8px solid var(--danger);
	border-radius: 0;
	background: var(--surface);
	font-size: 0.86rem;
	line-height: 1.45;
	color: var(--ink);
}
.wpcf7 form.st-optin.wpcf7-form .wpcf7-response-output:empty { display: none; }
.wpcf7 form.st-optin.sent .wpcf7-response-output { border-left-color: var(--mint); }

.st-optin .wpcf7-not-valid-tip {
	margin-top: 0.4rem;
	font-family: var(--font-mono);
	font-size: 0.72rem;
	color: var(--danger);
}
.st-optin .st-optin__input[aria-invalid="true"] { border-color: var(--danger); }
.st-optin .st-optin__checkbox[aria-invalid="true"] { border-color: var(--danger); }
.st-optin__consent .wpcf7-not-valid-tip { padding-left: calc(22px + 0.7rem); }
.st-optin.sent .st-optin__submit { background: var(--ink); color: var(--bg); }

/* ── Legal footer ─────────────────────────────────────────────────────── */
.st-optin__footer {
	display: flex;
	flex-wrap: wrap;
	gap: 0.15rem 0.75rem;
	padding-top: 0.85rem;
	border-top: 2px dashed var(--line-2);
	font-family: var(--font-mono);
	font-size: 0.66rem;
	line-height: 1.55;
	letter-spacing: 0.01em;
	color: var(--muted);
}
.st-optin__company { font-weight: 600; color: var(--ink-2); }
.st-optin__support { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.st-optin__support:hover { color: var(--ink); }
.st-optin__parent {
	flex-basis: 100%;
	margin: 0.35rem 0 0;
	font-family: var(--font-body);
	font-size: 0.72rem;
	line-height: 1.5;
	letter-spacing: 0;
	color: var(--muted);
}

.st-optin__recaptcha {
	flex-basis: 100%;
	margin: 0.35rem 0 0;
	font-family: var(--font-body);
	font-size: 0.68rem;
	line-height: 1.5;
	letter-spacing: 0;
	color: var(--muted);
}
.st-optin__recaptcha a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.st-optin__recaptcha a:hover { color: var(--ink); }

/* ── Subscribe modal ──────────────────────────────────────────────────── */
.st-modal {
	position: fixed;
	inset: 0;
	z-index: 300;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}
.st-modal[hidden] { display: none; }

.st-modal__backdrop {
	position: absolute;
	inset: 0;
	background: color-mix(in srgb, var(--scrim) 62%, transparent);
	animation: st-modal-fade 0.25s var(--ease);
}

.st-modal__dialog {
	position: relative;
	width: min(500px, 100%);
	max-height: calc(100dvh - 40px);
	overflow-y: auto;
	padding: 2rem 2rem 1.75rem;
	border: var(--bw, 2px) solid var(--ink);
	border-top: 14px solid var(--mint);
	border-radius: 0;
	background: var(--surface);
	box-shadow: 12px 12px 0 var(--ink);
	animation: st-modal-rise 0.35s var(--ease);
}
.scheme-is-dark .st-modal__dialog { box-shadow: 12px 12px 0 var(--mint); }

/* Ten pictogram readers across the top; the last fills in — you. */
.st-modal__isotype { display: flex; gap: 6px; margin: 0 3.2rem 1.1rem 0; }
.st-modal__isotype svg { width: 26px; height: 26px; fill: var(--off, #ccc); }
.st-modal__isotype svg:last-child { animation: st-modal-you 0.4s var(--ease) 0.5s forwards; }
@keyframes st-modal-you { to { fill: var(--mint); transform: translateY(-3px); } }

.st-modal__close {
	position: absolute;
	top: 12px; right: 12px;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px; height: 44px;
	border: var(--bw, 2px) solid var(--ink);
	border-radius: 0;
	background: var(--surface);
	cursor: pointer;
}
.st-modal__close svg { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: square; }
.st-modal__close:hover { background: var(--mint); }

.st-modal__kicker {
	display: inline-block;
	padding: 4px 8px 3px;
	background: var(--ink);
	color: var(--bg);
	font-family: var(--font-mono);
	font-size: 0.66rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}
.st-modal__title {
	margin-top: 0.8rem;
	max-width: 14ch;
	font-family: var(--font-display);
	font-size: clamp(2.2rem, 1.6rem + 2vw, 3rem);
	font-weight: 400;
	line-height: 0.92;
	text-transform: uppercase;
}
.st-modal__sub {
	margin: 0.9rem 0 1.5rem;
	font-size: 1rem;
	line-height: 1.5;
	color: var(--ink-2);
}

body.st-modal-open { overflow: hidden; }

@keyframes st-modal-fade { from { opacity: 0; } }
@keyframes st-modal-rise { from { opacity: 0; transform: translateY(18px); } }

@media (max-width: 480px) {
	.st-modal { padding: 10px; align-items: flex-end; }
	.st-modal__dialog { padding: 1.6rem 1.25rem 1.25rem; max-height: calc(100dvh - 20px); box-shadow: 6px 6px 0 var(--ink); }
	.st-modal__isotype svg { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
	.st-modal__backdrop, .st-modal__dialog { animation: none; }
	.st-modal__isotype svg:last-child { animation: none; fill: var(--mint); }
}
