/*
Theme Name: Costa Verde
Theme URI: https://ramonage.corsica
Author: Costa Verde Ramonage
Description: Thème block sur mesure pour Costa Verde Ramonage, l'expert du toit en Corse depuis 1999. Palette issue du logo — noir, jaune #FFE400, blanc — avec un accent braise. Aucune dépendance externe : ni page builder, ni police distante, ni bibliothèque JavaScript.
Version: 1.0.0
Requires at least: 6.7
Tested up to: 7.1
Requires PHP: 8.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: costaverde
Tags: block-theme, full-site-editing, business, one-column, custom-colors
*/

/*
 * Presque tout est piloté par theme.json. Cette feuille ne contient que ce que
 * theme.json ne sait pas exprimer : quelques comportements d'interface et les
 * ajustements typographiques fins.
 */

/* --- Accessibilité : cible de focus visible et cohérente ------------------ */
:where(a, button, input, select, textarea, .wp-block-button__link):focus-visible {
	outline: 3px solid var(--wp--preset--color--jaune);
	outline-offset: 2px;
	border-radius: 2px;
}

/* --- Titres : capitales étroites, dans l'esprit du logo ------------------- */
.cv-titre-marque {
	text-transform: uppercase;
	letter-spacing: -0.01em;
	line-height: 1.02;
}

/* --- Le numéro de téléphone, élément le plus important sur mobile --------- */
.cv-tel {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	letter-spacing: 0.01em;
}

/* --- Cartes de prestation : le survol soulève légèrement ------------------ */
.cv-carte {
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.cv-carte:hover,
.cv-carte:focus-within {
	transform: translateY(-3px);
	border-color: var(--wp--preset--color--jaune);
	box-shadow: 0 10px 28px rgb(0 0 0 / 0.10);
}

/* --- Filet jaune sous les titres de section ------------------------------- */
.cv-filet::after {
	content: "";
	display: block;
	width: 3.5rem;
	height: 4px;
	margin-top: 0.7rem;
	background: var(--wp--preset--color--jaune);
}
.has-text-align-center.cv-filet::after {
	margin-inline: auto;
}

/* --- Navigation : soulignement jaune à l'état actif ----------------------- */
.wp-block-navigation .wp-block-navigation-item.current-menu-item > a,
.wp-block-navigation .wp-block-navigation-item > a:hover {
	box-shadow: inset 0 -3px 0 0 var(--wp--preset--color--jaune);
}

/* --- Barre d'appel fixe en bas d'écran, mobile uniquement ----------------- */
.cv-barre-mobile {
	display: none;
}
@media (max-width: 781px) {
	.cv-barre-mobile {
		display: grid;
		grid-template-columns: 1fr 1fr;
		position: fixed;
		inset-inline: 0;
		bottom: 0;
		z-index: 100;
		border-top: 1px solid rgb(255 255 255 / 0.12);
	}
	.cv-barre-mobile a {
		padding: 0.95rem 0.5rem;
		text-align: center;
		font-weight: 700;
		text-decoration: none;
		font-size: 0.95rem;
	}
	/* de quoi ne pas masquer la fin du pied de page */
	body {
		padding-bottom: 3.6rem;
	}
}


/* --- Sections pleine largeur jointives ------------------------------------
 * Chaque section porte son propre rembourrage vertical : l'espacement par
 * défaut entre blocs de premier niveau créerait un liseré clair entre elles.
 */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}
.wp-site-blocks > main > * + * {
	margin-block-start: 0;
}

/* --- Formulaire de demande de rendez-vous ---------------------------------
 * Aucune dépendance JavaScript : la mise en page repose sur une grille qui se
 * réduit à une colonne sous 680 px.
 */
