/* ─────────────────────────────────────────────
   Woosung Lim — styles
   레이아웃: 왼쪽 고정(이름·링크·메뉴) + 오른쪽 본문 (좁은 화면에서는 위아래로 쌓임)
   ───────────────────────────────────────────── */

/* ── 색상 토큰 ── */
:root,
:root[data-theme="dark"] {
  --bg: #121314;
  --text: #c9c8c3;
  --strong: #efeee9;
  --muted: #85847f;
  --line: #2a2a2b;
  --link: #7f9ff5;
  --hl: rgba(77, 116, 235, 0.09);
  --win: #f08a74;
  --thumb-bg: #1b1c1d;
  --panel: #1a1b1d;
  --edge: #55565a;
  --link-soft: rgba(77, 116, 235, 0.13);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #fbfaf7;
  --text: #2e2d2a;
  --strong: #111110;
  --muted: #74726c;
  --line: #e3e0d8;
  --link: #4d74eb;
  --hl: #eef2fd;
  --win: #b8402f;
  --thumb-bg: #efece5;
  --panel: #ffffff;
  --edge: #b9b5ab;
  --link-soft: #e6ecfc;
  color-scheme: light;
}

/* ── 기본 ── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", Roboto, sans-serif;
  font-size: 16px; line-height: 1.65; -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
b { color: var(--strong); font-weight: 600; }
img { max-width: 100%; display: block; }
button { font: inherit; }
::selection { background: var(--link); color: var(--bg); }

[data-lang="en"] .ko, [data-lang="ko"] .en { display: none !important; }
[hidden] { display: none !important; }

/* ── 페이지 레이아웃 ── */
.page {
  max-width: 1160px; margin: 0 auto; padding: 0 48px;
  display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 80px;
}

/* ── 왼쪽 고정 영역 ── */
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 88px 0 44px;
}
.name {
  font-family: "Source Serif 4", Georgia, serif; font-weight: 600;
  font-size: 40px; line-height: 1.1; letter-spacing: -0.01em; margin: 0;
}
.name a { color: var(--strong); }
.name a:hover { text-decoration: none; }
.role { margin: 12px 0 0; color: var(--strong); font-size: 16px; }
.tagline { margin: 10px 0 0; color: var(--muted); font-size: 15px; max-width: 300px; }

