/* 화면 모드 고르기(자동 / 밝게 / 어둡게) — 원래 바탕과 상관없이 두 바탕 페이지 공통.
   색은 지금 모드(html[data-theme])만 보고 정한다. 아이콘은 고른 값(html[data-theme-pref])을 보여 준다 */

/* ---------- PC: 머리말 아이콘 버튼 ---------- */
.theme-pick { position: relative; display: inline-flex; margin-right: 4px; }
.theme-switch {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0;
    border: 1px solid transparent !important; border-radius: 10px;
    background: transparent; color: #99A1AF; cursor: pointer;
    transition: color .2s ease-out, background-color .2s ease-out, border-color .2s ease-out;
}
.theme-switch:hover, .theme-switch[aria-expanded="true"] { color: #fff; border-color: #364153 !important; }
.theme-switch:focus-visible { outline: 2px solid #2B7FFF; outline-offset: 2px; }
.theme-switch > span { display: none; color: inherit; } /* 전역 span 글자색(#101828)을 막는다 */
.theme-switch svg { width: 20px; height: 20px; display: block; }
html:not([data-theme-pref]) .theme-switch .i-system,
html[data-theme-pref="system"] .theme-switch .i-system,
html[data-theme-pref="light"] .theme-switch .i-light,
html[data-theme-pref="dark"] .theme-switch .i-dark { display: block; }
html[data-theme="light"] .theme-switch { color: #6A7282; }
html[data-theme="light"] .theme-switch:hover,
html[data-theme="light"] .theme-switch[aria-expanded="true"] { color: #101828; border-color: #CBD2DC !important; }

/* 휴대폰 머리말(메뉴 왼쪽) 버튼: 1024 미만에서만. PC 버튼은 .pc 묶음 안이라 휴대폰에선 저절로 숨는다 */
.theme-pick-mo { display: none; }
@media (max-width: 1023px) {
    .theme-pick-mo { display: inline-flex; margin-left: auto; margin-right: 8px; }
}

/* ---------- 펼침 메뉴 ---------- */
.theme-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 1000;
    min-width: 188px; padding: 6px;
    display: flex; flex-direction: column; gap: 2px;
    border-radius: 12px; border: 1px solid #1E2939;
    background: #101828; box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.theme-menu[hidden] { display: none; }
.theme-menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    height: 40px; padding: 0 10px; border: 0; border-radius: 8px;
    background: transparent; color: #D1D5DC; cursor: pointer; text-align: left;
    font: 500 14px/20px 'Pretendard', 'Pretendard Fallback', sans-serif; white-space: nowrap;
}
.theme-menu-item svg { width: 18px; height: 18px; flex: none; }
.theme-menu-item span { flex: 1; color: inherit; }
.theme-menu-item .theme-check { visibility: hidden; color: #60A5FA; }
.theme-menu-item[aria-checked="true"] { color: #FFFFFF; }
.theme-menu-item[aria-checked="true"] .theme-check { visibility: visible; }
.theme-menu-item:hover, .theme-menu-item:focus-visible { background: #1E2939; outline: none; }
html[data-theme="light"] .theme-menu { border-color: #E5E7EB; background: #FFFFFF; box-shadow: 0 16px 40px rgba(16, 24, 40, .12); }
html[data-theme="light"] .theme-menu-item { color: #4A5565; }
html[data-theme="light"] .theme-menu-item[aria-checked="true"] { color: #101828; }
html[data-theme="light"] .theme-menu-item .theme-check { color: #2066D0; }
html[data-theme="light"] .theme-menu-item:hover,
html[data-theme="light"] .theme-menu-item:focus-visible { background: #F3F4F6; }

/* ---------- 휴대폰: 메뉴 안 세 칸 버튼 (PC 에선 숨김) ---------- */
.theme-seg-wrap { display: none; }
@media (max-width: 1023px) {
    .theme-seg-wrap { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; padding-top: 20px; border-top: 1px solid #1E2939; }
    aside.left-side .theme-seg-wrap { margin: 16px 16px 24px; }
    .theme-seg-label { font: 500 13px/18px 'Pretendard', 'Pretendard Fallback', sans-serif; color: #99A1AF; }
    .theme-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: #101828; border: 1px solid #1E2939; }
    .theme-seg button {
        display: flex; align-items: center; justify-content: center; gap: 6px;
        height: 40px; border: 0; border-radius: 9px; background: transparent; color: #99A1AF; cursor: pointer;
        font: 500 14px/20px 'Pretendard', 'Pretendard Fallback', sans-serif;
    }
    .theme-seg button svg { width: 17px; height: 17px; flex: none; }
    .theme-seg button span { color: inherit; }
    .theme-seg button[aria-checked="true"] { background: #1E2939; color: #FFFFFF; }
    .theme-seg button:focus-visible { outline: 2px solid #2B7FFF; outline-offset: 1px; }
    html[data-theme="light"] .theme-seg-wrap { border-top-color: #E5E7EB; }
    html[data-theme="light"] .theme-seg-label { color: #6A7282; }
    html[data-theme="light"] .theme-seg { background: #F3F4F6; border-color: #E5E7EB; }
    html[data-theme="light"] .theme-seg button { color: #6A7282; }
    html[data-theme="light"] .theme-seg button[aria-checked="true"] { background: #FFFFFF; color: #101828; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
}
