/**
 * Post Oak signup: button, modal, form.
 *
 * Colors come from the theme's presets so this matches the rest of the site
 * without importing anything; the fallbacks keep it presentable if the
 * shortcode is ever dropped onto a page outside the ACC theme.
 */

.acc-newssub {
	margin-top: 1.75rem;
}

/* ---- Trigger ---- */

.acc-newssub__open {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.85rem 1.6rem;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--primary, #1a3a1f);
	color: var(--wp--preset--color--sand, #fbf3e7);
	font-family: inherit;
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 160ms ease;
}

.acc-newssub__open:hover {
	background: var(--wp--preset--color--primary-light, #2c5e34);
}

.acc-newssub__open:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary, #1a3a1f);
	outline-offset: 3px;
}

/* ---- Modal ---- */

.acc-newssub__modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	/* Top-aligned and scrolled at the shell, not centered: a centered dialog
	   taller than the visible viewport spills past both ends with no way to
	   reach either, and `vh` does not shrink when the keyboard opens. */
	align-items: flex-start;
	justify-content: center;
	padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
	overflow-y: auto;
	overscroll-behavior: contain;
}

.acc-newssub__modal[hidden] {
	display: none;
}

/* `overflow: hidden` on <body> alone does nothing while the theme sets
   `html, body { overflow-x: clip }` — <html> has to be pinned too. */
body.acc-newssub-open {
	overflow: hidden;
}

html:has(body.acc-newssub-open) {
	overflow: hidden;
}

.acc-newssub__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(20, 32, 22, 0.55);
}

.acc-newssub__dialog {
	position: relative;
	width: min(30rem, 100%);
	margin: auto; /* still centers when it fits */
	overflow-y: visible;
	padding: clamp(1.6rem, 4vw, 2.4rem);
	border-radius: 18px;
	background: #f7f1e2;
	border: 1px solid var(--wp--preset--color--border, #d9d5c7);
	box-shadow: 0 40px 80px -40px rgba(26, 58, 31, 0.6);
}

.acc-newssub__dialog:focus {
	outline: none;
}

.acc-newssub__close {
	position: absolute;
	top: 0.4rem;
	right: 0.5rem;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--wp--preset--color--primary, #1a3a1f);
	font-size: 1.7rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.65;
}

.acc-newssub__close:hover {
	opacity: 1;
}

	/* Reserve the close button's corner. It is 44px wide, absolutely
	   positioned at the top right, and the title had no space set aside for
	   it -- so any title that wrapped ran underneath the x. */
.acc-newssub__title {
	padding-right: 3rem;
	margin: 0 0 0.5rem;
	font-size: clamp(1.5rem, 3vw, 1.9rem);
	font-weight: 500;
	line-height: 1.15;
	color: var(--wp--preset--color--primary, #1a3a1f);
}

.acc-newssub__lede {
	margin: 0 0 1.5rem;
	font-size: 0.95rem;
	line-height: 1.6;
	color: var(--wp--preset--color--muted, #5f6b5f);
}

/* ---- Form ---- */

.acc-newssub__form[hidden],
.acc-newssub__done[hidden] {
	display: none;
}

.acc-newssub__field {
	display: block;
	margin-bottom: 0.9rem;
}

.acc-newssub__field > span {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wp--preset--color--primary, #1a3a1f);
}

.acc-newssub__field input {
	width: 100%;
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--wp--preset--color--border, #d9d5c7);
	border-radius: 10px;
	background: #fff;
	font-family: inherit;
	font-size: 1rem;
	color: inherit;
}

.acc-newssub__field input:focus {
	outline: none;
	border-color: var(--wp--preset--color--primary, #1a3a1f);
	box-shadow: 0 0 0 3px rgba(26, 58, 31, 0.14);
}

.acc-newssub__field input.is-invalid {
	border-color: #a3341f;
}

.acc-newssub__field input.is-invalid:focus {
	box-shadow: 0 0 0 3px rgba(163, 52, 31, 0.16);
}

/*
 * Takes no room until it has something to say.
 *
 * It used to reserve a line's height so the dialog would not jump when an error
 * appeared -- but with two fields that reserved space, plus its own margin, was
 * adding 19px of nothing between every field. A small shift when a message
 * appears is a better trade than a permanently airy form.
 */
.acc-newssub__error {
	display: block;
	margin-top: 0.3rem;
	font-size: 0.82rem;
	font-style: normal;
	color: #a3341f;
}

.acc-newssub__error:empty {
	display: none;
}

.acc-newssub__formerror {
	margin: 0 0 1rem;
	padding: 0.7rem 0.9rem;
	border-radius: 10px;
	background: rgba(163, 52, 31, 0.09);
	font-size: 0.9rem;
	color: #a3341f;
}

.acc-newssub__formerror[hidden] {
	display: none;
}

/* The "also send me the other one" tick box. Quieter than the name and email
   fields above it, since it is an addition rather than something to fill in. */
.acc-newssub__also {
	display: flex;
	gap: 0.6rem;
	align-items: flex-start;
	margin: 0 0 1.25rem;
	font-size: 0.88rem;
	line-height: 1.45;
	color: var(--wp--preset--color--muted, #5b5847);
	cursor: pointer;
}

.acc-newssub__also input {
	margin-top: 0.15rem;
	flex: none;
	accent-color: var(--wp--preset--color--primary, #1a3a1f);
}

/* Off-screen rather than display:none — a bot reading the DOM should still
   find it, while nobody using the page ever sees or tabs into it. */
.acc-newssub__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.acc-newssub__submit {
	width: 100%;
	padding: 0.85rem 1.5rem;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--primary, #1a3a1f);
	color: var(--wp--preset--color--sand, #fbf3e7);
	font-family: inherit;
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 160ms ease;
}

.acc-newssub__submit:hover:not(:disabled) {
	background: var(--wp--preset--color--primary-light, #2c5e34);
}

.acc-newssub__submit:disabled {
	opacity: 0.6;
	cursor: default;
}

.acc-newssub__donemsg {
	margin: 0 0 1.4rem;
	font-size: 1.05rem;
	line-height: 1.6;
	color: var(--wp--preset--color--primary, #1a3a1f);
}

/* ---- Unsubscribe confirmation ---- */

.acc-newssub__banner {
	padding: 0.9rem 1.25rem;
	background: var(--wp--preset--color--primary, #1a3a1f);
	color: var(--wp--preset--color--sand, #fbf3e7);
	font-size: 0.95rem;
	text-align: center;
}

@media (prefers-reduced-motion: reduce) {
	.acc-newssub__open,
	.acc-newssub__submit {
		transition: none;
	}
}
