/* 이 페이지만의 추가 토큰. --bg-color/--card-bg/--text-primary/--text-secondary/
   --accent/--accent-hover/--border-color 등 공통 디자인 시스템 토큰은
   MAGAZINE/assets/css/layout.css의 :root/.light-mode가 단일 진앙점이므로
   여기서 다시 정의하지 않고 그대로 상속받아 쓴다. */
:root {
    --accent-gradient: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent-deep) 100%);
    --border-color-hover: rgba(var(--accent-hover-rgb), 0.4);
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius-card: 16px;
    --border-radius-btn: 30px;
    --title-gradient: linear-gradient(to right, #ffffff, #9ca3af);
}

/* Reset and base styles removed for design system integration */

/* 본문 상단 타이틀(h1)을 다른 페이지와 동일한 그라디언트 스타일로 통일 */
.content-wrapper h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.05rem;
    margin-bottom: 15px;
    background: var(--title-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* Control Panel (Counter and View toggler) */
.control-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.counter {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 300;
}

.counter strong {
    color: var(--text-primary);
    font-weight: 600;
}

.view-toggle {
    display: flex;
    gap: 8px;
}

.view-btn {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.view-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-hover);
}

.view-btn.active {
    background-color: var(--accent);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(var(--accent-rgb), 0.3);
}

/* Filter container for countries */
.filter-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 40px;
}

@media (max-width: 900px) {
    .filter-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 560px) {
    .filter-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

.filter-btn {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.968rem;
    font-weight: 400;
    text-align: center;
    line-height: 1.3;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.filter-btn-flag {
    font-size: 1.05em;
    line-height: 1;
}

/* 필터 버튼 인원 수 (NEWS 페이지 .btn-count와 동일한 톤, 살짝 더 작게) */
.btn-count {
    font-size: 0.72rem;
    font-weight: 400;
    opacity: 0.55;
    margin-left: 2px;
    letter-spacing: 0;
}

.filter-btn.active .btn-count {
    opacity: 0.85;
}

.filter-btn:hover {
    border-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.filter-btn.active {
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.4);
    font-weight: 600;
    color: #ffffff;
}

/* Loading & Empty State */
.loading-state, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    text-align: center;
    grid-column: 1 / -1;
}

.loading-state i {
    font-size: 2.5rem;
    color: var(--accent-hover);
    margin-bottom: 15px;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* Missionary List Grid System (Card view) */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 18px;
    transition: var(--transition-smooth);
}

@media (max-width: 1100px) {
    .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
}
@media (max-width: 480px) {
    .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* List view adjustments */
.gallery-grid.list-view {
    grid-template-columns: 1fr;
    gap: 20px;
}

/* Card Component (Grid style) */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-card);
    overflow: hidden;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-8px) scale(1.01);
    border-color: var(--border-color-hover);
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.6), 0 10px 15px -5px rgba(var(--accent-rgb), 0.1);
}

.card-image-wrapper {
    width: 100%;
    height: 240px;
    background-color: #0c101b;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .card-image-wrapper img {
    transform: scale(1.06);
}

/* Default icon if no image */
.card-image-wrapper .no-image-placeholder {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.1);
}

.card-info {
    padding: 22px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}

.badge {
    background-color: var(--accent);
    color: #ffffff;
    border: none;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.year-badge {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.card-info h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.35;
}

.card-name-line {
    display: block;
}

.card-info .eng-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-weight: 300;
}

/* Card layout inside List View */
.gallery-grid.list-view .card {
    flex-direction: row;
    height: 110px;
}

.gallery-grid.list-view .card-image-wrapper {
    width: 110px;
    height: 100%;
    border-bottom: none;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}

.gallery-grid.list-view .card-info {
    padding: 14px 20px;
    justify-content: center;
}

.gallery-grid.list-view .card-info h3 {
    margin-bottom: 3px;
}

.gallery-grid.list-view .card-info .eng-name {
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .gallery-grid.list-view .card {
        flex-direction: column;
        height: auto;
    }
    .gallery-grid.list-view .card-image-wrapper {
        width: 100%;
        height: 260px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

/* Modal Popup Window */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 7, 12, 0.85);
    backdrop-filter: blur(8px);
}

.modal-content {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color-hover);
    border-radius: 20px;
    width: 90%;
    max-width: 760px;
    max-height: 85%;
    overflow-y: auto;
    position: relative;
    z-index: 1010;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.open .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    z-index: 1020;
}

.modal-close:hover {
    background-color: rgba(220, 38, 38, 0.2);
    color: #ef4444;
    border-color: rgba(220, 38, 38, 0.4);
}

.modal-body {
    padding: 50px 40px;
}

/* Modal Inner Design */
.modal-header-profile {
    display: flex;
    gap: 35px;
    margin-bottom: 40px;
}

/* 사진 박스 + (여러 장인 경우) 하단 컨트롤 행을 세로로 묶는 래퍼 */
.modal-profile-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.modal-profile-img {
    width: 180px;
    height: 230px;
    background-color: #0c101b;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-profile-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-profile-img i {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.05);
}

/* 사진이 여러 장일 때 사진 박스 아래에 보여주는 [이전] 점점점 [다음] 컨트롤 */
.modal-img-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.modal-img-nav {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.65rem;
    transition: var(--transition-smooth);
}

.modal-img-nav:hover {
    color: var(--accent-hover);
    border-color: var(--border-color-hover);
}

.modal-img-dots {
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-img-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

body.light-mode .modal-img-dot {
    background-color: rgba(15, 23, 42, 0.2);
}

.modal-img-dot.active {
    background-color: var(--accent-hover);
    transform: scale(1.3);
}

.modal-header-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-header-info h2 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-header-info .eng-name {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.modal-desc {
    font-size: 1.2rem;
    line-height: 1.85;
    color: var(--text-primary);
    white-space: pre-wrap; /* Preserve newlines from WordPress */
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
    text-align: left;
    margin-left: 215px; /* 사진 폭(180px) + 헤더 간격(35px)에 맞춰 이름/직함 시작선과 정렬 */
}

@media (max-width: 550px) {
    .modal-header-profile {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }
    .modal-profile-img {
        width: 150px;
        height: 190px;
    }
    .modal-body {
        padding: 40px 24px;
    }
    .modal-desc {
        margin-left: 0;
    }
}

.role-title {
    font-weight: 200;
}

/* 세 선교사 페이지에서 공통으로 사용하는 바로가기 */
.missionary-page-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px auto 30px;
}

.missionary-page-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 18px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    background-color: var(--card-bg);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    transition: var(--transition-smooth);
}

.missionary-page-nav-link:hover { color: var(--text-primary); border-color: var(--accent-hover); }
.missionary-page-nav-link.active { color: #ffffff; background-color: var(--accent); border-color: var(--accent); }

/* Search Box and Controls alignment */
.right-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    pointer-events: none;
}

.search-box input {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 15px 8px 38px;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
    width: 200px;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    border-color: var(--accent-hover);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
    width: 250px;
}

/* 라이트 모드: 공통 토큰(bg-color/card-bg/text-primary/text-secondary/border-color)은
   layout.css의 .light-mode가 이미 처리하므로, 이 페이지 전용 토큰만 재정의한다. */
.light-mode {
    --border-color-hover: rgba(var(--accent-rgb), 0.3);
    --title-gradient: linear-gradient(to right, #0f172a, #475569);
}
