/**
 * PLQ Vote — styles front-end.
 *
 * Les couleurs suivent les variables Salient/Nectar du thème quand elles
 * existent, avec repli sur les valeurs PLQ. Pour forcer une valeur, redéfinir
 * la variable dans le CSS additionnel du thème :
 *   :root { --plqv-red: #ce0e2d; }
 */

:root {
	--plqv-red: var(--nectar-accent-color, #d3242e);
	--plqv-red-dark: var(--nectar-extra-color-1, #a81a23);
	--plqv-ink: #101820;
	--plqv-muted: #5c6672;
	--plqv-grey: #f7f7f7;
	--plqv-border: #d9dce1;
	--plqv-white: #ffffff;
	--plqv-radius: 2px;
	--plqv-max: 1040px;
}

/* --- Typographie : tout hérite du thème -------------------------------- */

.plqv-modal,
.plqv-modal *,
.plqv-inline,
.plqv-inline * {
	font-family: inherit;
	box-sizing: border-box;
}

/* Les éléments de formulaire n'héritent pas de la police par défaut :
   on force explicitement, sinon ils rendent en police système. */
.plqv-modal button,
.plqv-modal input,
.plqv-modal select,
.plqv-modal textarea,
.plqv-modal legend,
.plqv-inline button,
.plqv-inline input,
.plqv-inline select,
.plqv-inline textarea,
.plqv-inline legend {
	font-family: inherit;
	-webkit-appearance: none;
	appearance: none;
}

.plqv-modal input[type="checkbox"],
.plqv-modal input[type="radio"],
.plqv-inline input[type="checkbox"],
.plqv-inline input[type="radio"] {
	-webkit-appearance: auto;
	appearance: auto;
}

/* Le thème applique `font-weight: 200 !important` sur body, p et h3.
   On le neutralise à l'intérieur de la modale — d'où les !important, qui sont
   nécessaires pour gagner contre une règle déjà !important. */
.plqv-modal .plqv-display,
.plqv-modal .plqv-title,
.plqv-modal .plqv-eyebrow,
.plqv-modal .plqv-sublegend,
.plqv-modal .plqv-legend,
.plqv-modal .plqv-box,
.plqv-modal .plqv-btn,
.plqv-modal .plqv-field label,
.plqv-modal .plqv-success h3,
.plqv-inline .plqv-title,
.plqv-inline .plqv-sublegend,
.plqv-inline .plqv-legend,
.plqv-inline .plqv-btn,
.plqv-inline .plqv-field label,
.plqv-inline .plqv-success h3 {
	font-family: inherit;
	font-weight: 800 !important;
}

/* Le texte courant reste lisible : 400 plutôt que le 200 du thème. */
.plqv-modal .plqv-intro,
.plqv-modal .plqv-privacy,
.plqv-modal .plqv-consent,
.plqv-modal .plqv-choice span,
.plqv-modal .plqv-field input,
.plqv-inline .plqv-intro,
.plqv-inline .plqv-privacy,
.plqv-inline .plqv-consent,
.plqv-inline .plqv-choice span,
.plqv-inline .plqv-field input {
	font-weight: 400 !important;
}

/* --- Conteneur ---------------------------------------------------------- */

.plqv-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	overflow-y: auto;
	line-height: 1.5;
	color: var(--plqv-ink);
}

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

.plqv-modal__overlay {
	position: fixed;
	inset: 0;
	background: rgba(16, 24, 32, 0.72);
	animation: plqv-fade 0.2s ease-out;
}

.plqv-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 620px;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	background: var(--plqv-white);
	border-radius: var(--plqv-radius);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
	animation: plqv-rise 0.25s ease-out;
}

.plqv-modal__dialog--form {
	max-width: 860px;
}

.plqv-modal__dialog--split {
	max-width: var(--plqv-max);
	display: grid;
	grid-template-columns: 1fr 1.15fr;
}

@keyframes plqv-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes plqv-rise {
	from { opacity: 0; transform: translateY(16px); }
	to { opacity: 1; transform: none; }
}

.plqv-modal .plqv-modal__close {
	position: absolute;
	top: 8px;
	right: 12px;
	z-index: 2;
	width: 40px;
	height: 40px;
	min-height: 0;
	padding: 0;
	font-size: 30px;
	line-height: 1;
	color: var(--plqv-ink);
	background: none;
	border: 0;
	box-shadow: none;
	cursor: pointer;
}

.plqv-modal .plqv-modal__close:hover,
.plqv-modal .plqv-modal__close:focus {
	color: var(--plqv-red);
	background: none;
}

/* --- Panneau gauche ----------------------------------------------------- */

.plqv-modal__aside {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 56px 48px;
	color: var(--plqv-white);
	background: var(--plqv-red);
}

.plqv-modal .plqv-eyebrow {
	margin: 0 0 16px;
	font-size: 23px;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--plqv-white);
	opacity: 0.9;
}

