:root {
    --font-kr: '-apple-system', 'Apple SD Gothic Neo', 'AppleGothic', sans-serif;
    --font-en: '-apple-system', 'SF Pro Text', 'SF Pro Display', system-ui, -system-ui, sans-serif;
    --primary-color: #3a4c6d;
    --secondary-color: #2980b9;
    --light-bg: #f5f7fa;
    --text-color: #2c3e50;
    --text-light: #555;
    --border-radius: 8px;
}

body {
    font-family: var(--font-kr);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    background-color: #f9f9f9;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navigation styles with improved mobile support */
nav {
    font-family: var(--font-en);
    background-color: var(--primary-color);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

nav .nav-content {
    max-width: 1200px;
    width: 90%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav .logo {
    color: white;
    font-weight: 600;
    text-decoration: none;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

nav .nav-links {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem;
    transition: color 0.3s;
    font-weight: 500;
}

nav a:hover {
    color: #1abc9c;
}

/* Container and layout */
.container {
    max-width: 1200px;
    width: 90%;
    margin: 0 auto;
    padding: 2rem 0;
}

/* Profile section with improved alignment and responsive behavior */
.profile-section {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    margin: 2.5rem 0 3.5rem;
    flex-wrap: wrap;
}

.profile-image-container {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

.profile-image {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.profile-info {
    flex: 1;
    min-width: 300px;
}

.name-title {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.name-title h1 {
    color: var(--primary-color);
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.03em;
    font-size: 2.2rem;
}

.english-name {
    font-family: var(--font-en);
    color: #666;
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}

/* Bio box styling */
.bio-box {
    background-color: var(--light-bg);
    border-left: 5px solid var(--secondary-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    font-size: 0.98rem;
    line-height: 1.7;
    color: var(--text-light);
    margin-top: 1rem;
}

.bio-box p {
    margin: 0 0 0.75rem;
}

.bio-box p:last-child {
    margin-bottom: 0;
}

.bio-box h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.bio-box a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.bio-box a:hover {
    color: #1a5276;
    text-decoration: underline;
}

/* Sections styling */
section {
    margin: 3rem 0;
}

h2 {
    color: var(--primary-color);
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    font-size: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #eee;
}

/* Timeline styling */
.timeline {
    position: relative;
    max-width: 100%;
    margin: 1.5rem 0;
}

.timeline-item {
    padding: 1.5rem;
    position: relative;
    border-left: 3px solid var(--secondary-color);
    margin-left: 1rem;
    background: white;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.timeline-item::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    border: 3px solid var(--secondary-color);
    border-radius: 50%;
    left: -8px;
    top: 24px;
}

.timeline-date {
    font-family: var(--font-en);
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.timeline-content {
    color: var(--text-light);
    line-height: 1.6;
    font-size: 0.98rem;
}

.timeline-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.timeline-content h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.timeline-content ul {
    margin-top: 0.5rem;
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.timeline-content li {
    margin-bottom: 0.5rem;
}

.timeline-content li:last-child {
    margin-bottom: 0;
}

/* Media queries for better responsiveness */
@media (max-width: 900px) {
    .profile-section {
        justify-content: center;
    }

    .profile-info {
        min-width: 100%;
    }
}

@media (max-width: 768px) {
    .profile-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .name-title {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .english-name {
        font-size: 1.1rem;
    }

    .bio-box {
        text-align: left;
    }

    h2 {
        text-align: center;
    }
}

@media (max-width: 600px) {
    nav .nav-content {
        flex-direction: column;
        gap: 1rem;
        padding: 0.5rem 0;
    }

    nav .nav-links {
        justify-content: center;
        gap: 1rem;
    }

    .profile-image {
        width: 180px;
        height: 180px;
    }

    .name-title h1 {
        font-size: 1.8rem;
    }

    .timeline-item {
        margin-left: 0.5rem;
        padding: 1.25rem;
    }

    .timeline-item::before {
        width: 10px;
        height: 10px;
        left: -7px;
    }
}

/* 검색 컨테이너 스타일 */
.search-container {
    margin: 20px 0;
    width: 100%;
}

.search-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    border-color: #007bff;
}

.search-input::placeholder {
    color: #999;
}

.search-type {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

/* 태그 관련 스타일 */
.tags-container {
    margin: 20px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    padding: 5px 12px;
    background-color: #f0f0f0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tag:hover {
    background-color: #e0e0e0;
}

.tag.active {
    background-color: #007bff;
    color: white;
}

.post-tags {
    margin: 10px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.post-tag {
    padding: 3px 8px;
    background-color: #f0f0f0;
    border-radius: 12px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.post-tag:hover {
    background-color: #e0e0e0;
}

.tags-container.hidden {
    display: none;
}

.post-tags.hidden {
    display: none;
}

/* 블로그 카드 스타일 */
.blog-card {
    background-color: #fff;
    border: 1px solid #dfe6e9;
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    display: flex;  /* Flexbox 추가 */
    gap: 1rem;      /* 썸네일과 텍스트 사이 간격 */
}

.blog-card-content {
    flex: 1;        /* 텍스트 영역이 남은 공간을 차지 */
    min-width: 0;   /* 텍스트 오버플로우 방지 */
}

.blog-thumbnail {
    /* 기본은 유연하게 처리 (다른 페이지 레이아웃을 방해하지 않음) */
    width: auto;
    max-width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0;  /* 기존 마진 제거 */
    order: 2;         /* 썸네일을 오른쪽으로 배치 */
    flex-shrink: 0;
}

/* Archive 페이지의 썸네일만 고정 크기로 강제 적용 */
#archives-list .blog-thumbnail {
    width: 300px;   /* 썸네일 고정 너비 */
    height: 200px;  /* 썸네일 고정 높이 */
    object-fit: cover;
    flex-shrink: 0;
}

.blog-card h2 {
    margin: 0 0 0.25rem 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.blog-card p {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.blog-summary {
    max-height: 3.6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.2;
}

.blog-card .read-more {
    display: inline-block;
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.25rem;
    transition: color 0.3s;
}

/* 모바일 대응 */
@media (max-width: 600px) {
    .blog-card {
        flex-direction: column;  /* 모바일에서는 세로로 배치 */
    }

    .blog-thumbnail {
        width: 100%;    /* 썸네일 전체 너비로 */
        order: 1;       /* 썸네일을 상단으로 */
        margin-bottom: 0.75rem;
    }
}

/* 모바일에서 Archive 페이지 썸네일은 가로 채움, 높이는 자동 */
@media (max-width: 600px) {
    #archives-list .blog-thumbnail {
        width: 100%;
        height: auto;
    }
}

/* 마크다운 콘텐츠 스타일 */
.markdown-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
}

/* Archive 포스트의 마크다운 이미지 기본 가운데 정렬 */
/* #post-content은 archives-post.html에서 마크다운 HTML이 들어가는 컨테이너입니다. */
#post-content img {
    display: block;
    margin: 0.75rem auto; /* 위아래 간격 + 가운데 정렬 */
    max-width: 100%;
    height: auto;
}

/* 코드 블록 스타일 */
.markdown-content pre {
    background-color: #f8f9fa;
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.markdown-content code {
    font-family: 'SF Mono', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.9em;
}

/* 인라인 코드 스타일 */
.markdown-content p code,
.markdown-content li code {
    background-color: #f8f9fa;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
    color: #e83e8c;
}

/* 마크다운 기본 요소 스타일 */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.markdown-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.markdown-content blockquote {
    border-left: 4px solid #e9ecef;
    padding-left: 1rem;
    margin-left: 0;
    color: #6c757d;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.markdown-content hr {
    border: 0;
    border-top: 1px solid #e9ecef;
    margin: 2rem 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid #e9ecef;
    padding: 0.5rem;
}

.markdown-content th {
    background-color: #f8f9fa;
}

/* KaTeX 수식 스타일 */
.markdown-content .katex {
    font-size: 0.95em; /* 인라인 수식 크기 */
}

.markdown-content .katex-display {
    font-size: 1.1em; /* 디스플레이 수식 크기 */
    margin: 1.5em 0; /* 디스플레이 수식 상하 여백 */
}

.markdown-content .katex-html {
    overflow-x: auto; /* 긴 수식은 가로 스크롤 허용 */
    overflow-y: hidden;
}

/* 페이지네이션 스타일 */
.pagination-container {
    margin: 2rem 0;
    text-align: center;
}

.pagination {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.page-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    background-color: white;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    min-width: 36px;
    text-align: center;
}

.page-btn:hover {
    background-color: var(--light-bg);
    border-color: var(--secondary-color);
}

.page-btn.active {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-ellipsis {
    padding: 0.5rem 0.25rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.pagination-info {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* 모바일 페이지네이션 */
@media (max-width: 768px) {
    .pagination {
        gap: 0.25rem;
    }

    .page-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
        min-width: 32px;
    }

    .pagination-info {
        font-size: 0.8rem;
    }
}