:root {
  color-scheme: dark;
  --bg: #000000;
  --ink: #fafafa;
  --ink-2: #a3a3a3;
  --line: #262626;
  --surface: #111111;
  --on-ink: #000000;
  --display: 'Hahmlet', 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', sans-serif;
  --body: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --top: 60px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--top); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.65; word-break: keep-all; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
:focus-visible { outline: 3px solid #ffffff; outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--on-ink); padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }

/* 상단 */
.top { position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(18px, 4vw, 48px); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); }
.mark { font-family: var(--display); font-weight: 800; font-size: 19px; text-decoration: none; letter-spacing: -0.01em; }
.top nav { display: flex; gap: clamp(14px, 2.4vw, 30px); font-size: 15px; }
.top nav a { text-decoration: none; color: var(--ink-2); padding: 6px 0; }
.top nav a:hover { color: var(--ink); }

/* 첫 화면 */
.hero { padding: clamp(56px, 11vh, 130px) clamp(18px, 4vw, 48px) clamp(48px, 8vh, 96px); max-width: 1320px; margin: 0 auto; }
.hero h1 { font-family: var(--display); font-weight: 800; font-size: clamp(38px, 7.2vw, 104px); line-height: 1.12; letter-spacing: -0.035em; }
.hero .line { display: block; overflow: hidden; padding-bottom: 0.08em; }
.hero .line > span { display: inline-block; transform: translateY(105%); animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.hero .line:nth-child(2) > span { animation-delay: 0.12s; }
.hero .line:nth-child(3) > span { animation-delay: 0.24s; }
@keyframes rise { to { transform: none; } }
.lede { max-width: 62ch; margin-top: clamp(22px, 4vh, 40px); font-size: clamp(17px, 1.5vw, 20px); color: var(--ink-2); opacity: 0; animation: fade 0.8s 0.7s forwards; }
@keyframes fade { to { opacity: 1; } }
.index { margin-top: clamp(36px, 7vh, 72px); display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--ink); opacity: 0; animation: fade 0.8s 0.9s forwards; }
.index a { display: block; padding: 16px 16px 18px 0; text-decoration: none; border-bottom: 1px solid var(--line); height: 100%; position: relative; }
.index a::before { content: ''; position: absolute; left: 0; top: -1px; height: 3px; width: 0; background: var(--c); transition: width 0.35s; }
.index a:hover::before, .index a:focus-visible::before { width: calc(100% - 16px); }
.index b { display: block; font-family: var(--display); font-size: clamp(17px, 1.6vw, 22px); font-weight: 800; letter-spacing: -0.02em; }
.index span { display: block; font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.index [data-c='jelly'] { --c: #ff5d8f; }
.index [data-c='seoul'] { --c: #f08a24; }
.index [data-c='atlas'] { --c: #3aa7c9; }
.index [data-c='agentlab'] { --c: #ffffff; }

/* 프로젝트: 화면에 붙어 있는 동안 스크롤이 장면을 움직인다 */
.projects { padding: 0 clamp(10px, 2vw, 28px); }
.pin { height: 190vh; position: relative; }
.card { position: sticky; top: calc(var(--top) + 8px); height: calc(100vh - var(--top) - 24px); min-height: 520px; border-radius: 28px; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.9fr); background: var(--card-bg); color: var(--card-ink); }
.scene { position: relative; min-height: 0; background: var(--scene-bg, transparent); }
.scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.copy { padding: clamp(22px, 3.2vw, 48px); display: flex; flex-direction: column; justify-content: safe center; gap: clamp(8px, 1.4vh, 16px); overflow: auto; min-height: 0; }
.kind { font-size: 14px; font-weight: 600; color: var(--card-accent); display: flex; align-items: center; gap: 10px; }
.wip { font-size: 12px; font-weight: 700; color: var(--card-bg); background: var(--card-warn, var(--card-accent)); padding: 1px 8px; border-radius: 999px; }
.card h2 { font-family: var(--card-display, var(--display)); font-weight: 800; font-size: clamp(34px, 4.4vw, 64px); line-height: 1.08; letter-spacing: -0.03em; }
.sum { font-size: clamp(15.5px, 1.25vw, 18px); max-width: 46ch; }
.facts { display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--card-line); }
.facts > div { display: grid; grid-template-columns: 6.2em 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--card-line); font-size: 15px; }
.facts dt { color: var(--card-muted); }
.facts dd { font-weight: 600; font-variant-numeric: tabular-nums; }
.role { font-size: 15px; color: var(--card-muted); max-width: 50ch; }
.role b { color: var(--card-ink); margin-right: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: 13px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--card-line); color: var(--card-muted); }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 4px; font-size: 15px; }
.links a { text-underline-offset: 4px; }
a.go { display: inline-block; text-decoration: none; font-weight: 700; padding: 11px 20px; border-radius: 999px; background: var(--card-accent, var(--ink)); color: var(--card-on-accent, var(--on-ink)); transition: transform 0.2s; }
a.go:hover { transform: translateY(-2px); }

