/* ==========================================================================
   Rémy Brèque — couche d'animations (toutes les pages)
   Chargée sur tout le site. Rien n'est masqué si le JavaScript ne tourne pas :
   les états "cachés" ne s'appliquent que sous html.rb-js.
   ========================================================================== */

:root {
    --rb-orange: #FF6B35;
    --rb-orange-soft: #FF8C42;
    --rb-ink: #1A1A1A;
    --rb-graphite: #2C2C2C;
    --rb-cream: #FBF8F3;
    --rb-ease-out: cubic-bezier(.16, 1, .3, 1);
    --rb-ease-in-out: cubic-bezier(.65, 0, .35, 1);
    --rb-reveal-dur: 1.1s;
}

/* ---------- Lenis (défilement fluide) ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ---------- Entrée / sortie de page ---------- */
html.rb-js body { animation: rb-page-in .7s var(--rb-ease-out) both; }
html.rb-leaving body { opacity: 0; transition: opacity .35s var(--rb-ease-in-out); }
@keyframes rb-page-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Barre de progression de lecture ---------- */
.rb-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 10001;
    transform-origin: 0 50%; transform: scaleX(0);
    background: linear-gradient(90deg, var(--rb-orange), var(--rb-orange-soft));
    pointer-events: none;
}

/* ---------- Révélations au défilement ---------- */
html.rb-js [data-reveal] {
    opacity: 0;
    transition:
        opacity var(--rb-reveal-dur) var(--rb-ease-out),
        transform var(--rb-reveal-dur) var(--rb-ease-out),
        clip-path 1.3s var(--rb-ease-out),
        filter var(--rb-reveal-dur) var(--rb-ease-out);
    transition-delay: calc(var(--i, 0) * 90ms + var(--d, 0ms));
    will-change: opacity, transform;
}
html.rb-js [data-reveal=""],
html.rb-js [data-reveal="up"]    { transform: translate3d(0, 48px, 0); }
html.rb-js [data-reveal="down"]  { transform: translate3d(0, -32px, 0); }
html.rb-js [data-reveal="left"]  { transform: translate3d(-56px, 0, 0); }
html.rb-js [data-reveal="right"] { transform: translate3d(56px, 0, 0); }
html.rb-js [data-reveal="zoom"]  { transform: scale(.92); }
html.rb-js [data-reveal="blur"]  { filter: blur(12px); transform: translate3d(0, 24px, 0); }
html.rb-js [data-reveal="fade"]  { transform: none; }
html.rb-js [data-reveal="mask"]  { opacity: 1; clip-path: inset(100% 0 0 0 round 24px); }
html.rb-js [data-reveal="mask-x"]{ opacity: 1; clip-path: inset(0 100% 0 0 round 24px); }

html.rb-js [data-reveal].is-in {
    opacity: 1;
    transform: none;
    filter: none;
}
html.rb-js [data-reveal^="mask"].is-in { clip-path: inset(0 0 0 0 round 24px); }

/* Titres découpés mot par mot */
.rb-split .rb-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.rb-split .rb-w > span { display: inline-block; }
html.rb-js .rb-split .rb-w > span {
    transform: translate3d(0, 110%, 0) rotate(4deg);
    transition: transform 1.1s var(--rb-ease-out);
    transition-delay: calc(var(--w, 0) * 70ms + var(--d, 0ms));
}
html.rb-js .rb-split.is-in .rb-w > span { transform: none; }

/* ---------- Boutons : reflet + magnétisme ---------- */
[data-magnetic] { transition: transform .5s var(--rb-ease-out); will-change: transform; }
.rb-shine { position: relative; overflow: hidden; isolation: isolate; }
.rb-shine::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform .9s var(--rb-ease-out);
}
.rb-shine:hover::after { transform: translateX(120%); }

/* ---------- Petites finitions globales ---------- */
:where(a, button, input, select, textarea):focus-visible {
    outline: 2px solid var(--rb-orange);
    outline-offset: 3px;
    border-radius: 6px;
}
::selection { background: var(--rb-orange); color: #fff; }

/* Cartes produits WooCommerce : levée douce au survol */
.woocommerce ul.products li.product,
.related-product {
    transition: transform .6s var(--rb-ease-out), box-shadow .6s var(--rb-ease-out) !important;
}
.woocommerce ul.products li.product:hover,
.related-product:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 24px 60px -20px rgba(26, 26, 26, .25) !important;
}

/* Menu mobile : apparition en cascade */
.mobile-nav-overlay .mobile-nav-list li { transition: opacity .5s var(--rb-ease-out), transform .6s var(--rb-ease-out) !important; }
.mobile-nav-overlay.active .mobile-nav-list li:nth-child(1) { transition-delay: .05s !important; }
.mobile-nav-overlay.active .mobile-nav-list li:nth-child(2) { transition-delay: .10s !important; }
.mobile-nav-overlay.active .mobile-nav-list li:nth-child(3) { transition-delay: .15s !important; }
.mobile-nav-overlay.active .mobile-nav-list li:nth-child(4) { transition-delay: .20s !important; }
.mobile-nav-overlay.active .mobile-nav-list li:nth-child(5) { transition-delay: .25s !important; }
.mobile-nav-overlay.active .mobile-nav-list li:nth-child(6) { transition-delay: .30s !important; }
.mobile-nav-overlay.active .mobile-nav-list li:nth-child(7) { transition-delay: .35s !important; }
.mobile-nav-overlay.active .mobile-nav-list li:nth-child(8) { transition-delay: .40s !important; }

/* ---------- Accessibilité : mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
    html.rb-js body { animation: none; }
    html.rb-js [data-reveal],
    html.rb-js .rb-split .rb-w > span {
        opacity: 1 !important; transform: none !important; filter: none !important;
        clip-path: none !important; transition: none !important;
    }
    .rb-progress { display: none; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
