/* ================================================================
   CRYSTAL ANIMATIONS v3.1 - PêlêTech Nexus
   Corrections : tilt subtil, performances, cartes réalisations
   ================================================================ */

:root {
    --crystal-violet: #8a6fe8;
    --crystal-blue: #4fa3d9;
    --crystal-gold: #C8A96E;
    --crystal-violet-glow: rgba(138, 111, 232, 0.5);
    --crystal-blue-glow: rgba(79, 163, 217, 0.5);
    --crystal-gold-glow: rgba(200, 169, 110, 0.4);
}

/* ================================================================
   1. CURSEUR HOLOGRAPHIQUE
   ================================================================ */
* { cursor: none !important; }

#crystal-cursor {
    position: fixed;
    top: 0; left: 0;
    width: 10px; height: 10px;
    background: var(--crystal-violet);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px var(--crystal-violet-glow), 0 0 16px rgba(138,111,232,0.3);
    mix-blend-mode: screen;
    will-change: left, top;
}

#crystal-cursor-ring {
    position: fixed;
    top: 0; left: 0;
    width: 36px; height: 36px;
    border: 1.5px solid rgba(138, 111, 232, 0.45);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    transform: translate(-50%, -50%);
    will-change: left, top;
    background: radial-gradient(circle, rgba(138,111,232,0.04) 0%, transparent 70%);
}

@media (max-width: 768px) {
    #crystal-cursor, #crystal-cursor-ring { display: none !important; }
    * { cursor: auto !important; }
}
@media (prefers-reduced-motion: reduce) {
    #crystal-cursor, #crystal-cursor-ring { display: none !important; }
    * { cursor: auto !important; }
}

/* ================================================================
   2. CANVAS PARTICULES (léger)
   ================================================================ */
#crystal-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 0;
    opacity: 0.22;
}

/* ================================================================
   3. HERO
   ================================================================ */
#hero {
    position: relative;
    overflow: hidden;
}
#hero::before {
    content: '';
    position: absolute;
    top: -20%; left: -10%;
    width: 65vw; height: 65vw;
    background: radial-gradient(ellipse, rgba(138,111,232,0.11) 0%, transparent 70%);
    animation: orb-float-1 11s ease-in-out infinite alternate;
    pointer-events: none;
}
#hero::after {
    content: '';
    position: absolute;
    bottom: -20%; right: -10%;
    width: 55vw; height: 55vw;
    background: radial-gradient(ellipse, rgba(79,163,217,0.08) 0%, transparent 70%);
    animation: orb-float-2 14s ease-in-out infinite alternate;
    pointer-events: none;
}
@keyframes orb-float-1 {
    0%   { transform: translate(0,0) scale(1); }
    100% { transform: translate(4%,5%) scale(1.07); }
}
@keyframes orb-float-2 {
    0%   { transform: translate(0,0) scale(1); }
    100% { transform: translate(-4%,-5%) scale(1.05); }
}

