/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    font-size: 16px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Theme Variables */
:root {
    /* Light Mode */
    --bg-color: #ffffff;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e5e5e5;
    --card-bg: #f8f9fa;
    --link-color: #0066cc;
    --link-hover: #004499;
    --header-bg: rgba(255, 255, 255, 0.95);
    --shadow: rgba(0, 0, 0, 0.1);
}

.dark-mode {
    /* Dark Mode */
    --bg-color: #0f0f0f;
    --text-color: #e5e5e5;
    --text-secondary: #a0a0a0;
    --border-color: #333333;
    --card-bg: #1a1a1a;
    --link-color: #66b3ff;
    --link-hover: #4da6ff;
    --header-bg: rgba(15, 15, 15, 0.95);
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    position: sticky;
    top: 0;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    padding: 1rem 0;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Back Link - 홈으로 돌아가기 링크 */
.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-right: 1rem;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--link-color);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.theme-toggle:hover {
    border-color: var(--link-color);
    background: var(--card-bg);
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    align-items: start;
}

/* Intro Section */
.intro {
    margin-bottom: 3rem;
}

.intro h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.intro-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.7;
}

.social-links {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

/* Pagination Styles - 모든 브라우저 호환성 강화 */
nav.pagination {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.5rem !important;
    margin-top: 3rem !important;
    padding-top: 2rem !important;
    border-top: 1px solid var(--border-color) !important;
}

nav.pagination a.page-link,
.pagination a.page-link,
a.page-link {
    padding: 0.5rem 1rem !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    color: var(--text-color) !important;
    text-decoration: none !important;
    font-size: 0.9rem !important;
    transition: all 0.3s ease !important;
    min-width: 40px !important;
    text-align: center !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

nav.pagination a.page-link:hover:not(.disabled),
.pagination a.page-link:hover:not(.disabled),
a.page-link:hover:not(.disabled) {
    background: var(--link-color) !important;
    color: var(--bg-color) !important;
    border-color: var(--link-color) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
    -webkit-transform: translateY(-2px) !important;
    -moz-transform: translateY(-2px) !important;
    -ms-transform: translateY(-2px) !important;
}

nav.pagination a.page-link.active,
.pagination a.page-link.active,
a.page-link.active {
    background: var(--link-color) !important;
    color: var(--bg-color) !important;
    border-color: var(--link-color) !important;
    font-weight: 500 !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4) !important;
}

nav.pagination a.page-link.disabled,
.pagination a.page-link.disabled,
a.page-link.disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    color: var(--text-secondary) !important;
    background: var(--card-bg) !important;
    pointer-events: none !important;
}

nav.pagination a.page-link.disabled:hover,
.pagination a.page-link.disabled:hover,
a.page-link.disabled:hover {
    transform: none !important;
    box-shadow: none !important;
    background: var(--card-bg) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
    -webkit-transform: none !important;
    -moz-transform: none !important;
    -ms-transform: none !important;
}

/* Chrome 전용 스타일 */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    nav.pagination a.page-link {
        -webkit-box-sizing: border-box !important;
        -webkit-transition: all 0.3s ease !important;
    }
    
    nav.pagination a.page-link:hover:not(.disabled) {
        -webkit-box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
    }
}

/* Firefox 전용 스타일 */
@-moz-document url-prefix() {
    nav.pagination a.page-link {
        -moz-box-sizing: border-box !important;
        -moz-transition: all 0.3s ease !important;
    }
}

.social-links a {
    color: var(--link-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: inline-block;
}

.social-links a:hover {
    background: var(--card-bg);
    border-color: var(--link-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* Blog Posts */
.blog-posts h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.post-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 2rem;
}

.post-item:last-child {
    border-bottom: none;
}

.post-content {
    flex: 1;
}

.post-content h3 {
    margin-bottom: 0.5rem;
}

.post-content h3 a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.4;
}

.post-content h3 a:hover {
    color: var(--link-color);
}

.post-excerpt {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.post-date {
    color: var(--text-secondary);
}

.post-tags {
    display: flex;
    gap: 0.5rem;
}

.tag {
    background: var(--card-bg);
    color: var(--text-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

.post-link {
    flex-shrink: 0;
}

.read-more {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--link-color);
    border-radius: 6px;
    transition: all 0.3s ease;
    display: inline-block;
}

.read-more:hover {
    background: var(--link-color);
    color: var(--bg-color);
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 100px;
}

.sidebar-section {
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.sidebar-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    font-weight: 600;
}

.archive-list,
.category-list,
.recent-posts {
    list-style: none;
}

.archive-list li,
.category-list li,
.recent-posts li {
    margin-bottom: 0.5rem;
}

.archive-list a,
.category-list a,
.recent-posts a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.archive-list a:hover,
.category-list a:hover,
.recent-posts a:hover {
    color: var(--link-color);
}

/* Tag Cloud */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-link {
    background: var(--bg-color);
    color: var(--text-secondary);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.tag-link:hover {
    background: var(--link-color);
    color: var(--bg-color);
    border-color: var(--link-color);
}

.tag-link[data-count="5"],
.tag-link[data-count="6"] {
    font-size: 0.9rem;
    font-weight: 500;
}

.tag-link[data-count="4"] {
    font-size: 0.85rem;
}

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .sidebar {
        position: static;
        order: -1;
    }
    
    .intro h1 {
        font-size: 2rem;
    }
    
    .post-item {
        flex-direction: column;
        gap: 1rem;
    }
    
    .post-link {
        align-self: flex-start;
    }
    
    .social-links {
        flex-wrap: wrap;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .sidebar-section {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .intro h1 {
        font-size: 1.8rem;
    }
    
    .intro-text {
        font-size: 1rem;
    }
    
    .blog-posts h2 {
        font-size: 1.5rem;
    }
    
    .post-content h3 a {
        font-size: 1.1rem;
    }
    
    .theme-toggle {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-item {
    animation: fadeIn 0.6s ease-out;
}

/* Print Styles */
@media print {
    .sidebar,
    .theme-toggle,
    .social-links {
        display: none;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    body {
        background: white;
        color: black;
    }
}