/*
 * Wooptima Opt-in Forms – Placement styles (Claude Design: "Blog - bloky pre zber kontaktov").
 *
 * Font family is inherited from the theme on purpose. Every selector is
 * prefixed with .woif so the theme's generic h2/p/input/button rules inside
 * .entry-content are neutralised only within a Placement.
 *
 * Custom properties (set inline on the section by the template):
 *   --woif-image    background photo, url(...)
 *   --woif-overlay  overlay darkness, 0-1 (default 0.4)
 */

.woif {
	--woif-green: #5f8039;
	--woif-green-hover: #4a6a2c;
	--woif-radius: 4px;

	position: relative;
	box-sizing: border-box;
	isolation: isolate;
	overflow: hidden;
	margin: 2rem 0;
	border-radius: var(--woif-radius);
	background-color: var(--woif-green);
	background-image: var(--woif-image, none);
	background-position: center;
	background-size: cover;
	color: #fff;
	text-align: center;
}

.woif *,
.woif *::before,
.woif *::after {
	box-sizing: border-box;
}

/* Dark overlay (design: rgba(0,0,0,.4)). */
.woif::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: rgba(0, 0, 0, var(--woif-overlay, 0.4));
}

/* Inline block: ~849 x 307 on desktop, 96 px side padding. */
.woif--inline {
	display: flex;
	align-items: center;
	min-height: 307px;
	padding: 53px 96px;
}

.woif__body {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	width: 100%;
	min-width: 0;
}

