/* ==========================================================================
   Composants partagés : icônes, boutons (règle C8), outils à icône, sélecteur segmenté, interrupteur,
   pastille d'inscription, infobulles, menu de langue, champ.
   Couleurs : uniquement les jetons de tokens.css. Aucun soulignement sur un composant.
   Identité : « vie, chaleur, sens ». Le violet et le lavande portent l'interface, l'or est un accent rare
   (aucun dégradé doré, aucune ombre dorée). Le seul dégradé de bouton est le violet de « S'inscrire » (front-layout.css).
   ========================================================================== */

/* --- Icônes -------------------------------------------------------------- */

.icon {
  display: inline-block;
  flex: none;
  width: 1.25em;
  height: 1.25em;
  vertical-align: middle;
}

.icon--sm {
  width: 1em;
  height: 1em;
}

.icon--lg {
  width: 1.5em;
  height: 1.5em;
}

/* --- Boutons (C8) : 32 / 40 / 44 px de haut, rayon 8 px, icône obligatoire, jamais soulignés ------------
   Famille variée, à plat : plein (UN seul par zone), contour, doux, discret, lien. « accent » (or) est réservé
   à l'appel à l'action du héros. Chaque variante a son propre effet de survol ; le texte ne change jamais de couleur. */

.btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: var(--h-md);
  padding: 0 var(--s4);
  border: 2px solid transparent;
  border-radius: var(--rayon-bouton);
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s;
}

.btn--sm {
  height: var(--h-sm);
  padding: 0 var(--s3);
  font-size: var(--fs-sm);
}

.btn--lg {
  height: var(--h-lg);
  padding: 0 var(--s5);
}

.btn--icon {
  width: var(--h-md);
  padding: 0;
}

.btn--icon.btn--sm {
  width: var(--h-sm);
}

.btn--icon.btn--lg {
  width: var(--h-lg);
}

.btn:active {
  transform: translateY(1px);
}

/* Plein : violet, texte blanc. Le seul bouton plein dominant d'une zone. Survol : le violet s'éclaircit. */
.btn--primary {
  color: var(--blanc);
  background: var(--violet);
}

.btn--primary:hover {
  background: var(--violet-2);
}

/* Contour : fond blanc, cadre violet. Survol : teinte lavande. */
.btn--secondary {
  color: var(--violet);
  background: var(--blanc);
  border-color: var(--violet);
}

.btn--secondary:hover {
  background: var(--violet-pale);
}

/* Doux : fond lavande. Survol : lavande plus soutenu. */
.btn--soft {
  color: var(--violet);
  background: var(--violet-pale);
}

.btn--soft:hover {
  background: var(--fond-2);
}

/* Discret (fantôme) : sans fond ni cadre. Survol : voile lavande. */
.btn--ghost {
  color: var(--violet);
  background: transparent;
}

.btn--ghost:hover {
  background: var(--violet-pale);
}

/* Lien : texte et icône, aucun soulignement (C8). Survol : l'icône avance de 2 px, rien d'autre ne bouge. */
.btn--link {
  padding-inline: var(--s2);
  color: var(--violet-2);
  background: transparent;
}

.btn--link .icon {
  transition: transform 0.15s;
}

.btn--link:hover .icon {
  transform: translateX(2px);
}

/* Or : RÉSERVÉ à l'appel à l'action du héros (lot L3a). À plat, sans dégradé ni ombre. Survol : or plus clair. */
.btn--accent {
  color: var(--violet);
  background: var(--or);
}

.btn--accent:hover {
  background: var(--or-clair);
}

/* Sur fond sombre (pied de page). */
.on-dark .btn--ghost {
  color: var(--blanc);
}

.on-dark .btn--ghost:hover {
  background: color-mix(in srgb, var(--blanc) 14%, transparent);
}

/* Désactivé et chargement. */
.btn:disabled,
.btn[aria-disabled="true"] {
  color: var(--encre-2);
  background: var(--fond-2);
  border-color: var(--ligne);
  cursor: not-allowed;
  transform: none;
}

.btn.is-loading {
  cursor: progress;
}

