html {
    scroll-behavior: smooth;
}

*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --bg-color: #0D1117;
    --card-bg: #161B22;
    --card-hover-bg: #21262D;
    --accent-blue: rgb(108, 193, 226);
    --primary-blue: rgb(61, 106, 255);
    --border-color: rgba(48, 54, 61, 0.7);
    --text-white: #FFFFFF;
    --text-gray: #8B949E;
}

body {
    background-color: var(--bg-color);
    color: var(--text-white);
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

/* --- ANIMATIONS --- */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.logo-name {
    color: var(--accent-blue);
    font-size: 20px;
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    transition: transform 0.3s ease;
    margin: 0;
}
.logo-name:hover { transform: translateX(10px); }

nav {
    background-color: rgba(13, 17, 23, 0.85);
    padding: 15px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(12px);
}

header {
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2.5rem;
    margin: 0;
    padding: 0;
}

nav ul a {
    text-decoration: none;
    color: var(--text-white);
    transition: 0.3s ease;
    font-weight: 500;
    position: relative;
    padding-bottom: 5px;
}
nav ul a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-blue);
    transition: width 0.3s ease;
}
nav ul a:hover { color: var(--accent-blue); }
nav ul a:hover::after { width: 100%; }

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ── HOME ── */
.Home {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-top: 20px;
}

.home-main {
    display: flex;
    align-items: center;
    gap: 4rem;
}

.home-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    flex-shrink: 0;
}

.home-img {
    width: 320px;
    height: 320px;
}

img {
    height: 100%;
    width: 100%;
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(61, 106, 255, 0.3);
    border: 4px solid var(--primary-blue);
    object-fit: cover;
    animation: float 3s ease-in-out infinite;
    display: block;
}

.home-icons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.social-icons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
}

.social-icons i {
    font-size: 1.8rem;
    color: var(--accent-blue);
    transition: 0.3s ease;
}

.social-icons a:hover i {
    color: var(--primary-blue);
    transform: translateY(-5px);
}

.home-button {
    width: 100%;
    display: flex;
    justify-content: center;
}

.button-link {
    text-decoration: none;
}

.home-content {
    flex-grow: 1;
}

.words-wrapper {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-family: 'Consolas', monospace;
    height: 40px;
    margin-bottom: 1rem;
}

.static-text {
    color: var(--text-white);
    margin-right: 8px;
}

.dynamic-box {
    display: flex;
    align-items: center;
    min-width: 250px;
}

.word-js {
    color: var(--accent-blue);
    font-weight: 700;
    border-right: 3px solid var(--primary-blue);
    padding-right: 5px;
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    from, to { border-color: transparent }
    50% { border-color: var(--primary-blue); }
}

/* ── BUTTONS ── */
button {
    padding: 12px 28px;
    border-radius: 8px;
    border: 1px solid var(--primary-blue);
    font-size: 14px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 2px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}
button:hover {
    background: var(--primary-blue);
    box-shadow: 0 0 20px rgba(61, 106, 255, 0.4);
}

/* ── ABOUT ── */
h2 {
    font-size: 2.5rem;
    text-align: center;
    margin: 4rem 0 3rem;
    position: relative;
    padding-bottom: 15px;
}
h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--primary-blue);
    border-radius: 2px;
}

.About-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.About-contenu {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: 0.4s ease;
}
.About-contenu:hover {
    transform: translateY(-10px);
    border-color: var(--primary-blue);
}

.title-card {
    color: var(--accent-blue);
    font-size: 1.5rem;
    margin: 0 0 1.5rem;
}

.formation-item {
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--primary-blue);
}

.button-container {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

/* ── SKILLS ── */
.Skills-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.Skills-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    transition: 0.4s ease;
}
.Skills-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-blue);
}

.skill-icon {
    font-size: 2.5rem;
    color: var(--accent-blue);
    margin-bottom: 1.5rem;
}

/* ── CTF ── */
.CTF-content {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    border-radius: 20px;
    max-width: 600px;
    margin: 0 auto 4rem;
    text-align: center;
}

/* ── FOOTER ── */
footer {
    background-color: #010409;
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-gray);
}

/* ════════════════════════
   RESPONSIVE (CENTRAGE PARFAIT)
   ════════════════════════ */
@media (max-width: 992px) {
    .home-main {
        flex-direction: column;
        text-align: center;
        gap: 3rem;
    }
    .home-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    .words-wrapper {
        justify-content: center;
        width: 100%;
    }
    .dynamic-box {
        min-width: fit-content; /* Supprime le décalage causé par la largeur fixe */
        justify-content: center;
    }
    .About-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    nav {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
    }
    nav ul {
        gap: 1.5rem;
    }
    .About-content {
        grid-template-columns: 1fr;
    }
    .home-img {
        width: 250px;
        height: 250px;
    }
}