@charset "utf-8";

/* =========================================================
   [1] 공통 설정
========================================================= */
:root {
    --webzine-transition: all 0.25s ease;
}

[data-bs-theme="dark"] {
    --bs-body-color: #e6e6e6;
}


/* =========================================================
   [2] 게시판 리스트 (Webzine)
========================================================= */
.webzine-item {
    display: flex;
    align-items: flex-start;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 15px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--bs-body-color);
    transition: var(--webzine-transition);
    width: 100%;
    box-sizing: border-box;
}

.webzine-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.08);
    border-color: var(--bs-primary);
}

/* 썸네일 */
.webzine-img-wrap {
    width: 160px;
    max-width: 40%;
    height: 110px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 12px;
}

.webzine-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 콘텐츠 */
.webzine-content {
    flex: 1;
    min-width: 0;
    margin-left: 14px;
}

/* 제목 (2줄 제한) */
.gal-subject {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 6px;

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;

    word-break: keep-all;
}

/* 메타 */
.gal-meta {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}


/* =========================================================
   [3] 게시물 본문 이미지 대응
/* =========================================================
   [3] 게시물 본문 이미지 대응 및 스타일
========================================================= */

/* 1. 본문 기본 스타일 (네이버 뉴스 스타일) */
#bo_v_con {
    font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', '맑은 고딕', sans-serif !important;
    font-size: 17px !important; 
    line-height: 1.8 !important; 
    color: #333 !important;
    letter-spacing: -0.03em !important;
    text-align: justify;
    word-break: break-all;
}

/* 2. 문단 간격 (엔터 쳤을 때 여백) */
#bo_v_con p, 
#bo_v_con div {
    margin-bottom: 22px !important;
}

/* 3. 이미지 중앙 정렬 및 모바일 넘침 방지 (PC/모바일 공통 해결) */
#bo_v_img img,
#bo_v_con img {
    max-width: 100% !important; /* 화면 너비보다 크면 자동으로 줄임 */
    height: auto !important;    /* 이미지 비율 유지 */
    display: block !important;  /* 좌우 auto 마진 작동을 위해 블록화 */
    margin: 25px auto !important; /* 위아래 25px 여백 + 좌우 중앙 정렬 */
}

/* 4. 본문 내 링크/태그 (네이버 스타일 파란 박스) */
#bo_v_con a {
    display: inline-block;
    padding: 2px 8px;
    margin: 0 2px;
    border-radius: 4px;
    background-color: #f1f7ff !important; /* 라이트모드 연파랑 배경 */
    color: #0b6ad5 !important;           /* 네이버 블루 글자색 */
    text-decoration: none !important;
    font-size: 0.95em;
    font-weight: 500;
    -webkit-text-fill-color: #0b6ad5 !important; /* 아이폰 색상 방어 */
    transition: all 0.2s ease;
}

/* 링크 마우스 올렸을 때 */
#bo_v_con a:hover {
    background-color: #e2efff !important;
    color: #084a96 !important;
    -webkit-text-fill-color: #084a96 !important;
}

/* 다크모드일 때의 링크 박스 스타일 */
[data-bs-theme="dark"] #bo_v_con a {
    background-color: #2c3e50 !important; /* 어두운 배경 */
    color: #89c4ff !important;           /* 밝은 하늘색 글자 */
    -webkit-text-fill-color: #89c4ff !important;
}

/* 5. 모바일 전용 글자 크기 미세 조정 */
@media (max-width: 576px) {
    #bo_v_con {
        font-size: 16.5px !important;
        line-height: 1.75 !important;
    }
}


/* =========================================================
   [4] 모바일 최적화
========================================================= */
@media (max-width: 576px) {

    .webzine-item {
        padding: 12px;
    }

    .webzine-img-wrap {
        width: 130px;
        height: 90px;
    }

    .gal-subject {
        font-size: 1rem;
    }
}


/* =========================================================
   [5] 다크모드 최적화
========================================================= */
[data-bs-theme="dark"] .webzine-item {
    background-color: #1e1e1e;
    border-color: #333;
}

[data-bs-theme="dark"] .gal-meta,
[data-bs-theme="dark"] .text-muted {
    color: #adb5bd;
}

/* 본문 인라인 컬러 강제 제거 */
[data-bs-theme="dark"] [style*="color"] {
    color: #e1e1e1 !important;
}


