/* Hero Section */
.hero-section {
    position: relative;
    background: #0a0a0a;
    color: white;
    overflow: hidden;
    padding-bottom: 2rem;
    min-height: 95vh;
    display: flex;
    align-items: center;
}

/* Escena 3D de fondo */
.hero-3d-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

.hero-3d-bg spline-viewer {
    width: 100%;
    height: 100%;
    display: block;
}

/* Todo el contenido del hero deja PASAR el ratón a la escena 3D, así el robot sigue
   el cursor de forma continua (sobre el texto y la foto) sin pegar saltos.
   Solo los enlaces/botones vuelven a capturar el ratón para poder hacer clic. */
.hero-section .container {
    pointer-events: none;
}

.hero-section .container a,
.hero-section .container .btn {
    pointer-events: auto;
}

/* Overlay: oscuro a la izquierda (legibilidad del texto), transparente a la derecha (se ve el 3D) */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(90deg, rgba(10, 10, 10, 0.95) 0%, rgba(10, 10, 10, 0.75) 35%, rgba(10, 10, 10, 0.2) 65%, rgba(10, 10, 10, 0) 100%),
        linear-gradient(0deg, rgba(10, 10, 10, 0.6) 0%, rgba(10, 10, 10, 0) 40%);
    z-index: 1;
    pointer-events: none;
}

/* Partículas animadas de fondo */
.hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float-particle 20s linear infinite;
}

.particle:nth-child(1) { width: 4px; height: 4px; left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { width: 6px; height: 6px; left: 20%; animation-delay: 2s; }
.particle:nth-child(3) { width: 3px; height: 3px; left: 30%; animation-delay: 4s; }
.particle:nth-child(4) { width: 5px; height: 5px; left: 40%; animation-delay: 6s; }
.particle:nth-child(5) { width: 4px; height: 4px; left: 50%; animation-delay: 8s; }
.particle:nth-child(6) { width: 7px; height: 7px; left: 60%; animation-delay: 10s; }
.particle:nth-child(7) { width: 3px; height: 3px; left: 70%; animation-delay: 12s; }
.particle:nth-child(8) { width: 5px; height: 5px; left: 80%; animation-delay: 14s; }
.particle:nth-child(9) { width: 4px; height: 4px; left: 90%; animation-delay: 16s; }

@keyframes float-particle {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

.hero-section .container {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
    animation: slideInFromLeft 1s ease-out;
}

.hero-subtitle {
    font-size: 1.8rem;
    font-weight: 300;
    margin-bottom: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    animation: slideInFromLeft 1s ease-out 0.2s both;
}

.hero-description {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    animation: slideInFromLeft 1s ease-out 0.4s both;
}

.hero-technologies {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 2.5rem;
    animation: slideInFromLeft 1s ease-out 0.6s both;
}

.tech-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    animation: bounceIn 0.6s ease-out;
}

.tech-badge:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.hero-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    animation: slideInFromLeft 1s ease-out 0.8s both;
}

/* Botones con efectos */
.btn-custom-primary {
    background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%);
    border: none;
    padding: 15px 35px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    color: white;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-custom-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-custom-primary:hover::before {
    left: 100%;
}

.btn-custom-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    color: white;
}

.btn-custom-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #ef4444;
    border: 2px solid rgba(255, 255, 255, 0.9);
    padding: 15px 35px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-custom-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.1), transparent);
    transition: left 0.5s;
}

.btn-custom-secondary:hover::before {
    left: 100%;
}

.btn-custom-secondary:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

/* Hero Image con efectos */
.hero-image {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: slideInFromRight 1s ease-out 0.5s both;
    /* La foto no captura el ratón: el robot del fondo sigue mirando el cursor
       aunque pase por encima de la imagen. */
    pointer-events: none;
}

.image-container {
    width: clamp(260px, 25vw, 380px);
    aspect-ratio: 4 / 5; 
    border-radius: 28px;  
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    transition: all 0.4s ease;
    position: relative;
}

.image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(239, 68, 68, 0.1), rgba(185, 28, 28, 0.1));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.image-container:hover::before {
    opacity: 1;
}

.image-container:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 60px rgba(239, 68, 68, 0.3);
    border-color: rgba(185, 28, 28, 0.5);
}

