/* Jarvis — feuille de style unique.
 *
 * Direction : clair par défaut, luxe sobre. Ivoire, cartes blanches, filets fins.
 * Champagne pour les filets et les anneaux ; bordeaux UNIQUEMENT pour l'arc du
 * noyau, les alertes, le point de l'onglet actif et le bouton principal.
 * Animations : seulement transform et opacity ; en pause quand la page est
 * cachée ; coupées si le téléphone demande moins de mouvement.
 */

/* --- Polices (auto-hébergées, licence OFL dans polices/) ------------------ */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("polices/manrope-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("polices/manrope-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("polices/cormorant-garamond-latin-500-italic.woff2") format("woff2");
}

/* --- Couleurs ------------------------------------------------------------ */
:root {
  --fond: #FBF8F4;
  --carte: #FFFFFF;
  --texte: #1C1917;
  --secondaire: #78716C;
  --discret: #A8A29E;
  --filet: #EDE7DF;
  --champagne: #C9A961;
  --champagne-doux: rgba(201, 169, 97, 0.42);
  --bordeaux: #A3195B;
  --sur-bordeaux: #FFFFFF;
  --bordeaux-voile: rgba(163, 25, 91, 0.08);
  --ok: #6F8A68;
  --ombre: 0 1px 2px rgba(28, 25, 23, 0.04), 0 14px 34px -20px rgba(28, 25, 23, 0.22);

  --police: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --police-voix: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --rayon: 20px;
  --gouttiere-g: max(20px, env(safe-area-inset-left));
  --gouttiere-d: max(20px, env(safe-area-inset-right));
  --hauteur-onglets: 66px;
  color-scheme: light;
}

:root[data-theme="nuit"] {
  --fond: #17120F;
  --carte: #201A16;
  --texte: #F4EEE9;
  --secondaire: #A8A29E;
  --discret: #7D7570;
  --filet: #2F2823;
  --champagne: #B39C68;
  --champagne-doux: rgba(179, 156, 104, 0.32);
  --bordeaux: #C66490;
  --sur-bordeaux: #17120F;
  --bordeaux-voile: rgba(198, 100, 144, 0.14);
  --ok: #93AE8B;
  --ombre: none;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--fond);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--fond);
  color: var(--texte);
  font: 400 16px/1.55 var(--police);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

p, h1, h2, h3, ol, ul, dl, dd {
  margin: 0;
}

h1, h2, h3 {
  font-weight: 500;
}

ol, ul {
  padding: 0;
  list-style: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

button, input {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--champagne-doux);
}

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

.visuellement-cache {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.evitement {
  position: absolute;
  top: -80px;
  left: 12px;
  z-index: 30;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--carte);
  box-shadow: var(--ombre);
}

.evitement:focus {
  top: calc(env(safe-area-inset-top) + 8px);
}

/* --- Textes -------------------------------------------------------------- */
.surtitre {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--secondaire);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.surtitre::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--champagne);
}

.titre {
  font: italic 500 42px/1.1 var(--police-voix);
  letter-spacing: -0.005em;
}

.voix {
  max-width: 26ch;
  font: italic 500 clamp(25px, 6.6vw, 32px)/1.3 var(--police-voix);
  text-wrap: pretty;
}

.fort { font-weight: 500; }
.discret { color: var(--secondaire); }
.texte-alerte { color: var(--bordeaux); }

.texte-erreur {
  color: var(--bordeaux);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.aide {
  margin-bottom: 12px;
  color: var(--secondaire);
  font-size: 14px;
}

.aide code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--texte);
  overflow-wrap: anywhere; /* jamais de défilement horizontal sur téléphone */
}

.vide {
  padding: 20px;
  border: 1px dashed var(--filet);
  border-radius: var(--rayon);
  color: var(--secondaire);
  font-size: 15px;
  text-align: center;
}

/* --- En-tête, bandeau, messages ------------------------------------------ */
.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) var(--gouttiere-d) 8px var(--gouttiere-g);
  view-transition-name: entete;
}

