/* ==========================================================================
   Projet Résurgence — Visual Enhancements
   3D hero, scroll reveals, card tilt, tech tree, HUD overlays
   ========================================================================== */

/* ---- 3D Hero Canvas ---- */
.hero-3d-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.hero .hero-content {
    z-index: 2;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, var(--bg-primary) 0%, transparent 100%);
    z-index: 1;
    pointer-events: none;
}

/* ---- Hero HUD Overlay ---- */
.hero-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.hud-element {
    position: absolute;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.7rem;
    color: var(--primary-gold);
    opacity: 0;
    animation: hudFadeIn 1.5s ease-out forwards;
    letter-spacing: 0.05em;
    line-height: 1.4;
    white-space: nowrap;
}

.hud-element::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-gold);
    margin-right: 6px;
    vertical-align: middle;
    animation: hudPulse 2s ease-in-out infinite;
}

.hud-el-1 { top: 18%; left: 5%; animation-delay: 0.8s; }
.hud-el-2 { top: 32%; right: 6%; animation-delay: 1.2s; }
.hud-el-3 { bottom: 35%; left: 8%; animation-delay: 1.6s; }
.hud-el-4 { top: 22%; right: 12%; animation-delay: 2.0s; }
.hud-el-5 { bottom: 28%; right: 4%; animation-delay: 2.4s; }
.hud-el-6 { top: 45%; left: 3%; animation-delay: 1.0s; }

@keyframes hudFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 0.55; transform: translateY(0); }
}

@keyframes hudPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Scan lines */
.hero-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.008) 2px,
        rgba(255, 255, 255, 0.008) 4px
    );
}

/* ---- Scroll Reveal System ---- */
[data-reveal] {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal="left"] {
    transform: translateX(-60px);
}

[data-reveal="right"] {
    transform: translateX(60px);
}

[data-reveal="scale"] {
    transform: scale(0.92);
}

[data-reveal="fade"] {
    transform: none;
}

[data-reveal].revealed {
    opacity: 1;
    transform: none;
}

[data-reveal-delay="1"] { transition-delay: 0.1s; }
[data-reveal-delay="2"] { transition-delay: 0.2s; }
[data-reveal-delay="3"] { transition-delay: 0.3s; }
[data-reveal-delay="4"] { transition-delay: 0.4s; }
[data-reveal-delay="5"] { transition-delay: 0.5s; }
[data-reveal-delay="6"] { transition-delay: 0.6s; }

/* ---- Card Tilt Effect ---- */
.feature-card {
    transform-style: preserve-3d;
    perspective: 800px;
    will-change: transform;
}

.feature-card.tilt-active {
    transition: transform 0.1s ease-out, box-shadow 0.3s ease;
}

.feature-card .card-shine {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: radial-gradient(
        600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(213, 182, 84, 0.08),
        transparent 40%
    );
}

.feature-card:hover .card-shine {
    opacity: 1;
}

.feature-card {
    position: relative;
    overflow: hidden;
}

/* Gold border glow on hover */
.feature-card::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: inherit;
    border: 1px solid transparent;
    transition: border-color 0.4s ease;
    pointer-events: none;
}

.feature-card:hover::after {
    border-color: rgba(213, 182, 84, 0.3);
}

/* ---- Stats Section Enhancement ---- */
.stats {
    position: relative;
    overflow: hidden;
}

.stats-grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(213, 182, 84, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(213, 182, 84, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

.stat-card {
    position: relative;
}

.stat-number {
    text-shadow: 0 0 30px rgba(213, 182, 84, 0.3);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: var(--primary-gold);
    opacity: 0.4;
    border-radius: 1px;
}

/* ---- Tech Tree Section ---- */
.tech-tree-section {
    padding: var(--spacing-3xl) 0;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.tech-tree-section::before {
    display: none;
}

.tech-tree-container {
    position: relative;
    margin-top: var(--spacing-2xl);
    padding: var(--spacing-xl) 0;
}

.tech-tree-track {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: var(--spacing-xl) var(--spacing-lg);
    scrollbar-width: thin;
    scrollbar-color: var(--primary-gold) var(--bg-secondary);
}

.tech-tree-content {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0;
    position: relative;
    min-width: max-content;
}

.tech-tree-track::-webkit-scrollbar {
    height: 4px;
}

.tech-tree-track::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 2px;
}

.tech-tree-track::-webkit-scrollbar-thumb {
    background: var(--primary-gold);
    border-radius: 2px;
}

.tech-tree-line {
    position: absolute;
    top: 8px;
    left: 50px;
    right: 50px;
    height: 2px;
    background: var(--bg-tertiary);
    z-index: 0;
}

.tech-tree-line-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-gold), var(--primary-gold-light));
    border-radius: 1px;
    transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 12px rgba(213, 182, 84, 0.4);
}