.plqv-modal .plqv-display {
	margin: 0;
	font-size: 64px;
	font-weight: 800;
	line-height: 0.95;
	letter-spacing: -0.02em;
	color: var(--plqv-white);
}

/* --- Panneau droit ------------------------------------------------------ */

.plqv-modal__main {
	display: flex;
	flex-direction: column;
	justify-content: center;
	/* `safe` évite que le haut du contenu soit rogné s'il dépasse la hauteur. */
	justify-content: safe center;
	padding: 56px 48px;
	background: var(--plqv-grey);
}

/* Le panneau du plan de vote héberge un formulaire : plus large, plus dense. */
.plqv-modal__main--wide {
	justify-content: flex-start;
	padding: 44px 52px;
	background: var(--plqv-white);
}

.plqv-modal .plqv-title,
.plqv-inline .plqv-title {
	margin: 0 0 12px;
	font-size: 28px;
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -0.01em;
	color: var(--plqv-ink);
}

.plqv-modal__dialog--split .plqv-title {
	display: none; /* le titre visuel vit dans le panneau de couleur */
}

.plqv-modal .plqv-intro,
.plqv-inline .plqv-intro {
	margin: 0 0 22px;
	font-size: 16px;
	line-height: 1.5;
	color: var(--plqv-ink);
}

/* --- Click boxes -------------------------------------------------------- */

.plqv-boxes {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.plqv-modal a.plqv-box,
.plqv-modal button.plqv-box {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 18px 22px;
	font-size: 16px;
	font-weight: 700;
	text-align: left;
	text-decoration: none;
	color: var(--plqv-red);
	background: var(--plqv-white);
	border: 2px solid var(--plqv-red);
	border-radius: var(--plqv-radius);
	box-shadow: none;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.plqv-modal a.plqv-box:hover,
.plqv-modal a.plqv-box:focus,
.plqv-modal button.plqv-box:hover,
.plqv-modal button.plqv-box:focus {
	color: var(--plqv-white);
	background: var(--plqv-red);
}

.plqv-modal .plqv-box--primary {
	color: var(--plqv-white);
	background: var(--plqv-red);
}

.plqv-modal .plqv-box--primary:hover,
.plqv-modal .plqv-box--primary:focus {
	background: var(--plqv-red-dark);
	border-color: var(--plqv-red-dark);
}

/* --- Boutons ------------------------------------------------------------ */

.plqv-btn {
	display: inline-block;
	padding: 14px 28px;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	border: 2px solid var(--plqv-red);
	border-radius: var(--plqv-radius);
	box-shadow: none;
	cursor: pointer;
}

.plqv-btn--solid,
.plqv-modal button.plqv-btn--solid {
	color: var(--plqv-white);
	background: var(--plqv-red);
}

.plqv-btn--solid:hover,
.plqv-btn--solid:focus,
.plqv-modal button.plqv-btn--solid:hover {
	color: var(--plqv-white);
	background: var(--plqv-red-dark);
	border-color: var(--plqv-red-dark);
}

.plqv-btn--outline {
	color: var(--plqv-red);
	background: transparent;
}

.plqv-btn--outline:hover,
.plqv-btn--outline:focus {
	color: var(--plqv-white);
	background: var(--plqv-red);
}

.plqv-btn--block {
	display: block;
	width: 100%;
}

/* --- Étapes ------------------------------------------------------------- */

.plqv-modal .plqv-stepper {
	margin: 0 0 6px;
	font-size: 12px;
	font-weight: 700 !important;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--plqv-red);
}

.plqv-step[hidden] {
	display: none;
}

/* Étape 1 : les deux groupes de choix côte à côte. */
.plqv-cols {
	display: grid;
	grid-template-columns: 1.25fr 1fr;
	align-items: start;
	gap: 28px;
	margin-bottom: 24px;
}

.plqv-cols .plqv-fieldset {
	margin: 0;
}

.plqv-choices--stack {
	flex-direction: column;
}

.plqv-choices--stack .plqv-choice {
	min-width: 0;
}

.plqv-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.plqv-modal .plqv-back,
.plqv-inline .plqv-back {
	padding: 8px 0;
	font-size: 14px;
	font-weight: 700 !important;
	color: var(--plqv-muted);
	background: none;
	border: 0;
	box-shadow: none;
	cursor: pointer;
}

.plqv-modal .plqv-back:hover,
.plqv-inline .plqv-back:hover {
	color: var(--plqv-red);
}

/* --- Formulaire --------------------------------------------------------- */

.plqv-form__message {
	margin-bottom: 20px;
	padding: 12px 16px;
	font-size: 14px;
	color: var(--plqv-red-dark);
	background: #fdecec;
	border-left: 3px solid var(--plqv-red);
}

.plqv-fieldset {
	margin: 0 0 18px;
	padding: 0;
	border: 0;
}

.plqv-modal .plqv-legend,
.plqv-inline .plqv-legend {
	display: block;
	float: none;
	width: auto;
	margin-bottom: 0;
	padding: 0;
	font-size: 17px;
	line-height: 1.3;
	font-weight: 800;
	color: var(--plqv-ink);
}

.plqv-sublegend {
	display: block;
	min-height: 16px;
	margin: 12px 0 6px;
	font-size: 12px;
	line-height: 16px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--plqv-muted);
}

