/* HUD tactique — couche décorative réutilisable (IRON GATES) */

@import 'tokens-campaign.css';

/* ─── Fond d'ambiance global (campagne + candidature) ─── */
html:has(.hud-ambient) {
    background-color: var(--color-black);
}

body:has(.hud-ambient) {
    background-color: transparent;
}

.hud-ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 50% at 12% 8%, rgba(var(--hud-cyan-rgb), 0.10), transparent 60%),
        radial-gradient(ellipse 55% 45% at 88% 92%, rgba(var(--hud-cyan-rgb), 0.08), transparent 60%),
        linear-gradient(rgba(var(--hud-cyan-rgb), 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--hud-cyan-rgb), 0.055) 1px, transparent 1px);
    background-size: auto, auto, 46px 46px, 46px 46px;
}

.hud-ambient::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.06) 2px,
        rgba(0, 0, 0, 0.06) 4px
    );
    opacity: 0.28;
    animation: hudScanDrift 14s linear infinite;
}

.hud-ambient::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 85% 75% at 50% 45%, transparent 45%, rgba(0, 0, 0, 0.45) 100%);
    pointer-events: none;
}

/* ─── Grille de fond discrète ─── */
.hud-grid {
    background-image:
        linear-gradient(rgba(var(--hud-cyan-rgb), 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--hud-cyan-rgb), 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
}

/* ─── Scanlines ─── */
.hud-scanlines::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    opacity: 0.35;
    animation: hudScanDrift 12s linear infinite;
}

@keyframes hudScanDrift {
    0% { background-position: 0 0; }
    100% { background-position: 0 48px; }
}

/* ─── Crochets de visée (4 coins) ─── */
.hud-frame {
    position: relative;
}

.hud-frame::before,
.hud-frame::after {
    content: '';
    position: absolute;
    inset: 1.25rem;
    z-index: 4;
    pointer-events: none;
    border: 1px solid rgba(var(--hud-cyan-rgb), 0.35);
}

.hud-frame::before {
    border-right: none;
    border-bottom: none;
    width: 48px;
    height: 48px;
    inset: 1.25rem auto auto 1.25rem;
}

.hud-frame::after {
    border-left: none;
    border-top: none;
    width: 48px;
    height: 48px;
    inset: auto 1.25rem 1.25rem auto;
}

.hud-frame > .hud-frame-brackets {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.hud-frame > .hud-frame-brackets::before,
.hud-frame > .hud-frame-brackets::after {
    content: '';
    position: absolute;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(var(--hud-cyan-rgb), 0.35);
}

.hud-frame > .hud-frame-brackets::before {
    top: 1.25rem;
    right: 1.25rem;
    border-left: none;
    border-bottom: none;
}

.hud-frame > .hud-frame-brackets::after {
    bottom: 1.25rem;
    left: 1.25rem;
    border-right: none;
    border-top: none;
}

/* ─── Glitch titre ─── */
.hud-glitch {
    position: relative;
    color: var(--color-white);
}

.hud-glitch::before,
.hud-glitch::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.hud-glitch::before {
    color: var(--hud-cyan-light);
    clip-path: inset(0 0 55% 0);
    transform: translate(-2px, -1px);
    opacity: 0.65;
    animation: hudGlitchCyan 4s steps(2, end) infinite;
}

.hud-glitch::after {
    color: #f472b6;
    clip-path: inset(45% 0 0 0);
    transform: translate(2px, 1px);
    opacity: 0.5;
    animation: hudGlitchMagenta 4s steps(2, end) infinite reverse;
}

@keyframes hudGlitchCyan {
    0%, 88%, 100% { transform: translate(-2px, -1px); opacity: 0.65; }
    90% { transform: translate(3px, 0); opacity: 0.85; }
    92% { transform: translate(-4px, 2px); opacity: 0.4; }
}

@keyframes hudGlitchMagenta {
    0%, 85%, 100% { transform: translate(2px, 1px); opacity: 0.5; }
    87% { transform: translate(-3px, -1px); opacity: 0.75; }
    89% { transform: translate(4px, 0); opacity: 0.35; }
}

/* ─── Bandeau télémétrie ─── */
.hud-telemetry {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    padding: 0 1.5rem 1.25rem;
    pointer-events: none;
}

.hud-telemetry--hero {
    bottom: 3.5rem;
}

.hud-telemetry__block {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.5;
}

.hud-telemetry__block span:first-child {
    color: var(--hud-cyan-light);
    font-weight: 600;
}

.hud-telemetry__block--right {
    text-align: right;
}

/* ─── Hero campagne — poster IRON GATES ─── */
.campaign-hero-cinematic.hud-hero {
    align-items: stretch;
    justify-content: flex-end;
}

.campaign-hero-cinematic.hud-hero .hero-video-wrap video {
    opacity: 0;
    visibility: hidden;
}

.campaign-hero-cinematic.hud-hero .hero-poster-fallback {
    display: block !important;
    background: var(--hud-hero-poster) center / cover no-repeat;
}

.campaign-hero-cinematic.hud-hero .hero-scrim {
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, transparent 22%),
        linear-gradient(0deg, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.55) 22%, transparent 42%);
}