.tech-tree-node {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    position: relative;
    z-index: 1;
    scroll-snap-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.tech-tree-node.node-visible {
    opacity: 1;
    transform: translateY(0);
}

.tech-node-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--bg-tertiary);
    transition: all 0.5s ease;
    position: relative;
    margin-bottom: var(--spacing-sm);
}

.tech-tree-node.node-active .tech-node-dot {
    background: var(--primary-gold);
    border-color: var(--primary-gold);
    box-shadow: 0 0 16px rgba(213, 182, 84, 0.5);
}

.tech-node-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid transparent;
    transition: border-color 0.5s ease;
}

.tech-tree-node.node-active .tech-node-dot::after {
    border-color: rgba(213, 182, 84, 0.3);
}

.tech-node-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.03em;
    transition: color 0.5s ease;
    line-height: 1.3;
}

.tech-tree-node.node-active .tech-node-label {
    color: var(--primary-gold);
}

.tech-node-era {
    font-size: 0.6rem;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 2px;
}

/* Tech tree competencies legend */
.tech-tree-branches {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.tech-branch-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-mono, monospace);
    transition: all 0.3s ease;
}

.tech-branch-tag:hover {
    border-color: var(--primary-gold);
    color: var(--primary-gold);
}

.tech-branch-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.tech-branch-dot.terrestre,
.tech-branch-dot.aerien,
.tech-branch-dot.naval,
.tech-branch-dot.balistique,
.tech-branch-dot.non-conventionnel,
.tech-branch-dot.industrie {
    background: var(--primary-gold);
}

/* ---- Section Dividers ---- */
.section-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(213, 182, 84, 0.2) 20%,
        rgba(213, 182, 84, 0.4) 50%,
        rgba(213, 182, 84, 0.2) 80%,
        transparent 100%
    );
    margin: 0;
    border: none;
}

/* ---- CTA Section Enhancement ---- */
.cta {
    position: relative;
    overflow: hidden;
}

.cta-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.cta-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: ctaFloat linear infinite;
}

@keyframes ctaFloat {
    0% {
        transform: translateY(100%) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
        transform: translateY(80%) translateX(10px) scale(1);
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100%) translateX(-20px) scale(0.5);
        opacity: 0;
    }
}

/* ---- Feature Icon Animation ---- */
.feature-icon svg {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-card:hover .feature-icon svg {
    transform: scale(1.15) rotate(-3deg);
}

/* ---- Mobile 3D Fallback ---- */
@media (max-width: 767px) {
    .hero-3d-canvas {
        display: none;
    }

    .hero::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 300px;
        height: 300px;
        border-radius: 50%;
        background:
            radial-gradient(circle at 30% 30%, rgba(213, 182, 84, 0.08) 0%, transparent 50%),
            radial-gradient(circle at 70% 70%, rgba(213, 182, 84, 0.06) 0%, transparent 50%);
        border: 1px solid rgba(213, 182, 84, 0.1);
        animation: mobileGlobePulse 8s ease-in-out infinite;
        z-index: 0;
        pointer-events: none;
    }

    @keyframes mobileGlobePulse {
        0%, 100% {
            transform: translate(-50%, -50%) scale(1);
            opacity: 0.6;
        }
        50% {
            transform: translate(-50%, -50%) scale(1.05);
            opacity: 0.8;
        }
    }
}

/* ---- Hero Title Enhancement ---- */
.hero-title {
    position: relative;
}

.hero-title-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 200%;
    background: radial-gradient(
        ellipse at center,
        rgba(213, 182, 84, 0.03) 0%,
        transparent 60%
    );
    pointer-events: none;
    z-index: -1;
}

@keyframes titleGlowPulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

/* ---- Section Title Underline ---- */
.section-title {
    position: relative;
    display: inline-block;
    width: 100%;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--primary-gold);
    margin: var(--spacing-md) auto 0;
    border-radius: 1px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-title.revealed::after {
    width: 120px;
}

/* ---- Button Enhancements ---- */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
}

.btn-primary:hover::after {
    left: 120%;
}

/* ---- Responsive: Mobile ---- */
@media (max-width: 1040px) {
    .hero-hud {
        display: none;
    }

    .hero-scanlines {
        display: none;
    }

    .tech-tree-node {
        width: 80px;
    }

    .tech-node-label {
        font-size: 0.6rem;
    }
}

