/* ============================================================
   의방서원 루트 게이트웨이 (index.html)
   폰트: Paperlogy (font-R / font-B / font-H)
   ============================================================ */

:root {
    --idx-accent  : #0f8add;
    --idx-white85 : rgba(255,255,255,0.85);
    --idx-white95 : rgba(255,255,255,0.95);
    --idx-shadow  : 0 4px 24px rgba(10,20,40,0.18);
    --idx-trans   : 0.45s ease;
}

/* ── 페이지 래퍼 ─────────────────────────────────────────── */
body.idx-gateway {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    font-family: 'font-R', sans-serif;
    background: #0b1220;
}

.idx_page {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ── 로그인: 로그아웃만 간단히 ───────────────────────────── */
body.idx-gateway #hd_login_msg {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 200;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    font-size: 0;
    line-height: 1;
}

body.idx-gateway #hd_login_msg a {
    display: inline-block;
    padding: 7px 14px;
    font-family: 'font-R', sans-serif;
    font-size: 12px;
    color: #374151;
    text-decoration: none;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

body.idx-gateway #hd_login_msg a:hover {
    color: var(--idx-accent);
    border-color: var(--idx-accent);
}

.idx_hd_empty { display: none; }

/* ── 메인 섹션 ───────────────────────────────────────────── */
#idx {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 64px 24px 80px;
    box-sizing: border-box;
}

/* PC 전용 풀스크린 배경 */
.idx_bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: url('../img/main_i1_1.jpg') center center / cover no-repeat;
    transition: background-image var(--idx-trans);
}

/* ── 로고 ────────────────────────────────────────────────── */
.idx_logo {
    flex-shrink: 0;
    text-align: center;
    margin-bottom: 0;
    animation: idxUp 0.55s ease both;
}

.idx_logo img {
    display: inline-block;
    width: 365px;
    height: auto;
    aspect-ratio: 365 / 113;
    max-width: 100%;
}

/* 버튼·배너 묶음 (로고와 분리해 세로 중앙) */
.idx_main_center {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
}

/* ── PC: 5개 원형 버튼 ───────────────────────────────────── */
.cont_list {
    width: 100%;
    max-width: 1080px;
    margin-top: 0;
    animation: idxUp 0.6s ease 0.05s both;
}

