/* Visor de fotos a pantalla completa (components/lightbox.js). Sobre el blanco del sitio apenas transparente
   (se intuye la pagina de atras), foto entera (contain),
   flechas y cruz del mismo trazo que el resto del sitio, contador "1 | 5" abajo. Mobile-first. */

[data-lightbox] img {
    cursor: zoom-in;
}

.tra-lightbox {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgb(250 250 250 / var(--tra-lightbox-opacity, .92));   /* --tra-white con un poquito de transparencia */
    color: var(--tra-black);
}

.tra-lightbox:focus {
    outline: none;
}

.tra-lightbox::backdrop {
    background: transparent;
}

.tra-lightbox[open] {
    animation: tra-lightbox-in .2s ease;
}

.tra-lightbox-open {
    overflow: hidden;
}

.tra-lightbox__figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 100%;
    margin: 0;
    padding: 64px var(--tra-space) 64px;
    box-sizing: border-box;
}

.tra-lightbox__image {
    display: block;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.tra-lightbox__caption {
    max-width: 60ch;
    margin: 0;
    font-size: 1rem;
    text-align: center;
}

.tra-lightbox__counter {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    margin: 0;
    font-size: 1rem;
}

.tra-lightbox__close,
.tra-lightbox__arrow {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    opacity: .7;
    transition: opacity .2s ease;
}

.tra-lightbox__close:hover,
.tra-lightbox__arrow:hover,
.tra-lightbox__close:focus-visible,
.tra-lightbox__arrow:focus-visible {
    opacity: 1;
}

.tra-lightbox__close:focus-visible,
.tra-lightbox__arrow:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.tra-lightbox__close {
    top: 12px;
    right: 12px;
}

/* En celular las flechas van abajo, a los costados del contador (el swipe tambien cambia de foto) */
.tra-lightbox__arrow {
    bottom: 6px;
}

.tra-lightbox__arrow--prev {
    left: calc(50% - 96px);
}

.tra-lightbox__arrow--prev svg {
    transform: rotate(180deg);
}

.tra-lightbox__arrow--next {
    right: calc(50% - 96px);
}

.tra-lightbox--single .tra-lightbox__arrow {
    display: none;
}

@media (min-width: 768px) {
    .tra-lightbox__figure {
        padding: 64px 88px;
    }

    .tra-lightbox__arrow {
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
    }

    .tra-lightbox__arrow--prev {
        left: var(--tra-space);
    }

    .tra-lightbox__arrow--next {
        right: var(--tra-space);
    }
}

@keyframes tra-lightbox-in {
    from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .tra-lightbox[open] {
        animation: none;
    }
}
