/*
 * Newsletters Sign Up Connector — front-end styles.
 *
 * Everything is scoped under .nsc-signup and all custom properties are declared
 * on that wrapper, so nothing leaks into (or is inherited unexpectedly from) the
 * theme. Selector specificity is kept flat and class-based to avoid clashes.
 */

.nsc-signup {
	--nsc-navy: #16264b;
	--nsc-navy-dark: #0f1c3a;
	--nsc-text: #1f2937;
	--nsc-muted: #6b7280;
	--nsc-border: #e6e8ee;
	--nsc-card: #ffffff;
	--nsc-banner: #eef0f7;
	--nsc-accent: var(--nsc-navy); /* per-card override via inline style */
	--nsc-ring: rgba(22, 38, 75, 0.35);
	--nsc-success: #1a7f47;
	--nsc-error: #c0392b;
	--nsc-radius: 14px;
	--nsc-radius-sm: 10px;

	max-width: 1160px;
	margin: 0 auto;
	color: var(--nsc-text);
	font-family: inherit;
	line-height: 1.5;
	box-sizing: border-box;
}

.nsc-signup *,
.nsc-signup *::before,
.nsc-signup *::after {
	box-sizing: inherit;
}

/* Screen-reader-only utility (for the fieldset legend). */
.nsc-signup__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Header */
.nsc-signup__head {
	text-align: center;
	margin-bottom: 1.75rem;
}

.nsc-signup__title {
	margin: 0 0 0.5rem;
	color: var(--nsc-navy);
	font-size: clamp(1.5rem, 3vw, 2.25rem);
	font-weight: 800;
	line-height: 1.15;
}

.nsc-signup__subtitle {
	margin: 0 auto;
	max-width: 46rem;
	color: var(--nsc-muted);
	font-size: 1.05rem;
}

/* Card grid — 2 per row on mobile, 3 on tablet, all 6 in one row on desktop. */
.nsc-signup__grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	align-items: stretch; /* every card fills the row height */
	gap: 14px;
	border: 0;
	padding: 0;
	margin: 0 0 1.25rem;
}

@media (min-width: 600px) {
	.nsc-signup__grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 16px;
	}
}

@media (min-width: 900px) {
	.nsc-signup__grid {
		grid-template-columns: repeat(6, 1fr);
	}
}

