/* 평평한 색만 씀: 그라데이션·빛 번짐·반투명 유리 효과 없음. 보라는 링크와 숫자에만 */
:root {
  --bg: #262624; --surface: #2d2d2b; --line: #3d3d3a; --text: #f3f1ea; --muted: #a29f95; --faint: #6f6d66;
  --accent: #a78bfa; --code-bg: #1f1f1d; --dot: 243, 241, 234; --dot-hot: 167, 139, 250;
  --code: 'JetBrains Mono', ui-monospace, Consolas, monospace;   /* 코드에만 고정폭 글꼴 */
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f4ee; --surface: #fffefb; --line: #dcd8cd; --text: #1f1e1c; --muted: #66635b; --faint: #a19d92;
  --accent: #6d4fd8; --code-bg: #f0ede4; --dot: 31, 30, 28; --dot-hot: 109, 79, 216;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.65; -webkit-font-smoothing: antialiased;
  font-family: 'Pretendard Variable', Pretendard, 'Hiragino Sans', 'Yu Gothic UI', 'Malgun Gothic', system-ui, sans-serif; }
a { color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 720px; }
::selection { background: var(--accent); color: #fff; }

/* 배경 점 격자: 화면 전체에 고정, 클릭은 통과 */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

/* 헤더 */
header { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
header .wrap { display: flex; align-items: center; gap: 8px; height: 56px; }
header nav { margin-right: auto; display: flex; gap: 22px; }
header nav a { font-size: 14px; color: var(--muted); text-decoration: none; }
header nav a:hover { color: var(--text); }
.hbtn { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; font: 13px inherit; color: var(--text);
  background: none; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.hbtn:hover, .hbtn[aria-expanded="true"] { border-color: var(--muted); }
.hbtn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#theme .sun { display: none; }
[data-theme="light"] #theme .sun { display: block; }
[data-theme="light"] #theme .moon { display: none; }
.dd { position: relative; }
.dd .caret { transition: transform .2s; }
.dd [aria-expanded="true"] .caret { transform: rotate(180deg); }
.dd ul { position: absolute; right: 0; top: calc(100% + 6px); min-width: 140px; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .35); animation: pop .12s ease-out; }
.dd ul[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.dd li button { display: flex; justify-content: space-between; width: 100%; padding: 7px 10px; font: inherit; font-size: 14px; color: var(--text);
  background: none; border: 0; border-radius: 5px; cursor: pointer; text-align: left; }
.dd li button:hover { background: var(--code-bg); }
.dd li button[aria-current="true"] { color: var(--accent); }
.dd li button[aria-current="true"]::after { content: '✓'; }

/* 히어로 */
#hero { min-height: calc(88vh - 56px); display: flex; flex-direction: column; justify-content: center; padding: 64px 0; }
#hero.withmap { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 48px; align-items: center; }

/* 인생 맵 카드 */
.mapcard { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--code-bg); }
.mapcard[hidden] { display: none; }
.mapbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.mapbar b { font-size: 15px; letter-spacing: -0.01em; }
.mapbtns { display: flex; gap: 4px; }
.mapbtns button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.mapbtns button:hover { color: var(--text); border-color: var(--muted); }
.mapbtns svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#map { height: 440px; }
.maphint { position: absolute; left: 14px; bottom: 10px; font-size: 12px; color: var(--faint); pointer-events: none; }
@media (pointer: coarse) { .maphint { display: none; } }   /* 휴대폰엔 Ctrl+휠 안내가 필요 없음 */
.mapinfo { position: absolute; left: 12px; right: 12px; bottom: 12px; max-height: 60%; overflow-y: auto; padding: 16px 18px; z-index: 2;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5); }
.mapinfo[hidden] { display: none; }
.mapinfo:not([hidden]) { animation: rise .32s cubic-bezier(.2, .7, .2, 1); }
.mapinfo img { display: block; max-width: 100%; max-height: 260px; margin: 14px 0 0; border-radius: 8px; }
.mapinfo time { display: block; font-size: 12.5px; color: var(--muted); }
.mapinfo b { display: block; font-size: 18px; letter-spacing: -0.02em; margin: 2px 0 6px; padding-right: 28px; }
.mapinfo strong { font-weight: 800; }
.mapinfo p { margin: 0; font-size: 14.5px; line-height: 1.7; white-space: pre-wrap; }
.mapinfo a { display: inline-block; margin-top: 10px; font-size: 14px; color: var(--accent); }
.mapinfo .x { position: absolute; right: 8px; top: 6px; width: 30px; height: 30px; font-size: 20px; line-height: 1; color: var(--muted); background: none; border: 0; cursor: pointer; }
/* 전체 화면 */
.mapcard.full { position: fixed; inset: 0; z-index: 50; border-radius: 0; border: 0; }
.mapcard.full #map { height: auto; flex: 1; }
.greet { font-size: 14px; line-height: 1.6; color: var(--muted); margin: 0 0 8px; min-height: 3.6em; }
.greet b { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.greet .me { font-size: 1.5em; line-height: 1.4; }
h1.name { font-size: clamp(64px, 11vw, 120px); font-weight: 800; line-height: 1; letter-spacing: -0.05em; margin: 0 0 30px; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; text-decoration: none; padding: 10px 16px;
  border-radius: 6px; border: 1px solid var(--line); transition: border-color .15s, background-color .15s; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.btn:hover svg { transform: translateX(2px); }
.socials { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 26px; }
.socials a { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); text-decoration: none; }
.socials a:hover { color: var(--text); }
.socials svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.socials svg.fill { fill: currentColor; stroke: none; }

/* 섹션 공통 */
section { padding: 88px 0; scroll-margin-top: 56px; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--text); padding-bottom: 12px; margin-bottom: 8px; }
.head h2 { font-size: clamp(32px, 5vw, 44px); font-weight: 800; line-height: 1.1; margin: 0; letter-spacing: -0.035em; }
.head small { font: 13px inherit; color: var(--muted); }

/* 제작 및 활동: 줄마다 꽉 차는 이미지 배치 (폭·높이는 스크립트가 이미지 비율로 계산) */
.bento { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.brow { display: flex; gap: 14px; }
.tile { position: relative; display: block; min-width: 0; overflow: hidden; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.tile:hover img { transform: scale(1.04); }
.tile:hover { border-color: var(--muted); }
/* 글자가 이미지 위에서도 읽히도록 아래쪽만 어둡게 */
.tile .cap { position: absolute; inset: auto 0 0 0; padding: 44px 18px 16px; color: #fff; background: linear-gradient(to top, rgba(0, 0, 0, .82), rgba(0, 0, 0, .4) 60%, transparent); }
.tile .cap time { display: block; font-size: 12px; opacity: .8; }
.tile .cap b { display: block; font-size: 19px; line-height: 1.3; letter-spacing: -0.02em; margin: 2px 0; overflow-wrap: anywhere; }
.tile.big .cap b { font-size: 26px; }
.tile .cap span { display: block; font-size: 13.5px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.sm .cap { padding: 32px 12px 12px; } .tile.sm .cap b { font-size: 15px; } .tile.sm .cap span { display: none; }
/* 이미지가 없는 글: 글자 칸 */
.tile.n .cap { inset: 0; display: flex; flex-direction: column; padding: 22px 22px 20px; color: var(--text); background: none; }
.tile.n .cap time { order: 3; margin-top: auto; color: var(--muted); opacity: 1; }
.tile.n .cap b { font-size: 24px; line-height: 1.25; margin: 0 0 10px; }
.tile.n.big .cap b { font-size: 30px; }
.tile.n .cap span { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; font-size: 15px; line-height: 1.6; color: var(--muted); opacity: 1; }
.tile.n.sm .cap { padding: 14px; } .tile.n.sm .cap b { font-size: 16px; } .tile.n.sm .cap span { display: -webkit-box; -webkit-line-clamp: 3; font-size: 13px; }
.tile.n:hover b { color: var(--accent); }
.empty { color: var(--muted); padding: 24px 0; grid-column: 1 / -1; }

.mail { display: inline-block; margin-top: 20px; font-size: clamp(26px, 5vw, 44px); font-weight: 700; letter-spacing: -0.03em; text-decoration: none; border-bottom: 1px solid var(--line); }
.mail:hover { color: var(--accent); border-color: var(--accent); }

footer { padding: 28px 0 44px; border-top: 1px solid var(--line); font: 13px inherit; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

/* 메인 페이지 위에 펼쳐지는 글 읽기 창 */
.reader { position: fixed; inset: 0; z-index: 40; overflow-y: auto; background: var(--bg); overscroll-behavior: contain; }
.reader[hidden] { display: none; }
.reader .back { position: sticky; top: 0; z-index: 1; display: block; width: 100%; margin: 0; padding: 18px 0 14px; text-align: left; font: inherit; font-size: 14px;
  color: var(--muted); background: var(--bg); border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.reader .back:hover { color: var(--accent); }

/* 글 페이지 */
.back { display: inline-block; margin-top: 36px; font-size: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--accent); }
.article { margin: 28px 0 72px; }
body[data-bg="dim"] .article { animation: rise .6s cubic-bezier(.2, .7, .2, 1); }   /* 글 페이지로 바로 들어왔을 때도 살짝 떠오르며 등장 */
.article time { font: 13px inherit; color: var(--muted); }
.article h1 { font-size: clamp(30px, 5.5vw, 44px); line-height: 1.2; letter-spacing: -0.025em; margin: 8px 0 36px; padding-bottom: 28px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.prose { font-size: 17px; line-height: 1.85; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; } .prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3 { line-height: 1.3; margin: 1.9em 0 .6em; letter-spacing: -0.015em; }
.prose h1 { font-size: 1.6em; } .prose h2 { font-size: 1.35em; } .prose h3 { font-size: 1.15em; }
.prose a { color: var(--accent); }
.prose img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 1.4em auto; }
.prose blockquote { margin: 1.3em 0; padding: .1em 1.1em; border-left: 2px solid var(--accent); color: var(--muted); }
.prose code { font: .88em var(--code); background: var(--code-bg); padding: .15em .4em; border-radius: 4px; }
.prose pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 16px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.2em 0; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 12px; }
.prose li { margin: .3em 0; }

.rise { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; animation-delay: var(--d, 0s); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

@media (max-width: 860px) {
  #hero { min-height: 0; padding: 72px 0; }
  #hero.withmap { grid-template-columns: 1fr; gap: 40px; }
  #map { height: 380px; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 18px; }
  header nav { gap: 14px; } header nav a:first-child { display: none; } #langName { display: none; }
  .bento, .brow { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .rise, .dd ul { animation: none; }
}
