/* Onyx · mouvement
   Activé par la classe « mvt » sur <html> (avec motion.js). Retirer la classe rétablit l'état actuel.
   Ici : les tokens de mouvement, les trois niveaux (Complet, Réduit, Aucun) et les pauses (onglet caché, élément hors écran). */

/* ===== Tokens : durées et courbes nommées (mêmes valeurs que dans motion.js) ===== */
html.mvt {
  --mv: 1;                                         /* échelle : 1 en Complet, 0,75 sur téléphone, 0 sinon */
  --dur-1: calc(80ms * var(--mv));                 /* retour d'un appui */
  --dur-2: calc(140ms * var(--mv));                /* survol */
  --dur-3: calc(220ms * var(--mv));                /* apparition courante */
  --dur-4: calc(360ms * var(--mv));                /* déplacement, transition de page */
  --dur-5: calc(600ms * var(--mv));                /* moment rare : arrivée, réussite */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);   /* rebond limité */
  --ease-snap: cubic-bezier(.3, 0, 0, 1);
}
@media (max-width: 860px) { html.mvt { --mv: .75; } }
html.mvt[data-motion="reduced"], html.mvt[data-motion="none"] { --mv: 0; }

/* ===== Niveaux ===== */
@keyframes mv-fade { from { opacity: 0; } }
/* Réduit : plus aucun déplacement ni décor animé, seulement un fondu de 120 ms sur les grands blocs */
html.mvt[data-motion="reduced"] *, html.mvt[data-motion="reduced"] *::before, html.mvt[data-motion="reduced"] *::after { animation: none !important; transition: none !important; }
html.mvt[data-motion="reduced"] .main > *, html.mvt[data-motion="reduced"] .tile, html.mvt[data-motion="reduced"] .ticket { animation: mv-fade .12s linear both !important; }
html.mvt[data-motion="reduced"] .segs, html.mvt[data-motion="reduced"] .orbs { display: none; }
/* Aucun : rien ne bouge, tout est affiché d'un coup */
html.mvt[data-motion="none"] *, html.mvt[data-motion="none"] *::before, html.mvt[data-motion="none"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html.mvt[data-motion="none"] .segs, html.mvt[data-motion="none"] .orbs { display: none; }

/* ===== Pauses : onglet caché, élément hors écran ===== */
html.mvt[data-hidden] *, html.mvt[data-hidden] *::before, html.mvt[data-hidden] *::after { animation-play-state: paused !important; }
html.mvt [data-offscreen], html.mvt [data-offscreen] * { animation-play-state: paused !important; }

/* ===== Réglage du mouvement (Mon compte) : même aspect que les onglets ===== */
html.mvt .tabs button.tab { border: 0; background: none; font: inherit; font-weight: 500; font-size: 14px; cursor: pointer; }
html.mvt .tab[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
html.mvt .field-help { margin: 0; color: var(--muted); font-size: 14px; max-width: 60ch; }
html.mvt .card > .tabs { align-self: flex-start; }

/* ===== Arrivée : connexion ===== */
/* Le monogramme se trace : les trois tracés partent invisibles (motion.js les dessine) ; un filet de sécurité les affiche si le script ne tourne pas. */
@keyframes mv-safe { to { stroke-dashoffset: 0; } }
html.mvt[data-motion="full"] .ox-draw path { stroke-dasharray: 100; stroke-dashoffset: 100; animation: mv-safe .01s 3s forwards; }
/* voile posé par theme.js avant tout affichage ; retiré dès que l'écran d'ouverture est en place (et de toute façon après 3,2 s si quelque chose a échoué) */
@keyframes splash-safe { to { visibility: hidden; } }
html.splash-wait::after { content: ""; position: fixed; inset: 0; z-index: 89; background: var(--bg); pointer-events: none; animation: splash-safe 0s 3.2s forwards; }
/* écran d'ouverture du tableau de bord : un fond plein percé d'un losange qui s'agrandit, et le monogramme par-dessus */
html.mvt .splash { position: fixed; inset: 0; z-index: 90; background: var(--bg); background-image: radial-gradient(60% 50% at 50% 50%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%); will-change: clip-path; }
html.mvt .splash-mark { position: fixed; left: 50%; top: 50%; width: 112px; height: 112px; margin: -56px 0 0 -56px; z-index: 91; color: var(--accent); pointer-events: none; will-change: transform; }
html.mvt .login-form { animation: none !important; }                 /* l'ancienne entrée « rise » est remplacée par la séquence de login.js */
html.mvt .login-mobile-brand .ox-mark { margin-bottom: 8px; }
html.mvt .edge-glint { position: absolute; top: 0; left: 18px; right: 18px; height: 2px; pointer-events: none; opacity: 0; background: linear-gradient(90deg, transparent, var(--bad), transparent); }
html.mvt .login-half { box-shadow: none; will-change: transform, opacity; }
html.mvt .login-seam { position: fixed; z-index: 31; width: 2px; pointer-events: none; opacity: 0; transform-origin: center; background: linear-gradient(180deg, transparent, var(--accent), transparent); }

/* ===== Transitions entre pages (View Transitions) ===== */
/* Entre deux documents (connexion vers application) : on laisse le navigateur fondre l'ancien et le nouveau, sans rechargement visible. */
@media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } }
@keyframes mv-vt-out { to { opacity: 0; } }
@keyframes mv-vt-in { from { opacity: 0; } }
html.mvt::view-transition-old(root) { animation: mv-vt-out var(--dur-3) var(--ease-out) both; }
html.mvt::view-transition-new(root) { animation: mv-vt-in var(--dur-4) var(--ease-out) both; }

