/* Homepage
   Layout: a fixed identity column (portrait, paper map, links) on the page color, beside the work,
   which scrolls on its own lighter panel. One type family, Geist, in two cuts.
   The two research directions are the only hues on the page; everything else is ink and grey. */

:root {
  --bg: #f0f2f5;        /* the page, behind the identity column */
  --surface: #ffffff;   /* boxes that sit on the page */
  --panel: #ffffff;     /* the column that scrolls */
  --card: #f5f6f9;      /* boxes that sit on the panel */
  --ink: #0e1318;
  --ink-2: #353f4c;
  --muted: #5d6978;
  --line: #dfe3e9;
  --line-2: #c5ccd6;

  /* research keywords, as in _data/themes.yml */
  --efficient: #0f7a6c;
  --causality: #7b4fd0;
  --shift: #2d62d6;
  --llm: #c2480e;
  --representation: #9a6b08;
  --other: #98a2b0;

  --font-body: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0c10;
    --surface: #12161c;
    --panel: #10141a;
    --card: #171c24;
    --ink: #eaeef3;
    --ink-2: #c3ccd7;
    --muted: #8a96a6;
    --line: #222933;
    --line-2: #323b48;
    --efficient: #4fd1b6;
    --causality: #bba3ff;
    --shift: #82a8ff;
    --llm: #ff9b5e;
    --representation: #e2b54f;
    --other: #5f6b7b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0c10;
  --surface: #12161c;
  --panel: #10141a;
  --card: #171c24;
  --ink: #eaeef3;
  --ink-2: #c3ccd7;
  --muted: #8a96a6;
  --line: #222933;
  --line-2: #323b48;
  --efficient: #4fd1b6;
  --causality: #bba3ff;
  --shift: #82a8ff;
  --llm: #ff9b5e;
  --representation: #e2b54f;
  --other: #5f6b7b;
  color-scheme: dark;
}

/* Anything tagged with a direction picks up its hue as --c. */
[data-theme-key] { --c: var(--other); }
[data-theme-key="efficient"] { --c: var(--efficient); }
[data-theme-key="causality"] { --c: var(--causality); }
[data-theme-key="shift"] { --c: var(--shift); }
[data-theme-key="llm"] { --c: var(--llm); }
[data-theme-key="representation"] { --c: var(--representation); }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 24px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 10; padding: 8px 12px; background: var(--ink); color: var(--panel); border-radius: 8px; text-decoration: none; }
.skip:focus { top: 12px; }
svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
svg.fill { fill: currentColor; stroke: none; }
.eyebrow {
  margin: 0 0 10px;
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow--spaced { margin-top: 40px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--other)); flex: none; }

/* ---------- page grid ---------- */
.page { display: grid; grid-template-columns: minmax(330px, 400px) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; }
.side__inner { display: flex; flex-direction: column; gap: 26px; min-height: 100%; padding: 32px 32px 28px; }
.main { background: var(--panel); border-left: 1px solid var(--line); padding: 64px clamp(24px, 6vw, 88px) 32px; }
.main > * { max-width: 760px; }

/* ---------- identity ---------- */
.id { position: relative; display: flex; align-items: center; gap: 16px; padding-right: 30px; }
.id [data-theme-toggle] { position: absolute; top: -6px; right: -10px; }
.id__photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; object-position: 50% 22%; border: 1px solid var(--line-2); background: var(--surface); }
.id__text { flex: 1; min-width: 0; }
.id__name { margin: 0; font-size: 31px; line-height: 1.1; font-weight: 650; letter-spacing: -.022em; }
.id__role { margin: 7px 0 0; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-2);
  transition: border-color .2s, color .2s;
}
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); }
.icon-btn--sm { width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; }
.icon-btn--sm svg { width: 14px; height: 14px; }
.icon-btn .i-sun { display: none; }
:root[data-theme="dark"] .icon-btn .i-sun { display: block; }
:root[data-theme="dark"] .icon-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .icon-btn .i-moon { display: none; }
}