.woif .woif__heading {
	margin: 0;
	padding: 0;
	color: #fff;
	font-size: 30px;
	font-weight: 700;
	letter-spacing: 0;
	line-height: 1.3;
	text-align: center;
	text-transform: none;
	overflow-wrap: anywhere;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.woif .woif__text {
	max-width: 578px;
	margin: 0;
	color: #fff;
	font-size: 18px;
	font-weight: 400;
	line-height: 1.4;
	text-align: center;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* Form core: field joined to the button in one 64 px row. */
.woif .woif__content {
	width: 100%;
	max-width: 656px;
	margin: 16px 0 0; /* with the 16 px body gap = 32 px between text and form */
}

.woif .woif__form {
	margin: 0;
	padding: 0;
}

.woif .woif__row {
	display: flex;
	align-items: stretch;
	width: 100%;
}

/* Visually hidden label; the theme's own rule also sets visibility:hidden, so restate it. */
.woif .woif__label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	border: 0;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	visibility: visible;
}

/* Honeypot: the inline style stays as a fallback. */
.woif .woif__hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.woif .woif__input,
.woif .woif__button {
	position: relative;
	height: 64px;
	margin: 0;
	border: 0;
	font-size: 18px;
	line-height: 26px;
	letter-spacing: 0;
	text-transform: none;
	-webkit-appearance: none;
	appearance: none;
	box-shadow: none;
}

.woif .woif__input {
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
	padding: 19px 20px;
	border-radius: var(--woif-radius) 0 0 var(--woif-radius);
	outline: 0;
	background: #fff;
	color: #1f1f1f;
	font-weight: 400;
	text-align: left;
}

.woif .woif__input::placeholder {
	color: #989898;
	opacity: 1;
}

.woif .woif__input[aria-invalid="true"] {
	box-shadow: inset 0 0 0 2px #b3261e;
}

.woif .woif__button {
	flex: 0 0 147px;
	width: 147px;
	padding: 19px 12px;
	border-radius: 0 var(--woif-radius) var(--woif-radius) 0;
	background-color: var(--woif-green);
	color: #fff;
	font-weight: 700;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.woif .woif__button:hover:not(:disabled) {
	background-color: var(--woif-green-hover);
	color: #fff;
}

/* Visible focus; beats the theme's .keyboard-active outline. The white ring reads on the dark overlay. */
.woif .woif__form .woif__input:focus-visible,
.woif .woif__form .woif__button:focus-visible {
	z-index: 1;
	outline: 3px solid #fff;
	outline-offset: 2px;
}

.woif .woif__form .woif__button:focus-visible {
	background-color: var(--woif-green-hover);
}

/* Sending: forms.js sets disabled + aria-busy. */
.woif .woif__button:disabled,
.woif .woif__button[aria-busy="true"] {
	opacity: 0.65;
	cursor: progress;
}

/* Messages (aria-live region; empty until JS fills it, so it takes no space). */
.woif .woif__message {
	margin: 0;
	padding: 0;
	color: #fff;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.4;
	text-align: center;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.woif .woif__message:not(:empty) {
	margin-top: 12px;
}

.woif .woif__message.woif__message--error {
	display: block;
	padding: 8px 12px;
	border-radius: var(--woif-radius);
	background: #fff;
	color: #b3261e;
	font-weight: 700;
	text-shadow: none;
}

/* Consent notice under the form; it informs, it is not a checkbox. */
.woif .woif__consent {
	margin: 12px 0 0;
	padding: 0;
	color: #fff;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.4;
	text-align: center;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.woif .woif__consent a {
	color: #fff;
	text-decoration: underline;
}

.woif .woif__consent a:hover {
	text-decoration: none;
}

.woif .woif__consent a:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

/* Thank-you state: the form is gone, the message is the content. */
.woif.woif--done .woif__message {
	margin-top: 0;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.3;
}

/* Phone: field stacked above the button, nothing wider than the viewport. */
@media (max-width: 600px) {
	.woif--inline {
		min-height: 0;
		padding: 32px 20px;
	}

	.woif .woif__heading {
		font-size: 24px;
	}

	.woif .woif__text {
		font-size: 16px;
	}

	.woif .woif__row {
		flex-direction: column;
	}

	.woif .woif__input,
	.woif .woif__button {
		flex: 0 0 auto;
		width: 100%;
		height: 56px;
	}

	/* 56 px high: (56 - 26) / 2 = 15 px, as in the Slide-in. */
	.woif .woif__input,
	.woif .woif__button {
		padding-top: 15px;
		padding-bottom: 15px;
	}

	.woif .woif__input {
		border-radius: var(--woif-radius) var(--woif-radius) 0 0;
	}

	.woif .woif__button {
		border-radius: 0 0 var(--woif-radius) var(--woif-radius);
	}

	.woif.woif--done .woif__message {
		font-size: 20px;
	}
}

/*
 * Footer band: full width above the site footer, ~232 px high (design). Text on the
 * left (656 px), form on the right (444 px) inside a centred 1118 px row.
 */
.woif--footer {
	margin: 0;
	padding: 63px 20px;
	border-radius: 0;
	text-align: left;
}

.woif--footer .woif__body {
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	gap: 17px;
	max-width: 1118px;
	margin: 0 auto;
}

.woif--footer .woif__intro {
	display: flex;
	flex: 0 1 656px;
	flex-direction: column;
	align-items: flex-start;
	gap: 16px;
	min-width: 0;
}

.woif--footer .woif__heading,
.woif--footer .woif__text {
	text-align: left;
}

.woif--footer .woif__content {
	flex: 0 0 444px;
	max-width: 444px;
	margin: 0;
}

.woif--footer .woif__message,
.woif--footer .woif__consent {
	text-align: left;
}

.woif.woif--footer.woif--done .woif__content {
	align-self: center;
}

@media (max-width: 900px) {
	.woif--footer {
		padding: 40px 20px;
	}

	.woif--footer .woif__body {
		flex-direction: column;
		align-items: stretch;
		gap: 24px;
	}

	.woif--footer .woif__intro {
		flex: none;
	}

	.woif--footer .woif__content {
		flex: none;
		width: 100%;
		max-width: none;
	}
}

/*
 * Slide-in: fixed panel on the right, ~392 x 359 (design). slidein.js removes [hidden]
 * and adds .woif--open; keep the closed state off-screen so the 300 ms slide runs.
 */
.woif--slidein {
	--woif-slidein-top: 100px;

	position: fixed;
	top: var(--woif-slidein-top);
	right: 0;
	z-index: 999;
	display: flex;
	align-items: center;
	width: 392px;
	max-width: 100%;
	min-height: 359px;
	margin: 0;
	padding: 44px 26px 44px 33px;
	border-radius: var(--woif-radius) 0 0 var(--woif-radius);
	transform: translateX(100%);
	transition: transform 0.3s ease;
}

.woif--slidein[hidden] {
	display: none;
}

.woif--slidein.woif--open {
	transform: none;
}

.woif--slidein .woif__body {
	gap: 12px;
}

.woif--slidein .woif__heading {
	max-width: 259px;
	line-height: 1.2;
}

.woif--slidein .woif__text {
	max-width: 303px;
}

/* Stacked form: 56 px field above the button, placeholder centred. */
.woif--slidein .woif__content {
	max-width: 333px;
	margin-top: 12px; /* with the 12 px body gap = 24 px between text and form */
}

.woif--slidein .woif__row {
	flex-direction: column;
}

.woif--slidein .woif__input,
.woif--slidein .woif__button {
	flex: 0 0 auto;
	width: 100%;
	height: 56px;
	padding-top: 15px;
	padding-bottom: 15px;
}

.woif--slidein .woif__input {
	border-radius: var(--woif-radius) var(--woif-radius) 0 0;
	text-align: center;
}

.woif--slidein .woif__button {
	border-radius: 0 0 var(--woif-radius) var(--woif-radius);
}

/*
 * Slide-in below the desktop breakpoint (slidein.js adds .woif--mobile; the breakpoint is a
 * setting, so it cannot be a media query): full-width bottom panel with heading, field and
 * button, at most 40 % of the viewport height. Vars set by slidein.js:
 *   --woif-slidein-bottom      lift above the on-screen keyboard
 *   --woif-slidein-max-height  40 % of the viewport, and the space under the header
 * The longer text and the photo are left out; the Consent notice stays.
 */
.woif--slidein.woif--mobile {
	top: auto;
	right: 0;
	bottom: var(--woif-slidein-bottom, 0px);
	left: 0;
	display: block;
	width: auto;
	max-width: none;
	min-height: 0;
	max-height: var(--woif-slidein-max-height, 40vh);
	padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
	overflow-y: auto;
	border-radius: var(--woif-radius) var(--woif-radius) 0 0;
	/* Overlay as a background, so it does not scroll away with the content. */
	background-image: linear-gradient(rgba(0, 0, 0, var(--woif-overlay, 0.4)), rgba(0, 0, 0, var(--woif-overlay, 0.4)));
	transform: translateY(100%);
}

.woif--slidein.woif--mobile[hidden] {
	display: none;
}

.woif--slidein.woif--mobile.woif--open {
	transform: none;
}

.woif--slidein.woif--mobile::before,
.woif--slidein.woif--mobile .woif__text {
	display: none;
}

.woif--slidein.woif--mobile .woif__body {
	gap: 8px;
	max-width: 480px;
	margin: 0 auto;
}

.woif--slidein.woif--mobile .woif__heading {
	max-width: none;
	padding: 0 28px; /* clear of the cross */
	font-size: 20px;
}

.woif--slidein.woif--mobile .woif__content {
	max-width: none;
	margin: 0;
}

.woif--slidein.woif--mobile .woif__row {
	flex-direction: column;
}

.woif--slidein.woif--mobile .woif__input,
.woif--slidein.woif--mobile .woif__button {
	height: 48px; /* (48 - 26) / 2 = 11 px */
	padding-top: 11px;
	padding-bottom: 11px;
}

.woif--slidein.woif--mobile .woif__consent {
	margin-top: 8px;
	font-size: 13px;
	line-height: 1.3;
}

.woif--slidein.woif--mobile.woif--done .woif__message {
	font-size: 20px;
}

/* Cross: 44 x 44 hit area, 50 % white; fully white on hover and focus (#ffffff). */
.woif .woif__close {
	position: absolute;
	top: 9px;
	right: 9px;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--woif-radius);
	background: transparent;
	box-shadow: none;
	color: rgba(255, 255, 255, 0.5);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.woif .woif__close:hover,
.woif .woif__close:focus,
.woif .woif__close:focus-visible {
	background: transparent;
	color: #ffffff;
}

.woif .woif__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -4px;
}

.woif .woif__close svg {
	display: block;
	width: 14.13px;
	height: 14.13px;
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	.woif .woif__button {
		transition: none;
	}

	/* Appear without sliding. */
	.woif--slidein,
	.woif--slidein.woif--mobile {
		transform: none;
		transition: none;
	}
}