/* Titre hero shimmer */
#hero h1 {
    background: linear-gradient(135deg,#fff 0%,var(--crystal-violet) 45%,var(--crystal-blue) 75%,var(--crystal-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 300% 300%;
    animation: crystal-shimmer 5s ease-in-out infinite;
    filter: drop-shadow(0 0 18px rgba(138,111,232,0.3));
}
@keyframes crystal-shimmer {
    0%,100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* ================================================================
   4. IMAGE PROFIL
   ================================================================ */
.animate-float {
    animation: float-subtle 7s ease-in-out infinite;
}
@keyframes float-subtle {
    0%,100% { transform: translateY(0); filter: drop-shadow(0 18px 32px rgba(138,111,232,0.22)); }
    50%      { transform: translateY(-12px); filter: drop-shadow(0 28px 45px rgba(79,163,217,0.28)); }
}
#hero img[alt="PêlêTech Nexus"] {
    border: 2px solid transparent;
    background:
        linear-gradient(#0b1020,#0b1020) padding-box,
        conic-gradient(from 0deg,var(--crystal-violet),var(--crystal-blue),var(--crystal-gold),var(--crystal-violet)) border-box;
    animation: ring-rotate 9s linear infinite;
    box-shadow: 0 0 28px rgba(138,111,232,0.22),0 0 55px rgba(79,163,217,0.09);
}
@keyframes ring-rotate {
    0%   { box-shadow: 0 0 28px rgba(138,111,232,0.28),0 0 55px rgba(79,163,217,0.09); }
    33%  { box-shadow: 0 0 28px rgba(79,163,217,0.32),0 0 55px rgba(138,111,232,0.09); }
    66%  { box-shadow: 0 0 28px rgba(200,169,110,0.25),0 0 55px rgba(138,111,232,0.12); }
    100% { box-shadow: 0 0 28px rgba(138,111,232,0.28),0 0 55px rgba(79,163,217,0.09); }
}

/* ================================================================
   5. LOGO
   ================================================================ */
.logo {
    background: linear-gradient(135deg,#fff 0%,var(--crystal-violet) 50%,var(--crystal-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: crystal-shimmer 5s ease-in-out infinite;
    filter: drop-shadow(0 0 7px rgba(138,111,232,0.38));
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* ================================================================
   6. NAVIGATION
   ================================================================ */
.navbar {
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
}
.navbar.scrolled {
    box-shadow: 0 4px 22px rgba(0,0,0,0.22),0 0 0 1px rgba(138,111,232,0.1);
}
.nav-link { position: relative; }
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -3px; left: 50%;
    width: 0; height: 2px;
    background: linear-gradient(90deg,var(--crystal-violet),var(--crystal-blue));
    transform: translateX(-50%);
    transition: width 0.3s cubic-bezier(0.23,1,0.32,1);
    border-radius: 2px;
    box-shadow: 0 0 5px var(--crystal-violet-glow);
}
.nav-link:hover::after,
.nav-link.active::after { width: 100%; }

/* ================================================================
   7. CARTES — RÈGLE PRINCIPALE
   *** Tilt JS actif uniquement sur les petites cartes ciblées ***
   *** Grandes cartes réalisations : élévation simple ***
   ================================================================ */
.card {
    position: relative;
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

/* Élévation universelle au hover (sans déformation) */
.card:hover {
    box-shadow: 0 10px 35px rgba(138,111,232,0.16),0 0 0 1px rgba(138,111,232,0.13);
}

/* --- PROTECTION ABSOLUE DES CARTES DE RÉALISATION --- */
.projet-card,
.projet-card.card,
#projets .card,
#projets .card-gradient,
#autres-projets .card {
    transform: none !important;
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease !important;
}
.projet-card:hover,
#projets .card:hover,
#projets .card-gradient:hover,
#autres-projets .card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 14px 38px rgba(138,111,232,0.19),0 0 0 1px rgba(138,111,232,0.18) !important;
    border-color: rgba(138,111,232,0.3) !important;
}

/* Reflet de lumière (injecté via JS) */
.crystal-shine {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        circle at var(--mouse-x,50%) var(--mouse-y,50%),
        rgba(255,255,255,0.08) 0%, transparent 55%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    mix-blend-mode: overlay;
    z-index: 0;
}
.card:hover .crystal-shine { opacity: 1; }

/* Pas de crystal-shine sur les cartes réalisation */
.projet-card .crystal-shine,
#projets .card .crystal-shine,
#autres-projets .card .crystal-shine { display: none !important; }

/* ================================================================
   8. SECTION TITLES
   ================================================================ */
.section-title {
    position: relative;
    display: inline-block;
    width: 100%;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px; left: 50%;
    transform: translateX(-50%);
    width: 0; height: 2px;
    background: linear-gradient(90deg,transparent,var(--crystal-violet),var(--crystal-blue),var(--crystal-gold),transparent);
    border-radius: 2px;
    transition: width 0.9s cubic-bezier(0.23,1,0.32,1);
    box-shadow: 0 0 7px var(--crystal-violet-glow);
}
.section-title.in-view::after { width: 100px; }

/* ================================================================
   9. ICÔNES
   ================================================================ */
.icon.icon-gradient.icon-circle {
    animation: icon-levitate 4s ease-in-out infinite;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.icon.icon-gradient.icon-circle:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 10px 28px rgba(138,111,232,0.38);
    animation-play-state: paused;
}
@keyframes icon-levitate {
    0%,100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}

/* ================================================================
   10. BOUTONS
   ================================================================ */
.btn {
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.btn::before {
    content: '';
    position: absolute;
    top: -50%; left: -60%;
    width: 40%; height: 200%;
    background: rgba(255,255,255,0.1);
    transform: skewX(-20deg);
    transition: left 0.5s ease;
    pointer-events: none;
}
.btn:hover::before { left: 130%; }

.btn-primary { box-shadow: 0 4px 15px rgba(138,111,232,0.28); }
.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 26px rgba(138,111,232,0.42);
}
.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(79,163,217,0.28);
}

