/* ============================================== */
/* SECCIÓN DE PROYECTOS - INTERFAZ GRÁFICA         */
/* ============================================== */

.projects-section {
    margin-top: 60px;
    padding: 3rem 0 4rem 0;
    border-top: 1px solid #30363d;
    position: relative;
    overflow: hidden;
}

/* Fondo de nebulosa */
.projects-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(88, 166, 255, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(177, 91, 255, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(137, 87, 229, 0.02) 0%, transparent 70%);
    pointer-events: none;
}

/* Estrellas de fondo */
.projects-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(2px 2px at 5% 10%, #58a6ff, transparent),
        radial-gradient(1px 1px at 15% 45%, #b15bff, transparent),
        radial-gradient(2px 2px at 30% 80%, #8957e5, transparent),
        radial-gradient(1px 1px at 45% 20%, #3b82f6, transparent),
        radial-gradient(2px 2px at 60% 60%, #8b5cf6, transparent),
        radial-gradient(1px 1px at 75% 35%, #58a6ff, transparent),
        radial-gradient(2px 2px at 90% 75%, #b15bff, transparent);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    opacity: 0.15;
    pointer-events: none;
}

/* Cabecera de proyectos */
.projects-header {
    text-align: center;
    margin-bottom: 45px;
    position: relative;
    z-index: 2;
}

.projects-title {
    font-size: 2.2rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: linear-gradient(135deg, #e6edf3 0%, #58a6ff 40%, #b15bff 70%, #e6edf3 100%);
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: title-shimmer 6s ease infinite;
}

@keyframes title-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.title-icon {
    font-size: 2rem;
    animation: icon-float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 15px rgba(88, 166, 255, 0.5));
}

.title-icon:first-child {
    animation-delay: 0s;
}

.title-icon:last-child {
    animation-delay: 1.5s;
}

@keyframes icon-float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.projects-description {
    max-width: 750px;
    margin: 0 auto;
    color: #b0c4de;
    font-size: 1.05rem;
    line-height: 1.7;
    padding: 0 20px;
}

/* ============================================== */
/* GRID DE PROYECTOS                              */
/* ============================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    padding: 25px 15px;
    position: relative;
    z-index: 2;
}

/* ============================================== */
/* TARJETA DE PROYECTO                            */
/* ============================================== */
.project-card {
    background: linear-gradient(145deg, 
        rgba(22, 27, 34, 0.95), 
        rgba(13, 17, 23, 0.98)
    );
    border: 1px solid rgba(88, 166, 255, 0.15);
    border-radius: 20px;
    overflow: hidden;
    
    display: flex;
    flex-direction: column;
    
    backdrop-filter: blur(10px);
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 0 0 1px rgba(88, 166, 255, 0.05);
    
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: card-orbital 5s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
    
    position: relative;
    will-change: transform, box-shadow, border-color;
}

/* Delays escalonados */
.project-card:nth-child(1) { --delay: 0s; }
.project-card:nth-child(2) { --delay: 0.4s; }
.project-card:nth-child(3) { --delay: 0.8s; }
.project-card:nth-child(4) { --delay: 1.2s; }
.project-card:nth-child(5) { --delay: 1.6s; }
.project-card:nth-child(6) { --delay: 2s; }

@keyframes card-orbital {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.project-card:hover {
    transform: translateY(-15px) scale(1.02);
    border-color: #58a6ff;
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.8),
        0 0 50px rgba(88, 166, 255, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 0 0 1px #58a6ff;
    animation-play-state: paused;
}

/* Brillo interno en hover */
.card-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        circle at 50% 0%,
        rgba(88, 166, 255, 0.1),
        transparent 60%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    border-radius: 20px;
    z-index: 1;
}

.project-card:hover .card-glow {
    opacity: 1;
}

/* ============================================== */
/* IMAGEN DEL PROYECTO                            */
/* ============================================== */
.card-image-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.project-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

/* Overlay en hover */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        rgba(13, 17, 23, 0.4) 0%, 
        rgba(13, 17, 23, 0.85) 100%
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover .image-overlay {
    opacity: 1;
}

.overlay-icon {
    font-size: 3rem;
    transform: translateY(15px);
    transition: transform 0.3s ease 0.05s;
    filter: drop-shadow(0 0 20px rgba(88, 166, 255, 0.6));
}

.overlay-text {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    transform: translateY(15px);
    transition: transform 0.3s ease 0.1s;
}

.project-card:hover .overlay-icon,
.project-card:hover .overlay-text {
    transform: translateY(0);
}

/* Badge */
.project-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #58a6ff, #8957e5);
    color: #fff;
    padding: 5px 14px;
    border-radius: 25px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    z-index: 3;
}

/* ============================================== */
/* CONTENIDO                                      */
/* ============================================== */
.card-content {
    padding: 20px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
    position: relative;
    z-index: 2;
    background: linear-gradient(180deg, 
        rgba(22, 27, 34, 0.5) 0%, 
        rgba(13, 17, 23, 0.9) 100%
    );
}

.project-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #e6edf3;
    margin: 0;
    line-height: 1.4;
    transition: all 0.3s ease;
}

.project-card:hover .project-name {
    background: linear-gradient(135deg, #58a6ff, #b15bff);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.project-description {
    font-size: 0.88rem;
    color: #b0c4de;
    margin: 0;
    line-height: 1.6;
    flex-grow: 1;
}

/* Tags */
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 5px 0;
}

.tag {
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.2);
    color: #7ab8ff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.project-card:hover .tag {
    background: rgba(88, 166, 255, 0.15);
    border-color: rgba(88, 166, 255, 0.4);
    color: #a0cfff;
}

/* ============================================== */
/* BOTÓN                                          */
/* ============================================== */
.card-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 22px;
    background: transparent;
    border: 1.5px solid #58a6ff;
    border-radius: 30px;
    color: #58a6ff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
    align-self: flex-start;
}

.card-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(88, 166, 255, 0.2), 
        transparent
    );
    transition: left 0.5s ease;
    z-index: -1;
}

