/*
 * Fideback : le chœur.
 * Une synthèse rassemble plusieurs voix sur une personne : chaque sondé reçoit une couleur
 * (voice-0 à voice-5) qui le suit partout dans sa campagne — pastille, bulle, position sur l'échelle.
 * Une seule famille, Bricolage Grotesque, dont la chasse et la graisse font les titres.
 */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/bricolage-grotesque-4a42c1c3.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F7F5FC;
  --surface: #FFFFFF;
  --ink: #231942;
  --ink-soft: #5A5378;
  --line: #E3DFF0;
  --line-strong: #C9C2DD;

  --pink: #FF5D8F;
  --saffron: #FFB627;
  --jade: #12B886;
  --azure: #2F8CFF;
  --orchid: #B05CF0;
  --lime: #9BD12E;
  --danger: #D7263D;

  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --page: 56rem;
  --bounce: cubic-bezier(.34, 1.56, .64, 1);
  --glide: cubic-bezier(.2, .8, .2, 1);

  color-scheme: light;
}

/* Les six voix */
.voice-0 { --voice: var(--pink); }
.voice-1 { --voice: var(--saffron); }
.voice-2 { --voice: var(--jade); }
.voice-3 { --voice: var(--azure); }
.voice-4 { --voice: var(--orchid); }
.voice-5 { --voice: var(--lime); }
:where([class*="voice-"]) { --voice-tint: color-mix(in srgb, var(--voice) 16%, var(--surface)); }

/* Base */

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, legend {
  font-weight: 750;
  font-stretch: 85%;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: 2.75rem; font-weight: 800; font-stretch: 78%; margin: 0 0 0.75rem; }
h2 { font-size: 1.625rem; margin: 3rem 0 1rem; }
h3 { font-size: 1.25rem; margin: 2rem 0 0.5rem; }

p { margin: 0 0 1rem; }

a {
  color: var(--ink);
  font-weight: 600;
  text-decoration-color: var(--pink);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
}
a:hover { text-decoration-color: var(--azure); text-decoration-thickness: 3px; }

:focus-visible {
  outline: 3px solid var(--azure);
  outline-offset: 2px;
  border-radius: 4px;
}

small, .muted { color: var(--ink-soft); }
small { font-size: 0.875rem; }

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

/* En-tête */

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: 0.9rem max(1.25rem, calc((100% - var(--page)) / 2 + 1.25rem));
  background: var(--surface);
  border-bottom: 2px solid var(--ink);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5em;
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 800;
  font-stretch: 80%;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
a.brand:hover { color: var(--ink); }

/* L'initiale reprend l'ombre rose du favicon. ::first-letter ne s'applique pas à un conteneur flex, d'où l'inline-block.
   La marge empêche le « i » serré de recouvrir l'ombre. */
.brand-name { display: inline-block; }
.brand-name::first-letter { text-shadow: 0.05em 0.05em 0 var(--pink); margin-right: 0.06em; }

/* Marque : deux bulles de dialogue, celle de devant « écrit » (partiel layouts/_brand_mark). Le bas du SVG, rogné au dessin,
   se pose sur la ligne de base du nom (align-items: baseline) : la marque dépasse au-dessus des lettres, jamais en dessous.
   Au repos elle est complète et immobile ; les animations sont ajoutées en fin de fichier, hors mouvement réduit. */
.brand-mark { flex: none; width: 1.59em; height: 1.25em; overflow: visible; }
.brand-mark g { transform-box: fill-box; }
.arrive-back, .sway-back { transform-origin: 20% 100%; }
.arrive-front, .sway-front { transform-origin: 80% 100%; }
.brand-mark path { stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; }
.bubble-back { fill: var(--pink); }
.bubble-front { fill: var(--saffron); }
.typing { fill: var(--ink); transform-box: fill-box; transform-origin: center; }

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 0.8rem;
  align-items: center;
  font-size: 0.9375rem;
}
.site-header nav a:not(.btn) { text-decoration: none; }
.site-header nav a:not(.btn):hover { text-decoration: underline; text-decoration-color: var(--pink); }

/* Entrée de l'écran ouvert : gras et barre multicolore dessous.
   Le texte gras est réservé d'avance (::before invisible) pour que le lien ne change pas de largeur.
   La barre se déroule quand l'écran s'ouvre (Turbo remplace le <body> : le lien actif est un élément neuf,
   l'animation se rejoue donc à chaque clic), puis son dégradé défile en boucle. L'état de repos est défini
   hors des animations : la règle prefers-reduced-motion en bas du fichier les coupe, la barre reste complète. */
.site-header nav a:not(.btn) { position: relative; display: inline-block; padding: 0.2rem 0.45rem; }
.site-header nav a:not(.btn)::before {
  content: attr(data-label);
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: 700;
}
.site-header nav a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 0.45rem;
  right: 0.45rem;
  bottom: -0.2rem;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--saffron), var(--jade), var(--azure), var(--pink)) 0 0 / 200% 100%;
  transform: scaleX(0);
  transform-origin: left;
}
.site-header nav a[aria-current="page"] { font-weight: 700; }
.site-header nav a[aria-current="page"]::after {
  transform: scaleX(1);
  animation:
    nav-unroll 450ms var(--bounce) both,
    nav-flow 3s linear infinite;
}
@keyframes nav-unroll { from { transform: scaleX(0); } }
@keyframes nav-flow { to { background-position: 200% 0; } }

/* Conteneur de la navigation, du bouton « Créer un compte » et du bouton de menu */
.header-end { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 0.8rem; }
.nav-account { display: contents; }
.nav-who, .nav-toggle, .nav-scrim { display: none; }

/* Tiroir des petits écrans. Il n'existe qu'une fois le contrôleur connecté (data-nav-ready) : sans JavaScript,
   la navigation reste empilée dans l'en-tête. Les entrées sont visibles par défaut et seule leur animation part
   de « masqué » : sous prefers-reduced-motion, la règle globale coupe l'animation et tout s'affiche d'emblée. */
