/* 이미지가 주인공인 공통 안내 팝업. 카드 비율은 모든 기기에서 5:7. */
.layer-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 16px 24px 40px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, .78);
}
.popup-gallery {
    --popup-count: 3;
    --popup-gap: 16px;
    --popup-card-width: min(380px, calc((100vw - 48px - 2 * var(--popup-gap)) / 3), max(1px, calc((100dvh - 176px) * 5 / 7)));
    --popup-image-width: calc(var(--popup-card-width) * var(--popup-count) + var(--popup-gap) * (var(--popup-count) - 1));
    width: max(224px, var(--popup-image-width));
    max-width: 100%;
    margin: auto;
    color: #fff;
    font-family: inherit;
    outline: none;
}
.popup-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    min-height: 44px;
}
.popup-gallery [hidden] { display: none; }
.popup-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 9px;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
    touch-action: manipulation;
}
.popup-control svg { width: 24px; height: 24px; }
.popup-close, .popup-arrow { border-radius: 50%; }
.popup-close {
    margin-inline-start: auto;
    border-color: transparent;
}
.popup-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}
.popup-position {
    min-width: 44px;
    text-align: center;
    line-height: 24px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.popup-control:focus-visible, .popup-dismiss input:focus-visible, .popup-card a:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 4px;
}
.popup-viewport {
    width: var(--popup-image-width);
    max-width: 100%;
    margin-inline: auto;
    overflow: hidden;
    border-radius: 12px;
    touch-action: pan-y pinch-zoom;
}
.popup-track { display: flex; gap: var(--popup-gap); }
.popup-card {
    flex: 0 0 var(--popup-card-width);
    aspect-ratio: 5 / 7;
    overflow: hidden;
    border-radius: 12px;
    background: #f6f6f6;
}
.popup-card a { display: block; width: 100%; height: 100%; }
.popup-card a:focus-visible { outline-offset: -5px; }
.popup-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
}
.popup-dismiss {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    width: fit-content;
    max-width: 100%;
    margin: 12px auto 0;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
}
.popup-dismiss input {
    appearance: auto;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--brand-color, #00529c);
    cursor: pointer;
    flex-shrink: 0;
}
.popup-announcement {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
@media (hover: hover) {
    .popup-control:hover { background: rgba(255, 255, 255, .16); border-color: #fff; }
}
@media (max-width: 1279px) {
    .layer-popup-overlay { padding: 8px 16px 28px; }
    .popup-gallery {
        --popup-count: 1;
        --popup-gap: 12px;
        /* Leave room for the toolbar, checkbox and overlay padding. */
        --popup-card-width: min(420px, calc(100vw - 32px), max(1px, calc((100dvh - 156px) * 5 / 7)));
    }
    .popup-toolbar { margin-bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .popup-track, .popup-control { transition: none !important; }
}
