:root {
    --afncg-bg: rgba(12, 12, 12, 0.98);
    --afncg-fg: #f5f5f2;
    --afncg-muted: rgba(245, 245, 242, 0.66);
    --afncg-line: rgba(245, 245, 242, 0.2);
}

html.afncg-open,
body.afncg-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

#afncg-lightbox[hidden] {
    display: none !important;
}

#afncg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--afncg-bg);
    color: var(--afncg-fg);
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
}

.afncg-topbar {
    position: relative;
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 18px;
    min-height: 66px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--afncg-line);
    background: rgba(12, 12, 12, 0.86);
}

.afncg-title {
    min-width: 0;
    overflow: hidden;
    color: var(--afncg-fg);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.afncg-counter {
    color: var(--afncg-muted);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.afncg-close,
.afncg-arrow {
    appearance: none;
    border: 0;
    margin: 0;
    padding: 0;
    color: var(--afncg-fg);
    background: transparent;
    cursor: pointer;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

.afncg-close {
    width: 38px;
    height: 38px;
    border: 1px solid var(--afncg-line);
    border-radius: 999px;
    font-size: 25px;
    font-weight: 300;
    line-height: 34px;
}

.afncg-stage {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px 70px 28px;
    overflow: hidden;
    cursor: e-resize;
    touch-action: pan-y pinch-zoom;
    -webkit-user-select: none;
    user-select: none;
}

.afncg-media-wrap {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    align-items: center;
    justify-content: center;
    touch-action: pan-y pinch-zoom;
}

.afncg-media {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    opacity: 1;
    transition: opacity 140ms ease;
    -webkit-user-drag: none;
    user-drag: none;
    touch-action: pan-y pinch-zoom;
}

.afncg-media.afncg-loading {
    opacity: 0.16;
}

.afncg-arrow {
    position: absolute;
    z-index: 3;
    top: 50%;
    width: 44px;
    height: 64px;
    transform: translateY(-50%);
    color: rgba(245, 245, 242, 0.86);
    font-size: 38px;
    font-weight: 200;
    line-height: 60px;
    text-align: center;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}

.afncg-arrow:hover,
.afncg-arrow:focus-visible,
.afncg-close:hover,
.afncg-close:focus-visible {
    color: #fff;
    outline: none;
}

.afncg-arrow:focus-visible,
.afncg-close:focus-visible {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.afncg-prev { left: 10px; }
.afncg-next { right: 10px; }

.afncg-status {
    position: absolute;
    left: 50%;
    bottom: 14px;
    z-index: 2;
    transform: translateX(-50%);
    color: var(--afncg-muted);
    font-size: 12px;
    pointer-events: none;
}

@media (max-width: 767px) {
    .afncg-topbar {
        grid-template-columns: minmax(0, 1fr) auto auto;
        min-height: 58px;
        gap: 10px;
        padding: 10px 12px;
    }

    .afncg-title {
        font-size: 12px;
    }

    .afncg-counter {
        font-size: 11px;
    }

    .afncg-close {
        width: 36px;
        height: 36px;
        line-height: 32px;
    }

    .afncg-stage {
        padding: 10px 8px 18px;
        cursor: default;
    }

    .afncg-arrow {
        top: auto;
        bottom: 12px;
        width: 42px;
        height: 48px;
        font-size: 31px;
        line-height: 44px;
        background: rgba(12, 12, 12, 0.34);
        border-radius: 999px;
    }

    .afncg-prev { left: 10px; }
    .afncg-next { right: 10px; }

    .afncg-status {
        bottom: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .afncg-media {
        transition: none;
    }
}
