/* ============================================================
   Galeria (case-lightbox.js) e leitor de PDF (pdf-modal.js) — os dois
   são montados pelo JS no fim do <body>. Fundo escuro de propósito:
   foto e vídeo leem melhor sobre o preto do que sobre o papel.
   ============================================================ */

.gallery-lb,
.pdf-lb {
    position: fixed;
    inset: 0;
    z-index: var(--z-overlay);
}
.gallery-lb[hidden],
.pdf-lb[hidden] { display: none; }

.gallery-lb__backdrop,
.pdf-lb__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 20, 0.94);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.gallery-lb__close,
.gallery-lb__prev,
.gallery-lb__next,
.pdf-lb__close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10);
    color: #FFFFFF;
    cursor: pointer;
    transition: background-color var(--dur-base) var(--ease-apple);
}
.gallery-lb__close svg,
.pdf-lb__close svg { width: 16px; height: 16px; pointer-events: none; }
.gallery-lb__prev svg,
.gallery-lb__next svg { width: 18px; height: 18px; }

@media (hover: hover) {
    .gallery-lb__close:hover,
    .gallery-lb__prev:hover,
    .gallery-lb__next:hover,
    .pdf-lb__close:hover { background: var(--brand); }
}

/* ── Galeria ─────────────────────────────────────────────── */

.gallery-lb__shell {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-areas:
        "header header header"
        "prev   stage  next";
    grid-template-rows: 64px 1fr;
    grid-template-columns: 56px 1fr 56px;
}

.gallery-lb__header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
}

.gallery-lb__counter {
    font-size: var(--fs-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.72);
}

.gallery-lb__stage {
    grid-area: stage;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    padding: var(--space-4) 0 var(--space-8);
    overflow: hidden;
}

.gallery-lb__image,
.gallery-lb__video {
    display: block;
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius-md);
}
.gallery-lb__image { object-fit: contain; }
.gallery-lb__video { background: #000000; }

.gallery-lb__prev,
.gallery-lb__next {
    align-self: center;
    justify-self: center;
    z-index: 1;
}
.gallery-lb__prev { grid-area: prev; }
.gallery-lb__next { grid-area: next; }
.gallery-lb__prev[hidden],
.gallery-lb__next[hidden] { display: none; }

@media (min-width: 720px) {
    .gallery-lb__shell { grid-template-columns: 88px 1fr 88px; }
    .gallery-lb__header { padding: 0 var(--space-6); }
}

/* ── PDF ─────────────────────────────────────────────────── */

.pdf-lb {
    display: grid;
    place-items: center;
    padding: var(--space-2);
}
.pdf-lb[hidden] { display: none; }

.pdf-lb__shell {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 960px;
    height: 92dvh;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
    animation: pdf-lb-in var(--dur-slow) var(--ease-out-expo) both;
}

@keyframes pdf-lb-in {
    from { opacity: 0; transform: scale(0.97) translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.pdf-lb__header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--line);
}

.pdf-lb__title {
    overflow: hidden;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pdf-lb__actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: var(--space-2);
}

.pdf-lb__download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 var(--space-4);
    border-radius: var(--radius-pill);
    background: var(--brand-soft);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--brand-deep);
}
.pdf-lb__download svg { width: 14px; height: 14px; }

.pdf-lb__close {
    background: var(--paper);
    color: var(--ink);
}

.pdf-lb__stage {
    flex: 1;
    min-height: 0;
    padding: var(--space-3);
    background: var(--paper-2);
}

.pdf-lb__frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: var(--radius-sm);
}

@media (min-width: 720px) {
    .pdf-lb { padding: var(--space-4); }
    .pdf-lb__shell { height: min(90dvh, 820px); }
}

@media (max-width: 599px) {
    .pdf-lb__download span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .pdf-lb__shell { animation: none; }
}
