/* 1. 전체 레이아웃 구조 */
.post-layout {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 50px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

/* 2. 왼쪽 플로팅 목차 사이드바 */
.toc-sidebar {
    position: sticky;
    top: 100px;
    width: 220px;
    flex-shrink: 0;
    display: none; /* 기본 숨김 (모바일) */
}

@media (min-width: 1150px) {
    .toc-sidebar { display: block; }
}

.toc-container {
    border-left: 2px solid #f1f5f9;
    padding-left: 20px;
}

.toc-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#toc {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#toc a {
    font-size: 0.9rem;
    color: var(--text-gray);
    text-decoration: none;
    line-height: 1.4;
    transition: all 0.2s ease;
    word-break: keep-all;
}

#toc a:hover, #toc a.active {
    color: var(--primary-color);
    font-weight: 600;
    transform: translateX(5px);
}

/* 3. 본문 컨테이너 */
.post-container {
    flex: 1;
    max-width: 800px;
    background: var(--white);
    padding: 3rem;
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    min-width: 0;
}

/* 4. 포스트 헤더 (Shrink 효과 포함) */
.post-header {
    margin-bottom: 2.5rem;
    text-align: center;
    transition: all 0.4s ease;
    padding: 20px 0;
}

.post-header h1 {
    font-size: 2.5rem;
    line-height: 1.3;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    word-break: keep-all;
    transition: all 0.4s ease;
}

.post-header.shrunk {
    margin-bottom: 1.5rem;
    padding: 10px 0;
}

.post-header.shrunk h1 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

/* 5. 본문 콘텐츠 스타일링 */
.post-content {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #374151;
}

.post-content h2 { 
    margin: 3.5rem 0 1.5rem; 
    font-size: 1.8rem; 
    color: var(--text-dark);
    scroll-margin-top: 120px; /* 목차 이동 시 상단 여백 */
}

.post-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2rem auto;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* 6. 코드 블록 및 복사 버튼 (통합 및 수정) */
.post-content pre {
    position: relative;
    max-width: 100%;
    background: #1e293b; /* 어두운 배경색 추가 (버튼 가독성) */
    color: #f8fafc;
    padding: 3rem 1.5rem 1.5rem; /* 버튼 공간 확보 */
    border-radius: 12px;
    overflow-x: auto;
    margin: 2rem 0;
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
}

.copy-button {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.copy-button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.copy-button.copied {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

/* 7. 모바일 대응 */
@media (max-width: 1150px) {
    .post-layout { display: block; padding: 0; }
    .post-container { max-width: 100%; border-radius: 0; padding: 2rem 1.5rem; }
}