/**
 * Critical CSS - FOUC 방지용 최소 스타일
 * ================================
 * head-loader.js가 리소스를 로드하는 동안 표시될 기본 스타일
 * 페이지 초기 렌더링 시 깜빡임(Flash of Unstyled Content) 최소화
 */

/* ========================================
 * 풀페이지 로딩 오버레이 - 끊김 현상 완전 제거
 * ======================================== */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 99999;
    pointer-events: none;
}

/* 로딩 완료 후 즉시 사라짐 (트랜지션 없음) */
.layout-loaded #page-loader {
    display: none;
}

/* 기본 폰트 (Pretendard 로드 전) */
html {
    font-size: 16px;
}

body {
    font-family: 'Pretendard GOV', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: #333;
    background-color: #fff;
    line-height: 1.5;
}

/* 레이아웃 골격 */
#wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 헤더/푸터 로드 전 숨김 (layout-loader.js가 로드하면 표시됨) */
/* opacity 사용으로 레이아웃 계산 유지 + 부드러운 페이드인 */
#header,
#footer {
    opacity: 0;
    min-height: 60px;
    transition: opacity 0.15s ease-in;
}

/* 레이아웃 로드 완료 후 헤더/푸터 표시 */
.layout-loaded #header,
.layout-loaded #footer {
    opacity: 1;
}

/* 메인 컨텐츠 영역 */
#container,
main {
    flex: 1;
    min-height: 50vh;
}

/* 링크 기본 스타일 */
a {
    color: inherit;
    text-decoration: none;
}

/* 버튼 기본 스타일 */
button {
    cursor: pointer;
    font-family: inherit;
}

/* 이미지 기본 스타일 */
img {
    max-width: 100%;
    height: auto;
}

/* 숨김 요소 */
.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;
}

/* 로딩 중 플레이스홀더 (선택적 사용) */
.loading-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.loading-placeholder::after {
    content: '로딩 중...';
}

/* 스킵 링크 (접근성) */
#krds-skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    z-index: 10000;
}

#krds-skip-link a:focus {
    position: fixed;
    top: 0;
    left: 0;
    padding: 10px 20px;
    background: #0056b3;
    color: #fff;
    text-decoration: none;
    z-index: 10000;
}
