/* ==========================================
   그리스 로마 신화 스토리북 전용 스타일시트
   ========================================== */

.story-box {
    max-width: 700px !important;
    background: #fcf8f0 !important; /* 양가죽/양장 고서의 따스한 아이보리 대리석 톤 */
    border: 3px double #d4af37 !important; /* 황금 복선 테두리 */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 0 40px rgba(212, 175, 55, 0.1) !important;
    color: #2b303a !important; /* 가독성 높은 짙은 차콜 텍스트 */
}

/* 밤 테마 상태에서도 스토리 가독성을 보장하기 위해 고서 무드 고수 */
body.theme-apollon .story-box {
    background: #fdfaf4 !important;
    border-color: #b8860b !important;
}

.story-book-container {
    width: 100%;
    margin-top: 1.5rem;
    position: relative;
    perspective: 1500px; /* 3D 책장 넘김 효과의 원근감 극대화 */
}

.story-page-viewport {
    width: 100%;
    max-height: 480px;
    overflow-y: auto;
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.25);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.45s cubic-bezier(0.645, 0.045, 0.355, 1), opacity 0.4s ease;
    transform-origin: left center;
}

/* 3D 책장 뒤집기 회전 연출 클래스 */
.story-page-viewport.flipping {
    transform: rotateY(-35deg) scale(0.96);
    opacity: 0.3;
}

.story-content-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.story-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(212, 175, 55, 0.2);
    padding-bottom: 0.75rem;
}

.story-page-header h4 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: #b8860b;
    margin: 0;
}

.story-page-badge {
    font-size: 0.75rem;
    background: rgba(212, 175, 55, 0.15);
    color: #b8860b;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-weight: bold;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.story-text-body {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #374151;
    text-align: justify;
    word-break: keep-all;
}

/* 스토리 속 인물 클릭 링크 (독립형 격리 스타일) */
.story-clickable-name {
    color: #b8860b !important;
    border-bottom: 2px dashed rgba(212, 175, 55, 0.7);
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
    padding: 0 2px;
}

.story-clickable-name:hover {
    background: rgba(212, 175, 55, 0.12);
    border-bottom-style: solid;
    color: #d4af37 !important;
}

.story-footer {
    border-top: 1px dashed rgba(212, 175, 55, 0.2);
    padding-top: 1.25rem;
    margin-top: 1rem;
    text-align: center;
}

.story-btn-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.story-nav-btn {
    padding: 0.7rem 1.3rem;
    font-size: 0.85rem;
    font-weight: bold;
    border-radius: 30px;
    border: 1px solid rgba(212, 175, 55, 0.4);
    background: #ffffff;
    color: #b8860b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.story-nav-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.15);
}

.story-nav-btn.next {
    background: #b8860b;
    color: #ffffff;
    border-color: #b8860b;
}

.story-nav-btn.next:hover {
    background: #d4af37;
    border-color: #d4af37;
    color: #ffffff;
}

.story-nav-btn.clear {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
    width: 100%;
}

.story-nav-btn.clear:hover {
    background: #059669;
    border-color: #059669;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

/* ==========================================
   2D 일러스트 미니 팝업 카드 레이아웃 (완벽 격리)
   ========================================== */

.story-profile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000; /* 모든 레이어 위 최상단 */
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.story-profile-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.story-profile-card {
    width: 280px;
    background: #ffffff;
    border-radius: 16px;
    border: 3px solid #d4af37;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    padding: 1.5rem;
    text-align: center;
    position: relative;
    transform: scale(0.85);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.story-profile-overlay.active .story-profile-card {
    transform: scale(1);
}

.story-profile-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
}

.story-profile-img-wrapper {
    width: 100%;
    height: 300px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 1px solid rgba(212, 175, 55, 0.3);
    background: #0d1117;
}

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

#story-profile-name {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: #1f2937;
    font-weight: 700;
}
