/**
 * nmg-lightbox.css — combat-log modal overlay for NMG gallery + single posts.
 *
 * Dark scrim, rarity-palette accent, monospace caption. Inherits fonts from
 * the page (Chakra Petch / Inter / JetBrains Mono). No new imports.
 *
 * Transitions respect prefers-reduced-motion.
 */

/* ── Overlay / backdrop ─────────────────────────────────────────────────── */
.nmg-lb {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9900;
    background: rgba(5, 6, 10, 0.92);
    align-items: center;
    justify-content: center;
    /* flex is toggled by JS — default display:none avoids layout reflow */
}

.nmg-lb[aria-hidden="false"] {
    display: flex;
}

@media (prefers-reduced-motion: no-preference) {
    .nmg-lb {
        opacity: 0;
        transition: opacity 0.18s ease;
    }
    .nmg-lb[aria-hidden="false"] {
        opacity: 1;
    }
}

/* ── Dialog shell ───────────────────────────────────────────────────────── */
.nmg-lb-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(94vw, 1600px);
    max-width: 94vw;
    max-height: 94vh;
    outline: none; /* focus target — visible via ring below */
}

.nmg-lb-dialog:focus-visible {
    outline: 2px solid #c6a84b; /* epic-gold accent */
    outline-offset: 4px;
    border-radius: 2px;
}

/* ── Image ──────────────────────────────────────────────────────────────── */
.nmg-lb-img {
    display: block;
    /* Sized box forces a modest source image to scale UP into the viewport;
       object-fit:contain preserves aspect ratio and letterboxes onto the
       dark #0b0d14 frame. */
    width: min(94vw, 1600px);
    max-width: 100%;
    height: calc(94vh - 76px); /* leave room for the (now larger) caption */
    object-fit: contain;
    border: 1px solid rgba(198, 168, 75, 0.25); /* subtle epic-gold frame */
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
    border-radius: 2px;
    background: #0b0d14;
}

@media (prefers-reduced-motion: no-preference) {
    .nmg-lb-img {
        opacity: 0;
        transform: scale(0.97);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }
    .nmg-lb[aria-hidden="false"] .nmg-lb-img {
        opacity: 1;
        transform: scale(1);
    }
}

/* ── Caption ────────────────────────────────────────────────────────────── */
.nmg-lb-caption {
    margin-top: 12px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 1rem;
    line-height: 1.4;
    letter-spacing: 0.04em;
    color: rgba(224, 214, 190, 0.9);
    text-align: center;
    max-width: min(94vw, 1600px);
    /* Title is allowed to wrap (see .nmg-lb-caption-text); the index prefix
       stays compact on its own. No truncation. */
}

.nmg-lb-caption-index {
    color: #c6a84b; /* epic-gold accent */
    margin-right: 0.5em;
    white-space: nowrap;
}

.nmg-lb-caption-text {
    /* Let long screenshot titles wrap onto multiple lines instead of being
       truncated with an ellipsis. */
    overflow-wrap: anywhere;
}

/* ── Close button ───────────────────────────────────────────────────────── */
.nmg-lb-close {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 9910;
    background: none;
    border: 1px solid rgba(198, 168, 75, 0.35);
    color: #e0d6be;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    line-height: 1;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 2px;
    transition: border-color 0.15s, color 0.15s;
}

.nmg-lb-close:hover,
.nmg-lb-close:focus-visible {
    border-color: #c6a84b;
    color: #c6a84b;
    outline: none;
}

/* ── Prev / Next arrows ─────────────────────────────────────────────────── */
.nmg-lb-prev,
.nmg-lb-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9910;
    background: rgba(5, 6, 10, 0.7);
    border: 1px solid rgba(198, 168, 75, 0.25);
    color: #e0d6be;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    line-height: 1;
    padding: 12px 14px;
    cursor: pointer;
    border-radius: 2px;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.nmg-lb-prev { left: 12px; }
.nmg-lb-next { right: 12px; }

.nmg-lb-prev:hover,
.nmg-lb-prev:focus-visible,
.nmg-lb-next:hover,
.nmg-lb-next:focus-visible {
    border-color: #c6a84b;
    color: #c6a84b;
    background: rgba(5, 6, 10, 0.9);
    outline: none;
}

/* Hide nav buttons when there is only one image */
.nmg-lb[data-count="1"] .nmg-lb-prev,
.nmg-lb[data-count="1"] .nmg-lb-next {
    display: none;
}

/* ── Responsive: tighten arrows on small screens ────────────────────────── */
@media (max-width: 600px) {
    .nmg-lb-prev { left: 4px; padding: 8px 10px; }
    .nmg-lb-next { right: 4px; padding: 8px 10px; }
    .nmg-lb-close { top: 8px; right: 8px; }
}