.cont_list ul {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cont_list li a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: var(--idx-white85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 3px solid rgba(255,255,255,0.6);
    box-shadow: var(--idx-shadow);
    text-decoration: none;
    color: #111827;
    font-family: 'font-B', sans-serif;
    font-size: clamp(16px, 1.5vw, 22px);
    letter-spacing: -0.02em;
    transition: border-color 0.25s ease, background 0.25s ease,
                transform 0.25s ease, box-shadow 0.25s ease;
}

.cont_list li a .lk_arr {
    display: none;
}

.cont_list li.is-active a,
.cont_list li a:hover,
.cont_list li a:focus-visible {
    border-color: var(--idx-accent);
    background: var(--idx-white95);
    transform: translateY(-6px) scale(1.05);
    box-shadow: 0 12px 36px rgba(15,132,221,0.25);
    outline: none;
}

/* ── 클래스 배너 ─────────────────────────────────────────── */
.idx_class_banner {
    width: 693px;
    max-width: 100%;
    margin: 40px auto 0;
    animation: idxUp 0.65s ease 0.1s both;
}

.idx_class_banner a {
    display: block;
    line-height: 0;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.idx_class_banner a:hover,
.idx_class_banner a:focus-visible {
    opacity: 0.92;
    outline: none;
}

.idx_class_banner img {
    display: block;
    width: 693px;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

/* ── 하단 저작권 (배지) ───────────────────────────────────── */
.idx_ft {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    width: 100%;
    margin: 0;
    padding: 0 16px 24px;
    box-sizing: border-box;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    pointer-events: none;
}

.ft_copy {
    display: inline-block;
    margin: 0;
    padding: 8px 18px;
    font-family: 'font-R', sans-serif;
    font-size: 11px;
    letter-spacing: 0.02em;
    line-height: 1.45;
    color: #4b5563;
    text-shadow: none;
    background: rgba(255, 255, 255, 0.58);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.1);
}

/* PC: 로고 상단 고정, 버튼·배너만 중앙 */
@media (min-width: 901px) {
    #idx {
        min-height: 100vh;
        min-height: 100dvh;
        padding: 28px 24px 88px;
        justify-content: flex-start;
    }

    .idx_logo {
        padding-top: 8px;
    }

    .idx_main_center {
        padding-bottom: 24px;
    }

    .idx_class_banner {
        margin-top: 56px;
    }

    .idx_ft {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 42px;
        padding: 0 16px;
    }

    .ft_copy {
        font-size: 11px;
        padding: 8px 18px;
        background: rgba(255, 255, 255, 0.52);
    }
}

@keyframes idxUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── 모바일: 배경 없음, 카드 내 이미지 (v1 방식 개선) ─────── */
@media (max-width: 900px) {

    body.idx-gateway {
        background: #fff;
    }

    .idx_bg {
        display: none !important;
    }

    #idx {
        padding: 32px 16px 24px;
    }

    .cont_list {
        margin-top: 0;
    }

    .idx_logo {
        margin-bottom: 24px;
    }

    .idx_logo img {
        width: auto;
        height: auto;
        max-width: min(240px, 68vw);
    }

    .cont_list ul {
        grid-template-columns: 1fr;
        max-width: 440px;
        gap: 10px;
        margin: 0 auto;
    }

    /* li에 분야 이미지, a는 오른쪽 50% 흰 영역 (클릭은 ::before로 카드 전체) */
    .cont_list li {
        position: relative;
        border: 1px solid #bbb;
        border-radius: 15px;
        overflow: hidden;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }

    .cont_list li.cate1 { background-image: url('../img/m_main_i1.jpg'); }
    .cont_list li.cate2 { background-image: url('../img/m_main_i2.jpg'); }
    .cont_list li.cate3 { background-image: url('../img/m_main_i3.jpg'); }
    .cont_list li.cate4 { background-image: url('../img/m_main_i4.jpg'); }
    .cont_list li.cate5 { background-image: url('../img/m_main_i5.jpg'); }

    .cont_list li a {
        position: relative;
        z-index: 1;
        aspect-ratio: unset;
        width: 50%;
        margin-left: 50%;
        min-height: 72px;
        padding: 0 16px;
        border-radius: 0 14px 14px 0;
        border: none;
        box-shadow: none;
        background: rgba(255,255,255,0.88);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-size: 17px;
        line-height: 1;
        transform: none;
    }

    .cont_list li a .lk_txt {
        line-height: 1;
    }

    /* 왼쪽 이미지 영역까지 클릭 확장 (시각 레이아웃은 5:5 유지) */
    .cont_list li a::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        right: 100%;
        width: 100%;
    }

    .cont_list li a .lk_arr {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        font-size: 18px;
        color: #7d7d7d;
        font-family: 'font-B', sans-serif;
        font-weight: 400;
        line-height: 1;
        transform: translateY(1px);
    }

    .cont_list li.is-active a,
    .cont_list li a:hover,
    .cont_list li a:focus-visible {
        transform: none;
        box-shadow: none;
        background: rgba(255,255,255,0.95);
        border: none;
    }

    .cont_list li.is-active {
        border-color: var(--idx-accent);
        box-shadow: 0 0 0 2px rgba(15,138,221,0.25);
    }

    .idx_class_banner {
        width: 100%;
        margin-top: 20px;
    }

    .idx_ft {
        padding: 8px 16px 32px;
    }

    .ft_copy {
        color: #6b7280;
        background: rgba(255, 255, 255, 0.72);
        border-color: rgba(0, 0, 0, 0.05);
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    }
}

@media (prefers-reduced-motion: reduce) {
    .idx_bg,
    .cont_list li a,
    .idx_class_banner a {
        transition: none;
    }
    .idx_logo, .cont_list, .idx_class_banner, .idx_main_center {
        animation: none;
    }
}
