/* 
 * 통합 웹 접근성 CSS
 * KWCAG 2.3 준수
 * 
 * 목차:
 * 1. 기본 접근성 요소
 * 2. 스킵 네비게이션
 * 3. 포커스 스타일
 * 4. 키보드 네비게이션
 * 5. 색상 대비 및 가독성
 * 6. 인터랙션 영역
 * 7. 모달 및 팝업
 * 8. 폼 요소
 * 9. 테이블
 * 10. 멀티미디어
 * 11. 반응형 및 리플로우
 * 12. 고대비/다크모드/애니메이션 감소
 * 13. 프린트 스타일
 */

/* ==================== 1. 기본 접근성 요소 ==================== */

/* 스크린리더 전용 클래스 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 테이블 캡션 숨김 처리 (스크린리더는 읽음) */
table caption {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==================== 2. 스킵 네비게이션 ==================== */

#skip-nav {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
    width: 100%;
}

#skip-nav a {
    position: absolute;
    top: -100px;
    left: 0;
    width: 100%;
    padding: 15px 0;
    background: #333;
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: top 0.3s;
    overflow: hidden;
}

#skip-nav a:focus,
#skip-nav a:active {
    top: 0;
    outline: 3px solid #ff0;
    outline-offset: -3px;
}

/* ==================== 3. 포커스 스타일 ==================== */

/* 기본 포커스 스타일 개선 */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
    outline: 2px solid #e94557;
    outline-offset: 2px;
}

/* 키보드 네비게이션 표시 */
.keyboard-focus-visible:focus {
    outline: 3px solid #e94557;
    outline-offset: 2px;
}

/* ==================== 4. 키보드 네비게이션 ==================== */

/* GNB 키보드 접근성 */
#gnb .dp1-box > a:focus,
#gnb .dp2-box a:focus {
    background-color: rgba(233, 69, 87, 0.1);
    outline: 2px solid #e94557;
    outline-offset: -2px;
    border-radius: 4px;
}

/* 서브메뉴가 열렸을 때 시각적 표시 */
#gnb .dp1-box.menu-open > a {
    background-color: rgba(233, 69, 87, 0.05);
}

/* 모바일 메뉴 키보드 접근성 */
#gnb.mo_gnb .dp1-box > a:focus {
    background-color: rgba(233, 69, 87, 0.1);
    outline: 2px solid #e94557;
    outline-offset: -2px;
}

/* 서브메뉴바(브레드크럼) 키보드 접근성 */
#sub_location .sub-location-item button {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 2rem 3rem;
    font-size: inherit;
    font-family: inherit;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s;
}

#sub_location .sub-location-item button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#sub_location .sub-location-item button:focus {
    background-color: rgba(255, 255, 255, 0.1);
    outline: 2px solid #fff;
    outline-offset: -2px;
}

#sub_location .sub-location-item ul {
    display: none;
    top: 100% !important;
    margin-top: -1px;
}

#sub_location .sub-location-item ul a:focus {
    background-color: rgba(255, 255, 255, 0.1);
    outline: 2px solid #fff;
    outline-offset: -2px;
}

/* ==================== 5. 색상 대비 및 가독성 ==================== */

/* 비활성화 텍스트 최소 대비 */
:disabled,
[aria-disabled="true"],
.disabled {
    opacity: 0.7;
}

/* 링크 밑줄 표시 (본문 내) */
main a:not(.item):not(.more):not(.btn):not(.video-prev):not(.video-next):not(.news-prev):not(.news-next) {
    text-decoration: underline;
    text-underline-offset: 2px;
}

main a:not(.item):not(.more):not(.btn):not(.video-prev):not(.video-next):not(.news-prev):not(.news-next):hover {
    text-decoration-thickness: 2px;
}

/* 최소 행간 및 문자 간격 */
p, li, td {
    line-height: 1.5;
}

/* ==================== 6. 인터랙션 영역 ==================== */

/* 최소 터치/클릭 영역 보장 (44x44px) */
.btn-sm,
.pagination a {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==================== 7. 모달 및 팝업 ==================== */

/* 모달 접근성 개선 */
[role="dialog"] {
    position: fixed;
}

[role="dialog"]:focus {
    outline: none;
}

/* 모달 백드롭 */
.modal-backdrop {
    background: rgba(0, 0, 0, 0.5);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
}

/* 팝업 닫기 버튼 스타일 */
button#pop-close-btn1,
button#pop-close-btn2,
button#pop-close-btn3,
button.in_close,
button.popup_2_close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 5px;
}

/* ==================== 8. 폼 요소 ==================== */

/* 폼 포커스 스타일 */
input:focus,
select:focus,
textarea:focus {
    border-color: #e94557;
    box-shadow: 0 0 0 3px rgba(233, 69, 87, 0.1);
}

