/* 교육원 시설 — 모던 갤러리 */
.ej-facility {
    max-width: 1180px;
    margin: 0 auto;
    padding: 48px 24px 24px;
    box-sizing: border-box;
}

.ej-facility--sub {
    padding-top: 16px;
    padding-bottom: 64px;
}

.ej-facility__title {
    position: relative;
    margin: 0 0 36px;
    padding-bottom: 14px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.03em;
    text-align: center;
    color: #111827;
}

.ej-facility__title::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 40px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    transform: translateX(-50%);
}

.ej-facility ul {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 28px 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ej-facility li {
    margin: 0;
}

.ej-facility a.i {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    margin: 0;
    text-decoration: none;
    cursor: pointer;
    border-radius: 14px;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.ej-facility a.i:hover,
.ej-facility a.i:focus-visible {
    transform: translateY(-4px);
}

.ej-facility .thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 14px;
    background: linear-gradient(145deg, #f8fafc 0%, #eef2f7 100%);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 8px 24px rgba(15, 23, 42, 0.06);
    transition:
        border-color 0.28s ease,
        box-shadow 0.28s ease;
}

.ej-facility .thumb::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        180deg,
        rgba(15, 23, 42, 0) 45%,
        rgba(15, 23, 42, 0.42) 100%
    );
    opacity: 0;
    transition: opacity 0.28s ease;
    pointer-events: none;
}

.ej-facility .thumb::after {
    content: "원본 보기";
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1e40af;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    opacity: 0;
    transform: translateY(6px);
    transition:
        opacity 0.28s ease,
        transform 0.28s ease;
    pointer-events: none;
}

.ej-facility a.i:hover .thumb,
.ej-facility a.i:focus-visible .thumb {
    border-color: rgba(37, 99, 235, 0.28);
    box-shadow:
        0 4px 12px rgba(37, 99, 235, 0.08),
        0 16px 36px rgba(15, 23, 42, 0.12);
}

.ej-facility a.i:hover .thumb::before,
.ej-facility a.i:focus-visible .thumb::before,
.ej-facility a.i:hover .thumb::after,
.ej-facility a.i:focus-visible .thumb::after {
    opacity: 1;
    transform: translateY(0);
}

.ej-facility .thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.ej-facility a.i:hover .thumb img,
.ej-facility a.i:focus-visible .thumb img {
    transform: scale(1.06);
}

.ej-facility a.i strong {
    display: block;
    width: 100%;
    margin: 12px 0 0;
    padding: 0 4px;
    min-height: auto;
    line-height: 1.45;
    text-align: center;
    color: #374151;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
    word-break: keep-all;
    transition: color 0.25s ease;
}

.ej-facility a.i:hover strong,
.ej-facility a.i:focus-visible strong {
    color: #2563eb;
    text-decoration: none;
}

/* 라이트박스 */
#ej-facility-viewer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100100;
}

#ej-facility-viewer.is-open {
    display: block;
}

#ej-facility-viewer .ej-fv-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(4px);
    cursor: pointer;
    animation: ej-fv-fade-in 0.25s ease;
}

#ej-facility-viewer .ej-fv-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 1;
    transform: translate(-50%, -50%);
    width: min(960px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
    display: flex;
    flex-direction: column;
    animation: ej-fv-scale-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

#ej-facility-viewer .ej-fv-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(147, 197, 253, 0.25);
    background: linear-gradient(
        180deg,
        rgba(186, 230, 253, 0.92) 0%,
        rgba(224, 242, 254, 0.45) 55%,
        rgba(240, 249, 255, 0) 100%
    );
}

#ej-facility-viewer .ej-fv-title {
    flex: 1;
    margin: 0;
    padding-right: 8px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.35;
    color: #0f4c81;
    word-break: keep-all;
}

#ej-facility-viewer .ej-fv-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.55);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #475569;
    padding: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

#ej-facility-viewer .ej-fv-close:hover {
    background: rgba(255, 255, 255, 0.85);
    color: #1e293b;
}

#ej-facility-viewer .ej-fv-body {
    padding: 16px;
    overflow: auto;
    text-align: center;
    background: #fff;
}

#ej-facility-viewer .ej-fv-body img {
    max-width: 100%;
    max-height: calc(100vh - 160px);
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    transition: opacity 0.2s ease;
}

#ej-facility-viewer .ej-fv-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: #1e293b;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.18);
    cursor: pointer;
    transform: translateY(-50%);
    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

#ej-facility-viewer .ej-fv-nav__ico {
    display: block;
    font-size: 28px;
    line-height: 1;
    font-weight: 300;
    margin-top: -2px;
}

#ej-facility-viewer .ej-fv-prev {
    left: max(16px, calc(50% - 520px));
}

#ej-facility-viewer .ej-fv-next {
    right: max(16px, calc(50% - 520px));
}

#ej-facility-viewer .ej-fv-nav:hover:not(:disabled) {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.35);
    transform: translateY(-50%) scale(1.05);
}

#ej-facility-viewer .ej-fv-nav:disabled {
    opacity: 0.35;
    cursor: default;
}

@keyframes ej-fv-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ej-fv-scale-in {
    from {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (max-width: 1024px) {
    .ej-facility ul {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 24px 20px;
    }
}

@media (max-width: 768px) {
    .ej-facility {
        padding: 36px 16px 16px;
    }

    .ej-facility ul {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 16px;
    }

    .ej-facility__title {
        font-size: 20px;
        margin-bottom: 28px;
    }
}

@media (max-width: 480px) {
    .ej-facility ul {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .ej-facility .thumb {
        border-radius: 12px;
    }

    .ej-facility a.i strong {
        font-size: 15px;
    }

    #ej-facility-viewer .ej-fv-title {
        font-size: 17px;
    }

    #ej-facility-viewer .ej-fv-nav {
        width: 40px;
        height: 40px;
    }

    #ej-facility-viewer .ej-fv-nav__ico {
        font-size: 24px;
    }

    #ej-facility-viewer .ej-fv-prev {
        left: 8px;
    }

    #ej-facility-viewer .ej-fv-next {
        right: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ej-facility a.i,
    .ej-facility .thumb,
    .ej-facility .thumb img,
    .ej-facility .thumb::before,
    .ej-facility .thumb::after,
    #ej-facility-viewer .ej-fv-backdrop,
    #ej-facility-viewer .ej-fv-panel {
        transition: none;
        animation: none;
    }

    .ej-facility a.i:hover,
    .ej-facility a.i:focus-visible {
        transform: none;
    }

    .ej-facility a.i:hover .thumb img,
    .ej-facility a.i:focus-visible .thumb img {
        transform: none;
    }
}
