/* SG-Popups — estilos do site (e da pré-visualização no backoffice, que os carrega tal e qual) */

/* Lato (SIL Open Font License) — alojada no plugin: sem pedidos a terceiros (RGPD). */
@font-face {
	font-family: "SG Lato";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/lato-latin-400-normal.woff2") format("woff2");
}

@font-face {
	font-family: "SG Lato";
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/lato-latin-400-italic.woff2") format("woff2");
}

@font-face {
	font-family: "SG Lato";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/lato-latin-700-normal.woff2") format("woff2");
}

@font-face {
	font-family: "SG Lato";
	font-style: italic;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/lato-latin-700-italic.woff2") format("woff2");
}

@font-face {
	font-family: "SG Lato";
	font-style: normal;
	font-weight: 900;
	font-display: swap;
	src: url("../fonts/lato-latin-900-normal.woff2") format("woff2");
}

.apq-root {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 100%;
	height: 100vh;
	height: 100dvh;
	padding: var(--apq-edge, 16px);
	background: rgba(0, 0, 0, 0.65);
}

.apq-root.apq-valign-top {
	align-items: flex-start;
}

.apq-root[hidden] {
	display: none;
}

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

/* Janela: nunca excede o ecrã visível; o conteúdo desloca-se dentro dela. */
.apq-root .apq-dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: var(--apq-maxw, 640px);
	min-height: min(var(--apq-minh, 0px), 100%);
	max-height: 100%;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	color: var(--apq-text, #fff);
	border-radius: var(--apq-radius, 16px);
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
	font-size: 1rem;
	line-height: 1.5;
}

.apq-root .apq-dialog.apq-font-lato {
	font-family: "SG Lato", "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.apq-root .apq-dialog:focus {
	outline: none;
}

/* Botão de fechar: sempre visível (fica colado ao topo quando há deslocamento). */
.apq-root .apq-close {
	position: sticky;
	top: 0;
	z-index: 2;
	flex: 0 0 auto;
	align-self: flex-end;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.45em;
	min-width: 44px;
	min-height: 44px;
	margin: 12px 12px 0;
	padding: 0.4em 1em;
	font: inherit;
	font-size: var(--apq-close-size, 1rem);
	font-weight: var(--apq-close-w, 700);
	line-height: 1.2;
	color: var(--apq-close-fg, #000);
	background: var(--apq-close-bg, #fff);
	border: var(--apq-close-bw, 2px) solid var(--apq-close-bc, #000);
	border-radius: var(--apq-close-r, 999px);
	cursor: pointer;
	text-transform: none;
	letter-spacing: normal;
}

.apq-root.apq-close-left .apq-close {
	align-self: flex-start;
}

.apq-root .apq-close:hover {
	filter: brightness(0.92);
}

.apq-root .apq-close-icon {
	flex: 0 0 auto;
	width: 1em;
	height: 1em;
}

/* "Só ícone": o texto continua disponível para leitores de ecrã. */
.apq-root.apq-closestyle-icon .apq-close {
	padding: 0.4em;
}

.apq-root.apq-closestyle-icon .apq-close .apq-close-label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.apq-root.apq-closestyle-text .apq-close .apq-close-icon {
	display: none;
}

.apq-root .apq-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex: 1 1 auto;
	justify-content: center;
	gap: var(--apq-gap, 16px);
	padding: var(--apq-pad-t, 8px) min(var(--apq-pad-x, 40px), max(20px, 5vw)) min(var(--apq-pad-b, 40px), max(24px, 5vw));
	text-align: center;
}

.apq-align-left .apq-content {
	align-items: flex-start;
	text-align: left;
}

/* SVG sem dimensões próprias (width/height 100%) não tem tamanho natural: usa a largura definida. */
.apq-root .apq-image {
	display: block;
	width: auto;
	max-width: min(100%, var(--apq-imgw, 220px));
	height: auto;
	margin: 0;
}

.apq-root .apq-image[src*=".svg"] {
	width: min(100%, var(--apq-imgw, 220px));
}

/* Título: tamanho escolhido no backoffice, reduzido de forma fluida em ecrãs pequenos. */
.apq-root .apq-title {
	margin: 0;
	padding: 0;
	font-size: clamp(calc(var(--apq-title-size, 2.5rem) * 0.65), 5vw, var(--apq-title-size, 2.5rem));
	font-weight: var(--apq-title-w, 700);
	text-transform: var(--apq-title-tt, none);
	line-height: 1.2;
	color: var(--apq-title-color, inherit);
	overflow-wrap: anywhere;
}

.apq-root .apq-body {
	font-size: var(--apq-body-size, 1.125rem);
	font-weight: var(--apq-body-w, 400);
	line-height: var(--apq-body-lh, 1.5);
	color: var(--apq-body-color, inherit);
	overflow-wrap: anywhere;
}

.apq-root .apq-body strong,
.apq-root .apq-body b {
	font-weight: 700;
}

.apq-root .apq-body > :first-child {
	margin-top: 0;
}

.apq-root .apq-body > :last-child {
	margin-bottom: 0;
}

.apq-root .apq-body p {
	margin: 0 0 1em;
}

.apq-root .apq-body ul,
.apq-root .apq-body ol {
	margin: 0 0 1em;
	padding-left: 1.5em;
	text-align: left;
}

.apq-root .apq-body a {
	color: inherit;
	text-decoration: underline;
}

.apq-root .apq-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--apq-btn-gap, 12px);
	justify-content: center;
	width: 100%;
}