/* 필수 필드 표시 */
.required::after {
    content: " *";
    color: #e94557;
    font-weight: bold;
}

/* 에러 메시지 */
.error-message {
    color: #d32f2f;
    font-size: 14px;
    margin-top: 5px;
}

/* ==================== 9. 테이블 ==================== */

/* 테이블 접근성 */
table th {
    background: #f5f5f5;
    font-weight: bold;
}

table caption {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
}

/* ==================== 10. 멀티미디어 ==================== */

/* 비디오/이미지 대체 텍스트 스타일 */
.video-caption,
.image-caption {
    font-style: italic;
    color: #666;
    margin-top: 5px;
}

/* 이미지 최적화: Lazy loading 지원 */
img[loading="lazy"] {
    content-visibility: auto;
}

/* 배경 이미지 지연 로딩 */
.lazy-bg {
    content-visibility: auto;
}

/* 이미지 로딩 최적화 */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 자동재생 컨트롤 - 제거됨 (원본 디자인 유지) */
.autoplay-controls,
.autoplay-control {
    display: none !important;
}

/* 메인 히어로의 모든 재생/일시정지 컨트롤 완전 제거 */
#main_visual .swiper-autoplay-control,
#main_visual .autoplay-control,
#main_visual .autoplay-controls,
#main_visual button[aria-label*="재생"],
#main_visual button[aria-label*="일시정지"],
#main_visual button[aria-label*="슬라이드"],
#main_visual .xi-play,
#main_visual .xi-pause,
#main_visual [class*="play"],
#main_visual [class*="pause"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}

/* 추가 네비게이션 버튼 - 제거됨 (원본 디자인 유지) */
.swiper-nav-btn {
    display: none !important;
}

/* ==================== 11. 버튼 스타일 ==================== */

/* 버거 메뉴 버튼 */
button.burger {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    position: relative;
}

button.burger span {
    display: block;
}

/* 스크롤 다운 버튼 */
.scroll_down button {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    display: inline-block;
    padding: 0;
}

/* 비디오/뉴스 컨트롤 버튼 */
button.video-prev,
button.video-next,
button.news-prev,
button.news-next {
    background: transparent;
    border: 1px solid #d2d2d2;
    border-radius: 100%;
    width: 4.4rem;
    height: 4.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 2.8rem;
    cursor: pointer;
    transition: all 0.3s;
}

button.video-prev:hover,
button.video-next:hover,
button.news-prev:hover,
button.news-next:hover {
    background: #f0f0f0;
    border-color: #999;
}

button.video-prev:focus,
button.video-next:focus,
button.news-prev:focus,
button.news-next:focus {
    outline: 2px solid #e94557;
    outline-offset: 2px;
}

/* ==================== 12. 반응형 및 리플로우 ==================== */

/* 320px 뷰포트 대응 */
@media (max-width: 320px) {
    body {
        min-width: 320px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    table {
        font-size: 12px;
    }
}

/* 모바일 스크린리더 텍스트 */
@media (max-width: 767.98px) {
    .sr-only-mobile {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

/* ==================== 13. 미디어 쿼리 (고대비/다크모드/애니메이션) ==================== */

/* 고대비 모드 */
@media (prefers-contrast: high) {
    a:focus,
    button:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 3px solid currentColor;
    }
    
    .btn,
    button {
        border: 2px solid currentColor;
    }
    
    :disabled {
        opacity: 0.5;
    }
}

/* 다크모드 */
@media (prefers-color-scheme: dark) {
    #skip-nav a {
        background: #fff;
        color: #000;
    }
    
    table th {
        background: #333;
        color: #fff;
    }
    
    .error-message {
        color: #ff6b6b;
    }
}

/* 애니메이션 감소 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==================== 14. 프린트 스타일 ==================== */

@media print {
    /* 불필요한 요소 숨김 */
    #skip-nav,
    .no-print,
    button,
    .btn,
    nav,
    .navigation,
    .sidebar,
    footer {
        display: none !important;
    }
    
    /* 링크 URL 표시 */
    a[href]::after {
        content: " (" attr(href) ")";
    }
    
    /* 페이지 나누기 */
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    table {
        page-break-inside: avoid;
    }
}

/* ==================== 15. 유틸리티 클래스 ==================== */

/* 시각적 숨김 (접근성 유지) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 포커스 시에만 표시 */
.show-on-focus:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* 읽기 전용 스타일 - 완전 제거 (원본 디자인 유지) */
/* readonly 필드는 원본 스타일 그대로 유지 */

/* 현재 페이지 표시 */
[aria-current="page"],
.current-page {
    font-weight: bold;
    color: #e94557;
}

/* 새 창 링크 표시 (로고 제외) */
a[target="_blank"]:not(:has(img))::after {
    content: " ↗";
    font-size: 0.8em;
    vertical-align: super;
}

/* 로딩 상태 */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-top-color: #e94557;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
