/* ─────────────────────────────────────────────
   sayu.day — 모던·개성 디자인 시스템
   ───────────────────────────────────────────── */
:root {
  --bg: #F6F4EE;
  --ink: #16151A;
  --muted: #6F6A60;
  --line: #16151A;
  --line-soft: rgba(22, 21, 26, 0.14);
  --accent: #2B2BE8;
  --accent-soft: rgba(43, 43, 232, 0.08);
  --card: #FFFFFF;
  --code-bg: #ECE9E0;
  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  /* 코드 하이라이팅 (라이트) */
  --hl-comment: #8a8578;
  --hl-keyword: #cf222e;
  --hl-string: #0a6640;
  --hl-number: #0550ae;
  --hl-title: #6639ba;
  --hl-type: #953800;
  --hl-var: #24292f;
}
[data-theme="dark"] {
  --bg: #0E0E12;
  --ink: #EDECEF;
  --muted: #8E8B96;
  --line: #EDECEF;
  --line-soft: rgba(237, 236, 239, 0.16);
  --accent: #7B7BFF;
  --accent-soft: rgba(123, 123, 255, 0.12);
  --card: #17161C;
  --code-bg: #1E1D24;
  /* 코드 하이라이팅 (다크) */
  --hl-comment: #8b949e;
  --hl-keyword: #ff7b72;
  --hl-string: #a5d6ff;
  --hl-number: #79c0ff;
  --hl-title: #d2a8ff;
  --hl-type: #ffa657;
  --hl-var: #c9d1d9;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}
::selection { background: var(--accent); color: #fff; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); font-size: 0.82em; letter-spacing: 0; }
.dot { color: var(--accent); }
.wrap { max-width: 780px; margin: 0 auto; padding: 0 24px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 8px 16px; z-index: 100;
}
.skip:focus { left: 0; }

/* ─── 헤더 ─── */
.top {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 2px solid var(--line);
}
.top-in {
  display: flex; align-items: center; gap: 20px;
  height: 64px;
}
.brand {
  font-weight: 800; font-size: 22px; letter-spacing: -0.04em;
  flex-shrink: 0;
}
.brand:hover .dot { animation: blink 0.9s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  padding: 6px 12px; font-weight: 600; font-size: 15.5px;
  border-radius: 999px; transition: all 0.15s ease;
}
.nav a:hover { background: var(--accent-soft); color: var(--accent); }
.nav a.active { background: var(--ink); color: var(--bg); }
.theme-btn {
  border: 1.5px solid var(--line); background: none; color: var(--ink);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  font-size: 15px; line-height: 1; flex-shrink: 0;
  transition: transform 0.3s ease;
}
.theme-btn:hover { transform: rotate(180deg); background: var(--accent-soft); }

/* ─── 히어로 ─── */
.hero { padding: 88px 0 72px; border-bottom: 2px solid var(--line); }
.hero-kicker { color: var(--accent); font-weight: 600; margin: 0 0 20px; }
.cursor { animation: blink 1.1s step-end infinite; }
.hero-title {
  margin: 0;
  font-size: clamp(44px, 9vw, 76px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.05em;
}
.hero-sub { color: var(--muted); font-size: 18px; margin: 24px 0 0; max-width: 480px; }

/* ─── 섹션 ─── */
.sec { padding: 56px 0; }
.sec + .sec { border-top: 1px solid var(--line-soft); }
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 32px;
}
.sec-title {
  margin: 0; font-size: 15px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
}
.sec-more { color: var(--accent); font-weight: 600; }
.sec-more:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ─── 글 목록 ─── */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item { padding: 28px 0; border-bottom: 1px solid var(--line-soft); }
.post-item:first-child { padding-top: 0; }
.pi-meta { display: flex; gap: 14px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.pi-idx { color: var(--accent); font-weight: 700; }
.pi-title {
  margin: 0;
  font-size: clamp(24px, 4.5vw, 34px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.035em;
  transition: color 0.15s ease;
}
.pi-link:hover .pi-title {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}
.pi-excerpt { color: var(--muted); margin: 10px 0 0; font-size: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  border: 1px solid var(--line-soft);
  padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; color: var(--muted);
  transition: all 0.15s ease;
}
a.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ─── 메모 ─── */
.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.note-feed { display: flex; flex-direction: column; gap: 16px; }
.note-card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 18px 20px;
}
.note-time { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.note-body { font-size: 15.5px; }
.note-body > *:first-child { margin-top: 0; }
.note-body > *:last-child { margin-bottom: 0; }

/* ─── 페이지 공통 ─── */
.page-head { padding: 64px 0 40px; border-bottom: 2px solid var(--line); margin-bottom: 40px; }
.page-title {
  margin: 0; font-size: clamp(40px, 8vw, 64px);
  font-weight: 800; letter-spacing: -0.05em; line-height: 1.1;
}
.page-sub { color: var(--muted); margin: 12px 0 0; }
.year-group { margin-bottom: 40px; }
.year {
  font-size: 42px; font-weight: 700; color: transparent;
  -webkit-text-stroke: 1.5px var(--muted);
  margin: 0 0 16px; letter-spacing: 0.02em;
}

/* ─── 글 본문 ─── */
.post { padding: 56px 0; }
.post-head { margin-bottom: 40px; }
.post-date { color: var(--accent); font-weight: 600; margin: 0 0 16px; }
.post-title {
  margin: 0; font-size: clamp(34px, 7vw, 56px);
  font-weight: 800; line-height: 1.18; letter-spacing: -0.045em;
}
.post-head .tags { margin-top: 20px; }
.post-body { border-top: 2px solid var(--line); padding-top: 40px; }

.prose { font-size: 17.5px; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.3;
  margin: 2em 0 0.6em;
}
.prose h1 { font-size: 1.7em; } .prose h2 { font-size: 1.45em; } .prose h3 { font-size: 1.2em; }
.prose p { margin: 1.1em 0; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.prose a:hover { text-decoration-thickness: 3px; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; display: block; margin: 1.6em auto; }
.prose blockquote {
  margin: 1.6em 0; padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--muted); font-style: normal;
}
.prose blockquote p { margin: 0.4em 0; }
.prose code {
  font-family: var(--mono); font-size: 0.85em;
  background: var(--code-bg); padding: 2px 6px; border-radius: 5px;
}
.prose pre {
  background: var(--code-bg); border-radius: 10px;
  padding: 18px 20px; overflow-x: auto; line-height: 1.6;
}
.prose pre code { background: none; padding: 0; font-size: 14px; }
.prose pre code.hljs { display: block; }
.prose hr { border: none; border-top: 2px solid var(--line-soft); margin: 2.5em 0; }

/* ─── 코드 하이라이팅 (highlight.js 토큰, 테마 대응) ─── */
.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-section, .hljs-doctag, .hljs-name { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-meta-string { color: var(--hl-string); }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-link { color: var(--hl-number); }
.hljs-title, .hljs-title.function_, .hljs-built_in, .hljs-class .hljs-title { color: var(--hl-title); }
.hljs-type, .hljs-class, .hljs-tag, .hljs-attribute, .hljs-attr, .hljs-selector-id, .hljs-selector-class { color: var(--hl-type); }
.hljs-variable, .hljs-template-variable, .hljs-params, .hljs-property { color: var(--hl-var); }
.hljs-meta, .hljs-comment.hljs-doctag { color: var(--hl-comment); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }
.hljs-deletion { color: var(--hl-keyword); }

/* ─── 콜아웃 (GFM alert) ─── */
.callout {
  margin: 1.6em 0; padding: 14px 18px;
  border-radius: 10px; border: 1px solid var(--callout-bd);
  border-left: 3px solid var(--callout-ac);
  background: var(--callout-bg);
}
.callout-head {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 6px; font-weight: 700; font-size: 0.94em;
  color: var(--callout-ac); letter-spacing: -0.01em;
}
.callout-icon { font-size: 1em; }
.callout-body > *:first-child { margin-top: 0; }
.callout-body > *:last-child { margin-bottom: 0; }
.callout-body { font-size: 0.96em; }
.callout-note { --callout-ac: #2563eb; --callout-bg: rgba(37,99,235,0.06); --callout-bd: rgba(37,99,235,0.2); }
.callout-tip { --callout-ac: #16a34a; --callout-bg: rgba(22,163,74,0.06); --callout-bd: rgba(22,163,74,0.2); }
.callout-important { --callout-ac: #7c3aed; --callout-bg: rgba(124,58,237,0.06); --callout-bd: rgba(124,58,237,0.2); }
.callout-warning { --callout-ac: #d97706; --callout-bg: rgba(217,119,6,0.07); --callout-bd: rgba(217,119,6,0.22); }
.callout-caution { --callout-ac: #dc2626; --callout-bg: rgba(220,38,38,0.06); --callout-bd: rgba(220,38,38,0.2); }
[data-theme="dark"] .callout-note { --callout-ac: #60a5fa; --callout-bg: rgba(96,165,250,0.1); --callout-bd: rgba(96,165,250,0.24); }
[data-theme="dark"] .callout-tip { --callout-ac: #4ade80; --callout-bg: rgba(74,222,128,0.1); --callout-bd: rgba(74,222,128,0.24); }
[data-theme="dark"] .callout-important { --callout-ac: #a78bfa; --callout-bg: rgba(167,139,250,0.12); --callout-bd: rgba(167,139,250,0.26); }
[data-theme="dark"] .callout-warning { --callout-ac: #fbbf24; --callout-bg: rgba(251,191,36,0.1); --callout-bd: rgba(251,191,36,0.24); }
[data-theme="dark"] .callout-caution { --callout-ac: #f87171; --callout-bg: rgba(248,113,113,0.1); --callout-bd: rgba(248,113,113,0.24); }

/* ─── mermaid 다이어그램 ─── */
.prose pre.mermaid {
  background: var(--card); border: 1px solid var(--line-soft);
  text-align: center; line-height: normal; padding: 20px;
  overflow-x: auto;
}
.prose pre.mermaid:not([data-processed]) { color: transparent; min-height: 40px; }
.prose pre.mermaid svg { max-width: 100%; height: auto; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.35em 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 1.6em 0; font-size: 0.92em; }
.prose th, .prose td { border: 1px solid var(--line-soft); padding: 8px 12px; text-align: left; }
.prose th { background: var(--code-bg); font-weight: 700; }

/* ─── 이전/다음 ─── */
.pn {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 64px; padding-top: 32px; border-top: 2px solid var(--line);
}
.pn-item { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--line-soft); border-radius: 10px; transition: all 0.15s ease; }
.pn-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.pn-item .mono { color: var(--muted); font-size: 12px; }
.pn-item strong { font-weight: 700; letter-spacing: -0.02em; line-height: 1.35; }
.pn-next { text-align: right; align-items: flex-end; }

/* ─── 링크 ─── */
.link-list { display: flex; flex-direction: column; }
.link-item { padding: 24px 0; border-bottom: 1px solid var(--line-soft); }
.li-title { display: inline-flex; align-items: baseline; gap: 8px; }
.li-title h3 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.025em; transition: color 0.15s ease; }
.li-arrow { color: var(--accent); font-weight: 700; opacity: 0; transition: opacity 0.15s ease; }
.li-title:hover h3 { color: var(--accent); }
.li-title:hover .li-arrow { opacity: 1; }
.li-meta { display: flex; gap: 10px; align-items: center; margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.li-note { color: var(--muted); margin: 10px 0 0; font-size: 15.5px; }

/* ─── 소개 ─── */
.about-body { padding-bottom: 56px; }

/* ─── 페이저 · 빈 상태 · 오류 ─── */
.pager { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 40px 0; }
.pg-btn { color: var(--accent); font-weight: 600; }
.pg-btn.dis { color: var(--muted); opacity: 0.4; }
.pg-cur { color: var(--muted); }
.empty {
  padding: 56px 24px; text-align: center; color: var(--muted);
  border: 1.5px dashed var(--line-soft); border-radius: 12px;
}
.err { padding: 120px 0; text-align: center; }
.err-code { font-size: 15px; color: var(--accent); font-weight: 700; }
.err-title { font-size: clamp(32px, 7vw, 52px); font-weight: 800; letter-spacing: -0.045em; margin: 12px 0 32px; }
.err-back { color: var(--accent); font-weight: 600; }

/* ─── 푸터 ─── */
.foot { border-top: 2px solid var(--line); margin-top: 48px; }
.foot-in { padding: 36px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.foot-brand { font-weight: 800; font-size: 18px; letter-spacing: -0.04em; }
.foot-meta { display: flex; gap: 18px; color: var(--muted); font-size: 13px; align-items: center; }
.foot-meta a:hover { color: var(--accent); }
.foot-admin { opacity: 0.5; }
.foot-admin:hover { opacity: 1; }

/* ─── 모션 ─── */
@media (prefers-reduced-motion: no-preference) {
  .hero, .sec, .post, .page-head { animation: rise 0.5s ease both; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}

/* ─── 반응형 ─── */
@media (max-width: 560px) {
  body { font-size: 16px; }
  .top-in { height: 56px; gap: 10px; }
  .brand { font-size: 19px; }
  .nav a { padding: 5px 9px; font-size: 14px; }
  .hero { padding: 56px 0 48px; }
  .pn { grid-template-columns: 1fr; }
  .pn-next { text-align: left; align-items: flex-start; }
  .note-grid { grid-template-columns: 1fr; }
  .foot-in { flex-direction: column; align-items: flex-start; }
}