/* =========================================================
   [6] 페이지네이션 (충돌 없는 안정형)
========================================================= */
.pg_wrap {
    margin-top: 30px;
    text-align: center;
}

.pg_wrap a,
.pg_wrap strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    margin: 4px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    border: 1px solid var(--bs-border-color);
    background: transparent;
    color: var(--bs-body-color);
}

/* hover */
.pg_wrap a:hover {
    background: rgba(0,0,0,0.05);
}

/* 현재 페이지 */
.pg_wrap strong {
    background: var(--bs-primary);
    color: #fff;
    border-color: var(--bs-primary);
}

/* 포커스 제거 (아이폰 포함) */
.pg_wrap a:focus,
.pg_wrap a:focus-visible,
.pg_wrap a:active {
    outline: none;
    box-shadow: none;
}

.pg_wrap a {
    -webkit-tap-highlight-color: transparent;
}

/* ========== 새로운 카드 그리드 스타일 (대중화된 디자인) ========== */
.board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.8rem;
    margin: 2rem 0;
}

.grid-card {
    position: relative;
    background: var(--bs-body-bg);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 20px rgba(0,0,0,0.03);
    border: 1px solid var(--bs-border-color);
}

.grid-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 30px -12px rgba(0,0,0,0.15);
}

.card-checkbox {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    background: rgba(0,0,0,0.5);
    border-radius: 30px;
    padding: 4px 8px;
    backdrop-filter: blur(4px);
}
.card-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-thumb {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--bs-secondary-bg);
}
.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.grid-card:hover .card-thumb img {
    transform: scale(1.03);
}
.card-category {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 30px;
    font-weight: 500;
    backdrop-filter: blur(2px);
}

.card-body {
    padding: 1rem 1.2rem 1.2rem;
}
.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-excerpt {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    border-top: 1px solid var(--bs-border-color);
    padding-top: 0.7rem;
    margin-top: 0.5rem;
}
.card-meta i {
    margin-right: 4px;
    width: 14px;
}

/* 툴바 (검색/필터) */
.list-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.filter-btn {
    background: none;
    border: none;
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
    cursor: pointer;
    transition: 0.2s;
}
.filter-btn.active {
    background: var(--bs-primary);
    color: white;
}
.search-sort {
    display: flex;
    gap: 12px;
    align-items: center;
}
.search-box {
    display: flex;
    align-items: center;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 40px;
    padding: 6px 12px;
    gap: 6px;
}
.search-box input {
    border: none;
    background: none;
    outline: none;
    font-size: 0.85rem;
    min-width: 180px;
}
.sort-dropdown {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 40px;
    padding: 5px 12px;
}
.sort-dropdown select {
    border: none;
    background: none;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

/* 반응형: 모바일에서 카드 1~2열 */
@media (max-width: 768px) {
    .board-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1rem;
    }
    .card-thumb {
        height: 150px;
    }
    .list-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .search-sort {
        justify-content: space-between;
    }
    .search-box input {
        min-width: 130px;
    }
}

/* 다크모드 호환 */
[data-bs-theme="dark"] .grid-card {
    background: #1e1e2a;
    border-color: #2d2d3a;
}
[data-bs-theme="dark"] .filter-btn.active {
    background: #3b82f6;
}
[data-bs-theme="dark"] .search-box,
[data-bs-theme="dark"] .sort-dropdown {
    background: #2a2a35;
    border-color: #3e3e4a;
}

/* ===== 모바일 툴바 겹침/가려짐 수정 ===== */
@media (max-width: 576px) {
    .list-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.8rem !important;
    }

    /* 필터 그룹: 좌우 스크롤 가능하게 (카테고리가 많을 때 대비) */
    .filter-group {
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .filter-group .filter-btn {
        flex-shrink: 0;
    }

    /* 검색 + 정렬 박스를 세로로 배치하고, 각각 너비 100% */
    .search-sort {
        display: flex;
        flex-direction: column !important;
        gap: 8px;
        width: 100%;
    }
    .search-box {
        width: 100%;
        box-sizing: border-box;
    }
    .search-box input {
        width: 100%;
        min-width: auto;
    }
    .sort-dropdown {
        width: 100%;
        justify-content: space-between;
    }
    .sort-dropdown select {
        flex: 1;
        text-align: right;
    }
}