:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #f43f5e;
    --dark: #111827;
    --light: #f9fafb;
    --gray: #9ca3af;
    --transition: all 0.3s ease;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animation de fondu à l'entrée */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Animations pour sections */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
}

.fade-in.appear {
    opacity: 1;
    transform: translateY(0);
}

/* Animation pour le header */
@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* Header */
header {
    background-color: var(--dark);
    color: var(--light);
    padding: 1.5rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.5s ease forwards;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--light);
    text-decoration: none;
}

.logo span {
    color: var(--primary);
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 2rem;
}

nav ul li a {
    color: var(--light);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

nav ul li a:hover {
    color: var(--primary);
}

nav ul li a::after {
    content: '';
    width: 0;
    height: 2px;
    background-color: var(--primary);
    position: absolute;
    bottom: -5px;
    left: 0;
    transition: var(--transition);
}

nav ul li a:hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    cursor: pointer;
}

.hamburger div {
    width: 25px;
    height: 3px;
    background-color: var(--light);
    margin: 5px 0;
    transition: var(--transition);
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    background: linear-gradient(rgba(17, 24, 39, 0.65), rgba(17, 24, 39, 0.65)), url('../image/bannier_hero.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--light);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.02) 0%, transparent 50%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    animation: fadeIn 1s ease forwards;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 600px;
    color: var(--gray);
}

.highlight {
    color: var(--primary);
}

.btn {
    display: inline-block;
    background-color: var(--primary);
    color: var(--light);
    padding: 0.8rem 1.8rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary);
    margin-left: 1rem;
}

.btn-outline:hover {
    background-color: var(--primary);
}

.social-icons {
    display: flex;
    margin-top: 2rem;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--light);
    margin-right: 1rem;
    transition: var(--transition);
}

.social-icons a:hover {
    background-color: var(--primary);
    transform: translateY(-3px);
}

/* À propos Section */
section {
    padding: 6rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
}

.section-title h2 {
    font-size: 2.5rem;
    display: inline-block;
    position: relative;
    z-index: 1;
}

.section-title h2::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 5px;
    background-color: var(--primary);
    bottom: -10px;
    left: 25%;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-img {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.15);
}

.about-img img {
    width: 100%;
    display: block;
    transition: var(--transition);
}

.about-img:hover img {
    transform: scale(1.05);
}

.about-text h3 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--dark);
}

.about-text p {
    margin-bottom: 1.5rem;
    color: #4b5563;
}

.skills {
    display: flex;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.skill {
    background-color: #e5e7eb;
    color: var(--dark);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    margin-right: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

.skill:hover {
    background-color: var(--primary);
    color: var(--light);
    transform: translateY(-3px);
}

/* Services Section */
.services {
    background-color: #f3f4f6;
}

.services-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.service-card {
    background-color: var(--light);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    background-color: var(--primary);
    transition: var(--transition);
    opacity: 0.05;
    z-index: -1;
}

.service-card:hover {
    transform: translateY(-10px);
}

.service-card:hover::before {
    height: 100%;
}

.service-icon {
    width: 60px;
    height: 60px;
    background-color: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    color: var(--primary);
    font-size: 1.8rem;
    transition: var(--transition);
}

.service-card:hover .service-icon {
    background-color: var(--primary);
    color: var(--light);
}

.service-card h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.service-card p {
    color: #4b5563;
    margin-bottom: 1.5rem;
}

/* Portfolio Section */
.portfolio-filter {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    background-color: transparent;
    border: none;
    padding: 0.5rem 1.5rem;
    margin: 0 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--dark);
    position: relative;
    transition: var(--transition);
}

.filter-btn::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: var(--transition);
}

.filter-btn:hover, .filter-btn.active {
    color: var(--primary);
}

.filter-btn:hover::after, .filter-btn.active::after {
    width: 100%;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* Make large portfolio items span two columns on wider screens */

/* Ensure all portfolio cards have the same size */
.portfolio-item {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.portfolio-img {
    height: 220px; /* fixed image area for uniform cards */
    flex: 0 0 220px;
}

.portfolio-info {
    flex: 1 1 auto; /* let content fill the remaining space */
}

/* Project type badge */
.project-type {
    display: inline-block;
    background-color: var(--primary);
    color: var(--light);
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.6rem;
    vertical-align: middle;
}

/* Local project indicator */
.portfolio-local {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0.5rem;
    cursor: default;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
}

.portfolio-item {
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.portfolio-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.15);
}

.portfolio-img {
    width: 100%;
    height: 250px;
    
    background-color: #e5e7eb;
    position: relative;
    overflow: hidden;
}

.portfolio-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: var(--transition);
}

