/* ------------------------------------------------------------------
   Jaewon Kim — personal website
   Layout and type adapted from etoilekim.github.io (Scholarly, MIT).
   ------------------------------------------------------------------ */

:root {
  --paper: #ffffff;
  --ink: #1f2328;
  --ink-strong: #111418;
  --muted: #57606a;
  --rule: #e4e7eb;
  --card: #f3f5f7;
  --accent: #1f5fa8;
  --accent-hover: #174a85;
  --accent-soft: #a9c3e2;
  --header-bg: rgb(255 255 255 / 0.9);
  --figure-bg: #ffffff;
  --glow: transparent;
  --serif: var(--sans);
  --sans: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

html.dark {
  --paper: #161918;
  --ink: #f5f1e8;
  --ink-strong: #fbfaf6;
  --muted: #b1b6ad;
  --rule: #383e39;
  --card: #212723;
  --accent: #8ab8ec;
  --accent-hover: #c9e0e5;
  --accent-soft: #4b6a72;
  --header-bg: rgb(22 25 24 / 0.82);
  --figure-bg: #f7f6f2;
  --glow: transparent;
}

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

* { margin: 0; padding: 0; }

html {
  scroll-padding-top: 6.5rem;
  background: var(--paper);
  color-scheme: light;
}
html.dark { color-scheme: dark; }

body {
  min-height: 100dvh;
  background: var(--paper);
  background-image: radial-gradient(circle at 88% -8%, var(--glow), transparent 32rem);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
  transition: background-color .2s, color .2s;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; }

::selection { background: rgb(150 189 201 / 0.55); color: #161918; }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 3px;
}

.skip-link {
  position: fixed; left: 1rem; top: 0; z-index: 100;
  transform: translateY(-120%);
  background: var(--accent); color: #fff;
  padding: .5rem 1rem; border-radius: .5rem;
  font-size: .875rem; font-weight: 700; text-decoration: none;
  transition: transform .2s;
}
.skip-link:focus { transform: translateY(.75rem); }

.wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 2rem;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 40;
  margin: 0 -2rem 1.25rem;
  padding: 0 2rem;
  border-bottom: 1px solid var(--rule);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(10px) saturate(102%);
  backdrop-filter: blur(10px) saturate(102%);
}
.header-row {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 4rem;
}
.site-title {
  font-family: var(--serif);
  font-size: 1.5rem; font-weight: 600; letter-spacing: -.015em;
  color: var(--ink-strong); text-decoration: none;
}
.header-actions { display: flex; align-items: center; gap: .5rem; }
.nav-list { display: flex; align-items: center; gap: .25rem; list-style: none; }
.nav-link {
  display: inline-flex; align-items: center; min-height: 2.75rem;
  padding: 0 .65rem;
  font-size: .875rem; font-weight: 700;
  color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .15s;
}
.nav-link:hover { color: var(--ink); }
.nav-link[aria-current="page"] { color: var(--ink); border-bottom-color: #497d90; }

.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem;
  border: 1px solid transparent; border-radius: .625rem;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.icon-button:hover { background: var(--card); border-color: var(--rule); }
.icon-button svg { width: 1.1rem; height: 1.1rem; }
.icon-sun { display: none; }
html.dark .icon-sun { display: block; }
html.dark .icon-moon { display: none; }

.menu-button { display: none; }
.mobile-menu {
  display: none;
  position: absolute; right: 0; top: calc(100% + .5rem);
  width: 15rem; padding: .5rem;
  border: 1px solid var(--rule); border-radius: .75rem;
  background: var(--paper);
  box-shadow: 0 18px 44px -28px rgb(22 25 24 / .5);
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: flex; align-items: center; min-height: 2.75rem;
  padding: 0 .75rem; border-radius: .625rem;
  font-size: .875rem; font-weight: 700; text-decoration: none; color: var(--ink);
}
.mobile-menu a:hover,
.mobile-menu a[aria-current="page"] { background: var(--card); }

main { flex: 1; }

/* ---------- Shared bits ---------- */

.eyebrow {
  font-size: .75rem; letter-spacing: .15em; text-transform: uppercase;
  font-weight: 700; color: var(--accent);
}

.section-topline {
  display: flex; justify-content: space-between; align-items: baseline; gap: 20px;
  margin-bottom: 25px;
}
.section-topline h2 {
  font-family: var(--serif); font-weight: 500;
  font-size: 2rem; letter-spacing: -.025em; line-height: 1.2;
}
.section-topline > span,
.section-topline > a { font-size: .85rem; color: var(--muted); text-decoration: none; }
.section-topline > a { color: var(--accent); white-space: nowrap; }

.figure-box {
  border: 1px solid var(--rule); border-radius: 5px;
  background: var(--figure-bg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.figure-box img { width: 100%; height: 100%; object-fit: contain; transition: transform .3s; }

/* Placeholder for papers without a figure yet */
.figure-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  padding: 22px;
  background:
    radial-gradient(circle at 85% 15%, rgb(103 154 170 / .16), transparent 55%),
    linear-gradient(135deg, #f4f1ea, #ebe6dc);
  color: #3f4a49;
}
.figure-placeholder span { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #396779; font-weight: 700; }
.figure-placeholder strong { font-family: var(--serif); font-weight: 500; font-size: 1.6rem; line-height: 1.1; letter-spacing: -.02em; }

/* ---------- Home ---------- */

.home-intro {
  display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 70px;
  padding: 52px 0 56px;
  border-bottom: 1px solid var(--rule);
}
.home-intro h1,
.page-intro h1 {
  font-family: var(--serif);
  font-size: clamp(3.3rem, 6.7vw, 5rem);
  line-height: 1.02; letter-spacing: -.04em; font-weight: 500;
  color: var(--ink);
}
.intro-role { font-size: 1rem; color: var(--muted); margin-top: 12px; }
.intro-lead {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.8vw, 2rem);
  line-height: 1.22; letter-spacing: -.018em;
  margin: 30px 0 23px; color: var(--ink);
}
.bio-copy { font-size: 1.035rem; line-height: 1.75; max-width: 650px; color: var(--muted); }
.bio-copy p + p { margin-top: 16px; }
.bio-copy a, .cv-fallback a {
  color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--accent-soft); text-underline-offset: 4px;
}
.bio-copy strong { color: var(--ink); font-weight: 700; }

.profile-links { display: flex; flex-wrap: wrap; gap: 12px 25px; margin-top: 24px; }
.profile-links a {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px;
  font-size: .91rem; font-weight: 700; color: var(--accent); text-decoration: none;
}
.profile-links a:hover { text-decoration: underline; text-underline-offset: 4px; }
.profile-links svg { width: 1rem; height: 1rem; flex: none; }

.portrait-block img { width: 210px; height: auto; border-radius: 5px; }

.research-directions,
.selected-section { padding-top: 38px; }

.directions-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 27px; }
.direction {
  display: block; position: relative;
  border-top: 1px solid var(--rule);
  padding: 20px 23px 12px 0;
  text-decoration: none; color: inherit;
}
.direction-number { font-size: .74rem; letter-spacing: .06em; color: var(--accent); }
.direction h3 {
  font-family: var(--serif); font-weight: 500; font-size: 1.65rem;
  margin: 9px 0 10px; letter-spacing: -.02em;
}
.direction p { font-size: .93rem; line-height: 1.65; color: var(--muted); }
.direction-arrow { position: absolute; right: 0; top: 55px; color: var(--accent); transition: transform .2s; }
.direction:hover .direction-arrow { transform: translate(2px, -2px); }

.selected-section { padding-top: 42px; padding-bottom: 28px; }
.selected-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.selected-card { color: inherit; text-decoration: none; min-width: 0; }
.selected-image { height: 225px; padding: 20px; }
.selected-image.no-pad { padding: 0; }
.selected-card:hover img { transform: scale(1.025); }
.selected-meta {
  display: flex; justify-content: space-between; gap: 16px;
  margin: 17px 0 9px;
  font-size: .72rem; letter-spacing: .035em; color: var(--muted);
}
.selected-meta > span:last-child { color: var(--accent); }
.selected-card h3 {
  font-family: var(--serif); font-weight: 500; font-size: 1.8rem; line-height: 1.2;
  letter-spacing: -.025em;
  display: flex; justify-content: space-between; gap: 12px;
}
.selected-card h3 span { font-family: var(--sans); font-size: 1.05rem; color: var(--accent); }
.selected-card > p { color: var(--muted); font-size: .95rem; margin-top: 9px; }

/* ---------- Publications ---------- */

.page-intro { padding: 42px 0 32px; }
.page-intro h1 { font-size: 4.5rem; margin: 12px 0 18px; }
.page-intro > p:last-child { color: var(--muted); line-height: 1.7; font-size: 1.07rem; }

.project-index {
  display: flex; flex-wrap: wrap; gap: 10px 24px;
  padding-bottom: 27px; border-bottom: 1px solid var(--rule);
}
.project-index a {
  display: inline-flex; align-items: center; gap: 10px; min-height: 32px;
  font-size: .82rem; color: var(--accent); text-decoration: none;
}
.project-index a span { color: var(--muted); }

.research-project {
  display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 46px;
  padding: 48px 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 94px;
}
.research-project:last-child { border-bottom: 0; }
.project-image { height: 240px; padding: 20px; }
.project-image.no-pad { padding: 0; }
.image-caption { display: flex; gap: 12px; padding-top: 12px; color: var(--muted); font-size: .74rem; }
.image-caption > span:first-child { color: var(--accent); }

.venue {
  display: flex; gap: 12px; margin-bottom: 13px;
  font-size: .74rem; font-weight: 700; letter-spacing: .065em; text-transform: uppercase;
  color: var(--accent);
}
.venue > span + span { font-weight: 400; color: var(--muted); }
.project-copy h2 {
  font-family: var(--serif); font-size: 1.87rem; font-weight: 500;
  letter-spacing: -.02em; line-height: 1.16; color: var(--ink);
}
.authors { font-size: .85rem; line-height: 1.65; color: var(--muted); margin-top: 14px; }
.authors strong { font-weight: 700; color: var(--ink); }
.author-note { font-size: .73rem; color: var(--muted); margin-top: 4px; }
.project-question { font-size: 1rem; line-height: 1.6; font-weight: 700; margin-top: 22px; color: var(--ink); }
.project-summary { font-size: .97rem; line-height: 1.75; color: var(--muted); margin-top: 7px; }

.resource-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.resource-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 13px;
  min-height: 38px; padding: 7px 13px;
  border: 1px solid var(--rule); border-radius: 4px;
  font-size: .81rem; font-weight: 700; text-decoration: none; color: var(--accent);
  transition: background .15s;
}
.resource-link:hover { background: var(--card); }
.resource-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.resource-primary:hover { background: var(--accent-hover); color: #fff; }
html.dark .resource-primary { color: #172b34; }
html.dark .resource-primary:hover { color: #172b34; }
.status-note { font-size: .8rem; color: var(--muted); margin-top: 22px; font-style: italic; }

/* ---------- CV ---------- */

.cv-intro { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding-bottom: 16px; }
.cv-intro h1 { margin-bottom: 0; }
.cv-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cv-reader { border: 1px solid var(--rule); border-radius: 5px; overflow: hidden; background: #deddd9; }
html.dark .cv-reader { background: #303632; }
.cv-reader iframe { display: block; width: 100%; height: calc(100dvh - 230px); min-height: 720px; border: 0; }
.cv-fallback { font-size: .8rem; color: var(--muted); margin-top: 14px; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 2.5rem;
  padding: 1.5rem 0 max(1.5rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  font-size: .875rem; color: var(--muted);
  display: flex; justify-content: flex-end;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .home-intro { gap: 38px; grid-template-columns: minmax(0, 1fr) 175px; }
  .portrait-block img { width: 175px; }
  .research-project { grid-template-columns: 250px minmax(0, 1fr); gap: 30px; }
  .project-image { height: 220px; }
}

@media (max-width: 767px) {
  .wrap { padding: 0 1rem; }
  .site-header { margin: 0 -1rem 1.25rem; padding: 0 1rem; }
  .nav-list { display: none; }
  .menu-button { display: inline-flex; }
}

@media (max-width: 640px) {
  .profile-links { gap: 8px 14px; }
  .home-intro { display: flex; flex-direction: column; padding: 26px 0 32px; gap: 26px; }
  .home-intro h1 { font-size: 3.55rem; }
  .intro-lead { font-size: 1.75rem; margin: 23px 0 19px; }
  .bio-copy { font-size: 1rem; }
  .portrait-block img { width: 92px; }
  .directions-grid { grid-template-columns: 1fr; gap: 6px; }
  .direction { padding: 18px 29px 18px 34px; }
  .direction-number { position: absolute; top: 25px; left: 0; }
  .direction h3 { margin: 0 0 7px; }
  .direction-arrow { top: 24px; }
  .section-topline h2 { font-size: 1.8rem; }
  .section-topline > span { display: none; }
  .selected-grid { grid-template-columns: 1fr; gap: 30px; }
  .selected-image { height: 205px; }
  .research-directions, .selected-section { padding-top: 28px; }
  .research-project { grid-template-columns: 1fr; gap: 22px; padding: 32px 0; }
  .project-image { height: 225px; }
  .project-copy h2 { font-size: 1.9rem; }
  .page-intro { padding-top: 25px; }
  .page-intro h1 { font-size: 3.5rem; }
  .page-intro > p:last-child { font-size: 1rem; }
  .cv-intro { align-items: flex-end; padding-bottom: 20px; }
  .cv-actions .resource-link { font-size: .72rem; padding: 6px 10px; gap: 7px; }
  .cv-reader iframe { min-height: 550px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.figure-note { font-size: .74rem; line-height: 1.55; color: var(--muted); margin-top: 6px; }
.figure-note em { font-family: var(--serif); font-size: .9rem; }

/* Three-panel figures with in-figure labels */
.figure-box.strip { display: block; height: auto; padding: 14px 14px 8px; }
.research-thumbnail { display: block; width: 100%; height: auto; }
.fig-label { font-family: var(--sans); font-size: 15px; fill: #4b514d; }
.fig-label-accent { fill: #1f5fa8; font-weight: 700; }
.research-project { grid-template-columns: 380px minmax(0, 1fr); gap: 44px; }
@media (max-width: 900px) { .research-project { grid-template-columns: 300px minmax(0, 1fr); gap: 30px; } }
@media (max-width: 640px) { .research-project { grid-template-columns: 1fr; gap: 22px; } }

/* ---------- Typography: one sans family, modest headings ---------- */
.site-title { font-size: 1.15rem; font-weight: 700; letter-spacing: 0; }
.home-intro h1 { font-size: clamp(2.3rem, 4.2vw, 2.9rem); font-weight: 700; letter-spacing: -.015em; line-height: 1.1; }
.page-intro h1 { font-size: 2.6rem; font-weight: 700; letter-spacing: -.015em; line-height: 1.1; margin: 0 0 14px; }
.intro-role { margin-top: 8px; }
.intro-lead { font-size: 1.3rem; font-weight: 400; line-height: 1.45; letter-spacing: 0; margin: 22px 0 18px; color: var(--ink); }
.section-topline h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.005em; }
.direction h3 { font-size: 1.12rem; font-weight: 700; letter-spacing: 0; margin: 8px 0 8px; }
.selected-card h3 { font-size: 1.2rem; font-weight: 700; letter-spacing: 0; }
.project-copy h2 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.005em; line-height: 1.35; }
.venue { letter-spacing: .04em; }
.figure-placeholder strong { font-size: 1.2rem; font-weight: 700; letter-spacing: 0; }
.nav-link[aria-current="page"] { border-bottom-color: var(--accent); }
@media (max-width: 640px) {
  .home-intro h1 { font-size: 2.3rem; }
  .page-intro h1 { font-size: 2.2rem; }
  .intro-lead { font-size: 1.2rem; }
  .project-copy h2 { font-size: 1.2rem; }
}
.intro-lead { margin: 32px 0 28px; }
/* Lining numerals for dates and years */
body { font-variant-numeric: lining-nums; font-feature-settings: "lnum" 1; }
.fig-label { font-feature-settings: "lnum" 1; }
/* Portrait */
.portrait-block img { border-radius: 6px; }

/* Larger portrait slot for the full, uncropped photo */
.home-intro { grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; }
.portrait-block img { width: 300px; }
@media (max-width: 900px) { .home-intro { grid-template-columns: minmax(0, 1fr) 220px; gap: 38px; } .portrait-block img { width: 220px; } }
@media (max-width: 640px) { .portrait-block img { width: 160px; } }
