@font-face {
    font-family: 'localFont';
    src: url('../font/ChironGoRoundTC-VariableFont_wght.ttf') format('truetype');
}

/* ── Light mode (default) ── */
:root {
    --bg: #FFFFFF;
    --bg-section: #F7F7F7;
    --border: #D5D5D5;
    --accent: #0000EE;
    --accent-bg: #E8E8FF;
    --text-primary: #1A1A1A;
    --text-secondary: #5F5F5F;
    --text-muted: #9B9B9B;
    --healthy: #2E7D4F;
    --degraded: #B45309;
    --down: #B91C1C;
    --shadow: rgba(0, 0, 0, 0.06);
}

/* ── Dark mode ── */
[data-theme="dark"] {
    --bg: #1C1917;
    --bg-section: #252220;
    --border: #3D3530;
    --accent: #7BA7F7;
    --accent-bg: #1E2A3A;
    --text-primary: #F0EBE3;
    --text-secondary: #C4B9AE;
    --text-muted: #7A7370;
    --healthy: #4ADE80;
    --degraded: #FBBF24;
    --down: #F87171;
    --shadow: rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Lato", "Helvetica Neue", "Segoe UI", system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 40px 0 40px;
    padding-right: 200px;
    color: var(--text-primary);
    background: var(--bg);
    font-size: 16px;
    line-height: 1.7;
    transition: background 0.2s ease, color 0.2s ease;
}

@media (max-width: 1100px) {
    body { padding-right: 40px; }
}

h1 {
    font-size: 2em;
    margin-bottom: 0;
}

/* ── 상단 헤더 (design2 스타일) ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.brand-name {
    font-size: 2.8rem;
    line-height: 1;
    margin: 0;
    letter-spacing: 0.01em;
}
.brand-name .first { font-weight: 400; }
.brand-name .last { font-weight: 800; }
.brand-alias {
    margin-top: 8px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
}
.brand-role {
    margin-top: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.28em;
    color: var(--text-muted);
}
.brand-contact {
    display: grid;
    grid-template-columns: auto;
    gap: 14px;
    justify-content: end;
}
.brand-contact .info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}
.brand-contact .info-ico {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 1.5px solid var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    color: var(--text-primary);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.brand-contact .info-item:hover .info-ico {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.brand-contact .info-ico svg { display: block; }
.brand-contact .info-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-contact .info-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.brand-contact .info-value { font-size: 0.86rem; color: var(--text-primary); text-decoration: none; }
.brand-contact .info-item:hover .info-value { text-decoration: underline; }

h2 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding-bottom: 9px;
    margin-bottom: 18px;
    background-image: linear-gradient(to right, var(--accent) 0 42px, var(--border) 42px);
    background-position: left bottom;
    background-size: 100% 2px;
    background-repeat: no-repeat;
}

h4 {
    margin-bottom: 4px;
}

p {
    line-height: 1.8;
    color: var(--text-secondary);
}

p b, p strong {
    color: var(--text-primary);
}

.about-quote {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

li {
    line-height: 1.8;
    color: var(--text-secondary);
}

ul {
    padding-left: 1.2em;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

small {
    color: var(--text-muted);
}

blockquote {
    margin: 0 0 0 24px;
    padding: 0;
}

.meta {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: -8px;
    margin-bottom: 8px;
}

.status {
    font-weight: bold;
}

.healthy  { color: var(--healthy); }
.degraded { color: var(--degraded); }
.down     { color: var(--down); }

.responsive-img {
    width: 100%;
    height: auto;
    max-width: 1280px;
    display: block;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px 16px;
    margin: 8px 0;
    background: var(--bg-section);
}

legend {
    font-size: 0.85em;
    color: var(--text-muted);
    padding: 0 4px;
}


/* ── SKILLS (카테고리 + 태그 칩) ── */
.skillset {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 900px;
    margin-left: 24px;
}
.skill-group {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 18px;
    align-items: start;
}
.skill-cat {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-top: 7px;
}
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chip {
    font-size: 0.83rem;
    padding: 5px 13px;
    border: 1px solid var(--border);
    border-radius: 99px;
    color: var(--text-secondary);
    transition: border-color 0.15s ease, color 0.15s ease;
}
.chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.lang-stats {
    margin: 20px 0 0 24px;
    max-width: 560px;
}
.lang-caption {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.lang-bar {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: #E2E2E2;
}
.lang-bar span { height: 100%; }
.lang-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 14px;
}
.lang-legend .item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.84rem;
    color: var(--text-muted);
}
.lang-legend .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.lang-legend b { color: var(--text-primary); font-weight: 600; }

