/*
* 파일명: church.css
* 경로: /public_html/assets/css/
* 기능: 풍기삼일교회 전용 테마 (랜딩/헤더/공통 컴포넌트)
* 작성일: 2026-06-14
* 수정일: 2026-06-15
*/

/* ===================================
* 디자인 토큰
* =================================== */
:root {
    --ch-primary: #1f3a5f;        /* 교회 네이비 */
    --ch-primary-dark: #16293f;
    --ch-accent: #c8a35b;         /* 따뜻한 골드 */
    --ch-accent-dark: #a9863f;
    --ch-bg-soft: #f5f3ee;        /* 부드러운 베이지 */
    --ch-text: #2b2b2b;
    --ch-muted: #6c757d;
    --ch-radius: 12px;
    --ch-shadow: 0 2px 10px rgba(31, 58, 95, 0.08);

    /* style.css 헤더 변수 재정의 → 흰색 네비 테마 (로고가 파란색이라) */
    --header-bg: #ffffff;
    --header-border: #eceae5;
    --header-text: #333333;            /* 메뉴 기본 글자 */
    --header-text-white: #1f3a5f;      /* 호버/활성 글자(네이비) */
    --header-accent: #c8a35b;          /* 활성 하단 액센트(골드) */
    --header-hover: rgba(31, 58, 95, 0.06); /* 호버 배경(옅은 네이비) */
}

/* 모바일 토글 아이콘: 흰 배경에 맞춰 어둡게 */
.clien-header .navbar-toggler { color: var(--ch-primary); }
.clien-header .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(31,58,95,1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

html { scrollbar-gutter: stable; }
/* style.css의 height:100% 는 body를 1뷰포트로 가둬 sticky 헤더가 풀림 →
   콘텐츠 높이만큼 늘어나도록 override (네비 상단 고정 유지) */
html, body { height: auto; min-height: 100%; }

body {
    color: var(--ch-text);
    word-break: keep-all;
}

/* ===================================
* 헤더 (네비게이션) — 교회 네이비
* =================================== */
.clien-header {
    background: #fff;
    border-bottom: 1px solid #eceae5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;       /* 스크롤해도 상단 고정 */
    top: 0;
    z-index: 1030;
}
.clien-header .navbar-brand { padding-top: 0; padding-bottom: 0; }
.clien-header .ch-logo { height: 44px; width: auto; display: block; }
.clien-header .nav-link { color: #333; font-weight: 500; }
.clien-header .nav-link:hover,
.clien-header .nav-link.active { color: var(--ch-primary); }
.clien-header .dropdown-menu { border: none; box-shadow: var(--ch-shadow); }
.clien-header .dropdown-item:active { background: var(--ch-primary); color: #fff; }

@media (max-width: 480px) {
    .clien-header .ch-logo { height: 36px; }
}

/* ===================================
* Hero (랜딩 대표 영역)
* =================================== */
.ch-hero {
    position: relative;
    /* 컨테이너(main) 밖으로 빼내 화면 전체 폭(100vw)으로 확장 */
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-top: -1.5rem;            /* main의 py-4 상단 패딩 상쇄 */
    /* 밝은 노을 이미지가 살아나도록 오버레이를 옅게(상단 더 밝게) + 글씨는 그림자로 가독성 확보 */
    background: linear-gradient(rgba(22, 41, 63, 0.28), rgba(22, 41, 63, 0.45)),
                url('../images/hero_bg.webp') center / cover no-repeat;
    color: #fff;
    padding: 7rem 1rem;
    text-align: center;
    border-radius: 0;
}
.ch-hero h1, .ch-hero p, .ch-hero .ch-verse {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.ch-hero h1 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 800;
    margin-bottom: 1rem;
}
.ch-hero p.lead { font-size: 1.15rem; color: #fff; }
.ch-hero .ch-verse {
    margin-top: 1.5rem;
    font-style: italic;
    color: var(--ch-accent);
}

/* ===================================
* 섹션 공통
* =================================== */
.ch-section { padding: 3rem 0; }
.ch-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ch-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}
.ch-section-title small { display: block; color: var(--ch-accent); font-size: 0.95rem; font-weight: 600; }

/* 예배 안내 카드 */
.ch-worship-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: var(--ch-radius);
    box-shadow: var(--ch-shadow);
    padding: 1.5rem;
    height: 100%;
    text-align: center;
}
.ch-worship-card .ch-worship-icon {
    font-size: 2rem;
    color: var(--ch-accent);
    margin-bottom: 0.5rem;
}
.ch-worship-card h5 { font-weight: 700; color: var(--ch-primary); }
.ch-worship-card .ch-time { font-size: 1.05rem; font-weight: 600; }

/* 최근 글 리스트 */
.ch-list { list-style: none; padding: 0; margin: 0; }
.ch-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0.25rem;
    border-bottom: 1px solid #eee;
}
.ch-list li:last-child { border-bottom: none; }
.ch-list a { color: var(--ch-text); text-decoration: none; font-weight: 500; }
.ch-list a:hover { color: var(--ch-primary); }
.ch-list .ch-date { color: var(--ch-muted); font-size: 0.85rem; white-space: nowrap; margin-left: 1rem; }

/* 비전 7대 사역 목록 */
.ch-vision-list { padding-left: 1.25rem; margin: 0; }
.ch-vision-list li {
    padding: 0.4rem 0;
    line-height: 1.6;
    border-bottom: 1px solid #f0f0f0;
}
.ch-vision-list li:last-child { border-bottom: none; }
.ch-vision-list li::marker { color: var(--ch-accent); font-weight: 700; }

/* 강조 버튼 */
.btn-church {
    background: var(--ch-accent);
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    border-radius: var(--ch-radius);
}
.btn-church:hover { background: var(--ch-accent-dark); color: #fff; }

.ch-soft-bg { background: var(--ch-bg-soft); }

/* 버튼은 호버/포커스 시 밑줄 표시 안 함 (style.css의 a:hover 밑줄 무효화) */
.btn:hover,
.btn:focus,
.btn:active { text-decoration: none; }

/* 페이지 공통 히어로 배너 (네이비 그라디언트) */
.ch-page-hero {
    background: linear-gradient(135deg, var(--ch-primary) 0%, var(--ch-primary-dark) 100%);
    color: #fff;
    padding: 3.5rem 1rem 3rem;
    text-align: center;
}
.ch-page-hero .ch-hero-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--ch-accent);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}
.ch-page-hero h1 {
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: #fff;
}
.ch-page-hero p {
    color: rgba(255,255,255,0.7);
    font-size: 0.98rem;
    margin: 0;
}

