/* Theme-scoped cover presentation; images retain their original aspect ratio. */
.cgl-gallery {
    --cgl-radius: 12px;
    --cgl-focus: #7ab8ff;
    display: block;
    max-width: 100%;
    margin: 0 0 1.5rem;
}

.cgl-gallery .cgl-trigger {
    position: relative;
    display: block;
    overflow: hidden;
    border: 0;
    border-radius: var(--cgl-radius);
    background: #161719;
    color: #fff;
    text-decoration: none;
    isolation: isolate;
}

.cgl-gallery .cgl-cover-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
    transition: transform 220ms ease;
}

.cgl-gallery .cgl-trigger:hover .cgl-cover-image {
    transform: scale(1.025);
}

.cgl-gallery .cgl-trigger:focus-visible {
    outline: 3px solid var(--cgl-focus);
    outline-offset: 4px;
}

.cgl-gallery .cgl-cover-overlay {
    position: absolute;
    inset: auto 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 32px 18px 16px;
    background: linear-gradient(transparent, rgb(0 0 0 / 78%));
    color: #fff;
    pointer-events: none;
}

.cgl-gallery .cgl-cover-label {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 6px rgb(0 0 0 / 50%);
}

.cgl-gallery .cgl-cover-count {
    flex: 0 0 auto;
    padding: 5px 10px;
    border: 1px solid rgb(255 255 255 / 42%);
    border-radius: 999px;
    background: rgb(0 0 0 / 48%);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.35;
}

.cgl-gallery .cgl-gallery-caption {
    display: block;
    margin: 0.65rem 0 0;
    font-size: 0.9rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

/* The native dialog provides the modal top layer and an inert page behind it. */
dialog.cgl-lightbox {
    box-sizing: border-box;
    inset: 0;
    width: calc(100% - 24px);
    max-width: 1280px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgb(255 255 255 / 15%);
    border-radius: 14px;
    background: #111214;
    color: #fff;
    box-shadow: 0 20px 90px rgb(0 0 0 / 55%);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    text-align: left;
    color-scheme: dark;
}

dialog.cgl-lightbox[open] {
    display: block;
    animation: cgl-dialog-appear 160ms ease-out;
}

dialog.cgl-lightbox:not([open]),
.cgl-lightbox [hidden] {
    display: none !important;
}

dialog.cgl-lightbox::backdrop {
    background: rgb(0 0 0 / 88%);
}

.cgl-lightbox *,
.cgl-lightbox *::before,
.cgl-lightbox *::after {
    box-sizing: border-box;
}

.cgl-lightbox .cgl-lightbox-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-height: calc(100vh - 26px);
    max-height: calc(100dvh - 26px);
}

.cgl-lightbox .cgl-lightbox-toolbar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px 10px 18px;
}

.cgl-lightbox .cgl-lightbox-title {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: #f5f5f5;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cgl-lightbox .cgl-lightbox-close,
.cgl-lightbox .cgl-lightbox-nav {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    appearance: none;
    border: 1px solid rgb(255 255 255 / 30%);
    border-radius: 50%;
    background: rgb(17 18 20 / 85%);
    color: #fff;
    box-shadow: none;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 32px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: normal;
    text-align: center;
    text-decoration: none;
    text-indent: 0;
    text-transform: none;
    transition: background-color 120ms ease, border-color 120ms ease;
    -webkit-tap-highlight-color: transparent;
}

.cgl-lightbox .cgl-lightbox-close:hover,
.cgl-lightbox .cgl-lightbox-nav:hover {
    border-color: #fff;
    background: #34363b;
    color: #fff;
}

.cgl-lightbox .cgl-lightbox-close:focus-visible,
.cgl-lightbox .cgl-lightbox-nav:focus-visible {
    outline: 3px solid #7ab8ff;
    outline-offset: 3px;
}

.cgl-lightbox .cgl-lightbox-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: #08090a;
}

.cgl-lightbox .cgl-lightbox-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: min(72vh, 760px);
    height: min(72dvh, 760px);
    max-height: calc(100vh - 210px);
    max-height: calc(100dvh - 210px);
    min-height: 80px;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
}

.cgl-lightbox .cgl-lightbox-image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
}

.cgl-lightbox .cgl-lightbox-status {
    max-width: 34rem;
    margin: 0;
    padding: 24px 64px;
    color: #e2e4e7;
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: center;
}

.cgl-lightbox .cgl-lightbox-nav {
    position: absolute;
    z-index: 2;
    top: 50%;
    transform: translateY(-50%);
    font-size: 40px;
}

.cgl-lightbox .cgl-lightbox-previous {
    left: 12px;
}

.cgl-lightbox .cgl-lightbox-next {
    right: 12px;
}

.cgl-lightbox .cgl-lightbox-footer {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 112px;
    margin: 0;
    padding: 12px 18px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    text-align: center;
}

.cgl-lightbox .cgl-lightbox-count {
    margin: 0;
    color: #b9bec7;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}

.cgl-lightbox .cgl-lightbox-caption {
    margin: 6px auto 0;
    max-width: 64rem;
    color: #f0f1f3;
    font-size: 0.9375rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

@keyframes cgl-dialog-appear {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    dialog.cgl-lightbox {
        width: calc(100% - 12px);
        max-height: calc(100vh - 12px);
        max-height: calc(100dvh - 12px);
        border-radius: 10px;
    }

    .cgl-lightbox .cgl-lightbox-panel {
        max-height: calc(100vh - 14px);
        max-height: calc(100dvh - 14px);
    }

    .cgl-lightbox .cgl-lightbox-toolbar {
        gap: 10px;
        padding: 8px 8px 8px 12px;
    }

    .cgl-lightbox .cgl-lightbox-title {
        font-size: 0.9375rem;
    }

    .cgl-lightbox .cgl-lightbox-previous { left: 6px; }
    .cgl-lightbox .cgl-lightbox-next { right: 6px; }

    .cgl-lightbox .cgl-lightbox-footer {
        padding: 10px 12px 12px;
    }

    .cgl-gallery .cgl-cover-overlay {
        padding: 28px 12px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cgl-gallery .cgl-cover-image,
    .cgl-lightbox .cgl-lightbox-close,
    .cgl-lightbox .cgl-lightbox-nav {
        transition: none;
    }

    .cgl-gallery .cgl-trigger:hover .cgl-cover-image {
        transform: none;
    }

    dialog.cgl-lightbox[open] {
        animation: none;
    }
}
