/*
 * CrawlHub 이미지 뷰어 (만화 뷰어 스타일)
 * - 갤러리 이미지 클릭 시 전체화면 오버레이로 열림
 * - 단일 페이지 모드(좌우 넘김) / 세로 스크롤(웹툰) 모드 전환
 * - 키보드(←/→/↑/↓, Esc, f), 클릭 영역, 마우스 휠 지원
 * 정적 자산으로 분리(인라인 script/style 지양 규칙 준수).
 */


/* 사이드바 텍스트 로고 (이미지 로고 대체) */
.civ-logo-text {
    display: inline-block;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--theme-default, #f47a20);
    text-decoration: none;
    line-height: 1;
}

.civ-logo-icon-text {
    display: inline-block;
    font-size: 18px;
    font-weight: 700;
    color: var(--theme-default, #f47a20);
    text-decoration: none;
    line-height: 1;
}

/* 홈 페이지 모듈 카드 호버 (전역 로드되는 이 파일에 함께 둠) */
.civ-home-card {
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    border: 1px solid var(--chart-border, #ecf3fa);
}
.civ-home-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.civ-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: rgba(15, 15, 18, 0.96);
    display: none;
    flex-direction: column;
    overscroll-behavior: contain;
}

.civ-overlay.civ-open {
    display: flex;
}

/* 상단 바 */
.civ-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #f4f4f5;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    z-index: 2;
}

.civ-title {
    flex: 1 1 auto;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.civ-counter {
    flex: 0 0 auto;
    font-size: 13px;
    opacity: 0.85;
    min-width: 64px;
    text-align: center;
}

.civ-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #f4f4f5;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.15s ease;
}

.civ-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.civ-btn.civ-btn-active {
    background: #f47a20;
    color: #fff;
}

.civ-btn svg {
    width: 18px;
    height: 18px;
}

/* 뷰포트(이미지 영역) */
.civ-viewport {
    flex: 1 1 auto;
    position: relative;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* 단일 페이지 모드 */
.civ-viewport.civ-mode-single {
    align-items: center;
}

.civ-viewport.civ-mode-single .civ-page {
    display: none;
    max-width: 100%;
    max-height: 100%;
    margin: auto;
}

.civ-viewport.civ-mode-single .civ-page.civ-page-current {
    display: block;
}

.civ-viewport.civ-mode-single .civ-page img {
    display: block;
    max-width: 100vw;
    max-height: calc(100vh - 56px);
    width: auto;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
}

/* 세로 스크롤(웹툰) 모드 */
.civ-viewport.civ-mode-scroll {
    flex-direction: column;
    align-items: center;
    padding: 8px 0 60px;
}

.civ-viewport.civ-mode-scroll .civ-page {
    display: block;
    width: 100%;
    max-width: 900px;
    text-align: center;
}

.civ-viewport.civ-mode-scroll .civ-page img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto 6px;
}

/* 폭맞춤(가로 100%) 토글 — 단일 모드에서만 의미 */
.civ-viewport.civ-fit-width.civ-mode-single .civ-page img {
    max-width: 100vw;
    max-height: none;
    width: 100%;
}

/* 좌우 클릭 네비 영역 (단일 모드) */
.civ-nav-zone {
    position: absolute;
    top: 56px;
    bottom: 0;
    width: 28%;
    z-index: 1;
    cursor: pointer;
    display: none;
}

.civ-viewport.civ-mode-single ~ .civ-nav-zone,
.civ-overlay.civ-single .civ-nav-zone {
    display: block;
}

.civ-nav-prev {
    left: 0;
}

.civ-nav-next {
    right: 0;
}

/* 하단 화살표 버튼 (단일 모드 보조) */
.civ-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3;
    font-size: 22px;
}

.civ-overlay.civ-single .civ-arrow {
    display: flex;
}

.civ-arrow:hover {
    background: rgba(244, 122, 32, 0.85);
}

.civ-arrow-prev {
    left: 12px;
}

.civ-arrow-next {
    right: 12px;
}

/* 로딩 표시 */
.civ-loading {
    color: #aaa;
    font-size: 13px;
    padding: 40px;
    text-align: center;
}

/* 갤러리 썸네일에 커서/호버 힌트 */
.js-civ-item {
    cursor: zoom-in;
}

body.civ-lock {
    overflow: hidden;
}

@media (max-width: 576px) {
    .civ-title { font-size: 12px; }
    .civ-nav-zone { width: 33%; }
}
