/* CSS variables representing design system */
:root {
    /* --accent/--accent-hover/--accent-gradient는 먼저 로드되는 layout.css의
       :root에서 이미 정의되고, 사이트 테마(키 컬러)의 단일 진앙점을 그 파일
       하나로 유지하기 위해 여기서는 재정의하지 않고 상속만 받는다. */
    --bg-color: #090d16;
    --card-bg: #121824;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.07);
    --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);
    --header-bg: linear-gradient(180deg, rgba(22, 31, 48, 0.8) 0%, rgba(11, 15, 25, 0) 100%);
}

/* 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 months */
.filter-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 40px;
}

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

@media (max-width: 480px) {
    .filter-container {
        grid-template-columns: repeat(3, 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.95rem;
    font-weight: 400;
    text-align: center;
    transition: var(--transition-smooth);
}

.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: rgba(var(--accent-rgb), 0.15);
    color: var(--accent-light);
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    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 .badge:not(.year-badge) {
    background-color: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

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

/* 직함은 이름 아래의 독립된 줄로 표시한다. */
.card-info .role-title {
    display: block;
}

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

.card-info .summary {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
    flex-grow: 1;
}

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

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

.gallery-grid.list-view .card-info {
    padding: 20px 25px;
}

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

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

.gallery-grid.list-view .card-info .summary {
    -webkit-line-clamp: 2;
}

@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-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-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;
}

@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;
    }
}

.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;
}

/* Light Mode overrides */
body.light-mode {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: rgba(15, 23, 42, 0.08);
    --border-color-hover: rgba(var(--accent-rgb), 0.3);
    --title-gradient: linear-gradient(to right, #0f172a, #475569);
    --header-bg: linear-gradient(180deg, rgba(241, 245, 249, 0.8) 0%, rgba(248, 250, 252, 0) 100%);
}

/* Theme Toggle Button style removed for design system integration */
