/*
Theme Name: Courcelles
Theme URI: https://courcelles-les-gisors.fr
Author: Mairie de Courcelles-lès-Gisors
Description: Thème bloc du site officiel de la commune de Courcelles-lès-Gisors. Charte du verger et du plateau : pomme, blé, prune et craie.
Version: 2.0.0
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: courcelles
Tags: block-theme, full-site-editing, accessibility-ready
*/

/* Ce fichier ne contient que ce que theme.json ne sait pas exprimer :
   états de survol, formes composées, décalages. Toute valeur de charte
   passe par une variable de la palette, pour rester modifiable depuis
   Apparence → Styles. */

/* ==========================================================================
   Fondations
   ========================================================================== */

/* Lien d'évitement, injecté par WordPress : on l'habille en pilule. */
.skip-link.screen-reader-text:focus {
	top: 1rem;
	left: 1rem;
	z-index: 99;
	background: var(--wp--preset--color--prune);
	color: var(--wp--preset--color--blanc);
	padding: 0.7rem 1.2rem;
	border-radius: var(--wp--custom--rayon-pilule);
	font-family: var(--wp--preset--font-family--corps);
	font-size: var(--wp--preset--font-size--petit);
	font-weight: 700;
	text-decoration: none;
	box-shadow: none;
}

/* Focus visible partout, en framboise : la couleur ne sert qu'à ça et à
   l'alerte, donc elle ne se confond avec aucun élément décoratif. */
:focus-visible {
	outline: 3px solid var(--wp--preset--color--framboise);
	outline-offset: 3px;
	border-radius: 6px;
}

.wp-block-navigation__responsive-container-close:focus-visible,
.wp-block-navigation__responsive-close:focus-visible {
	outline: 3px solid var(--wp--preset--color--framboise) !important;
	outline-offset: 3px;
}

/* Les liens de titres et de cartes portent leur indication par le bloc,
   pas par un soulignement. */
:where(h1, h2, h3, h4) a,
.lien-discret a {
	color: inherit;
	text-decoration: none;
}

:where(h1, h2, h3, h4) a:hover,
.lien-discret a:hover {
	text-decoration: underline;
}

/* Surlignage au feutre, pour un mot d'un titre. Le blé ne sert jamais de
   couleur de texte : son contraste ne le permet pas. */
.surligne {
	background: linear-gradient(
		transparent 58%,
		var(--wp--preset--color--ble) 58%,
		var(--wp--preset--color--ble) 94%,
		transparent 94%
	);
	padding: 0 0.1em;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition: none !important;
		animation: none !important;
		scroll-behavior: auto !important;
	}

	.sticker,
	.sticker--vert {
		transform: none !important;
	}
}

/* ==========================================================================
   En-tête collant et navigation en pilules
   ========================================================================== */

.entete-collante {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--wp--preset--color--craie) 90%, transparent);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--wp--preset--color--trait);
}

.marque {
	font-family: var(--wp--preset--font-family--titre);
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.05;
}

.wp-block-navigation .wp-block-navigation-item__content {
	display: block;
	padding: 0.5rem 0.85rem;
	border-radius: var(--wp--custom--rayon-pilule);
	text-decoration: none;
	color: var(--wp--preset--color--prune);
	font-weight: 600;
}

.wp-block-navigation .wp-block-navigation-item__content:hover {
	background: var(--wp--preset--color--pomme-clair);
	color: var(--wp--preset--color--pomme);
}

.wp-block-navigation .current-menu-item > .wp-block-navigation-item__content {
	background: var(--wp--preset--color--prune);
	color: var(--wp--preset--color--blanc);
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	border-radius: var(--wp--custom--rayon-petit);
}

/* Champ de recherche en pilule bordée. */
.wp-block-search__inside-wrapper {
	gap: 0.4rem;
}

.wp-block-search__input {
	border: 2px solid var(--wp--preset--color--prune-doux);
	border-radius: var(--wp--custom--rayon-pilule);
	background: var(--wp--preset--color--blanc);
	padding: 0.5rem 1rem;
	font-size: var(--wp--preset--font-size--petit);
	color: var(--wp--preset--color--prune);
}

.wp-block-search__input:focus {
	border-color: var(--wp--preset--color--pomme);
}

.wp-block-search__button {
	margin-left: 0;
	border: 2px solid var(--wp--preset--color--prune);
	background: var(--wp--preset--color--prune);
	color: var(--wp--preset--color--blanc);
	border-radius: var(--wp--custom--rayon-pilule);
	padding: 0.5rem 1.1rem;
	font-size: var(--wp--preset--font-size--petit);
	font-weight: 700;
}

.wp-block-search__button:hover {
	background: var(--wp--preset--color--pomme);
	border-color: var(--wp--preset--color--pomme);
}

