/* Cristallo R2 · the top layer: the crystal heart's look and its light (Fable, 02/11/2026).
   coeur.js writes on the button, every frame: --lumiere (0..1, the light inside) and --battement (0..1, a beat, decaying
   in ~0.42 s), plus data-etat="repos"|"vit". At rest, a small light breathes inside the faceted crystal (« ce petit
   voyant »); pressed, the core lights from within and the facets catch its orange. The living canvas is vivant.js.
   No inline style anywhere (the site's CSP). */

/* The button: its border and its glow follow the light inside */
.coeur{border-color:color-mix(in srgb,var(--orange) calc(35% + var(--lumiere,0)*45%),var(--trait));
  box-shadow:0 0 calc(10px + var(--lumiere,0)*46px) calc(var(--lumiere,0)*9px) color-mix(in srgb,var(--orange) calc(14% + var(--lumiere,0)*58%),transparent),
    inset 0 0 calc(var(--lumiere,0)*18px) color-mix(in srgb,var(--orange) calc(var(--lumiere,0)*35%),transparent);
  transition:border-color .5s}
.coeur-cristal{transform:scale(calc(1 + var(--battement,0)*.05));transform-origin:50% 54%}

/* The crystal: a translucent face, cut facets, their edges, the contour */
.coeur-fond{fill:color-mix(in srgb,var(--orange) calc(5% + var(--lumiere,0)*10%),color-mix(in srgb,var(--fond-profond) 55%,transparent))}
.facette{fill:color-mix(in srgb,var(--texte) 6%,transparent)}
.facette-claire{fill:color-mix(in srgb,var(--texte) 13%,transparent)}
.facette-sombre{fill:color-mix(in srgb,var(--texte) 2.5%,transparent)}
.coeur-lueur{fill:var(--orange-vif);opacity:calc(var(--lumiere,0)*.3)}
.coeur-aretes{fill:none;stroke:var(--texte);stroke-opacity:.28;stroke-width:.75;stroke-linejoin:round;stroke-linecap:round}
.coeur-contour{fill:none;stroke:var(--texte);stroke-opacity:.84;stroke-width:1.5;stroke-linejoin:round}

/* The core: a faceted gem lit from within, a blurred halo behind it, and the small light at its centre */
.coeur-noyau-halo{fill:var(--orange-vif);filter:url(#noyau-flou);opacity:calc(var(--lumiere,0)*.85)}
.coeur-noyau{fill:url(#noyau-lumiere);transform-box:fill-box;transform-origin:50% 50%;transform:scale(calc(.9 + var(--battement,0)*.26));opacity:calc(.3 + var(--lumiere,0)*.7)}
.noyau-stop-centre{stop-color:#fff4e8}
.noyau-stop-milieu{stop-color:var(--orange-vif)}
.noyau-stop-bord{stop-color:var(--orange);stop-opacity:.4}
.coeur-noyau-aretes{fill:none;stroke:#fff4e8;stroke-opacity:calc(.12 + var(--lumiere,0)*.5);stroke-width:.6;stroke-linejoin:round}
.coeur-voyant{fill:#fff4e8;opacity:calc(.45 + var(--lumiere,0)*.55)}
:root[data-theme="clair"] .coeur-voyant{fill:#fff}
:root[data-theme="clair"] .coeur-noyau-aretes{stroke:#fff;stroke-opacity:calc(.25 + var(--lumiere,0)*.5)}
:root[data-theme="clair"] .noyau-stop-centre{stop-color:#ffd9bd}
:root[data-theme="clair"] .noyau-stop-bord{stop-opacity:.55}

/* At rest: the small light breathes, slowly */
.coeur[data-etat="repos"] .coeur-noyau{animation:coeur-respire 5.2s ease-in-out infinite}
.coeur[data-etat="repos"] .coeur-voyant{animation:voyant-respire 5.2s ease-in-out infinite}
@keyframes coeur-respire{0%,100%{opacity:.26}50%{opacity:.62}}
@keyframes voyant-respire{0%,100%{opacity:.4}50%{opacity:1}}

@media (prefers-reduced-motion:reduce){
  .coeur[data-etat="repos"] .coeur-noyau,.coeur[data-etat="repos"] .coeur-voyant{animation:none}
  .coeur[data-etat="repos"] .coeur-noyau{opacity:.45}
  .coeur[data-etat="repos"] .coeur-voyant{opacity:.7}
  .coeur-cristal{transform:none}
  .coeur-noyau{transform:none}
}