@media (max-width: 40rem) {
  .site-header[data-nav-ready] { position: relative; z-index: 30; flex-wrap: nowrap; gap: 0.5rem; padding: 0.7rem max(1rem, env(safe-area-inset-right, 0px)) 0.7rem max(1rem, env(safe-area-inset-left, 0px)); }
  .site-header[data-nav-ready] .header-end { flex-wrap: nowrap; gap: 0.6rem; }
  .site-header[data-nav-ready] .header-end > .btn { white-space: nowrap; }

  .site-header[data-nav-ready] .nav-toggle {
    display: block;
    position: relative;
    z-index: 50;
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 2px 2px 0 var(--saffron);
    cursor: pointer;
    transition: background-color 200ms, box-shadow 200ms;
  }
  .nav-toggle[hidden] { display: none !important; }
  .nav-toggle span {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1.1rem;
    height: 2.5px;
    margin: -1.25px 0 0 -0.55rem;
    border-radius: 2px;
    background: var(--ink);
    transition: transform 320ms var(--bounce), opacity 160ms;
  }
  .nav-toggle span:nth-child(1) { transform: translateY(-6px); }
  .nav-toggle span:nth-child(3) { transform: translateY(6px); }
  .site-header.is-open .nav-toggle { background: var(--saffron); box-shadow: 2px 2px 0 var(--pink); }
  .site-header.is-open .nav-toggle span:nth-child(1) { transform: rotate(45deg); }
  .site-header.is-open .nav-toggle span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .site-header.is-open .nav-toggle span:nth-child(3) { transform: rotate(-45deg); }
  .nav-toggle:focus-visible, .site-header nav a:focus-visible, .site-header nav button:focus-visible { outline: 3px solid var(--azure); outline-offset: 3px; }

  .site-header[data-nav-ready] .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: color-mix(in srgb, var(--ink) 55%, transparent);
    opacity: 0;
    visibility: hidden;
  }
  /* Plus spécifique que la règle d'armement des transitions (plus bas) : sinon sa visibilité à l'ouverture serait retardée. */
  .site-header[data-nav-ready].is-open .nav-scrim { opacity: 1; visibility: visible; transition-delay: 0s; }

  .site-header[data-nav-ready] nav {
    position: fixed;
    z-index: 40;
    inset: 0 0 0 auto;
    width: min(82%, 19rem);
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0.2rem;
    padding: calc(5rem + env(safe-area-inset-top, 0px)) 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    background: var(--surface);
    border-left: 2px solid var(--ink);
    font-size: 1.25rem;
    transform: translateX(104%);
    visibility: hidden;
  }
  /* Les transitions n'arment qu'après le premier rendu : sinon le tiroir glisserait vers sa position fermée à chaque chargement. */
  .site-header[data-nav-armed] .nav-scrim { transition: opacity 300ms ease, visibility 0s linear 300ms; }
  .site-header[data-nav-armed] nav { transition: transform 380ms var(--glide), visibility 0s linear 380ms; }
  .site-header[data-nav-ready].is-open nav { transform: none; visibility: visible; transition-delay: 0s; }
  .site-header[data-nav-ready] nav a:not(.btn) { padding: 0.75rem 0.45rem; overflow-wrap: anywhere; }
  .site-header[data-nav-ready] nav a:not(.btn)::after { bottom: 0.4rem; }

  .site-header[data-nav-ready] .nav-account {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    align-self: stretch;
    gap: 0.2rem;
    margin-top: 0.9rem;
    padding-top: 0.6rem;
    border-top: 2px solid var(--line);
  }
  .site-header[data-nav-ready] .nav-who { display: block; margin: 0.2rem 0.45rem 0; font-size: 0.8125rem; color: var(--ink-soft); }
  .site-header[data-nav-ready] nav form.inline { display: block; }
  .site-header[data-nav-ready] nav button.link { min-height: 3rem; padding: 0.75rem 0.45rem; font-size: 1.0625rem; color: var(--ink-soft); }

  /* Cascade d'apparition ; la barre de l'entrée active se déroule une fois le tiroir en place. */
  .site-header.is-open nav > a, .site-header.is-open .nav-account > * {
    animation: nav-item-in 420ms var(--glide) both;
    animation-delay: calc(var(--i, 0) * 60ms + 120ms);
  }
  .site-header[data-nav-ready] nav a[aria-current="page"]::after { animation: none; }
  .site-header[data-nav-ready].is-open nav a[aria-current="page"]::after {
    animation: nav-unroll 450ms var(--bounce) 380ms both, nav-flow 3s linear 830ms infinite;
  }
}
/* Très petits écrans : la marque rétrécit pour que « Créer un compte » et le bouton de menu tiennent sur une ligne. */
@media (max-width: 24rem) {
  .site-header[data-nav-ready] .brand-mark { width: 1.27em; height: 1em; }
  .site-header[data-nav-ready] .header-end > .btn { padding-inline: 0.6rem; font-size: 0.8125rem; }
}
@keyframes nav-item-in { from { opacity: 0; transform: translateX(1.25rem); } }
html.nav-open { overflow: hidden; }

/* Page */

main {
  flex: 1;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 2.75rem 1.25rem 4rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 2rem;
}
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 0.85rem; }
.page-head p { margin: 0; }
.campaign-meta { flex-basis: 100%; color: var(--ink-soft); }
.campaign-meta strong:not(.status) { color: var(--ink); }

.back { margin-top: 3rem; font-size: 0.9375rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.85rem; align-items: center; }

/* Boutons : bord encre, ombre dure colorée, ils s'enfoncent quand on clique */

form.inline { display: inline; margin: 0; }

.btn,
input[type=submit]:not(.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.3rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--saffron);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms var(--bounce), box-shadow 140ms var(--bounce), background-color 140ms;
}
.btn:hover,
input[type=submit]:not(.btn):hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--saffron); text-decoration: none; color: var(--ink); }
.btn:active,
input[type=submit]:not(.btn):active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--saffron); }

.btn-primary,
input[type=submit]:not(.btn) {
  background: var(--ink);
  color: var(--surface);
  box-shadow: 3px 3px 0 var(--pink);
}
.btn-primary:hover,
input[type=submit]:not(.btn):hover { color: var(--surface); box-shadow: 5px 5px 0 var(--pink); }
.btn-primary:active,
input[type=submit]:not(.btn):active { box-shadow: 1px 1px 0 var(--pink); }

.btn-danger { color: var(--danger); border-color: var(--danger); box-shadow: 3px 3px 0 color-mix(in srgb, var(--danger) 25%, var(--surface)); }
.btn-danger:hover { color: var(--danger); box-shadow: 5px 5px 0 color-mix(in srgb, var(--danger) 25%, var(--surface)); }

.btn-small { padding: 0.35rem 0.9rem; font-size: 0.875rem; box-shadow: 2px 2px 0 var(--saffron); }

.btn-add { border-style: dashed; box-shadow: none; background: transparent; }
.btn-add:hover { box-shadow: none; transform: none; background: color-mix(in srgb, var(--saffron) 22%, var(--surface)); }

button.link {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--pink);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
  cursor: pointer;
}
button.link:hover { text-decoration-color: var(--azure); }
button.link-remove { color: var(--ink-soft); font-size: 0.875rem; text-decoration-color: var(--line-strong); }
button.link-remove:hover { color: var(--danger); text-decoration-color: var(--danger); }

