/* ==============================================
   ESTILOS ESPECÍFICOS PARA PORTAFOLIO
   ============================================== */

/* Hero del Portafolio */
.portfolio-hero {
    padding: 8rem 0 4rem;
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.portfolio-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../imgs/hero-pattern.svg') repeat;
    opacity: 0.05;
    z-index: 0;
}

.portfolio-hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.portfolio-hero .hero-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #F59E0B;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.portfolio-hero h1 {
    color: #F8FAFC;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: 700;
    line-height: 1.2;
}

.portfolio-hero .hero-subtitle {
    font-size: 1.125rem;
    color: #F8FAFC;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
    font-weight: 500;
    max-width: 600px;
    margin: 0 auto;
}

/* Sección de Filtros */
.portfolio-filters {
    padding: 4rem 0;
    background-color: #0F172A;
    text-align: center;
}

.portfolio-filters h2 {
    color: #F8FAFC;
    margin-bottom: 1rem;
    font-size: 2rem;
    font-weight: 700;
}

.portfolio-filters .section-subtitle {
    color: #F59E0B;
    font-size: 1.125rem;
    margin-bottom: 3rem;
    font-weight: 500;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.filter-btn {
    background-color: transparent;
    color: #2563EB;
    border: 2px solid #2563EB;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 120px;
}

.filter-btn:hover {
    background-color: #2563EB;
    color: #F8FAFC;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3);
}

.filter-btn.is-active {
    background-color: #2563EB;
    color: #F8FAFC;
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.4);
}

.filter-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5);
}

/* Descripciones de Categorías */
.categories-description {
    padding: 3rem 0;
    background-color: #1E293B;
}

.category-info {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    display: none;
    animation: fadeInUp 0.5s ease-out;
}

.category-info.active {
    display: block;
}

.category-info h3 {
    color: #F59E0B;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.category-info p {
    color: #F8FAFC;
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.9;
}

/* Grid del Portafolio */
.portfolio-grid-section {
    padding: 4rem 0;
    background-color: #0F172A;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.grid-item {
    opacity: 1;
    transform: scale(1);
    transition: all 0.4s ease;
}

.grid-item.filtered-out {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    position: absolute;
    visibility: hidden;
}

.portfolio-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background-color: #1E293B;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.4);
    transition: all 0.3s ease;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.portfolio-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(37, 99, 235, 0.3);
    border-color: #2563EB;
}

.portfolio-item img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(15, 23, 42, 0.8) 60%, rgba(15, 23, 42, 0.95) 100%);
    color: #F8FAFC;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    transition: all 0.3s ease;
}

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

.portfolio-overlay h4 {
    color: #F59E0B;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.portfolio-overlay p {
    color: #F8FAFC;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
    line-height: 1.4;
}

.portfolio-btn {
    background-color: #2563EB;
    color: #F8FAFC;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    align-self: flex-start;
    transition: background-color 0.3s ease;
}

.portfolio-btn:hover {
    background-color: #1D4ED8;
}

/* Modal Lightbox */
.portfolio-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(5px);
}

.portfolio-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.9);
    cursor: pointer;
}

.modal-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    margin: auto;
    z-index: 2001;
}

.modal-close {
    position: absolute;
    top: -45px;
    right: 0;
    color: #F8FAFC;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2002;
    background-color: rgba(37, 99, 235, 0.8);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background-color: #2563EB;
    transform: scale(1.1);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(37, 99, 235, 0.8);
    color: #F8FAFC;
    border: none;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2002;
}

.modal-nav:hover {
    background-color: #2563EB;
    transform: translateY(-50%) scale(1.1);
}

.modal-prev {
    left: -60px;
}

.modal-next {
    right: -60px;
}

.modal-content {
    position: relative;
    background-color: #1E293B;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-content img {
    width: 100%;
    max-width: 800px;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
    display: block;
}

.modal-caption {
    padding: 2rem;
    text-align: center;
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
}

.modal-caption h3 {
    color: #F59E0B;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.modal-caption p {
    color: #F8FAFC;
    font-size: 1rem;
    margin-bottom: 1rem;
    opacity: 0.9;
    line-height: 1.6;
}

