/* ============================================================
   Design tokens — "vintage" palette
     navy #0e3a54 · amber #f0c173 · ink #14161a
     slate #3d5a80 · rust #d94f2b · cream #e9e5c4
   ============================================================ */
:root {
  --navy:  #0e3a54;
  --amber: #f0c173;
  --ink:   #14161a;
  --slate: #3d5a80;
  --rust:  #d94f2b;
  --cream: #e9e5c4;

  /* Light theme: cream paper, ink text, rust links, navy headings. */
  --bg:      #faf7ea;
  --surface: #eee9d3;
  --text:    var(--ink);
  --heading: var(--navy);
  --muted:   #5b6a7c;
  --faint:   #8d95a1;
  --rule:    #ded7bd;
  --accent:  #c4462a;

  --max: 48rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark theme: navy-black paper, cream text, amber links. */
    --bg:      #101519;
    --surface: #182533;
    --text:    var(--cream);
    --heading: var(--cream);
    --muted:   #9db0c4;
    --faint:   #6d7c8c;
    --rule:    #24323f;
    --accent:  var(--amber);
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0 1.5rem 6rem;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  transition: border-color .15s, color .15s;
}
a:hover { border-bottom-color: var(--accent); }

em { font-style: italic; }

/* Language switching: every translatable string is duplicated as
   <span class="ko"> / <span class="en">, and one side is hidden. */
html[data-lang="ko"] .en,
html[data-lang="en"] .ko { display: none; }

/* ============================================================
   Site navigation
   ============================================================ */
.sitenav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem 1.25rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 0 .85rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.sitenav .brand {
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--heading);
  border: 0;
}

.sitenav .navlinks {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1rem;
  margin: 0;
  margin-left: auto;
  padding: 0;
  list-style: none;
  font-size: .875rem;
}

.sitenav .navlinks a {
  color: var(--muted);
  border: 0;
}
.sitenav .navlinks a:hover { color: var(--text); }
.sitenav .navlinks a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

.lang-toggle {
  padding: .18rem .6rem;
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.lang-toggle:hover { color: var(--text); border-color: var(--faint); }

/* ============================================================
   Hero (home page)
   ============================================================ */
.hero {
  display: flex;
  gap: 1.75rem;
  align-items: center;
  max-width: var(--max);
  margin: 0 auto;
  padding: 3rem 0 1rem;
}

.avatar {
  flex: none;
  width: 116px;
  height: 116px;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--rule);
}

.hero-text { min-width: 0; }

h1 {
  margin: 0 0 .3rem;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
  color: var(--heading);
}

h1 .latin {
  display: block;
  font-size: .95rem;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--muted);
  margin-top: .2rem;
}

.role { margin: 0; font-weight: 600; color: var(--accent); }

.affils { margin: .35rem 0 0; padding: 0; list-style: none; color: var(--muted); }
.affils li { font-size: .95rem; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .9rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  font-size: .9rem;
}

/* ============================================================
   Page header (subpages)
   ============================================================ */
.pagehead {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3rem 0 .5rem;
}
.pagehead h1 { font-size: 1.75rem; }
.pagehead .sub { margin: .35rem 0 0; color: var(--muted); }

/* ============================================================
   Sections
   ============================================================ */
main { max-width: var(--max); margin: 0 auto; }

section { padding: 2.5rem 0 0; scroll-margin-top: 4.5rem; }

h2 {
  margin: 0 0 1.1rem;
  padding-bottom: .5rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}

h3 {
  margin: 1.75rem 0 .75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
}
h3:first-child { margin-top: 0; }

section p { margin: 0 0 .9rem; }
section p:last-child { margin-bottom: 0; }

.lead { font-size: 1.02rem; }

/* Jump links inside a long page */
.jump {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .9rem;
  max-width: var(--max);
  margin: 1rem auto 0;
  padding: 0;
  list-style: none;
  font-size: .875rem;
  color: var(--muted);
}

/* ============================================================
   Tag pills
   ============================================================ */
.tags { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.tags li {
  padding: .25rem .7rem;
  font-size: .875rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: 999px;
}

/* ============================================================
   Timeline: year on the left, detail on the right
   ============================================================ */
.timeline { margin: 0; padding: 0; list-style: none; }

.timeline li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0 1.25rem;
  padding: .5rem 0;
}

.when {
  padding-top: .12rem;
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.what-title { font-weight: 600; }
.what-sub   { color: var(--muted); font-size: .95rem; }
.what-note  { color: var(--faint); font-size: .875rem; }

/* ============================================================
   Reference lists (publications, talks, books)
   ============================================================ */
.reflist { margin: 0; padding: 0; list-style: none; }

.reflist > li {
  padding: .7rem 0;
  border-top: 1px solid var(--rule);
}
.reflist > li:first-child { border-top: 0; }

.ref-title  { font-weight: 600; }
.ref-meta   { display: block; font-size: .9rem; color: var(--muted); }
.ref-authors{ display: block; font-size: .875rem; color: var(--muted); }
.ref-note   { display: block; font-size: .85rem; color: var(--faint); }

.ref-links { margin-top: .25rem; font-size: .8rem; }
.ref-links a {
  margin-right: .4rem;
  padding: .05rem .45rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.ref-links a:hover { color: var(--accent); border-color: var(--accent); }

/* Year divider inside a reference list */
.yearmark {
  margin: 1.6rem 0 .4rem;
  font-size: .8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .08em;
  color: var(--accent);
}
.yearmark:first-child { margin-top: 0; }

/* Forthcoming items read as pending, not published */
.forthcoming .ref-title { font-weight: 500; color: var(--muted); }

/* ============================================================
   Film entries
   ============================================================ */
.film {
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
}
.film:first-child { border-top: 0; }

.film-title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--heading); }
.film-spec  { margin: .1rem 0 .5rem; font-size: .9rem; color: var(--muted); }

.film ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .9rem;
  color: var(--muted);
}
.film ul li { padding: .12rem 0; }
.film ul li .yr {
  display: inline-block;
  min-width: 3.5rem;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}

/* ============================================================
   Footer
   ============================================================ */
footer {
  max-width: var(--max);
  margin: 4.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: .82rem;
  color: var(--faint);
}
footer p { margin: 0; }

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 38rem) {
  body { padding-left: 1.15rem; padding-right: 1.15rem; }

  .sitenav { padding-top: .75rem; }
  .sitenav .navlinks { margin-left: 0; width: 100%; }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    padding-top: 2.25rem;
  }
  .avatar { width: 92px; height: 92px; }
  h1 { font-size: 1.6rem; }

  .timeline li { grid-template-columns: 1fr; gap: .1rem; }
  .when { order: -1; }

  .film ul li .yr { min-width: 0; margin-right: .5rem; }
}

/* ============================================================
   Print — the pages double as a printable CV
   ============================================================ */
@media print {
  .sitenav, .jump, .ref-links { display: none; }
  body { padding: 0; font-size: 10.5pt; color: #000; background: #fff; }
  a { color: #000; border: 0; }
  .film, .reflist > li { page-break-inside: avoid; }
  h2 { page-break-after: avoid; }
}