.cv-form {
	margin-top: 1.5rem;
}
.cv-form-grille {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.1rem 1.4rem;
}
.cv-champ--large {
	grid-column: 1 / -1;
}
.cv-champ {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}
.cv-champ label {
	font-weight: 700;
	font-size: 0.95rem;
}
.cv-champ abbr {
	color: var(--wp--preset--color--braise);
	text-decoration: none;
	border: 0;
}
.cv-champ input[type="text"],
.cv-champ input[type="tel"],
.cv-champ input[type="email"],
.cv-champ select,
.cv-champ textarea {
	width: 100%;
	padding: 0.7rem 0.8rem;
	font: inherit;
	color: inherit;
	background: var(--wp--preset--color--blanc);
	border: 1px solid var(--wp--preset--color--pierre);
	border-radius: 0.4rem;
}
.cv-champ input:focus,
.cv-champ select:focus,
.cv-champ textarea:focus {
	border-color: var(--wp--preset--color--jaune);
}
.cv-champ--case label {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	font-weight: 400;
	font-size: 0.9rem;
	line-height: 1.5;
}
.cv-champ--case input {
	margin-top: 0.2rem;
	width: 1.1rem;
	height: 1.1rem;
	flex: 0 0 auto;
}

/* Champ piège : invisible pour l'humain, atteignable par un robot.
   On évite display:none, que certains robots savent détecter. */
/* L'adresse avec suggestions (26 octobre 2026) : Base Adresse Nationale,
   saisie libre si rien ne convient. L'apparition des champs (will-change)
   fait de chacun un calque : le bloc adresse passe au-dessus des suivants. */
.cv-adresse-bloc {
	position: relative;
	z-index: 30;
}

.cv-saisie {
	position: relative;
	display: block;
}