.modal-category {
    display: inline-block;
    background-color: #2563EB;
    color: #F8FAFC;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Sección de Contacto del Portafolio */
.portfolio-contact {
    padding: 4rem 0;
    background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
    text-align: center;
}

.portfolio-contact h2 {
    color: #F8FAFC;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.portfolio-contact .section-subtitle {
    color: #F8FAFC;
    font-size: 1.125rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.contact-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    margin-top: 2rem;
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.grid-item {
    animation: fadeInUp 0.6s ease-out forwards;
}

.grid-item:nth-child(even) {
    animation-delay: 0.1s;
}

.grid-item:nth-child(odd) {
    animation-delay: 0.2s;
}

/* Estados de carga lazy loading */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Responsive Design - Tablet */
@media (min-width: 768px) {
    .portfolio-hero .hero-brand {
        font-size: 2rem;
    }

    .portfolio-hero h1 {
        font-size: 3rem;
    }

    .portfolio-hero .hero-subtitle {
        font-size: 1.25rem;
    }

    .filter-buttons {
        gap: 1.5rem;
    }

    .filter-btn {
        font-size: 1rem;
        padding: 1rem 2rem;
        min-width: 150px;
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }

    .portfolio-item img {
        height: 320px;
    }

    .contact-actions {
        flex-direction: row;
        justify-content: center;
    }

    .modal-prev {
        left: -80px;
    }

    .modal-next {
        right: -80px;
    }

    .modal-content img {
        max-height: 70vh;
    }
}

/* Responsive Design - Desktop */
@media (min-width: 1024px) {
    .portfolio-hero {
        padding: 10rem 0 5rem;
    }

    .portfolio-hero .hero-brand {
        font-size: 2.5rem;
    }

    .portfolio-hero h1 {
        font-size: 3.5rem;
    }

    .portfolio-filters h2 {
        font-size: 2.5rem;
    }

    .category-info h3 {
        font-size: 1.75rem;
    }

    .category-info p {
        font-size: 1.125rem;
    }

    .portfolio-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3rem;
    }

    .portfolio-item img {
        height: 350px;
    }

    .portfolio-overlay {
        padding: 2rem;
    }

    .portfolio-overlay h4 {
        font-size: 1.5rem;
    }

    .portfolio-overlay p {
        font-size: 1rem;
    }

    .modal-prev {
        left: -100px;
    }

    .modal-next {
        right: -100px;
    }

    .modal-content img {
        max-height: 75vh;
    }
}

@media (min-width: 1200px) {
    .portfolio-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .portfolio-item img {
        height: 300px;
    }
}

/* Estados para navegación por teclado */
.filter-btn:focus-visible,
.portfolio-item:focus-visible,
.modal-close:focus-visible,
.modal-nav:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Smooth scroll para dispositivos que lo soporten */
@media (prefers-reduced-motion: no-preference) {
    .portfolio-grid {
        scroll-behavior: smooth;
    }
    
    .grid-item {
        transition: all 0.4s ease;
    }
}

/* Reducir animaciones para usuarios que lo prefieren */
@media (prefers-reduced-motion: reduce) {
    .grid-item {
        animation: none;
    }
    
    .portfolio-item,
    .portfolio-overlay,
    .filter-btn {
        transition: none;
    }
}

/* Mejoras de accesibilidad */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Estado de focus para elementos interactivos */
.portfolio-item:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Indicador de categoría activa */
.category-info {
    border-left: 4px solid transparent;
    padding-left: 2rem;
    transition: border-color 0.3s ease;
}

.category-info.active {
    border-left-color: #F59E0B;
}

/* Mejora visual para botones en hover */
.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 0%, rgba(37, 99, 235, 0.1) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
    z-index: -1;
}

.filter-btn {
    position: relative;
    overflow: hidden;
}

.filter-btn:hover::before {
    opacity: 1;
}

/* Estilos adicionales para mejor UX */
.portfolio-grid-section {
    min-height: 60vh;
}

.grid-item.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background-color: #1E293B;
    border-radius: 12px;
    border: 2px dashed rgba(37, 99, 235, 0.3);
}

.no-results-message {
    color: #F59E0B;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.no-results-subtitle {
    color: #F8FAFC;
    opacity: 0.7;
}