/* OrienteBac : animations et effets au survol
   Règles : on n'anime que transform et opacity (fluide, même sur téléphone d'entrée de gamme),
   les effets de survol ne s'activent que sur les appareils qui ont une souris,
   et tout mouvement est coupé si l'utilisateur a demandé « moins d'animations ». */

/* ===== Titre du hero : lettres écrites une à une (motion.js) ===== */
.hero h1 .ch { visibility: hidden; }
.hero h1 .ch.on, .hero h1.is-typed .ch { visibility: visible; }
/* Garde-fou : si le script ne s'exécute pas, le titre s'affiche quand même après 2 s */
html.js:not(.type-ok) .hero h1 { opacity: 0; animation: h1-secours .01s linear 2s forwards; }
@keyframes h1-secours { to { opacity: 1; } }

/* ===== Éléments fixes (sans mouvement par défaut) ===== */
.scroll-progress { position: fixed; z-index: 60; top: 0; left: 0; width: 100%; height: 3px; transform: scaleX(0); transform-origin: left;
                   background: linear-gradient(90deg, var(--c-primary), #ffb36b); pointer-events: none; }
.to-top { position: fixed; z-index: 55; right: 1.1rem; bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px)); display: grid; place-items: center;
          width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%; background: var(--c-primary-dark, #1e3a8a); color: #fff; cursor: pointer;
          box-shadow: 0 10px 24px rgba(15, 30, 74, .3); opacity: 0; visibility: hidden; transform: translateY(12px); }
.to-top svg { width: 22px; height: 22px; }
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.site-header.is-scrolled { box-shadow: 0 8px 28px rgba(15, 30, 74, .10); }
.site-header { view-transition-name: site-header; }

/* Transition douce entre les pages (navigateurs récents ; ignorée ailleurs) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation-duration: .16s; }
::view-transition-new(root) { animation-duration: .26s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

@media (prefers-reduced-motion: no-preference) {

  /* ===== Barre d'en-tête, retour en haut ===== */
  .scroll-progress { will-change: transform; }
  .to-top { transition: opacity .3s ease, transform .3s ease, visibility .3s, background-color .2s; }
  .site-header { transition: box-shadow .3s ease; }

  /* ===== Hero : une entrée orchestrée ===== */
  @keyframes hero-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
  .hero__text > * { animation: hero-in .7s cubic-bezier(.2, .7, .2, 1) both; }
  .hero__text > :nth-child(1) { animation-delay: .05s; }
  /* Le titre s'écrit (motion.js) pendant ~1,3 s : le reste du hero suit juste derrière */
  .hero__text > :nth-child(3) { animation-delay: .95s; }
  .hero__text > :nth-child(4) { animation-delay: 1.1s; }
  .hero__text > :nth-child(5) { animation-delay: 1.25s; }
  .hero__text > :nth-child(6) { animation-delay: 1.4s; }
  .hero__text > h1 { animation: none; }

  /* Curseur lumineux du titre */
  .caret { display: inline-block; position: relative; width: 0; height: 1em; vertical-align: baseline; }
  .caret::after { content: ""; position: absolute; left: .05em; bottom: .04em; width: .07em; height: .92em; border-radius: 3px;
                  background: linear-gradient(180deg, #ffc58a, #f97316); box-shadow: 0 0 16px rgba(249, 115, 22, .8); animation: caret-blink .85s steps(1) infinite; }
  .is-typing .caret::after { animation: none; }               /* fixe pendant l'écriture, clignote ensuite */
  .caret.is-done::after { animation: caret-out .5s ease forwards; }
  @keyframes caret-blink { 50% { opacity: 0; } }
  @keyframes caret-out { to { opacity: 0; } }
  @keyframes bar-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .hero h1 + .hero__lead::before { animation: bar-draw .55s cubic-bezier(.2, .7, .2, 1) 1s backwards; }

  /* Reflet qui glisse lentement dans le dégradé du titre */
  @keyframes shimmer { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
  .hero .h1__grad { background-image: linear-gradient(95deg, #8cc2ff, #b9b4ff, #ffb36b, #b9b4ff, #8cc2ff);
                    background-size: 200% 100%; animation: shimmer 7s ease-in-out infinite alternate; }

  /* Point « en direct » du badge */
  @keyframes dot-ring { 0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, .6); } 70%, 100% { box-shadow: 0 0 0 8px rgba(249, 115, 22, 0); } }
  .eyebrow::before { animation: dot-ring 2.2s ease-out infinite; }

  /* Carte « Mes choix » : entrée, lignes qui s'ajoutent une à une, léger flottement */
  @keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
  @keyframes row-in { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
  @keyframes card-back { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
  .pcard.is-back { animation: card-back .35s ease backwards; }
  @keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.18); } 100% { transform: scale(1); } }
  .demo { animation: hero-in .9s cubic-bezier(.2, .7, .2, 1) 1.15s both, float 7s ease-in-out 2.5s infinite; }
  .mock__row { animation: row-in .55s cubic-bezier(.2, .7, .2, 1) both; }
  .mock__rows > :nth-child(1) { animation-delay: 1.45s; }
  .mock__rows > :nth-child(2) { animation-delay: 1.6s; }
  .mock__rows > :nth-child(3) { animation-delay: 1.75s; }
  .mock__rank { animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both; }
  .mock__rows > :nth-child(1) .mock__rank { animation-delay: 1.6s; }
  .mock__rows > :nth-child(2) .mock__rank { animation-delay: 1.75s; }
  .mock__rows > :nth-child(3) .mock__rank { animation-delay: 1.9s; }
  /* Barres « squelette » qui scintillent : elles montrent qu'il s'agit d'un emplacement, pas d'un vrai profil */
  @keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
  .skel { animation: skel 1.9s ease-in-out infinite; }
  @keyframes live-dot { 0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .55); } 70%, 100% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); } }
  .mock__row .tag--candidature::before { animation: live-dot 2s ease-out infinite; }
  .demo__label::before { animation: dot-ring 2.2s ease-out infinite; }

  /* Lueurs qui dérivent doucement derrière le hero (écrans larges seulement) */
  @keyframes orb-a { from { transform: translate(0, 0); } to { transform: translate(70px, 50px); } }
  @keyframes orb-b { from { transform: translate(0, 0); } to { transform: translate(-60px, -40px); } }
  @media (min-width: 768px) {
    .hero > .home-wrap { position: relative; z-index: 1; }
    .hero::before, .hero::after { content: ""; position: absolute; z-index: 0; border-radius: 50%; pointer-events: none; }
    .hero::before { width: 34rem; height: 34rem; left: -12rem; top: -14rem; background: radial-gradient(circle, rgba(96, 165, 250, .32), transparent 65%); animation: orb-a 16s ease-in-out infinite alternate; }
    .hero::after { width: 30rem; height: 30rem; right: -9rem; bottom: -13rem; background: radial-gradient(circle, rgba(249, 115, 22, .22), transparent 65%); animation: orb-b 20s ease-in-out infinite alternate; }
  }

  /* ===== Apparition au défilement (les classes sont ajoutées par motion.js) ===== */
  @keyframes reveal-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  @keyframes reveal-left { from { opacity: 0; transform: translateX(-32px); } to { opacity: 1; transform: none; } }
  @keyframes reveal-right { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: none; } }
  .motion-ok .reveal { opacity: 0; }
  .motion-ok .reveal.is-in { opacity: 1; animation: reveal-up .75s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms) backwards; }
  .motion-ok .reveal--left.is-in { animation-name: reveal-left; }
  .motion-ok .reveal--right.is-in { animation-name: reveal-right; }

  /* Étapes : le trait se dessine, le numéro apparaît avec un petit rebond */
  .motion-ok .step.reveal::before { transform: scaleY(0); transform-origin: top; transition: transform .9s ease calc(var(--d, 0ms) + .35s); }
  .motion-ok .step.is-in::before { transform: scaleY(1); }
  .motion-ok .step.is-in .step__num { animation: pop .55s cubic-bezier(.2, 1.4, .4, 1) calc(var(--d, 0ms) + .2s) backwards; }
  @media (min-width: 768px) {
    .motion-ok .step.reveal::before { transform: scaleX(0); transform-origin: left; }
    .motion-ok .step.is-in::before { transform: scaleX(1); }
  }

  /* ===== Boutons ===== */
  .btn { position: relative; overflow: hidden; transition: background-color .2s ease, transform .15s ease, box-shadow .25s ease; }
  .btn:active { transform: scale(.97); }
  .btn .ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .45); transform: scale(0); animation: ripple .6s ease-out forwards; pointer-events: none; }
  .btn--secondary .ripple { background: rgba(37, 99, 235, .18); }
  @keyframes ripple { to { transform: scale(1); opacity: 0; } }

  /* ===== Éléments divers ===== */
  .alert { animation: alert-in .45s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes alert-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
  .field input, .field select, .field textarea { transition: border-color .2s ease, box-shadow .2s ease; }
  .field input:focus, .field select:focus, .field textarea:focus { box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); }
  .search__field svg { transition: color .2s ease, transform .25s ease; }
  .search:focus-within .search__field svg { color: var(--c-primary); transform: scale(1.15); }

  /* FAQ : le + devient × et la réponse se déplie en douceur */
  .faq .faq__item summary::after, .faq .faq__item[open] summary::after { content: "+"; transition: transform .3s ease, background-color .2s ease; }
  .faq .faq__item[open] summary::after { transform: rotate(45deg); background: var(--c-primary); color: #fff; }
  @keyframes faq-open { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
  .faq__item[open] > p { animation: faq-open .35s ease both; }
  :root { interpolate-size: allow-keywords; }
  .faq__item::details-content { block-size: 0; overflow: clip; transition: block-size .35s ease, content-visibility .35s allow-discrete; }
  .faq__item[open]::details-content { block-size: auto; }


  /* Pages intérieures */
  .page-hero__in > * { animation: hero-in .7s cubic-bezier(.2, .7, .2, 1) backwards; }
  .page-hero__in > :nth-child(2) { animation-delay: .08s; }
  .page-hero__in > :nth-child(3) { animation-delay: .16s; }
  .page-hero__in > :nth-child(4) { animation-delay: .24s; }
  .auth__wrap { animation: hero-in .8s cubic-bezier(.2, .7, .2, 1) backwards; }
  .tronc > :not(summary) { animation: faq-open .35s ease both; }
  .tronc:not([open]) > :not(summary) { animation: none; }
  .choice { transition: box-shadow .25s ease, border-color .2s ease, background-color .2s ease; }
  .pw__toggle, .pill { transition: background-color .2s ease, color .2s ease, border-color .2s ease; }

  /* Appel final : entrée orchestrée, anneaux en rotation, pastilles flottantes, reflet sur le bouton */
  .motion-ok .cta.is-in .cta__body > * { animation: hero-in .75s cubic-bezier(.2, .7, .2, 1) backwards; }
  .motion-ok .cta.is-in .cta__body > :nth-child(1) { animation-delay: .1s; }
  .motion-ok .cta.is-in .cta__body > :nth-child(2) { animation-delay: .2s; }
  .motion-ok .cta.is-in .cta__body > :nth-child(3) { animation-delay: .3s; }
  .motion-ok .cta.is-in .cta__body > :nth-child(4) { animation-delay: .4s; }
  .motion-ok .cta.is-in .cta__body > :nth-child(5) { animation-delay: .6s; }
  .cta .cta__grad { background-image: linear-gradient(95deg, #8cc2ff, #b9b4ff, #ffb36b, #b9b4ff, #8cc2ff); background-size: 200% 100%; animation: shimmer 7s ease-in-out infinite alternate; }

  /* Les coches se dessinent l'une après l'autre */
  @keyframes draw { to { stroke-dashoffset: 0; } }
  .motion-ok .cta .cta__ck { stroke-dasharray: 20; stroke-dashoffset: 20; }
  .motion-ok .cta.is-in .cta__ck { animation: draw .5s ease forwards; }
  .motion-ok .cta.is-in .cta__list li:nth-child(1) .cta__ck { animation-delay: .7s; }
  .motion-ok .cta.is-in .cta__list li:nth-child(2) .cta__ck { animation-delay: .9s; }
  .motion-ok .cta.is-in .cta__list li:nth-child(3) .cta__ck { animation-delay: 1.1s; }

  .cta__glow--a { animation: orb-b 14s ease-in-out infinite alternate; }
  .cta__glow--b { animation: orb-a 18s ease-in-out infinite alternate; }

  /* Reflet qui traverse le bouton toutes les quelques secondes */
  @keyframes cta-shine { 0% { transform: translateX(-180%) skewX(-20deg); } 38%, 100% { transform: translateX(300%) skewX(-20deg); } }
  .cta .cta__btn::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 55%; pointer-events: none;
                          background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .6), transparent); animation: cta-shine 4.8s ease-in-out 1.4s infinite; }

  @media (min-width: 900px) {
    @keyframes spin { to { transform: rotate(360deg); } }
    @keyframes drift { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-11px); } }
    @keyframes badge-in { from { opacity: 0; transform: translateY(24px) scale(.7); } to { opacity: 1; transform: none; } }
    @keyframes core-ping { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.9); opacity: 0; } }
    @keyframes core-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
    .ring--1 { animation: spin 32s linear infinite; }
    .ring--2 { animation: spin 46s linear infinite reverse; }
    .ring--3 { animation: spin 20s linear infinite; }
    .cta__core { animation: core-breathe 4.5s ease-in-out infinite; }
    .cta__core::after { animation: core-ping 3s ease-out infinite; }
    .motion-ok .cta__badge { opacity: 0; }
    .motion-ok .cta.is-in .cta__badge { opacity: 1; }
    .motion-ok .cta.is-in .cta__badge--a { animation: badge-in .8s cubic-bezier(.2, 1.2, .4, 1) .6s backwards, drift 7s ease-in-out 1.4s infinite; }
    .motion-ok .cta.is-in .cta__badge--b { animation: badge-in .8s cubic-bezier(.2, 1.2, .4, 1) .8s backwards, drift 8.5s ease-in-out -2s infinite; }
    .motion-ok .cta.is-in .cta__badge--c { animation: badge-in .8s cubic-bezier(.2, 1.2, .4, 1) 1s backwards, drift 6.5s ease-in-out -4s infinite; }
  }
}

