/* 콘텐츠 페이지 전용 정밀 레이아웃 스타일 (269px 고정 너비) */

.board-container {
    max-width: var(--max-width);
    margin: 30px auto;
    padding: 0 20px;
}

/* 좌/우 영역 정밀 분할 레이아웃 (5:5) */
.contents-layout {
    display: flex;
    gap: 24px; /* 좌우 영역 사이의 여백 */
    margin-top: 24px;
    align-items: flex-start;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    min-height: 1000px; /* 고정된 스티키 공간 확보를 위해 최소 높이 설정 */
}

.contents-left {
    flex: 1;
    min-width: 0;
}

.contents-right {
    flex: 1;
    min-width: 0;
    position: sticky;
    top: 60px; /* 요청사항 반영: top 60px */
    z-index: 10;
}

/* 그리드: 2열 자동 비율 배치 */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px; /* 카드간 여백 */
    justify-content: flex-start;
}

/* 텍스트 중심의 초간결 카드 UI */
.ro-card {
    width: 100%; /* 부모(그리드) 비율에 맞게 꽉 차도록 */
    height: auto;
    min-height: 140px; 
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
    overflow: hidden; /* 확장 시 본문 내용 감춤 처리 */
}

.ro-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* 테마 보더 */
.ro-card.theme-purple { border-left: 5px solid #a08cc8; }
.ro-card.theme-red { border-left: 5px solid #e04848; }
.ro-card.theme-gold { border-left: 5px solid #e8a838; }
.ro-card.theme-blue { border-left: 5px solid #4a90d9; }
.ro-card.theme-orange { border-left: 5px solid #ff8c00; }
.ro-card.theme-green { border-left: 5px solid #48c878; }
.ro-card.theme-pink { border-left: 5px solid #ff69b4; }
.ro-card.theme-cyan { border-left: 5px solid #00ced1; }

.card-toggle-area {
    cursor: pointer;
    width: 100%;
}

.card-toggle-area:hover .card-name {
    color: var(--accent);
}

.card-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* 모바일용 인라인 상세 설명 (기본 숨김) */
.mobile-detail {
    display: none; 
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.8;
    white-space: pre-wrap;
    animation: fadeIn 0.3s ease;
}

/* 확장된 카드의 스타일 */
.ro-card.expanded {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.ro-card.expanded .card-desc {
    /* 요약문을 숨기지 않고 펼침으로써 UI 출렁임 완벽 방지 */
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
    white-space: pre-wrap; /* 원문의 줄바꿈 그대로 노출 */
    color: var(--text-primary);
}

/* 카드 내 캡처 이미지 컨테이너 (모바일용) */
.card-capture-container {
    display: none;
    width: 100%;
    margin-top: 16px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
    background: #000;
}

.ro-card.expanded .card-capture-container {
    display: block;
}

/* PC에서는 카드 내부 캡처 숨김 */
@media (min-width: 1025px) {
    .card-capture-container {
        display: none !important;
    }
}

/* 우측 상세 설명 패널 (PC 전용) */
.card-detail-panel {
    background: var(--bg-surface-2);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 24px;
    width: 100%; 
    box-shadow: var(--shadow-md);
    box-sizing: border-box;
    /* 브라우저 화면 바닥을 채우면서 스크롤바가 생성되도록 설정 */
    height: calc(100vh - 100px);
    overflow-y: auto;
}
.detail-empty {
    min-height: 150px;
    padding: 40px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

.detail-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.detail-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.detail-name {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--accent);
    line-height: 1.2;
}

.detail-capture-container {
    width: 100%;
    margin-bottom: 20px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
}

/* 슬라이드 스타일 (버그 수정: display flex 강제 및 너비 고정) */
.slider-wrapper {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    transition: transform 0.3s ease-in-out;
    width: 100%;
}

.slider-slide {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100%;
    position: relative;
    overflow: hidden;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10; /* 버튼이 이미지 위로 확실히 오도록 z-index 상향 */
    transition: background 0.3s;
    font-size: 14px;
}

.slider-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.slider-prev {
    left: 10px;
}

.slider-next {
    right: 10px;
}

.slider-dots {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 10; /* 도트가 이미지 위로 오도록 z-index 상향 */
}

.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background 0.3s;
}

.slider-dot.active {
    background: rgba(255, 255, 255, 1);
}

.detail-capture-container img,
.card-capture-container img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain; /* 가로세로 비율 유지 */
    max-height: 500px; /* 너무 길어지지 않게 제한 */
    background: #000;
}

.detail-desc-full {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 반응형 스마트 인터랙션 */
@media (max-width: 1024px) {
    .board-container { padding: 0 10px; }
    .contents-layout { border-top: none; }
    .contents-left { padding-bottom: 24px; }
    .contents-right { display: none; } /* 모바일에서는 우측 패널을 완전히 숨김 */
    
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(269px, 1fr));
        justify-content: center;
    }
    
    .ro-card {
        width: 100%; /* 모바일에서는 너비를 꽉 차게 조절 가능 */
        max-width: 480px;
        margin: 0 auto;
    }
}

/* === 공통 이미지 모달 === */
#image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

#image-modal.active {
    display: flex;
}

/* 모달 오픈 시 배경 스크롤 방지 */
body.modal-open {
    overflow: hidden !important;
}

.modal-close-x {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    z-index: 10001;
    line-height: 1;
    padding: 10px;
    transition: transform 0.2s;
}

.modal-close-x:hover {
    transform: scale(1.1);
    color: var(--accent);
}

.modal-content-wrapper {
    width: 90%;
    max-width: 1200px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: var(--radius-lg);
    background: transparent;
}

.modal-slider-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modal-slider-wrapper {
    display: flex;
    transition: transform 0.3s ease-out;
    width: 100%;
    height: 100%;
}

.modal-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.modal-bottom-bar {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.btn-modal-close {
    padding: 10px 30px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-modal-close:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

/* 모달 내 슬라이드 버튼 확대 */
#image-modal .slider-btn {
    width: 50px;
    height: 50px;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.3);
}

#image-modal .slider-btn:hover {
    background: rgba(232, 168, 56, 0.8);
    color: #000;
}

@media (max-width: 768px) {
    .modal-content-wrapper {
        width: 100%;
        height: 70vh;
    }
}
