/* ============================================================
   MSI-LFI : habillage « à la manière de mantes-sud-insoumis.fr » (structure) — polices = charte LFI
   Reproduit l'esprit visuel du site Framer d'origine :
   - violet LFI rgb(123,19,214) = #7b13d6 (couleur dominante)
   - rouge #f91616 (accents, dates)
   - jaune #ffec00 (surbrillance)
   - texte sombre rgb(17,17,17), surfaces claires #f2f2f2
   - titres Public Sans Black, corps Gowun Batang (charte LFI)
   - boutons pleine largeur / grosses pastilles arrondies
   ============================================================ */

:root {
	--msi-violet: #7b13d6;
	--msi-rouge: #f91616;
	--msi-jaune: #ffec00;
	--msi-encre: #111111;
	--msi-surface: #f2f2f2;
}

/* --- Base typographique conforme à la charte LFI ---
   Corps : Gowun Batang (règle globale dans msi-lfi.css).
   Ici on ne force que le contraste et la couleur d'encre. */
body,
p,
.wp-block-post-content,
.wp-block-post-excerpt {
	color: var(--msi-encre, #111111);
}

/* Les titres restent violets (déjà définis dans theme.json) */

/* --- Boutons « pastille » : violet plein, hover rouge, coins très arrondis --- */
.wp-block-button__link,
.wp-element-button,
button:not(.msi-burger),
input[type="submit"] {
	background-color: var(--msi-violet, #7b13d6) !important;
	color: #ffffff !important;
	border-radius: 999px;
	padding: 0.8em 1.6em;
	font-weight: 700;
	letter-spacing: 0.01em;
	box-shadow: 0 2px 10px rgba(123, 19, 214, 0.25);
	transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.wp-block-button__link:hover,
.wp-element-button:hover,
button:not(.msi-burger):hover,
input[type="submit"]:hover {
	background-color: var(--msi-rouge, #f91616) !important;
	transform: translateY(-2px);
	box-shadow: 0 4px 14px rgba(249, 22, 22, 0.3);
}

/* --- Cartes de contenu (événements / communications) : surface grise claire, coins arrondis --- */
.wp-block-post-excerpt,
.wp-block-group.card-msi,
.home-carte-evenement,
.home-carte-communication {
	background-color: var(--msi-surface, #f2f2f2);
	border-radius: 14px;
	padding: 1.25rem;
	transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.wp-block-post-excerpt:hover,
.home-carte-evenement:hover,
.home-carte-communication:hover {
	box-shadow: 0 6px 18px rgba(17, 17, 17, 0.12);
	transform: translateY(-2px);
}

/* --- Dates en rouge (déjà en theme.json, renforcé ici) --- */
.wp-block-post-date {
	font-weight: 600;
}

/* --- Surlignage jaune pour les mots-clés (balise <mark>) --- */
mark,
.mark-msi {
	background-color: var(--msi-jaune, #ffec00);
	color: var(--msi-encre, #111111);
	padding: 0.05em 0.25em;
	border-radius: 4px;
}

/* --- Formulaire d'enquête / contact : champs arrondis comme l'original --- */
input[type="text"],
input[type="email"],
textarea,
select {
	border-radius: 10px;
	border: 2px solid #e0e0e0;
	background: #ffffff;
	font-family: 'Public Sans', sans-serif;
	padding: 0.6em 0.9em;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
	border-color: var(--msi-violet, #7b13d6);
	outline: none;
	box-shadow: 0 0 0 3px rgba(123, 19, 214, 0.15);
}

/* --- Pied de page : violet plein, texte blanc, pastilles réseaux sociaux --- */
footer.wp-block-template-part {
	background-color: var(--msi-violet, #7b13d6);
	color: #ffffff;
}

footer.wp-block-template-part a {
	color: #ffffff;
}

/* --- En-tête : géré par msi-header.css (bandeau blanc 80px, ombre douce) --- */

/* --- Mobile : le menu devient visible via burger (msi-header.css) --- */
@media (max-width: 900px) {
	.msi-nav-mobile {
		display: none;
	}
}

/* --- Badge « Groupe d'action La France insoumise » --- */
.badge-msi {
	display: inline-block;
	font-family: 'Public Sans', sans-serif;
	font-weight: 600;
	font-size: 0.85em;
	background: var(--msi-jaune, #ffec00);
	color: var(--msi-encre, #111111);
	border-radius: 999px;
	padding: 0.25em 0.8em;
}

/* --- Accessibilité : focus visible --- */
a:focus-visible,
button:focus-visible {
	outline: 3px solid var(--msi-rouge, #f91616);
	outline-offset: 2px;
}

/* --- Écrans étroits : réduire l'ombrage des cartes --- */
@media (max-width: 640px) {
	.home-carte-evenement,
	.home-carte-communication,
	.wp-block-post-excerpt {
		transform: none;
	}
}
/* --- Événements : date en rouge, lieu en italique gris --- */
.msi-event-date {
	font-family: 'Public Sans', sans-serif;
	font-weight: 700;
	color: var(--msi-rouge, #f91616);
	margin: 0.15em 0;
}

.msi-event-lieu {
	font-style: italic;
	font-size: 0.95em;
	color: #444444;
	margin: 0.15em 0 0.5em;
}

/* ============================================================
   HEADER FIXE + collage du contenu sous le bandeau
   - Le bandeau reste en haut à l'écran (fixed, plein écran).
   - body et wp-site-blocks reçoivent un padding-top égal à la
     hauteur du bandeau : aucun espace entre header et contenu,
     le hero commence exactement sous la barre.
   - Neutralise les marges WordPress (1.2rem) sur les enfants de
     wp-site-blocks pour toutes les pages (accueil, articles...).
   ============================================================ */

body {
	--msi-scroll-padding: var(--msi-hauteur-header, 80px);
	scroll-padding-top: var(--msi-hauteur-header, 80px);
}

body,
.wp-site-blocks {
	padding-top: var(--msi-hauteur-header, 80px) !important;
}

.msi-header {
	position: fixed !important;
	top: 0;
	left: 0;
	right: 0;
	width: 100%;
	max-width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

/* Supprime les marges verticales inter-blocs générées par WP
   entre le header (template part) et le contenu de la page. */
.wp-site-blocks > .wp-block-template-part,
.wp-site-blocks > .wp-block-template-part > .msi-header {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}

/* Le contenu (post-content) ne doit jamais décoller du header */
.wp-site-blocks > .wp-block-post-content {
	margin-top: 0 !important;
}

/* Ajuste la hauteur du hero : plein écran moins le bandeau */
.msi-hero {
	min-height: calc(100vh - var(--msi-hauteur-header, 80px)) !important;
}

/* ============================================================
   HERO plein écran (page Accueil) — comme mantes-sud-insoumis.fr :
   VIDÉO plein écran sans déformation (object-fit: cover, crop OK),
   texte centré blanc avec ombre portée.
   ============================================================ */

/* Le cover sort du conteneur contraint : pleine largeur du viewport */
.entry-content > .msi-hero,
.wp-block-post-content > .msi-hero,
.msi-main > .msi-hero {
	width: 100vw;
	max-width: 100vw;
	margin-right: calc(50% - 50vw);
	margin-left: calc(50% - 50vw);
}

/* Pleine hauteur d'écran MOINS le header (80px) */
.msi-hero {
	min-height: calc(100vh - var(--msi-hauteur-header, 80px)) !important;
	position: relative;
	overflow: hidden;
}

/* La vidéo : couvre TOUT le cadre, sans déformation, crop si nécessaire */
.msi-hero .msi-hero-video {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 100%;
	height: 100%;
	transform: translate(-50%, -50%);
	object-fit: cover;
	object-position: center center;
	z-index: -2;
}

/* Voile charbon 40 % au-dessus de la vidéo */
.msi-hero::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(33, 35, 32, 0.4);
	z-index: -1;
	pointer-events: none;
}

/* Contenu : centré verticalement, au-dessus du voile */
.msi-hero .wp-block-cover__inner-container,
.msi-hero .wp-block-cover__inner-container .wp-block-group {
	height: 100%;
	display: flex !important;
	flex-direction: column !important;
	justify-content: center !important;
	align-items: center;
	z-index: 1;
}

/* Les textes restent centrés horizontalement, sans décalage vertical */
.msi-hero .wp-block-cover__inner-container .wp-block-group {
	height: auto;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

.msi-hero-title {
	text-shadow: 0px 0px 6px #000000;
}

.msi-hero-subtitle {
	text-shadow: 0px 0px 6px #000000;
}

.msi-hero-city {
	font-size: 0.95rem;
	text-shadow: 0px 0px 6px #000000;
	margin: 0.1em 0 0 !important;
}

.msi-hero-city.msi-hero-first {
	margin-top: 1.2em !important;
}

/* Mobile : hauteur correcte sur iOS (100svh dynamique), toujours moins le header */
@supports (height: 100svh) {
	.msi-hero {
		min-height: calc(100svh - var(--msi-hauteur-header, 80px)) !important;
	}
}

/* ============================================================
   FORMULAIRE Contact Form 7 (page Nous (re)joindre)
   Champs empilés, labels gras Public Sans, inputs arrondis.
   ============================================================ */

.wpcf7 form {
	display: flex;
	flex-direction: column;
	gap: 1.1rem;
	max-width: 560px;
}

.wpcf7 label {
	display: block;
	font-family: 'Public Sans', sans-serif;
	font-weight: 700;
	font-size: 0.95rem;
	color: #111111;
}

.wpcf7 form .wpcf7-form-control {
	width: 100%;
	margin-top: 0.35rem;
}

.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 select,
.wpcf7 textarea {
	border: 2px solid #e0e0e0;
	border-radius: 10px;
	padding: 0.7em 1em;
	font-family: 'Gowun Batang', serif;
	font-size: 1rem;
	background: #ffffff;
}

.wpcf7 input:focus,
.wpcf7 select:focus,
.wpcf7 textarea:focus {
	border-color: var(--msi-violet, #7b13d6);
	outline: none;
	box-shadow: 0 0 0 3px rgba(123, 19, 214, 0.15);
}

.wpcf7 .wpcf7-acceptance {
	font-family: 'Gowun Batang', serif;
	font-weight: 400;
	font-size: 0.95rem;
}

.wpcf7 .wpcf7-acceptance input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: var(--msi-violet, #7b13d6);
	vertical-align: middle;
	margin-right: 0.5rem;
}

.wpcf7 .wpcf7-submit {
	align-self: flex-start;
	background-color: var(--msi-violet, #7b13d6) !important;
	color: #ffffff !important;
	border: none;
	border-radius: 8px;
	padding: 0.8em 2em;
	font-family: 'Public Sans', sans-serif;
	font-weight: 700;
	font-size: 1rem;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.wpcf7 .wpcf7-submit:hover {
	background-color: var(--msi-rouge, #f91616) !important;
}

.wpcf7 .wpcf7-not-valid-tip {
	color: var(--msi-rouge, #f91616);
	font-size: 0.85rem;
	margin-top: 0.25rem;
}

.wpcf7 .wpcf7-response-output {
	border: 2px solid var(--msi-violet, #7b13d6);
	border-radius: 8px;
	padding: 0.8em 1em;
	font-family: 'Public Sans', sans-serif;
}

/* ============================================================
   CARTES ÉVÉNEMENTS / COMMUNICATIONS (grille responsive)
   ============================================================ */

.msi-cards-grid {
	display: grid;
	/* 3 cartes par ligne quand la largeur le permet */
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1.25rem;
	/* Sortir du conteneur contraint (960px) : occuper la largeur utile (1320px max) */
	width: min(1320px, calc(100vw - 40px));
	margin-left: calc((960px - min(1320px, calc(100vw - 40px))) / 2);
	margin-right: calc((960px - min(1320px, calc(100vw - 40px))) / 2);
}

/* Responsive : 2 puis 1 colonne */
@media (max-width: 980px) {
	.msi-cards-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 680px) {
	.msi-cards-grid {
		grid-template-columns: 1fr;
		width: 100%;
		margin-left: 0;
		margin-right: 0;
	}
}

.msi-card {
	background-color: var(--msi-surface, #f2f2f2);
	border-radius: 14px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.msi-card:hover {
	box-shadow: 0 6px 18px rgba(17, 17, 17, 0.12);
	transform: translateY(-2px);
}

.msi-card-img {
	display: block;
	aspect-ratio: 16/9;
	overflow: hidden;
}

.msi-card-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.msi-card-body {
	padding: 1.1rem 1.25rem 1.25rem;
	display: flex;
	flex-direction: column;
	flex: 1;
}

.msi-card-title {
	font-family: 'Public Sans', sans-serif !important;
	font-weight: 800 !important;
	font-size: 1.15rem !important;
	line-height: 1.25;
	margin: 0 0 0.4rem !important;
	color: var(--msi-violet, #7b13d6);
}

.msi-card-title a {
	color: inherit;
	text-decoration: none;
}

.msi-card-title a:hover {
	color: var(--msi-rouge, #f91616);
}

.msi-card-date {
	font-family: 'Public Sans', sans-serif;
	font-weight: 700;
	color: var(--msi-rouge, #f91616);
	font-size: 0.9rem;
	margin: 0 0 0.25rem;
}

.msi-card-lieu {
	font-style: italic;
	font-size: 0.9rem;
	color: #444444;
	margin: 0 0 0.5rem;
}

.msi-card-excerpt {
	font-family: 'Gowun Batang', serif;
	font-size: 0.95rem;
	line-height: 1.5;
	margin: 0 0 0.75rem;
	flex: 1;
}

.msi-card-more {
	font-family: 'Public Sans', sans-serif;
	font-weight: 700;
	font-size: 0.9rem;
	color: var(--msi-violet, #7b13d6);
	text-decoration: none;
	align-self: flex-start;
}

.msi-card-more:hover {
	color: var(--msi-rouge, #f91616);
}

.msi-empty {
	font-family: 'Gowun Batang', serif;
	font-style: italic;
	color: #666666;
}

/* Hub événements : titres de sections */
.msi-hub-title {
	margin-top: 2.5rem !important;
}

.msi-hub-title-passes {
	margin-top: 3rem !important;
}

/* ============================================================
   PAGINATION (page Nos communications)
   ============================================================ */

.msi-pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 0.5rem;
	margin-top: 2.5rem;
}

.msi-pagination a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	height: 42px;
	padding: 0 0.8em;
	border-radius: 8px;
	font-family: 'Public Sans', sans-serif;
	font-weight: 700;
	font-size: 0.95rem;
	color: var(--msi-encre, #111111);
	text-decoration: none;
	background-color: var(--msi-surface, #f2f2f2);
	transition: background-color 0.15s ease, color 0.15s ease;
}

.msi-pagination a:hover {
	background-color: rgba(123, 19, 214, 0.12);
	color: var(--msi-violet, #7b13d6);
}

.msi-pagination a.is-current {
	background-color: var(--msi-violet, #7b13d6);
	color: #ffffff;
}

/* ============================================================
   ÉTAT DU BOUTON ENVOYER (désactivé tant que le formulaire
   n'est pas complet : champs requis + autorisation cochée)
   ============================================================ */

.wpcf7 .wpcf7-submit:disabled,
.wpcf7 form.msi-form-incomplete .wpcf7-submit {
	opacity: 0.45;
	cursor: not-allowed;
	filter: grayscale(0.6);
	transform: none !important;
	box-shadow: none !important;
}

/* Le champ de consentement et son libellé sur une ligne */
.wpcf7 .wpcf7-acceptance .acceptance-label,
.wpcf7 .wpcf7-acceptance {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

/* Lien discret vers les mentions RGPD sous l'acceptation */
.msi-form-rgpd {
	font-family: 'Public Sans', sans-serif;
	font-size: 0.82rem;
	color: #666666;
	margin: -0.5rem 0 0 !important;
}

.msi-form-rgpd a {
	color: #666666;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.msi-form-rgpd a:hover {
	color: var(--msi-violet, #7b13d6);
}

/* ============================================================
   Image mise en avant (articles + événements) :
   dans la zone de texte (largeur du contenu), pas pleine page.
   object-fit contain, max-height 25em.
   ============================================================ */

/* Alignwide sort du conteneur : on le ramène dans la zone de contenu */
.wp-block-post-featured-image.alignwide,
.wp-block-post-featured-image.alignfull {
	width: 100%;
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}

/* L image elle-même : contain (pas de crop), max 25em de haut.
   !important : neutralise les styles inline object-fit:cover des blocs. */
.wp-block-post-featured-image img {
	width: auto;
	max-width: 100%;
	max-height: 25em;
	object-fit: contain !important;
	margin-left: auto;
	margin-right: auto;
	display: block;
}

/* ============================================================
   Vidéos insérées dans les articles (bloc Vidéo Gutenberg) :
   comportement identique aux images mises en avant.
   La figure prend toute la largeur du contenu, la vidéo reste
   en contain (pas de crop), 100% de large, 25em de haut max.
   !important : neutralise l aspect-ratio 1080/1920 posé en style
   inline par WordPress sur les vidéos verticales.
   ============================================================ */

/* La figure reste dans la largeur du contenu, la vidéo est centrée */
.wp-block-video {
	width: 100%;
	max-width: 100%;
	margin-left: auto;
	margin-right: auto;
}

/* Le cadre de la vidéo épouse le format réel du film (pas de
   letterbox) : les contrôles natifs couvrent alors exactement la
   vidéo, et rien ne dépasse jamais la largeur du texte
   (max-width: 100% + max-height: 25em). */
.wp-block-video video {
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 25em;
	object-fit: contain !important;
	margin-left: auto;
	margin-right: auto;
	display: block;
}

/* Légende du bloc vidéo, alignée sur les légendes d'images */
.wp-block-video figcaption {
	font-family: 'Public Sans', sans-serif;
	font-size: 0.85em;
	color: var(--wp--preset--color--lfi-charbon, #212320);
	text-align: center;
	margin-top: 0.4em;
}