.btn.is-loading .icon {
  animation: btn-spin 1s linear infinite;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

.btn__label {
  display: inline-block;
}

/* --- Pastille d'icône teintée : un carré à coins de 8 px aux couleurs de la rubrique (data-tint sur un parent) ---- */

.pastille {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--rayon-bouton);
  color: var(--tint-icone, var(--violet));
  background: var(--tint-fond, var(--violet-pale));
}

/* --- Outil à icône seule (barre du haut) : sans bordure ; au survol, un petit rond lavande -------------- */

.tool {
  position: relative;
  display: inline-grid;
  flex: none;
  place-items: center;
  width: var(--h-sm);
  height: var(--h-sm);
  padding: 0;
  border: 0;
  border-radius: 50%;
  font: inherit;
  color: var(--violet);
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s;
}

.tool:hover,
.tool[aria-expanded="true"],
details[open] > .tool {
  background: var(--violet-pale);
}

/* --- Infobulle (survol ET focus clavier) : fond violet profond, flèche, coins de 6 px. Échap la ferme (front-tooltip.js) : WCAG 1.4.13. --- */

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  right: -4px;
  z-index: var(--z-skip);
  padding: 5px var(--s3);
  border-radius: var(--rayon-panneau);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--blanc);
  background: var(--violet);
  /* Absente de la mise en page tant qu'elle n'est pas affichée : une infobulle masquée ne crée jamais de défilement. */
  display: none;
}

/* La flèche : un petit carré tourné, de la couleur de l'infobulle. */
[data-tooltip]::before {
  content: "";
  position: absolute;
  top: calc(100% + 5px);
  right: 11px;
  z-index: var(--z-skip);
  width: 10px;
  height: 10px;
  background: var(--violet);
  transform: rotate(45deg);
  display: none;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after,
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::before {
  display: block;
}

.tool[aria-expanded="true"]::after,
.tool[aria-expanded="true"]::before,
details[open] > [data-tooltip]::after,
details[open] > [data-tooltip]::before,
[data-tooltip][data-tooltip-dismissed]::after,
[data-tooltip][data-tooltip-dismissed]::before {
  display: none !important;
}

/* Avec JavaScript, l'infobulle est un élément unique (front-tooltip.js) centré sous son déclencheur et recalé dans l'écran. */
.js [data-tooltip]::after,
.js [data-tooltip]::before {
  display: none !important;
}

.tooltip {
  position: fixed;
  z-index: var(--z-skip);
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 5px var(--s3);
  border-radius: var(--rayon-panneau);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.4;
  color: var(--blanc);
  background: var(--violet);
}

/* La flèche pointe TOUJOURS le centre du déclencheur, même quand l'infobulle est recalée (--arrow-x). */
.tooltip::before {
  content: "";
  position: absolute;
  top: -5px;
  left: calc(var(--arrow-x, 50%) - 5px);
  width: 10px;
  height: 10px;
  background: var(--violet);
  transform: rotate(45deg);
}

/* Variante « bulle d'invitation » (lien de la fondation) : fond blanc, texte violet très foncé, queue qui pointe le centre du lien.
   Pendant l'apparition automatique elle ne bloque jamais un clic (pointer-events: none) et flotte très doucement (3 cycles). */
.tooltip--bubble {
  padding: 4px 10px;
  border-radius: 10px;
  color: var(--violet);
  background: var(--blanc);
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--violet) 55%, transparent);
}

.tooltip--bubble::before {
  background: var(--blanc);
}

.tooltip.is-auto {
  pointer-events: none;
  animation: bubble-float 2.6s ease-in-out 3;
}

.tooltip.is-leaving {
  opacity: 0;
  transition: opacity 0.2s;
}

@keyframes bubble-float {
  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -3px;
  }
}

/* --- Sélecteur segmenté : taille du texte A / A+ / A++ ------------------------------------------- */

.seg {
  display: inline-flex;
  align-items: stretch;
  height: var(--h-sm);
  padding: 2px;
  background: var(--blanc);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-bouton);
}

.seg__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  padding: 0 var(--s2);
  border: 0;
  border-radius: 6px;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1;
  color: var(--violet);
  background: transparent;
}