.campaign-hero-cinematic.hud-hero .hero-content--poster {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 11%;
    top: auto;
    z-index: 2;
    padding: 0 var(--space-4) var(--space-4);
    text-align: center;
}

.campaign-hero-cinematic.hud-hero .hero-content--poster .container {
    max-width: 36rem;
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(var(--hud-cyan-rgb), 0.22);
    backdrop-filter: blur(6px);
}

/* Titres redondants avec l'affiche — conservés pour le SEO / lecteurs d'écran */
.campaign-hero-cinematic.hud-hero #campaignHubTitle,
.campaign-hero-cinematic.hud-hero #campaignOpLabel,
.campaign-hero-cinematic.hud-hero #campaignLocation {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.campaign-hero-cinematic.hud-hero .campaign-badge {
    margin-bottom: var(--space-3);
    background: rgba(var(--hud-cyan-rgb), 0.15);
    color: var(--hud-cyan-light);
    border: 1px solid rgba(var(--hud-cyan-rgb), 0.45);
    box-shadow: 0 0 20px rgba(var(--hud-cyan-rgb), 0.2);
}

.campaign-hero-cinematic.hud-hero .hero-tagline {
    margin: 0;
    font-size: var(--text-base);
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.55;
    max-width: none;
}

.campaign-hero-cinematic.hud-hero .hero-scroll-hint {
    bottom: 3.5rem;
    z-index: 5;
    color: rgba(var(--hud-cyan-rgb), 0.6);
}

/* ─── Hero candidature — poster IRON GATES ─── */
.candidature-hero.hud-hero {
    min-height: 72vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 0 0 calc(var(--space-10) + 1rem);
    background: var(--color-black);
}

.candidature-hero.hud-hero::before {
    opacity: 1;
    background: var(--hud-hero-poster) center / cover no-repeat;
    filter: saturate(0.95) contrast(1.05);
}

.candidature-hero.hud-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, transparent 22%),
        linear-gradient(0deg, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.5) 24%, transparent 44%);
}

.candidature-hero.hud-hero .candidature-hero-content--poster {
    position: relative;
    z-index: 1;
    max-width: 36rem;
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
    text-align: center;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(var(--hud-cyan-rgb), 0.22);
    backdrop-filter: blur(6px);
}

.candidature-hero.hud-hero .candidature-hero-badge {
    background: rgba(var(--hud-cyan-rgb), 0.15);
    color: var(--hud-cyan-light);
    border: 1px solid rgba(var(--hud-cyan-rgb), 0.45);
}

.candidature-hero.hud-hero .candidature-hero-title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    letter-spacing: 0.14em;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: var(--space-3);
}

.candidature-hero.hud-hero .candidature-hero-lead {
    font-size: var(--text-base);
    color: rgba(255, 255, 255, 0.72);
    margin: 0;
}

/* ─── Focus visible (accessibilité) ─── */
.hud-frame a:focus-visible,
.hud-frame button:focus-visible {
    outline: 2px solid var(--hud-cyan);
    outline-offset: 3px;
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
    .hud-scanlines::after,
    .hud-ambient::before,
    .hud-glitch::before,
    .hud-glitch::after {
        animation: none !important;
    }

    .hud-glitch::before,
    .hud-glitch::after {
        display: none;
    }
}

@media (max-width: 640px) {
    .hud-ambient {
        background:
            radial-gradient(ellipse 70% 55% at 12% 8%, rgba(var(--hud-cyan-rgb), 0.04), transparent 60%),
            radial-gradient(ellipse 65% 50% at 88% 92%, rgba(var(--hud-cyan-rgb), 0.035), transparent 60%),
            linear-gradient(rgba(var(--hud-cyan-rgb), 0.025) 1px, transparent 1px),
            linear-gradient(90deg, rgba(var(--hud-cyan-rgb), 0.025) 1px, transparent 1px);
        background-size: auto, auto, 56px 56px, 56px 56px;
    }

    .hud-ambient::before {
        opacity: 0.1;
    }

    .campaign-hero-cinematic.hud-hero .hero-content--poster {
        bottom: 7%;
        padding: 0 var(--space-2);
    }

    .campaign-hero-cinematic.hud-hero .hero-content--poster .container {
        padding: var(--space-3) var(--space-4);
    }

    .candidature-hero.hud-hero {
        min-height: 65vh;
        padding-bottom: var(--space-8);
    }

    .candidature-hero.hud-hero .candidature-hero-content--poster {
        margin: 0 var(--space-2);
        padding: var(--space-3) var(--space-4);
    }

    .hud-telemetry {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 1rem;
    }

    .hud-telemetry__block--right {
        text-align: left;
    }

    .hud-frame::before,
    .hud-frame::after,
    .hud-frame > .hud-frame-brackets::before,
    .hud-frame > .hud-frame-brackets::after {
        width: 28px;
        height: 28px;
        inset: 0.75rem;
    }

    .hud-frame::after {
        inset: auto 0.75rem 0.75rem auto;
    }

    .hud-frame > .hud-frame-brackets::before {
        top: 0.75rem;
        right: 0.75rem;
    }

    .hud-frame > .hud-frame-brackets::after {
        bottom: 0.75rem;
        left: 0.75rem;
    }
}