.cv-suggestions {
	position: absolute;
	z-index: 20;
	top: calc(100% + 2px);
	left: 0;
	right: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	max-height: 16rem;
	overflow-y: auto;
	background: #fff;
	border: 1px solid var(--wp--preset--color--pierre, #6b6257);
	border-radius: 6px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}

.cv-suggestions li {
	padding: .65rem .8rem;
	cursor: pointer;
	border-bottom: 1px solid #eee;
	line-height: 1.3;
}

.cv-suggestions li:last-child {
	border-bottom: 0;
}

.cv-suggestions li:hover,
.cv-suggestions li[aria-selected="true"] {
	background: #f6efe6;
}

.cv-aide {
	display: block;
	margin-top: .3rem;
	font-size: .85rem;
	color: var(--wp--preset--color--pierre, #6b6257);
}

.cv-form-piege {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.cv-form-envoi {
	margin-top: 1.6rem;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem;
}
.cv-form-note {
	font-size: 0.9rem;
	color: var(--wp--preset--color--ardoise);
}

.cv-form-message {
	padding: 1.1rem 1.3rem;
	border-radius: 0.5rem;
	margin-bottom: 1.5rem;
	border-left: 5px solid;
}
.cv-form-message--ok {
	background: #f2f8f3;
	border-left-color: #1f7a4d;
}
.cv-form-message--ko {
	background: #fdf3f1;
	border-left-color: var(--wp--preset--color--braise);
}

@media (max-width: 680px) {
	.cv-form-grille {
		grid-template-columns: 1fr;
	}
}

/* --- Galeries : la légende sous la photo, jamais dessus --------------------
 * Par défaut, WordPress pose la légende d'une galerie en bandeau sombre sur
 * l'image. Demande du gérant, 25 septembre 2026 : « pas dans la photo, à
 * côté ». La légende devient un texte sous l'image, dans la couleur du site. */
.wp-block-gallery.has-nested-images figure.wp-block-image {
	display: flex;
	flex-direction: column;
	align-items: stretch;
}
/* :not(#individual-image) reprend la spécificité de la règle de WordPress
   (flex: 1 0 0% ; height: 100 %), qui donne une hauteur nulle à une photo pas
   encore chargée. Ici la boîte a toujours sa hauteur, chargée ou non. */
.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) > img {
	/* !important : la feuille du bloc galerie est imprimée après celle du
	   thème et gagnerait sinon à spécificité égale (constaté le 25/09/2026 :
	   31 photos sur 33 à 0 px tant qu'elles n'étaient pas chargées). */
	flex: 0 0 auto !important;
	aspect-ratio: 4 / 3 !important;
	width: 100% !important;
	height: auto !important;
	object-fit: cover;
	border-radius: 4px;
	background: var(--wp--preset--color--pierre);
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
	position: static;
	bottom: auto;
	width: auto;
	max-height: none;
	margin: 0.45rem 0 0;
	padding: 0;
	background: none;
	color: var(--wp--preset--color--encre, #1A1917);
	font-size: 0.9rem;
	line-height: 1.35;
	text-align: left;
	text-shadow: none;
	overflow: visible;
	-webkit-mask-image: none;
	mask-image: none;
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption a {
	color: inherit;
}


/* ==========================================================================
 * Mouvement et immersion — 25 septembre 2026
 * Demande du gérant : apparitions animées des textes, photos vivantes,
 * grandes images à l'arrivée, style plus élégant, animations visibles mais
 * fluides. Tout est en CSS ; assets/cv-animations.js ne fait que poser des
 * classes. Sans JavaScript ou avec prefers-reduced-motion, rien ne bouge et
 * tout est visible.
 * ========================================================================== */

:root {
	--cv-ease: cubic-bezier(0.22, 0.7, 0.2, 1);
	--cv-duree: 0.95s;
	--cv-decalage: 42px;
}

/* --- Apparitions au défilement -------------------------------------------
 * L'état caché n'existe que si le script a marqué l'élément (.cv-reveal) ;
 * il le révèle (.cv-vu) quand l'élément entre dans l'écran, par observateur
 * d'intersection, avec un filet par mesure directe. Sans script : tout est
 * visible. */
.cv-anime .cv-reveal {
	opacity: 0;
	transform: translate3d(0, var(--cv-decalage), 0);
	transition: none; /* on se cache d'un coup : la transition ne joue qu'à l'apparition */
	will-change: opacity, transform;
}
.cv-anime figure.wp-block-image.cv-reveal {
	transform: translate3d(0, var(--cv-decalage), 0) scale(1.04);
}
.cv-anime .cv-reveal.cv-vu {
	opacity: 1;
	transform: none;
	transition: opacity var(--cv-duree) var(--cv-ease), transform var(--cv-duree) var(--cv-ease);
}

/* --- Bandeau d'ouverture : plein écran, photo qui respire ---------------- */
.cv-hero {
	min-height: 92svh;
	display: flex;
	align-items: flex-end;
}
.cv-hero .wp-block-cover__image-background {
	transform: scale(1.06);
	transform-origin: 50% 40%;
}
.cv-anime .cv-hero .wp-block-cover__image-background {
	animation: cv-respire 22s var(--cv-ease) both;
}
@keyframes cv-respire {
	from { transform: scale(1.12) translate3d(0, 1.5%, 0); }
	to   { transform: scale(1.0) translate3d(0, 0, 0); }
}
.cv-hero .wp-block-cover__background {
	background: linear-gradient(180deg, rgb(0 0 0 / 0.30) 0%, rgb(0 0 0 / 0.18) 35%, rgb(0 0 0 / 0.78) 100%) !important;
	opacity: 1 !important;
}
.cv-hero .wp-block-cover__inner-container {
	padding-bottom: clamp(2rem, 6vh, 4.5rem);
}
/* Chorégraphie d'entrée : chaque élément du bandeau à son tour, en
   animation CSS lancée dès le premier affichage (la classe cv-anime est
   posée dans l'en-tête de la page, avant le premier rendu). */
.cv-anime .cv-hero .wp-block-cover__inner-container > * {
	animation: cv-cascade 1s var(--cv-ease) both;
}
.cv-anime .cv-hero .wp-block-cover__inner-container > :nth-child(1) { animation-delay: 0.25s; }
.cv-anime .cv-hero .wp-block-cover__inner-container > :nth-child(2) { animation-delay: 0.45s; }
.cv-anime .cv-hero .wp-block-cover__inner-container > :nth-child(3) { animation-delay: 0.70s; }
.cv-anime .cv-hero .wp-block-cover__inner-container > :nth-child(4) { animation-delay: 0.92s; }
.cv-anime .cv-hero .wp-block-cover__inner-container > :nth-child(5) { animation-delay: 1.12s; }
@keyframes cv-cascade {
	from { opacity: 0; transform: translate3d(0, 36px, 0); }
	to   { opacity: 1; transform: none; }
}
.cv-hero h1 {
	font-size: clamp(2.6rem, 6.4vw, 5.2rem);
	line-height: 0.98;
	letter-spacing: -0.025em;
	text-wrap: balance;
	text-shadow: 0 2px 24px rgb(0 0 0 / 0.35);
}
.cv-hero .cv-surtitre {
	display: inline-block;
	padding: 0.35rem 0.8rem;
	border: 1px solid rgb(255 228 0 / 0.55);
	border-radius: 2rem;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}
/* Le repère de défilement, discret, qui pulse. */
.cv-hero-indice {
	position: absolute;
	left: 50%;
	bottom: 1.1rem;
	width: 26px;
	height: 42px;
	margin-left: -13px;
	border: 2px solid rgb(255 255 255 / 0.55);
	border-radius: 14px;
	z-index: 2;
}
.cv-hero-indice::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 8px;
	width: 4px;
	height: 8px;
	margin-left: -2px;
	border-radius: 2px;
	background: var(--wp--preset--color--jaune);
	animation: cv-indice 1.8s ease-in-out infinite;
}
@keyframes cv-indice {
	0%   { transform: translateY(0);    opacity: 1; }
	70%  { transform: translateY(14px); opacity: 0; }
	100% { transform: translateY(0);    opacity: 0; }
}
@media (max-width: 781px) {
	.cv-hero { min-height: 86svh; }
	.cv-hero-indice { display: none; }
}

/* --- Bandeaux des pages intérieures : la photo à la une en grand --------- */
.cv-banniere {
	min-height: 56vh;
	display: flex;
	align-items: flex-end;
}
.cv-banniere .wp-block-cover__image-background {
	transform: scale(1.08);
	transform-origin: 50% 45%;
}
.cv-anime .cv-banniere .wp-block-cover__image-background {
	animation: cv-respire 20s var(--cv-ease) both;
}
.cv-banniere .wp-block-cover__background {
	background: linear-gradient(180deg, rgb(0 0 0 / 0.25) 0%, rgb(0 0 0 / 0.20) 40%, rgb(0 0 0 / 0.80) 100%) !important;
	opacity: 1 !important;
}
.cv-banniere h1 {
	font-size: clamp(2.1rem, 5vw, 4rem);
	line-height: 1.02;
	letter-spacing: -0.02em;
	text-wrap: balance;
	text-shadow: 0 2px 20px rgb(0 0 0 / 0.35);
}
.cv-anime .cv-banniere .wp-block-cover__inner-container > * {
	animation: cv-cascade 0.9s var(--cv-ease) both;
	animation-delay: 0.2s;
}
.cv-anime .cv-banniere .wp-block-cover__inner-container > :nth-child(2) { animation-delay: 0.42s; }
@media (max-width: 781px) {
	.cv-banniere { min-height: 44vh; }
}

/* --- En-tête flottant, translucide quand la page défile ------------------ */
/* Collant à partir de la tablette seulement : sur un téléphone, la barre
   d'appel du bas suffit, et un en-tête collant mangerait l'écran. */
@media (min-width: 782px) {
	.wp-site-blocks > header.wp-block-template-part {
		position: sticky;
		top: 0;
		z-index: 90;
	}
}
/* Le bandeau supérieur (accroche, courriel) se replie quand on défile,
   et n'existe pas sur téléphone (demande du gérant, 25 septembre 2026). */
@media (max-width: 781px) {
	.wp-site-blocks > header.wp-block-template-part > .wp-block-group:first-child {
		display: none;
	}
}
.wp-site-blocks > header.wp-block-template-part > .wp-block-group:first-child {
	max-height: 6rem;
	overflow: hidden;
	transition: max-height 0.4s var(--cv-ease), padding 0.4s var(--cv-ease), opacity 0.3s ease;
}
.wp-site-blocks > header.cv-entete--flotte > .wp-block-group:first-child {
	max-height: 0;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	opacity: 0;
}
.cv-entete {
	transition: background-color 0.35s ease, box-shadow 0.35s ease;
}
.cv-entete--flotte .cv-entete {
	background-color: rgb(0 0 0 / 0.78) !important;
	backdrop-filter: blur(14px) saturate(1.2);
	-webkit-backdrop-filter: blur(14px) saturate(1.2);
	box-shadow: 0 8px 30px rgb(0 0 0 / 0.25);
}

/* --- Navigation : soulignement qui glisse -------------------------------- */
.wp-block-navigation .wp-block-navigation-item > a {
	position: relative;
	box-shadow: none !important;
	transition: color 0.25s ease;
}
.wp-block-navigation .wp-block-navigation-item > a::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -4px;
	height: 3px;
	background: var(--wp--preset--color--jaune);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.3s var(--cv-ease);
}
.wp-block-navigation .wp-block-navigation-item.current-menu-item > a::after,
.wp-block-navigation .wp-block-navigation-item > a:hover::after,
.wp-block-navigation .wp-block-navigation-item > a:focus-visible::after {
	transform: scaleX(1);
}

/* --- Boutons : réaction au survol ---------------------------------------- */
.wp-block-button__link {
	transition: transform 0.25s var(--cv-ease), box-shadow 0.25s var(--cv-ease), background-color 0.25s ease, color 0.25s ease;
}
.wp-block-button__link:hover,
.wp-block-button__link:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 10px 24px rgb(0 0 0 / 0.18);
}
.wp-block-button__link:active {
	transform: translateY(0);
	box-shadow: 0 3px 10px rgb(0 0 0 / 0.16);
}

/* --- Cartes de prestation : plus de relief, un accent qui s'allume ------- */
.cv-carte {
	position: relative;
	overflow: hidden;
	transition: transform 0.35s var(--cv-ease), box-shadow 0.35s var(--cv-ease), border-color 0.35s ease;
}
.cv-carte::before {
	content: "";
	position: absolute;
	inset: auto 0 0 0;
	height: 3px;
	background: linear-gradient(90deg, var(--wp--preset--color--jaune), var(--wp--preset--color--braise));
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.45s var(--cv-ease);
}
.cv-carte:hover,
.cv-carte:focus-within {
	transform: translateY(-6px);
	box-shadow: 0 22px 44px rgb(0 0 0 / 0.14);
}
.cv-carte:hover::before,
.cv-carte:focus-within::before {
	transform: scaleX(1);
}
.cv-carte h3 a {
	transition: color 0.25s ease;
}
.cv-carte:hover h3 a {
	color: var(--wp--preset--color--braise);
}

/* --- Photos : coins doux, ombre, zoom lent au survol --------------------- */
main .wp-block-image img,
main .wp-block-gallery figure.wp-block-image img {
	border-radius: 0.6rem;
	transition: transform 0.9s var(--cv-ease), box-shadow 0.4s ease;
}
main .wp-block-gallery figure.wp-block-image > img {
	box-shadow: 0 6px 18px rgb(0 0 0 / 0.08);
}
main .wp-block-gallery figure.wp-block-image:hover > img,
main .wp-block-image:hover img {
	transform: scale(1.03);
	box-shadow: 0 18px 40px rgb(0 0 0 / 0.16);
}

/* --- Chiffres : alignés, prêts à compter --------------------------------- */
.cv-chiffre {
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.03em;
}

/* --- Titres de section : le filet s'étire à l'arrivée -------------------- */
main h2.cv-filet::after {
	transition: width 0.6s var(--cv-ease) 0.25s;
}
.cv-anime main h2.cv-filet.cv-reveal::after {
	width: 0;
}
.cv-anime main h2.cv-filet.cv-reveal.cv-vu::after {
	width: 3.5rem;
}
.cv-chapeau {
	font-size: var(--wp--preset--font-size--moyen);
	color: var(--wp--preset--color--ardoise);
	text-wrap: pretty;
}

/* --- Bande photo « zone » : les toits derrière les communes --------------- */
.cv-bande-photo .wp-block-cover__background {
	background: linear-gradient(180deg, rgb(26 25 23 / 0.86) 0%, rgb(26 25 23 / 0.72) 100%) !important;
	opacity: 1 !important;
}

/* --- Mouvement réduit : NON respecté, décision du gérant du 25/09/2026 ------
 * Son PC a les effets d'animation de Windows désactivés et il veut le
 * mouvement pour tous. Pour le rétablir : ne pas poser la classe cv-anime
 * dans functions.php (cv_classe_mouvement) quand prefers-reduced-motion est actif.
 */
