/**
 * Cyberpunk Heading Widget Styles
 *
 * Styles pour le widget de titre cyberpunk avec effets néon,
 * glitch, scanlines et autres effets futuristes
 */

/* ========================================
   WRAPPER PRINCIPAL
   ======================================== */

.cyberpunk-heading-wrapper {
    position: relative;
    display: inline-block;
    overflow: hidden;
    width: auto; /* Par défaut, largeur automatique */
}

/* Support du centrage et alignement */
.cyberpunk-heading-wrapper.text-align-center {
    margin-left: auto;
    margin-right: auto;
    display: block;
    text-align: center;
}

.cyberpunk-heading-wrapper.text-align-center .cyberpunk-heading {
    display: inline-block;
}

.cyberpunk-heading-wrapper.text-align-left {
    margin-left: 0;
    margin-right: auto;
    text-align: left;
}

.cyberpunk-heading-wrapper.text-align-right {
    margin-left: auto;
    margin-right: 0;
    text-align: right;
}

.cyberpunk-heading {
    position: relative;
    display: inline-block;
    margin: 0;
    padding: 0;
    font-family: 'Orbitron', 'Rajdhani', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    transition: all 0.3s ease;
}

/* ========================================
   EFFET DÉGRADÉ
   ======================================== */

.cyberpunk-heading.has-gradient {
    /* Le gradient est appliqué inline via PHP */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

/* Fallback pour les navigateurs qui ne supportent pas background-clip: text */
@supports not (-webkit-background-clip: text) {
    .cyberpunk-heading.has-gradient {
        color: #00F0FF;
    }
}

/* ========================================
   EFFET NÉON SUBTIL (OPTIONNEL)
   ======================================== */

.cyberpunk-heading.has-neon-glow {
    /* Le filter drop-shadow est appliqué inline via PHP avec l'intensité choisie */
}

/* Animation de pulse très subtile pour le néon */
.cyberpunk-heading.has-neon-glow {
    animation: subtle-neon-pulse 4s ease-in-out infinite;
}

@keyframes subtle-neon-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.95;
    }
}

/* ========================================
   EFFET GLITCH
   ======================================== */

.cyberpunk-heading.has-glitch {
    position: relative;
}

.cyberpunk-heading.has-glitch::before,
.cyberpunk-heading.has-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.cyberpunk-heading.has-glitch::before {
    color: #FF0040;
    z-index: -1;
    animation: glitch-red 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
}

.cyberpunk-heading.has-glitch::after {
    color: #00FFFF;
    z-index: -2;
    animation: glitch-blue 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    animation-delay: 0.1s;
}

.cyberpunk-heading.has-glitch:hover::before,
.cyberpunk-heading.has-glitch:hover::after {
    opacity: 1;
}

@keyframes glitch-red {
    0%, 100% {
        transform: translate(0);
        clip-path: inset(0 0 0 0);
    }
    20% {
        transform: translate(-2px, 2px);
        clip-path: inset(0 0 90% 0);
    }
    40% {
        transform: translate(-2px, -2px);
        clip-path: inset(20% 0 20% 0);
    }
    60% {
        transform: translate(2px, 2px);
        clip-path: inset(60% 0 0 0);
    }
    80% {
        transform: translate(2px, -2px);
        clip-path: inset(0 0 50% 0);
    }
}

@keyframes glitch-blue {
    0%, 100% {
        transform: translate(0);
        clip-path: inset(0 0 0 0);
    }
    20% {
        transform: translate(2px, -2px);
        clip-path: inset(10% 0 50% 0);
    }
    40% {
        transform: translate(2px, 2px);
        clip-path: inset(70% 0 0 0);
    }
    60% {
        transform: translate(-2px, -2px);
        clip-path: inset(0 0 80% 0);
    }
    80% {
        transform: translate(-2px, 2px);
        clip-path: inset(40% 0 30% 0);
    }
}

/* ========================================
   EFFET SCANLINES
   ======================================== */

.cyberpunk-heading-wrapper.has-scanlines::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(0, 240, 255, 0.05) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1;
    animation: scan 8s linear infinite;
}

