/*!
 * FLOW44 Calendrier de disponibilités — styles côté visiteur.
 *
 * Toutes les valeurs viennent des variables CSS posées sur .f44cal par le réglage du calendrier.
 * Pour surcharger dans un thème : .f44cal { --f44-booked: #000; } ou #f44cal-1 { … }.
 * Les règles « reset » neutralisent les styles de tableaux et de boutons des thèmes (Impreza…).
 */

.f44cal {
	--f44-title-lh: 1.3;
	position: relative;
	box-sizing: border-box;
	padding: var(--f44-pad, 0);
	background: var(--f44-bg, transparent);
	font-family: var(--f44-font, inherit);
	color: var(--f44-free-text, #1a1a1a);
}
.f44cal *,
.f44cal *::before,
.f44cal *::after { box-sizing: border-box; }

.f44cal__name {
	margin: 0 0 .75em;
	font-size: var(--f44-title-fs, 18px);
	font-weight: var(--f44-title-fw, 600);
	line-height: var(--f44-title-lh);
	color: var(--f44-title, #1a1a1a);
}

.f44cal__body { position: relative; }

.f44cal__loading,
.f44cal__error {
	margin: 0;
	font-size: var(--f44-fs, 14px);
	opacity: .7;
}

/* --- Grille des mois ------------------------------------------------ */

.f44cal__grid {
	display: grid;
	grid-template-columns: repeat(var(--f44-cols-d, 2), minmax(0, 1fr));
	gap: var(--f44-month-gap, 32px);
}
@media (max-width: 1024px) {
	.f44cal__grid { grid-template-columns: repeat(var(--f44-cols-t, 2), minmax(0, 1fr)); }
}
@media (max-width: 600px) {
	.f44cal__grid { grid-template-columns: repeat(var(--f44-cols-m, 1), minmax(0, 1fr)); }
	/* Mois empilés : inutile de garder la 6e rangée vide qui sert à aligner les mois côte à côte. */
	.f44cal .f44cal__table tr.is-empty-row { display: none; }
}
.f44cal--week .f44cal__grid { grid-template-columns: minmax(0, 1fr); }

/* --- Tableau (reset des styles du thème) ----------------------------- */

.f44cal table.f44cal__table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: separate;
	border-spacing: var(--f44-gap, 3px);
	table-layout: fixed;
	background: none;
}
.f44cal .f44cal__table th,
.f44cal .f44cal__table td {
	padding: 0;
	border: 0;
	background: none;
	line-height: 1.2;
	vertical-align: middle;
	text-align: center;
}
.f44cal .f44cal__table tr { background: none; }

.f44cal .f44cal__title {
	caption-side: top;
	padding: 0 2.2em .6em;
	font-size: var(--f44-title-fs, 18px);
	font-weight: var(--f44-title-fw, 600);
	line-height: var(--f44-title-lh);
	text-transform: var(--f44-title-tt, none);
	text-align: center;
	color: var(--f44-title, #1a1a1a);
}

.f44cal .f44cal__table th {
	padding-bottom: .35em;
	font-size: var(--f44-wd-fs, 12px);
	font-weight: 500;
	text-transform: none;
	color: var(--f44-weekday, #6b6b6b);
}

/* --- Cases ------------------------------------------------------------ */

.f44cal td.f44cal__day {
	position: relative;
	border-radius: var(--f44-radius, 4px);
	background: var(--f44-free);
	color: var(--f44-free-text);
	font-size: var(--f44-fs, 14px);
	font-variant-numeric: tabular-nums;
	box-shadow: inset 0 0 0 1px var(--f44-border, transparent);
}
.f44cal__in {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 1;
}
.f44cal[data-ratio="auto"] .f44cal__in { aspect-ratio: auto; padding: .6em 0; }
.f44cal--week .f44cal__in { aspect-ratio: auto; min-height: 3.2em; padding: .5em 0; }

.f44cal__mo {
	font-size: .7em;
	line-height: 1.1;
	opacity: .75;
}

/* Réservé (toute la journée). */
.f44cal td.f44cal__day.is-booked {
	background: var(--f44-booked);
	color: var(--f44-booked-text);
}
/* Hachures : repère visuel qui ne dépend pas de la couleur (accessibilité). */
.f44cal td.f44cal__day.is-hatch,
.f44cal .f44cal__swatch.is-hatch {
	background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .22) 0 2px, transparent 2px 7px);
}

/* Jour d'arrivée : matin libre (haut-gauche), après-midi réservé (bas-droite). */
.f44cal td.f44cal__day.is-arrival,
.f44cal .f44cal__swatch.is-arrival {
	background: linear-gradient(to bottom right, var(--f44-free) 50%, var(--f44-booked) 50%);
}
/* Jour de départ : matin réservé, après-midi libre. */
.f44cal td.f44cal__day.is-departure {
	background: linear-gradient(to bottom right, var(--f44-booked) 50%, var(--f44-free) 50%);
}
/* Départ + arrivée le même jour : réservé, avec un filet de séparation. */
.f44cal td.f44cal__day.is-changeover {
	background: linear-gradient(to bottom right, var(--f44-booked) calc(50% - 1px), var(--f44-free) calc(50% - 1px) calc(50% + 1px), var(--f44-booked) calc(50% + 1px));
	color: var(--f44-booked-text);
}
.f44cal td.f44cal__day.is-arrival .f44cal__num,
.f44cal td.f44cal__day.is-departure .f44cal__num {
	/* Chiffre lisible sur les deux moitiés. */
	text-shadow: 0 0 3px var(--f44-free), 0 0 3px var(--f44-free);
}

/* Jours passés. */
.f44cal td.f44cal__day.is-past-grey {
	background: var(--f44-past);
	color: var(--f44-past-text);
	text-shadow: none;
}
.f44cal td.f44cal__day.is-past-grey .f44cal__num { text-shadow: none; }
.f44cal td.f44cal__day.is-past-hidden {
	background: transparent;
	box-shadow: none;
}

/* Jour courant. */
.f44cal td.f44cal__day.is-today {
	box-shadow: inset 0 0 0 2px var(--f44-today, #1a1a1a);
}
.f44cal td.f44cal__day.is-today .f44cal__num { font-weight: 700; }

/* Cases hors du mois. */
.f44cal td.f44cal__day.is-empty {
	background: transparent;
	box-shadow: none;
}
.f44cal td.f44cal__day.is-outside {
	background: transparent;
	box-shadow: none;
	color: var(--f44-past-text);
	opacity: .6;
}

/* --- Navigation ------------------------------------------------------ */

.f44cal__nav {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1;
	display: flex;
	justify-content: space-between;
	align-items: center;
	height: calc(var(--f44-title-fs, 18px) * var(--f44-title-lh));
	pointer-events: none;
}
.f44cal .f44cal__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2em;
	height: 2em;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: var(--f44-nav, #1a1a1a);
	font: inherit;
	font-size: var(--f44-title-fs, 18px);
	line-height: 1;
	cursor: pointer;
	pointer-events: auto;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color .15s;
}
.f44cal .f44cal__btn:hover { background: rgba(127, 127, 127, .14); }
.f44cal .f44cal__btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.f44cal .f44cal__btn[disabled] { opacity: .25; cursor: default; background: transparent; }
.f44cal .f44cal__btn svg { width: .9em; height: .9em; }

/* --- Légende ---------------------------------------------------------- */

.f44cal .f44cal__legend {
	display: flex;
	flex-wrap: wrap;
	gap: .5em 1.5em;
	margin: 1em 0 0;
	padding: 0;
	list-style: none;
	font-size: var(--f44-fs, 14px);
	color: var(--f44-legend, #1a1a1a);
}
.f44cal .f44cal__legend li {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
}
.f44cal .f44cal__legend li::before { content: none; }
.f44cal__swatch {
	display: inline-block;
	width: 1.15em;
	height: 1.15em;
	margin-right: .5em;
	border-radius: calc(var(--f44-radius, 4px) / 2);
	box-shadow: inset 0 0 0 1px var(--f44-border, transparent);
}
.f44cal__swatch.is-free { background-color: var(--f44-free); }
.f44cal__swatch.is-booked { background-color: var(--f44-booked); }

/* --- Utilitaires ------------------------------------------------------ */

.f44cal__sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Mode contraste élevé (Windows) : les couleurs disparaissent, on garde un repère. */
@media (forced-colors: active) {
	.f44cal td.f44cal__day.is-booked,
	.f44cal td.f44cal__day.is-changeover { outline: 2px solid CanvasText; outline-offset: -4px; }
	.f44cal td.f44cal__day.is-today { outline: 2px dashed Highlight; }
}

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