@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
    --bg-color: #ffffff;
    --sidebar-bg: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --accent-color: #0071e3;
    --border-color: #d2d2d7;
    --callout-bg: #f5f5f7;
    --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --sidebar-width: 300px;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    box-sizing: border-box;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.site-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
}

/* Search */
.search-container {
    position: relative;
    margin-bottom: 2rem;
}
.search-input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
    font-family: var(--font-family);
}
.search-input:focus {
    border-color: var(--accent-color);
}
.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}
.search-results.active {
    display: block;
}
.search-result-item {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    display: block;
    color: var(--text-primary);
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover {
    background-color: #f9f9f9;
}
.search-result-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}
.search-result-excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navigation */
.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}
.nav-links li {
    margin-bottom: 0.2rem;
}
.nav-links a {
    display: block;
    padding: 0.4rem 0.8rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: background-color 0.2s;
}
.nav-links a:hover {
    background-color: rgba(0,0,0,0.05);
    text-decoration: none;
}
.nav-links a.active {
    background-color: var(--accent-color);
    color: #fff;
    font-weight: 500;
}

/* Collapsible Folders (GitBook style) */
details {
    margin-bottom: 0.2rem;
}
details summary {
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    border-radius: 6px;
    user-select: none;
    transition: background-color 0.2s, color 0.2s;
    list-style: none; 
    display: flex;
    align-items: center;
}
details summary::-webkit-details-marker {
    display: none;
}
details summary:hover {
    background-color: rgba(0,0,0,0.05);
    color: var(--text-primary);
}
details summary::before {
    content: '▶';
    font-size: 0.6rem;
    margin-right: 0.6rem;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}
details[open] > summary::before {
    transform: rotate(90deg);
}
details[open] > summary {
    color: var(--text-primary);
}

ul.nested-nav {
    list-style: none;
    padding-left: 0.8rem;
    margin: 0.2rem 0 0.5rem 0.6rem;
    border-left: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 4rem;
    box-sizing: border-box;
}
.content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Typography & Markdown Elements */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 2rem;
    color: #000;
    line-height: 1.2;
}
h2, h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-top: 3rem;
    margin-bottom: 1.2rem;
    color: #111;
}
p {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    word-break: keep-all;
}
a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}
a:hover {
    text-decoration: underline;
}
aside {
    background-color: var(--callout-bg);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
aside h3 {
    margin-top: 0;
    font-size: 1.2rem;
}
aside p {
    font-size: 1rem;
    margin-bottom: 1rem;
}
aside p:last-child {
    margin-bottom: 0;
}
blockquote {
    border-left: 4px solid var(--accent-color);
    margin: 2rem 0;
    padding: 1rem 1.5rem;
    background-color: #f0f7ff;
    border-radius: 0 8px 8px 0;
}
blockquote p {
    margin: 0;
    color: #004d99;
    font-weight: 500;
}
img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin: 2rem 0;
    display: block;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
}
th, td {
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    text-align: left;
}
th {
    background-color: var(--callout-bg);
    font-weight: 600;
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .main-content {
        margin-left: 0;
        padding: 2rem;
    }
}