/* Messages d'état : ils décrivent la page et y restent. Les messages consécutifs à une action sont des toasts. */

.callout,
#error_explanation,
#confirmation-outcome,
#invitation-outcome {
  margin: 0 0 1.75rem;
  padding: 0.85rem 1.1rem;
  border: 2px solid var(--jade);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--jade) 12%, var(--surface));
  animation: flash-in 520ms var(--bounce) both;
}
.callout-alert,
#error_explanation { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, var(--surface)); }
.callout ul,
#error_explanation ul { margin: 0; padding-left: 1.25rem; }
#error_explanation h2 { font-size: 1.0625rem; font-stretch: 100%; letter-spacing: 0; margin: 0 0 0.25rem; }
#confirmation-outcome p:last-child,
#invitation-outcome p:last-child { margin: 0; }
/* Une invitation invalide n'est pas un succès : même cadre que le résultat d'une confirmation, en safran. */
#invitation-outcome { border-color: var(--saffron); background: color-mix(in srgb, var(--saffron) 14%, var(--surface)); }

/* Connexion par lien unique : la page d'attente du lien et le lien refusé. */
#login-link-outcome { margin: 0 0 1.75rem; padding: 0.85rem 1.1rem; border: 2px solid var(--saffron); border-radius: 1rem; background: color-mix(in srgb, var(--saffron) 14%, var(--surface)); animation: flash-in 520ms var(--bounce) both; }
#login-link-outcome p { margin: 0 0 0.5rem; }
#login-link-outcome p:last-child { margin: 0; }
.wait-card { display: grid; gap: 1rem; padding: 1.75rem; border: 2px solid var(--ink); border-radius: 1.5rem; background: var(--surface); box-shadow: 8px 8px 0 var(--azure); }
.wait-card h2 { margin: 0; font-size: 2.25rem; font-weight: 800; font-stretch: 78%; line-height: 1.1; text-wrap: balance; }
.wait-card .lead { margin: 0; font-size: 1.0625rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.wait-card .facts { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0; list-style: none; }
.wait-card .facts li { padding: 0.2rem 0.7rem; border-radius: 999px; background: color-mix(in srgb, var(--azure) 14%, var(--surface)); font-size: 0.8125rem; font-weight: 700; }
.wait-card .btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--line); }
.envelope { position: relative; width: 4.25rem; height: 3rem; border: 2px solid var(--ink); border-radius: 0.5rem; background: var(--bg); animation: envelope-bob 2.4s ease-in-out infinite; }
.envelope::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to bottom right, transparent calc(50% - 1px), var(--ink) 50%, transparent calc(50% + 1px)) 0 0 / 50% 62% no-repeat,
    linear-gradient(to bottom left, transparent calc(50% - 1px), var(--ink) 50%, transparent calc(50% + 1px)) 100% 0 / 50% 62% no-repeat;
}
.envelope::after { content: ""; position: absolute; right: -0.55rem; top: -0.55rem; width: 1.1rem; height: 1.1rem; border: 2px solid var(--ink); border-radius: 50%; background: var(--pink); animation: envelope-ping 1.6s ease-out infinite; }
@keyframes envelope-bob { 50% { transform: translateY(-5px) rotate(-2deg); } }
@keyframes envelope-ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pink) 60%, transparent); } 100% { box-shadow: 0 0 0 0.6rem transparent; } }
@media (max-width: 34rem) { .wait-card { padding: 1.25rem; } .wait-card h2 { font-size: 1.875rem; } }

/* Toasts : les messages consécutifs à une action, posés par-dessus la page sans rien décaler.
   Le contrôleur toasts fait passer la colonne dans la couche supérieure (popover) ; sans lui, elle reste en position fixe.
   En bas à droite, en bas sur toute la largeur sur petit écran ; seuls les toasts captent les clics, pas la colonne.
   --toasts-lift la soulève au-dessus d'une barre d'actions collée en bas de l'écran. */

.toasts {
  position: fixed;
  inset: auto max(1rem, env(safe-area-inset-right)) calc(max(1rem, env(safe-area-inset-bottom)) + var(--toasts-lift, 0px)) auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(24rem, calc(100vw - 2rem));
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  overflow: visible;
  pointer-events: none;
}

.toast {
  --toast-color: var(--jade);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.5rem 0.85rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 4px 4px 0 var(--toast-color);
  overflow: hidden;
  pointer-events: auto;
  touch-action: pan-y;
  animation: toast-in 520ms var(--bounce) both;
  transition: translate 220ms var(--bounce), opacity 220ms;
}
.toast.flash-warning { --toast-color: var(--saffron); }
.toast.flash-alert { --toast-color: var(--danger); }
.toast.is-dragging { transition: none; }
.toast.is-leaving { pointer-events: none; animation: toast-out 240ms ease-in forwards; }
.toast p { flex: 1; margin: 0.15rem 0 0; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }

.toast-dot {
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  margin-top: 0.45rem;
  border-radius: 50%;
  background: var(--toast-color);
  animation: pop 420ms 160ms var(--bounce) both;
}

.toast-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: -0.25rem 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 1.375rem;
  line-height: 1;
  cursor: pointer;
}
.toast-close:hover { background: color-mix(in srgb, var(--toast-color) 16%, var(--surface)); color: var(--ink); }
.toast-close:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

/* La barre d'une notice est son minuteur : sa fin ferme le toast. Elle s'arrête au survol, au focus, pendant un
   balayage et onglet caché ; !important parce que la règle de mouvement réduit redéfinit toute l'animation. */
.toast.is-timed::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: var(--toast-color);
  transform-origin: left;
  animation: toast-timer var(--toast-duration, 5s) linear forwards;
}
.toast.is-timed:hover::after,
.toast.is-timed:focus-within::after,
.toast.is-timed.is-dragging::after,
.toasts.is-paused .toast.is-timed::after { animation-play-state: paused !important; }

/* Avec JavaScript, les toasts restent masqués jusqu'à leur réinsertion par le contrôleur, pour ne pas apparaître deux fois. */
@media (scripting: enabled) {
  .toasts:not([data-ready]) .toast { visibility: hidden; }
}

@media (max-width: 40rem) {
  .toasts { left: max(1rem, env(safe-area-inset-left)); width: auto; }
}

.error { color: var(--danger); font-style: normal; font-weight: 700; font-size: 0.9375rem; }

.empty {
  padding: 1.75rem;
  border: 2px dashed var(--line-strong);
  border-radius: 1.25rem;
  background: var(--surface);
  color: var(--ink-soft);
}
.empty p:first-child { font-size: 1.375rem; font-weight: 750; font-stretch: 85%; color: var(--ink); }
.empty p:last-child { margin: 0; }
.admin-welcome { animation: scene-in 0.5s ease-out both; }

