/*--------------------------------------------------
 # Portfolio Section Styles (realisations.css)
--------------------------------------------------*/

/*--------------------------------------------------
 # Scroll Animations for Cards
--------------------------------------------------*/
/* Animation from the left */
@keyframes portfolioFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation from the bottom */
@keyframes portfolioFromBottom {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation from the right */
@keyframes portfolioFromRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/*--------------------------------------------------
 # Portfolio Section Container & Title
--------------------------------------------------*/
.portfolio {
    padding: 80px 0;
    background-color: rgba(250, 250, 255, 0.8); /* Slight blue background */
    color: #333;
    position: relative;
    overflow: hidden;
}

.portfolio::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -100px;
    width: 400px;
    height: 400px;
    border: 2px solid rgba(64, 76, 186, 0.1);
    background: linear-gradient(135deg, rgba(64, 76, 186, 0.08), rgba(123, 31, 162, 0.05));
    border-radius: 32px;
    transform: rotate(15deg);
    pointer-events: none;
    opacity: 0.8;
    z-index: 0;
    box-shadow: 0 15px 35px rgba(64, 76, 186, 0.08);
}

.portfolio h2 {
    text-align: center;
}

/*--------------------------------------------------
 # Portfolio Grid Layout
--------------------------------------------------*/
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

/* === Portfolio card base === */
.portfolio-item {
    position: relative;
    height: 350px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(69, 39, 160, 0.12), 0 5px 10px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    text-align: center;
    background-color: #f8f9fa;
    font-family: 'Montserrat', sans-serif;
    border: 1px solid rgba(255,255,255,0.1);
    /* 3D effect */
    transform-style: preserve-3d;
    transform: perspective(1000px) translateZ(0);
    /* Performance */
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Smooth transition */
    transition: all 0.7s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* Force border-radius and mask on main layers to avoid Safari clipping issues */
.portfolio-item, .portfolio-bg, .portfolio-overlay {
    border-radius: 20px !important;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}

/* Remove border-radius and mask from content and details */
.portfolio-content, .project-details, .project-details * {
    border-radius: 0 !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
}

/* === Portfolio card background image === */
.portfolio-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: url('../../assets/backgrounds/background_cartes.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.8;
    z-index: 1;
    border-radius: 20px;
    /* Subtle zoom/pulse effect */
    transform: scale(1.03);
    animation: subtle-pulse 8s infinite alternate ease-in-out;
    /* Performance */
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Transition */
    transition: transform 0.7s cubic-bezier(0.215, 0.61, 0.355, 1),
                opacity 0.7s cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* Pulse animation for background image */
@keyframes subtle-pulse {
    0% { transform: scale(1.02); }
    100% { transform: scale(1.06); }
}

/* Background zooms in on hover */
.portfolio-item:hover .portfolio-bg {
    transform: scale(1.12);
    animation: none;
    filter: none;
}

/* === Portfolio overlay (color gradient layer) === */
.portfolio-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #6441ff, #7b1fa2);
    opacity: 0.75;
    z-index: 2;
    border-radius: 20px;
    box-shadow: inset 0 0 30px rgba(255,255,255,0.1);
    will-change: opacity, background;
    transition: opacity 0.6s cubic-bezier(0.215, 0.61, 0.355, 1),
                background 0.6s cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* Overlay gets darker on hover */
.portfolio-item:hover .portfolio-overlay {
    opacity: 0.85;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, rgba(30,30,30,0.95), rgba(50,50,50,0.95));
}

/* === Portfolio card content (titles, text, details) === */
.portfolio-content {
    position: relative;
    z-index: 3;
    height: 100%;
    padding: 25px 25px 30px 25px;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transform: translateZ(10px);
    will-change: transform;
    transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
    overflow: visible !important;
}

/* Card title (project name) */
.portfolio-content h3 {
    color: #fff !important;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.2);
    position: relative;
    transition: all 0.35s cubic-bezier(0.215, 0.61, 0.355, 1);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    will-change: transform;
}

/* Decorative underline for title */
.portfolio-content h3:after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background: rgba(255,255,255,0.7);
    transition: width 0.4s cubic-bezier(0.19, 1, 0.22, 1), height 0.4s cubic-bezier(0.19, 1, 0.22, 1), background 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Card description */
.portfolio-content p {
    font-size: 0.95rem;
    font-weight: 400;
    margin-bottom: 15px;
    opacity: 0.9;
    max-width: 300px;
    transform: translateY(20px) translateZ(0);
    transition: all 0.7s cubic-bezier(0.165, 0.84, 0.44, 1);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    will-change: transform, opacity;
    animation: moveToCenter 0.1s forwards;
}

/* Project details list (hidden by default, revealed on hover) */
.project-details {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 1.2s cubic-bezier(0.19, 1, 0.22, 1), margin-top 1.2s cubic-bezier(0.19, 1, 0.22, 1);
    transform: translateZ(5px);
    visibility: hidden;
    margin-top: 0;
}


.project-details ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    text-align: center;
}

