/* --- 변수 및 기본 스타일 --- */
:root {
    --background-color: #FFFFFF;
    --primary-text-color: #262626;
    --secondary-text-color: #8e8e8e;
    --border-color: #DBDBDB;
    --link-color: #0095f6;
    --button-primary-background: #0095f6;
    --button-primary-text: #FFFFFF;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--primary-text-color);
    margin: 0;
    padding: 0;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--link-color);
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* --- 전체 레이아웃 --- */
.container {
    display: grid;
    grid-template-columns: 244px 1fr;
    min-height: 100vh;
}

@media (min-width: 1024px) {
    .container {
        grid-template-columns: 244px 1fr 293px;
    }
}

@media (min-width: 1280px) {
    .container {
        grid-template-columns: 335px 1fr 380px;
    }
}


/* --- 좌측 사이드바 --- */
.left-sidebar {
    position: fixed;
    width: 244px; /* 너비 고정 */
    height: 100%;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
    box-sizing: border-box;
}

.left-sidebar .logo {
    padding: 25px 12px 16px 12px;
    margin-bottom: 19px;
}

.left-sidebar .logo h1 {
    font-size: 1.5rem;
    font-style: italic;
    margin: 0;
}

.navigation ul li a, .more-menu a {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 1rem;
    color: var(--primary-text-color);
}

.navigation ul li a:hover, .more-menu a:hover {
    background-color: #f2f2f2;
}

.navigation ul li a i, .more-menu a i {
    margin-right: 16px;
    width: 24px;
    height: 24px;
}

.more-menu {
    margin-top: auto; /* 하단에 고정 */
}

/* --- 중앙 피드 --- */
.main-feed {
    grid-column: 2 / 3;
    padding: 20px;
    max-width: 630px;
    margin: 0 auto;
}

.stories-container {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 24px;
    overflow-x: auto; /* 가로 스크롤 */
}

.story-item {
    text-align: center;
    font-size: 0.75rem;
}

.story-item img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #c7c7c7;
    padding: 2px;
}

.feed-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.feed-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info .profile-pic {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.user-info .username {
    font-weight: 600;
}

.user-info .post-time {
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.card-media img {
    width: 100%;
    height: auto;
    max-height: 585px;
    object-fit: cover;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
}

.main-actions {
    display: flex;
    gap: 16px;
}

.card-actions button i {
    width: 24px;
    height: 24px;
}

.card-text-content {
    padding: 0 16px 16px;
}

.like-count {
    font-weight: 600;
    margin: 4px 0;
}

.post-caption {
    margin: 8px 0;
    line-height: 1.5;
}

.post-caption > span {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; /* 기본적으로 2줄만 표시 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
}

.post-caption.expanded > span {
    -webkit-line-clamp: unset; /* 'expanded' 클래스가 있으면 전체 내용 표시 */
}

.more-btn {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    font-weight: 500;
}

.view-comments-link {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}


/* --- 우측 사이드바 --- */
.right-sidebar {
    grid-column: 3 / 4;
    padding: 20px;
    display: none; /* 기본 숨김 */
}

@media (min-width: 1024px) {
    .right-sidebar {
        display: block;
    }
}

.current-user-profile, .recommendations ul li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.current-user-profile img, .recommendations ul li img {
    border-radius: 50%;
}

.user-details, .rec-user-details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.username {
    font-weight: 600;
    font-size: 0.9rem;
}

.full-name, .follower-info {
    color: var(--secondary-text-color);
    font-size: 0.8rem;
}

.switch-btn, .follow-btn {
    font-size: 0.75rem;
    font-weight: 600;
}

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.rec-header span {
    font-weight: 600;
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.rec-header a {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-text-color);
}

.page-footer {
    margin-top: 32px;
    font-size: 0.75rem;
    color: #c7c7c7;
}

/* --- 반응형 --- */
@media (max-width: 1023px) {
    .right-sidebar {
        display: none;
    }
}

@media (max-width: 767px) {
    .container {
        grid-template-columns: 72px 1fr;
    }
    .left-sidebar {
        width: 72px; /* 아이콘만 보이도록 너비 축소 */
    }
    .left-sidebar .logo h1, .navigation span, .more-menu span {
        display: none; /* 텍스트 숨김 */
    }
    .left-sidebar .logo {
        padding: 20px 12px;
    }
    .navigation ul li a, .more-menu a {
        justify-content: center;
    }
    .navigation ul li a i, .more-menu a i {
        margin-right: 0;
    }
}
