/* Effets des plaques de titre de l'Odyssée (ui/components/PlaqueFx.tsx), repris tels quels de la maquette validée
   (public/mockups/odyssee-da/v4.css, 02/11), et ceux des objets (fin de feuille).
   Chaque plaque porte trois images de même cadre 2:1 (marge transparente commune) : --img la plaque, --halo son contour
   élargi et flouté, --lis le liseré de son bord. Toutes les animations bouclent sans saut. */

@property --a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes pfx-tour { to { --a: 360deg; } }
@keyframes pfx-tourne { to { transform: rotate(1turn); } }
@keyframes pfx-respire { from { opacity: var(--halo-min, .55); } to { opacity: 1; } }
@keyframes pfx-flotte { from { transform: translateY(.2cqw); } to { transform: translateY(-.2cqw); } }

.fx { position: relative; container-type: inline-size; isolation: isolate; width: 100%; }
.fx > img { position: relative; z-index: 2; width: 100%; height: auto; }
.fx > i { position: absolute; inset: 0; pointer-events: none; }
.fx.floats { animation: pfx-flotte 6s ease-in-out infinite alternate; }   /* Légende : à peine, un souffle, pas un saut (avis du 02/11) */

/* Halo : la silhouette s'allume de sa couleur, en respirant ; « tournant » = un dégradé qui fait le tour */
.fx-halo { z-index: 1; background: var(--halo-c); animation: pfx-respire 2.8s ease-in-out infinite alternate;
  -webkit-mask: var(--halo) center / 100% 100% no-repeat; mask: var(--halo) center / 100% 100% no-repeat; }
.fx.halo-spin .fx-halo { background: conic-gradient(from var(--a), var(--h1), var(--h2), var(--h3), var(--h1));
  animation: pfx-tour 5s linear infinite, pfx-respire 2.8s ease-in-out infinite alternate; }