@media (max-width: 768px) {
    .ch-page-hero { padding: 2.5rem 1rem 2rem; }
}

/* 푸터 */
footer .ch-footer-title { color: var(--ch-primary); font-weight: 700; }

/* 반응형 — MD(768px) 이하 */
@media (max-width: 768px) {
    .ch-hero { padding: 4.5rem 1rem; }
    .ch-section { padding: 2rem 0; }
}

/* ===================================
* 메인 포토갤러리 (모자이크 격자: 첫 항목 크게)
* =================================== */
.ch-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 180px;
    gap: 12px;
}
.ch-gallery-item {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--ch-radius);
    background: #eceae5;
    text-decoration: none;
}
.ch-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;   /* 잘리지 않고 칸 안에 전체가 보이도록 */
    display: block;
}
/* 첫 항목은 2x2로 크게 (스크린샷 레이아웃) */
.ch-gallery-item:first-child {
    grid-column: span 2;
    grid-row: span 2;
}
.ch-gallery-caption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 1.4rem 0.9rem 0.7rem;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.35;
    background: linear-gradient(to top, rgba(0,0,0,0.72), rgba(0,0,0,0));
    opacity: 0;
    transition: opacity 0.2s ease;
}
.ch-gallery-item:hover .ch-gallery-caption,
.ch-gallery-item:focus .ch-gallery-caption { opacity: 1; }
.ch-gallery-date { display: block; font-size: 0.75rem; opacity: 0.85; }

@media (max-width: 768px) {
    .ch-gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 140px; }
    .ch-gallery-caption { opacity: 1; } /* 모바일은 항상 표시 */
}