.entete-logo {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.logo {
  width: auto;
  height: 42px;
}

.logo--nuit,
:root[data-theme="nuit"] .logo--clair {
  display: none;
}

:root[data-theme="nuit"] .logo--nuit {
  display: block;
}

.entete-marque {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  text-decoration: none;
}

.entete-nom {
  font: italic 500 23px/1 var(--police-voix);
}

.marque {
  width: 30px;
  height: 30px;
  overflow: visible;
}

.marque--nommee,
.noyau--nomme {
  view-transition-name: noyau;
}

.bandeau {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(720px, calc(100% - 40px));
  margin: 6px auto 2px;
  padding: 10px 10px 10px 16px;
  border-radius: 16px;
  background: var(--bordeaux);
  color: var(--sur-bordeaux);
  font-size: 14px;
  line-height: 1.4;
  animation: entree 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.bandeau-signe {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sur-bordeaux);
  animation: respire 2s ease-in-out infinite;
}

.bandeau-texte {
  flex: 1;
  min-width: 0;
}

.bandeau-lien {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  font-weight: 500;
  white-space: nowrap;
}

.messages {
  width: min(720px, calc(100% - 40px));
  margin: 8px auto 0;
}

.message {
  padding: 12px 16px;
  border: 1px solid var(--filet);
  border-left: 2px solid var(--champagne);
  border-radius: 14px;
  background: var(--carte);
  font-size: 14px;
  animation: entree 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

/* --- Page et blocs -------------------------------------------------------- */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px var(--gouttiere-d) calc(var(--hauteur-onglets) + env(safe-area-inset-bottom) + 36px) var(--gouttiere-g);
}

.bloc {
  margin-top: 36px;
}

.bloc--fin {
  margin-top: 44px;
  text-align: center;
}

.page-titre {
  padding: 18px 0 4px;
}

.page-titre .surtitre {
  margin-bottom: 8px;
}

.carte {
  border: 1px solid var(--filet);
  border-radius: var(--rayon);
  background: var(--carte);
  box-shadow: var(--ombre);
}

.grille {
  display: grid;
  gap: 12px;
}

/* --- Noyau (Brief) ------------------------------------------------------- */
.heros {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 14px 0 6px;
  text-align: center;
}

.heros-texte {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.noyau {
  position: relative;
  aspect-ratio: 1;
  animation: apparition-noyau 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.noyau--grand {
  width: min(64vw, 250px);
}

.noyau-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.anneau {
  fill: none;
  stroke: var(--champagne);
}

.anneau--pointille { stroke-width: 1; opacity: 0.75; }
.anneau--balayage { stroke-width: 1.6; stroke-linecap: round; }
.anneau--graduations { stroke-width: 3; opacity: 0.5; }
.anneau--heures { stroke-width: 6; opacity: 0.85; }
.anneau--fin { stroke-width: 1; }

.arc-trait {
  fill: none;
  stroke: var(--bordeaux);
  stroke-width: 3;
  stroke-linecap: round;
}

.arc-trait--marque {
  stroke-width: 2.2;
}

.noyau-coeur {
  fill: var(--carte);
  stroke: var(--champagne);
  stroke-width: 0.8;
}

.noyau-halo-centre { stop-color: var(--champagne); stop-opacity: 0.4; }
.noyau-halo-bord { stop-color: var(--champagne); stop-opacity: 0; }

/* Rotation autour du centre de chaque groupe (boîte de ses cercles). */
.tourne,
.arc,
.noyau-halo {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.tourne--lent { animation: rotation 120s linear infinite; }
.tourne--balayage { animation: rotation 18s linear infinite; }
.tourne--inverse { animation: rotation 220s linear infinite reverse; }

/* L'arc (120°) tourne sous un demi-plan : il apparaît comme s'il se traçait. */
.arc {
  transform: rotate(-60deg);
  animation: arc-trace 1.9s cubic-bezier(0.65, 0, 0.35, 1) 0.35s backwards;
}

.noyau-halo {
  opacity: 0.55;
  transform: scale(0.94);
}

.en-releve .noyau-halo {
  animation: pulsation 2.6s ease-in-out infinite;
}

.noyau-centre {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.noyau-nombre {
  font: italic 500 clamp(46px, 13vw, 60px)/1 var(--police-voix);
  font-variant-numeric: lining-nums;
}

.noyau-etiquette {
  margin-top: 6px;
  color: var(--secondaire);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* --- La voix qui s'écrit -------------------------------------------------- */
/* Avec JavaScript, la phrase attend d'être écrite (au plus 1,4 s si app.js manque). */
.js .voix[data-voix]:not(.voix--ecrite) {
  animation: voix-attente 1.4s;
}

.mot {
  white-space: nowrap;
}

.voix--ecrite .lettre {
  animation: lettre 0.55s ease-out backwards;
}

.curseur {
  display: inline-block;
  width: 1px;
  height: 0.95em;
  margin-left: 3px;
  vertical-align: -0.12em;
  background: var(--champagne);
  opacity: 0;
  animation: curseur 1.1s steps(1, end) 3 backwards;
}

.releve-finie {
  color: var(--secondaire);
  font-size: 14px;
  animation: entree 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.releve-finie a {
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* zone tactile */
  padding: 0 6px;
  color: var(--texte);
  font-weight: 500;
}

/* --- Boîtes et mails (Brief) ---------------------------------------------- */
.boites {
  display: grid;
  gap: 10px;
}

.boite {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
}

.boite .pastille {
  margin-top: 8px;
}

.boite-texte {
  min-width: 0;
}

.boite-nom {
  font-weight: 500;
}

.boite-adresse {
  margin-left: 4px;
  color: var(--secondaire);
  font-size: 13.5px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.boite-detail {
  color: var(--secondaire);
  font-size: 14px;
}

.mails {
  padding: 0 18px;
  border: 1px solid var(--filet);
  border-radius: var(--rayon);
  background: var(--carte);
  box-shadow: var(--ombre);
}

.mail {
  padding: 14px 0;
  border-bottom: 1px solid var(--filet);
}

.mail:last-child {
  border-bottom: 0;
}

.mail-ligne {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.mail-expediteur,
.mail-sujet {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-expediteur {
  font-weight: 500;
}

.mail--erreur .mail-expediteur {
  color: var(--secondaire);
}

.mail-quand {
  display: flex;
  flex: none;
  align-items: baseline;
  gap: 8px;
  color: var(--secondaire);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.mail-compte {
  color: var(--secondaire);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mail-sujet {
  color: var(--secondaire);
  font-size: 15px;
}

.etiquettes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.etiquette {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--filet);
  border-radius: 999px;
  color: var(--secondaire);
  font-size: 11.5px;
  white-space: nowrap;
}

.etiquette--alerte {
  border-color: transparent;
  background: var(--bordeaux-voile);
  color: var(--bordeaux);
}

/* Dossier d'origine d'un mail qui ne vient pas de la Boîte de réception. */
.etiquette--dossier {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  border-color: var(--champagne-doux);
  color: var(--texte);
  line-height: 20px;
  text-overflow: ellipsis;
}

/* --- Pastilles ------------------------------------------------------------ */
.pastille {
  display: inline-block;
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--discret);
}

.pastille--ok { background: var(--ok); }

.pastille--alerte {
  background: var(--bordeaux);
  box-shadow: 0 0 0 4px var(--bordeaux-voile);
}

.pastille--en-cours {
  background: var(--champagne);
  animation: respire 2s ease-in-out infinite;
}

.pastille--neutre {
  border: 1px solid var(--discret);
  background: transparent;
}

/* --- Santé ---------------------------------------------------------------- */
.compte,
.inventaire,
.reglage,
.indicateur {
  padding: 18px;
}

.inventaire + .inventaire {
  margin-top: 12px;
}

.carte-entete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  margin-bottom: 14px;
}

.carte-titre {
  font: italic 500 25px/1.2 var(--police-voix);
}

.carte-sous-titre {
  flex-basis: 100%;
  color: var(--secondaire);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.details {
  display: grid;
  gap: 12px;
}

.details > div {
  display: grid;
  gap: 1px;
}

.details dt {
  color: var(--secondaire);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.details dd {
  font-size: 15px;
  overflow-wrap: anywhere;
}

/* Dossiers lus par la relève, dans la carte d'un compte. */
.dossiers-suivis {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.dossiers-suivis li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.carte-action {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--filet);
}

.indicateur {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.indicateur .pastille {
  margin-top: 11px;
}

.indicateur-valeur {
  font-size: 15px;
}

.indicateur .discret {
  font-size: 13.5px;
}

.liste {
  padding: 2px 18px;
}

.ligne {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--filet);
  font-size: 14.5px;
}

.ligne:last-child {
  border-bottom: 0;
}

.ligne .pastille {
  margin-top: 7px;
}

.ligne-texte {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Inventaire : l'arborescence des dossiers, indentée selon le séparateur. */
.dossier {
  padding: 10px 0;
  border-top: 1px solid var(--filet);
}

.niveau-1 { padding-left: 14px; }
.niveau-2 { padding-left: 28px; }
.niveau-3 { padding-left: 42px; }
.niveau-4 { padding-left: 56px; }
.niveau-5 { padding-left: 70px; }

.dossier-ligne {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dossier-nom {
  min-width: 0;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dossier:not(.niveau-0) .dossier-nom::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 1px;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--champagne);
}

.dossier-compteurs {
  flex: none;
  margin-left: auto;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.dossier-details {
  margin-top: 3px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* Sélecteur de thème */
.choix-theme {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--filet);
  border-radius: 999px;
  background: var(--fond);
}

.choix {
  min-width: 76px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--secondaire);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.choix[aria-pressed="true"] {
  background: var(--carte);
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.1);
  color: var(--texte);
}

/* --- Boutons et champs ----------------------------------------------------- */
.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.bouton:active {
  transform: scale(0.97);
}

.bouton--principal {
  background: var(--bordeaux);
  color: var(--sur-bordeaux);
}

.bouton--discret {
  border-color: var(--filet);
  background: transparent;
  color: var(--secondaire);
}

.bouton--large {
  width: 100%;
}

.champ {
  width: 100%;
  height: 54px;
  padding: 0 18px;
  border: 1px solid var(--filet);
  border-radius: 16px;
  background: var(--carte);
  font-size: 17px;
}

.champ:focus {
  border-color: var(--champagne);
  outline: none;
  box-shadow: 0 0 0 3px var(--champagne-doux);
}

.champ[aria-invalid="true"] {
  border-color: var(--bordeaux);
}

.champ-libelle {
  color: var(--secondaire);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* --- Écrans seuls : connexion, hors ligne, erreur -------------------------- */
.seul {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 32px) max(24px, env(safe-area-inset-right))
    calc(env(safe-area-inset-bottom) + 24px) max(24px, env(safe-area-inset-left));
}

.seul-carte {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: entree 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.seul-logo {
  width: 180px;
  height: auto;
  margin-bottom: 14px;
}

.marque--seul {
  width: 64px;
  height: 64px;
}

.marque--veille {
  opacity: 0.7;
}

.marque--veille .arc-trait {
  stroke: var(--discret);
}

.seul-titre {
  font: italic 500 46px/1 var(--police-voix);
  letter-spacing: 0.01em;
}

.voix--seul {
  max-width: 28ch;
  margin-bottom: 8px;
  color: var(--secondaire);
  font-size: 21px;
}

.connexion {
  display: grid;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
  text-align: left;
}

.connexion .bouton {
  margin-top: 8px;
}

.connexion-erreur {
  font-size: 14px;
}

.seul-pied {
  color: var(--discret);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* --- Pages d'attente -------------------------------------------------------- */
.attente {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 36px 0 12px;
  text-align: center;
}

.marque--attente {
  width: 84px;
  height: 84px;
  margin-bottom: 14px;
}

.attente .surtitre {
  margin: 0;
}

.attente .surtitre::after {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--champagne);
}

.voix--douce {
  max-width: 30ch;
  font-size: clamp(21px, 5.4vw, 26px);
}

.etapes {
  position: relative;
  display: grid;
  width: 100%;
  max-width: 320px;
  margin-top: 28px;
  text-align: left;
}

.etapes::before {
  content: "";
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 5px;
  width: 1px;
  background: var(--filet);
}

.etape {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  color: var(--secondaire);
  font-size: 14.5px;
  animation: entree 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.etape:nth-child(2) { animation-delay: 0.08s; }
.etape:nth-child(3) { animation-delay: 0.16s; }
.etape:nth-child(4) { animation-delay: 0.24s; }
.etape:nth-child(5) { animation-delay: 0.32s; }

.etape-point {
  position: relative;
  z-index: 1;
  flex: none;
  width: 11px;
  height: 11px;
  border: 1px solid var(--discret);
  border-radius: 50%;
  background: var(--fond);
}

.etape--faite,
.etape--visee {
  color: var(--texte);
}

.etape--visee {
  font-weight: 500;
}

.etape--faite .etape-point {
  border-color: var(--champagne);
  background: var(--champagne);
}

.etape--visee .etape-point {
  border-color: var(--champagne);
}

.etape--visee .etape-point::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid var(--champagne);
  border-radius: 50%;
  animation: onde 2.4s ease-out infinite;
}

/* --- Barre d'onglets --------------------------------------------------------- */
.onglets {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom))
    max(6px, env(safe-area-inset-left));
  border-top: 1px solid var(--filet);
  background: var(--carte);
  view-transition-name: onglets;
}

.onglet {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 54px;
  color: var(--secondaire);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.icone {
  width: 22px;
  height: 22px;
  transition: transform 0.2s ease;
}

.onglet:active .icone {
  transform: scale(0.9);
}

.onglet-libelle {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.onglet--actif {
  color: var(--texte);
}

.onglet-point {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--bordeaux);
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.onglet--actif .onglet-point {
  opacity: 1;
  transform: none;
}

/* --- Cascade d'entrée des listes ---------------------------------------------- */
.cascade > * {
  animation: entree 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.cascade > :nth-child(1) { animation-delay: 0.1s; }
.cascade > :nth-child(2) { animation-delay: 0.15s; }
.cascade > :nth-child(3) { animation-delay: 0.2s; }
.cascade > :nth-child(4) { animation-delay: 0.25s; }
.cascade > :nth-child(5) { animation-delay: 0.3s; }
.cascade > :nth-child(6) { animation-delay: 0.35s; }
.cascade > :nth-child(7) { animation-delay: 0.4s; }
.cascade > :nth-child(8) { animation-delay: 0.45s; }
.cascade > :nth-child(9) { animation-delay: 0.5s; }
.cascade > :nth-child(10) { animation-delay: 0.55s; }
.cascade > :nth-child(11) { animation-delay: 0.6s; }
.cascade > :nth-child(12) { animation-delay: 0.65s; }
.cascade > :nth-child(13) { animation-delay: 0.7s; }
.cascade > :nth-child(14) { animation-delay: 0.75s; }
.cascade > :nth-child(n + 15) { animation-delay: 0.8s; }

/* --- Animations (transform et opacity seulement) ------------------------------- */
@keyframes entree {
  from { opacity: 0; transform: translateY(10px); }
}

@keyframes apparition-noyau {
  from { opacity: 0; transform: scale(0.94); }
}

@keyframes rotation {
  to { transform: rotate(360deg); }
}

@keyframes arc-trace {
  from { transform: rotate(-185deg); }
}

@keyframes pulsation {
  0%, 100% { opacity: 0.5; transform: scale(0.94); }
  50% { opacity: 1; transform: scale(1.12); }
}

@keyframes respire {
  50% { opacity: 0.35; }
}

@keyframes onde {
  from { opacity: 0.9; transform: scale(0.6); }
  to { opacity: 0; transform: scale(1.4); }
}

@keyframes voix-attente {
  0%, 99% { opacity: 0; }
}

@keyframes lettre {
  from { opacity: 0; }
}

@keyframes curseur {
  0% { opacity: 0; }
  5% { opacity: 1; }
  55% { opacity: 0; }
}

/* Transitions entre pages : le noyau passe d'une page à l'autre. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.28s;
}

::view-transition-group(noyau) {
  animation-duration: 0.55s;
  animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Page cachée ou noyau hors de l'écran : les animations s'arrêtent. */
.page-cachee *,
.page-cachee *::before,
.page-cachee *::after,
.hors-ecran,
.hors-ecran * {
  animation-play-state: paused !important;
}

/* Le téléphone demande moins de mouvement : tout est coupé. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* --- Grands écrans -------------------------------------------------------- */
@media (min-width: 700px) {
  .grille {
    grid-template-columns: 1fr 1fr;
  }

  .boites {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .entete,
  .page {
    max-width: 960px;
  }

  .page {
    padding-bottom: 140px;
  }

  .heros {
    flex-direction: row;
    justify-content: center;
    gap: 56px;
    padding: 36px 0 20px;
    text-align: left;
  }

  .heros-texte {
    justify-items: start;
  }

  .heros .voix {
    max-width: 22ch;
    font-size: 34px;
  }

  .noyau--grand {
    width: 280px;
  }

  .logo {
    height: 50px;
  }

  /* La barre d'onglets devient un dock flottant. */
  .onglets {
    right: auto;
    bottom: 22px;
    left: 50%;
    width: 560px;
    padding: 4px 10px;
    border: 1px solid var(--filet);
    border-radius: 999px;
    box-shadow: var(--ombre);
    transform: translateX(-50%);
  }

  .onglet {
    min-height: 56px;
  }
}
