/* ── 공지 레이어 팝업 ─────────────────────────────────── */
.notice-layers {
    .notice-header .org-name {
        font-family: "GangwonEduPowerExtraBold", sans-serif;
    }
    .notice-header .logo-img {
        max-height: 40px;
    }

    body:has(&.on) {
        overflow: hidden;
        &:has(.notice-layers.on[style="display: none;"]) {
            overflow-y: auto;
        }
    }
    body:has(.images &.on) {
        overflow-y: auto;
    }
    position: fixed;
    inset: 0 auto auto 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: 0s;
    align-content: center;
    &.on {
        pointer-events: all;
        opacity: 1;

        + .visual .swiper-slide::before {
            background-color: rgba(0, 0, 0, 0.2);
        }
    }

    > .closes {
        margin-bottom: 16px;
        display: flex;
        justify-content: center;
        gap: 5px;
        margin-top: 10px;
        a {
            display: flex;
            gap: 4px;
            align-items: center;
            background-color: var(--white);
            color: var(--black);
            /* background-color: rgba(0, 0, 0, 0.15); */
            border-radius: 10em;
            padding: 12px 20px;
            font-size: 0.9em;

            &:hover {
                background-color: var(--main-color);
                color: var(--white);
            }
        }
    }

    /* 레이어팝업 삽입*/
    .notice-layer {
        --gap: 12px;
        --cell: 4;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--gap);
        box-sizing: border-box;
        transition: 0.2s;
        padding: var(--padding) var(--padding) 10px var(--padding);
        overflow-y: auto;
        align-content: flex-start;
        &:has(li:nth-child(9)) {
            --cell: 5;
        }
        li {
            .more-click {
                position: absolute;
                right: 4px;
                top: 4px;
                font-weight: bold;
                font-size: 12px;
                padding: 0.4em 0.8em;
                border-radius: 5px;
                background: rgba(0, 0, 0, 0.4);
                backdrop-filter: blur(10px);
                pointer-events: all;
                cursor: pointer;
                border: 1px solid rgba(255, 255, 255, 0.1);
                &::before {
                    content: "pan_tool_alt";
                    font-family: "Material Symbols Sharp";
                    vertical-align: bottom;
                    margin-right: 4px;
                    font-weight: 400;
                }
                &:hover {
                    background: var(--main-color);
                }
            }
            /* aspect-ratio: 1/1; */
            border-radius: 8px;
            overflow: hidden;
            position: relative;
            transform-origin: left top;
            flex-grow: 0;
            flex-shrink: 0;
            width: calc(
                    (100% / var(--cell)) - var(--gap) + (var(--gap) / var(--cell))
            );
            /* 화면이 넓어도 셀(=팝업) 한 칸이 너무 커지지 않게 상한 */
            max-width: 350px;
            height: fit-content;
            /* 자식 .popup-card 의 cqw 단위가 이 셀 폭을 기준으로 계산되게 컨테이너로 지정 */
            container-type: inline-size;
            img {
                width: 100%;
                height: auto;
                object-fit: contain;
            }

            .closes {
                display: flex;
                position: absolute;
                width: 100%;
                justify-content: center;
                font-size: 0.7em;
                gap: 5px;
                right: 0;
                bottom: 0;
                background-color: rgba(255, 255, 255, 0);
                backdrop-filter: blur(10px);
                -webkit-backdrop-filter: blur(10px);

                a {
                    display: flex;
                    align-items: center;
                    gap: 4px;
                    padding: 10px;
                    font-weight: bold;
                    color: #fff;
                }
            }

            &.light {
                .closes a {
                    color: #000;
                    box-shadow: none;
                }
            }
        }
    }
    /* 모달(메인 / 서브 standalone)일 때. .visual 스크린은 팝업이 .main/.sub 밖 최상위라 :has(+ .visual)로 직접 매칭 */
    &:has(+ .visual),
    .main &,
    .sub &,
    &.filled {
        padding-top: var(--top-h);
        padding-bottom: var(--top-h);
        .notice-layer {
            align-items: center;
            justify-content: center;
            height: auto;
            flex-grow: 0;
            max-height: 100%;
            width: 100%;
        }
    }
    &.filled {
        position: fixed;
        & .notice-layer {
            --cell: 2;
            gap: 10px;
            width: 100%;
            padding: 10px;
            li {
                aspect-ratio: 1/1;
                border-radius: 8px;
                overflow: hidden;
                position: relative;
                transform-origin: left top;
                flex-shrink: 0;
                width: calc(
                        (100% / var(--cell)) - var(--gap) + (var(--gap) / var(--cell))
                );
                height: auto;
                img {
                    width: 100%;
                    height: 100%;
                }

                .closes {
                    display: flex;
                    position: absolute;
                    width: 100%;
                    justify-content: center;
                    font-size: 0.7em;
                    gap: 5px;
                    right: 0;
                    bottom: 0;
                    background-color: rgba(255, 255, 255, 0);
                    backdrop-filter: blur(10px);
                    -webkit-backdrop-filter: blur(10px);

                    a {
                        display: flex;
                        align-items: center;
                        gap: 4px;
                        padding: 10px;
                        font-weight: bold;
                        color: #fff;
                    }
                }

                &.light {
                    .closes a {
                        color: #000;
                        box-shadow: none;
                    }
                }
            }
        }
    }
    /* 서브일때 */
    .images & {
        padding: 0;
        z-index: 2;
        position: absolute;
        .notice-layer {
            --cell: 5;
            width: 100%;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
            flex-wrap: nowrap;
            align-items: center;
            > li {
                height: 100%;
                width: auto;
            }
        }
        > .closes {
            font-size: 0.85em;
        }
    }
    /* 서브 꽉 채울때 */
}

/* 반응형 */
@media (max-width: 812px) {
    .notice-layers {
        flex-direction: column;
        width: 100%;
        height: 100%;

        > .closes {
            text-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
            font-size: 1em;
            font-weight: bold;
            position: static;
            width: 100%;
            margin: 10px 0;
            .sub & {
                margin-top: 0;
                margin-bottom: 10px;
            }
            a {
                font-size: 0.8em;
            }
        }
        .notice-layer {
            --cell: 1;
            gap: 10px;
            width: 100%;
            padding: 10px;
            align-content: flex-start;

            li {
                border-radius: 8px;
                overflow: hidden;
                position: relative;
                max-width: none;
                width: 100%;

                .closes a {
                    color: #fff;
                }
            }

            /* TEMPLATE 배너(.popup-card)만 1:1 정사각형, 단순 이미지 공지는 이미지 원본 비율대로 */
            li:has(.popup-card) {
                aspect-ratio: 1/1;
            }

            li.one {
                width: 100%;
            }
        }
    }

    .dimed .notice-layers {
        display: none;
    }
}