/* ===================================
* 게시판 갤러리형 목록 (board_view: gallery)
* =================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.gallery-card {
    display: block;
    text-decoration: none;
    color: var(--ch-text);
    border: 1px solid #e9e7e2;
    border-radius: var(--ch-radius);
    overflow: hidden;
    background: #fff;
}
.gallery-card-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #f4f3ef;
    overflow: hidden;
}
.gallery-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;   /* 메인처럼 잘리지 않게 전체 표시 */
    display: block;
}
.gallery-card-noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #c5c2ba;
    font-size: 2rem;
}
.gallery-card-comments {
    position: absolute;
    right: 8px; bottom: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.75rem;
    padding: 1px 8px;
    border-radius: 999px;
}
.gallery-card-body {
    padding: 0.6rem 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.gallery-card-title {
    font-weight: 600;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gallery-card-meta { font-size: 0.78rem; color: var(--ch-muted); }

/* ===================================
* 게시글 상세 — 유튜브 영상 / 사진 그리드 / 사진 모달
* =================================== */
.post-videos .ratio { border-radius: var(--ch-radius); overflow: hidden; background: #000; }

.post-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);   /* 가로 2장씩 */
    gap: 14px;
}
.post-gallery-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e9e7e2;
    cursor: zoom-in;
    display: block;
}
/* 사진이 1장이면 가운데 정렬 + 크게 (원본 비율 유지) */
.post-gallery--single {
    grid-template-columns: 1fr;
    justify-items: center;
}
.post-gallery--single .post-gallery-img {
    width: auto;
    max-width: 100%;
    max-height: 70vh;
    aspect-ratio: auto;
    object-fit: contain;
}
@media (max-width: 575.98px) {
    .post-gallery { gap: 10px; }   /* 모바일도 2열 유지 */
}

#postImageModal .modal-xl { max-width: 96vw; }
.post-modal-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
}
.post-modal-slide img {
    max-width: 100%;
    max-height: 88vh;
    width: auto;
    height: auto;
    object-fit: contain;
}
#postImageModal .carousel-control-prev,
#postImageModal .carousel-control-next { width: 10%; }
#postImageModal .carousel-control-prev-icon,
#postImageModal .carousel-control-next-icon {
    background-color: rgba(0,0,0,0.45);
    border-radius: 50%;
    padding: 14px;
    background-size: 50%;
}

/* ===================================
* 업로드 사진 미리보기 (저장 전 삭제 가능)
* =================================== */
.gallery-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 0.75rem;
}
.gallery-preview-item {
    position: relative;
    width: 110px;
}
.gallery-preview-item img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e9e7e2;
    display: block;
}
.gallery-preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    line-height: 1;
    border: none;
    border-radius: 50%;
    background: #c0392b;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.gallery-preview-name {
    display: block;
    margin-top: 3px;
    font-size: 0.7rem;
    color: var(--ch-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

/* ===================================
* 카카오맵 roughmap 퍼가기 — 전체폭 강제
* =================================== */
.root_daum_roughmap,
.root_daum_roughmap > div,
.root_daum_roughmap iframe {
    width: 100% !important;
    max-width: 100% !important;
}

/* ===================================
* 오시는길 정적지도 마커 (지도 중심 = 교회 위치)
* =================================== */
.ch-map-link { line-height: 0; }
.ch-map-marker {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -100%);   /* 핀 끝이 지도 중심을 가리키도록 */
    text-align: center;
    pointer-events: none;                 /* 클릭은 지도 링크로 전달 */
    line-height: 1;
}
.ch-map-marker i {
    font-size: 2rem;
    color: #e8453c;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.35));
}
.ch-map-marker-label {
    display: inline-block;
    margin-bottom: 3px;
    padding: 2px 8px;
    background: var(--ch-primary);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* 갤러리 카테고리 필터 */
.gallery-cat-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.gallery-cat-btn {
    background: #fff;
    border: 1px solid #d7d3c9;
    color: var(--ch-text);
}
.gallery-cat-btn:hover,
.gallery-cat-btn:focus { border-color: var(--ch-accent); color: var(--ch-accent-dark); }
.gallery-cat-btn.active,
.gallery-cat-btn.active:hover,
.gallery-cat-btn.active:focus {
    background: var(--ch-accent);
    border-color: var(--ch-accent);
    color: #fff;
}