.hero-section .hero-image .image-container img {
    object-fit: cover;
    image-rendering: auto; 
    transform: none;      
    -webkit-transform: none;
    backface-visibility: visible;
    transition: all 0.4s ease;
    position: relative;
    z-index: 0;
}

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

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(5deg);
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 255, 255, 0.5);
    }
}

@keyframes slideInFromLeft {
    0% {
        opacity: 0;
        transform: translateX(-50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    0% {
        opacity: 0;
        transform: translateX(50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Scroll */
.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.scroll-indicator a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.5rem;
    text-decoration: none;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* About Section */
.about-content {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    height: 100%;
}

.about-content .lead {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--secondary-color);
}

.about-image-section {
    display: flex;
    justify-content: center;
    align-items: center;
}

.about-image img {
    transition: var(--transition);
}

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

/* Tech Stack */
.tech-stack {
    margin-top: 2rem;
}

.tech-badges .badge {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
}

.timeline-content {
    padding-left: 1rem;
}

/* Las .card de Bootstrap no traen margen, asi que las tarjetas de experiencia
   se tocaban. Solo entre ellas: el ultimo no arrastra hueco al pie. */
.timeline-content + .timeline-content {
    margin-top: 1.25rem;
}

.experience-tech {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Projects Section */
.project-card {
    transition: all 0.3s ease;
    border: none;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.project-image {
    height: 200px;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.project-placeholder {
    color: white;
    font-size: 3rem;
    text-align: center;
}

.project-tech {
    margin-top: 1rem;
}

.project-tech .badge {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

/* Contact Section */
#contacto {
    background: linear-gradient(135deg, #0d0d0d 0%, #161616 100%) !important;
    color: white;
}

.contact-item {
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: all 0.3s ease;
    overflow: hidden;
}

.contact-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-5px);
}

.contact-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: block;
    width: 100%;
    height: 100%;
    padding: 1.5rem;
}

.contact-link:hover {
    color: white;
    text-decoration: none;
}

.contact-link:hover i {
    color: #f87171 !important;
    transform: translateY(-3px);
    transition: all 0.3s ease;
}

.contact-link:hover h5 {
    color: #f87171;
    transition: all 0.3s ease;
}

.contact-link:hover .contact-text {
    color: #f87171;
    transition: all 0.3s ease;
}

.contact-text {
    margin: 0;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.contact-link h5 {
    margin: 0.5rem 0;
    transition: all 0.3s ease;
}

.contact-link i {
    transition: all 0.3s ease;
}

/* RESPONSIVE DESIGN */

/* Tablet y desktop pequeño */
@media (max-width: 992px) {
    .hero-section {
        min-height: 85vh;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.5rem;
    }

    .image-container {
        width: 280px;
        height: 280px;
    }

    .about-image-section {
        margin-top: 2rem;
        padding: 1rem;
    }

    .tech-badges .badge {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
}

/* MÓVIL */
@media (max-width: 768px) {
    .hero-section {
        padding-top: 1rem; 
        padding-bottom: 4rem;
        min-height: 90vh; 
        justify-content: center;
    }

    .hero-title {
        font-size: 2.2rem;
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .hero-subtitle {
        font-size: 1.4rem;
        text-align: center;
        margin-bottom: 2rem;
    }

    .hero-description {
        text-align: center;
        font-size: 1.1rem;
        margin-bottom: 2.5rem;
    }

    .hero-technologies {
        justify-content: center;
        margin-bottom: 3rem;
    }

    /* Botones */
    .hero-buttons {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 15px !important;
        margin-bottom: 3rem;
        width: 100% !important;
        padding: 0 !important;
    }

    .btn-custom-primary,
    .btn-custom-secondary {
        width: 80% !important;
        max-width: 300px !important;
        min-width: 250px !important;
        padding: 15px 30px !important;
        text-align: center !important;
        font-size: 1rem !important;
        display: block !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }

      .image-container {
        width: 280px;
        height: 280px;
        margin: 1rem auto;
        transform: translateY(8px);
    }

    /* Reorganizar contenido en móvil */
    .hero-section .container {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
    }
    
    .hero-section .row {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    
    .hero-section .col-lg-6.order-1.order-lg-2 {
        order: 1; 
        margin-bottom: 2rem;
        display: flex;
        justify-content: center;
    }
    
      .hero-section .col-lg-6.order-2.order-lg-1 {
        order: 2;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-top: 2.5rem;
    }

    .about-image-section {
        margin-top: 2rem;
        padding: 0.5rem;
    }

    .timeline {
        padding-left: 20px;
    }

    .timeline::before {
        left: 10px;
    }

    .tech-badges .badge {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .scroll-indicator {
        bottom: 25px;
    }
}

/* MÓVILES PEQUEÑOS */
@media (max-width: 576px) {
    .hero-section {
        padding-top: 1rem;
        padding-bottom: 4rem;
        min-height: 90vh;
    }

    .hero-title {
        font-size: 1.9rem;
        margin-bottom: 1.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
    }

    .hero-description {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .hero-technologies {
        margin-bottom: 2.5rem;
    }

    .hero-buttons {
        margin-bottom: 3rem;
        gap: 15px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
    }

    .btn-custom-primary,
    .btn-custom-secondary {
        padding: 12px 25px !important;
        font-size: 0.95rem !important;
        width: 85% !important;
        max-width: 280px !important;
        min-width: 240px !important;
        display: block !important;
        margin: 0 auto !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }

     .image-container {
        width: 240px;
        height: 240px;
        transform: translateY(12px);
    }

    .tech-badge {
        font-size: 0.8rem;
        padding: 5px 12px;
    }

    .about-image-section {
        margin-top: 2rem;
        padding: 0.5rem;
    }

    .about-content {
        padding: 1.5rem;
        margin-top: 2rem;
    }

    .timeline-content {
        padding-left: 0.5rem;
    }
    
    .scroll-indicator {
        bottom: 30px;
    }
}


.project-card {
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
    background: var(--surface-elevated);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.project-image {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
}

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

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

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(239, 68, 68, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

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

.overlay-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.overlay-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    transform: scale(1.1);
}

/* Placeholder mejorado */
.project-placeholder {
    height: 100%;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
}

.project-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="code-pattern" width="20" height="20" patternUnits="userSpaceOnUse"><text x="10" y="15" font-family="monospace" font-size="8" fill="rgba(255,255,255,0.1)" text-anchor="middle">&lt;/&gt;</text></pattern></defs><rect width="100" height="100" fill="url("#code-pattern#code-pattern")"/></svg>');
    opacity: 0.3;
}

.placeholder-icon {
    position: relative;
    z-index: 1;
    margin-bottom: 1rem;
}

.placeholder-icon i {
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
}

.placeholder-content {
    position: relative;
    z-index: 1;
}

.placeholder-content h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.placeholder-tech {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Contenido de la tarjeta */
.project-card .card-body {
    padding: 1.5rem;
}

.project-card .card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.project-card .card-text {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.project-tech {
    margin-bottom: 1.5rem;
}

.project-tech .badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    font-weight: 500;
    border-radius: 12px;
}

.project-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.project-actions .btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.project-actions .btn-primary {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    border: none;
    flex-grow: 1;
}

.project-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
}

.project-actions .btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-muted);
}

.project-actions .btn-outline-secondary:hover {
    background: var(--surface-elevated);
    border-color: var(--accent-color);
    color: var(--text-color);
}

/* Mensaje sin proyectos */
.no-projects-message {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 4rem 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    text-align: center;
    margin: 2rem 0;
}

.no-projects-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    position: relative;
}

.no-projects-icon::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid rgba(239, 68, 68, 0.2);
    border-radius: 50%;
    animation: pulse-ring 2s ease-in-out infinite;
}

.no-projects-icon i {
    color: white;
    font-size: 2.5rem;
}

.no-projects-message h4 {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-weight: 600;
}

.no-projects-message .lead {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* RESPONSIVE para proyectos */
@media (max-width: 768px) {
    .project-image {
        height: 200px;
    }
    
    .project-placeholder {
        padding: 1.5rem 1rem;
    }
    
    .placeholder-icon i {
        font-size: 2.5rem;
    }
    
    .placeholder-content h6 {
        font-size: 1rem;
    }
    
    .placeholder-tech {
        font-size: 0.8rem;
    }
    
    .project-actions {
        flex-direction: column;
    }
    
    .project-actions .btn {
        width: 100%;
    }
    
    .no-projects-message {
        padding: 3rem 2rem;
    }
    
    .no-projects-icon {
        width: 80px;
        height: 80px;
    }
    
    .no-projects-icon i {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .project-image {
        height: 180px;
    }
    
    .project-card .card-body {
        padding: 1.25rem;
    }
    
    .project-card .card-title {
        font-size: 1.1rem;
    }
    
    .project-tech .badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }
    
    .no-projects-message {
        padding: 2rem 1.5rem;
    }
}

/* Hero 3D - ajustes responsive */
/* ============================================================
   MÓVIL: el robot manda arriba.
   El robot ocupa la franja superior y el contenido (foto + texto)
   arranca por debajo, para que se le vea la cabeza entera.

   Tres mandos, independientes entre si:
     --robot-escala   cuanto se encoge la escena (1 = tamano original)
     --robot-subida   cuanto se sube, para comerse el hueco negro que la
                      escena deja por encima del robot
     --robot-espacio  donde empieza la foto de perfil

   Nada de esto aplica en escritorio.
   ============================================================ */
@media (max-width: 991.98px) {
    .hero-section {
        --robot-escala: 0.62;
        --robot-subida: 7vh;
        --robot-espacio: 24vh;

        /* sin esto el contenido se centra vertical y vuelve a taparlo */
        align-items: flex-start;
        justify-content: flex-start;
        padding-top: var(--robot-espacio);
        padding-bottom: 3rem;
        min-height: 100vh;
    }

    .hero-section .container {
        height: auto;
        justify-content: flex-start;
    }

    .hero-3d-bg {
        /* Antes estaba al 55%: se perdia entre el overlay y el fondo negro. */
        opacity: 0.9;
        /* Se encoge desde arriba, no desde el centro: asi al reducirla el
           robot no se va hacia el medio de la pantalla. */
        transform-origin: top center;
        transform: translateY(calc(var(--robot-subida) * -1)) scale(var(--robot-escala));
    }

    /* La franja del robot queda casi limpia y el oscurecido entra justo donde
       empieza el texto, que es lo unico que necesita contraste. */
    .hero-overlay {
        background: linear-gradient(180deg,
            rgba(10, 10, 10, 0.10) 0%,
            rgba(10, 10, 10, 0.25) calc(var(--robot-espacio) * 0.6),
            rgba(10, 10, 10, 0.85) calc(var(--robot-espacio) + 5rem),
            rgba(10, 10, 10, 0.95) 100%);
    }
}

/* ============================================================
   Sección "Mis Proyectos" — efecto PINNED scrollytelling
   Inspirado en modern-hero (21st.dev): el bloque se queda fijo
   (.proyectos-pin = sticky a pantalla completa) mientras el
   contenedor alto (.proyectos-scroll) aporta "recorrido" de
   scroll. Durante ese recorrido (--p de 0 → 1) las tarjetas
   entran grandes y dispersas con parallax desde distintas
   posiciones/profundidades, y al final se ensamblan en la
   rejilla mientras aparecen el título y el botón.

   FALLBACK: sin la clase .reveal-active (JS off / reduce-motion
   / móvil) NO se activa el pin: layout normal y todo visible.
   La variable --p (0 → 1) la actualiza inicio.js.
   ============================================================ */
.proyectos-section {
    --p: 0;
    position: relative;
    padding-top: 0;
    padding-bottom: 0;
}

/* --- ACTIVO (con JS, desktop) ------------------------------- */

/* Contenedor alto: cuanto más alto, más largo dura el efecto.
   El montaje termina ~al 60% del recorrido (ver multiplicadores
   de .reveal-card / .proy-header); el 40% restante es "settle":
   la rejilla se queda fija y cuadrada antes de pasar a Contacto. */
.proyectos-section.reveal-active .proyectos-scroll {
    position: relative;
    height: 230vh;
}

/* Escenario que se queda pegado ocupando la pantalla.
   padding-top reserva el alto del navbar fijo para que el título
   no quede tapado al centrar el contenido. */
.proyectos-section.reveal-active .proyectos-pin {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding-top: var(--navbar-height, 76px);
}

/* Escala el bloque para que SIEMPRE quepa en la altura disponible
   (--fit lo calcula inicio.js). En pantallas altas vale 1 (tamaño
   completo); en pantallas bajas reduce en lugar de recortar. */
.proyectos-section.reveal-active .proyectos-pin .container {
    transform: scale(var(--fit, 1));
    transform-origin: center center;
}

/* Compactación LIGERA en pinned: tamaño casi como el original, solo
   se le quita un pelín. El botón se ancla al fondo del escenario
   (fuera del bloque centrado) para liberar alto y dejar tarjetas grandes. */
.proyectos-section.reveal-active .proyectos-pin .proy-header {
    margin-bottom: 1rem;
}
.proyectos-section.reveal-active .proyectos-pin .project-image {
    height: 200px;               /* original 220, solo un poco menos */
}
.proyectos-section.reveal-active .proyectos-pin .card-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;       /* descripción a 3 líneas */
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.proyectos-section.reveal-active .proyectos-pin .reveal-card.mb-4 {
    margin-bottom: 0 !important;
}

/* Botón "Ver todos" anclado al fondo del escenario: no ocupa alto
   del bloque, así las tarjetas pueden ir a tamaño casi completo. */
.proyectos-section.reveal-active .proyectos-pin > .proy-outro {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1.5rem;
    margin: 0;
    z-index: 2;
}

/* Resplandor rojo de fondo, ESTÁTICO (no se anima por frame → 0 coste
   de repintado durante el scroll, ni capa GPU permanente). */
.proyectos-section.reveal-active .proy-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 60% at 50% 50%,
        rgba(239, 68, 68, 0.16) 0%,
        rgba(239, 68, 68, 0) 70%);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.proyectos-section.reveal-active .proyectos-pin .container {
    position: relative;
    z-index: 1;
}

/* Título, botón y tarjetas: la coreografía (opacidad, posición, vuelo y
   ensamblado) la calcula y aplica INLINE inicio.js, por rendimiento.
   Sin will-change permanente: el navegador promueve la capa solo durante
   el transform y la libera al acabar (no satura el compositor en reposo).
   Aquí solo dejamos el z-index del collage. */
.proyectos-section.reveal-active .reveal-card:nth-child(1) { z-index: 1; }
.proyectos-section.reveal-active .reveal-card:nth-child(2) { z-index: 3; }
.proyectos-section.reveal-active .reveal-card:nth-child(3) { z-index: 2; }

/* --- Móvil: desactiva el pin (layout normal, sin huecos) -----
   display:block es CLAVE: si el pin sigue siendo flex, el .container
   (flex-item con min-width:auto) no encoge bajo su contenido y empuja
   la página más ancha que la pantalla (scroll horizontal). */
@media (max-width: 768px) {
    .proyectos-section.reveal-active .proyectos-scroll { height: auto; }
    .proyectos-section.reveal-active .proyectos-pin {
        position: static;
        display: block;
        height: auto;
        overflow: visible;
        padding: 4rem 0;
    }
    .proyectos-section.reveal-active .reveal-card,
    .proyectos-section.reveal-active .proy-header,
    .proyectos-section.reveal-active .proy-outro,
    .proyectos-section.reveal-active .proyectos-pin .container {
        transform: none;
        opacity: 1;
    }
    /* El botón vuelve al flujo normal (en desktop va anclado abajo) */
    .proyectos-section.reveal-active .proyectos-pin > .proy-outro {
        position: static;
        margin-top: 2rem;
    }
    /* Restaura la separación entre tarjetas (la compactación del pinned la
       quitaba; en móvil van apiladas y necesitan su margen). */
    .proyectos-section.reveal-active .proyectos-pin .reveal-card.mb-4 {
        margin-bottom: 1.5rem !important;
    }
}

/* --- Reduce-motion: sin animación, todo visible -------------- */
@media (prefers-reduced-motion: reduce) {
    .proyectos-section.reveal-active .proyectos-scroll { height: auto; }
    .proyectos-section.reveal-active .proyectos-pin {
        position: static;
        display: block;
        height: auto;
        overflow: visible;
        padding: 4rem 0;
    }
    .proyectos-section.reveal-active .reveal-card,
    .proyectos-section.reveal-active .proy-header,
    .proyectos-section.reveal-active .proy-outro,
    .proyectos-section.reveal-active .proyectos-pin .container {
        transform: none;
        opacity: 1;
    }
    .proyectos-section.reveal-active .proyectos-pin > .proy-outro {
        position: static;
        margin-top: 2rem;
    }
}
