/* PROJECTS SECTION */
.projects-section {
    padding: 4rem 10% 4rem;
    position: relative;
    /* Evitar saltos de layout durante la animación */
    overflow-anchor: none;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
    width: 100%;
    /* Hardware acceleration */
    will-change: transform, opacity, filter;
    /* Transición fluida y natural (Ease Out Expo) */
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    filter: blur(0);
    transform: perspective(1000px) translate3d(0, 0, 0);
    align-items: stretch;
}

.projects-grid.hidden {
    opacity: 0;
    transform: perspective(1000px) translate3d(0, 20px, 0) scale(0.98);
    filter: blur(10px);
    pointer-events: none;
    position: absolute;
    visibility: hidden;
}

.project-card {
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: flex-start;
    cursor: pointer;
    position: relative;
    height: 100%;
    /* Transición para el hover más rápida y reactiva */
    transition: var(--transition-slow);
    will-change: transform, background;
}

.project-card::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: transparent;
    color: #b5666b;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.4);
    padding: 0.8rem 1.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: 'Lato', sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-slow);
    z-index: 10;
    white-space: nowrap;
}

.project-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.project-card:hover h3 {
    color: #fff;
}

.project-card:hover::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.project-card:hover .project-image img {
    transform: scale(1.05);
    opacity: 0.3;
    filter: blur(5px);
}

.project-card h3 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-weight: 700;
    transition: var(--transition-slow);
}

.project-image {
    width: 100%;
    aspect-ratio: 16/9;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    position: relative;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
    opacity: 0.8;
}

.project-card:hover .project-image img {
    transform: scale(1.1);
    opacity: 1;
}

.in-progress-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(139, 34, 82, 0.25); /* Translucent accent */
    color: #b5666b;
    padding: 0.35rem 0.85rem;
    font-size: 0.65rem;
    font-family: 'Lato', sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    border-radius: 4px;
    z-index: 10;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 34, 82, 0.5); /* subtle accent border */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.in-progress-badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #b5666b; /* glowing soft color */
    border-radius: 50%;
    box-shadow: 0 0 8px #b5666b;
    animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); box-shadow: 0 0 2px #ffb7c5; }
    100% { opacity: 1; transform: scale(1); }
}

.project-info {
    margin-bottom: 1rem;
}

.project-card p {
    font-size: 0.95rem;
    color: var(--text-soft);
    line-height: 1.6;
    margin-bottom: 2rem;
    opacity: 0.8;
    white-space: pre-line;
    transition: var(--transition-slow);
}

.card-links {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 1rem;
    width: 100%;
}

.card-link {
    color: rgba(255, 255, 255, 0.65);
    font-family: 'Lato', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: capitalize;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
}

.card-link:hover {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* PROJECT DETAIL VIEW */
.project-detail {
    display: none;
    opacity: 0;
    filter: blur(10px);
    background: transparent;
    padding: 4rem 2rem;
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    will-change: transform, opacity, filter;
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transform: perspective(1000px) translate3d(0, 30px, 0);
}

.project-detail.active {
    display: block;
    opacity: 1;
    filter: blur(0);
    transform: perspective(1000px) translate3d(0, 0, 0);
}

.detail-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 4rem;
    gap: 2rem;
}

.detail-image-container {
    width: 100%;
    aspect-ratio: 21/9;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4rem;
    background: transparent;
    position: relative;
}

.detail-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* DETAIL CAROUSEL */
.detail-image-container .detail-carousel-img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    min-height: 100%;
    object-fit: cover;
    opacity: 0;
    filter: blur(20px);
    transition: none;
}

.detail-image-container .detail-carousel-img:first-child {
    opacity: 1;
    filter: blur(0);
    animation: detailPanFirst 5.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.detail-image-container .detail-carousel-img.active {
    animation: detailPanIn 5.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.detail-image-container .detail-carousel-img.exit {
    animation: detailBlurOut 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes detailPanFirst {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(var(--pan-y, 0px));
    }
}

@keyframes detailPanIn {
    0% {
        opacity: 0;
        filter: blur(20px);
        transform: translateY(0);
    }
    18% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }
    100% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(var(--pan-y, 0px));
    }
}

@keyframes detailBlurOut {
    0% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(var(--pan-y, 0px));
    }
    100% {
        opacity: 0;
        filter: blur(20px);
        transform: translateY(var(--pan-y, 0px));
    }
}

.detail-title-section h2 {
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.4);
}

.detail-title-section h3 {
    font-family: 'Didact Gothic', sans-serif;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0;
}

.detail-tech-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin: 1rem 0 3rem;
    justify-content: center;
}

.detail-tech-icons .stack-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.detail-tech-icons .stack-icon i,
.detail-tech-icons .stack-icon svg {
    font-size: 36px;
    width: 36px;
    height: 36px;
    color: #fff;
    fill: #fff;
    opacity: 0.5;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.detail-tech-icons .stack-icon:hover {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    transform: translateY(-8px) scale(1.1);
}

.detail-tech-icons .stack-icon:hover i,
.detail-tech-icons .stack-icon:hover svg {
    opacity: 1;
    color: #fff;
    fill: #fff;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.4));
}

.back-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: 'Lato', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.4s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.back-btn:hover {
    color: #fff;
    transform: translateX(-5px);
}

.detail-description {
    line-height: 1.8;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 auto 4rem;
    max-width: 800px;
    text-align: justify;
    text-justify: inter-word;
    white-space: pre-line;
}

.detail-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.detail-link {
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    font-family: 'Lato', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.4s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-link i {
    font-size: 1.8rem;
    color: #fff;
    opacity: 0.6;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translate3d(0, 0, 0);
}

.detail-link:hover {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.detail-link:hover i {
    opacity: 1;
    transform: scale(1.2);
}

/* Responsive */
@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .projects-section {
        padding: 4rem 5%;
    }

    .project-card {
        padding: 1.5rem;
    }

    .project-card h3 {
        font-size: 1.3rem;
    }

    .project-detail {
        padding: 2.5rem 1.5rem;
    }

    .detail-header {
        flex-direction: column-reverse;
        gap: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .detail-title-section h2 {
        font-size: 1.8rem;
    }

    .back-btn {
        align-self: flex-start;
    }

    .detail-image-container {
        margin-bottom: 2rem;
        aspect-ratio: 4/3;
    }

    .detail-tech-icons {
        justify-content: center;
        gap: 1rem;
    }

    .detail-tech-icons .stack-icon {
        width: 64px;
        height: 64px;
    }

    .detail-tech-icons .stack-icon i {
        font-size: 28px;
    }
}