.plqv-choices {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	align-items: stretch;
}

/* Une seule case occupant toute la largeur de la colonne. */
.plqv-sublegend--spacer {
	visibility: hidden;
}

.plqv-choices--single,
.plqv-choices--stack {
	grid-template-columns: minmax(0, 1fr);
}

.plqv-modal .plqv-choice,
.plqv-inline .plqv-choice {
	position: relative;
	display: flex;
	margin: 0;
	padding: 0;
	font-weight: 400;
}

.plqv-choice input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.plqv-choice span {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 10px 14px;
	font-size: 15px;
	font-weight: 600;
	text-align: center;
	color: var(--plqv-ink);
	background: var(--plqv-white);
	border: 2px solid var(--plqv-border);
	border-radius: var(--plqv-radius);
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.plqv-choice input:checked + span {
	color: var(--plqv-white);
	background: var(--plqv-red);
	border-color: var(--plqv-red);
}

.plqv-choice input:focus-visible + span {
	outline: 2px solid var(--plqv-ink);
	outline-offset: -2px;
}

.plqv-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
	margin-bottom: 16px;
}

.plqv-field {
	margin: 0;
}

.plqv-field--full {
	grid-column: 1 / -1;
}

.plqv-modal .plqv-field label,
.plqv-inline .plqv-field label {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 700;
	color: var(--plqv-ink);
}

.plqv-optional {
	font-weight: 400;
	color: var(--plqv-muted);
}

.plqv-modal .plqv-field input[type="text"],
.plqv-modal .plqv-field input[type="email"],
.plqv-modal .plqv-field input[type="tel"],
.plqv-inline .plqv-field input[type="text"],
.plqv-inline .plqv-field input[type="email"],
.plqv-inline .plqv-field input[type="tel"] {
	width: 100%;
	height: auto;
	margin: 0;
	padding: 10px 12px;
	font-size: 15px;
	line-height: 1.4;
	color: var(--plqv-ink);
	background: var(--plqv-white);
	border: 2px solid var(--plqv-border);
	border-radius: var(--plqv-radius);
	box-shadow: none;
}

.plqv-modal .plqv-field input:focus,
.plqv-inline .plqv-field input:focus {
	border-color: var(--plqv-red);
	outline: none;
}

.plqv-field input[aria-invalid="true"] {
	border-color: var(--plqv-red);
	background: #fdf3f3;
}

.plqv-consents {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 18px;
}

.plqv-consent {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin: 0;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.4;
	cursor: pointer;
}

.plqv-modal .plqv-consent input[type="checkbox"],
.plqv-inline .plqv-consent input[type="checkbox"] {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin: 1px 0 0;
	accent-color: var(--plqv-red);
}

.plqv-privacy {
	margin: 0 0 18px;
	font-size: 15px;
	line-height: 1.4;
	color: var(--plqv-ink);
}

.plqv-privacy a {
	color: var(--plqv-red);
	text-decoration: underline;
}

.plqv-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.plqv-success {
	padding: 32px 0;
	text-align: center;
}

.plqv-modal .plqv-success h3,
.plqv-inline .plqv-success h3 {
	margin: 0 0 8px;
	font-size: 26px;
	font-weight: 800;
	color: var(--plqv-red);
}

.plqv-is-loading {
	opacity: 0.6;
	pointer-events: none;
}

/* --- Version en ligne (shortcode) --------------------------------------- */

.plqv-inline {
	max-width: 720px;
	margin: 0 auto;
	padding: 40px;
	color: var(--plqv-ink);
	background: var(--plqv-grey);
	border-radius: var(--plqv-radius);
}

.plqv-inline .plqv-title {
	display: block;
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 900px) {
	.plqv-modal {
		padding: 0;
		align-items: flex-start;
	}

	.plqv-modal__dialog,
	.plqv-modal__dialog--split {
		max-width: none;
		max-height: 100vh;
		min-height: 100vh;
		grid-template-columns: 1fr;
		border-radius: 0;
	}

	.plqv-modal__aside {
		padding: 64px 28px 32px;
	}

	.plqv-modal .plqv-display {
		font-size: 44px;
	}

	.plqv-modal .plqv-eyebrow {
		font-size: 18px;
	}

	.plqv-modal__main {
		padding: 32px 28px 56px;
	}

	.plqv-grid {
		grid-template-columns: 1fr;
	}

	.plqv-sublegend--spacer {
		display: none;
	}

	.plqv-cols {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.plqv-modal__main--wide {
		padding: 32px 28px 56px;
	}

	.plqv-actions {
		flex-direction: column-reverse;
		align-items: stretch;
	}

	.plqv-actions .plqv-btn {
		width: 100%;
	}
}

/* Verrouillage du défilement de la page sous la modale */
body.plqv-modal-open {
	overflow: hidden;
}