/* Danger zone : carte à bordure rouge en pointillés, réservée à l'Admin */
.danger-zone {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
  border: 2px dashed var(--danger);
  border-radius: 1.25rem;
  background: color-mix(in srgb, var(--danger) 5%, var(--surface));
  animation: scene-in 0.5s ease-out both;
}
.danger-zone h2 { margin: 0; font-size: 1.375rem; font-weight: 800; font-stretch: 85%; }
.danger-zone p { margin: 0; color: var(--ink-soft); }
.zone-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: start;
  font-size: 0.8125rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--danger);
}
.zone-label::before { content: ""; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--danger); animation: zone-pulse 1.8s ease-out infinite; }
.zone-state { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; }
.zone-note { font-size: 0.875rem; }
.zone-confirm {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border: 2px solid var(--danger);
  border-radius: 1rem;
  background: var(--surface);
  animation: pop 360ms var(--bounce) both;
}
.danger-zone .zone-confirm p { color: var(--ink); font-weight: 600; }
.zone-confirm ul { display: grid; gap: 0.25rem; margin: 0; padding-left: 1.2rem; color: var(--ink); }
.btn-solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: 3px 3px 0 color-mix(in srgb, var(--danger) 30%, var(--surface)); }
.btn-solid-danger:hover { color: #fff; box-shadow: 5px 5px 0 color-mix(in srgb, var(--danger) 30%, var(--surface)); }
@keyframes zone-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 55%, transparent); }
  100% { box-shadow: 0 0 0 0.55rem transparent; }
}

/* Pastilles d'initiales */

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--voice, var(--line));
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 800;
  font-stretch: 85%;
  line-height: 1;
  letter-spacing: 0.02em;
}
.avatar-large { width: 3.25rem; height: 3.25rem; font-size: 1.125rem; }

/* Statuts */

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 650;
  white-space: nowrap;
  background: #ECE9F5;
  color: var(--ink-soft);
}
.status-running, .status-submitted, .status-open { background: color-mix(in srgb, var(--jade) 16%, var(--surface)); color: #0A6B4E; }
.status-closed { background: var(--ink); color: var(--surface); }
.status-in_progress { background: color-mix(in srgb, var(--saffron) 25%, var(--surface)); color: #7A4F00; }
.status-admin { background: color-mix(in srgb, var(--pink) 18%, var(--surface)); color: #A3154A; }
.status-unconfirmed { background: color-mix(in srgb, var(--saffron) 25%, var(--surface)); color: #7A4F00; }
.status + .status { margin-left: 0.35rem; }
.status-pending { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.status-expired { background: color-mix(in srgb, var(--saffron) 25%, var(--surface)); color: #7A4F00; }
.status-running::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--jade);
  animation: pulse 1.8s ease-out infinite;
}
.campaign-meta .status { font-size: 0.875rem; }

/* Liste des campagnes : une ligne colorée par campagne, cliquable en entier */

.campaign-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 1rem; }
.campaign-list li {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "badge name status" "badge deadline status";
  align-items: center;
  column-gap: 1.1rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--ink);
  border-radius: 1.25rem;
  background: var(--surface);
  box-shadow: 5px 5px 0 var(--voice);
  transition: transform 160ms var(--bounce), box-shadow 160ms var(--bounce);
}
.campaign-list li:hover { transform: translate(-3px, -3px); box-shadow: 8px 8px 0 var(--voice); }
.campaign-list li:has(a:focus-visible) { outline: 3px solid var(--azure); outline-offset: 3px; }
.campaign-badge {
  grid-area: badge;
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0.9rem;
  background: var(--voice);
  font-weight: 800;
  font-stretch: 80%;
  font-size: 1.125rem;
  rotate: -5deg;
  transition: rotate 220ms var(--bounce);
}
.campaign-list li:hover .campaign-badge { rotate: 6deg; }
.campaign-name {
  grid-area: name;
  font-size: 1.375rem;
  font-weight: 750;
  font-stretch: 85%;
  line-height: 1.15;
  text-decoration: none;
}
.campaign-name::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.campaign-name:focus-visible { outline: none; }
.campaign-deadline { grid-area: deadline; font-size: 0.875rem; color: var(--ink-soft); }
.campaign-list .status { grid-area: status; }

/* Campagne */

#response-rate { margin-bottom: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.chorus { display: flex; flex-wrap: wrap; margin: 0 0 1.75rem; padding-left: 0.4rem; }
.chorus .avatar { margin-left: -0.4rem; animation: pop 480ms var(--bounce) both; animation-delay: calc(var(--i, 0) * 70ms + 150ms); }
.avatar.is-waiting { background: var(--surface); border-style: dashed; border-color: var(--line-strong); color: var(--ink-soft); }

/* position: relative garde les libellés masqués (positionnés en absolu) dans la zone qui défile,
   sinon ils élargissent toute la page. */
.table-scroll {
  position: relative;
  overflow-x: auto;
  container-type: inline-size;
  border: 2px solid var(--ink);
  border-radius: 1.25rem;
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
th {
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 650;
  color: var(--ink-soft);
  padding: 0.85rem 1rem 0.6rem;
  border-bottom: 2px solid var(--line);
}
td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 120ms; }
tbody tr:hover { background: #FAF8FF; }
td.cell-person { font-weight: 600; white-space: nowrap; }
td.cell-person .avatar { width: 1.85rem; height: 1.85rem; margin-right: 0.6rem; font-size: 0.6875rem; vertical-align: middle; }
td.cell-action { text-align: right; }
td.cell-action form + form { margin-left: 1rem; }

/* Quand la place manque, chaque sondé devient une fiche : nom et statut, puis e-mail, date d'invitation et action. */
@container (max-width: 36rem) {
  .table-scroll table, .table-scroll tbody, .table-scroll tr, .table-scroll td { display: block; }
  .table-scroll thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .table-scroll tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "person status" "email email" "invited action";
    align-items: center;
    gap: 0.35rem 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--line);
  }
  .table-scroll tbody tr:last-child { border-bottom: 0; }
  .table-scroll td { padding: 0; border: 0; white-space: normal; }
  .table-scroll td.cell-person { grid-area: person; display: flex; align-items: center; min-width: 0; }
  .table-scroll td.cell-status { grid-area: status; justify-self: end; }
  .table-scroll td.cell-email { grid-area: email; padding-left: 2.45rem; overflow-wrap: anywhere; font-size: 0.875rem; }
  .table-scroll td.cell-invited { grid-area: invited; padding-left: 2.45rem; font-size: 0.875rem; }
  .table-scroll td.cell-action { grid-area: action; }
  .table-scroll td.cell-invited::before { content: attr(data-label) "\00a0: "; }
}

/* Fiche très étroite : le statut passe sous le nom au lieu de le comprimer. */
@container (max-width: 22rem) {
  .table-scroll tr { grid-template-areas: "person person" "status status" "email email" "invited action"; }
  .table-scroll td.cell-status { justify-self: start; padding-left: 2.45rem; }
}

.ledger { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.6rem; }
.ledger li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  padding: 0.7rem 1rem;
  border-radius: 1rem;
  background: var(--surface);
  border: 2px solid var(--line);
}
.ledger-title { font-weight: 700; font-size: 1.0625rem; }
.ledger-action { margin-left: auto; }

