/* ============================================================
   Animations du portfolio : ce qui bouge et s’allume.
   Chargé après style.css, ne modifie pas la mise en page.

   Palette volontairement réduite à DEUX couleurs, pour une lecture nette :
   le bordeaux (texte, traits, halos) et le fond clair.
   En thème sombre, le bordeaux est remplacé par son rose très pâle.
   Plus aucun dégradé multicolore, ni changement de teinte au survol.

   Tout le mouvement est coupé si le visiteur a activé « réduire les animations ».
   ============================================================ */

:root {
    --anim-main: #5A0F1B;      /* bordeaux */
    --anim-rgb: 90, 15, 27;    /* même bordeaux, pour les transparences */
    --anim-ease: cubic-bezier(.22, 1, .36, 1);
}
:root[data-theme="dark"] {
    --anim-main: #F1D8DC;
    --anim-rgb: 241, 216, 220;
}

/* ---------- Prénom : une seule couleur ---------- */
.hero-name { color: var(--anim-main); }

/* ---------- Barre de progression de lecture ---------- */
.anim-progress {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    height: 3px;
    z-index: 1000;
    pointer-events: none;
    transform-origin: 0 50%;
    transform: scaleX(var(--p, 0));
    background: var(--anim-main);
}

/* ---------- Halo doux derrière l’accueil ---------- */
.hero { position: relative; isolation: isolate; }
.anim-aura {
    position: absolute;
    inset: -6% 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}
.anim-aura span {
    position: absolute;
    width: 42vmax;
    height: 42vmax;
    max-width: 560px;
    max-height: 560px;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .12;
    background: radial-gradient(circle, rgba(var(--anim-rgb), 1), transparent 70%);
}
.anim-aura span:nth-child(1) { top: -10%; left: -8%; }
.anim-aura span:nth-child(2) { top: 30%;  right: -6%; }
.anim-aura span:nth-child(3) { bottom: -15%; left: 35%; }

/* ---------- Lumière qui suit la souris sur les cartes (même couleur, très discrète) ---------- */
.anim-spot { position: relative; }
.anim-spot::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity .35s ease;
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--anim-rgb), .06), transparent 70%);
    box-shadow: inset 0 0 0 1px rgba(var(--anim-rgb), .3);
}
.anim-spot:hover::after { opacity: 1; }

/* ---------- Bouton principal avec reflet ---------- */
.btn.primary { position: relative; overflow: hidden; isolation: isolate; }
.btn.primary::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .3) 50%, transparent 70%);
    translate: -130% 0;
}

/* ---------- Lien du menu de la section visible ---------- */
#nav-list a.is-current {
    color: var(--anim-main);
    text-decoration: underline 2px var(--anim-main);
    text-underline-offset: 6px;
}

/* ---------- Trait sous les titres de section ---------- */
.sec-head h2 {
    padding-bottom: .15em;
    background: linear-gradient(var(--anim-main), var(--anim-main)) no-repeat 0 100% / 3.5em 3px;
}

/* ---------- Qualité sélectionnée ---------- */
.q[aria-pressed="true"] { box-shadow: 0 0 0 3px rgba(var(--anim-rgb), .15); }

/* ---------- Signe × de la légende du portrait ---------- */
.portrait-caption span { display: inline-block; color: inherit; }

/* ============================================================
   Mouvement : seulement si le visiteur ne l’a pas désactivé
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {

    /* Arrivée de l’accueil au chargement */
    .hero-copy > * { animation: anim-rise .9s var(--anim-ease) both; }
    .hero-copy > :nth-child(2) { animation-delay: .08s; }
    .hero-copy > :nth-child(3) { animation-delay: .16s; }
    .hero-copy > :nth-child(4) { animation-delay: .24s; }
    .hero-copy > :nth-child(5) { animation-delay: .32s; }
    .hero-copy > :nth-child(6) { animation-delay: .40s; }
    .hero-portrait-wrap { animation: anim-rise 1.1s var(--anim-ease) .2s both; }

    /* Portrait qui flotte doucement */
    .hero-portrait { animation: anim-float 7s ease-in-out infinite, anim-glow 9s ease-in-out infinite; }
    .portrait-frame { animation: anim-frame 9s ease-in-out infinite; }
    .portrait-caption span { animation: anim-spin 8s linear infinite; }

    /* Halos qui dérivent (position seulement, la couleur ne change pas) */
    .anim-aura span { animation: anim-drift 18s ease-in-out infinite alternate; }
    .anim-aura span:nth-child(2) { animation-duration: 22s; animation-delay: -6s; }
    .anim-aura span:nth-child(3) { animation-duration: 26s; animation-delay: -12s; }

    /* Reflet qui passe sur le bouton principal */
    .btn.primary::after { animation: anim-shine 5s var(--anim-ease) infinite; }

    /* Apparition des blocs au défilement (ajouté par animations.js) */
    .anim-ready .anim-reveal {
        opacity: 0;
        translate: 0 28px;
        transition: opacity .8s var(--anim-ease), translate .8s var(--anim-ease);
        transition-delay: calc(var(--i, 0) * 90ms);
    }
    .anim-ready .anim-reveal.is-in { opacity: 1; translate: 0 0; }

    /* Trait sous les titres qui se dessine quand la section arrive */
    .anim-ready .sec-head:not(.anim-lit) h2 { background-size: 0 3px; }
    .anim-ready .sec-head h2 { transition: background-size 1s var(--anim-ease) .25s; }
}

@keyframes anim-rise   { from { opacity: 0; translate: 0 24px; } }
@keyframes anim-float  { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes anim-glow {
    0%, 100% { filter: drop-shadow(0 18px 28px rgba(var(--anim-rgb), .28)); }
    50%      { filter: drop-shadow(0 18px 38px rgba(var(--anim-rgb), .4)); }
}
@keyframes anim-frame {
    0%, 100% { box-shadow: 0 0 0 rgba(var(--anim-rgb), 0); }
    50%      { box-shadow: 0 0 26px rgba(var(--anim-rgb), .2); }
}
@keyframes anim-spin  { to { rotate: 360deg; } }
@keyframes anim-drift {
    0%   { translate: 0 0;        scale: 1; }
    50%  { translate: 6vw -4vh;   scale: 1.15; }
    100% { translate: -4vw 5vh;   scale: .9; }
}
@keyframes anim-shine { 0%, 70% { translate: -130% 0; } 100% { translate: 130% 0; } }

/* ---------- Impression : tableau de synthèse propre, sans effets ---------- */
@media print {
    .anim-progress, .anim-aura { display: none !important; }
    .anim-reveal { opacity: 1 !important; translate: none !important; }
    .anim-spot::after, .btn.primary::after { display: none !important; }
    .hero-name { color: #000; }
    *, *::before, *::after { animation: none !important; }
}
