/*
 * WebePc Animals Profile — Lightbox CSS
 * Zero colori hardcoded — usa Canvas/CanvasText per light/dark.
 * WCAG AAA: contrasto, focus-visible, reduced-motion.
 */

#wap-lb {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
}

/* Immagine */
.wap-lb-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    max-width: calc(100vw - 120px);
    max-height: 100vh;
}

.wap-lb-img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 5rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 2px;
}

@media (prefers-reduced-motion: no-preference) {
    .wap-lb-img { transition: opacity .2s ease; }
    .wap-lb--loading .wap-lb-img { opacity: 0; }
}

.wap-lb-caption {
    color: rgba(255, 255, 255, .75);
    font-size: .85em;
    text-align: center;
    margin: 0;
    min-height: 1.2em;
}

/* Bottoni freccia */
.wap-lb-prev,
.wap-lb-next {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .5);
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, border-color .15s ease;
    /* touch target minimo 44px WCAG 2.5.8 */
    min-width: 44px;
    min-height: 44px;
}

.wap-lb-prev:hover,
.wap-lb-next:hover {
    background: rgba(255, 255, 255, .25);
    border-color: rgba(255, 255, 255, .9);
}

.wap-lb-prev:focus-visible,
.wap-lb-next:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.wap-lb-prev:disabled,
.wap-lb-next:disabled {
    opacity: .25;
    cursor: not-allowed;
}

/* Bottone chiudi */
.wap-lb-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .5);
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
    /* touch target WCAG */
    min-width: 44px;
    min-height: 44px;
}

.wap-lb-close:hover {
    background: rgba(255, 255, 255, .25);
    border-color: rgba(255, 255, 255, .9);
}

.wap-lb-close:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

/* Loading spinner */
.wap-lb--loading .wap-lb-content::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
    .wap-lb--loading .wap-lb-content::after {
        animation: wap-spin .7s linear infinite;
    }
}

@keyframes wap-spin {
    to { transform: rotate(360deg); }
}

/* Mobile — frecce sotto l'immagine */
@media (max-width: 600px) {
    #wap-lb {
        flex-direction: column;
        gap: .75rem;
    }
    .wap-lb-content {
        max-width: 100%;
        order: 1;
    }
    .wap-lb-prev,
    .wap-lb-next {
        order: 2;
    }
    .wap-lb-prev { order: 2; }
    .wap-lb-next { order: 3; }
}