/* ── 토이프로젝트 하위 섹션 라벨 ── */
.muted-note {
    margin-left: 24px;
    color: var(--text-muted);
    font-size: 0.88rem;
}
.subsection {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--text-primary);
    margin: 8px 0 16px 24px;
    padding-left: 12px;
    border-left: 3px solid var(--accent);
}

/* ── 토이프로젝트 카드 (GitHub OG 썸네일) ── */
.pcards {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, 1fr);
    max-width: 920px;
    margin: 0 0 8px 24px;
}
@media (max-width: 900px) {
    .pcards { grid-template-columns: repeat(2, 1fr); }
}
.pcard {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    min-width: 0;
    box-shadow: 0 6px 24px var(--shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.pcard:hover { transform: translateY(-3px); box-shadow: 0 12px 30px var(--shadow); }
.pcard-cover {
    aspect-ratio: 2 / 1;
    flex-shrink: 0;
    overflow: hidden;
}
.pcard-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard-body { padding: 15px 16px 16px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.pcard-titlerow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard-title { font-size: 1rem; font-weight: 800; color: var(--text-primary); }
.pcard-status { font-size: 0.64rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.pcard-status.done { color: var(--healthy); border: 1px solid var(--healthy); }
.pcard-status.dev { color: var(--degraded); border: 1px solid var(--degraded); }
.pcard-desc { font-size: 0.84rem; color: var(--text-secondary); margin: 0; }
.pcard-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.pcard-tag { font-size: 0.72rem; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 99px; padding: 3px 9px; }
.pcard-links { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.pcard-links a { font-size: 0.82rem; color: var(--accent); text-decoration: none; font-weight: 600; }
.pcard-links a:hover { text-decoration: underline; }

/* ── 경력 타임라인 (회사 그룹 + 세로 연결선) ── */
.exp-timeline {
    margin-left: 24px;
}
.exp-group {
    margin-bottom: 8px;
}
.exp-group + .exp-group {
    margin-top: 28px;
}
.exp-group-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding-bottom: 10px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.exp-company {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}
.exp-company small {
    font-weight: 600;
    font-size: 0.72em;
    color: var(--text-muted);
    margin-left: 4px;
}
.exp-badge {
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--healthy);
    border: 1px solid var(--healthy);
    border-radius: 99px;
    padding: 2px 9px;
}
.exp-role {
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.exp-projects {
    position: relative;
    padding-left: 30px;
}
.exp-projects::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 10px;
    bottom: 10px;
    width: 1px;
    background: var(--border);
}
.exp-projects > blockquote {
    position: relative;
    margin-left: 0;
    padding-bottom: 6px;
}
.exp-projects > blockquote::before {
    content: "";
    position: absolute;
    left: -30px;
    top: 9px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    box-sizing: border-box;
}
.exp-timeline hr {
    display: none;
}

/* ── 하위 그룹 (공통/개별 프로젝트 아래 들여쓰기) ── */
.sub-items {
    margin-left: 24px;
    padding-left: 18px;
    border-left: 2px solid var(--border);
}
.sub-items > blockquote { margin-left: 0; }
.sub-items .pcards { margin-left: 0; }
.sub-items .muted-note { margin-left: 0; }

/* ── TOC sidebar ── */
.toc {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 990;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 160px;
}

.toc-item {
    font-size: 0.72em;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 0 2px 8px;
    border-left: 2px solid transparent;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
}

.toc-item:hover {
    color: var(--text-secondary);
}

.toc-item.active {
    color: var(--accent);
    border-left-color: var(--accent);
}

.toc-item.toc-h4 {
    padding-left: 16px;
    font-size: 0.68em;
}

.toc-item.toc-h5 {
    padding-left: 24px;
    font-size: 0.65em;
}

@media (max-width: 1100px) {
    .toc { display: none; }
}

/* ── Sticky header ── */
.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 997;
    background: var(--bg);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    font-weight: 400;
    font-size: 0.95em;
    letter-spacing: 0.01em;
    transform: translateY(-100%);
    transition: transform 0.2s ease, background 0.2s;
    box-shadow: 0 2px 8px var(--shadow);
}

.sticky-header.visible {
    transform: translateY(0);
}

.sticky-header .first { font-weight: 400; }
.sticky-header .last { font-weight: 800; }
.sticky-header .sh-role { font-weight: 400; color: var(--text-muted); }

/* ── 상단 컨트롤 (PDF + 테마 토글) ── */
.top-controls {
    position: fixed;
    top: 9px;
    right: 20px;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 8px;
}

.print-btn {
    height: 32px;
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 0 14px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.print-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Theme toggle ── */
.theme-toggle {
    height: 32px;
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 0 10px 0 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow);
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
}

.theme-toggle:hover {
    border-color: var(--accent);
}

.theme-toggle .toggle-track {
    width: 28px;
    height: 16px;
    background: var(--border);
    border-radius: 99px;
    position: relative;
    flex-shrink: 0;
}

.theme-toggle .toggle-knob {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.2s ease;
}

[data-theme="dark"] .theme-toggle .toggle-knob {
    transform: translateX(12px);
}

.theme-toggle .toggle-label {
    font-size: 0.75em;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 22px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    body {
        margin: 0;
        padding: 16px 12px;
        font-size: 14px;
    }
    h1 { font-size: 1.6em; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .brand-name { font-size: 2rem; }
    .brand-contact { grid-template-columns: 1fr; justify-content: start; }
    .skillset { margin-left: 0; }
    .skill-group { grid-template-columns: 1fr; gap: 8px; }
    .pcards { margin-left: 0; grid-template-columns: 1fr; }
    .subsection { margin-left: 0; }
    .muted-note { margin-left: 0; }
    .sub-items { margin-left: 0; padding-left: 12px; }
    .lang-stats { margin-left: 0; }
    h2 { font-size: 1.2em; }
    h4 { font-size: 0.95em; }
    blockquote {
        margin-left: 0;
    }
    .exp-timeline {
        margin-left: 0;
    }
    .top-controls {
        top: 9px;
        right: 10px;
    }
    .theme-toggle {
        padding: 0 8px 0 6px;
    }
    .sticky-header {
        display: none;
    }
}

/* ── 인쇄 / PDF 저장용 ── */
@media print {
    /* 다크 모드여도 인쇄는 라이트 팔레트 강제 */
    :root, [data-theme="dark"] {
        --bg: #ffffff;
        --bg-section: #f7f7f7;
        --border: #cccccc;
        --accent: #0000EE;
        --text-primary: #111111;
        --text-secondary: #333333;
        --text-muted: #666666;
        --shadow: rgba(0, 0, 0, 0.1);
    }

    /* 배경/색 유지 (스킬바·언어바·밑줄 등) */
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    @page { margin: 14mm; }

    body {
        margin: 0;
        font-size: 12px;
        line-height: 1.55;
    }

    /* 화면 전용 UI 숨김 */
    .top-controls,
    .toc,
    .sticky-header {
        display: none !important;
    }

    /* 인쇄에서 제외할 항목 (인프라 구성도·현재 서비스 상태) */
    .no-print {
        display: none !important;
    }

    /* 인쇄에선 카드 썸네일(OG 이미지) 숨기고 텍스트만 */
    .pcard-cover { display: none !important; }
    .pcards { grid-template-columns: 1fr 1fr; }

    a {
        color: var(--text-primary);
        text-decoration: none;
    }

    /* 항목이 페이지 경계에서 잘리지 않도록 */
    h2 { break-after: avoid; }
    .exp-projects > blockquote,
    .exp-group-head,
    .skill-group,
    .lang-stats,
    .brand-contact {
        break-inside: avoid;
    }
}
