/* ---------- Tokens ---------- */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #1f2228;
  --muted: #5d6270;
  --line: #e4e1da;
  --accent: #46588f;
  --accent-soft: #e8ebf5;
  --accent-text: #34447a;
  --shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 6px 24px rgba(20, 24, 40, .06);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  --maxw: 980px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161b; --surface: #1b1e25; --surface-2: #22262f; --text: #e9eaee; --muted: #a2a7b4;
    --line: #2e333d; --accent: #9fb0e6; --accent-soft: #262d42; --accent-text: #b9c6f0;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161b; --surface: #1b1e25; --surface-2: #22262f; --text: #e9eaee; --muted: #a2a7b4;
  --line: #2e333d; --accent: #9fb0e6; --accent-soft: #262d42; --accent-text: #b9c6f0;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 24px rgba(0,0,0,.25); color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16.5px/1.7 var(--sans); -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.08rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted); text-decoration: none; font-size: .9rem; padding: 6px 10px; border-radius: 8px; white-space: nowrap;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.theme-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; flex: none; display: grid; place-items: center;
}
.theme-toggle:hover { color: var(--text); }
@media (max-width: 719px) { .brand { display: none; } .nav { margin-left: 0; } }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 24px; display: grid; gap: 36px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 820px) {
  .hero { grid-template-columns: 260px 1fr; gap: 52px; padding-top: 72px; }
  .hero .portrait { position: sticky; top: 84px; }
}
.portrait { border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); background: var(--surface-2); width: 100%; max-width: 260px; aspect-ratio: 3 / 4; }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
@media (max-width: 819px) { .portrait { max-width: 200px; } }

/* ---------- Tabs ---------- */
.tab { padding: 48px 0 56px; animation: fade .25s ease; }
.tab#about { padding-top: 0; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tab { animation: none; } }
.page-title { font-size: clamp(1.9rem, 4vw, 2.5rem); margin: 0 0 28px; }
.kicker {
  font-size: .78rem; font-family: var(--sans); font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-text); margin: 36px 0 16px;
}
.page-title + .kicker, .grid-2 > div > .kicker:first-child { margin-top: 0; }
.nav a[aria-current="page"] { color: var(--accent-text); background: var(--accent-soft); font-weight: 500; }
.hero h1 { font-size: clamp(2rem, 4.4vw, 2.8rem); margin: 0 0 6px; }
.role { color: var(--muted); margin: 0 0 22px; font-size: 1.02rem; }
.contact { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: .88rem;
}
.chip:hover { border-color: var(--accent); color: var(--accent-text); }
.chip svg { width: 15px; height: 15px; flex: none; }
.hero p { margin: 0 0 16px; }