/* === Project details list items === */
.project-details ul li {
    font-size: 0.9rem;
    margin-bottom: 5px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s cubic-bezier(0.19, 1, 0.22, 1), transform 0.8s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    padding-left: 18px;
    text-align: left;
    line-height: 1.4;
}

/* Chevron icon before each project detail item */
.project-details ul li:before {
    content: '\203A'; /* Chevron (›) */
    position: absolute;
    left: 0;
    top: -1px;
    color: rgba(255,255,255,0.9);
    margin-right: 6px;
    font-size: 1.1rem;
    font-weight: 500;
}

/* ===============================
   Hover Effects for Portfolio Cards
   =============================== */

.portfolio-item:hover {
    transform: perspective(1000px) translateZ(10px) translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px rgba(69, 39, 160, 0.2), 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: transform 1.5s cubic-bezier(0.19, 1, 0.22, 1),
                box-shadow 1.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.portfolio-item:hover .portfolio-bg {
    opacity: 0.9;
    transform: scale(1.12);
    animation: none;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 0.85;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.95), rgba(50, 50, 50, 0.95)); /* Dark filter for readability */
}

.portfolio-item:hover .portfolio-content {
    padding-top: 30px; /* More space for content */
    transform: translateZ(10px);
    transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.portfolio-item:hover .project-details {
    max-height: none; /* No height limit */
    opacity: 1;
    margin-top: 15px;
    transform: translateZ(15px);
    visibility: visible;
    overflow: visible !important;
    position: relative;
}

.portfolio-item:hover h3 {
    transform: translateY(0) translateZ(0);
    font-size: 1.75rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.8px;
    transition: all 0.5s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.portfolio-item:hover h3:after {
    width: 100px;
    height: 3px;
    background: rgba(255,255,255,0.95);
}

.portfolio-item:hover p {
    transform: translateY(0) translateZ(0);
    opacity: 1;
    transition: all 0.7s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.portfolio-item:hover .project-details ul li {
    transform: translateY(0);
    opacity: 1;
}

/* Staggered reveal for project details list items */
.portfolio-item:hover .project-details ul li:nth-child(1) { transition-delay: 0.4s; }
.portfolio-item:hover .project-details ul li:nth-child(2) { transition-delay: 0.8s; }
.portfolio-item:hover .project-details ul li:nth-child(3) { transition-delay: 1.2s; }
.portfolio-item:hover .project-details ul li:nth-child(4) { transition-delay: 1.6s; }
.portfolio-item:hover .project-details ul li:nth-child(5) { transition-delay: 2s; }

/* ===============================
   View More Button Styles
   =============================== */

.view-more {
    text-align: center;
    margin-top: 60px;
    margin-bottom: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.view-more .btn {
    padding: 12px 30px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.view-more .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(69, 39, 160, 0.2);
}

/* ===============================
   Portfolio Card Color Variations
   =============================== */

/* Default overlay gradients for each card */
.portfolio-grid .portfolio-item:nth-child(1) .portfolio-overlay {
    background: linear-gradient(135deg, #095894, #0b3b5f);
}
.portfolio-grid .portfolio-item:nth-child(2) .portfolio-overlay {
    background: linear-gradient(135deg, #6441ff, #7b1fa2);
}
.portfolio-grid .portfolio-item:nth-child(3) .portfolio-overlay {
    background: linear-gradient(135deg, #f7d046, #f1c40f); /* Modern gold/yellow */
}

/* On hover, override overlay gradient for each card */
.portfolio-grid .portfolio-item:hover .portfolio-overlay {
    opacity: 0.85 !important;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.3) !important;
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.95), rgba(50, 50, 50, 0.95)) !important;
}

/* Specific hover overlay for each card */
.portfolio-grid .portfolio-item:nth-child(1):hover .portfolio-overlay {
    background: linear-gradient(135deg, rgba(9, 58, 94, 0.95), rgba(5, 35, 60, 0.95)) !important;
}
.portfolio-grid .portfolio-item:nth-child(2):hover .portfolio-overlay {
    background: linear-gradient(135deg, rgba(65, 35, 140, 0.95), rgba(95, 25, 120, 0.95)) !important;
}
.portfolio-grid .portfolio-item:nth-child(3):hover .portfolio-overlay {
    background: linear-gradient(135deg, rgba(210, 190, 30, 0.92), rgba(180, 160, 20, 0.92)) !important;
}


.project-details ul li:before {
    content: '\203A'; /* Symbole chevron (›) */
    position: absolute;
    left: 0;
    top: -1px;
    color: rgba(255, 255, 255, 0.9);
    margin-right: 6px;
    font-size: 1.1rem;
    font-weight: 500;
}

.portfolio-item:hover {
    transform: perspective(1000px) translateZ(10px) translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px rgba(69, 39, 160, 0.2), 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: transform 1.5s cubic-bezier(0.19, 1, 0.22, 1),
                box-shadow 1.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.portfolio-item:hover .portfolio-bg {
    opacity: 0.9;
    transform: scale(1.12);
    animation: none; /* Stop animation on hover */
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 0.85;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.95), rgba(50, 50, 50, 0.95)); /* Filtre sombre pour lisibilité */
}

.portfolio-item:hover .portfolio-content {
    padding-top: 30px; /* Reduced padding to give more space to content */
    transform: translateZ(10px);
    transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); /* Transition rapide et fluide */
    display: flex;
    flex-direction: column;
    align-items: center; 
    justify-content: flex-start;
}

.portfolio-item:hover .project-details {
    max-height: none; /* Pas de limite de hauteur */
    opacity: 1;
    margin-top: 15px;
    transform: translateZ(15px);
    visibility: visible;
    overflow: visible !important;
    position: relative; /* Assure que le contenu est positionné correctement */
}

.portfolio-item:hover h3 {
    transform: translateY(0) translateZ(0); /* Return to normal position at top */
    font-size: 1.75rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.8px;
    transition: all 0.5s cubic-bezier(0.215, 0.61, 0.355, 1); /* Animation beaucoup plus rapide et fluide */
}

.portfolio-item:hover h3:after {
    width: 100px;
    height: 3px;
    background: rgba(255, 255, 255, 0.95);
}

.portfolio-item:hover p {
    transform: translateY(0) translateZ(0); /* Return to normal position */
    opacity: 1;
    transition: all 0.7s cubic-bezier(0.215, 0.61, 0.355, 1); /* Animation plus rapide et fluide */
}

.portfolio-item:hover .project-details ul li {
    transform: translateY(0);
    opacity: 1;
}

.portfolio-item:hover .project-details ul li:nth-child(1) { transition-delay: 0.4s; }
.portfolio-item:hover .project-details ul li:nth-child(2) { transition-delay: 0.8s; }
.portfolio-item:hover .project-details ul li:nth-child(3) { transition-delay: 1.2s; }
.portfolio-item:hover .project-details ul li:nth-child(4) { transition-delay: 1.6s; }
.portfolio-item:hover .project-details ul li:nth-child(5) { transition-delay: 2s; }

.view-more {
    text-align: center;
    margin-top: 60px;
    margin-bottom: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.view-more .btn {
    padding: 12px 30px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.view-more .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(69, 39, 160, 0.2);
}

/*--------------------------------------------------
 # Portfolio Card Color Variations
--------------------------------------------------*/
.portfolio-grid .portfolio-item:nth-child(1) .portfolio-overlay {
    background: linear-gradient(135deg, #095894, #0b3b5f);
}

.portfolio-grid .portfolio-item:nth-child(2) .portfolio-overlay {
    background: linear-gradient(135deg, #6441ff, #7b1fa2);
}

.portfolio-grid .portfolio-item:nth-child(3) .portfolio-overlay {
    background: linear-gradient(135deg, #f7d046, #f1c40f); /* Jaune doré moderne */
}

.portfolio-grid .portfolio-item:hover .portfolio-overlay {
    opacity: 0.85 !important;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.3) !important;
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.95), rgba(50, 50, 50, 0.95)) !important;
}

/* Style de survol spécifique à la carte Application de Gestion (1ère carte) */
.portfolio-grid .portfolio-item:nth-child(1):hover .portfolio-overlay {
    background: linear-gradient(135deg, rgba(9, 58, 94, 0.95), rgba(5, 35, 60, 0.95)) !important;
}

/* Style de survol spécifique à la carte Site E-commerce (2ème carte) */
.portfolio-grid .portfolio-item:nth-child(2):hover .portfolio-overlay {
    background: linear-gradient(135deg, rgba(65, 35, 140, 0.95), rgba(95, 25, 120, 0.95)) !important;
}

/* Style de survol spécifique à la carte Bot d'Automatisation (3ème carte) */
.portfolio-grid .portfolio-item:nth-child(3):hover .portfolio-overlay {
    background: linear-gradient(135deg, rgba(210, 190, 30, 0.92), rgba(180, 160, 20, 0.92)) !important;
}