/* ===== CSS 리셋 및 기본 설정 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #000000;
    color: #ffffff;
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== 컨테이너 ===== */
.container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: #000000;
}

/* ===== 헤더 ===== */
.header {
    position: sticky;
    top: 0;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid #2f2f2f;
    z-index: 100;
}

.header-content {
    padding: 20px;
    text-align: center;
}

.logo {
    font-size: 28px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 5px;
}

.logo i {
    color: #1d9bf0;
    margin-right: 8px;
}

.tagline {
    color: #71767b;
    font-size: 14px;
    font-weight: 400;
}

/* ===== 메인 콘텐츠 ===== */
.main-content {
    padding: 0;
}

.posts-container {
    display: flex;
    flex-direction: column;
}

/* ===== 포스팅 카드 ===== */
.post-card {
    background-color: #000000;
    border: 1px solid #2f2f2f;
    border-radius: 16px;
    padding: 16px 20px;
    margin: 12px 16px;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.post-card:hover {
    background-color: #0a0a0a;
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(45deg, #1d9bf0, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 18px;
    color: white;
}

.post-info h3 {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
}

.post-date {
    color: #71767b;
    font-size: 13px;
}

.post-content {
    margin-left: 10px;
    margin-right: 10px;
}

.post-text {
    color: #ffffff;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

/* ===== Markdown 스타일 ===== */
.post-text h1 {
    color: #ffffff;
    margin: 20px 0 0px 0;
    font-weight: 700;
    line-height: 1;
}

.post-text h2,
.post-text h3,
.post-text h4,
.post-text h5,
.post-text h6 {
    color: #ffffff;
    margin: 0px 0 0px 0;
    font-weight: 700;
    line-height: 1;
}

.post-text h1 { font-size: 24px; }
.post-text h2 { font-size: 20px; }
.post-text h3 { font-size: 18px; }

.post-text p {
    margin-bottom: 0px;
}

.post-text strong {
    color: #ffffff;
    font-weight: 700;
}

.post-text em {
    color: #71767b;
    font-style: italic;
}

.post-text code {
    background-color: #16181c;
    color: #1d9bf0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.post-text pre {
    background-color: #16181c;
    border: 1px solid #2f2f2f;
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
    overflow-x: auto;
}

.post-text pre code {
    background: none;
    padding: 0;
}

.post-text blockquote {
    border-left: 3px solid #1d9bf0;
    padding-left: 16px;
    color: #71767b;
    font-style: italic;
    margin: 12px 0;
}

.post-text a {
    color: #1d9bf0;
    text-decoration: none;
}

.post-text a:hover {
    text-decoration: underline;
}

.post-text ul,
.post-text ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.post-text li {
    margin-bottom: 0px;
}

/* ===== 이미지 갤러리 ===== */
.post-images {
    margin-top: 12px;
}

.images-grid {
    display: grid;
    gap: 4px;
    border-radius: 16px;
    overflow: hidden;
}

.images-grid.grid-1 {
    grid-template-columns: 1fr;
}

.images-grid.grid-2 {
    grid-template-columns: 1fr 1fr;
}

.images-grid.grid-3 {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.images-grid.grid-3 img:first-child {
    grid-row: 1 / 3;
}

.images-grid.grid-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.images-grid.grid-many {
    grid-template-columns: 1fr 1fr;
}

.post-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.post-image:hover {
    opacity: 0.9;
}

.images-grid.grid-2 .post-image,
.images-grid.grid-4 .post-image {
    height: 200px;
}

.images-grid.grid-3 .post-image:first-child {
    height: 400px;
}

.images-grid.grid-3 .post-image:not(:first-child) {
    height: 198px;
}

.more-images {
    position: relative;
}

.more-images::after {
    content: '+' attr(data-count);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
}

/* ===== 이미지 모달 ===== */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    cursor: pointer;
}

.image-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #ffffff;
    font-size: 30px;
    cursor: pointer;
    z-index: 1001;
}

/* ===== 로딩 및 빈 상태 ===== */
.loading,
.no-posts {
    text-align: center;
    padding: 60px 20px;
    color: #71767b;
}

.loading i,
.no-posts i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #1d9bf0;
}

.loading p,
.no-posts p {
    font-size: 16px;
    margin-bottom: 8px;
}

.no-posts .sub-text {
    font-size: 14px;
    color: #5b7083;
}

/* ===== 하단 로딩 ===== */
.bottom-loading {
    display: none;
    padding: 20px;
    text-align: center;
    border-top: 1px solid #2f2f2f;
}

.loading-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #71767b;
    font-size: 14px;
}

.loading-content i {
    color: #1d9bf0;
    font-size: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* ===== 푸터 ===== */
.footer {
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid #2f2f2f;
    color: #71767b;
    font-size: 14px;
}

/* ===== 스크롤바 스타일 ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #000000;
}

::-webkit-scrollbar-thumb {
    background: #2f2f2f;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555555;
}