/* ── Variables ── */
:root {
    --bg: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-card: #f9f9f9;
    --text: #111111;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e5e5e5;
    --accent: #111111;
    --tag-bg: #f0f0f0;
    --tag-text: #555555;
    --shadow: rgba(0,0,0,0.06);
    --sidebar-w: 220px;
}
[data-theme="dark"] {
    --bg: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #141414;
    --text: #f0f0f0;
    --text-secondary: #888888;
    --text-muted: #555555;
    --border: #222222;
    --accent: #f0f0f0;
    --tag-bg: #1e1e1e;
    --tag-text: #aaaaaa;
    --shadow: rgba(0,0,0,0.4);
}

/* ── Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}
a { color: var(--text); text-decoration: none; }
a:hover { opacity: 0.7; }

/* ── Sidebar ── */
.sidebar-nav {
    width: var(--sidebar-w);
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    border-right: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 28px 20px;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-top { display: flex; flex-direction: column; gap: 28px; }

/* Profile */
.profile-area { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.profile-img-wrap { position: relative; width: 72px; height: 72px; }
.profile-img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); display: block; }
.profile-placeholder {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--bg-secondary); border: 2px solid var(--border);
    display: none; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: 700; color: var(--text-secondary);
}
.profile-name { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.profile-bio { font-size: 0.78rem; color: var(--text-muted); }

/* Menu */
.sidebar-menu { display: flex; flex-direction: column; gap: 2px; }
.menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    font-size: 0.88rem; color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
    position: relative;
}
.menu-item:hover { background: var(--bg-secondary); color: var(--text); opacity: 1; }
.menu-item.active {
    background: var(--bg-secondary);
    color: var(--text);
    font-weight: 600;
}
.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px; border-radius: 2px;
    background: var(--text);
}
.menu-icon { font-size: 0.9rem; width: 18px; text-align: center; }

/* Sidebar bottom */
.sidebar-bottom { display: flex; flex-direction: column; gap: 12px; }
.theme-toggle {
    width: 100%; padding: 9px 12px;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text-secondary);
    cursor: pointer; font-size: 0.85rem; text-align: left;
    transition: border-color 0.15s;
}
.theme-toggle:hover { border-color: var(--text-muted); color: var(--text); }
.sidebar-auth { display: flex; flex-direction: column; gap: 6px; }
.auth-user { font-size: 0.8rem; color: var(--text-muted); display: block; padding: 2px 0; }
.auth-link {
    display: block; font-size: 0.83rem; color: var(--text-secondary);
    padding: 5px 0; background: none; border: none; cursor: pointer;
    text-align: left;
}
.auth-link:hover { color: var(--text); opacity: 1; }

/* ── Main content ── */
.main-wrap {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
}
.container {
    max-width: 860px;
    padding: 0 40px;
    margin: 0 auto;
}

/* ── Hero ── */
.hero { padding: 80px 0 60px; border-bottom: 1px solid var(--border); }
.hero-badge { font-size: 0.72rem; letter-spacing: 2.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 16px; display: block; }
.hero h1 {
    font-size: clamp(2.8rem, 5vw, 4.2rem);
    font-weight: 800; letter-spacing: -2px; line-height: 1.05;
    margin-bottom: 20px;
}
.hero p { font-size: 1rem; color: var(--text-secondary); max-width: 420px; margin-bottom: 32px; line-height: 1.8; }
.hero-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Buttons ── */
.btn-primary {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--accent); color: var(--bg);
    padding: 10px 20px; border-radius: 8px;
    font-size: 0.88rem; font-weight: 600; border: none; cursor: pointer;
}
.btn-primary:hover { opacity: 0.8; }
.btn-outline {
    display: inline-flex; align-items: center; gap: 6px;
    background: transparent; color: var(--text);
    padding: 10px 20px; border-radius: 8px;
    font-size: 0.88rem; font-weight: 500;
    border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--text-secondary); opacity: 1; }
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg); color: var(--text); font-size: 0.85rem; cursor: pointer;
}
.btn:hover { border-color: var(--text-muted); opacity: 1; }
.btn-danger { color: #e74c3c; border-color: #e74c3c; background: transparent; }
.btn-danger:hover { background: #e74c3c; color: #fff; opacity: 1; }
.btn-link { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.82rem; padding: 0; }
.btn-link:hover { color: #e74c3c; }

/* ── Section ── */
.section { padding: 56px 0; border-bottom: 1px solid var(--border); }
.section:last-child { border-bottom: none; }
.section-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 28px; }
.section-header h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.3px; }
.section-more { font-size: 0.82rem; color: var(--text-muted); }
.section-more:hover { color: var(--text); opacity: 1; }

/* ── Post list ── */
.post-list { list-style: none; }
.post-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.post-item:last-child { border-bottom: none; }
.post-title { font-size: 0.92rem; font-weight: 500; color: var(--text); flex: 1; }
.post-title:hover { opacity: 0.7; }
.post-meta { display: flex; gap: 12px; color: var(--text-muted); font-size: 0.78rem; flex-shrink: 0; }

/* ── Portfolio grid ── */
.portfolio-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.portfolio-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex; flex-direction: column;
    height: calc((100vh - 220px) / 3);
    text-decoration: none; color: inherit;
}
.portfolio-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px var(--shadow); opacity: 1; }
.portfolio-img {
    width: 100%; flex: 1;
    object-fit: cover; display: flex;
    align-items: center; justify-content: center;
    background: var(--bg-secondary); font-size: 2rem;
    min-height: 0;
}
.portfolio-info { padding: 12px; flex-shrink: 0; }
.portfolio-info h3 { font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portfolio-link { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.portfolio-link:hover { color: var(--text); opacity: 1; }
.tech-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.tech-tag { font-size: 0.67rem; padding: 2px 7px; border-radius: 20px; background: var(--tag-bg); color: var(--tag-text); }

/* ── Page header ── */
.page-header { padding: 48px 0 28px; border-bottom: 1px solid var(--border); margin-bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; }
.page-header h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -1px; }

/* ── Sidebar-content layout (블로그/게시판) ── */
.content-layout { display: flex; gap: 40px; padding-top: 32px; }
.sub-sidebar { width: 150px; flex-shrink: 0; padding-top: 4px; }
.sub-sidebar h3 { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 10px; }
.category-list { list-style: none; }
.category-list li { margin-bottom: 2px; }
.category-list a { font-size: 0.85rem; color: var(--text-secondary); display: block; padding: 5px 8px; border-radius: 6px; }
.category-list a:hover, .category-list a.active { background: var(--bg-secondary); color: var(--text); opacity: 1; font-weight: 500; }
.content { flex: 1; min-width: 0; }

/* ── Search ── */
.search-form { display: flex; gap: 8px; margin-bottom: 20px; }
.search-form input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 0.88rem; }
.search-form input:focus { outline: none; border-color: var(--text-muted); }