/* ---------- Sections ---------- */
section.block { padding: 44px 0; border-top: 1px solid var(--line); }
.block > h2 {
  font-size: .78rem; font-family: var(--sans); font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-text); margin: 0 0 22px;
}
.block h3 { font-size: 1.15rem; margin: 26px 0 10px; }
.block h3:first-child { margin-top: 0; }
.lede { font-family: var(--serif); font-size: 1.12rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.pronounce { margin-top: 26px; }
.pronounce h3 { font-size: 1rem; margin: 0 0 10px; font-family: var(--sans); }
.pronounce ol { margin: 0; padding-left: 20px; }
.pronounce li { margin-bottom: 6px; }
.pronounce .meta { margin: 10px 0 0; font-size: .9rem; }

/* Education timeline */
.edu { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.edu li { padding-left: 18px; border-left: 2px solid var(--accent-soft); }
.edu strong { display: block; font-family: var(--serif); font-size: 1.08rem; font-weight: 600; }
.edu .where { color: var(--muted); font-size: .94rem; }
.edu .note { font-size: .94rem; margin-top: 4px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.tags li { background: var(--accent-soft); color: var(--accent-text); padding: 6px 12px; border-radius: 999px; font-size: .9rem; }

/* Citations */
.cites { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.cites li { padding-left: 16px; border-left: 2px solid var(--line); }
.cites .links { display: inline-flex; gap: 10px; margin-left: 6px; font-size: .86rem; }
.status { display: inline-block; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; margin-right: 6px; vertical-align: 1px; }
.year { color: var(--muted); }

details.more { margin-top: 20px; }
details.more > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px; font-weight: 500;
  color: var(--accent-text); padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; font-size: 1.1rem; line-height: 1; }
details.more[open] > summary::after { content: "–"; }
details.more > .inner { margin-top: 22px; }

.ko { font-family: "Noto Sans KR", var(--sans); }
.columns-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.columns-list a { text-decoration: none; }
.columns-list a:hover { text-decoration: underline; }
.columns-list .vol { color: var(--muted); font-size: .85rem; margin-left: 6px; }

/* Project / app cards */
.card h3 { margin-top: 0; }
.card p { margin: 0 0 12px; }
.card .meta { color: var(--muted); font-size: .88rem; margin-bottom: 8px; }
.card .actions { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: .92rem; }

/* Rows (teaching / honors / service) */
.rows { display: grid; gap: 0; margin: 0; }
.rows > div { display: grid; grid-template-columns: 1fr; gap: 2px 20px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.rows > div:last-child { border-bottom: 0; }
.rows dt { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.rows dd { margin: 0; }
@media (min-width: 640px) { .rows > div { grid-template-columns: 150px 1fr; } }
.courses { margin: 6px 0 0; padding-left: 18px; }
.courses li { margin-bottom: 2px; }
.sub { font-family: var(--serif); font-style: italic; color: var(--muted); margin: 0 0 6px; }

/* Life gallery */
.gallery { columns: 2 220px; column-gap: 14px; }
.gallery figure { margin: 0 0 14px; break-inside: avoid; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.gallery img, .gallery video { width: 100%; height: auto; }
.life-teaser { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 720px) { .life-teaser { grid-template-columns: 1fr 1.2fr; } }
.teaser-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.teaser-strip img { aspect-ratio: 1; object-fit: cover; border-radius: 10px; width: 100%; }
.btn { display: inline-block; background: var(--accent); color: #fff; padding: 9px 16px; border-radius: 10px; text-decoration: none; font-weight: 500; }
:root[data-theme="dark"] .btn { color: #14161b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn { color: #14161b; } }
.btn:hover { color: #fff; filter: brightness(1.08); }

/* Expertise */
.expertise { display: grid; gap: 12px; grid-template-columns: 1fr; margin: 0 0 30px; }
@media (min-width: 560px) { .expertise { grid-template-columns: 1fr 1fr; } }
.skill-card { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.skill-card h3 { font-family: var(--sans); font-size: .82rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.skill-card .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.skill-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.skill-card li { font-size: .86rem; line-height: 1.35; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text); }

/* Research / To Practice pair */
.pair-crumb { display: inline-block; font-size: .9rem; text-decoration: none; margin-bottom: 10px; color: var(--muted); }
.pair-crumb:hover { color: var(--accent-text); }
.pair-next {
  display: grid; gap: 2px; margin-top: 40px; padding: 18px 22px; border-radius: 14px; text-decoration: none;
  background: var(--accent-soft); border: 1px solid transparent; color: var(--text);
}
.pair-next:hover { border-color: var(--accent); color: var(--text); }
.pair-next span { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.pair-next strong { font-family: var(--serif); font-size: 1.3rem; color: var(--accent-text); }
.pair-next em { font-style: normal; color: var(--muted); font-size: .95rem; }

.about-more { margin-top: 48px; padding-top: 40px; border-top: 1px solid var(--line); }
.about-more > .kicker:first-child { margin-top: 0; }

/* Sub-navigation inside a tab */
.subnav { display: flex; gap: 6px; margin: -8px 0 8px; position: sticky; top: 60px; z-index: 5; padding: 10px 0; background: var(--bg); }
.subnav a { text-decoration: none; color: var(--muted); font-size: .9rem; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.subnav a.on, .subnav a:hover { color: var(--accent-text); border-color: var(--accent); }
[data-subpanel] { scroll-margin-top: 120px; }
[data-subpanel="talks"] { margin-top: 44px; padding-top: 8px; border-top: 1px solid var(--line); }
.intro { max-width: 720px; padding: 16px 20px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; margin: 0 0 8px; }

/* Life posts */
.post-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.post-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease; }
.post-card:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--text); }
.post-thumb { aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-info { padding: 14px 16px 16px; }
.post-info h3 { margin: 0 0 4px; font-size: 1.12rem; }
.post-info span { color: var(--muted); font-size: .86rem; }
.post .back { display: inline-block; margin-bottom: 18px; font-size: .92rem; text-decoration: none; }
.post .page-title { margin-bottom: 6px; }
.post-date { color: var(--muted); margin: 0 0 24px; font-size: .92rem; }
.post-body { max-width: 680px; margin-bottom: 28px; font-family: var(--serif); font-size: 1.08rem; }
.post-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); font-size: .92rem; }
.muted { color: var(--muted); }

/* Footer */
footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: .88rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
