/* ===========================
   SECCIÓN TRABAJOS / PORTAFOLIO
   =========================== */

.trabajos-section {
    background-color: var(--blanco);
    padding: 120px 24px 128px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ---- Header de sección (adaptado) ---- */

.section-badge {
    display: inline-block;
    background: var(--celeste-light);
    color: var(--celeste-dark);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 5px 16px;
    border-radius: 100px;
    margin-bottom: 14px;
    border: 1px solid rgba(0, 151, 196, 0.2);
}

.section-title {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 800;
    color: var(--negro);
    letter-spacing: -1px;
    margin: 0 0 14px;
    line-height: 1.1;
}

.section-description {
    font-size: 16px;
    color: var(--gris-texto);
    margin: 0 auto 0;
    max-width: 680px;
    line-height: 1.65;
    text-align: center;
}

/* ---- Grid de trabajos ---- */

.trabajos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    margin-top: 52px;
}

/* ---- Item de trabajo ---- */

.trabajo-item {
    cursor: pointer;
    border-radius: 14px;
    overflow: hidden;
    background: var(--blanco);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.trabajo-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 32px rgba(0, 0, 0, 0.12);
}

/* ---- Wrapper de imagen ---- */

.trabajo-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%; /* Aspect ratio 4:3 */
    overflow: hidden;
}

.trabajo-img-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.trabajo-item:hover .trabajo-img-wrapper img {
    transform: scale(1.08);
}

/* ---- Overlay (aparece en hover) ---- */

.trabajo-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 151, 196, 0.92) 0%, rgba(242, 99, 34, 0.92) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.35s ease;
    backdrop-filter: blur(2px);
}

.trabajo-item:hover .trabajo-overlay {
    opacity: 1;
}

.overlay-icon {
    font-size: 48px;
    color: var(--blanco);
    margin-bottom: 16px;
    transform: translateY(20px);
    transition: transform 0.35s ease;
    display: inline-block;
}

.trabajo-item:hover .overlay-icon {
    transform: translateY(0);
}

.trabajo-overlay h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--blanco);
    margin: 0 0 12px;
    transform: translateY(20px);
    transition: transform 0.35s ease 0.05s;
    letter-spacing: -0.3px;
}

.trabajo-item:hover .trabajo-overlay h3 {
    transform: translateY(0);
}

.trabajo-overlay p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    transform: translateY(20px);
    transition: transform 0.35s ease 0.1s;
    line-height: 1.5;
    max-width: 180px;
}

.trabajo-item:hover .trabajo-overlay p {
    transform: translateY(0);
}

/* ---- Lightbox Modal (reutilizando estilo de tu patrón) ---- */

.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 27, 42, 0.96);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: pointer;
}

.lightbox-content {
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: lightbox-fadein 0.25s ease;
}

@keyframes lightbox-fadein {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-caption {
    text-align: center;
    color: var(--blanco);
    font-size: 16px;
    font-weight: 500;
    margin-top: 24px;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 40px;
    backdrop-filter: blur(4px);
    max-width: 80%;
}

.close-lightbox {
    position: absolute;
    top: 24px;
    right: 32px;
    color: var(--blanco);
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    z-index: 2001;
    line-height: 1;
}

.close-lightbox:hover {
    color: var(--naranja);
    transform: scale(1.1);
}

/* ---- Responsive ---- */

@media (max-width: 960px) {
    .trabajos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .trabajos-section {
        padding: 72px 20px 80px;
    }

    .section-description {
        max-width: 550px;
    }
}

@media (max-width: 600px) {
    .trabajos-section {
        padding: 56px 16px 64px;
    }

    .trabajos-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 40px;
    }

    .trabajo-overlay h3 {
        font-size: 20px;
    }

    .overlay-icon {
        font-size: 40px;
    }

    .close-lightbox {
        top: 16px;
        right: 20px;
        font-size: 32px;
    }

    .lightbox-caption {
        font-size: 14px;
        margin-top: 16px;
        padding: 8px 20px;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 28px;
    }

    .section-description {
        font-size: 14px;
    }
}

