/* Visionneuse des images jointes aux commentaires. */
.blog-comment-attachment-link {
    appearance: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: zoom-in;
}

.blog-comment-attachment-link:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .48);
    outline-offset: 3px;
    border-radius: 14px;
}

.comment-image-viewer[hidden],
.comment-image-viewer.is-hidden {
    display: none !important;
}

.comment-image-viewer {
    position: fixed;
    inset: 0;
    z-index: var(--club-ui-layer-topmost, 2147483000);
    display: grid;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 12px;
    overflow: hidden;
    place-items: center;
    border: 0;
    color: inherit;
    background: rgba(236, 240, 246, .74);
    backdrop-filter: blur(2.5px);
    -webkit-backdrop-filter: blur(2.5px);
    isolation: isolate;
    pointer-events: auto;
    overscroll-behavior: contain;
}

.comment-image-viewer::backdrop {
    background: transparent;
}

.comment-image-viewer:not([open]):not(.is-open) {
    pointer-events: none;
}

.comment-image-viewer-dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
    width: min(1780px, calc(100vw - 24px));
    height: min(1080px, calc(100dvh - 24px));
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, .2);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 72px rgba(15, 23, 42, .28);
}

.comment-image-viewer-dialog:focus {
    outline: none;
}

.comment-image-viewer-stage {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #030712;
}

.comment-image-viewer-stagebar {
    position: absolute;
    z-index: 4;
    top: 14px;
    right: 14px;
    left: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}

.comment-image-viewer-close,
.comment-image-viewer-toolbar {
    pointer-events: auto;
}

.comment-image-viewer-close,
.comment-image-viewer-tool {
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(15, 23, 42, .72);
    color: #fff;
    box-shadow: 0 7px 20px rgba(0, 0, 0, .25);
    backdrop-filter: blur(5px);
}

.comment-image-viewer-close {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.65rem;
    line-height: 1;
}

.comment-image-viewer-toolbar {
    display: flex;
    gap: 6px;
    padding: 5px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .58);
    box-shadow: 0 7px 20px rgba(0, 0, 0, .2);
    backdrop-filter: blur(5px);
}

.comment-image-viewer-tool {
    min-width: 36px;
    height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 1.1rem;
    font-weight: 700;
}

.comment-image-viewer-tool.is-wide {
    min-width: 70px;
    font-size: .78rem;
    font-variant-numeric: tabular-nums;
}

.comment-image-viewer-close:hover,
.comment-image-viewer-close:focus-visible,
.comment-image-viewer-tool:hover,
.comment-image-viewer-tool:focus-visible {
    border-color: rgba(255, 255, 255, .65);
    background: rgba(30, 41, 59, .94);
    outline: none;
}

.comment-image-viewer-viewport {
    position: relative;
    grid-row: 1 / 4;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    cursor: default;
}

.comment-image-viewer-viewport.is-zoomed {
    cursor: grab;
}

.comment-image-viewer-viewport.is-dragging {
    cursor: grabbing;
}

.comment-image-viewer-viewport:focus-visible {
    outline: 2px solid rgba(96, 165, 250, .75);
    outline-offset: -3px;
}

.comment-image-viewer-image {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    max-width: calc(100% - 30px);
    max-height: calc(100% - 30px);
    width: auto;
    height: auto;
    object-fit: contain;
    transform: translate3d(0, 0, 0) scale(1);
    transform-origin: center center;
    translate: -50% -50%;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
}

.comment-image-viewer-loading,
.comment-image-viewer-error {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: min(460px, calc(100% - 40px));
    padding: 12px 18px;
    border-radius: 12px;
    background: rgba(15, 23, 42, .78);
    color: #fff;
    text-align: center;
    transform: translate(-50%, -50%);
}

.comment-image-viewer-help {
    position: absolute;
    z-index: 3;
    bottom: 13px;
    left: 50%;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .65);
    color: rgba(255, 255, 255, .9);
    font-size: .76rem;
    transform: translateX(-50%);
    pointer-events: none;
    white-space: nowrap;
}

.comment-image-viewer-panel {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    border-left: 1px solid #e2e8f0;
    background: #fff;
}

.comment-image-viewer-panel-header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 18px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.comment-image-viewer-avatar {
    display: inline-grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    overflow: hidden;
    border: 2px solid rgba(37, 99, 235, .18);
    border-radius: 50%;
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 800;
}

.comment-image-viewer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-image-viewer-identity {
    min-width: 0;
}

.comment-image-viewer-author {
    display: block;
    overflow: hidden;
    color: #111827;
    font-size: .98rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comment-image-viewer-date {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-size: .78rem;
    line-height: 1.35;
}

.comment-image-viewer-panel-body {
    min-height: 0;
    padding: 20px 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.comment-image-viewer-kicker {
    margin-bottom: 10px;
    color: #64748b;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.comment-image-viewer-comment {
    color: #1f2937;
    font-family: var(--bs-body-font-family, system-ui, -apple-system, "Segoe UI", sans-serif);
    font-size: .96rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.comment-image-viewer-comment.is-empty {
    color: #94a3b8;
    font-style: italic;
}

.comment-image-viewer-open {
    overscroll-behavior: none;
}

:root[data-theme="dark"] .comment-image-viewer {
    background: rgba(15, 23, 42, .7);
}

:root[data-theme="dark"] .comment-image-viewer-dialog,
:root[data-theme="dark"] .comment-image-viewer-panel {
    background: #111827;
    color: #e5e7eb;
}

:root[data-theme="dark"] .comment-image-viewer-panel {
    border-left-color: #334155;
}

:root[data-theme="dark"] .comment-image-viewer-panel-header {
    border-bottom-color: #334155;
}

:root[data-theme="dark"] .comment-image-viewer-author,
:root[data-theme="dark"] .comment-image-viewer-comment {
    color: #f1f5f9;
}

:root[data-theme="dark"] .comment-image-viewer-date,
:root[data-theme="dark"] .comment-image-viewer-kicker {
    color: #94a3b8;
}

@media (max-width: 920px) {
    .comment-image-viewer {
        padding: 0;
    }

    .comment-image-viewer-dialog {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border: 0;
        border-radius: 0;
    }

    .comment-image-viewer-panel {
        max-height: 34dvh;
        border-top: 1px solid #e2e8f0;
        border-left: 0;
    }

    .comment-image-viewer-panel-header {
        padding: 11px 14px 9px;
    }

    .comment-image-viewer-panel-body {
        padding: 10px 14px 15px;
    }

    .comment-image-viewer-help {
        display: none;
    }
}

@media (max-width: 520px) {
    .comment-image-viewer-stagebar {
        top: 9px;
        right: 9px;
        left: 9px;
    }

    .comment-image-viewer-close {
        width: 38px;
        height: 38px;
    }

    .comment-image-viewer-tool {
        min-width: 32px;
        height: 31px;
        padding: 0 8px;
    }

    .comment-image-viewer-tool.is-wide {
        min-width: 58px;
    }

    .comment-image-viewer-image {
        max-width: calc(100% - 12px);
        max-height: calc(100% - 12px);
    }
}

@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    .comment-image-viewer {
        background: rgba(238, 242, 247, .96);
    }

    :root[data-theme="dark"] .comment-image-viewer {
        background: rgba(15, 23, 42, .96);
    }
}
