:root {
  color-scheme: light dark;

  --bg:        #f6f7f9;
  --bg-sunken: #ecedf1;
  --shell:     rgba(246, 247, 249, 0.8);
  --ink:       #121317;
  --ink-2:     #4d4f58;
  --ink-3:     #6b6e78;
  --rule:      #dfe1e6;
  --rule-firm: #c3c6ce;

  --accent:      #c24a00;
  --accent-pure: #e8630c;
  --on-accent:   #121317;
  --highlight:   rgba(232, 99, 12, 0.3);
  --lift:        0 12px 34px -20px rgba(18, 19, 23, 0.5);

  --fs-name:  clamp(2rem, 3.6vw, 2.6rem);
  --fs-say:   clamp(1.45rem, 2.7vw, 2.1rem);
  --fs-h2:    clamp(1.3rem, 2vw, 1.55rem);
  --fs-key:   1.22rem;
  --fs-h3:    1.08rem;
  --fs-body:  1rem;
  --fs-small: 0.93rem;
  --fs-meta:  0.82rem;
  --fs-chip:  0.7rem;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system,
          "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --r-plate: 10px;
  --r-pill:  999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --measure: 62ch;
  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  --stack: clamp(2.5rem, 5vw, 4.5rem);
  --rail: 11rem;
  --bar: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f1013;
    --bg-sunken: #17181c;
    --shell:     rgba(15, 16, 19, 0.78);
    --ink:       #eceef2;
    --ink-2:     #a6a9b3;
    --ink-3:     #8a8d97;
    --rule:      #26282e;
    --rule-firm: #3a3d45;
    --accent:      #ff9e5c;
    --accent-pure: #e8630c;
    --on-accent:   #121317;
    --highlight:   rgba(232, 99, 12, 0.45);
    --lift:        0 12px 34px -18px rgba(0, 0, 0, 0.8);
  }
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip; /* not hidden: it would turn the page into a scroll container and break the fixed bar */
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