/* ---- Soporte para animación reveal (heredada de tu patrón) ---- */

.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===========================
   SECCIÓN VIDEO SHOWCASE (VERSIÓN VERTICAL)
   =========================== */

.video-showcase {
    background: linear-gradient(135deg, #F8FAFE 0%, #F0F4F8 100%);
    padding: 120px 24px 128px;
    position: relative;
    overflow: hidden;
}

/* Decoración de fondo sutil */
.video-showcase::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 10% 20%, rgba(0, 151, 196, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(242, 99, 34, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

/* ---- Contenedor principal del video ---- */

.video-container {
    max-width: 500px; /* Limitado para videos verticales */
    margin: 48px auto 0;
    border-radius: 24px;
    background: var(--negro);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

/* ---- Wrapper del video (adaptado para vertical) ---- */

.video-wrapper {
    position: relative;
    background: #000;
    cursor: pointer;
    /* En lugar de aspect-ratio fijo, dejamos que el video defina su altura */
    display: flex;
    justify-content: center;
    align-items: center;
}

.video-player {
    width: 100%;
    height: auto;
    max-height: 80vh; /* Altura máxima para que no ocupe toda la pantalla */
    object-fit: contain;
    display: block;
    background: #000;
}

/* Para videos verticales en desktop, centrar y limitar altura */
@media (min-width: 769px) {
    .video-player {
        max-height: 70vh;
    }
}

/* ---- Botón play central (personalizado) ---- */

.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 1;
    padding: 0;
}

.video-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.play-icon {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    transition: filter 0.2s ease;
}

.video-play-btn:hover .play-icon circle {
    fill: var(--naranja);
    opacity: 1;
}

.video-play-btn:hover .play-icon polygon {
    fill: white;
}

/* ---- Overlay de información sobre el video ---- */

.video-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
    padding: 24px 20px 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.video-wrapper:hover .video-info-overlay {
    opacity: 1;
}

.video-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.video-stats span {
    font-size: 12px;
    font-weight: 500;
    color: var(--blanco);
    letter-spacing: 0.3px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    padding: 5px 12px;
    border-radius: 100px;
}

/* ---- Controles de video personalizados ---- */

.video-controls {
    background: rgba(13, 27, 42, 0.95);
    backdrop-filter: blur(8px);
    padding: 12px 20px;
    transition: opacity 0.3s ease;
    opacity: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.video-wrapper:hover .video-controls {
    opacity: 1;
}

/* Barra de progreso */
.video-progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    margin-bottom: 12px;
    position: relative;
    transition: height 0.2s ease;
}

.video-progress-container:hover {
    height: 6px;
}

.video-progress-bar {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 2px;
}

.video-progress-filled {
    width: 0%;
    height: 100%;
    background: var(--naranja);
    border-radius: 2px;
    position: relative;
    transition: width 0.1s linear;
}

.video-progress-filled::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--naranja);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 0 6px rgba(242, 99, 34, 0.5);
}

.video-progress-container:hover .video-progress-filled::after {
    opacity: 1;
}

/* Botones de control */
.video-buttons {
    display: flex;
    align-items: center;
    gap: 20px;
}

.video-control-btn {
    background: transparent;
    border: none;
    color: var(--blanco);
    cursor: pointer;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
}

.video-control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.video-control-btn:active {
    transform: scale(0.98);
}

.video-time {
    font-size: 13px;
    font-family: monospace;
    color: #B8CDE0;
    letter-spacing: 0.5px;
    margin-left: auto;
}

/* ---- Galería de videos (miniaturas) ---- */

.video-gallery {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.video-gallery-item {
    cursor: pointer;
    text-align: center;
    transition: transform 0.25s ease;
    max-width: 140px;
}

.video-gallery-item:hover {
    transform: translateY(-5px);
}

.video-gallery-item.active .video-thumb {
    border-color: var(--naranja);
    box-shadow: 0 0 0 3px rgba(242, 99, 34, 0.3);
}

.video-thumb {
    position: relative;
    width: 120px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Para miniaturas de videos verticales, ajustamos el contenedor */
@media (min-width: 769px) {
    .video-thumb {
        width: 90px;
        height: 160px; /* Proporción vertical 9:16 */
    }
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-thumb-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: rgba(242, 99, 34, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    transition: transform 0.2s ease, background 0.2s ease;
    z-index: 2;
}

.video-gallery-item:hover .video-thumb-icon {
    transform: translate(-50%, -50%) scale(1.1);
    background: var(--naranja);
}

.video-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    transition: background 0.2s ease;
}

.video-gallery-item:hover .video-thumb::after {
    background: rgba(0, 0, 0, 0.2);
}

.video-gallery-item p {
    font-size: 12px;
    font-weight: 600;
    color: var(--gris-texto);
    margin: 0;
    transition: color 0.2s ease;
}

.video-gallery-item.active p,
.video-gallery-item:hover p {
    color: var(--naranja);
}

/* ---- Animación reveal heredada ---- */

.video-showcase.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.video-showcase.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .video-showcase {
        padding: 64px 16px 72px;
    }

    .video-container {
        max-width: 100%;
        margin-top: 32px;
        border-radius: 16px;
    }

    .video-player {
        max-height: 70vh;
        width: auto;
        margin: 0 auto;
    }

    .video-controls {
        padding: 10px 16px;
    }

    .video-buttons {
        gap: 12px;
    }

    .video-control-btn {
        width: 28px;
        height: 28px;
    }

    .video-time {
        font-size: 11px;
    }

    .video-stats {
        gap: 12px;
    }

    .video-stats span {
        font-size: 10px;
        padding: 4px 10px;
    }

    .video-gallery {
        gap: 16px;
        margin-top: 32px;
    }

    .video-thumb {
        width: 80px;
        height: 142px; /* Proporción vertical en móvil */
    }

    .video-gallery-item {
        max-width: 80px;
    }

    .video-gallery-item p {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .video-showcase {
        padding: 48px 16px 56px;
    }

    .video-container {
        max-width: 100%;
        border-radius: 16px;
    }

    .video-player {
        max-height: 65vh;
    }

    .video-gallery {
        gap: 12px;
    }

    .video-thumb {
        width: 70px;
        height: 124px; /* Proporción vertical en móvil pequeño */
    }

    .video-gallery-item {
        max-width: 70px;
    }

    .video-gallery-item p {
        font-size: 9px;
    }

    .video-stats {
        gap: 8px;
    }

    .video-stats span {
        font-size: 9px;
        padding: 3px 8px;
    }

    .play-icon {
        width: 40px;
        height: 40px;
    }

    .video-buttons {
        gap: 8px;
    }

    .video-control-btn {
        width: 24px;
        height: 24px;
    }

    .video-time {
        font-size: 10px;
    }
}

/* Ajustes para pantallas muy pequeñas */
@media (max-width: 380px) {
    .video-thumb {
        width: 60px;
        height: 107px;
    }

    .video-gallery-item {
        max-width: 60px;
    }

    .video-stats span {
        font-size: 8px;
        padding: 2px 6px;
    }
}

/* ---- Soporte para fullscreen nativo ---- */

.video-wrapper:fullscreen {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.video-wrapper:fullscreen .video-player {
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.video-wrapper:fullscreen .video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

/* ---- Animación sutil para el botón play al cargar ---- */

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(242, 99, 34, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(242, 99, 34, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(242, 99, 34, 0);
    }
}

.video-play-btn {
    animation: pulse-ring 2s ease-out infinite;
}

.video-play-btn:hover {
    animation: none;
}