button.seg__item {
  cursor: pointer;
}

.seg__item.is-current,
.seg__item[aria-pressed="true"] {
  color: var(--blanc);
  background: var(--violet);
}

/* --- Interrupteur ------------------------------------------------------------------------------------ */

.switch {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  padding: 0;
  border: 2px solid var(--violet-2);
  border-radius: 999px;
  background: var(--blanc);
  cursor: pointer;
  transition: background-color 0.15s;
}

.switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--violet-2);
  transition: transform 0.15s, background-color 0.15s;
}

.switch[aria-checked="true"] {
  background: var(--violet-2);
}

.switch[aria-checked="true"] .switch__thumb {
  background: var(--blanc);
  transform: translateX(20px);
}

/* Verrouillé (cookies nécessaires) : allumé, non modifiable. */
.switch[aria-disabled="true"] {
  border-color: var(--violet-3);
  background: var(--violet-3);
  cursor: not-allowed;
}

/* --- Pastille d'inscription : une icône dans un rond de couleur. La FORME porte le sens, pas la couleur seule. --- */

.reg-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  position: relative;
  border-radius: 999px;
}

.reg-badge:not(.is-labelled) {
  justify-content: center;
  width: var(--h-sm);
  height: var(--h-sm);
}

.reg-badge:not(.is-labelled):hover {
  background: var(--violet-pale);
}

.reg-badge__dot {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--blanc);
  background: var(--succes);
}

.reg-badge__dot .icon {
  width: 14px;
  height: 14px;
}

/* Ondes permanentes sur la coche « inscriptions ouvertes » : deux anneaux concentriques de 2 px en blanc translucide, en boucle
   (cycle 2,4 s, le second décalé de 1,2 s), uniquement transform et opacity (aucun décalage de mise en page). Elles tournent sans
   attendre le survol. WCAG 2.2.2 : le réglage « Réduire les animations » du panneau d'accessibilité (data-motion="reduced") et la
   préférence du système les arrêtent (règle globale de front-base.css) ; il reste alors un anneau fixe, discret, de la même couleur. */
.reg-badge__dot {
  position: relative;
}

.reg-badge__dot::before,
.reg-badge__dot::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid var(--blanc);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

/* Anneau fixe discret (état sans mouvement) ; l'animation reprend ses propriétés quand elle est active. */
.reg-badge--open .reg-badge__dot::after {
  opacity: 0.35;
  transform: scale(1.3);
  animation: badge-wave 2.4s ease-out infinite;
}

.reg-badge--open .reg-badge__dot::before {
  animation: badge-wave 2.4s ease-out 1.2s infinite;
}

@keyframes badge-wave {
  0% {
    opacity: 0.7;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(2.1);
  }
}

.reg-badge--not_yet_open .reg-badge__dot {
  background: var(--info);
}

.reg-badge--closed .reg-badge__dot {
  background: var(--erreur);
}

.reg-badge.is-labelled {
  padding: 4px var(--s3) 4px 4px;
  background: var(--violet-pale);
}

.reg-badge__text {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--violet);
}

/* --- Menu de langue : un seul petit contrôle « drapeau + chevron » (mini-menu natif <details>) -------- */

.lang-menu {
  position: relative;
}

.lang-menu__summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  gap: 4px;
  padding: 0 var(--s2);
  border-radius: 999px;
  list-style: none;
}

.lang-menu__summary::-webkit-details-marker {
  display: none;
}

.lang-menu__flag {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.lang-menu__summary .icon {
  width: 0.875em;
  height: 0.875em;
}

.lang-menu[open] .lang-menu__summary .icon {
  transform: rotate(180deg);
}

.lang-menu__list {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 5;
  min-width: 11em;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--blanc);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-panneau);
  box-shadow: var(--ombre-menu);
}

/* Avec JavaScript : centré sous le drapeau, recalé dans l'écran (--pop-shift), flèche toujours sur le centre du drapeau. */
.js .lang-menu__list {
  right: auto;
  left: 50%;
  transform: translateX(calc(-50% + var(--pop-shift, 0px)));
}