.question-list { padding: 0; list-style: none; counter-reset: q; }
.question-list li {
  counter-increment: q;
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.6rem;
}
.question-list li::before {
  content: counter(q);
  flex: none;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.8125rem;
  font-weight: 800;
}

/* Formulaires */

.field { margin-bottom: 1.25rem; }
.field p { margin: 0.3rem 0; }
.field label { font-weight: 650; font-size: 0.9375rem; }
.field i, .field em:not(.error) { font-style: normal; font-size: 0.875rem; color: var(--ink-soft); font-weight: 400; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], textarea {
  width: 100%;
  max-width: 28rem;
  padding: 0.6rem 0.85rem;
  border: 2px solid var(--line-strong);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 120ms, box-shadow 120ms;
}
textarea { resize: vertical; }
input:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--ink-soft); }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--azure);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--azure) 22%, transparent);
}
input:disabled, textarea:disabled { background: var(--bg); color: var(--ink-soft); border-style: dashed; }
input::placeholder, textarea::placeholder { color: #9A93B3; }

input[type=checkbox] { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--ink); vertical-align: -0.2em; }
.check { display: inline-flex; align-items: center; gap: 0.5rem; }
.check label { font-weight: 500; }

.field-date input { max-width: 13rem; }

fieldset {
  min-width: 0;
  margin: 2.25rem 0 0;
  padding: 1.5rem 1.5rem 0.75rem;
  border: 2px solid var(--ink);
  border-radius: 1.5rem;
  background: var(--surface);
}
legend {
  padding: 0.2rem 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--saffron);
  font-size: 1.125rem;
}
.campaign-form fieldset:nth-of-type(2) legend { background: var(--pink); }
.campaign-form fieldset:nth-of-type(3) legend { background: var(--azure); }
legend span { font-size: 0.8125rem; font-weight: 500; font-stretch: 100%; letter-spacing: 0; }

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-bottom: 0.6rem;
}
.contact input { max-width: none; }

.question {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 0.5rem 1.25rem;
  align-items: center;
  margin-bottom: 1.1rem;
}
.question input[type=text] { grid-column: 1 / -1; max-width: none; }
.question .link-remove { justify-self: end; }

.is-added { border-radius: 0.75rem; animation: row-in 700ms var(--bounce) both; }

/* Choix des managés et sondés dans l'annuaire : une fiche par personne, teintée à la couleur de la section une fois cochée */