.card-button:hover {
    background: linear-gradient(135deg, #58a6ff, #8957e5);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 25px rgba(88, 166, 255, 0.35);
    transform: translateY(-3px);
}

.card-button:hover::before {
    left: 100%;
}

.button-icon {
    font-size: 1.1rem;
}

.button-arrow {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.card-button:hover .button-arrow {
    transform: translateX(5px);
}

/* ============================================== */
/* FOOTER CON INDICADOR DE PROGRESO               */
/* ============================================== */
.projects-footer {
    text-align: center;
    margin-top: 40px;
    position: relative;
    z-index: 2;
}

.progress-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 15px;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #30363d;
    border: 1px solid #58a6ff;
    transition: all 0.3s ease;
}

.progress-dot.completed {
    background: #58a6ff;
    box-shadow: 0 0 15px rgba(88, 166, 255, 0.6);
    animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
}

.footer-note {
    color: #8b949e;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* ============================================== */
/* RESPONSIVE                                    */
/* ============================================== */

@media (max-width: 900px) {
    .projects-title {
        font-size: 1.8rem;
        gap: 12px;
    }
    
    .title-icon {
        font-size: 1.6rem;
    }
}

@media (max-width: 700px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 600px) {
    .projects-section {
        margin-top: 40px;
        padding: 2rem 0 3rem 0;
    }
    
    .projects-title {
        font-size: 1.5rem;
        flex-wrap: wrap;
    }
    
    .title-icon {
        font-size: 1.4rem;
    }
    
    .projects-description {
        font-size: 0.95rem;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
        max-width: 380px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .card-image-wrapper {
        height: 180px;
    }
    
    .project-name {
        font-size: 1.1rem;
    }
    
    .progress-indicator {
        gap: 8px;
    }
    
    .progress-dot {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 400px) {
    .projects-title {
        font-size: 1.3rem;
    }
    
    .title-icon {
        font-size: 1.2rem;
    }
}

/* ============================================== */
/* ACCESIBILIDAD                                 */
/* ============================================== */
@media (prefers-reduced-motion: reduce) {
    .project-card,
    .projects-title,
    .title-icon,
    .progress-dot {
        animation: none;
    }
    
    .project-card:hover {
        transform: translateY(-5px);
    }
    
    .project-card:hover img {
        transform: scale(1.03);
    }
}