@keyframes scan {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

/* ========================================
   COINS BISEAUTÉS
   ======================================== */

.cyberpunk-heading-wrapper.has-corner-cut {
    clip-path: polygon(
        12px 0,
        100% 0,
        100% calc(100% - 12px),
        calc(100% - 12px) 100%,
        0 100%,
        0 12px
    );
}

@media (max-width: 768px) {
    .cyberpunk-heading-wrapper.has-corner-cut {
        clip-path: polygon(
            8px 0,
            100% 0,
            100% calc(100% - 8px),
            calc(100% - 8px) 100%,
            0 100%,
            0 8px
        );
    }
}

/* ========================================
   BORDURE NÉON ANIMÉE
   ======================================== */

.cyberpunk-heading-wrapper.has-border {
    position: relative;
    background: rgba(26, 26, 46, 0.5);
    backdrop-filter: blur(5px);
}

.cyberpunk-heading-wrapper.has-border::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        90deg,
        var(--border-color, #00F0FF),
        var(--border-color-light, #00FFFF),
        var(--border-color, #00F0FF)
    );
    background-size: 200% 100%;
    z-index: -1;
    animation: border-flow 3s ease infinite;
}

@keyframes border-flow {
    0%, 100% {
        background-position: 0% 0%;
    }
    50% {
        background-position: 100% 0%;
    }
}

/* ========================================
   VARIANTES DE COULEUR
   ======================================== */

.cyberpunk-heading-wrapper.color-cyan .cyberpunk-heading {
    color: #00F0FF;
}

.cyberpunk-heading-wrapper.color-magenta .cyberpunk-heading {
    color: #FF00FF;
}

.cyberpunk-heading-wrapper.color-violet .cyberpunk-heading {
    color: #8B00FF;
}

.cyberpunk-heading-wrapper.color-yellow .cyberpunk-heading {
    color: #FFFF00;
}

.cyberpunk-heading-wrapper.color-matrix .cyberpunk-heading {
    color: #00FF41;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .cyberpunk-heading {
        font-size: clamp(1.5rem, 5vw, 3rem);
    }
}

@media (max-width: 768px) {
    .cyberpunk-heading {
        font-size: clamp(1.2rem, 6vw, 2.5rem);
        letter-spacing: 1px;
    }

    .cyberpunk-heading.has-glitch::before,
    .cyberpunk-heading.has-glitch::after {
        opacity: 0.6;
    }
}

/* ========================================
   ÉTATS INTERACTIFS
   ======================================== */

@media (min-width: 1025px) {
    .cyberpunk-heading-wrapper:hover .cyberpunk-heading {
        transform: scale(1.01);
    }

    /* Hover plus subtil pour les titres avec dégradé */
    .cyberpunk-heading-wrapper:hover .cyberpunk-heading.has-gradient {
        opacity: 0.95;
    }

    /* Hover avec effet néon */
    .cyberpunk-heading-wrapper:hover .cyberpunk-heading.has-neon-glow {
        animation-duration: 2s;
    }

    .cyberpunk-heading-wrapper:hover.has-glitch .cyberpunk-heading::before,
    .cyberpunk-heading-wrapper:hover.has-glitch .cyberpunk-heading::after {
        animation-duration: 0.2s;
    }
}

.cyberpunk-heading-wrapper:focus-within {
    outline: 2px solid rgba(0, 240, 255, 0.5);
    outline-offset: 4px;
}

/* ========================================
   ANIMATIONS D'ENTRÉE
   ======================================== */

@keyframes fadeInGlitch {
    0% {
        opacity: 0;
        transform: translateY(20px);
        filter: blur(10px);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.cyberpunk-heading-wrapper.animate-on-scroll {
    opacity: 0;
}

.cyberpunk-heading-wrapper.animate-on-scroll.in-viewport {
    animation: fadeInGlitch 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ========================================
   ACCESSIBILITÉ
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .cyberpunk-heading-wrapper,
    .cyberpunk-heading,
    .cyberpunk-heading-wrapper::before,
    .cyberpunk-heading-wrapper::after,
    .cyberpunk-heading::before,
    .cyberpunk-heading::after {
        animation: none !important;
        transition: none !important;
    }
}

@media (prefers-contrast: high) {
    .cyberpunk-heading {
        text-shadow: none;
    }

    .cyberpunk-heading-wrapper.has-border {
        border-width: 3px;
    }
}

/* ========================================
   SÉPARATEUR ANIMÉ
   ======================================== */

.cyberpunk-heading-wrapper .title-decoration {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.cyberpunk-heading-wrapper .deco-line {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00D4E6);
    position: relative;
}

.cyberpunk-heading-wrapper .deco-line.right {
    background: linear-gradient(90deg, #00D4E6, transparent);
}

.cyberpunk-heading-wrapper .deco-icon {
    color: #00D4E6;
    font-size: 1.5rem;
    animation: iconRotate 4s linear infinite;
}

@keyframes iconRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Alignement pour le séparateur */
.cyberpunk-heading-wrapper.text-align-left .title-decoration {
    justify-content: flex-start;
}

.cyberpunk-heading-wrapper.text-align-center .title-decoration {
    justify-content: center;
}

.cyberpunk-heading-wrapper.text-align-right .title-decoration {
    justify-content: flex-end;
}

/* Responsive pour le séparateur */
@media (max-width: 768px) {
    .cyberpunk-heading-wrapper .title-decoration {
        gap: 15px;
        margin-top: 15px;
    }

    .cyberpunk-heading-wrapper .deco-line {
        width: 40px;
    }

    .cyberpunk-heading-wrapper .deco-icon {
        font-size: 1.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cyberpunk-heading-wrapper .deco-icon {
        animation: none !important;
    }
}
