/**
 * Bloc « Calendrier de disponibilités » — styles front (lecture seule).
 * Chargé uniquement quand le bloc est présent (RGESN).
 * RGAA : indisponibilité signalée par texture + barré (pas la seule couleur),
 * contrastes ≥ 4.5:1, focus clavier visible. prefers-reduced-motion respecté.
 */

.vv-cal {
	--vv-cal-dispo: var( --wp--preset--color--vert-vv, #50614e );
	--vv-cal-line: #d9d6ce;
	--vv-cal-text: #2b2b2b;
	--vv-cal-muted: #6b6b6b;

	max-width: 480px;
	margin-inline: auto;
	color: var( --vv-cal-text );
}

.vv-cal.alignwide,
.vv-cal.alignfull {
	max-width: 640px;
}

/* En-tête : navigation + mois affiché */
.vv-cal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
}

.vv-cal__title {
	flex: 1 1 auto;
	text-align: center;
	font-weight: 600;
	font-size: 1.1rem;
	text-transform: capitalize;
}

.vv-cal__nav {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	font-size: 1.25rem;
	line-height: 1;
	color: var( --vv-cal-text );
	background: transparent;
	border: 1px solid var( --vv-cal-line );
	border-radius: 2px;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.vv-cal__nav:hover:not( :disabled ) {
	background-color: var( --vv-cal-dispo );
	border-color: var( --vv-cal-dispo );
	color: #fff;
}

.vv-cal__nav:focus-visible {
	outline: 2px solid var( --vv-cal-dispo );
	outline-offset: 2px;
}

.vv-cal__nav:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

/* Grille */
.vv-cal__grid {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
}

.vv-cal__dow {
	padding: 0.4rem 0;
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --vv-cal-muted );
	text-align: center;
}

.vv-cal__dow abbr {
	text-decoration: none;
	border: 0;
	cursor: help;
}

.vv-cal__cell {
	position: relative;
	height: 2.6rem;
	text-align: center;
	vertical-align: middle;
	font-size: 0.95rem;
	border: 1px solid var( --vv-cal-line );
}

.vv-cal__cell--empty {
	border: 0;
}

.vv-cal__num {
	position: relative;
	z-index: 1;
}

/* Disponible : fond clair, pastille de la couleur du thème (repère non textuel) */
.vv-cal__cell--dispo {
	background-color: #fff;
	font-weight: 600;
}

.vv-cal__cell--dispo .vv-cal__mark::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 0.3rem;
	transform: translateX( -50% );
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background-color: var( --vv-cal-dispo );
}

/* Indisponible : texture hachurée + numéro barré (signal non coloré, RGAA) */
.vv-cal__cell--indispo {
	color: var( --vv-cal-muted );
	background-color: #f1efe9;
	background-image: repeating-linear-gradient(
		135deg,
		transparent,
		transparent 4px,
		rgba( 43, 43, 43, 0.14 ) 4px,
		rgba( 43, 43, 43, 0.14 ) 5px
	);
}

.vv-cal__cell--indispo .vv-cal__num {
	text-decoration: line-through;
	text-decoration-thickness: 1.5px;
}

/* Passé : très atténué, non sélectionnable visuellement */
.vv-cal__cell--past {
	color: #b6b2a8;
	background-color: #faf9f6;
}

/* Légende */
.vv-cal__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	justify-content: center;
	margin: 0.9rem 0 0;
	padding: 0;
	list-style: none;
	font-size: 0.85rem;
	color: var( --vv-cal-muted );
}

.vv-cal__legend-item {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
}

.vv-cal__legend-swatch {
	display: inline-block;
	width: 1rem;
	height: 1rem;
	border: 1px solid var( --vv-cal-line );
}

.vv-cal__legend-item--dispo .vv-cal__legend-swatch {
	background-color: #fff;
	position: relative;
}

.vv-cal__legend-item--dispo .vv-cal__legend-swatch::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate( -50%, -50% );
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background-color: var( --vv-cal-dispo );
}

.vv-cal__legend-item--indispo .vv-cal__legend-swatch {
	background-color: #f1efe9;
	background-image: repeating-linear-gradient(
		135deg,
		transparent,
		transparent 3px,
		rgba( 43, 43, 43, 0.18 ) 3px,
		rgba( 43, 43, 43, 0.18 ) 4px
	);
}

/* Texte réservé aux lecteurs d'écran (repli si le thème ne le fournit pas) */
.vv-cal .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

@media ( prefers-reduced-motion: reduce ) {
	.vv-cal__nav {
		transition: none;
	}
}
