/*
 * Newsletter modal.
 *
 * Inherits the theme's tokens, so it is monochrome and hard-edged in both
 * themes without redefining a palette. Falls back to literal values when the
 * plugin runs under some other theme.
 */

.rn-modal {
	position: fixed;
	inset: 0;
	z-index: 9000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

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

.rn-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	border: 0;
	padding: 0;
	cursor: pointer;
}

.rn-modal__panel {
	position: relative;
	width: 100%;
	max-width: 460px;
	text-align: left;
	background: var(--paper, #fff);
	color: var(--ink, #111214);
	border: 1px solid var(--rule-strong, #111214);
	border-radius: 0;
	box-shadow: none;
	/* Even on all four sides — the close button aligns to this edge. */
	padding: 20px;
}

/* Nothing inside the modal is allowed to round off. */
.rn-modal__panel *,
.rn-modal__panel *::before,
.rn-modal__panel *::after {
	border-radius: 0;
}

/* Entrance is a short fade only, and only when motion is welcome. */
@media (prefers-reduced-motion: no-preference) {
	.rn-modal[data-rn-shown] .rn-modal__panel {
		animation: rn-in 140ms ease-out;
	}
}

@keyframes rn-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.rn-modal__close {
	position: absolute;
	/*
	 * Pulled back by half its own overhang so the glyph lines up with the
	 * panel's padding edge while the hit area still exceeds 32px.
	 */
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 0;
	color: var(--ink, #111214);
	font-size: 26px;
	line-height: 1;
	opacity: 1;
	cursor: pointer;
}

.rn-modal__close:hover,
.rn-modal__close:focus-visible {
	color: var(--accent, #c8102e);
}

.rn-modal__kicker {
	margin: 0 0 6px;
	padding-right: 32px;
	font-family: var(--font-mono, ui-monospace, Menlo, monospace);
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--accent, #c8102e);
}

.rn-modal__title {
	margin: 0;
	padding-right: 24px;
	font-family: var(--font-display, system-ui, sans-serif);
	font-size: 26px;
	line-height: 1.15;
	letter-spacing: -0.02em;
	font-weight: 600;
}

.rn-modal__sub {
	margin: 8px 0 0;
	font-size: 15px;
	line-height: 1.45;
	color: var(--mute, #6b7078);
}

.rn-modal__note {
	margin: 8px 0 0;
	font-family: var(--font-mono, ui-monospace, Menlo, monospace);
	font-size: 10px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--mute-soft, #8b9098);
}

/* ------------------------------------------------------------------ form -- */

.rn-form {
	margin-top: 14px;
}

.rn-form__row {
	display: flex;
	align-items: stretch;
}

.rn-form__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 42px;
	padding: 8px 12px;
	background: var(--paper, #fff);
	color: var(--ink, #111214);
	border: 1px solid #dddddd;
	border-right: 0;
	border-radius: 0;
	font-family: var(--font-mono, ui-monospace, Menlo, monospace);
	font-size: 13px;
}

.rn-form__input:focus {
	outline: none;
	border-color: var(--ink, #111214);
}

/* Dark mode needs its own resting border; #ddd would glare. */
[data-theme="dark"] .rn-form__input {
	border-color: #2a2c30;
}

[data-theme="dark"] .rn-modal__panel {
	border-color: #2a2c30;
}

.rn-form__row:focus-within .rn-form__submit {
	border-color: var(--ink, #111214);
}

.rn-form__input::placeholder {
	color: var(--mute-soft, #8b9098);
}

.rn-form__submit {
	flex: 0 0 auto;
	height: 42px;
	padding: 0 18px;
	background: var(--inverse, #111214);
	color: var(--inverse-ink, #ffffff);
	border: 1px solid var(--inverse, #111214);
	border-radius: 0;
	cursor: pointer;
	font-family: var(--font-mono, ui-monospace, Menlo, monospace);
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.rn-form__submit:hover:not(:disabled) {
	opacity: 0.88;
}

.rn-form__submit:disabled {
	opacity: 0.55;
	cursor: default;
}

.rn-form__msg:empty {
	display: none;
}

.rn-form__msg {
	margin: 8px 0 0;
	font-family: var(--font-mono, ui-monospace, Menlo, monospace);
	font-size: 11px;
	line-height: 1.4;
	letter-spacing: 0.02em;
	color: var(--mute, #6b7078);
}

.rn-form__msg[data-state="error"] {
	color: var(--accent, #c8102e);
}

.rn-form__msg[data-state="ok"] {
	color: var(--ink, #111214);
}

.rn-turnstile:not(:empty) {
	margin-top: 10px;
}

/* Honeypot: out of sight, out of the tab order, hidden from assistive tech. */
.rn-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.rn-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* The inline bar in the footer shares the form styles but keeps its own row. */
.newsletter .rn-turnstile {
	margin-top: 10px;
}

.newsletter__status {
	margin-top: 8px;
	font-family: var(--font-mono, ui-monospace, Menlo, monospace);
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--mute, #6b7078);
}

@media (max-width: 480px) {
	.rn-modal__panel {
		padding: 16px;
	}

	.rn-modal__title {
		font-size: 22px;
	}

	.rn-form__row {
		flex-direction: column;
	}

	.rn-form__input {
		border-right: 1px solid var(--rule-strong, #111214);
		border-bottom: 0;
	}
}

/*
 * The consent line. Deliberately plain and full width — a checkbox squeezed
 * beside the button reads as fine print, and a consent control that reads as
 * fine print is the thing regulators object to.
 */
.rn-consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-top: 10px;
	font-family: var(--font-mono, ui-monospace, Menlo, monospace);
	font-size: 11px;
	line-height: 1.45;
	color: var(--mute, #6b7078);
	cursor: pointer;
}

.rn-consent input {
	flex: 0 0 auto;
	width: 15px;
	height: 15px;
	margin-top: 1px;
	accent-color: var(--ink, #111214);
	cursor: pointer;
}

.rn-consent label {
	cursor: pointer;
}