.lang-menu__list::before {
  content: "";
  position: absolute;
  top: -6px;
  left: calc(50% - var(--pop-shift, 0px) - 5.5px);
  width: 10px;
  height: 10px;
  background: var(--blanc);
  border-top: 1px solid var(--ligne);
  border-left: 1px solid var(--ligne);
  transform: rotate(45deg);
}

.lang-menu__item {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: 4px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--violet);
  text-decoration: none;
}

.lang-menu__item.is-current {
  background: var(--violet-pale);
}

.lang-menu__check {
  margin-left: auto;
}

/* EN grisé et non cliquable : le texte reste lisible (jeton --encre-2), le drapeau est atténué. */
.lang-menu__item.is-disabled {
  color: var(--encre-2);
  cursor: not-allowed;
}

.lang-menu__item.is-disabled .lang-menu__flag {
  filter: grayscale(1);
  opacity: 0.6;
}

/* --- Champ de saisie : un seul cadre, un seul anneau au focus --------------------------------- */

.field {
  display: grid;
  gap: var(--s2);
  max-width: 28rem;
}

.field__label {
  font-weight: 700;
  color: var(--violet);
}

.field__input {
  width: 100%;
  height: 48px;
  padding: 0 var(--s4);
  border: 1.5px solid var(--violet-3);
  border-radius: var(--rayon);
  font: inherit;
  font-size: var(--fs-base);
  color: var(--encre);
  background: var(--blanc);
}

.field__help {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--encre-2);
}

/* Pastille d'état (cookies nécessaires, etc.). */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin: 0;
  padding: 5px var(--s3);
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.2;
}

.status-pill--success {
  color: var(--succes);
  background: var(--succes-pale);
}

/* ==========================================================================================================================
   Pages intérieures (lot L2) : fil d'Ariane, en-tête de page, pages légales, plan du site, page 404.
   Fond clair, sobre, aéré ; toutes les tailles de texte suivent le réglage A / A+ / A++ (variables --fs-*).
   ========================================================================================================================== */

.breadcrumb__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--encre-2);
}

.breadcrumb__item {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}

.breadcrumb__item .icon {
  width: 12px;
  height: 12px;
}

.breadcrumb a {
  color: var(--violet);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--violet-2);
}

.page-head {
  background: var(--fond);
  border-bottom: 1px solid var(--ligne);
}

.page-head__inner {
  display: grid;
  gap: var(--s3);
  padding-block: var(--s6);
}

.page-head__title {
  margin: 0;
  font-size: clamp(var(--fs-xl), 7.4vw, var(--fs-3xl));
  font-weight: 800;
  line-height: 1.15;
  color: var(--violet);
}

.page-head__lead {
  max-width: 60ch;
  margin: 0;
  font-size: var(--fs-lg);
  color: var(--encre-2);
}

.page-head__note {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--encre-2);
}

/* Pages légales : menu à gauche sur bureau ; sur mobile, une rangée de liens qui défile. */
.legal {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s5);
  padding-block: var(--s5) var(--s8);
  font-size: var(--fs-base);
}

.legal-menu__list {
  display: flex;
  gap: var(--s2);
  margin: 0;
  padding: 0 0 var(--s1);
  overflow-x: auto;
  list-style: none;
  scroll-snap-type: x proximity;
}

.legal-menu__link {
  display: block;
  padding: var(--s2) var(--s4);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-bouton);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  color: var(--violet);
  text-decoration: none;
  background: var(--blanc);
  scroll-snap-align: start;
}

.legal-menu__link:hover {
  background: var(--violet-pale);
}

.legal-menu__link[aria-current="page"] {
  color: var(--blanc);
  background: var(--violet);
  border-color: var(--violet);
}

@media (min-width: 62em) {
  .legal {
    grid-template-columns: 15em minmax(0, 1fr);
    gap: var(--s7);
    align-items: start;
    padding-block: var(--s7) var(--s9);
  }

  .legal-menu {
    position: sticky;
    top: calc(var(--s9) + var(--s5));
    padding: var(--s3);
    border: 1px solid var(--ligne);
    border-radius: var(--rayon);
    background: var(--blanc);
  }

  .legal-menu__list {
    flex-direction: column;
    gap: var(--s1);
    padding: 0;
    overflow: visible;
  }

  .legal-menu__link {
    border-color: transparent;
    white-space: normal;
  }
}

