:root {
    --bg: #030305;
    --surface: #0a0e17;
    --accent-cyan: #00ffff;
    --accent-pink: #ff00ff;
    --text: #e0f7fa;
    --border: rgba(0, 255, 255, 0.2);
    --glow: 0 0 15px rgba(0, 255, 255, 0.5);
}

/* --- RESET & BODY --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: crosshair;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Orbitron', sans-serif;
    overflow-x: hidden;
    background-image:
        linear-gradient(var(--surface) 1px, transparent 1px),
        linear-gradient(90deg, var(--surface) 1px, transparent 1px);
    background-size: 50px 50px;
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 4px;
    z-index: 100;
    pointer-events: none;
    opacity: 0.2;
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* --- HEADER RESSERRÉ --- */
header {
    padding-top: 60px;
    /* Titre plus haut */
    padding-bottom: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    position: relative;
}

.status {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-pink);
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

/* --- TITRE GLITCH STABLE --- */
h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    text-transform: uppercase;
    line-height: 0.9;
    margin-bottom: 1.5rem;
    color: #fff;
    position: relative;
    display: inline-block;
}

h1::before,
h1::after {
    content: "SOFTWARE_FORGE";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
}

h1::before {
    left: 2px;
    text-shadow: -2px 0 var(--accent-cyan);
    clip-path: inset(45% 0 45% 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
}

h1::after {
    left: -2px;
    text-shadow: -2px 0 var(--accent-pink);
    clip-path: inset(55% 0 55% 0);
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

.hero-desc {
    max-width: 700px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    color: #a0c0c0;
    border-left: 3px solid var(--accent-cyan);
    padding-left: 20px;
}

/* --- LE RETOUR DES BELLES CARTES --- */
h2 {
    font-size: 1.8rem;
    text-transform: uppercase;
    margin: 3rem 0 1.5rem 0;
    color: var(--accent-cyan);
    text-shadow: var(--glow);
    display: flex;
    align-items: center;
}

h2::before {
    content: "> ";
    color: #fff;
    margin-right: 10px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.card {
    background: rgba(10, 14, 23, 0.8);
    border: 1px solid var(--border);
    padding: 2rem;
    position: relative;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow: hidden;
    /* Coins biseautés "cyber" */
    clip-path: polygon(0 0, 100% 0, 100% 90%, 90% 100%, 0 100%);
}

/* Ligne lumineuse animée en haut au hover */
.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    transition: all 0.5s;
}

.card:hover {
    border-color: rgba(0, 255, 255, 0.8);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 255, 255, 0.2);
    background: rgba(16, 22, 35, 0.9);
}

.card:hover::before {
    left: 100%;
}

.card-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent-cyan);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #fff;
}

.tech-stack {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tech {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    border: 1px solid var(--accent-pink);
    color: var(--accent-pink);
    padding: 3px 8px;
    background: rgba(255, 0, 255, 0.1);
}

/* --- TERMINAL --- */
.links-terminal {
    background: rgba(10, 14, 23, 0.95);
    border: 1px solid var(--accent-cyan);
    margin-top: 3rem;
    padding: 10px;
}

.terminal-content {
    display: flex !important;
    flex-direction: column !important;
}

.terminal-content a.terminal-row {
    display: flex !important;
    color: var(--text) !important;
    text-decoration: none !important;
    padding: 10px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.05);
}

.terminal-content a.terminal-row:hover {
    color: var(--accent-cyan) !important;
    background: rgba(0, 255, 255, 0.05);
}

/* --- ANIMATIONS --- */
@keyframes glitch-anim {
    0% {
        clip-path: inset(80% 0 1% 0);
    }

    20% {
        clip-path: inset(44% 0 56% 0);
    }

    40% {
        clip-path: inset(10% 0 80% 0);
    }

    60% {
        clip-path: inset(70% 0 15% 0);
    }

    80% {
        clip-path: inset(25% 0 60% 0);
    }

    100% {
        clip-path: inset(99% 0 1% 0);
    }
}

footer {
    text-align: center;
    padding: 4rem 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: rgba(0, 255, 255, 0.4);
}

/* --- OPTIMISATION MOBILE (Cyber Page) --- */
@media (max-width: 768px) {

    /* 1. On réduit le padding du container */
    .main-container {
        padding: 0 1rem;
    }

    /* 2. Titre : on force le mot à tenir et on réduit la taille */
    h1 {
        font-size: 2.5rem;
        /* Taille fixe plus sécurisée sur mobile */
        word-wrap: break-word;
        line-height: 1.1;
    }

    h1::before,
    h1::after {
        /* On s'assure que le pseudo-élément suit la même règle */
        content: "SOFTWARE_FORGE";
    }

    /* 3. On descend le min-size des cartes pour les petits écrans */
    .grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }

    /* 4. On ajuste le header pour ne pas perdre d'espace */
    header {
        padding-top: 30px;
        align-items: center;
        /* On centre tout sur mobile pour le style */
        text-align: center;
    }

    .hero-desc {
        border-left: none;
        border-top: 3px solid var(--accent-cyan);
        padding: 15px 0 0 0;
        text-align: center;
    }

    /* 5. Mode Paysage (Smartphone à l'horizontale) */
    @media (orientation: landscape) and (max-height: 500px) {
        header {
            padding-top: 10px;
        }

        h1 {
            font-size: 2rem;
        }
    }
}