/* Reduce hover zoom to avoid cropping; keep image visible */
.portfolio-item:hover .portfolio-img img {
    transform: scale(1.03);
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-overlay a {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0.5rem;
    transform: translateY(20px);
    opacity: 0;
    transition: var(--transition);
}

.portfolio-item:hover .portfolio-overlay a {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-item:hover .portfolio-overlay a:nth-child(2) {
    transition-delay: 0.1s;
}

.portfolio-item:hover .portfolio-local {
    opacity: 1;
    transform: translateY(0);
}

/* Portfolio details button styling */
.portfolio-details-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--light);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0.5rem;
    transform: translateY(20px);
    opacity: 0;
    transition: var(--transition);
    font-size: 1.2rem;
}

.portfolio-item:hover .portfolio-details-btn {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-item:hover .portfolio-details-btn:nth-child(2) {
    transition-delay: 0.1s;
}

.portfolio-details-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(0) scale(1.1);
}

.portfolio-info {
    padding: 1.5rem;
    background-color: var(--light);
}

.portfolio-info h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.portfolio-info p {
    color: var(--gray);
    font-size: 0.9rem;
}

.portfolio-tags {
    display: flex;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.portfolio-tag {
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-radius: 20px;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Contact Section */
.contact {
    position: relative;
    background-color: #f3f4f6;
}

.contact-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 4rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
}

.contact-info h3 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
}

.contact-info p {
    color: #4b5563;
    margin-bottom: 2rem;
}

.contact-details {
    margin-bottom: 2rem;
}

.contact-details div {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.contact-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    color: var(--primary);
    font-size: 1.2rem;
}

.contact-text {
    font-size: 1rem;
    color: var(--dark);
}

.contact-text span {
    display: block;
    color: var(--gray);
    font-size: 0.9rem;
}

.contact-form {
    background-color: var(--light);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Accessible focus outlines */
:focus {
    outline: none;
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

textarea.form-control {
    resize: vertical;
    min-height: 150px;
}

/* Footer */
footer {
    background-color: var(--dark);
    color: var(--light);
    padding: 3rem 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.footer-logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--light);
    text-decoration: none;
    margin-bottom: 1rem;
}

.footer-logo span {
    color: var(--primary);
}

.footer-text {
    margin-bottom: 1rem;
    max-width: 400px;
    color: var(--gray);
}

.footer-links h4 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

.footer-links h4::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 3px;
    background-color: var(--primary);
    bottom: -10px;
    left: 0;
}

.footer-links ul {
    list-style: none;
}

.footer-links ul li {
    margin-bottom: 0.8rem;
}

.footer-links ul li a {
    color: var(--gray);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links ul li a:hover {
    color: var(--primary);
    padding-left: 5px;
}

.copyright {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--gray);
}

/* Media Queries */
@media (max-width: 992px) {
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-img {
        max-width: 500px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    nav ul {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        flex-direction: row;
        justify-content: space-around;
        background-color: var(--dark);
        padding: 2rem 0;
        clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
        transition: var(--transition);
    }

    nav ul.active {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }

    nav ul li {
        margin: 1rem 0;
    }

    .hero h1 {
        font-size: 2rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .about-content {
        flex-direction: column;
        gap: 2rem;
    }

    .about-img {
        max-width: 100%;
        margin: 0 auto;
    }

    .about-text pre {
        font-size: 0.75rem;
        padding: 1rem !important;
        word-wrap: break-word;
        white-space: pre-wrap;
    }

    .skills {
        justify-content: center;
    }

    .skill {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .btn {
        display: block;
        width: 100%;
        text-align: center;
        margin-bottom: 1rem;
    }

    .btn-outline {
        margin-left: 0;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        margin-top: 2rem;
    }

    .footer-links h4::after {
        left: 25%;
    }
}

/* Animation pour le curseur */
.typing {
    position: relative;
}

.typing::after {
    content: '|';
    position: absolute;
    right: -5px;
    animation: blink 0.7s infinite;
}

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

/* Animation pour les icônes */
@keyframes pulse {
    0% {transform: scale(1);}
    50% {transform: scale(1.1);}
    100% {transform: scale(1);}
}

.service-icon {
    animation: pulse 2s infinite;
}

/* Scroll To Top Button */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary);
    color: var(--light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.scroll-top.active {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    background-color: var(--primary-dark);
    transform: translateY(-5px);
}