/* Liseré : une ou deux traînées de lumière courent sur le bord du cadre */
.fx-lis { z-index: 3; mix-blend-mode: plus-lighter; animation: pfx-tour var(--lis-t, 3.6s) linear infinite;
  -webkit-mask: var(--lis) center / 100% 100% no-repeat; mask: var(--lis) center / 100% 100% no-repeat;
  background: conic-gradient(from var(--a), transparent 0 58%, var(--com) 80%, #fff 88%, var(--com) 93%, transparent 99%); }
.fx.lis-2 .fx-lis { background: conic-gradient(from var(--a),
  transparent 0 14%, var(--com) 30%, #fff 38%, var(--com) 43%, transparent 49%,
  transparent 50% 64%, var(--com) 80%, #fff 88%, var(--com) 93%, transparent 99%); }

/* Reflet : passe sur l'image seule, puis attend */
.fx-shine { z-index: 3; mix-blend-mode: overlay; background-repeat: no-repeat; background-size: 280% 100%; background-position: 170% 0;
  background-image: linear-gradient(105deg, transparent 40%, var(--shine, #ffffffa0) 49%, #fff4 53%, transparent 62%);
  -webkit-mask: var(--img) center / 100% 100% no-repeat; mask: var(--img) center / 100% 100% no-repeat;
  animation: pfx-reflet var(--shine-t, 5.5s) cubic-bezier(.45, 0, .2, 1) infinite; }
@keyframes pfx-reflet { 0%, 50% { background-position: 170% 0; } 100% { background-position: -70% 0; } }

/* Rayons derrière : deux nappes de faisceaux irréguliers qui tournent en sens contraire */
.fx-rays { z-index: 0; inset: -45% -12% !important; animation: pfx-tourne 60s linear infinite;
  -webkit-mask: radial-gradient(closest-side, #000 12%, transparent 72%); mask: radial-gradient(closest-side, #000 12%, transparent 72%); }
.fx-rays::before, .fx-rays::after { content: ""; position: absolute; inset: 0; background: no-repeat center / contain var(--beams); }
.fx-rays::after { transform: rotate(17deg) scale(.86); opacity: .7; animation: pfx-tourne 41s linear infinite reverse; }
.fx-rays { --beams: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><g fill='%23ffe2a0'><path d='M100 100L174.5 97.4L174.5 102.6Z' fill-opacity='0.2'/><path d='M100 100L179.6 114.8L178.1 121.5Z' fill-opacity='0.12'/><path d='M100 100L169.7 164.3L164.5 169.5Z' fill-opacity='0.13'/><path d='M100 100L117.4 169.2L109.0 170.8Z' fill-opacity='0.22'/><path d='M100 100L57.3 176.3L53.0 173.7Z' fill-opacity='0.18'/><path d='M100 100L27.9 140.8L24.3 133.7Z' fill-opacity='0.14'/><path d='M100 100L21.6 110.0L21.1 103.8Z' fill-opacity='0.2'/><path d='M100 100L38.3 51.3L43.5 45.3Z' fill-opacity='0.22'/><path d='M100 100L75.9 13.2L80.0 12.2Z' fill-opacity='0.19'/><path d='M100 100L135.0 24.0L141.7 27.4Z' fill-opacity='0.2'/><path d='M100 100L195.6 71.5L197.9 80.6Z' fill-opacity='0.2'/></g></svg>"); }

/* Étoiles qui scintillent sur les gemmes */
.fx-glints { z-index: 4; }
.fx-glints b { position: absolute; width: var(--gs, 4.5cqw); aspect-ratio: 1; margin: calc(var(--gs, 4.5cqw) / -2) 0 0 calc(var(--gs, 4.5cqw) / -2); opacity: 0;
  background: var(--glint, #fff); filter: drop-shadow(0 0 .8cqw var(--glint-c, #9fe6ff));
  -webkit-mask: var(--star) center / contain no-repeat; mask: var(--star) center / contain no-repeat;
  animation: pfx-scintille 3.4s ease-in-out infinite; }
.fx { --star: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M10 0C10.6 7 13 9.4 20 10C13 10.6 10.6 13 10 20C9.4 13 7 10.6 0 10C7 9.4 9.4 7 10 0Z'/></svg>"); }
@keyframes pfx-scintille { 0%, 100% { opacity: 0; transform: scale(.2) rotate(0deg); } 40% { opacity: 1; transform: scale(1) rotate(30deg); } 70% { opacity: 0; transform: scale(.3) rotate(60deg); } }

/* Particules : chacune monte (dehors) et ondule (dedans), naît et meurt invisible : le flot ne s'arrête jamais.
   Les braises du Dragon sont des traînées qui pâlissent ; la poussière de la Légende, des éclats d'étoile. */
.fx-motes { z-index: var(--mz, 4); overflow: visible; }
.fx-motes > span { position: absolute; left: var(--x); top: var(--y); animation: pfx-monte var(--d) cubic-bezier(.3, .2, .6, 1) var(--t) infinite; opacity: 0; }
.fx-motes > span > b { display: block; width: var(--w); height: var(--h); margin-left: calc(var(--w) / -2); animation: pfx-ondule var(--o) ease-in-out var(--t) infinite alternate; }
@keyframes pfx-monte { 0% { transform: translateY(0); opacity: 0; } 12% { opacity: var(--op, 1); } 26% { opacity: calc(var(--op, 1) * .55); } 38% { opacity: var(--op, 1); } 60% { opacity: calc(var(--op, 1) * .7); } 100% { transform: translateY(var(--rise)); opacity: 0; } }
@keyframes pfx-ondule { from { transform: translateX(calc(var(--sway) * -1)) rotate(var(--tilt)); } to { transform: translateX(var(--sway)) rotate(calc(var(--tilt) * -1)); } }
.braises .fx-motes > span > b { background: radial-gradient(circle closest-side, #fff8e0 0 22%, #ffc061 42%, #ff6a1f9c 66%, transparent); }
.braises .fx-motes.flou > span > b { filter: blur(.3cqw); }
/* La lueur du Dragon vacille comme un feu, par paliers irréguliers, sur une boucle qui retombe où elle a commencé */
.lv-dragon .fx-halo { animation: pfx-vacille 3.1s ease-in-out infinite; }
@keyframes pfx-vacille { 0%, 100% { opacity: .62; } 18% { opacity: .9; } 31% { opacity: .74; } 52% { opacity: 1; } 67% { opacity: .8; } 83% { opacity: .95; } }
.poussiere .fx-motes > span > b { background: var(--mote-c, #ffe7a8); filter: drop-shadow(0 0 .7cqw var(--mote-g, #ffd27a));
  -webkit-mask: var(--star) center / contain no-repeat; mask: var(--star) center / contain no-repeat; }

/* Les couleurs de chaque niveau ; un seul endroit à régler */
.lv-celeste { --halo-c: radial-gradient(#63d6ff, #63d6ff99); --halo-min: .35; --glint-c: #63d6ff; }
.lv-dragon { --halo-c: radial-gradient(#ff8a3d, #ff5a1fcc); --halo-min: .5; --com: #ffb347; --shine: #ffd9a0b0; --glint-c: #ff9a4a; --lis-t: 3.2s; }
.lv-legende { --h1: #ffd27a; --h2: #ff8fd8; --h3: #63d6ff; --halo-min: .7; --com: #ffe9b0; --shine: #e9f6ffc0; --glint-c: #ffe39a; --lis-t: 4.4s; --shine-t: 4.6s; }

@media (prefers-reduced-motion: reduce) {
  .fx, .fx > i, .fx > i::before, .fx > i::after, .fx-glints b, .fx-motes span, .fx-motes b { animation: none !important; }
  .fx-motes, .fx-glints, .fx-lis, .fx-shine { display: none; }
}

/* Les places d'une plaque : cadre 2:1 commun à l'image et à ses masques. Sous le pseudo (titles.css §1), elle prend la
   largeur de sa place ; dans l'album et le module Plaques, la hauteur de la case (62 et 64 px). */
.fx.is-ody { display: block; aspect-ratio: 2; }
.fx.is-ody > img { width: 100%; height: 100%; max-width: none; max-height: none; }
/* La plaque ne remplit que 83 % de la largeur de son cadre (la marge est celle du halo), contre 98 % pour une plaque de
   collection : agrandie d'autant que la marge lui prend, sans changer la hauteur de la case (marges négatives). */
.plate-box .fx.is-ody { width: auto; height: 86px; margin-block: -12px; max-width: 112%; }
.plaque .fx.is-ody { width: auto; height: 90px; margin-block: -13px; max-width: 112%; }
.sc-plate .fx.is-ody { width: 115%; margin-inline: -7.5%; }
/* Palier IV porté au centre (Mercator, Cartographe de l'Atlas) : le titre ultime, une fois et demie plus grand */
.sc-plate.is-center .fx.lv-legende { width: 150%; margin-inline: -25%; margin-block: -8% -4%; }
/* À 170 px de large, braises et rayons ne font plus qu'un pixel : seuls le halo, la lumière du cadre et les éclats restent. */
:is(.plate-box, .plaque) :is(.fx-motes, .fx-rays) { display: none; }
.fx.is-offscreen, .fx.is-offscreen * { animation-play-state: paused; }   /* PlaqueFx : hors écran */

/* Palier d'une plaque de l'Odyssée, écrit dans l'album (Titles.tsx PlateTile) et en fin de partie : la Légende se lit
   au-dessus du Dragon même sans les effets (mouvement réduit). */
.plate-tier { justify-self: center; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em; color: var(--muted); }
.plate-tier.is-t2 { color: color-mix(in srgb, #63d6ff 70%, var(--text)); }
.plate-tier.is-t3 { color: color-mix(in srgb, #ff9a4a 75%, var(--text)); }
.plate-tier.is-t4 { color: color-mix(in srgb, #ffd27a 80%, var(--text)); }

/* Fin de partie (ui/odyssee/NouveauxTitres.tsx) : la plaque gagnée en tête, son palier, sa condition, « Porter ». */
.ody-end-titles > ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 14px; }
.ody-end-titles li { display: grid; grid-template-columns: minmax(0, 240px) 1fr auto; align-items: center; gap: 14px; }
.ody-nt-plate { display: block; }
.ody-nt-copy { display: grid; gap: 2px; font-size: var(--fs-sm); color: var(--muted); }
.ody-nt-copy > small { font-size: var(--fs-xs); font-weight: 700; color: var(--text); }
@media (max-width: 540px) {
  .ody-end-titles li { grid-template-columns: 1fr auto; }
  .ody-nt-plate { grid-column: 1 / -1; justify-self: center; width: min(260px, 100%); }
}

/* Objets de l'Odyssée (ui/odyssee/ItemArt.tsx, maquette v6.html) : l'image tient dans sa case carrée sans être rognée ;
   halo, liseré et reflet se posent de la même façon (contain), les trois images ayant le même cadre. Teinte de rareté
   partout, effets seulement au coffre (`.fx`). */
.ody-it { display: inline-grid; place-items: center; flex: none; width: var(--it, 44px); height: auto; aspect-ratio: 1; }
.ody-it > img { width: 100%; height: 100%; max-width: none; object-fit: contain; }
.ody-it.r-courant > img { filter: drop-shadow(0 2px 3px #000a); }
.ody-it.r-rare > img { filter: drop-shadow(0 0 4px #8b5cf6aa); }
.ody-it.r-boss > img { filter: drop-shadow(0 0 5px #ffb347b0) drop-shadow(0 0 1.5px #fff1c480); }
.ody-it.fx > :is(.fx-halo, .fx-lis, .fx-shine) { -webkit-mask-size: contain; mask-size: contain; }
/* Cercle magique sous l'objet, couché en perspective, qui tourne lentement */
.fx-ring { z-index: 0; inset: auto -6% 4% !important; aspect-ratio: 1; transform: perspective(80cqw) rotateX(70deg); transform-origin: 50% 100%; }
.fx-ring::before { content: ""; position: absolute; inset: 0; animation: pfx-tourne 24s linear infinite; filter: drop-shadow(0 0 1.6cqw var(--ring)) drop-shadow(0 0 .4cqw var(--ring));
  background: var(--ring); -webkit-mask: var(--sigil) center / contain no-repeat; mask: var(--sigil) center / contain no-repeat; }
.fx-ring { --sigil: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23000'><circle cx='50' cy='50' r='47' stroke-width='2.2'/><circle cx='50' cy='50' r='41' stroke-width='1.4' stroke-dasharray='2 3'/><circle cx='50' cy='50' r='30' stroke-width='1.6'/><path d='M50 9L59 50L50 91L41 50Z M9 50L50 41L91 50L50 59Z' stroke-width='1.2'/><g fill='%23000' stroke='none'><path d='M50 1l2.4 4-2.4 4-2.4-4z'/><path d='M50 91l2.4 4-2.4 4-2.4-4z'/><path d='M1 50l4-2.4 4 2.4-4 2.4z'/><path d='M91 50l4-2.4 4 2.4-4 2.4z'/><circle cx='83.2' cy='16.8' r='1.6'/><circle cx='16.8' cy='16.8' r='1.6'/><circle cx='83.2' cy='83.2' r='1.6'/><circle cx='16.8' cy='83.2' r='1.6'/></g></svg>"); }
.lv-rare { --halo-c: radial-gradient(#a78bfa, #8b5cf6cc); --halo-min: .45; --com: #c4b5fd; --ring: #a78bfa; }
.lv-boss { --h1: #ffc94a; --h2: #ff7a2a; --h3: #fff6d0; --halo-min: .7; --com: #fff1c4; --ring: #ffd27a; --lis-t: 3s; }