@media (max-width: 768px) {
    .tech-tree-section {
        padding: var(--spacing-xl) 0;
    }

    .tech-tree-track {
        padding: var(--spacing-md) var(--spacing-sm);
    }

    .tech-tree-line {
        top: 7px;
        left: 30px;
        right: 30px;
    }

    .tech-tree-node {
        width: 60px;
        min-width: 60px;
    }

    .tech-node-dot {
        width: 14px;
        height: 14px;
    }

    .tech-node-label {
        font-size: 0.55rem;
    }

    .tech-node-era {
        font-size: 0.5rem;
    }

    .tech-branches {
        gap: var(--spacing-xs);
    }

    .tech-branch-tag {
        font-size: 0.6rem;
        padding: 3px 6px;
        gap: 4px;
    }

    .stats-grid-bg {
        display: none;
    }

    .feature-card {
        transform: none !important;
    }

    .feature-card:hover {
        transform: translateY(-4px) !important;
    }

    .card-shine {
        display: none;
    }

    [data-reveal] {
        transition-duration: 0.4s !important;
    }

    .features {
        padding: var(--spacing-xl) 0;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: var(--spacing-lg);
    }

    .feature-card {
        padding: var(--spacing-md);
    }

    .feature-title {
        font-size: 1.1rem;
    }

    .feature-description {
        font-size: 0.9rem;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }

    .hero {
        padding: var(--spacing-xl) 0;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .cta {
        padding: var(--spacing-xl) 0;
    }

    .cta h2 {
        font-size: 1.4rem;
    }

    .cta p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    [data-reveal] {
        transform: translateY(20px);
    }

    [data-reveal="left"],
    [data-reveal="right"] {
        transform: translateY(20px);
    }
}

/* ---- Cross-Page Card Enhancements ---- */
.resource-card,
.info-card,
.guide-card,
.tip-card,
.faq-item,
.comparison-column,
.rule-category-section,
.step-item,
.context-item,
.step-category {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s ease;
}

.resource-card:hover,
.info-card:hover,
.guide-card:hover,
.tip-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(213, 182, 64, 0.1);
}

.faq-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.step-item:hover .step-number {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(213, 182, 64, 0.3);
}

.step-number {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.context-item:hover {
    transform: translateY(-3px);
}

.step-category:hover {
    transform: translateX(4px);
}

/* ---- Hero Parallax Effect (all pages) ---- */
.hero {
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(213, 182, 64, 0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
}

/* ---- Section Transitions ---- */
.features,
.stories-section,
.comparison-section,
.rules-hero,
.guide-hero,
.resources-hero,
.mecaniques-hero {
    position: relative;
}

/* ---- Progressive Reveal for Lists ---- */
.comparison-list li,
.rule-list li,
.step-category ul li {
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.comparison-list li.revealed,
.rule-list li.revealed,
.step-category ul li.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* ---- Article Content Enhancement (rp-geopolitique) ---- */
.article-content h2 {
    position: relative;
    padding-left: var(--spacing-md);
}

.article-content h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-gold);
    border-radius: 2px;
}

.comparison-table {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.comparison-table tr {
    transition: background-color 0.2s ease;
}

/* ---- Form Field Enhancement (guide) ---- */
.form-field {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.form-field:hover {
    transform: translateX(4px);
    box-shadow: -3px 0 0 var(--primary-gold);
}

/* ---- Rules Sidebar Enhancement ---- */
.rules-sidebar-link {
    transition: transform 0.2s ease, padding-left 0.2s ease;
}

.rules-sidebar-link:hover {
    transform: translateX(4px);
    padding-left: var(--spacing-md);
}

/* ---- CTA Enhancement (new dark style) ---- */
.cta {
    position: relative;
    overflow: hidden;
}

.cta::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(213, 182, 64, 0.2), transparent);
}

/* ---- Native Feel — Touch Feedback & Smooth Interactions ---- */
.btn,
.btn-primary,
.btn-secondary,
.feature-card,
.tech-branch-tag,
.carousel-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn:active,
.btn-primary:active,
.btn-secondary:active {
    transform: scale(0.96);
    transition: transform 0.1s ease;
}

.feature-card:active {
    transform: scale(0.98) !important;
    transition: transform 0.15s ease;
}

.tech-branch-tag:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.tech-tree-track {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.tech-tree-track::-webkit-scrollbar {
    height: 6px;
}

.tech-tree-track::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
    margin: 0 8px;
}

.tech-tree-track::-webkit-scrollbar-thumb {
    background: var(--primary-gold);
    border-radius: 3px;
}

.tech-tree-track::-webkit-scrollbar-thumb:hover {
    background: var(--primary-gold-light);
}

html {
    scroll-behavior: smooth;
}

@media (hover: none) and (pointer: coarse) {
    .feature-card:hover {
        transform: none;
    }

    .feature-card:active {
        transform: scale(0.98);
    }

    .card-shine {
        display: none;
    }

    .hero-hud {
        display: none;
    }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .hero-3d-canvas {
        display: none;
    }

    .hero-hud {
        display: none;
    }

    .hero-scanlines {
        display: none;
    }

    [data-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .tech-tree-line-fill {
        transition: none;
    }

    .tech-tree-node {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .cta-particle {
        animation: none;
        display: none;
    }

    .hero-title-glow {
        animation: none;
    }

    .btn-primary::after {
        display: none;
    }

    .hud-element {
        animation: none;
        opacity: 0.5;
    }
}

/* ---- Performance: Low-end devices ---- */
.reduce-motion .hero-3d-canvas {
    display: none;
}

.reduce-motion .hero-hud,
.reduce-motion .hero-scanlines {
    display: none;
}

.reduce-motion .cta-particles {
    display: none;
}
