/* ===== 색·크기 토큰 ===== */
:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --text: #1d1d1f;
  --muted: #6b6a66;
  --line: #e4e1da;
  --accent: #3b6cf6;
  --accent-soft: #e8eeff;
  --live: #1f8a4c;   --live-bg: #e3f5ea;
  --wip: #a1580d;    --wip-bg: #fdf0dd;
  --done: #4b5bb8;   --done-bg: #e9ecfb;
  --study: #6b6a66;  --study-bg: #eeece7;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214;
    --surface: #1b1b1e;
    --surface-2: #232327;
    --text: #ececef;
    --muted: #9c9ca4;
    --line: #2e2e33;
    --accent: #7c9cff;
    --accent-soft: #23294a;
    --live: #6fd39a;   --live-bg: #183325;
    --wip: #f2b56b;    --wip-bg: #3a2a15;
    --done: #a3afff;   --done-bg: #252a4a;
    --study: #b3b3ba;  --study-bg: #2a2a2f;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  --bg: #121214;
  --surface: #1b1b1e;
  --surface-2: #232327;
  --text: #ececef;
  --muted: #9c9ca4;
  --line: #2e2e33;
  --accent: #7c9cff;
  --accent-soft: #23294a;
  --live: #6fd39a;   --live-bg: #183325;
  --wip: #f2b56b;    --wip-bg: #3a2a15;
  --done: #a3afff;   --done-bg: #252a4a;
  --study: #b3b3ba;  --study-bg: #2a2a2f;
  --shadow: none;
}

/* ===== 기본 ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.3; letter-spacing: -0.01em; margin: 0; }
.muted { color: var(--muted); }
.icon { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 32px; padding-bottom: 64px; min-height: 70vh; }

/* ===== 머리·꼬리 ===== */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--text); color: var(--bg); font-size: 15px; font-weight: 800;
}
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--muted); padding: 6px 12px; border-radius: 999px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.theme-toggle {
  display: grid; place-items: center; width: 36px; height: 36px; margin-left: 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; padding-top: 24px; padding-bottom: 32px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--muted); }

/* ===== 첫 화면 ===== */
.hero { display: flex; gap: 28px; align-items: flex-start; padding: 16px 0 28px; }
.avatar { width: 112px; height: 112px; border-radius: 50%; border: 1px solid var(--line); flex: none; object-fit: cover; }
.handle { margin: 0 0 2px; color: var(--muted); font-weight: 500; }
.hero h1 { font-size: 34px; font-weight: 800; }
.tagline { margin: 6px 0 0; font-size: 19px; font-weight: 600; }
.intro { margin: 10px 0 0; color: var(--muted); max-width: 620px; }
.link-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 15px;
}
.pill:hover { background: var(--surface-2); text-decoration: none; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.now { padding: 18px 22px; }
.now-title { font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.now ul { margin: 0; padding-left: 18px; }
.now li + li { margin-top: 2px; }

/* ===== 구역 ===== */
.section { margin-top: 48px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.section-head h2 { font-size: 22px; font-weight: 750; }
.more { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 15px; white-space: nowrap; }

.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 30px; font-weight: 800; }
.page-head p { margin: 6px 0 0; }

/* ===== 프로젝트 카드 ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project { display: flex; flex-direction: column; padding: 20px; transition: transform .15s ease, border-color .15s ease; }
.project:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.project[hidden] { display: none; }
.project-top { display: flex; align-items: center; justify-content: space-between; }
.project-emoji {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--surface-2); font-size: 24px;
}
.status { font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.status-live { color: var(--live); background: var(--live-bg); }
.status-wip { color: var(--wip); background: var(--wip-bg); }
.status-done { color: var(--done); background: var(--done-bg); }
.status-study { color: var(--study); background: var(--study-bg); }
.project-title { font-size: 18px; font-weight: 750; margin-top: 14px; }
.project-summary { margin: 6px 0 0; color: var(--muted); font-size: 15px; flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 14px 0 0; }
.tags li { font-size: 12.5px; color: var(--muted); background: var(--surface-2); padding: 2px 9px; border-radius: 6px; }
.project-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.project-links a { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 14.5px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filter {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted);
}
.filter:hover { color: var(--text); }
.filter[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter .count { opacity: .6; font-weight: 500; margin-left: 2px; }

/* ===== 글 목록 ===== */
.post-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.post-list li { border-bottom: 1px solid var(--line); }
.post-row { display: flex; align-items: baseline; gap: 16px; padding: 14px 4px; color: var(--text); }
.post-row:hover { text-decoration: none; background: var(--surface-2); }
.post-row time { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; flex: none; }
.post-row-title { font-weight: 600; flex: 1; }
.post-row-tag { font-size: 12.5px; color: var(--muted); background: var(--surface-2); padding: 2px 9px; border-radius: 6px; flex: none; }
.year-group + .year-group { margin-top: 32px; }
.year { font-size: 16px; color: var(--muted); margin-bottom: 8px; }

/* ===== 글 본문 ===== */
.post { max-width: 720px; margin: 0 auto; }
.post-head { margin-bottom: 28px; }
.post-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.post-head h1 { font-size: 32px; font-weight: 800; }
.lead { font-size: 18px; margin: 10px 0 0; }
.prose { font-size: 17px; line-height: 1.8; }
.prose h2 { font-size: 23px; margin: 40px 0 12px; }
.prose h3 { font-size: 19px; margin: 28px 0 8px; }
.prose p, .prose ul, .prose ol, .prose table, .prose pre, .prose blockquote { margin: 0 0 18px; }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.prose pre { background: var(--surface-2); padding: 16px; border-radius: 12px; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { border-left: 3px solid var(--line); padding-left: 16px; color: var(--muted); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.prose th { font-weight: 700; }
.prose img { border-radius: 12px; }
.post-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); font-weight: 600; }

/* ===== 휴대폰 ===== */
@media (max-width: 640px) {
  .main { padding-top: 20px; }
  .hero { flex-direction: column; gap: 16px; padding-top: 4px; }
  .avatar { width: 88px; height: 88px; }
  .hero h1 { font-size: 28px; }
  .tagline { font-size: 17px; }
  .grid { grid-template-columns: 1fr; }
  .section { margin-top: 40px; }
  .post-row { flex-wrap: wrap; gap: 4px 12px; }
  .post-row-title { flex-basis: 100%; order: 3; }
  .post-head h1 { font-size: 26px; }
  .prose { font-size: 16px; }
}