.campaign-form fieldset { --pick: var(--saffron); }
.campaign-form fieldset:nth-of-type(2) { --pick: var(--pink); }
.picker-head { display: flex; justify-content: flex-end; margin: -0.25rem 0 0.6rem; font-size: 0.9375rem; }
.picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 0.6rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}
.pick {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "box name" "box email";
  align-items: center;
  gap: 0 0.7rem;
  height: 100%;
  padding: 0.6rem 0.85rem;
  border: 2px solid var(--line-strong);
  border-radius: 1rem;
  cursor: pointer;
  transition: border-color 140ms, background-color 140ms, box-shadow 140ms var(--bounce), transform 140ms var(--bounce);
}
.pick:hover { border-color: var(--ink-soft); }
.pick input { grid-area: box; }
.pick-name { grid-area: name; font-weight: 700; overflow-wrap: anywhere; }
.pick-email { grid-area: email; font-size: 0.8125rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.pick:has(:checked) {
  border-color: var(--ink);
  background: color-mix(in srgb, var(--pick) 22%, var(--surface));
  box-shadow: 3px 3px 0 var(--pick);
  transform: translate(-1px, -1px);
}
.pick:has(:focus-visible) { outline: 3px solid var(--azure); outline-offset: 2px; }
.picker-empty { padding: 0.85rem 1rem; border: 2px dashed var(--line-strong); border-radius: 1rem; color: var(--ink-soft); }
.contact.has-error input { border-color: var(--danger); }

.campaign-form .actions { margin-top: 2.5rem; }

/* Mon équipe : une ligne par personne, ses rôles en pastilles à cocher */

.role-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.chip {
  appearance: none;
  padding: 0.35rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms var(--bounce), background-color 140ms;
}
.chip:hover { transform: translateY(-2px); }
.chip.is-active { background: var(--ink); color: var(--surface); }
.chip-managed.is-active { background: var(--pink); color: var(--ink); }
.chip-surveyable.is-active { background: var(--azure); color: var(--surface); }

.team-list { padding: 1rem; border: 2px solid var(--ink); border-radius: 1.5rem; background: var(--surface); box-shadow: 8px 8px 0 var(--jade); }
.team-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.5rem;
  border-radius: 1rem;
  transition: background-color 120ms;
}
.team-row:hover { background: #FAF8FF; }
.team-row + .team-row { border-top: 1px solid var(--line); }
.team-row input[type=text], .team-row input[type=email] { max-width: none; }
.team-row.has-error { background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.team-row.is-filtered-out { display: none; }
.row-error { grid-column: 1 / -1; margin: 0; }

.roles { display: flex; flex-wrap: wrap; gap: 0.4rem; min-width: 0; }
.team-row .link-remove { justify-self: end; }
.role {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  transition: background-color 140ms, border-color 140ms, color 140ms, transform 140ms var(--bounce);
}
.role:hover { border-color: var(--ink-soft); }
.role:active { transform: scale(0.94); }
.role:has(:checked) { border-color: var(--ink); color: var(--ink); }
.role-managed:has(:checked) { background: color-mix(in srgb, var(--pink) 30%, var(--surface)); }
.role-surveyable:has(:checked) { background: color-mix(in srgb, var(--azure) 22%, var(--surface)); }
.role input[type=checkbox] { width: 1rem; height: 1rem; }
.role:has(:focus-visible) { outline: 3px solid var(--azure); outline-offset: 2px; }

.team-list > p { margin: 0.75rem 0 0; }
.team-form .actions { margin-top: 2rem; }

@media (max-width: 40rem) {
  .team-row { grid-template-columns: minmax(0, 1fr) auto; padding: 0.75rem 0.25rem; }
  .team-row input[type=text], .team-row input[type=email] { grid-column: 1 / -1; }
  .team-list { padding: 0.75rem; box-shadow: 5px 5px 0 var(--jade); }
  .role { padding: 0.3rem 0.6rem; gap: 0.3rem; }
}

/* Écrans de compte (Devise) : le formulaire posé sur une fiche */

:is(.page-sessions, .page-registrations, .page-passwords, .page-confirmations, .page-invitations, .page-invitation_acceptances) main { max-width: 34rem; }
:is(.page-sessions, .page-registrations, .page-passwords, .page-confirmations, .page-invitations, .page-invitation_acceptances) main > h2:first-of-type {
  font-size: 2.75rem;
  font-weight: 800;
  font-stretch: 78%;
  margin: 0 0 1.5rem;
}
:is(.page-sessions, .page-registrations, .page-passwords, .page-confirmations, .page-invitations, .page-invitation_acceptances) main > form {
  padding: 1.75rem;
  border: 2px solid var(--ink);
  border-radius: 1.5rem;
  background: var(--surface);
  box-shadow: 8px 8px 0 var(--orchid);
}
:is(.page-sessions, .page-registrations, .page-passwords, .page-confirmations, .page-invitations, .page-invitation_acceptances) main > form input:not([type=checkbox]):not([type=submit]) { max-width: none; }
.actions input[type=submit], .actions .btn { margin-top: 0.5rem; }
.auth-links { margin-top: 2rem; font-size: 0.9375rem; }
.auth-links p { margin: 0 0 0.45rem; }
.danger-zone { margin-top: 3rem; padding: 1.25rem 1.5rem; border: 2px dashed var(--danger); border-radius: 1.25rem; }
.danger-zone h3 { margin-top: 0; }
.danger-zone form { display: inline; }

/* Accueil */

.page-pages main { max-width: 72rem; }

.home-hero { max-width: 44rem; margin-bottom: 3.5rem; }
.home-hero h1 {
  font-size: clamp(3rem, 8vw, 5.75rem);
  font-weight: 800;
  font-stretch: 78%;
  line-height: 0.98;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
}
/* Mot par mot : seuls l'opacité, la transformation et la couleur bougent, la mise en page du titre ne change jamais. */
.home-hero h1 .word {
  display: inline-block;
  animation: word-in 640ms calc(var(--i) * 70ms) var(--bounce) both;
}
.lead { font-size: 1.25rem; line-height: 1.5; max-width: 36rem; color: var(--ink-soft); }
.home-hero .actions { margin-top: 2rem; }

.home-scene {
  margin: 0 0 4rem;
  padding: 1.75rem 2rem 1.5rem;
  max-width: 40rem;
  border: 2px solid var(--ink);
  border-radius: 1.75rem;
  background: var(--surface);
  box-shadow: 10px 10px 0 var(--azure);
  rotate: -1.5deg;
  animation: scene-in 800ms var(--bounce) 350ms both;
}
.scene-title { font-size: 1.375rem; font-weight: 800; font-stretch: 80%; margin-bottom: 0.25rem; }

@media (min-width: 64rem) {
  .page-pages main {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    column-gap: 4rem;
    align-items: center;
  }
  .home-hero, .home-scene { margin-bottom: 4.5rem; }
  .home-steps { grid-column: 1 / -1; }
}

.home-steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 2rem;
}
.home-steps li { counter-increment: step; }
.home-steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.85rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-size: 1.375rem;
  font-weight: 800;
}
.home-steps li:nth-child(1)::before { background: var(--pink); }
.home-steps li:nth-child(2)::before { background: var(--saffron); }
.home-steps li:nth-child(3)::before { background: var(--jade); }
.home-steps h2 { font-size: 1.375rem; margin: 0 0 0.4rem; }
.home-steps p { margin: 0; color: var(--ink-soft); }

/* Échelle 1 à 5 : chaque pastille glisse jusqu'à sa note, la moyenne tombe dessus */

.track {
  position: relative;
  height: 5.25rem;
  margin: 1.25rem 1.25rem 0.75rem;
}
.track::before {
  content: "";
  position: absolute;
  inset: 2.85rem 0 auto;
  height: 0.5rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #EFEAF8, #E0D8F2);
}
.track .avatar {
  position: absolute;
  top: 0.25rem;
  left: var(--pos);
  translate: calc(-50% + var(--stack, 0) * 1.1rem) 0;
  z-index: 1;
  animation: slide-to 950ms var(--bounce) both;
  animation-delay: calc(var(--i, 0) * 120ms + 250ms);
}
.track-avg {
  position: absolute;
  top: 3.6rem;
  left: var(--pos);
  translate: -50% 0;
  z-index: 2;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.8125rem;
  font-weight: 800;
  animation: drop 600ms var(--bounce) 900ms both;
}
.track-avg::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 2px;
  height: 0.9rem;
  translate: -50% 0;
  background: var(--ink);
}
.track-scale {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}
.track-scale li { width: 0; display: flex; justify-content: center; }

/* Synthèse */

.question-summary {
  margin-top: 2.5rem;
  padding: 1.75rem 1.75rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 1.75rem;
  background: var(--surface);
}
.question-summary h2 { margin: 0 0 0.5rem; }

.average { margin: 0 0 0.5rem; }
.average strong { font-size: 1.75rem; font-weight: 800; font-stretch: 80%; white-space: nowrap; }
.average span { color: var(--ink-soft); font-size: 0.875rem; }

.ratings { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
.ratings li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.7rem 0.15rem 0.35rem;
  border-radius: 999px;
  background: var(--voice-tint);
  font-size: 0.875rem;
  font-weight: 600;
}
.ratings li::before { content: ""; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--voice); border: 1.5px solid var(--ink); }

.comments { margin: 0.5rem 0 0; padding: 0; list-style: none; }
.comments li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  margin-bottom: 1.25rem;
}
.comments blockquote {
  margin: 0;
  padding: 0.85rem 1.1rem;
  border: 2px solid var(--voice);
  border-radius: 0.3rem 1.25rem 1.25rem 1.25rem;
  background: var(--voice-tint);
  font-size: 1.125rem;
  line-height: 1.5;
  transform-origin: 0 0;
  animation: pop 560ms var(--bounce) both;
  animation-delay: calc(var(--i, 0) * 110ms + 300ms);
}
.comments blockquote p { margin: 0 0 0.5rem; }
.comments blockquote p:last-child { margin: 0; }
.comments cite { display: block; margin: 0.3rem 0 0 0.4rem; font-style: normal; font-size: 0.875rem; font-weight: 650; color: var(--ink-soft); }
.home-scene .comments li { margin-bottom: 0.85rem; }
.home-scene .comments blockquote { font-size: 1rem; animation-delay: calc(var(--i, 0) * 160ms + 1100ms); }
.home-scene .track .avatar { animation-delay: calc(var(--i, 0) * 120ms + 800ms); }
.home-scene .track-avg { animation-delay: 1400ms; }