.side-links { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
.side-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.side-links a:hover { color: var(--strong); }
.side-links svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.side-links a:hover svg { color: var(--link); }

.nav-links { list-style: none; margin: 52px 0 0; padding: 0; }
.nav-links a {
  display: inline-block; padding: 5px 0 5px 14px; border-left: 2px solid var(--line);
  color: var(--muted); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
}
.nav-links a:hover { color: var(--strong); text-decoration: none; }
.nav-links a.active { color: var(--strong); border-left-color: var(--link); }

.tools { display: flex; gap: 8px; }
.tool {
  height: 30px; min-width: 30px; padding: 0 10px; border-radius: 4px; cursor: pointer;
  background: none; border: 1px solid var(--line); color: var(--muted); font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
}
.tool:hover { color: var(--strong); border-color: var(--muted); }
#lang-btn span.on { color: var(--strong); font-weight: 600; }
#theme-btn { padding: 0; }
:root[data-theme="dark"] .sun, :root[data-theme="light"] .moon { display: none; }

/* ── 본문 ── */
.main-col { padding: 88px 0 0; min-width: 0; }
main section { margin-bottom: 88px; scroll-margin-top: 40px; }
.sec-title {
  font-family: "Source Serif 4", Georgia, serif; font-weight: 600;
  font-size: 22px; color: var(--strong); margin: 0 0 22px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}

/* About */
.about { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 36px; align-items: start; }
.bio p { margin: 0 0 14px; }
.portrait { width: 150px; aspect-ratio: 4 / 5; object-fit: cover; object-position: 45% 35%; border-radius: 4px; }

/* News */
.news-list { overflow-y: auto; outline: none; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.news-list.more {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
}
.news-item { display: grid; grid-template-columns: 22px 76px minmax(0, 1fr); gap: 12px; padding: 9px 0; align-items: baseline; }
.news-emoji { font-size: 14px; text-align: center; }
.news-date { font-size: 13.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.news-text { font-size: 15px; }

/* Projects — 레이아웃 A(Index): 왼쪽 썸네일 + 오른쪽 제목·정보·링크·요약, 발표·수상 항목은 옅은 배경 */
.sec-lede { margin: -10px 0 14px; color: var(--muted); font-size: 15px; }
.project {
  display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 0 20px;
  padding: 16px 14px; margin: 0 -14px; border-radius: 4px; scroll-margin-top: 24px;
}
.project.hl { background: var(--hl); }
.project.flash { animation: flash 1.6s ease; }
@keyframes flash { from { box-shadow: inset 0 0 0 1px var(--link); } to { box-shadow: inset 0 0 0 1px transparent; } }

.thumb {
  aspect-ratio: 16 / 9; max-width: 100%; border-radius: 4px; overflow: hidden; cursor: zoom-in;
  background: var(--thumb-bg); border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.empty { background: none; border-style: dashed; cursor: default; }

.p-title { font-weight: 700; font-size: 17px; line-height: 1.35; color: var(--link); cursor: pointer; }
.p-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.p-authors, .p-meta { font-size: 14.5px; margin-top: 2px; }
.p-meta i { color: var(--muted); }
.p-role { font-size: 14px; color: var(--muted); margin-top: 2px; }
.award { font-size: 14px; margin-top: 2px; color: var(--win); font-weight: 600; }
.p-sum { margin: 6px 0 0; font-size: 15px; }

.links { margin-top: 2px; font-size: 14.5px; }
.lnk { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font-size: inherit; }
.lnk:hover { text-decoration: underline; text-underline-offset: 3px; }
.lnk.on { color: var(--strong); }
.links > .lnk + .lnk::before { content: "/"; color: var(--muted); margin: 0 0.5em; display: inline-block; }

.abstract {
  display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease;
  font-size: 15px;
}
.abstract > div { overflow: hidden; }
.abstract.open { grid-template-rows: 1fr; }
.abstract.open > div { padding-top: 12px; }
.abstract.plain { grid-column: 1 / -1; }

.chips { margin-top: 10px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; color: var(--muted); }
.chip + .chip::before { content: " · "; }

/* Research 개요 */
.rq { margin-bottom: 14px; }
.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.level { border-top: 1px solid var(--line); padding-top: 10px; font-size: 14px; }
.level .step { display: block; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; color: var(--muted); letter-spacing: 0.06em; }
.level p { margin: 4px 0 0; }
/* Research: 파이프라인 다이어그램 (인라인 SVG, 테마 색상 사용) */
.thumb.diagram { cursor: pointer; }
.thumb.diagram svg { width: 100%; height: 100%; display: block; }
.mini rect { fill: var(--panel); stroke: var(--edge); stroke-width: 1; }
.mini rect.k { fill: var(--link-soft); stroke: var(--link); }
.mini path { stroke: var(--edge); stroke-width: 1.2; fill: none; }
.mini path.l { stroke: var(--link); stroke-dasharray: 3 3; }
.pipes-h { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 4px 0 10px; }
.pipe { margin-bottom: 18px; }
.pipe h4 { margin: 0; font-size: 15px; color: var(--strong); font-weight: 600; }
.pipe p { margin: 2px 0 10px; font-size: 14px; color: var(--muted); }
.svgwrap { cursor: zoom-in; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--line); border-radius: 6px; padding: 12px; background: var(--bg); }
.svgwrap svg { display: block; width: max(100%, 820px); height: auto; }
.swipe { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.sk { font-size: 13.5px; margin-top: 2px; }
.agentic { margin-top: 26px; }
.ag-note { margin: -4px 0 14px; font-size: 14px; color: var(--muted); max-width: 70ch; }
.n-box { fill: var(--panel); stroke: var(--edge); stroke-width: 1; }
.n-key { fill: var(--link-soft); stroke: var(--link); stroke-width: 1; }
.n-group { fill: none; stroke: var(--edge); stroke-width: 1; stroke-dasharray: 4 4; }
svg .t { fill: var(--strong); font: 600 13px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
svg .t2 { fill: var(--muted); font: 11.5px ui-monospace, "SF Mono", Menlo, monospace; }
svg .t3 { fill: var(--muted); font: 600 10.5px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; letter-spacing: 0.08em; }
.edge { stroke: var(--edge); stroke-width: 1.4; fill: none; }
.edge-loop { stroke: var(--link); stroke-width: 1.4; fill: none; stroke-dasharray: 5 5; }
.ah { fill: var(--edge); }
.ah-loop { fill: var(--link); }

/* Awards */
.award-list { list-style: none; margin: 0; padding: 0; }
.award-list li { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 10px 0; }
.a-date { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.a-title { color: var(--strong); font-weight: 600; }
.a-by { font-size: 14.5px; color: var(--muted); }

/* Footer */
footer { font-size: 13px; color: var(--muted); padding: 22px 0 56px; border-top: 1px solid var(--line); }

/* ── Lightbox ── */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; flex-direction: column;
  padding: 24px 16px; background: rgba(10, 10, 10, 0.92);
}
.lightbox.open { display: flex; }
.lightbox img { max-height: 80vh; max-width: min(1100px, 100%); border-radius: 2px; }
.lb-svg { width: min(1180px, 100%); max-height: 84vh; overflow: auto; padding: 16px; border-radius: 6px; background: var(--bg); }
.lb-svg svg { display: block; width: max(100%, 820px); height: auto; }
.lb-cap { color: rgba(255, 255, 255, 0.7); font-size: 13px; margin-top: 12px; }
.lb-btn {
  position: absolute; color: #fff; font-size: 22px; width: 44px; height: 44px; border-radius: 4px; cursor: pointer;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.16);
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.14); }
.lb-close { top: 18px; right: 18px; font-size: 16px; }
.lb-prev { left: 18px; top: 50%; }
.lb-next { right: 18px; top: 50%; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .abstract { transition: none; }
  .project.flash { animation: none; }
}

/* ── 좁은 화면: 위아래로 쌓기 ── */
@media (max-width: 1023px) {
  .page { display: block; position: relative; padding: 0 24px; max-width: 720px; }
  .side { position: static; height: auto; padding: 64px 0 0; }
  .nav-links { display: none; }
  .tools { position: absolute; top: 18px; right: 24px; }
  .main-col { padding-top: 56px; }
  main section { margin-bottom: 64px; }
}
@media (max-width: 640px) {
  .page { padding: 0 18px; }
  .tools { right: 18px; }
  .name { font-size: 34px; }
  .about { grid-template-columns: 1fr; gap: 20px; }
  .portrait { order: -1; width: 110px; }
  .project { grid-template-columns: 1fr; gap: 10px; padding: 14px; margin: 0 -14px; }
  .thumb.empty { display: none; }
  .news-item { grid-template-columns: 22px minmax(0, 1fr); row-gap: 0; }
  .news-emoji { grid-row: 1 / span 2; }
  .news-date { grid-column: 2; }
  .news-text { grid-column: 2; }
  .award-list li { grid-template-columns: 1fr; gap: 0; }
  .levels { grid-template-columns: 1fr; }
  .lb-prev, .lb-next { top: auto; bottom: 18px; }
}
