/* Animations de l'article Kerberos : styles communs (moteur.js). Palette du site, angles nets, pixels. */
@font-face { font-family: 'Silkscreen'; src: url(polices/silkscreen-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Inter'; src: url(polices/inter-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url(polices/jetbrains-mono-latin-400-normal.woff2) format('woff2'); font-display: swap; }

:root {
  --fond: #0b111b; --fond-2: #111a27; --ardoise: #182435; --ardoise-2: #1e2c40; --bord: #2b3c54;
  --texte: #e8e7e3; --texte-2: #a9b1ba; --texte-3: #7d8896; --ambre: #d69a58; --ambre-clair: #f1c98a;
  --ok: #7fd08a; --ko: #e5675c;
  --silk: 'Silkscreen', ui-monospace, monospace; --sans: 'Inter', system-ui, sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { cursor: url(curseurs/fleche.svg) 0 0, default; }
button { cursor: url(curseurs/main.svg) 9 1, pointer; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font: 14px/1.55 var(--sans); }
#anim { padding: 14px 14px 16px; }

/* ---- légende des clés ---- */
.legende { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 0 0 10px; min-height: 22px; }
.legende .l-titre { font: 10px var(--silk); color: var(--texte-3); letter-spacing: .08em; text-transform: uppercase; }

/* ---- scène ---- */
.scene { position: relative; overflow: hidden; border: 2px solid var(--bord); background:
  radial-gradient(circle at 1px 1px, #1a2738 1px, transparent 1.5px) 0 0 / 14px 14px, var(--fond-2); }
.plateau { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fleches { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.fleches line { stroke: var(--texte-3); stroke-width: 2; stroke-dasharray: 6 5; }
.fleches .f-label rect { fill: var(--fond-2); }
.fleches .f-label text { fill: var(--texte-2); font: 10px var(--silk); text-anchor: middle; dominant-baseline: central; }
.fleches .active line { stroke: var(--ambre); animation: defile .6s linear infinite; }
.fleches .active text { fill: var(--ambre-clair); }
.fleches .passee { opacity: .42; }
@keyframes defile { to { stroke-dashoffset: -11; } }

/* ---- acteurs ---- */
.acteur { position: absolute; width: 150px; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; text-align: center; transition: opacity .4s, filter .4s; z-index: 1; }
.acteur .icone { position: relative; line-height: 0; transition: transform .3s; }
.acteur .icone svg { image-rendering: pixelated; }
.acteur.actif .icone { transform: translateY(-3px); }
.acteur.actif .icone::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: -7px; height: 3px; background: var(--ambre); }
.acteur.eteint { opacity: .28; filter: grayscale(.8); }
.a-nom { margin-top: 8px; font: 12px/1.2 var(--silk); color: var(--texte); }
.a-role { font-size: 11.5px; color: var(--texte-3); line-height: 1.3; }
.badges:empty, .cles:empty, .poche:empty { display: none; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 5px; }
.badge { font: 9px/1 var(--silk); padding: 4px 5px 3px; border: 1px solid currentColor; color: var(--ambre-clair); background: #2a2116; }
.badge.rouge { color: #ff9b90; background: #3a1714; }
.cles, .poche { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 6px; max-width: 160px; }
.cles .c-titre { width: 100%; font: 9px var(--silk); color: var(--texte-3); letter-spacing: .06em; }
.acteur:has(.bulle.visible) { z-index: 15; }

/* bulle d'état */
.bulle { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) scale(.9); width: max-content; max-width: 190px;
  padding: 6px 9px; background: var(--texte); color: #121a26; font-size: 12px; line-height: 1.35; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; z-index: 5; }
.bulle::after { content: ''; position: absolute; left: 50%; top: 100%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--texte); }
.acteur.bulle-bas .bulle { bottom: auto; top: calc(100% + 8px); }
.acteur.bulle-bas .bulle::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--texte); }
.acteur.bulle-gauche .bulle, .acteur.bulle-droite .bulle { bottom: auto; top: 30px; transform: translateY(-50%) scale(.9); }
.acteur.bulle-gauche .bulle { left: auto; right: calc(50% + 44px); }
.acteur.bulle-droite .bulle { left: calc(50% + 44px); }
.acteur.bulle-gauche .bulle::after { left: 100%; top: 50%; margin: -6px 0 0; border-top-color: transparent; border-left-color: var(--texte); }
.acteur.bulle-droite .bulle::after { left: auto; right: 100%; top: 50%; margin: -6px 0 0; border-top-color: transparent; border-right-color: var(--texte); }
.acteur.bulle-gauche .bulle.visible, .acteur.bulle-droite .bulle.visible { transform: translateY(-50%) scale(1); }
.acteur.bulle-gauche .bulle.ok::after { border-top-color: transparent; border-left-color: #cfeed3; }
.acteur.bulle-droite .bulle.ok::after { border-top-color: transparent; border-right-color: #cfeed3; }
.acteur.bulle-gauche .bulle.ko::after { border-top-color: transparent; border-left-color: #f6c9c3; }
.acteur.bulle-droite .bulle.ko::after { border-top-color: transparent; border-right-color: #f6c9c3; }
.bulle.visible { opacity: 1; transform: translateX(-50%) scale(1); }
.bulle.ok { background: #cfeed3; } .bulle.ok::after { border-top-color: #cfeed3; }
.bulle.ko { background: #f6c9c3; } .bulle.ko::after { border-top-color: #f6c9c3; }
.acteur.bulle-bas .bulle.ok::after { border-top-color: transparent; border-bottom-color: #cfeed3; }
.acteur.bulle-bas .bulle.ko::after { border-top-color: transparent; border-bottom-color: #f6c9c3; }

/* ---- puces (clés) et jetons (tickets) ---- */
.puce { display: inline-flex; align-items: center; gap: 5px; padding: 2px 6px 2px 4px; border: 1px solid var(--k); background: color-mix(in srgb, var(--k) 14%, var(--fond)); color: var(--texte);
  font: 10px/1.3 var(--silk); white-space: nowrap; vertical-align: 1px; transition: box-shadow .3s, transform .3s; }
.puce svg { flex: none; }
.puce.nouvelle { animation: apparait .6s cubic-bezier(.3, 1.6, .5, 1); }
.puce.pulse { animation: pulse 1s ease-in-out 2; }
@keyframes apparait { from { transform: scale(0); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--k) 45%, transparent); transform: scale(1.08); } }
.jeton { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px 3px 5px; background: color-mix(in srgb, var(--k) 22%, var(--ardoise)); border: 2px solid var(--k);
  font: 10px/1.2 var(--silk); color: var(--texte); white-space: nowrap; position: relative; }
.jeton::before, .jeton::after { content: ''; position: absolute; top: 50%; width: 6px; height: 6px; margin-top: -3px; background: var(--fond-2); }
.jeton::before { left: -4px; } .jeton::after { right: -4px; }
.jeton.nouvelle { animation: apparait .6s cubic-bezier(.3, 1.6, .5, 1); }
.cle-vol { position: absolute; z-index: 20; transform: translate(-50%, -50%) scale(1.5); transition: left .7s cubic-bezier(.5, 0, .3, 1), top .7s cubic-bezier(.5, 0, .3, 1); pointer-events: none; filter: drop-shadow(0 0 4px var(--k)); }

/* ---- paquets (messages) ---- */
.paquet { position: absolute; z-index: 10; width: max-content; min-width: 170px; max-width: 300px; transform: translate(-50%, -50%) scale(var(--s, 1)); opacity: 1;
  background: var(--ardoise); border: 2px solid #3a4f6c; box-shadow: 4px 4px 0 #05080d;
  transition: left 1.1s cubic-bezier(.55, 0, .35, 1), top 1.1s cubic-bezier(.55, 0, .35, 1), transform .45s, opacity .45s; }
.paquet.naissant { --s: .75; opacity: 0; }
.paquet.voyage { --s: .5; }
.paquet.disparu { --s: .8; opacity: 0; }
.paquet.discret { opacity: .35; }
.p-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 5px 8px 4px; background: #24344b; border-bottom: 2px solid #3a4f6c; }
.p-nom { font: 11px var(--mono); color: var(--ambre-clair); letter-spacing: .02em; }
.p-sens { font: 9px var(--silk); color: var(--texte-3); }
.p-corps { padding: 7px 8px 8px; display: flex; flex-direction: column; gap: 5px; }
.paquet.petit .p-corps { flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 8px 10px; justify-content: center; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 2px 5px; font-size: 12px; line-height: 1.35; border: 1px solid transparent; transition: background .3s, border-color .3s; }
.item .k { color: var(--texte-3); }
.item .v { color: var(--texte); font-family: var(--mono); font-size: 11.5px; text-align: right; }
.groupe { border: 1px solid #3a4f6c; background: #152131; transition: border-color .3s; }
.groupe.deplie { border-color: var(--ambre); }
.g-tete { display: flex; align-items: center; gap: 8px; padding: 2px 5px; font-size: 12px; line-height: 1.35; }
.g-tete .k { color: var(--texte-3); }
.g-resume { margin-left: auto; font: 11.5px var(--mono); color: var(--texte); transition: opacity .3s; }
.g-fleche { color: var(--texte-3); font-size: 10px; transition: transform .4s; }
.groupe.deplie .g-tete .k { color: var(--ambre-clair); }
.groupe.deplie .g-resume { opacity: 0; }
.groupe.deplie .g-fleche { transform: rotate(90deg); color: var(--ambre); }
.g-corps { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .6s cubic-bezier(.5, 0, .3, 1); }
.groupe.deplie .g-corps { grid-template-rows: 1fr; }
.g-int { overflow: hidden; display: flex; flex-direction: column; gap: 2px; padding: 0 3px; }
.groupe.deplie .g-int { padding: 2px 3px 4px; }
.g-int .item { font-size: 11.5px; }
.g-int .item .v { font-size: 11px; }
.item.note { justify-content: center; color: var(--texte-2); font-size: 11.5px; font-style: italic; }

/* boîte chiffrée : bord de la couleur de la clé, voile hachuré tant qu'elle est fermée */
.boite, .item { position: relative; }
.boite { border: 2px solid var(--k); background: color-mix(in srgb, var(--k) 8%, var(--ardoise)); transition: border-color .3s; }
.b-tete { display: flex; align-items: center; gap: 6px; padding: 3px 6px 3px 5px; background: color-mix(in srgb, var(--k) 30%, var(--ardoise)); font: 10px/1.2 var(--silk); }
.b-titre { color: var(--texte); }
.b-cle { margin-left: auto; color: color-mix(in srgb, var(--k) 70%, white); font-size: 9px; }
.cadenas { line-height: 0; }
.b-corps { position: relative; padding: 5px 4px; display: flex; flex-direction: column; gap: 3px; min-height: 26px; }
.voile { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 4px;
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--k) 42%, #0d1520) 0 5px, color-mix(in srgb, var(--k) 26%, #0d1520) 5px 10px);
  transition: clip-path .7s cubic-bezier(.6, 0, .3, 1); clip-path: inset(0 0 0 0); }
.voile span { font: 9px/1.3 var(--silk); color: var(--texte); background: #0d1520cc; padding: 2px 5px; }
.boite.ouverte .voile { clip-path: inset(0 0 0 100%); }
.boite.refus { animation: secoue .45s; border-color: var(--ko); }
@keyframes secoue { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* marques : vérifications réussies, échouées ou champ observé */
.m-vu { background: #3a2c18; border-color: var(--ambre); }
.m-ok { background: #1c3523; border-color: var(--ok); }
.m-ko { background: #3a1a17; border-color: var(--ko); }
.item.m-ok .k::before { content: '✓ '; color: var(--ok); font-weight: 700; }
.item.m-ko .k::before { content: '✗ '; color: var(--ko); font-weight: 700; }
.boite.m-ok, .boite.m-vu { box-shadow: 0 0 0 2px var(--ok); }
.boite.m-vu { box-shadow: 0 0 0 2px var(--ambre); }
.tampon { position: absolute; right: -10px; bottom: -11px; z-index: 3; padding: 3px 6px 2px; font: 10px var(--silk); transform: rotate(6deg); animation: apparait .4s cubic-bezier(.3, 1.6, .5, 1); }
.tampon.ok { background: var(--ok); color: #0c1a10; } .tampon.ko { background: var(--ko); color: #1d0907; }

/* ---- texte de l'étape ---- */
.texte { margin-top: 12px; min-height: 7.4em; }
.t-tete { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.t-num { font: 10px var(--silk); color: var(--ambre); white-space: nowrap; }
.t-titre { font: 13px/1.3 var(--silk); color: var(--texte); }
.t-corps { margin: 0; color: var(--texte-2); }
.t-corps b { color: var(--texte); font-weight: 600; }
.t-corps code { font: 12.5px var(--mono); color: var(--ambre-clair); }

/* ---- commandes ---- */
.commandes { display: flex; align-items: center; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.commandes button { font: 10.5px/1 var(--silk); color: var(--texte); background: var(--ardoise); border: 2px solid var(--bord); padding: 7px 10px 6px; cursor: url(curseurs/main.svg) 9 1, pointer; }
.commandes button:hover:not(:disabled) { border-color: var(--ambre); }
.commandes button:disabled { opacity: .4; cursor: url(curseurs/fleche.svg) 0 0, default; }
.commandes button:focus-visible, .segments button:focus-visible { outline: 2px solid var(--ambre-clair); outline-offset: 2px; }
.commandes .b-lecture { min-width: 92px; }
.segments { display: flex; gap: 3px; flex: 1; min-width: 120px; margin-left: 6px; }
.segments button { flex: 1; height: 10px; padding: 0; border: 0; background: var(--bord); cursor: url(curseurs/main.svg) 9 1, pointer; }
.segments button.fait { background: #6b5536; }
.segments button.courant { background: var(--ambre); }
.compteur { font: 10px var(--silk); color: var(--texte-3); min-width: 44px; text-align: right; }

/* sans animation : tout est posé d'un coup (rattrapage des étapes passées, mouvement réduit) */
.instant *, .instant *::before, .instant *::after { transition: none !important; animation: none !important; }
@media (max-width: 480px) { #anim { padding: 10px; } .t-titre { font-size: 12px; } }