/* Formulaire du sondé */

.respondent main { max-width: 44rem; padding-top: 2.25rem; }
.respondent .site-header { padding-inline: max(1.25rem, calc((100% - 44rem) / 2 + 1.25rem)); }

.respondent-intro { margin-bottom: 2rem; }
.respondent-intro h1 { font-size: clamp(2.25rem, 6vw, 3.25rem); }

.notice-transparency {
  margin: 1.5rem 0 0;
  padding: 0.85rem 1.1rem;
  border: 2px solid var(--saffron);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--saffron) 18%, var(--surface));
}

.subject { margin-top: 3rem; border-color: var(--voice); box-shadow: 6px 6px 0 var(--voice); }
.subject legend {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 1rem 0.3rem 0.3rem;
  background: var(--voice);
  font-size: 1.5rem;
}
.subject legend::before {
  content: attr(data-initials);
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--ink);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

.answer { margin: 0; padding: 1.25rem 0 1.5rem; border-bottom: 2px dashed var(--line); }
.answer:last-child { border-bottom: 0; }
.answer .prompt { font-size: 1.3125rem; font-weight: 700; font-stretch: 88%; line-height: 1.25; margin: 0 0 0.9rem; }
.answer .prompt strong { font-weight: inherit; }
.answer .rating { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.85rem; margin-bottom: 1rem; }
.answer .rating input { width: 4.25rem; text-align: center; font-weight: 700; }
.answer .comment label { display: block; margin-bottom: 0.35rem; }
.answer textarea { max-width: none; min-height: 6.5rem; }

.rating-picks { display: inline-flex; gap: 0.4rem; }
.rating-pick {
  width: 2.6rem;
  height: 2.6rem;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 120ms, transform 160ms var(--bounce);
}
.rating-pick:hover:not(:disabled) { border-color: var(--ink); transform: translateY(-3px); }
.rating-pick[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--voice);
  animation: pick 420ms var(--bounce);
}
.rating-pick:disabled { cursor: default; opacity: 0.55; }
.rating-pick[aria-pressed="true"]:disabled { opacity: 1; }

/* Champs obligatoires : mention près du libellé, signalement d'un champ manquant, compteur dans la barre d'actions. */
.field-head { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; }
.answer .comment .field-head { display: flex; margin-bottom: 0.35rem; }
.answer .comment .field-head label { margin-bottom: 0; }
.required-hint { color: var(--ink-soft); font-size: 0.8125rem; font-weight: 600; }
.answer .comment .error { display: block; margin-top: 0.35rem; }
.answer-progress { margin-right: auto; align-self: center; font-size: 0.9375rem; font-weight: 700; color: var(--ink); }
.answer-progress.is-done { color: #0b7a58; }
/* La barre d'actions collée en bas ne doit pas cacher le champ qui reçoit le focus après un refus. */
html:has(.answer-form) { scroll-padding-bottom: 7rem; }

.answer.missing {
  margin-inline: -0.75rem;
  padding-inline: 0.75rem;
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  box-shadow: inset 4px 0 0 var(--danger);
}

.answer-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  justify-content: flex-end;
  margin: 2.25rem -1.25rem 0;
  padding: 0.9rem 1.25rem;
  border-top: 2px solid var(--ink);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(6px);
}

/* Pied de page de développement */

.dev-footer { padding: 0.5rem 1.25rem; border-top: 2px dashed var(--line-strong); font-size: 0.8rem; color: var(--ink-soft); }

/* Mouvements */

@keyframes word-in {
  from { opacity: 0; color: var(--voice); transform: translateY(0.45em) scale(0.85) rotate(-6deg); }
  60% { opacity: 1; color: var(--voice); }
}
@keyframes scene-in {
  from { opacity: 0; transform: translateY(1.5rem) rotate(3deg); }
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.6); }
}
@keyframes slide-to {
  from { left: 0; opacity: 0; }
  20% { opacity: 1; }
}
@keyframes drop {
  from { opacity: 0; transform: translateY(-1.25rem); }
}
@keyframes pick {
  50% { transform: scale(1.25); }
}
/* Sans opacité : une ligne qui vient d'être ajoutée doit rester utilisable tout de suite. */
@keyframes row-in {
  from { transform: translateX(-1rem); background: color-mix(in srgb, var(--saffron) 35%, var(--surface)); }
}
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-0.75rem) scale(0.97); }
}
@keyframes pulse {
  from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--jade) 60%, transparent); }
  to { box-shadow: 0 0 0 0.45rem transparent; }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(1.25rem) scale(0.96); }
}
/* --toast-exit : sens du balayage qui a fermé le toast. */
@keyframes toast-out {
  to { opacity: 0; transform: translateX(var(--toast-exit, 0)) scale(0.94); }
}
@keyframes toast-fade {
  from { opacity: 0; }
}
@keyframes toast-timer {
  to { transform: scaleX(0); }
}

/* Marque du logo, une animation par élément : l'arrivée (.arrive, une seule fois par chargement complet, voir le contrôleur
   brand-mark), le balancement au survol (.sway), le défilé de couleurs (la bulle de devant) et la pulsation des points. */
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-brand-arrived]) .arrive-back { animation: bubble-in 520ms var(--bounce) both; }
  :root:not([data-brand-arrived]) .arrive-front { animation: bubble-in 520ms 260ms var(--bounce) both; }
  .brand-mark .bubble-front { animation: voices 12s linear infinite; }
  .brand-mark .typing { animation: typing 1.2s infinite; }
  .brand-mark .typing:nth-of-type(1) { animation-delay: 700ms; }
  .brand-mark .typing:nth-of-type(2) { animation-delay: 850ms; }
  .brand-mark .typing:nth-of-type(3) { animation-delay: 1000ms; }
  .brand:is(:hover, :focus-visible) .sway-back { animation: sway 520ms var(--bounce); }
  .brand:is(:hover, :focus-visible) .sway-front { animation: sway 520ms 90ms var(--bounce); }
}
@keyframes bubble-in { from { scale: 0; } }
@keyframes typing { 30% { translate: 0 -2px; } 55% { opacity: 0.4; } }
@keyframes sway { 30% { rotate: -6deg; } 65% { rotate: 4deg; } }
/* Cinq voix du site, 12 s par tour : chaque couleur tient, le passage à la suivante est court pour éviter les teintes boueuses. */
@keyframes voices {
  0%, 17.5% { fill: var(--saffron); }
  20%, 37.5% { fill: var(--jade); }
  40%, 57.5% { fill: var(--azure); }
  60%, 77.5% { fill: var(--orchid); }
  80%, 97.5% { fill: var(--lime); }
  100% { fill: var(--saffron); }
}

