/* ===== CSS Variables (Light / Dark) ===== */
:root {
    --bg: #f0f0f4;
    --surface: #ffffff;
    --surface2: #f8f9fa;
    --text: #111111;
    --text-secondary: #555555;
    --text-muted: #999999;
    --border: #e8e8ee;
    --accent: #3b82f6;
    --accent-bg: #eff6ff;
    --header-bg: #ffffff;
    --footer-bg: #f8f9fa;
    --code-bg: #f1f5f9;
    --pre-bg: #1e293b;
    --pre-text: #e2e8f0;
    --shadow: rgba(0,0,0,0.07);
    --shadow-hover: rgba(59,130,246,0.12);
    --blockquote-bg: #eff6ff;
    --blockquote-text: #444;
    --tip-bg: #f0fdf4;
    --tip-border: #86efac;
    --tag-bg: #eff6ff;
    --tag-text: #3b82f6;
}

[data-theme="dark"] {
    --bg: #0f1117;
    --surface: #1a1b26;
    --surface2: #16161e;
    --text: #e2e2e2;
    --text-secondary: #aaaaaa;
    --text-muted: #666666;
    --border: #2a2a3e;
    --accent: #6b8ef7;
    --accent-bg: #1a1f3a;
    --header-bg: #13131f;
    --footer-bg: #13131f;
    --code-bg: #1e293b;
    --pre-bg: #0d1117;
    --pre-text: #c9d1d9;
    --shadow: rgba(0,0,0,0.3);
    --shadow-hover: rgba(107,142,247,0.15);
    --blockquote-bg: #1a1f3a;
    --blockquote-text: #aaa;
    --tip-bg: #0d2018;
    --tip-border: #166534;
    --tag-bg: #1a1f3a;
    --tag-text: #6b8ef7;
}

/* ===== Base ===== */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    color: var(--text);
    font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    transition: background-color 0.2s, color 0.2s;
}

.main {display: flex; height: calc(100vh - 85px);}
.right, .left {flex: 1; flex-basis: 250px;}
.container {flex: 10; display: flex; gap: 10px; padding: 10px; height: 98%;}
main {height: 65px;}
ul {margin: 0; padding: 0;}

/* ===== Header ===== */
.site__header {
    background-color: var(--header-bg);
    padding: 0 1.5rem;
    box-sizing: border-box;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0.5rem;
    box-shadow: 0px 2px 4px -1px rgba(0,0,0,0.06), 0px 4px 6px -1px rgba(0,0,0,0.1);
    transition: background-color 0.2s, box-shadow 0.2s;
    border-bottom: 1px solid var(--border);
}