.apq-align-left .apq-actions {
	justify-content: flex-start;
}

.apq-root .apq-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 48px;
	min-height: 48px;
	padding: var(--apq-btn-pad, 0.6em 1.6em);
	font: inherit;
	font-size: var(--apq-btn-fs, 1.125rem);
	font-weight: var(--apq-btn-w, 700);
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	text-transform: var(--apq-btn-tt, none);
	color: var(--apq-btn-fg, #0b3d66);
	background: var(--apq-btn-bg, #fff);
	border: var(--apq-btn-bw, 2px) solid var(--apq-btn-bc, #0b3d66);
	border-radius: var(--apq-btn-r, 999px);
	cursor: pointer;
}

.apq-root .apq-btn--full {
	flex: 1 1 100%;
	width: 100%;
}

.apq-root .apq-btn:hover,
.apq-root .apq-btn:focus-visible {
	color: var(--apq-btn-hfg, var(--apq-btn-fg, #0b3d66));
	background: var(--apq-btn-hbg, var(--apq-btn-bg, #fff));
	text-decoration: underline;
}

/* Indicador de foco de dois tons: visível sobre qualquer fundo (WCAG 2.4.7 / 2.4.11). */
.apq-root a:focus-visible,
.apq-root button:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 0;
	box-shadow: 0 0 0 6px #000;
}

@supports not selector(:focus-visible) {
	.apq-root a:focus,
	.apq-root button:focus {
		outline: 3px solid #fff;
		outline-offset: 0;
		box-shadow: 0 0 0 6px #000;
	}
}

/* Texto só para leitores de ecrã. */
.apq-root .apq-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------ *
 * Animações de entrada e saída.
 * O efeito, a duração e os estados inicial/final vêm de variáveis CSS
 * definidas no popup (--apq-in-o/t, --apq-out-o/t, --apq-dur).
 * Só correm se o utilizador não pediu movimento reduzido.
 * ------------------------------------------------------------------ */

@keyframes apq-bd-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes apq-bd-out {
	from { opacity: 1; }
	to { opacity: 0; }
}

@keyframes apq-in {
	from { opacity: var(--apq-in-o, 0); transform: var(--apq-in-t, none); }
	to { opacity: 1; transform: none; }
}

@keyframes apq-out {
	from { opacity: 1; transform: none; }
	to { opacity: var(--apq-out-o, 0); transform: var(--apq-out-t, none); }
}

@media (prefers-reduced-motion: no-preference) {
	.apq-root.apq-anim-in {
		animation: apq-bd-in var(--apq-dur, 250ms) ease-out both;
	}

	.apq-root.apq-anim-in .apq-dialog {
		animation: apq-in var(--apq-dur, 250ms) ease-out both;
	}

	.apq-root.apq-anim-out {
		pointer-events: none;
		animation: apq-bd-out var(--apq-dur, 250ms) ease-in both;
	}

	.apq-root.apq-anim-out .apq-dialog {
		animation: apq-out var(--apq-dur, 250ms) ease-in both;
	}

	.apq-root[data-anim-in="none"].apq-anim-in,
	.apq-root[data-anim-in="none"].apq-anim-in .apq-dialog,
	.apq-root[data-anim-out="none"].apq-anim-out,
	.apq-root[data-anim-out="none"].apq-anim-out .apq-dialog {
		animation: none;
	}
}

/* Telemóvel: ocupa no máximo o ecrã visível, botões fáceis de tocar. */
@media (max-width: 600px) {
	.apq-root {
		padding: min(var(--apq-edge, 16px), 8px);
	}

	.apq-root .apq-dialog {
		border-radius: min(var(--apq-radius, 16px), 12px);
	}

	.apq-root .apq-actions {
		flex-direction: column;
	}

	.apq-root .apq-btn {
		width: 100%;
	}
}

/* Modo de alto contraste do sistema. */
@media (forced-colors: active) {
	.apq-root .apq-dialog {
		border: 2px solid CanvasText;
		background: Canvas !important;
		color: CanvasText;
	}

	.apq-root .apq-btn,
	.apq-root .apq-close {
		forced-color-adjust: auto;
		border-color: ButtonText;
	}

	.apq-root a:focus-visible,
	.apq-root button:focus-visible {
		outline: 3px solid Highlight;
		box-shadow: none;
	}
}

/* Pré-visualização: o conteúdo é o do site; apenas não é interativo. */
.apq-root.apq-is-preview .apq-close,
.apq-root.apq-is-preview .apq-btn {
	cursor: default;
}