.nsc-signup__card {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 0.4rem;
	height: 100%; /* fill the grid cell → margin-top:auto pins the checkbox row */
	padding: 1.4rem 1rem 1.1rem;
	background: var(--nsc-card);
	border: 1px solid var(--nsc-border);
	border-radius: var(--nsc-radius);
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.nsc-signup__card:hover {
	box-shadow: 0 6px 18px rgba(16, 24, 40, 0.08);
	transform: translateY(-2px);
}

.nsc-signup__card.is-checked {
	border-color: var(--nsc-accent);
	box-shadow: 0 0 0 2px var(--nsc-accent) inset;
}

/* Brand block: holds either an uploaded logo or the styled brand text. The
   fixed min-height keeps categories aligned across cards of differing logos. */
.nsc-signup__brand {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	font-size: 1.3rem;
	font-weight: 800;
	color: var(--nsc-accent);
	letter-spacing: -0.01em;
}

.nsc-signup__logo {
	max-width: 100%;
	max-height: 48px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.nsc-signup__cat {
	font-weight: 700;
	color: var(--nsc-accent);
}

.nsc-signup__desc {
	color: var(--nsc-muted);
	font-size: 0.9rem;
	margin-top: 0.15rem;
}

/* Checkbox + its short label, pinned to the bottom of the card and aligned. */
.nsc-signup__pick {
	margin-top: auto;
	padding-top: 0.9rem;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
}

.nsc-signup__check {
	width: 20px;
	height: 20px;
	margin: 0;
	accent-color: var(--nsc-accent);
	cursor: pointer;
}

.nsc-signup__pick-label {
	font-size: 0.9rem;
	color: var(--nsc-muted);
}

/* "You're in control" banner */
.nsc-signup__banner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem;
	padding: 1.1rem 1.4rem;
	background: var(--nsc-banner);
	border-radius: var(--nsc-radius);
	margin-bottom: 1.5rem;
}

.nsc-signup__banner-main {
	display: flex;
	align-items: center;
	gap: 0.9rem;
}

.nsc-signup__banner-icon {
	flex: none;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: #fff;
	color: var(--nsc-navy);
	display: flex;
	align-items: center;
	justify-content: center;
}

.nsc-signup__banner-text {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.nsc-signup__banner-text strong {
	color: var(--nsc-navy);
	font-size: 1.05rem;
}

.nsc-signup__banner-text span {
	color: var(--nsc-muted);
	font-size: 0.95rem;
}

/* Right-hand actions: the toggle plus the optional "manage" link, stacked. */
.nsc-signup__banner-actions {
	flex: none;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.5rem;
}

.nsc-signup__selectall {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.6rem 1.2rem;
	background: #fff;
	color: var(--nsc-navy);
	border: 1.5px solid var(--nsc-navy);
	border-radius: var(--nsc-radius-sm);
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.nsc-signup__selectall:hover {
	background: var(--nsc-navy);
	color: #fff;
}

/* Unchecked by default: the tick appears — and the button fills — only once the
   toggle is active (aria-pressed="true"), i.e. every newsletter is selected. */
.nsc-signup__selectall-icon {
	display: none;
}

.nsc-signup__selectall[aria-pressed="true"] {
	background: var(--nsc-navy);
	color: #fff;
}

.nsc-signup__selectall[aria-pressed="true"] .nsc-signup__selectall-icon {
	display: inline-flex;
}

/* Secondary "manage preferences" link, styled as a quiet button. */
.nsc-signup__manage {
	display: inline-block;
	/*padding: 0.5rem 1rem;*/
	text-align: center;
	color: var(--nsc-navy);
	font-weight: 600;
	font-size: 0.95rem;
	text-decoration: underline;
	border-radius: var(--nsc-radius-sm);
}

.nsc-signup__manage:hover {
	background: rgba(22, 38, 75, 0.06);
	text-decoration: none;
}

/* Email field */
.nsc-signup__field {
	margin-bottom: 1rem;
}

.nsc-signup__field label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.35rem;
	color: var(--nsc-text);
}

.nsc-signup__field input {
	width: 100%;
	padding: 0.8rem 0.9rem;
	font-size: 1rem;
	border: 1px solid var(--nsc-border);
	border-radius: var(--nsc-radius-sm);
	background: #fff;
	color: var(--nsc-text);
}

/* Consent */
.nsc-signup__consent {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	margin-bottom: 1.1rem;
	font-size: 0.95rem;
	color: var(--nsc-text);
	cursor: pointer;
}

.nsc-signup__consent input {
	margin-top: 0.2rem;
	width: 18px;
	height: 18px;
	accent-color: var(--nsc-navy);
	flex: none;
}

.nsc-signup__consent a {
	color: var(--nsc-navy);
	text-decoration: underline;
}

/* Honeypot — visually removed but still in the DOM for bots. */
.nsc-signup__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Turnstile */
.nsc-signup__turnstile {
	margin-bottom: 1.1rem;
}

/* Submit */
.nsc-signup__submit {
	display: block;
	width: 100%;
	padding: 1rem 1.25rem;
	background: var(--nsc-navy);
	color: #fff;
	border: 0;
	border-radius: var(--nsc-radius);
	font-size: 1.1rem;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.15s ease;
}

.nsc-signup__submit:hover {
	background: var(--nsc-navy-dark);
}

.nsc-signup__submit[disabled] {
	opacity: 0.65;
	cursor: progress;
}

/* Status message */
.nsc-signup__status {
	margin: 0.9rem 0 0;
	text-align: center;
	font-weight: 600;
	min-height: 1.2em;
}

.nsc-signup__status.is-success {
	color: var(--nsc-success);
}

.nsc-signup__status.is-error {
	color: var(--nsc-error);
}

/* Reassurance note */
.nsc-signup__note {
	margin: 0.75rem 0 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	color: var(--nsc-muted);
	font-size: 0.9rem;
}

.nsc-signup__note-icon {
	display: inline-flex;
	color: var(--nsc-muted);
}

/* Visible keyboard focus for every interactive element. */
.nsc-signup :is(input, button, a):focus-visible {
	outline: 3px solid var(--nsc-ring);
	outline-offset: 2px;
	border-radius: 6px;
}

/* Progressive enhancement for browsers without JS class toggling. */
.nsc-signup__card:has(.nsc-signup__check:checked) {
	border-color: var(--nsc-accent);
	box-shadow: 0 0 0 2px var(--nsc-accent) inset;
}

@media (max-width: 600px) {
	.nsc-signup__banner {
		flex-direction: column;
		align-items: stretch;
		text-align: center;
	}
	.nsc-signup__banner-actions {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nsc-signup__card,
	.nsc-signup__selectall,
	.nsc-signup__submit {
		transition: none;
	}
	.nsc-signup__card:hover {
		transform: none;
	}
}