/* ---------- paper map ---------- */
.map { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; }
.map .eyebrow { margin-bottom: 12px; }
.map__keys { display: grid; gap: 4px; }
.map__key {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; text-align: left;
  background: var(--card); border: 1px solid transparent; border-radius: 9px;
  transition: border-color .2s, background .2s;
}
.map__key { padding: 6px 10px; gap: 9px; }
.map__key .dot { width: 8px; height: 8px; }
.map__key:hover { border-color: var(--line-2); }
.map__key[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, var(--surface)); }
.map__key-label { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 550; line-height: 1.3; }
.map__n { font: 500 12px var(--font-mono); color: var(--c); }

/* the cluster figure: one circle per direction, a dot per paper or project */
.cluster { margin: -4px -6px 12px; }
.cluster__svg { display: block; width: 100%; height: auto; overflow: visible; }
.cluster__area {
  fill: color-mix(in srgb, var(--c, var(--other)) 7%, transparent);
  stroke: color-mix(in srgb, var(--c, var(--other)) 38%, transparent);
  stroke-width: 1; transition: fill .3s var(--ease), stroke .3s var(--ease);
}
.cluster__area--other { --c: var(--other); stroke-dasharray: 3 3; }
.cluster__area[data-area] { cursor: pointer; }
.cluster__area[data-area]:hover { fill: color-mix(in srgb, var(--c) 13%, transparent); }
.cluster__area.is-active { fill: color-mix(in srgb, var(--c) 14%, transparent); stroke: var(--c); }
/* Labels use the body face at a normal weight; a halo in the card color keeps them clean where they cross a circle's edge. */
.cluster__label {
  font-family: var(--font-body); font-size: 12px; font-weight: 550; letter-spacing: -.005em;
  fill: var(--ink-2);
  paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round;
}
.cluster__label[data-area] { cursor: pointer; }
.cluster__n { font-weight: 500; font-variant-numeric: tabular-nums; fill: var(--c, var(--muted)); }
.cdot {
  cursor: pointer; transform-box: fill-box; transform-origin: center;
  transition: opacity .3s var(--ease);
  animation: cdot-in .7s var(--ease) backwards; animation-delay: var(--d, 0ms);
}
@keyframes cdot-in { from { opacity: 0; transform: scale(0); } }
.cdot:not([data-theme-key]) { --c: var(--other); }
.cdot__shape { fill: var(--surface); stroke: var(--c); stroke-width: 1.6; transform-box: fill-box; transform-origin: center; transition: transform .2s var(--ease); }
.cdot--first .cdot__shape, .cdot--project .cdot__shape { fill: var(--c); }
.cdot__ring { fill: none; stroke: var(--c2); stroke-width: 1.4; }
.cdot__hit { fill: transparent; stroke: none; }
.cdot:hover .cdot__shape { transform: scale(1.5); }
.cdot--project:hover .cdot__shape { transform: rotate(45deg) scale(1.5); }
.cdot.is-dim { opacity: .16; }
.cluster__readout {
  min-height: 2.9em; margin: 2px 6px 0; font-size: 12px; line-height: 1.45; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cluster__readout.is-on { color: var(--ink); }

.map__caption { margin: 12px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.key-dot, .key-diamond { display: inline-block; width: 8px; height: 8px; vertical-align: 0; border: 1.4px solid var(--ink-2); border-radius: 50%; }
.key-dot--first { background: var(--ink-2); }
.key-diamond { width: 7px; height: 7px; border-radius: 1px; background: var(--ink-2); transform: rotate(45deg); margin: 0 1px; }

/* ---------- section nav ---------- */
.toc { display: flex; flex-wrap: wrap; gap: 4px 16px; padding-top: 2px; }
.toc a { position: relative; font-size: 13px; color: var(--muted); text-decoration: none; padding: 2px 0; transition: color .2s; }
.toc a:hover, .toc a[aria-current="true"] { color: var(--ink); }
.toc a[aria-current="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1.5px; background: var(--ink); border-radius: 2px; }

/* ---------- actions ---------- */
.side__actions { margin-top: auto; display: grid; gap: 10px; }
.cv-btn {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 14px;
  background: var(--ink); color: var(--panel); border-radius: 10px; text-decoration: none; font-weight: 550; font-size: 14px;
  transition: transform .2s var(--ease);
}
.cv-btn:hover { transform: translateY(-1px); }
.mail { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.mail__addr { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font: 13px var(--font-mono); color: var(--ink); text-decoration: none; }
.mail__addr:hover { text-decoration: underline; text-underline-offset: 3px; }
.socials { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.socials a {
  display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  font-size: 12.5px; font-weight: 500; text-decoration: none; transition: border-color .2s;
}
.socials a:hover { border-color: var(--line-2); }
.socials svg { width: 14px; height: 14px; }
.side__blog { font-size: 13px; color: var(--muted); text-decoration: none; justify-self: start; }
.side__blog:hover { color: var(--ink); }

/* ---------- hero ---------- */
.hero__title { margin: 0 0 22px; font-size: clamp(26px, 3vw, 34px); line-height: 1.22; font-weight: 620; letter-spacing: -.022em; text-wrap: balance; }
.hero__title em { font-style: normal; color: var(--c); }
.prose p { margin: 0 0 12px; color: var(--ink-2); font-size: 15.5px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: currentColor; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 34px 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { display: flex; flex-direction: column; padding: 20px 16px 18px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat dd { margin: 0; }
.stat__num { order: -1; font-size: 40px; line-height: 1; font-weight: 600; letter-spacing: -.03em; margin-bottom: 14px !important; }
.stat__plus { color: var(--muted); font-weight: 400; }
.stat__label { font-size: 13px; font-weight: 600; }
.stat__sub { font-size: 11.5px; color: var(--muted); line-height: 1.4; margin-top: 2px !important; }

/* ---------- sections ---------- */
.sec { padding-top: 64px; }
.sec__title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 22px; font-size: 24px; font-weight: 620; letter-spacing: -.02em; }
.sec__aside, .sec__count { font: 500 12px var(--font-mono); color: var(--muted); letter-spacing: 0; }
.sec__more { margin-left: auto; font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--muted); text-decoration: none; }
.sec__more:hover { color: var(--ink); }

.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px;
  font: 500 11px/1.6 var(--font-mono); color: var(--c, var(--ink-2));
  background: color-mix(in srgb, var(--c, var(--ink-2)) 10%, transparent);
}
.tag--partner { --c: var(--ink-2); background: transparent; border: 1px solid var(--line); }
.link { font-size: 12.5px; font-weight: 500; color: var(--ink-2); text-decoration: none; }
.link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* project cards */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cards--grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  position: relative; padding: 18px 20px; background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--c); border-radius: var(--radius);
}
.card--past { border-left-width: 1px; }
.card__meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card__when { display: inline-flex; align-items: center; gap: 7px; font: 500 11.5px var(--font-mono); color: var(--muted); }
.card__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card__title { margin: 0 0 6px; font-size: 16px; line-height: 1.35; font-weight: 600; letter-spacing: -.01em; }
.card__body { margin: 0 0 6px; font-size: 13.5px; color: var(--ink-2); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 50%, transparent); animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* publications */
.pub-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; }
.seg--themes { flex-wrap: wrap; border-radius: 18px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 0; border-radius: 999px; background: transparent; font-size: 12.5px; font-weight: 500; color: var(--muted); transition: background .2s, color .2s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.seg button[aria-pressed="true"] .dot { box-shadow: 0 0 0 1.5px var(--panel); }
.check { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.check__box { width: 13px; height: 13px; border: 1.5px solid var(--line-2); border-radius: 50%; transition: background .2s, border-color .2s; }
.check[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }
.check[aria-pressed="true"] .check__box { background: var(--ink); border-color: var(--ink); }
.pub-hint { margin: 0 0 22px; font-size: 12px; color: var(--muted); }
.pub-hint__status:not(:empty)::before { content: "·"; margin: 0 6px; }

.pub-group { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 0 18px; }
.pub-group + .pub-group { margin-top: 8px; }
.pub-group__head { padding-top: 2px; }
.pub-group__label { display: block; font-size: 22px; font-weight: 620; letter-spacing: -.02em; line-height: 1.2; }
.pub-group__count { font: 11px var(--font-mono); color: var(--muted); }
.pub-list { list-style: none; margin: 0; padding: 0 0 18px 22px; border-left: 1px solid var(--line); }
.pub { position: relative; padding: 0 0 26px; scroll-margin-top: 24px; transition: opacity .3s var(--ease); }
.pub::before {
  content: ""; position: absolute; left: -28px; top: 5px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--c, var(--other)); box-sizing: border-box;
}
.pub:not([data-theme-key]) { --c: var(--other); }
.pub[data-first]::before { background: var(--c); }
.pub:target .pub__title, .pub.is-flash .pub__title { background: color-mix(in srgb, var(--c) 14%, transparent); border-radius: 4px; }
.pub__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.venue { padding: 1px 7px; border-radius: 5px; background: var(--ink); color: var(--panel); font: 600 10.5px/1.7 var(--font-mono); letter-spacing: .02em; }
.pub__type { font: 11.5px var(--font-mono); color: var(--muted); }
.pub__note { font: 600 10.5px/1.7 var(--font-mono); color: var(--ink); padding: 0 7px; border: 1px solid var(--ink); border-radius: 5px; }
.pub__title { margin: 0 0 4px; font-size: 15.5px; line-height: 1.4; font-weight: 600; letter-spacing: -.008em; text-wrap: pretty; }
.pub__title a { text-decoration: none; }
.pub__title a:hover { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.pub__authors { margin: 0; font-size: 13px; color: var(--muted); }
.pub__authors .me { color: var(--ink); font-weight: 600; }
.pub__venue { margin: 1px 0 0; font-size: 13px; color: var(--ink-2); }
.pub__summary { margin: 8px 0 0; padding: 8px 12px; font-size: 13px; color: var(--ink-2); background: var(--card); border-radius: 8px; }
.pub__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 9px; }
.pub__foot .tag + .link, .pub__foot .tag:last-of-type { margin-right: 2px; }
.pub-empty { margin: 0 0 0 128px; color: var(--muted); font-size: 14px; }

/* background */
.bg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline__item { position: relative; display: grid; padding: 0 0 18px 20px; border-left: 1px solid var(--line); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before { content: ""; position: absolute; left: -4.5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--panel); border: 1.5px solid var(--line-2); }
.timeline__item:first-child::before { background: var(--ink); border-color: var(--ink); }
.timeline__period { font: 11.5px var(--font-mono); color: var(--muted); }
.timeline__title { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.timeline__org { font-size: 13.5px; color: var(--ink-2); }
.timeline__note { font-size: 12.5px; color: var(--muted); }

/* writing */
.posts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.posts li { border-bottom: 1px solid var(--line); }
.post-row { display: grid; gap: 3px; padding: 16px 4px; text-decoration: none; transition: background .2s; }
.post-row:hover { background: var(--card); }
.post-row:hover .post-row__title { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.post-row__meta { display: flex; align-items: center; gap: 10px; font: 11.5px var(--font-mono); color: var(--muted); }
.post-row__title { font-size: 15.5px; font-weight: 600; line-height: 1.45; word-break: keep-all; }
.post-row__sub { font-size: 13px; color: var(--muted); }
.kind { padding: 1px 7px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--ink-2); font: 500 10.5px/1.6 var(--font-mono); }
.kind--personal { background: var(--ink); border-color: var(--ink); color: var(--panel); }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 72px; padding-top: 20px; border-top: 1px solid var(--line); font: 12px var(--font-mono); color: var(--muted); }
.foot a { color: inherit; }

/* filtering */
.pub.is-hidden { display: none; }
.pub-group.is-empty { display: none; }

/* ---------- narrow screens ---------- */
@media (max-width: 1040px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; overflow: visible; }
  .side__inner { padding: 28px 20px 24px; max-width: 760px; margin: 0 auto; }
  .main { border-left: 0; border-top: 1px solid var(--line); padding: 44px 20px 28px; }
  .main > * { margin-left: auto; margin-right: auto; }
  .toc { display: none; }
  .side__actions { margin-top: 0; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 16px 12px; }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
  .stat:nth-child(4) { border-top: 1px solid var(--line); }
  .stat__num { font-size: 32px; }
  .pub-group { grid-template-columns: minmax(0, 1fr); }
  .pub-group__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
  .pub-list { padding-left: 18px; margin-left: 5px; }
  .pub::before { left: -24px; }
  .pub-empty { margin-left: 0; }
  .bg-grid { grid-template-columns: minmax(0, 1fr); }
  .socials { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