/* Document : lecture confortable, ≈ 70 caractères par ligne. */
.doc {
  max-width: 70ch;
}

.doc__toc {
  margin-bottom: var(--s5);
  padding: var(--s4) var(--s5);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  background: var(--fond);
}

.doc__toc-title {
  margin: 0 0 var(--s2);
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--violet);
}

.doc__toc-list {
  display: grid;
  gap: var(--s1);
  margin: 0;
  padding-inline-start: var(--s5);
  font-size: var(--fs-base);
}

.doc__toc-list a {
  color: var(--violet);
  text-decoration: none;
}

.doc__toc-list a:hover {
  color: var(--violet-2);
}

.doc__article {
  padding-block: var(--s5);
  border-top: 1px solid var(--ligne);
  scroll-margin-top: calc(var(--s9) + var(--s5));
}

.doc__heading {
  margin: 0 0 var(--s3);
  font-size: var(--fs-xl);
  font-weight: 800;
  line-height: 1.25;
  color: var(--violet);
}

.doc p,
.doc ul {
  margin: 0 0 var(--s3);
  line-height: 1.7;
  color: var(--encre);
}

.doc ul {
  padding-inline-start: var(--s5);
}

.doc li + li {
  margin-top: var(--s1);
}

.doc__fields {
  display: grid;
  gap: var(--s2);
  margin: 0 0 var(--s3);
}

.doc__field {
  display: grid;
  gap: 0;
}

.doc__field dt {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--encre-2);
}

.doc__field dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--encre);
}

.doc__records {
  display: grid;
  gap: var(--s3);
  margin-bottom: var(--s3);
}

.doc__record {
  padding: var(--s4);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  background: var(--fond);
}

.doc__record-title {
  margin: 0 0 var(--s2);
  font-size: var(--fs-base);
  font-weight: 800;
  overflow-wrap: anywhere;
  color: var(--violet);
}

.doc__record .doc__fields {
  margin-bottom: 0;
}

@media (min-width: 40em) {
  .doc__field {
    grid-template-columns: 9em minmax(0, 1fr);
    gap: var(--s3);
  }
}

/* Page 404 : illustration, gros « 404 » décoratif, titre (seul h1), deux sorties. */
.not-found {
  display: grid;
  justify-items: center;
  gap: var(--s3);
  padding-block: var(--s8);
  text-align: center;
}

.not-found__illustration {
  width: min(100%, 20em);
  height: auto;
}

.not-found__code {
  margin: 0;
  font-size: calc(var(--fs-3xl) * 2.5);
  font-weight: 800;
  line-height: 1;
  color: var(--violet);
}

.not-found__title {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: 800;
  line-height: 1.2;
  color: var(--violet);
}

.not-found__text {
  max-width: 46ch;
  margin: 0;
  font-size: var(--fs-lg);
  color: var(--encre-2);
}

.not-found__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s3);
  margin-top: var(--s3);
}

/* Squelette « en cours de construction » (lot L2b) : illustration, message, bouton d'accueil, centrés et sobres comme la 404. */
.stub {
  display: grid;
  justify-items: center;
  gap: var(--s4);
  padding-block: var(--s8);
  text-align: center;
}

.stub__illustration {
  width: min(100%, 18em);
  height: auto;
}

.stub__message {
  max-width: 46ch;
  margin: 0;
  font-size: var(--fs-lg);
  color: var(--encre-2);
}

/* Lot L5h : le premier champ en erreur reçoit le focus ; le navigateur le fait défiler SOUS l'en-tête et le bandeau collés en haut (critère « focus non masqué »). La marge de
   défilement réserve leur hauteur (en-tête + bandeau « À la une » jusqu'à 25 % de la fenêtre à 375 px en texte A++). La fenêtre de commande (défilement interne) n'est pas concernée. */
form[data-validate]:not([data-order-form]) :is(input:not([type="hidden"]), select, textarea, [tabindex="-1"]) {
  scroll-margin-top: 13rem;
}