/* ===== Survol (souris uniquement, mouvement autorisé) ===== */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {

  /* Menu : soulignement qui glisse */
  .site-nav a:not(.btn) { position: relative; }
  .site-nav a:not(.btn):not([aria-current])::after { content: ""; position: absolute; left: .7rem; right: .7rem; bottom: .3rem; height: 2px; border-radius: 2px;
                                                      background: var(--c-primary); transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
  .site-nav a:not(.btn):not([aria-current]):hover::after { transform: scaleX(1); }
  .site-nav a:not(.btn):hover { text-decoration: none; }

  /* Logo */
  .logo__mark { transition: transform .35s cubic-bezier(.2, 1.4, .4, 1); }
  .logo:hover .logo__mark { transform: rotate(-9deg) scale(1.08); }

  /* Boutons : élévation, ombre, reflet */
  .btn:not(.btn--secondary):not(.btn--light):not([disabled]):hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(37, 99, 235, .32); }
  .btn--secondary:hover, .btn--light:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 30, 74, .14); }
  .btn--danger:hover { box-shadow: 0 10px 22px rgba(180, 35, 24, .3); }
  .btn:not(.btn--secondary)::before { content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(-130%);
                                      background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); transition: transform .65s ease; }
  .btn:not(.btn--secondary):hover::before { transform: translateX(130%); }
  .btn svg, .link svg { transition: transform .25s ease; }
  .btn:hover svg, .link:hover svg { transform: translateX(4px); }

  /* Puces et suggestions */
  .chip, .hero__tags a { transition: transform .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease; }
  .chip:hover, .hero__tags a:hover { transform: translateY(-2px); }

  /* Cartes : élévation + halo qui suit le curseur */
  .card, .cat, .etab, .pcard { transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s ease, border-color .2s ease; }
  .card:hover, .cat:hover, .etab:hover, .pcard:hover { transform: translateY(-5px); box-shadow: 0 18px 38px rgba(15, 30, 74, .13); }
  .cat, .etab { position: relative; overflow: hidden; isolation: isolate; }
  .cat::after, .etab::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; pointer-events: none; transition: opacity .3s ease;
                              background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), rgba(37, 99, 235, .11), transparent 62%); }
  .cat:hover::after, .etab:hover::after { opacity: 1; }
  .cat__icon, .feature__icon, .etab__logo { transition: transform .35s cubic-bezier(.2, 1.4, .4, 1); }
  .cat:hover .cat__icon { transform: scale(1.1) rotate(-5deg); }
  .etab:hover .etab__logo { transform: scale(1.08) rotate(-3deg); }
  .feature:hover .feature__icon { transform: translateY(-3px) scale(1.08); }
  .cat__foot svg { transition: transform .25s ease; }
  .cat:hover .cat__foot svg { transform: translateX(5px); }
  .etab__name { transition: color .2s ease; }
  .etab:hover .etab__name { color: var(--c-primary); }

  /* Parcours : le lien se décale, la flèche s'allume et avance */
  .pcard__list a { transition: padding-left .25s ease, color .2s ease; }
  .pcard__list a:hover { padding-left: .55rem; }
  .pcard__arrow { transition: transform .25s ease, opacity .2s ease; }
  .pcard__list a:hover .pcard__arrow { opacity: 1; transform: translateX(4px); }
  .pcard__icon { transition: transform .35s cubic-bezier(.2, 1.4, .4, 1); }
  .pcard:hover .pcard__icon { transform: scale(1.1) rotate(-5deg); }
  .pchip { transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s ease; }
  .pchip:hover { transform: translateY(-2px); }

  /* Photo du fondateur */
  .founder__photo { transition: transform .45s cubic-bezier(.2, .7, .2, 1), box-shadow .45s ease; }
  .founder__photo:hover { transform: translateY(-6px) rotate(-1.2deg); box-shadow: 0 28px 54px rgba(15, 30, 74, .22); }

  /* Pied de page et FAQ */
  .site-footer__col a { display: inline-block; transition: transform .2s ease, color .2s ease; }
  .site-footer__col a:hover { transform: translateX(4px); }
  .faq__item { transition: border-color .2s ease, box-shadow .25s ease; }
  .faq__item:hover { border-color: #bcd0f7; box-shadow: 0 8px 22px rgba(15, 30, 74, .07); }
  .cta:hover::after { opacity: 1; }
  .cta .cta__btn:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(249, 115, 22, .5); }
  .job { transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s ease; }
  .job:hover, .stat:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(15, 30, 74, .12); }
  .stat { transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s ease; }
  .choice:hover { box-shadow: 0 12px 28px rgba(15, 30, 74, .10); }
  .card .card__go { transition: transform .25s ease, opacity .2s ease; }
  .card:hover .card__go { transform: translateX(5px); }
  .pill:hover { transform: translateY(-2px); }
  .to-top:hover { transform: translateY(-3px); background: var(--c-primary); }
}