/* ── Board table ── */
.board-table { width: 100%; border-collapse: collapse; }
.board-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 0 10px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.board-table td { padding: 12px 10px; font-size: 0.88rem; border-bottom: 1px solid var(--border); color: var(--text); }
.board-table tr:last-child td { border-bottom: none; }
.board-table tr:hover td { background: var(--bg-secondary); }
.board-table a { color: var(--text); }
.board-table a:hover { opacity: 0.7; }

/* ── Pagination ── */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 28px; }
.pagination a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; color: var(--text-secondary); font-size: 0.82rem; }
.pagination a.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.pagination a:hover { border-color: var(--text-muted); opacity: 1; color: var(--text); }

/* ── Post detail ── */
.post-detail { padding: 40px 0; border-bottom: 1px solid var(--border); }
.post-header { margin-bottom: 28px; }
.post-header h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 10px; }
.post-content { font-size: 0.97rem; line-height: 1.9; white-space: pre-wrap; color: var(--text); min-height: 200px; }
.post-actions { display: flex; gap: 8px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ── Comments ── */
.comments { padding: 36px 0; }
.comments h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 20px; }
.comment-list { list-style: none; margin-bottom: 20px; }
.comment-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-meta { display: flex; gap: 10px; margin-bottom: 5px; font-size: 0.78rem; color: var(--text-muted); }
.comment-meta strong { color: var(--text); }
.comment-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 0.88rem; resize: vertical; margin-bottom: 8px; }
.comment-form textarea:focus { outline: none; border-color: var(--text-muted); }

/* ── Forms ── */
.form-box { max-width: 480px; margin: 60px auto; }
.form-box.wide { max-width: 760px; }
.form-box h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 28px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 0.92rem; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--text-muted); }
.form-group textarea { resize: vertical; }
.form-footer { margin-top: 14px; text-align: center; font-size: 0.83rem; color: var(--text-muted); }
.form-footer a { color: var(--text); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ── Alerts ── */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 18px; font-size: 0.88rem; border: 1px solid; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
[data-theme="dark"] .alert-success { background: #052e16; color: #86efac; border-color: #166534; }
[data-theme="dark"] .alert-error { background: #2d0a0a; color: #fca5a5; border-color: #991b1b; }

/* ── Portfolio detail ── */
.portfolio-detail { padding: 40px 0; }
.portfolio-img-large { width: 100%; max-height: 400px; object-fit: cover; border-radius: 12px; margin-bottom: 24px; border: 1px solid var(--border); }
.portfolio-description { font-size: 0.97rem; line-height: 1.9; white-space: pre-wrap; margin: 14px 0; }
.portfolio-links { display: flex; gap: 10px; margin: 18px 0; }

/* ── Footer ── */
footer { border-top: 1px solid var(--border); margin-top: 20px; }
.footer-inner { padding: 20px 0; font-size: 0.78rem; color: var(--text-muted); }

/* ── Utility ── */
.empty { color: var(--text-muted); text-align: center; padding: 56px 0; font-size: 0.88rem; }

/* ── Responsive ── */
@media (max-width: 1000px) { .portfolio-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar-nav { display: none; }
    .main-wrap { margin-left: 0; }
    .container { padding: 0 20px; }
    .content-layout { flex-direction: column; }
    .sub-sidebar { width: 100%; }
}