/* Page introuvable : l'écran de synthèse, où personne n'a trouvé la page. */

.not-found-hero { max-width: 36rem; margin-bottom: 3rem; }
.not-found-code { margin: 0; font-size: 0.9375rem; font-weight: 700; color: var(--ink-soft); }
.not-found-digits {
  margin: 0 0 0.25rem;
  font-size: clamp(6rem, 24vw, 10.5rem);
  font-weight: 800;
  font-stretch: 78%;
  line-height: 1;
  letter-spacing: -0.02em;
}
/* L'ombre décalée reprend celle du « F » du logotype. */
.not-found-digits .digit {
  display: inline-block;
  text-shadow: 0.05em 0.05em 0 var(--voice);
  animation: word-in 640ms calc(var(--i, 0) * 120ms) var(--bounce) both;
}
/* Le zéro cherche partout : il tangue de gauche à droite une fois arrivé. */
.not-found-digits .digit-lost {
  animation: word-in 640ms calc(var(--i, 0) * 120ms) var(--bounce) both, wander 3.2s ease-in-out 1.4s infinite;
}
.not-found h1 { font-size: clamp(2.25rem, 6vw, 3.5rem); font-weight: 800; font-stretch: 78%; line-height: 1; margin-bottom: 1rem; }
.not-found h1 .word { display: inline-block; animation: word-in 640ms calc(var(--i, 0) * 70ms) var(--bounce) both; }
.not-found .actions { margin-top: 1.5rem; }
.not-found-scene { box-shadow: 10px 10px 0 var(--pink); rotate: 1.5deg; margin-bottom: 1rem; }
.not-found-scene .track-avg { animation-delay: 1000ms; }
@keyframes wander {
  25% { transform: translateX(-0.08em) rotate(-10deg); }
  75% { transform: translateX(0.08em) rotate(10deg); }
}
@media (min-width: 64rem) {
  .not-found { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 4rem; align-items: center; }
  .not-found-hero, .not-found-scene { margin-bottom: 0; }
}

/* Boîte de confirmation : remplace l'alerte du navigateur (contrôleur confirm-dialog, partiel layouts/_confirm_dialog).
   <dialog> passe dans la couche supérieure : pas de z-index, et la page derrière est inerte. --tone colore l'ombre et la
   pastille (safran, ou rouge pour une action destructive). L'entrée et la sortie sont des transitions (@starting-style,
   allow-discrete) ; la règle prefers-reduced-motion en bas du fichier les coupe. Sous 40rem, la boîte devient une feuille en bas. */

dialog.confirm {
  --tone: var(--saffron);
  --tone-shadow: var(--pink);
  width: min(26rem, calc(100vw - 2rem));
  margin: auto;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 1.5rem;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--tone-shadow);
  overflow: visible;
  opacity: 0;
  transform: translateY(0.75rem) scale(0.94);
  transition: opacity 180ms var(--glide), transform 260ms var(--bounce), overlay 260ms allow-discrete, display 260ms allow-discrete;
}
dialog.confirm[open] { opacity: 1; transform: none; }
@starting-style { dialog.confirm[open] { opacity: 0; transform: translateY(0.75rem) scale(0.94); } }
dialog.confirm[data-tone="danger"] { --tone: var(--danger); --tone-shadow: color-mix(in srgb, var(--danger) 35%, var(--surface)); }

dialog.confirm::backdrop {
  background: color-mix(in srgb, var(--ink) 55%, transparent);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 200ms, overlay 200ms allow-discrete, display 200ms allow-discrete;
}
dialog.confirm[open]::backdrop { opacity: 1; }
@starting-style { dialog.confirm[open]::backdrop { opacity: 0; } }

.confirm form { display: grid; gap: 0.75rem; margin: 0; padding: 1.5rem 1.5rem 1.25rem; }
.confirm-badge {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.25rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--tone);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}
.confirm[data-tone="danger"] .confirm-badge { color: #fff; }
.confirm-badge svg { width: 1.5rem; height: 1.5rem; }
.confirm h2 { margin: 0; font-size: 1.375rem; line-height: 1.2; text-wrap: balance; }
.confirm-detail { margin: 0; color: var(--ink-soft); font-size: 0.9375rem; }
.confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.75rem; margin-top: 0.5rem; }

@media (max-width: 40rem) {
  dialog.confirm {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-bottom: 0;
    border-radius: 1.5rem 1.5rem 0 0;
    box-shadow: 0 -4px 0 var(--tone-shadow);
    transform: translateY(100%);
  }
  dialog.confirm[open] { transform: none; }
  @starting-style { dialog.confirm[open] { transform: translateY(100%); } }
  .confirm form { padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px)); }
  .confirm-actions { flex-direction: column-reverse; }
  .confirm-actions .btn { width: 100%; padding-block: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  /* Les toasts gardent un fondu, et la barre d'une notice, qui est son minuteur, continue de se vider. */
  .toast { animation: toast-fade 200ms ease-out both !important; }
  .toast.is-leaving { animation: toast-fade 200ms ease-in reverse forwards !important; }
  .toast.is-timed::after { animation: toast-timer var(--toast-duration, 5s) linear forwards !important; }
}

/* Petits écrans */

@media (max-width: 40rem) {
  h1 { font-size: 2.25rem; }
  main { padding-top: 2rem; }
  .site-header nav { gap: 0.25rem 1rem; }

  .campaign-list li {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "badge name" "badge deadline" "badge status";
    row-gap: 0.25rem;
  }
  .campaign-list .status { justify-self: start; }

  fieldset { padding: 1.25rem 1rem 0.5rem; }
  .question-summary { padding: 1.25rem 1.1rem 0.75rem; }
  .comments .avatar { width: 1.85rem; height: 1.85rem; font-size: 0.6875rem; }
  .comments blockquote { font-size: 1.0625rem; }
  .home-scene { padding: 1.25rem 1.1rem; rotate: 0deg; box-shadow: 6px 6px 0 var(--azure); }
  .track { margin-inline: 1rem; }

  .contact { grid-template-columns: minmax(0, 1fr) auto; }
  .contact input[type=email] { grid-row: 2; }
  .contact .link-remove { grid-row: 1 / span 2; }
  .page-head .btn { width: 100%; }
  .answer-actions { padding-inline: 0.75rem; }
  .answer-actions input { flex: 1 1 100%; min-width: 0; padding-inline: 0.8rem; font-size: 0.875rem; white-space: normal; }
}
