/* ================================================
   PORTFOLIO LIST STYLES - CON SOPORTE PARA VIDEOS
================================================ */

/* Portfolio List Styles */
.portfolio-container {
    width: 100%;
    min-height: calc(100vh - 10rem);
    height: auto;
    margin-top: 10rem;
    padding: 10px;
    font-family: var(--font-primary);
    letter-spacing: var(--letter-spacing-base);
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Lista de proyectos */
.portfolio-list {
    height: auto;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.portfolio-list::-webkit-scrollbar {
    display: none;
}

/* Fila principal del proyecto */
.project-row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 10px;
    cursor: pointer;
    align-items: center;
}

.project-title {
    grid-column: 1 / 4;
    font-size: var(--font-size-base);
    font-weight: normal;
    line-height: var(--line-height-base);
}

.project-category {
    grid-column: 4 / 6;
    font-size: var(--font-size-base);
    color: var(--color-text);
    line-height: var(--line-height-base);
}

.project-type {
    grid-column: 6 / 8;
    font-size: var(--font-size-base);
    color: var(--color-text);
    line-height: var(--line-height-base);
}

.project-year {
    grid-column: 8 / 13;
    font-size: var(--font-size-base);
    color: var(--color-text);
    line-height: var(--line-height-base);
    text-align: left;
}

/* Galería expandible */
.project-gallery {
    grid-column: 1 / 13;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
}

.portfolio-item.expanded .project-gallery {
    padding: 5px 0;
}

/* ================================================
   SCROLL HORIZONTAL OPTIMIZADO
================================================ */

.gallery-scroll {
    display: flex;
    gap: 30px;
    padding: 60px 0 65px 0;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    scroll-behavior: auto;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
}

.project-gallery:has(.additional-info) .gallery-scroll {
    padding: 60px 0 5px 0;
}

.gallery-with-additional-info .gallery-scroll {
    padding: 60px 0 5px 0;
}

.gallery-scroll::-webkit-scrollbar {
    display: none;
}

.gallery-scroll:hover {
    cursor: default;
}

/* ================================================
   ESTILOS PARA ITEMS DE GALERÍA
================================================ */

.gallery-scroll .gallery-item {
    flex-shrink: 0;
    height: 300px;
    width: auto;
    position: relative;
}

/* IMÁGENES CON LAZY LOADING SUAVE */
.gallery-item.gallery-image {
    background-color:transparent;
}

.gallery-item.gallery-image img {
    height: 100%;
    width: auto;
    object-fit: cover;
    -webkit-user-drag: none;
    user-select: none;
}

/* Transición suave para imágenes */
.lazy-image {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* VIDEOS */
.gallery-item.gallery-video {
    position: relative;
    background: #000;
    overflow: hidden;
}

.gallery-item.gallery-video video {
    height: 100%;
    width: auto;
    object-fit: cover;
    display: block;
    max-width: none;
}

/* Transición suave para videos */
.portfolio-video {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.portfolio-video.video-loaded {
    opacity: 1;
}

/* Estado de carga para videos */
.gallery-video video[poster] {
    background-size: cover;
    background-position: center;
}

/* ================================================
   ADDITIONAL INFO STYLES
================================================ */
.additional-info {
    padding: 5px 0 60px 0;
    text-align: left;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 30px;
}

.additional-info-label {
    font-size: var(--font-size-base);
    font-weight: normal;
    color: var(--color-text);
    line-height: var(--line-height-base);
    letter-spacing: var(--letter-spacing-base);
    cursor: pointer;
    flex-shrink: 0;
}

.additional-info-details {
    display: flex;
    flex-direction: row;
    gap: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    flex-grow: 1;
}

.additional-info-label:hover + .additional-info-details,
.additional-info-details:hover {
    opacity: 1;
    visibility: visible;
}

.info-field {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.info-label {
    font-size: var(--font-size-base);
    font-weight: normal;
    color: var(--color-text);
    line-height: var(--line-height-base);
    letter-spacing: var(--letter-spacing-base);
    flex-shrink: 0;
}

.info-value {
    font-size: var(--font-size-base);
    font-weight: normal;
    color: var(--color-text);
    line-height: var(--line-height-base);
    letter-spacing: var(--letter-spacing-base);
}

/* Indicador visual cuando es scrollable */
.gallery-scroll.scrollable {
    position: relative;
}

.gallery-scroll.scrollable::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.gallery-scroll.scrollable:hover::after {
    opacity: 0.5;
}

.no-images,
.no-projects {
    padding: 40px;
    text-align: center;
    font-size: var(--font-size-base);
}

/* Efecto dimmed */
.project-row.dimmed,
.project-row.dimmed .project-title,
.project-row.dimmed .project-client,
.project-row.dimmed .project-category,
.project-row.dimmed .project-type,
.project-row.dimmed .project-year {
    color: #999;
    transition: color 0.3s ease;
}

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

@media (max-width: 1024px) {
    .portfolio-container {
        margin-top: 8rem;
        min-height: calc(100vh - 8rem);
    }
    
    .portfolio-list.needs-scroll {
        height: calc(100vh - 8rem - 20px);
    }
}

@media (max-width: 768px) {
    .portfolio-container {
        margin-top: 8rem;
        min-height: auto;
    }
    
    .portfolio-list {
        height: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
    }
    
    .portfolio-list.needs-scroll {
        overflow-y: visible !important;
        max-height: none !important;
        height: auto !important;
    }
    
    .project-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        text-align: left;
        align-items: start;
    }
    
    .project-title {
        grid-column: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    .project-client {
        display: none;
    }
    
    .project-category {
        grid-column: 2;
        text-align: right;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    .project-type {
        display: none;
    }
    
    .project-year {
        display: none;
    }
    
    .gallery-scroll {
        overflow-x: auto;
        overflow-y: hidden;
        padding: 60px 0 !important;
        touch-action: pan-x;
        overscroll-behavior-y: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .gallery-scroll::-webkit-scrollbar {
        display: none;
    }
    
    .gallery-item {
        height: 200px;
    }
    
    .additional-info {
        display: none !important;
    }
}

/* ================================================
   OPTIMIZACIONES DE RENDIMIENTO
================================================ */

.gallery-video video:not(.playing) {
    filter: brightness(0.95);
}

.gallery-video video {
    transition: filter 0.3s ease;
}

.gallery-video.playing video {
    filter: brightness(1);
}

.gallery-video video[preload="none"] {
    background: #f0f0f0;
}

.gallery-video {
    width: auto;
}

.gallery-video video:invalid,
.gallery-video video[src=""]:not([poster]) {
    background: #f5f5f5;
    border: 2px dashed #ccc;
}

.gallery-video:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .video-overlay,
    .gallery-video video,
    .lazy-image {
        transition: none;
    }
    
    .video-overlay .play-button {
        transition: none;
    }
}