.brand {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.brand--point { color: var(--accent); }

.menu {
    list-style: none;
    display: flex;
    align-items: center;
    height: 64px;
}

.menu li {
    height: 100%;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.menu li a {
    text-decoration: none;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.875rem;
    transition: color 0.2s;
    padding: 0 1rem;
    z-index: 1;
    user-select: none;
}

.menu li a:after {
    position: absolute;
    left: 0;
    bottom: 0;
    content: '';
    width: 100%;
    height: 0px;
    background-color: var(--accent);
    transition: height 0.15s ease-in-out;
}

.menu li a:hover { color: var(--accent); }
.menu li a:hover:after { height: 3px; }
.menu li a.active { color: var(--accent); font-weight: 700; }
.menu li a.active:after { height: 3px; }

/* ===== Dark Mode Toggle ===== */
.toggle {
    position: relative;
    display: flex;
    background-color: var(--border);
    width: 42px;
    height: 24px;
    border-radius: 24px;
    cursor: pointer;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.toggle--switch {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: var(--surface);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: left 0.3s cubic-bezier(0.42, 0, 0, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.toggle.active { background-color: var(--accent); }
.toggle.active .toggle--switch { left: calc(100% - 22px); }

/* ===== Footer ===== */
footer {
    text-align: center;
    background-color: var(--footer-bg);
    padding: 20px;
    min-height: 60px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.82rem;
}
footer p { margin: 4px 0; }
footer a { color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* ===== Page Body ===== */
.page-body {
    padding: 20px 24px;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
    background: var(--bg);
    flex: 1;
}

/* ===== Home Page ===== */
.home-wrap { max-width: 900px; margin: 0 auto; padding: 48px 0 80px; }
.home-section { margin-bottom: 56px; }
.home-section-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.service-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s;
    display: block;
}
.service-card:hover { box-shadow: 0 6px 20px var(--shadow-hover); transform: translateY(-2px); }
.service-card-icon { font-size: 1.6rem; margin-bottom: 10px; }
.service-card h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.service-card p { font-size: 0.85rem; color: var(--text-secondary); margin: 0; line-height: 1.6; }

.blog-preview-list { display: flex; flex-direction: column; gap: 10px; }
.blog-preview-item {
    background: var(--surface);
    border-radius: 12px;
    padding: 18px 22px;
    box-shadow: 0 1px 4px var(--shadow);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.2s;
}
.blog-preview-item:hover { box-shadow: 0 4px 14px var(--shadow-hover); }
.blog-preview-item h3 { font-size: 0.92rem; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.blog-preview-item p { font-size: 0.8rem; color: var(--text-secondary); margin: 0; }
.blog-preview-item .arrow { color: var(--accent); font-size: 1rem; flex-shrink: 0; margin-left: 16px; }

/* ===== Tags ===== */
.blog-tag {
    display: inline-block;
    background: var(--tag-bg);
    color: var(--tag-text);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    margin-right: 6px;
    margin-bottom: 4px;
}

/* ===== Blog List ===== */
.blog-wrap { max-width: 820px; margin: 0 auto; padding: 48px 0 80px; }
.blog-list-title { font-size: 1.6rem; font-weight: 900; color: var(--text); margin: 0 0 6px; }
.blog-list-desc { font-size: 0.9rem; color: var(--text-secondary); margin: 0 0 36px; }
.blog-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    display: block;
    margin-bottom: 14px;
    transition: box-shadow 0.2s, transform 0.2s;
}
.blog-card:hover { box-shadow: 0 6px 20px var(--shadow-hover); transform: translateY(-2px); }
.blog-card-tags { margin-bottom: 10px; }
.blog-card h2 { font-size: 1.05rem; font-weight: 800; color: var(--text); margin: 0 0 8px; }
.blog-card p { font-size: 0.87rem; color: var(--text-secondary); margin: 0 0 12px; line-height: 1.7; }
.blog-card-meta { font-size: 0.78rem; color: var(--text-muted); }

/* ===== Blog Post ===== */
.post-wrap { max-width: 760px; margin: 0 auto; padding: 48px 0 100px; }
.post-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 32px;
}
.post-back:hover { text-decoration: underline; }
.post-tags { margin-bottom: 14px; }
.post-title { font-size: 1.8rem; font-weight: 900; color: var(--text); margin: 0 0 12px; line-height: 1.3; }
.post-meta { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 36px; }
.post-divider { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.post-body { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.85; }
.post-body h2 { font-size: 1.25rem; font-weight: 800; color: var(--text); margin: 40px 0 16px; }
.post-body h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); margin: 28px 0 12px; }
.post-body p { margin: 0 0 18px; }
.post-body ul, .post-body ol { padding-left: 24px; margin: 0 0 18px; }
.post-body li { margin-bottom: 6px; }
.post-body a { color: var(--accent); }
.post-body code {
    background: var(--code-bg);
    color: #e02020;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: 'Fira Mono', 'Consolas', monospace;
}
[data-theme="dark"] .post-body code { color: #f87171; }
.post-body pre {
    background: var(--pre-bg);
    color: var(--pre-text);
    border-radius: 10px;
    padding: 20px 24px;
    overflow-x: auto;
    margin: 0 0 20px;
}
.post-body pre code { background: none; color: inherit; padding: 0; font-size: 0.88rem; line-height: 1.7; }
.post-body blockquote {
    border-left: 4px solid var(--accent);
    margin: 0 0 20px;
    padding: 12px 20px;
    background: var(--blockquote-bg);
    border-radius: 0 8px 8px 0;
    color: var(--blockquote-text);
}
.post-body .tip {
    background: var(--tip-bg);
    border: 1px solid var(--tip-border);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
}
.post-body .tip strong { color: #16a34a; }
[data-theme="dark"] .post-body .tip strong { color: #4ade80; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background-color: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background-color: transparent; }
