body {
    height: 100dvh;
}

.layout {
    min-height: calc(100dvh - var(--header-h) - var(--footer-h));
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 2rem 1rem;
    margin-left: calc(-1 * var(--sidebar-collapsed));
    transition: margin-left var(--transition);
    position: relative;
}

body:not(.sidebar-closed) main {
    margin-left: calc(-1 * var(--sidebar-w));
}

.main-artwork {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 3 / 4;
    border-radius: 2px;
    overflow: hidden;
    cursor: zoom-in;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-artwork:hover {
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.13);
}

.main-artwork img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.5s ease, opacity 0.3s ease;
}

/* Ocultar ícono roto mientras carga */
.img-loading {
    opacity: 0;
    color: transparent;
}
.img-error {
    opacity: 1;
    color: inherit;
}

.main-artwork:hover img {
    transform: scale(1.01);
}

.thumbnail-section {
    width: 100%;
    max-width: 540px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.thumb-scroll {
    flex: 1;
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
    padding: 8px 4px;
    overflow-y: visible;
}

.thumb-scroll::-webkit-scrollbar {
    display: none;
}

.thumb {
    width: 68px;
    height: 86px;
    flex-shrink: 0;
    background: var(--grey-light);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.thumb:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.thumb.active {
    border-color: #136f3f;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-arrow {
    width: 30px;
    height: 30px;
    background: var(--grey-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.95rem;
    color: #888;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.thumb-arrow:hover {
    background: var(--green);
    color: var(--text);
}

.thumb-arrow img {
    width: 23px;
    height: 23px;
}

.black-box {
    position: absolute;
    bottom: 1rem;
    right: 2rem;
    width: 320px;
    height: 320px;
    overflow: hidden;
    background: #b3c3ba;
    border-radius: 4px;
    z-index: 40;
}

.black-box-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#lightbox {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    cursor: zoom-out;
    touch-action: none;
}

#lightbox.active {
    opacity: 1;
    pointer-events: all;
}

#lightbox-img {
    max-width: 90vw;
    max-height: 90dvh;
    object-fit: contain;
    border-radius: 3px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
    cursor: default;
    transform: scale(0.94);
    transition: transform 0.28s cubic-bezier(0.34, 1.3, 0.64, 1);
}

#lightbox.active #lightbox-img {
    transform: scale(1);
}

.lightbox-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 1000;
    user-select: none;
}

.lightbox-arrow:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-50%) scale(1.08);
}

.lightbox-arrow img {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(1);
}

#lightbox-prev { left: 1.5rem; }
#lightbox-next { right: 1.5rem; }

.lightbox-close {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: background 0.2s, transform 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.08);
}

@media (max-width: 480px) {
    .lightbox-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 36px;
        height: 36px;
    }
}