/* corp.wjsevin.com - 커스텀 스타일 */

/* Pretendard 폰트 최적화
 * - Pretendard 미로드 시 시스템 한국어 폰트로 즉시 렌더 (CLS 방지)
 * - 폰트 fallback에 'Apple SD Gothic Neo', 'Malgun Gothic' 명시
 */
* {
    font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont,
                 'Apple SD Gothic Neo', 'Malgun Gothic', 'Segoe UI', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Pretendard 다운로드 후에도 swap 보장 (subset CSS에 누락된 경우 안전장치) */
@font-face {
    font-family: 'Pretendard Variable';
    font-display: swap;
    src: local('Pretendard Variable');
}

/* 스크롤 부드럽게 */
html {
    scroll-behavior: smooth;
}

/* 모바일 좌우 스크롤 방지 (아이폰 대응) */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* 링크 기본 스타일 */
a {
    transition: color 0.15s ease, opacity 0.15s ease;
}

/* 드롭다운 그룹 hover 처리 */
.group:hover .group-hover\:visible {
    visibility: visible;
}

/* 페이지 로딩 시 애니메이션 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

main {
    animation: fadeIn 0.2s ease-out;
    overflow-x: hidden;
    word-break: keep-all;
    overflow-wrap: break-word;
}

/* 검색 하이라이트 */
mark {
    background-color: #FEF08A;
    color: inherit;
    border-radius: 2px;
    padding: 0 2px;
}

/* 스크롤탑 버튼 표시 */
#scrollTop.show {
    opacity: 1;
    visibility: visible;
}

/* 테이블 스타일 */
.data-table th,
.data-table td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #F3F4F6;
}

.data-table thead th {
    background: #F9FAFB;
    font-weight: 600;
    font-size: 0.8125rem;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* 회사 카드 호버 효과 */
.company-card {
    transition: all 0.15s ease;
}

.company-card:hover {
    transform: translateY(-1px);
}

/* 태블릿/모바일에서 사이드 필터 스타일 */
@media (max-width: 1023px) {
    .sticky {
        position: static;
    }
}

/* 아이폰/모바일 대응 */
@media (max-width: 640px) {
    /* 지도 높이 축소 */
    #world-map, #company-map, #parent-map {
        height: 220px !important;
    }
    /* 테이블 셀 여백 축소 */
    table th, table td {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
    }
    /* 기업 카드: 우측 태그 영역 축소/줄바꿈 */
    .space-y-3 > a.flex {
        flex-wrap: wrap;
    }
    .space-y-3 > a.flex > .text-right.flex-shrink-0 {
        flex-shrink: 1;
        max-width: 40%;
        text-align: right;
    }
    /* 기업 카드 내 min-w-0 영역 */
    .space-y-3 > a.flex > .flex-1 {
        min-width: 0;
        max-width: calc(100% - 4rem);
    }
    /* 히어로 통계 카드 축소 */
    .bg-blue-50.rounded-xl {
        padding: 0.5rem 0.75rem;
    }
    .bg-blue-50.rounded-xl .text-xl {
        font-size: 1rem;
    }
    /* 인사이트 헤더 카드 */
    .bg-white\/15, .bg-white\/20 {
        padding: 0.5rem 0.75rem;
    }
    .bg-white\/15 .text-2xl, .bg-white\/20 .text-2xl {
        font-size: 1.25rem;
    }
}

/* 페이지네이션 */
nav[aria-label="페이지네이션"] a,
nav[aria-label="페이지네이션"] span {
    font-size: 0.875rem;
}

/* Chart.js 캔버스 */
canvas {
    max-width: 100%;
}

/* 관리자 페이지 탭 애니메이션 */
.tab-content {
    animation: fadeIn 0.15s ease-out;
}

/* 업로드 드롭존 애니메이션 */
#dropzone {
    transition: all 0.2s ease;
}

/* 진행 바 */
#progressBar {
    transition: width 0.5s ease;
}

/* 접근성: 포커스 링 */
:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
    border-radius: 4px;
}

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

.focus\:not-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Leaflet/지도 컨테이너 CLS 예약 (라이브러리 로드 전에도 자리 유지) */
#world-map, #company-map, #parent-map, #network-chart {
    background: #f0f4f8;
    min-height: 220px;
}

/* AdSense 광고 슬롯 CLS 예약 (광고 로드 전 공간 확보 권장)
   실제 광고 슬롯에 .ad-slot 클래스 추가 시 적용 */
.ad-slot {
    min-height: 100px;
    display: block;
    overflow: hidden;
}

/* 첫 페인트 fadeIn 애니메이션이 LCP 측정에 noise — 더 짧게 */
main {
    animation-duration: 0.12s;
}

/* Leaflet 세계지도 툴팁 */
.leaflet-tooltip-custom {
    background: rgba(30, 64, 175, 0.95);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8125rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.leaflet-tooltip-custom::before {
    border-top-color: rgba(30, 64, 175, 0.95);
}

/* 인쇄 스타일 */
@media print {
    header, footer, nav, #scrollTop, aside { display: none; }
    main { padding: 0; }
    a { text-decoration: underline; }
}