::selection { background: color-mix(in srgb, var(--accent-pure) 30%, transparent); color: var(--ink); }

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(2.5rem, 5vw, 4rem) var(--gutter) 3rem;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, var(--accent) 32%, transparent);
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}
a:hover { text-decoration-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

strong { font-weight: 600; }
em { font-style: italic; }

/* ---------- hero: the board ---------- */

.hero {
  display: grid;
  grid-template-columns: clamp(220px, 26vw, 320px) minmax(0, 1fr);
  gap: 0 clamp(1.5rem, 4vw, 3.5rem);
  align-items: end;
}

.portrait {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: var(--r-plate);
  background: var(--bg-sunken);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }

.intro { min-width: 0; padding-bottom: 0.25rem; }

.hero h1 {
  font-size: var(--fs-name);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}
.hero h1 .hangul {
  margin-left: 0.55em;
  font-size: 0.47em;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  vertical-align: 0.1em;
}

.role {
  margin-top: 0.75rem;
  font-size: var(--fs-small);
  font-weight: 450;
  color: var(--ink-2);
  line-height: 1.5;
}
.role .advisor { display: block; color: var(--ink-3); }

.say {
  margin-top: 1.5rem;
  max-width: 24ch;
  font-size: var(--fs-say);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.026em;
  text-wrap: balance;
}
.say .key {
  padding-inline: 0.06em;
  background-image: linear-gradient(var(--highlight), var(--highlight));
  background-repeat: no-repeat;
  background-size: 100% 0.44em;
  background-position: 0 calc(100% - 0.06em);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.channels {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: var(--fs-meta);
  font-weight: 500;
}
.channels a { padding-inline: 0.85rem; }
.channels a:first-child { padding-left: 0; }
.channels a:not(:last-child) { border-right: 1px solid var(--rule-firm); }

.board {
  grid-column: 1 / -1;
  margin-top: 1.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule-firm);
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 1rem clamp(1.75rem, 4vw, 3.5rem);
  align-items: start;
}
.fact {
  display: grid;
  gap: 0.15rem;
  color: var(--ink);
  text-decoration: none;
}
.fact strong {
  font-size: clamp(1.8rem, 2.6vw, 2.2rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.fact span { font-size: var(--fs-small); color: var(--ink-2); line-height: 1.35; max-width: 42ch; }
.fact:hover span { color: var(--ink); }

.areas { display: grid; gap: 0.5rem; align-content: start; }
.areas > span { font-size: var(--fs-small); color: var(--ink-2); line-height: 1.35; }
.areas ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.areas a,
.filters button {
  display: inline-block;
  font: inherit;
  font-size: var(--fs-chip);
  font-weight: 500;
  line-height: 1.6;
  color: var(--ink-2);
  background: none;
  border: 1px solid color-mix(in srgb, var(--ink-3) 82%, var(--bg));
  border-radius: var(--r-pill);
  padding: 0.16rem 0.7rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.areas a:hover,
.filters button:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- rail + content ---------- */

.bar-anchor { height: 1px; margin-top: -1px; }
.tail-anchor { height: 1px; }

.body {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
  margin-top: var(--stack);
}
.rail { position: sticky; top: var(--bar); }
.content { min-width: 0; }

.jump ul { list-style: none; display: grid; gap: 0.1rem; }
.jump a {
  display: block;
  padding: 0.28rem 0 0.28rem 0.85rem;
  border-left: 2px solid transparent;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
}
.jump a:hover { color: var(--ink); }
.jump a.here { color: var(--ink); border-color: var(--accent-pure); }

.band { padding-top: var(--stack); scroll-margin-top: 1.25rem; }
.band:first-child { padding-top: 0; }

.band > h2 {
  font-size: var(--fs-h2);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  padding-top: 0.85rem;
  border-top: 2px solid var(--ink);
  margin-bottom: 1.2rem;
}
.band > h2:has(+ .filterbar) { margin-bottom: 0.8rem; }

/* ---------- news ---------- */

.feed { list-style: none; }
.feed li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 1.4rem;
  padding-block: 0.4rem;
}
.feed li:nth-child(n+6) { display: none; }
.feed .when {
  font-family: var(--mono);
  font-size: var(--fs-meta);
  color: var(--ink-3);
  padding-top: 0.28rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.feed p { font-size: var(--fs-body); color: var(--ink-2); }
.feed strong { color: var(--ink); font-weight: 600; }

/* ---------- research ---------- */

.thread { display: grid; gap: 1.5rem; }
.thread article { max-width: var(--measure); }
.thread h3 {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.thread p { margin-top: 0.6rem; color: var(--ink-2); font-size: var(--fs-body); }

/* ---------- publications ---------- */

.filterbar {
  display: grid;
  gap: 0.9rem;
  justify-items: start;
  margin-bottom: 1.2rem;
}
.filterbar[hidden] { display: none; }
.filters { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.filters button[aria-pressed="true"] {
  background: var(--accent-pure);
  border-color: var(--accent-pure);
  color: var(--on-accent);
}
.filters button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter-note { font-size: var(--fs-small); color: var(--ink-3); }
.filter-note[hidden] { display: none; }

.year-group {
  display: grid;
  grid-template-columns: clamp(3.5rem, 6vw, 5rem) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  padding-block: 1.5rem;
}
.filterbar + .year-group { padding-top: 0; } /* not :first-of-type: .filterbar is the section's first div */
.year-group:last-of-type { padding-bottom: 0; }
.year-group + .year-group { border-top: 1px solid var(--rule); }
.work[hidden] { display: none; } /* .work's display: grid would otherwise override [hidden] */
.year-group.is-hidden { display: none; }
.year-group.is-first { padding-top: 0; border-top: 0; }
.year-group.is-last { padding-bottom: 0; }

.year {
  font-size: var(--fs-key);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.year-group > .year { position: sticky; top: calc(var(--bar) + 0.25rem); align-self: start; }

.works { list-style: none; display: grid; gap: 1.5rem; }

.work {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: 1.5rem;
  align-items: start;
}
.plate { grid-column: 1; grid-row: 1; }
.work > .tags { grid-column: 1; grid-row: 2; }
.work > div { grid-column: 2; grid-row: 1 / span 2; min-width: 0; }

.plate {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--r-plate);
  background: var(--bg-sunken);
  border: 1px solid var(--rule);
}
.plate img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }

.work h3 {
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.022em;
}
.work .abstract { margin-top: 0.5rem; font-size: var(--fs-small); color: var(--ink-2); }
.work .byline { margin-top: 0.7rem; font-size: var(--fs-small); color: var(--ink-2); }
.work .byline strong { color: var(--ink); font-weight: 600; }

.imprint {
  margin-top: 0.4rem;
  font-size: var(--fs-small);
  line-height: 1.5;
}
.imprint > * { margin-right: 0.7rem; } /* keep each .imprint on one source line: whitespace between items renders as a space */
.imprint > *:last-child { margin-right: 0; }
.imprint .where { color: var(--ink); font-weight: 500; }
.imprint .state { color: var(--ink-3); font-style: italic; }
.imprint a:not([href]) { color: var(--ink-3); text-decoration: none; cursor: default; }

.tags { margin-top: 0.4rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li {
  list-style: none;
  font-size: var(--fs-chip);
  font-weight: 500;
  color: var(--ink-2);
  border: 1px solid var(--rule-firm);
  border-radius: var(--r-pill);
  padding: 0.16rem 0.62rem;
  white-space: nowrap;
}

/* ---------- projects ---------- */

.commissions {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem 3rem;
}
.commissions .sponsor {
  display: inline-block;
  font-size: var(--fs-key);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.commissions p { font-size: var(--fs-body); color: var(--ink-2); }

/* ---------- funding ---------- */

.grants { list-style: none; display: grid; gap: 1.1rem; }
.grants li {
  display: grid;
  grid-template-columns: clamp(4.5rem, 8vw, 6.5rem) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: baseline;
}
.grants li > div { min-width: 0; }
.grants .sum {
  font-size: var(--fs-key);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.grants h3 {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.grants .funder { margin-top: 0.3rem; font-size: var(--fs-small); color: var(--ink-2); }
.grants .term {
  margin-left: 0.7rem;
  font-family: var(--mono);
  font-size: var(--fs-meta);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.grants .project { margin-top: 0.25rem; font-size: var(--fs-small); color: var(--ink-3); }

/* ---------- awards ---------- */

.honours {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem 3rem;
}
.honours .stamp {
  display: block;
  font-size: var(--fs-key);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.honours .when {
  margin-left: 0.7rem;
  font-family: var(--mono);
  font-size: var(--fs-meta);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.honours h3 {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.honours p { font-size: var(--fs-small); color: var(--ink-2); margin-top: 0.2rem; }
.honours .project { color: var(--ink-3); }

/* ---------- in progress, colophon, footer ---------- */

.docket { list-style: none; display: grid; gap: 0.8rem; max-width: var(--measure); }
.docket .subject {
  display: block;
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.docket p { font-size: var(--fs-body); color: var(--ink-2); margin-top: 0.15rem; }

.colophon { max-width: var(--measure); }
.colophon p { color: var(--ink-2); font-size: var(--fs-body); }

footer {
  margin-top: var(--stack);
  padding-top: 0.9rem;
  border-top: 2px solid var(--ink);
  font-size: var(--fs-meta);
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
}
footer a { margin-left: auto; }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  .hero .portrait,
  .hero .intro > *,
  .hero .board > * { animation: rise 0.9s var(--ease) backwards; }
  .hero .portrait { animation-delay: 0.05s; }
  .hero .intro h1 { animation-delay: 0.12s; } /* specificity must beat .hero .intro > *, whose shorthand resets the delay */
  .hero .role { animation-delay: 0.2s; }
  .hero .say { animation-delay: 0.28s; }
  .hero .channels { animation-delay: 0.36s; }
  .hero .fact:nth-child(1) { animation-delay: 0.48s; }
  .hero .fact:nth-child(2) { animation-delay: 0.55s; }
  .hero .areas { animation-delay: 0.62s; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
  }
  .portrait img { animation: settle 1.1s var(--ease) 0.05s backwards; }
  .say .key { animation: sweep 0.75s var(--ease) 1s backwards; }
  @keyframes sweep {
    from { background-size: 0 0.44em; }
    to { background-size: 100% 0.44em; }
  }
  @keyframes settle {
    from { opacity: 0; transform: scale(1.05); }
    to { opacity: 1; transform: none; }
  }

  .reveal-ready .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  }
  .reveal-ready .reveal.shown { opacity: 1; transform: none; }
  .reveal-ready .stagger > * {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
    transition-delay: calc(min(var(--i, 0), 7) * 55ms + 90ms);
  }
  .reveal-ready .shown .stagger > * { opacity: 1; transform: none; }

  .jump a { transition: color 0.2s ease, border-color 0.3s var(--ease), background 0.28s var(--ease); }
  .jump a:active, .channels a:active, .areas a:active,
  .filters button:active { transform: translateY(1px); }
  .fact span, .areas a, .filters button {
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  }
}

/* ---------- narrow: the rail becomes the pinned bar ---------- */

@media (max-width: 999px) {
  :root { --bar: 4rem; }
  .body { display: block; }
  .rail { position: static; height: 0; }

  .jump {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    border-bottom: 1px solid transparent;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
  }
  .jump.pinned {
    visibility: visible;
    opacity: 1;
    transform: none;
    border-color: var(--rule);
    background: var(--shell);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    box-shadow: var(--lift);
  }
  @media (prefers-reduced-transparency: reduce) {
    .jump.pinned { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  }
  .jump ul {
    display: flex;
    gap: 0.1rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0.3rem var(--gutter) 0.3rem calc(var(--gutter) - 0.82rem);
  }
  .jump ul::-webkit-scrollbar { display: none; }
  .jump a {
    padding: 0.42rem 0.82rem;
    border-left: 0;
    border-radius: var(--r-pill);
    font-size: var(--fs-meta);
    white-space: nowrap;
  }
  .jump a:hover { background: var(--bg-sunken); }
  .jump a.here { background: var(--accent-pure); color: var(--on-accent); }
  @media (prefers-reduced-motion: no-preference) {
    .jump {
      transition: opacity 0.3s ease, transform 0.35s var(--ease),
                  background 0.35s ease, border-color 0.35s ease,
                  box-shadow 0.35s ease, visibility 0s linear 0.3s;
    }
    .jump.pinned { transition-delay: 0s; }
  }
}

@media (max-width: 700px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; align-items: start; }
  .portrait { max-width: 200px; }
  .say { max-width: none; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; }
  .areas { grid-column: 1 / -1; }
  .feed li { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
  .feed .when { padding-top: 0; }
  .year-group { grid-template-columns: minmax(0, 1fr); gap: 0.8rem; padding-block: 1.6rem; }
  .year-group > .year { position: static; }
  .work { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: 0.9rem; }
  .plate, .work > .tags, .work > div { grid-column: 1; grid-row: auto; }
  .plate { max-width: 340px; }
  .work > .tags { order: 3; margin-top: 0; }
  .work > div { order: 2; }
  .commissions, .honours { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
  .grants li { grid-template-columns: minmax(0, 1fr); gap: 0.3rem; }
}