/* ==========================================================================
   Hero : pilules de tâches
   ========================================================================== */

/* Étiquette d'état, en haut du hero. */
.etiquette-etat {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	background: var(--wp--preset--color--pomme-clair);
	color: var(--wp--preset--color--pomme);
	font-weight: 700;
	font-size: var(--wp--preset--font-size--petit);
	padding: 0.4rem 0.95rem;
	border-radius: var(--wp--custom--rayon-pilule);
}

/* Nuage de pilules « vous cherchez quoi ? ».
   Chaque paragraphe contenant un lien devient une pilule : la mairie ajoute
   ou retire une entrée en ajoutant un paragraphe, sans toucher au code. */
.pilules {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

.pilules p {
	margin: 0;
}

.pilules a {
	display: inline-block;
	background: var(--wp--preset--color--blanc);
	border: 2px solid var(--wp--preset--color--prune);
	border-radius: var(--wp--custom--rayon-pilule);
	padding: 0.7rem 1.2rem;
	text-decoration: none;
	color: var(--wp--preset--color--prune);
	font-weight: 700;
	box-shadow: 3px 3px 0 var(--wp--preset--color--prune);
	transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.pilules a:hover {
	transform: translate(3px, 3px);
	box-shadow: 0 0 0 var(--wp--preset--color--prune);
	color: var(--wp--preset--color--prune);
}

.pilules p:nth-child(3n + 1) a:hover {
	background: var(--wp--preset--color--ble);
}

.pilules p:nth-child(3n + 2) a:hover {
	background: var(--wp--preset--color--pomme-clair);
}

.pilules p:nth-child(3n + 3) a:hover {
	background: var(--wp--preset--color--framboise-clair);
}

/* ==========================================================================
   En-tête de section
   ========================================================================== */

.tete-section {
	align-items: flex-end;
}

.tete-section .lien-plus a {
	font-weight: 700;
	text-decoration: none;
	color: var(--wp--preset--color--pomme);
	border-bottom: 2px solid var(--wp--preset--color--ble);
	padding-bottom: 2px;
}

.tete-section .lien-plus a:hover {
	border-bottom-color: var(--wp--preset--color--pomme);
}

/* ==========================================================================
   Blocs colorés : démarches, enfance
   ========================================================================== */

.bloc-couleur {
	border: 2px solid var(--wp--preset--color--prune);
	border-radius: var(--wp--custom--rayon);
	padding: 1.4rem 1.3rem 1.5rem;
	transition: transform 0.12s ease;
	height: 100%;
}

.bloc-couleur:hover {
	transform: translateY(-4px);
}

.bloc-couleur p {
	margin: 0;
}

.bloc-couleur p + p {
	margin-top: 0.25rem;
}

.bloc-couleur a {
	text-decoration: none;
	color: inherit;
}

.bloc-couleur a:hover {
	text-decoration: underline;
}

/* La couleur tourne d'une carte à l'autre : la mairie ajoute une carte sans
   avoir à choisir un fond. */
.blocs-colores .wp-block-column:nth-child(4n + 1) .bloc-couleur {
	background: var(--wp--preset--color--pomme-clair);
}

.blocs-colores .wp-block-column:nth-child(4n + 2) .bloc-couleur {
	background: var(--wp--preset--color--ble-clair);
}

.blocs-colores .wp-block-column:nth-child(4n + 3) .bloc-couleur {
	background: var(--wp--preset--color--framboise-clair);
}

.blocs-colores .wp-block-column:nth-child(4n + 4) .bloc-couleur {
	background: var(--wp--preset--color--blanc);
}

/* ==========================================================================
   Cartes d'actualité
   ========================================================================== */

.carte-actu {
	background: var(--wp--preset--color--blanc);
	border: 2px solid var(--wp--preset--color--prune);
	border-radius: var(--wp--custom--rayon);
	overflow: hidden;
	height: 100%;
	transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.carte-actu:hover {
	transform: translateY(-4px);
	box-shadow: 0 10px 0 -2px var(--wp--preset--color--prune);
}

.carte-actu .wp-block-post-featured-image {
	margin: 0;
	border-bottom: 2px solid var(--wp--preset--color--prune);
	background: var(--wp--preset--color--pomme-clair);
}

.carte-actu .wp-block-post-date,
.carte-actu .wp-block-post-title,
.carte-actu .wp-block-post-excerpt {
	padding-left: 1.2rem;
	padding-right: 1.2rem;
}

.carte-actu .wp-block-post-date {
	padding-top: 1.15rem;
}

/* La date en pastille blé. */
.carte-actu .wp-block-post-date time {
	display: inline-block;
	background: var(--wp--preset--color--ble);
	color: var(--wp--preset--color--prune);
	font-weight: 700;
	padding: 0.22rem 0.6rem;
	border-radius: var(--wp--custom--rayon-pilule);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.carte-actu .wp-block-post-excerpt {
	padding-bottom: 1.4rem;
}

/* ==========================================================================
   Sticker : alerte et encarts d'appel
   ========================================================================== */

.sticker {
	border-radius: var(--wp--custom--rayon);
	padding: 1.1rem 1.4rem;
	transform: rotate(-0.6deg);
}

.sticker--vert {
	transform: rotate(0.5deg);
	background: var(--wp--preset--color--pomme);
	color: var(--wp--preset--color--blanc);
}

.sticker--vert a {
	color: var(--wp--preset--color--blanc);
	font-weight: 700;
}

/* ==========================================================================
   Fiches simples : associations, zones du PLU
   ========================================================================== */

.fiche {
	background: var(--wp--preset--color--blanc);
	border: 2px solid var(--wp--preset--color--trait);
	border-radius: var(--wp--custom--rayon);
	padding: 1.3rem;
	height: 100%;
}

.fiche:hover {
	border-color: var(--wp--preset--color--pomme);
}

.fiche p {
	margin: 0;
}

.fiche p + p {
	margin-top: 0.5rem;
}

/* Pastille de code de zone.
   WordPress ajoute un généreux remplissage à tout paragraphe qui porte une
   couleur de fond : sans l'annuler, la pastille s'étire en rectangle et
   pousse le nom de la zone à la ligne. */
.puce-zone {
	padding: 0 !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: var(--wp--custom--rayon-petit);
	font-family: var(--wp--preset--font-family--titre);
	font-weight: 800;
	font-size: 1.1rem;
	color: var(--wp--preset--color--blanc);
	flex: 0 0 auto;
}

/* ==========================================================================
   Liste de documents à télécharger
   ========================================================================== */

.liste-docs {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.6rem;
}

.liste-docs li {
	margin: 0;
}

.liste-docs a {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 0.9rem;
	background: var(--wp--preset--color--blanc);
	border: 2px solid var(--wp--preset--color--trait);
	border-radius: var(--wp--custom--rayon-petit);
	padding: 0.85rem 1.1rem;
	text-decoration: none;
	color: var(--wp--preset--color--prune);
	font-weight: 700;
}

.liste-docs a:hover {
	border-color: var(--wp--preset--color--pomme);
	background: var(--wp--preset--color--pomme-clair);
	color: var(--wp--preset--color--prune);
}

/* ==========================================================================
   Conseil municipal
   ========================================================================== */

.prochaine-seance {
	background: var(--wp--preset--color--ble);
	border-radius: var(--wp--custom--rayon);
	padding: 1.3rem 1.5rem;
}

.prochaine-seance p {
	margin: 0;
}

.prochaine-seance a {
	color: var(--wp--preset--color--prune);
	font-weight: 700;
}

/* ==========================================================================
   Pied de page
   ========================================================================== */

.pied-grand-titre {
	font-family: var(--wp--preset--font-family--titre);
	font-weight: 800;
	letter-spacing: -0.03em;
	line-height: 1;
}

.pied-rubrique {
	font-family: var(--wp--preset--font-family--corps);
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.14em;
}

/* ==========================================================================
   Listes sans puce, dans le pied de page et les encadrés
   ========================================================================== */

.wp-block-list.is-style-sans-puce {
	list-style: none;
	padding-left: 0;
}

.wp-block-list.is-style-sans-puce li {
	margin-bottom: 0.5rem;
}

/* ==========================================================================
   Mesure de lecture du hero

   Une largeur maximale posée sur un bloc en disposition « contenue » le
   centre automatiquement. Ici on veut une ligne courte mais alignée à
   gauche : on rétablit donc explicitement la marge droite.
   ========================================================================== */

.hero-titre {
	max-width: 14ch;
	margin-right: auto;
	margin-left: 0;
}

.hero-accroche {
	max-width: 44ch;
	margin-right: auto;
	margin-left: 0;
}

/* Le champ de recherche de l'en-tête ne doit pas écraser la navigation
   quand la place manque : il passe à la ligne plutôt que de rétrécir. */
.entete-collante .wp-block-search {
	flex: 0 0 auto;
}

.entete-collante .wp-block-search__input {
	min-width: 0;
}

/* Sur petit écran, le champ de recherche prend la largeur restante à côté du
   bouton de menu plutôt que de tronquer son texte d'invite. */
@media (max-width: 600px) {
	.entete-collante .wp-block-search {
		flex: 1 1 auto;
		min-width: 0;
	}

	.entete-collante .wp-block-search__inside-wrapper {
		width: 100%;
	}

	.entete-collante .wp-block-search__input {
		flex: 1 1 auto;
	}
}