.card-jelly { --card-bg: #ffeef2; --card-ink: #3b1c2a; --card-muted: #7d5565; --card-line: #f3c9d5; --card-accent: #e8336f; --card-display: 'Jua', var(--body); }
.card-jelly h2 { letter-spacing: -0.01em; font-weight: 400; }
.card-seoul { --card-bg: #0d1430; --card-ink: #f1f3ff; --card-muted: #a9b2d6; --card-line: #2a3564; --card-accent: #ffc857; --card-on-accent: #1a1405; }
.card-atlas { --card-bg: #e9f0ee; --card-ink: #14303f; --card-muted: #4e6873; --card-line: #c2d2d0; --card-accent: #17627c; }
.card-atlas h2 { font-weight: 600; }
.card-agentlab { --card-bg: #000000; --card-ink: #fafafa; --card-muted: #8c8c8c; --card-line: #242424; --card-accent: #ffffff; --card-on-accent: #000000; --card-warn: #fbbf24; --card-display: 'JetBrains Mono', ui-monospace, monospace; }
.card-agentlab { box-shadow: inset 0 0 0 1px #262626; }
.card-agentlab h2 { font-weight: 700; letter-spacing: -0.04em; }

/* 이력 */
.about { max-width: 1320px; margin: 0 auto; padding: clamp(64px, 12vh, 140px) clamp(18px, 4vw, 48px); }
.about h2 { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 4vw, 52px); letter-spacing: -0.03em; margin-bottom: clamp(20px, 4vh, 40px); }
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 48px); }
.cols h3 { font-size: 15px; font-weight: 600; color: var(--ink-2); padding-bottom: 10px; border-bottom: 1px solid var(--ink); }
.cols li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.cols b { display: block; font-weight: 700; line-height: 1.4; }
.cols span { display: block; font-size: 15px; color: var(--ink-2); margin-top: 2px; }
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px clamp(18px, 4vw, 48px); border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }

/* 첫 화면 보강: 상태, 바로가기, 숫자 */
.pillars { margin-top: clamp(20px, 3.5vh, 32px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; opacity: 0; animation: fade 0.8s 0.75s forwards; }
.pillars li { position: relative; padding: 14px 26px 4px 0; border-top: 2px solid var(--ink); }
.pillars li + li { padding-left: 26px; }
.pillars li + li::before { content: '+'; position: absolute; left: -9px; top: -15px; width: 18px; height: 26px; display: grid; place-items: center; background: var(--bg); font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1; }
.pillars b { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(18px, 1.6vw, 22px); letter-spacing: -0.02em; line-height: 1.3; }
.badge { display: inline-block; vertical-align: 0.15em; margin-left: 6px; padding: 1px 9px; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-family: var(--body); font-style: normal; font-size: 12px; font-weight: 700; letter-spacing: 0; line-height: 1.6; }
.pillars span { display: block; margin-top: 6px; font-size: 15px; color: var(--ink-2); line-height: 1.6; }
/* 매일 아침 갱신되는 숫자(scripts/update-stats.mjs): 감싼 span이 위의 span 규칙에 걸리지 않게 */
body span[data-stat] { display: inline; margin: 0; font: inherit; color: inherit; }
.top nav a.cta { color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--ink); }
.top nav { align-items: center; }
.top nav a.gh { display: inline-flex; padding: 4px; margin: -4px -4px -4px 0; color: var(--ink-2); }
.top nav a.gh:hover { color: var(--ink); }
.status { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: clamp(18px, 3vh, 28px); padding: 5px 14px 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px #34d39926; }
.hook { margin-top: 18px; opacity: 0; animation: fade 0.8s 0.8s forwards; }
.hook a { display: inline-block; font-weight: 700; text-decoration: none; padding: 10px 18px; border-radius: 12px; background: var(--ink); color: var(--on-ink); transition: transform 0.2s; }
.hook a:hover { transform: translateY(-2px); }
.stats { margin-top: clamp(32px, 6vh, 56px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; opacity: 0; animation: fade 0.8s 0.9s forwards; }
.stats > div { padding: 4px 18px 4px 0; }
.stats > div + div { padding-left: 18px; border-left: 1px solid var(--line); }
.stats dt { font-family: var(--display); font-weight: 800; font-size: clamp(26px, 3vw, 40px); letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stats dt small { font-size: 0.5em; color: var(--ink-2); font-weight: 600; }
.stats dd { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.index { margin-top: clamp(28px, 5vh, 48px); }

/* 일하는 방식 */
.how, .more, .contact { max-width: 1320px; margin: 0 auto; padding: clamp(48px, 9vh, 110px) clamp(18px, 4vw, 48px); }
.how h2, .more h2, .contact h2 { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 4vw, 52px); letter-spacing: -0.03em; line-height: 1.2; }
.how-head { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 4vw, 64px); align-items: end; margin-bottom: clamp(24px, 4vh, 44px); }
.how-head p { color: var(--ink-2); max-width: 46ch; }
.rules { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; counter-reset: rule; }
.rules li { background: var(--surface); border-radius: 20px; padding: 22px 22px 24px; display: flex; flex-direction: column; gap: 10px; counter-increment: rule; }
.rules li::before { content: '0' counter(rule); font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.rules h3 { font-size: 18px; line-height: 1.4; letter-spacing: -0.01em; }
.rules p { font-size: 15px; color: var(--ink-2); flex: 1; }
.rules a { font-size: 14px; font-weight: 600; text-underline-offset: 4px; }
.base { margin-top: 18px; padding: 18px 22px; border-radius: 16px; border: 1px dashed #3a3a3a; font-size: 15.5px; color: var(--ink-2); }
.base b { color: var(--ink); margin-right: 4px; }

/* 카드 안의 문제 해결 줄 */
.wins { display: grid; gap: 8px; }
.wins li { font-size: 14.5px; line-height: 1.6; padding-left: 12px; border-left: 2px solid var(--card-accent); }
.wins b { color: var(--card-accent); margin-right: 6px; }

/* 그 밖의 프로젝트 */
.more h2 { margin-bottom: clamp(20px, 4vh, 40px); }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid article { background: var(--surface); border-radius: 20px; padding: clamp(20px, 2.4vw, 30px); display: flex; flex-direction: column; gap: 10px; }
.grid .meta { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.grid h3 { font-size: clamp(19px, 1.7vw, 23px); line-height: 1.35; letter-spacing: -0.02em; }
.grid p { font-size: 15px; color: var(--ink-2); }
.grid .tags li { --card-line: var(--line); --card-muted: var(--ink-2); }
.grid article > a { font-size: 14px; font-weight: 600; text-underline-offset: 4px; margin-top: auto; }

/* 이력 보강 */
.cols span a { color: var(--ink); font-weight: 600; text-underline-offset: 3px; }
.edu, .skills { margin-top: clamp(36px, 6vh, 64px); }
.edu h3, .skills h3 { font-size: 15px; font-weight: 600; color: var(--ink-2); padding-bottom: 10px; border-bottom: 1px solid var(--ink); }
.edu li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.edu b { display: block; font-weight: 700; }
.edu span { display: block; font-size: 15px; color: var(--ink-2); margin-top: 2px; }
.aplus { display: flex !important; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px !important; }
.aplus i { font-style: normal; font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.path { margin-top: 16px; font-size: 15px; color: var(--ink-2); max-width: 80ch; }
.path b { color: var(--ink); margin-right: 6px; }
.skills dl > div { display: grid; grid-template-columns: 8em 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.skills dt { font-weight: 700; }
.skills dd { color: var(--ink-2); }

/* 연락 */
.contact { padding-bottom: clamp(64px, 12vh, 140px); }
.contact > p { color: var(--ink-2); margin-top: 14px; max-width: 52ch; }
.contact .links { margin-top: 24px; font-size: 16px; }
.contact a.go { font-size: 17px; padding: 13px 24px; }

@media (min-width: 901px) and (max-height: 940px) {
  .card h2 { font-size: clamp(30px, 3.6vw, 52px); }
  .sum { font-size: 15.5px; }
  .facts > div { padding: 5px 0; font-size: 14px; }
  .wins li { font-size: 14px; line-height: 1.55; }
  .role { font-size: 14px; }
}
/* 글이 넘칠 때 (site.js의 fit) */
.pin.dense .card .tags { display: none; }
.pin.dense .sum { font-size: 15px; }
.pin.dense .wins li { font-size: 13.5px; line-height: 1.5; }
.pin.dense .facts > div { padding: 4px 0; }
.pin.unpin { height: auto; margin-bottom: 18px; }
.pin.unpin .card { position: relative; top: 0; height: auto; }
.pin.unpin .copy { overflow: visible; }
@media (min-width: 901px) and (max-height: 860px) {
  .card { grid-template-columns: minmax(0, 0.95fr) minmax(400px, 1.05fr); }
  .card h2 { font-size: clamp(28px, 3.2vw, 44px); }
}
@media (max-width: 1100px) {
  .rules { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .pillars { grid-template-columns: 1fr; }
  .pillars li, .pillars li + li { padding: 14px 0 10px; }
  .pillars li + li { margin-top: 16px; }
  .pillars li + li::before { left: 0; }
  .stats { grid-template-columns: 1fr 1fr; row-gap: 18px; }
  .stats > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .how-head, .grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .top nav a:not(.cta):not(.gh):not([href="/resume/"]) { display: none; }
  .rules { grid-template-columns: 1fr; }
  .skills dl > div { grid-template-columns: 1fr; gap: 2px; }
}

/* 좁은 화면: 고정하지 않고 위에서 아래로 */
@media (max-width: 900px), (max-height: 699px) {
  .index { grid-template-columns: 1fr 1fr; }
  .pin { height: auto; margin-bottom: 18px; }
  .card { position: relative; top: 0; height: auto; grid-template-columns: 1fr; border-radius: 22px; }
  .scene { height: 62vw; min-height: 240px; max-height: 420px; }
  .copy { overflow: visible; }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .index { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero .line > span, .lede, .index, .hook, .stats, .pillars { animation: none; transform: none; opacity: 1; }
  a.go { transition: none; }
}