/* ===== Arrivée dans l'application : les entrées en CSS sont remplacées par celles de arrivee.js ===== */
html.mvt[data-motion="full"] .main > *, html.mvt[data-motion="full"] .tile, html.mvt[data-motion="full"] .ticket { animation: none !important; }
/* Icône de page : celle de la tuile qui voyage jusqu'à la page */
html.mvt .page-ico { display: inline-grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; margin-right: 14px; border-radius: 12px; color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
html.mvt .page-title:has(> .page-ico), html.mvt .card-head h2:has(> .page-ico) { display: flex; align-items: center; }

/* ===== Défilement (inspiré de la page iPhone Duo) ===== */
/* Barre compacte : se pose en haut quand le grand titre sort de l'écran */
html.mvt .pagebar { position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: 60px; display: flex; align-items: center; background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 1px 0 var(--line); opacity: 0; pointer-events: none; }
html.mvt .pagebar:not([inert]) { pointer-events: auto; }
html.mvt .pagebar-in { width: 100%; padding: 0 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
html.mvt .pagebar-title { font-family: var(--fd); font-size: 24px; line-height: 1; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.mvt .pagebar-actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 1100px) { html.mvt .pagebar-in { padding: 0 32px; } }
@media (max-width: 860px) { html.mvt .pagebar { height: calc(56px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); } html.mvt .pagebar-in { padding: 0 16px; } html.mvt .pagebar-title { font-size: 22px; } html.mvt .pagebar-actions .btn:not(.btn-primary):not(a) { display: none; } }
/* La salutation rétrécit et s'estompe en défilant (la variable --sp va de 0 à 1, posée sur l'élément lui-même) */
html.mvt[data-motion="full"] .hello, html.mvt[data-motion="full"] .hero { transform-origin: left top; transform: translateY(calc(var(--sp, 0) * -18px)) scale(calc(1 - var(--sp, 0) * .08)); opacity: calc(1 - var(--sp, 0) * .7); }
/* Deux niveaux de texte : l'essentiel en encre, le reste en gris */
html.mvt .hello p { color: var(--muted); }
html.mvt .hello p strong { color: var(--ink); font-weight: 500; }
/* Blocs plus bas : cachés jusqu'à ce qu'ils entrent dans l'écran (filet de sécurité si le script ne tourne pas) */
@keyframes mv-show { to { opacity: 1; } }
html.mvt [data-reveal] { opacity: 0; animation: mv-show .01s 2.5s forwards; }

/* ===== Tâches : le tableau vivant ===== */
html.mvt .task { position: relative; touch-action: manipulation; }
html.mvt .task:not(.task-ghost):not(.task-shard) { cursor: grab; }
/* La carte qu'on tient : un fantôme qui suit le pointeur ; la vraie carte devient la place qui attend */
html.mvt .task-ghost, html.mvt .task-shard { position: fixed; margin: 0; z-index: 60; pointer-events: none; cursor: grabbing; transform-origin: center; }
html.mvt .task-ghost { box-shadow: 0 28px 44px -18px rgba(0, 0, 0, .65), 0 0 0 1px var(--accent); background: var(--raise); }
html.mvt .task.is-dragging { opacity: .35; box-shadow: inset 0 0 0 1px var(--accent) !important; transform: none !important; }
/* La colonne visée s'illumine, ses bords aspirent la carte */
html.mvt .col { transition: box-shadow var(--dur-3) var(--ease-out), background-color var(--dur-3) var(--ease-out); }
html.mvt .col.over { outline: none; box-shadow: inset 0 0 0 1px var(--accent), inset 0 0 36px -14px var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--sunk)); }
/* Effets de réussite et de blocage */
html.mvt .task-fx { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
html.mvt .task-sheen { position: absolute; top: 0; bottom: 0; left: 0; width: 45%; background: linear-gradient(100deg, transparent, color-mix(in srgb, var(--accent) 40%, white) 50%, transparent); opacity: .55; }
html.mvt .task-crack { position: absolute; left: 0; top: 0; width: 100%; height: 10px; color: var(--warn); }
html.mvt .fx-spark { position: fixed; z-index: 70; width: 10px; height: 10px; background: var(--accent); pointer-events: none; opacity: 0; }
/* Barre de progression globale */
html.mvt .taskprog { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
html.mvt .taskprog-track { flex: 1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
html.mvt .taskprog-fill { display: block; width: 100%; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
html.mvt .taskprog-label { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ===== Données vivantes ===== */
/* Chiffres qui roulent : un rouleau vertical par chiffre (dix chiffres empilés, on décale le rouleau) */
html.mvt .roll { display: inline-flex; font-variant-numeric: tabular-nums; }
html.mvt .reel { display: inline-block; height: 1.25em; line-height: 1.25em; overflow: hidden; }
html.mvt .reel-col { display: flex; flex-direction: column; }
html.mvt .reel-col > span { display: block; height: 1.25em; }
html.mvt .reel-sep { display: inline-block; line-height: 1.25em; }
/* Courbe : se trace, l'aire se remplit, le dernier point pulse */
html.mvt .ring-host { display: contents; }
html.mvt .spark { position: relative; grid-column: 1 / -1; height: 36px; color: var(--accent); }
html.mvt .spark[data-tone="warn"] { color: var(--warn); }
html.mvt .spark-svg { display: block; width: 100%; height: 100%; overflow: visible; }
html.mvt .spark-line { fill: none; stroke: currentColor; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: miter; }
html.mvt .spark-area { fill: color-mix(in srgb, currentColor 14%, transparent); stroke: none; }
html.mvt .spark-dot { position: absolute; width: 8px; height: 8px; background: currentColor; transform: translate(-50%, -50%); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
/* Voyants : ceux qui vont bien respirent (un anneau qui s'élargit et s'efface, transform et opacité seulement) */
@keyframes mv-breathe { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(2.6); opacity: 0; } }
html.mvt[data-motion="full"] .services .dot { position: relative; }
html.mvt[data-motion="full"] .services .dot:not(.warn):not(.bad)::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ok); animation: mv-breathe 3.4s var(--ease-out) infinite; }

/* ===== Micro-interactions de matière ===== */
/* Thème : un balayage en octogone (pans coupés) part du bouton ; les deux vues se superposent sans fondu */
html.vt-theme::view-transition-old(root), html.vt-theme::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.vt-theme::view-transition-old(root) { z-index: 1; }
html.vt-theme::view-transition-new(root) { z-index: 2; }
/* Boutons : un reflet glisse au survol ; au clic l'onde est un losange, pas un cercle */
@keyframes mv-sheen { to { transform: translateX(130%); } }
html.mvt[data-motion="full"] .btn { position: relative; overflow: hidden; }
html.mvt[data-motion="full"] .btn::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .32) 50%, transparent 65%); transform: translateX(-130%); }
html.mvt[data-motion="full"] .btn:hover:not([disabled])::before { animation: mv-sheen .7s var(--ease-out); }
html.mvt .burst { border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); background: color-mix(in srgb, var(--accent) 55%, transparent); }
/* Cartes : un reflet suit le curseur (la position vient de l'unique écouteur de verre.js) */
html.mvt[data-motion="full"] .card:not(.sim-strip)::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity var(--dur-3) var(--ease-out); background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 12%, transparent), transparent 62%); }
html.mvt[data-motion="full"] .card:not(.sim-strip):hover::after { opacity: 1; }
/* Notifications : empilées, arrivée par le bas, barre de temps fine */
html.mvt .toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
html.mvt .toasts .toast { position: relative; left: auto; bottom: auto; transform: none; animation: none; overflow: hidden; pointer-events: auto; }
html.mvt .toast-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: currentColor; opacity: .45; transform-origin: left; }
/* Fond de pierre (canvas) : remplace les halos et segments */
html.mvt .fond { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
html.fond-on .segs, html.fond-on .orbs { display: none; }
/* Palette de commandes (Ctrl K) */
html.mvt .cmd-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--fill); color: var(--muted); font: 500 14px var(--fs); cursor: pointer; }
html.mvt .cmd-btn:hover { background: var(--fill-hi); color: var(--ink); }
html.mvt .cmd-btn kbd { font: 400 12px var(--fn); padding: 2px 6px; border-radius: 6px; background: var(--bg); color: var(--muted); }
@media (max-width: 860px) { html.mvt .cmd-btn span, html.mvt .cmd-btn kbd { display: none; } html.mvt .cmd-btn { width: 40px; padding: 0; justify-content: center; } }
html.mvt .pal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: start center; padding: 12vh 16px 16px; background: color-mix(in srgb, var(--bg) 62%, transparent); }
html.mvt .pal-panel { width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column; overflow: hidden; border-radius: 24px; background: var(--raise); box-shadow: 0 0 0 1px var(--line), var(--sh-2); }
html.mvt .pal-input { height: 64px; padding: 0 24px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: 400 18px var(--fs); outline: none; }
html.mvt .pal-input:focus-visible { box-shadow: inset 0 -2px 0 var(--accent); }
html.mvt .pal-list { position: relative; overflow: auto; overscroll-behavior: contain; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
html.mvt .pal-group { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 4px; }
html.mvt .pal-item { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 12px; border-radius: 12px; cursor: pointer; }
html.mvt .pal-ico { width: 28px; display: grid; place-items: center; color: var(--accent); flex-shrink: 0; }
html.mvt .pal-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.mvt .pal-hint { font-size: 13px; color: var(--muted); }
html.mvt .pal-sel { position: absolute; left: 8px; right: 8px; top: 0; z-index: 0; border-radius: 12px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); pointer-events: none; opacity: 0; }
html.mvt .pal-empty { padding: 24px; color: var(--muted); }
html.mvt .pal-foot { padding: 12px 24px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }

/* ===== Gestes au doigt (téléphone) ===== */
/* Balayage d'une tâche : l'action se révèle sous la carte */
html.mvt .col { position: relative; }
html.mvt .task { touch-action: pan-y; }
html.mvt .task.swiping { z-index: 2; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .55); }
html.mvt .swipe-under { position: absolute; z-index: 1; border-radius: 12px; display: flex; align-items: center; padding: 0 18px; pointer-events: none; font: 500 14px var(--fs); color: var(--ink); background: color-mix(in srgb, var(--accent) calc(var(--p, 0) * 22%), var(--sunk)); }
html.mvt .swipe-under[data-side="l"] { justify-content: flex-end; background: color-mix(in srgb, var(--warn) calc(var(--p, 0) * 28%), var(--sunk)); color: var(--warn-ink, var(--ink)); }
html.mvt .swipe-under.ready { box-shadow: inset 0 0 0 1px currentColor; }
/* Tirer pour rafraîchir : un octogone qui se taille */
html.mvt[data-motion="full"] { overscroll-behavior-y: contain; }
html.mvt .ptr { position: fixed; z-index: 70; top: calc(env(safe-area-inset-top) + 6px); left: 50%; width: 30px; height: 30px; background: var(--accent); pointer-events: none; opacity: 0; transform: translate(-50%, 0); }
/* Palette en feuille du bas */
html.mvt .pal-grip { display: none; }
@media (max-width: 860px) {
  html.mvt .pal.sheet { place-items: end center; padding: 0; }
  html.mvt .pal.sheet .pal-panel { width: 100%; max-height: 82dvh; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  html.mvt .pal.sheet .pal-grip { display: flex; justify-content: center; align-items: center; height: 28px; touch-action: none; cursor: grab; flex-shrink: 0; }
  html.mvt .pal.sheet .pal-grip span { width: 40px; height: 4px; background: var(--line-strong); clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 50%, calc(100% - 6px) 100%, 6px 100%, 0 50%); }
  html.mvt .pal.sheet .pal-foot { display: none; }
}

/* ===== Ouverture et fermeture d'une page : la feuille et ses copies ===== */
html.mvt .vt-sheet { position: fixed; inset: 0; z-index: 45; background: var(--surface); pointer-events: none; will-change: clip-path, opacity; }
html.mvt .vt-clone { position: absolute; margin: 0; transform-origin: left top; pointer-events: none; will-change: transform, opacity; }
html.mvt .vt-clone.tile-ico, html.mvt .vt-clone.page-ico { display: grid; place-items: center; }
html.mvt .vt-clone.tile-title, html.mvt .vt-clone.hero-title { white-space: nowrap; margin: 0; }