/* ================================================================
   11. BADGES
   ================================================================ */
.badge-secondary,.badge-primary {
    position: relative;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.badge-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(138,111,232,0.3);
}

/* ================================================================
   12. SCROLL PROGRESS
   ================================================================ */
.scroll-progress,#scrollProgress {
    background: linear-gradient(90deg,var(--crystal-violet),var(--crystal-blue),var(--crystal-gold)) !important;
    box-shadow: 0 0 7px var(--crystal-violet-glow) !important;
    height: 3px !important;
}

/* ================================================================
   13. BACK TO TOP
   ================================================================ */
#backToTop { box-shadow: 0 4px 14px rgba(138,111,232,0.32) !important; }
#backToTop:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 22px rgba(138,111,232,0.48) !important;
}

/* ================================================================
   14. SOCIAL LINKS
   ================================================================ */
.social-link:hover {
    transform: translateY(-3px) scale(1.08) !important;
    box-shadow: 0 6px 15px rgba(138,111,232,0.32) !important;
}

/* ================================================================
   15. FOOTER
   ================================================================ */
.footer { position: relative; }
.footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg,transparent,var(--crystal-violet),var(--crystal-blue),var(--crystal-gold),transparent);
    box-shadow: 0 0 10px rgba(138,111,232,0.38);
}

/* ================================================================
   16. CARD GRADIENT
   ================================================================ */
.card-gradient {
    border: 1px solid rgba(138,111,232,0.16) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ================================================================
   17. TEXTE GRADIENT
   ================================================================ */
.text-gradient-secondary {
    background: linear-gradient(135deg,var(--crystal-gold) 0%,var(--crystal-violet) 50%,var(--crystal-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: crystal-shimmer 4s ease-in-out infinite;
}

/* ================================================================
   18. REVEAL AU SCROLL
   ================================================================ */
.crystal-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.65s cubic-bezier(0.23,1,0.32,1),
                transform 0.65s cubic-bezier(0.23,1,0.32,1);
    will-change: opacity, transform;
}
.crystal-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}
.crystal-delay-1 { transition-delay: 0.08s; }
.crystal-delay-2 { transition-delay: 0.16s; }
.crystal-delay-3 { transition-delay: 0.24s; }
.crystal-delay-4 { transition-delay: 0.32s; }
.crystal-delay-5 { transition-delay: 0.40s; }

/* ================================================================
   19. GEMMES FLOTTANTES HERO
   ================================================================ */
@keyframes gem-float {
    0%,100% { transform: translateY(0) rotate(0deg); opacity: 0.45; }
    50%      { transform: translateY(-11px) rotate(180deg); opacity: 0.7; }
}

/* ================================================================
   20. TÉMOIGNAGES
   ================================================================ */
.carousel-track .card:hover {
    transform: translateY(-6px) !important;
    box-shadow: 0 14px 36px rgba(138,111,232,0.22),0 0 0 1px rgba(138,111,232,0.22) !important;
    border-color: rgba(138,111,232,0.32) !important;
}
@keyframes star-twinkle {
    0%   { transform: scale(1); }
    100% { transform: scale(1.14); }
}
.carousel-track .card:hover .fa-star {
    animation: star-twinkle 0.5s ease infinite alternate;
    filter: drop-shadow(0 0 3px var(--crystal-gold-glow));
}

/* ================================================================
   21. FORM
   ================================================================ */
.form-control:focus {
    border-color: var(--crystal-violet) !important;
    box-shadow: 0 0 0 2px rgba(138,111,232,0.15),0 0 12px rgba(138,111,232,0.09) !important;
    outline: none;
}

/* ================================================================
   22. RESPONSIVE / ACCESSIBILITÉ
   ================================================================ */
@media (max-width: 768px) {
    .card { transform: none !important; }
    #crystal-canvas { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
    *,*::before,*::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    #crystal-canvas { display: none !important; }
}